This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gas: undefined symbol in immediate operand


Hi Jeremy,

I'm using a pre-built ARM toolchain (supplied with an embedded development
system) running on Windows under cygwin.

I think that you must have an old version of the ARM assembler. The current versions definitely do report an error for the use of an undefined symbol as an immediate operand.


We've also tried this on a more recent PowerPC toolchain, this time running
on Linux and get a similar result:

The objdump output shows that the assembler hasn't created a relocation
entry for the undefined "moo" symbol,

What objdump output ? When I tried running objdump I saw this:


$ objdump -Dr test.o

test.o: file format elf32-powerpc

Disassembly of section .text:

  00000000 <_start>:
     0:   3f e0 00 00     lis     r31,0
                        2: R_PPC_ADDR16_HI      moo
     4:   3f e0 ff 00     lis     r31,-256
     8:   4e 80 00 20     blr

Which clearly does show the reloc against symbol "moo". Furthermore, when I tried to link this object file, I received an error message:

  $ ld test.o
  test.o: In function `_start':
  (.text+0x2): undefined reference to `moo'

This is which an assembler and linker compiled from today's binutils sources.

Cheers
  Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]