bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ld doesn't warn about undefined symbols


From: Jakub Jermar
Subject: ld doesn't warn about undefined symbols
Date: Wed, 02 Nov 2005 18:01:03 +0100
User-agent: Debian Thunderbird 1.0.2 (X11/20051002)

Hi binutils people!

ld (from binutils 2.16) on mipsel doesn't warn about undefined symbols with elf32-little and binary output formats (and possibly others).

When the output format is elf32-tradlittlemips, undefined symbols are reported as expected.

I have created a small test case, wich I attach. You'll only need to adjust your mipsel paths in the Makefile.

To see the undefined symbols in a statically linked ELF binary, take a look at boot.bin after issuing make.

For the impatient, here goes the output from my mipsel nm:

/usr/local/mipsel/bin/mipsel-linux-gnu-nm boot.bin
         U deadbeef
         U _gp_disp
         U __muldf3
00000000 T start
00000020 T test

My project needs to use both binary and elf32-little targets, so it is essential for me to know what is going on.

Note: I use cross-compiled mipsel binutils and gcc. My system is i386.

Best regards,
Jakub
MIPS_BINUTILS_DIR=/usr/local/mipsel/bin
MIPS_TARGET=mipsel-linux-gnu

CC=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-gcc
LD=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-ld

ASFLAGS=-mips2
LFLAGS=-e start -T _link.ld 

.S.o:
        $(CC) $(ASFLAGS) -c -o $@ $<

.c.o:
        $(CC) -msoft-float -c -o $@ $<

boot.bin: boot.o test.o
        $(LD) $(LFLAGS) boot.o test.o -o $@


clean:
        -rm *.o *.bin
OUTPUT_FORMAT(elf32-little)
/*OUTPUT_FORMAT(binary)*/
SECTIONS {
        .image 0x0: AT (0) {
                *(.text);
                *(.reginfo);
        } 
}
.text

.global start
start:
        jal test
        nop

        j start
        nop
extern double test(void);

double test(void)
{
        double e, pi;
        
        e = 2.7;
        pi = 3.14;

        deadbeef();
        
        return e*pi;
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]