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]

LD doesn't complain undefined reference


Hello, everyone:

I have a port of GNU tool chain on OpenRISC (or32-elf).
http://www.opencores.org/projects.cgi/web/or1k/overview

My linker or32-elf-ld didn't complain undefined reference. What
should I check?


Log start:


$ cat main.c

void foo();
int main() { foo(); return 0; }

$ gcc main.c
/cygdrive/c/DOCUME~1/s110/LOCALS~1/Temp/cck3LBzx.o:main.c:(.text+0x2b):
undefined reference to `_foo'
collect2: ld returned 1 exit status

$ or32-elf-gcc --verbose main.c
Reading specs from /usr/local/cross/lib/gcc/or32-elf/3.4.4/specs
Configured with: ../configure --target=or32-elf
--prefix=/usr/local/cross --disable-nls --with-gnu-ld --with-gnu-ls
--enable-languages=c,c++ --with-new-lib
Thread model: single
gcc version 3.4.4
/usr/local/cross/libexec/gcc/or32-elf/3.4.4/cc1.exe -quiet -v main.c
-quiet -dumpbase main.c -auxbase main -version -o
/cygdrive/c/DOCUME~1/s110/LOCALS~1/Temp/ccDF265T.s
ignoring nonexistent directory
"/usr/local/cross/lib/gcc/or32-elf/3.4.4/../../../../or32-elf/sys-include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/cross/lib/gcc/or32-elf/3.4.4/include
/usr/local/cross/lib/gcc/or32-elf/3.4.4/../../../../or32-elf/include
End of search list.
GNU C version 3.4.4 (or32-elf)
      compiled by GNU C version 3.4.4 (cygming special) (gdc 0.12,
using dmd 0.125).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
/usr/local/cross/lib/gcc/or32-elf/3.4.4/../../../../or32-elf/bin/as.exe
-o /cygdrive/c/DOCUME~1/s110/LOCALS~1/Temp/ccA4HgLJ.o
/cygdrive/c/DOCUME~1/s110/LOCALS~1/Temp/ccDF265T.s
/usr/local/cross/libexec/gcc/or32-elf/3.4.4/collect2.exe
/usr/local/cross/lib/gcc/or32-elf/3.4.4/crt0.o
-L/usr/local/cross/lib/gcc/or32-elf/3.4.4
-L/usr/local/cross/lib/gcc/or32-elf/3.4.4/../../../../or32-elf/lib
/cygdrive/c/DOCUME~1/s110/LOCALS~1/Temp/ccA4HgLJ.o -lgcc -lc -lgcc

$ or32-elf-objdump -S a.out

01000218 <_main>:
1000218:       9c 21 ff f4     l.addi r1,r1,0xfffffff4
100021c:       d4 01 10 04     l.sw 0x4(r1),r2
1000220:       9c 41 00 0c     l.addi r2,r1,0xc
1000224:       d4 01 48 00     l.sw 0x0(r1),r9
1000228:       04 00 00 84     l.jal 1000438 <___main>
100022c:       15 00 00 00     l.nop 0x0
1000230:       07 bf ff 74     l.jal 0 <_start_proc-0x1000074>
1000234:       15 00 00 00     l.nop 0x0
1000238:       9c 60 00 00     l.addi r3,r0,0x0
100023c:       d7 e2 1f fc     l.sw 0xfffffffc(r2),r3
1000240:       85 62 ff fc     l.lwz r11,0xfffffffc(r2)
1000244:       85 21 00 00     l.lwz r9,0x0(r1)
1000248:       84 41 00 04     l.lwz r2,0x4(r1)
100024c:       44 00 48 00     l.jr r9
1000250:       9c 21 00 0c     l.addi r1,r1,0xc

Notice that in address 1000230, the program jump to address zero.

--
Tzu-Chien Chiu - SMedia Technology Corp.
URL: http://www.csie.nctu.edu.tw/~jwchiu/


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