Bug 38309 - ld defaults to wrong linker script
Summary: ld defaults to wrong linker script
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: binutils
Version: 7.0
Hardware: i386
OS: Linux
medium
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-04-29 12:33 UTC by Need Real Name
Modified: 2007-04-18 16:32 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-04-29 12:34:28 UTC
Embargoed:


Attachments (Terms of Use)
Source file to assemble to find the bug (163 bytes, text/plain)
2001-04-29 12:34 UTC, Need Real Name
no flags Details

Description Need Real Name 2001-04-29 12:33:23 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.2.14-5.0 i686)


When dynamically linking an executable, ld by default specifies
/lib/libc.so.1 as the linker, so you have to specify -dynamic-linker
/lib/ld-linux.so.2 to get ld to build dynamic executables.  gcc does this,
so it's only a problem when running ld manually, but according to the ld
docs, ld should know where it is anyway.

Reproducible: Always
Steps to Reproduce:
1. Create an assembly file that requires symbols from libc
2. assemble it - as test.s -o test.o
3. link it - ld test.o -o test -lc
4. run it - ./test - you will get the message "./test - no such file or
directory"
5. run objdump -s test, you will see a reference to /lib/libc.so.1, which
doesn't exist
6. link it again with - ld test.o -o test -lc -dynamic-linker
/lib/ld-linux.so.2
7. run it - ./test - runs perfectly
	

Actual Results:  You get "./test - no such file or directory"

Expected Results:  The program should have run normally

Comment 1 Need Real Name 2001-04-29 12:34:24 UTC
Created attachment 16766 [details]
Source file to assemble to find the bug

Comment 2 Jakub Jelinek 2001-04-29 13:13:55 UTC
No, ld behaviour is correct, you have to specify -dynamic-linker
(well, even better the gcc driver).
ld documentation is not linux specific and on many targets the
default dynamic linker is appropriate.
The thing is that you're linking for elf_i386 emulation (no
linux mentioned anywhere in that name fyi), and IA32 psABI specifies
the ABI dynamic linker as /usr/lib/libc.so.1.


Note You need to log in before you can comment on or make changes to this bug.