ld -r
Paul Edwards
mutazilah@gmail.com
Sun May 10 09:00:11 GMT 2020
More information about the Binutils mailing list
Sun May 10 09:00:11 GMT 2020
- Previous message (by thread): Required ELF segments
- Next message (by thread): ld -r
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Why does adding "-r" to "ld" allow the link
to complete without error, even when there
are undefined symbols? Is there an option I
can use to get the link to fail as expected?
Note that I am using "-r" to produce
relocatable executables. See below for example.
Thanks. Paul.
C:\scratch\xxx3>type main.c
int main(void)
{
foo();
}
C:\scratch\xxx3>gcc -c main.c
C:\scratch\xxx3>ld -s main.o
main.o:main.c:(.text+0x7): undefined reference to `__main'
main.o:main.c:(.text+0xc): undefined reference to `foo'
ld: main.o: bad reloc address 0x20 in section `.eh_frame'
ld: final link failed: Invalid operation
C:\scratch\xxx3>ld -r -s main.o
C:\scratch\xxx3>ld -s main.o
main.o:main.c:(.text+0x7): undefined reference to `__main'
main.o:main.c:(.text+0xc): undefined reference to `foo'
ld: main.o: bad reloc address 0x20 in section `.eh_frame'
ld: final link failed: Invalid operation
C:\scratch\xxx3>ld --version
GNU ld (GNU Binutils) 2.23.52.20130309
Copyright 2013 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later
version.
This program has absolutely no warranty.
- Previous message (by thread): Required ELF segments
- Next message (by thread): ld -r
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list