armips icon indicating copy to clipboard operation
armips copied to clipboard

Conditional compilation of .importobj doesn't raise an undefined label error when it should

Open Zeturic opened this issue 6 years ago • 1 comments

This is the smallest example I could come up with to show the problem. Imagine this is the contents of test.asm:

.gba
.thumb
.create "test.gba", 0x0

bl foo

.ifdef NOT_DEFINED
.importobj "foo.o"
.endif

.close

foo.o exists and exports the symbol foo.

This should report an error about Undefined label "foo", but it doesn't. It is accepted without complaints.

It does correctly report the error if the .importobj line is commented out or replaced with foo: or a .definelabel for foo. Additionally, if foo.o doesn't actually export foo, it also correctly reports the error (though that's hardly surprising).

Zeturic avatar Jul 22 '18 20:07 Zeturic

The bug also manifests like this:

.gba
.thumb
.create "test.gba", 0x08000000

.ifdef NOT_DEFINED
.importobj "nonexistant.o"
.endif

.close

If nonexistent.o doesn't exist, ARMIPS will nonsensically complain about error: Could not load library.

Since both are caused by ARMIPS reading object files when it shouldn't (or attempting to, in this case), it's probably the same bug.

Zeturic avatar Feb 06 '20 22:02 Zeturic