Re: ld dynamic linker x86-64 ?!



Claudio Daffra <spamtrap@xxxxxxxxxx> wrote:
hi all

hi have compiler a program in this way :

gcc x.c -S -o x.s
as x.s -o x.o
gcc x.o -o x

and work good but with ...

gcc x.c -S -o x.s
as x.s -o x.o
ld -e main -dynamic-linker /lib64/ld-linux-x86-64.so.2 -lc x.o -o x

the program terminate with seg. fault error ?


type
gcc -v x.o -o x. I get:

/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/3.4.4/collect2 --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o x /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /usr/local/lib/gcc/x86_64-unknown-linux-gnu/3.4.4/crtbegin.o -L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/3.4.4 -L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/3.4.4/../../../../lib64 -L/usr/local/lib/gcc/x86_64-unknown-linux-gnu/3.4.4/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 x.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/local/lib/gcc/x86_64-unknown-linux-gnu/3.4.4/crtend.o /usr/lib/../lib64/crtn.o

Note that the compiler links in crt1.o, crti.o, crtbegin.o, crtend.o, crtn.o
besides x.o (and order matters!). Compiled code depends on compiler-specific
runtime libraries (libgcc and libgcc_eh).

BTW: what are you trying to do? If you want to link compiled code then
the compiler know better what extra stuff should be linked in. If you
want to create standalone assembly program you can skip all of this.

--
Waldek Hebisch
hebisch@xxxxxxxxxxxxxxxx

.



Relevant Pages

  • Re: Code size with GCC
    ... I am working on GCC for ARM target.I built one executable with GCC. ... 2.1.Are there any points which i have to keep in mind for code size? ... use the objdump and / or size commands to examine the compiled code, ...
    (comp.sys.arm)
  • Re: gcc 4.1.1 and 16-bit code generation
    ... code using gcc 4.1.1 on a 32-bit ... If it is possible can we execute the resulting compiled code. ... (Maybe you should head over to comp.compilers.gnu for a real answer.) ...
    (comp.lang.c)
  • Re: gcc-4.1.2
    ... I tried binary package for 2.04 under WinXP and seems to work OK. ... Compiled code is a few bytes smaller than gcc 4.1.0 i used before. ...
    (comp.os.msdos.djgpp)
  • Re: gcc 4.1.1 and 16-bit code generation
    ... code using gcc 4.1.1 on a 32-bit ... If it is possible can we execute the resulting compiled code. ... (Maybe you should head over to comp.compilers.gnu for a real answer.) ...
    (comp.lang.c)