Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 1 Oct 2014 22:44:35 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: converting gcc from glibc to musl

* stephen Turner <stephen.n.turner@...il.com> [2014-10-01 15:11:25 -0400]:
> On Wed, Oct 1, 2014 at 2:13 PM, Szabolcs Nagy <nsz@...t70.net> wrote:
> > i meant running
> >
> >  gcc -v test.c
> >
...
> COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i586'
>  /usr/lib/gcc/i486-linux-gnu/4.7/collect2 --sysroot=/ --build-id
> --no-add-needed --eh-frame-hdr -m elf_i386 --hash-style=both
> -dynamic-linker /lib/ld-linux.so.2

this is not a musl based toolchain, it uses the wrong dynamic-linker

> > check if the musl loader is set up as expected:
> >
> >  readelf -l a.out
> >
> > (in case of dynamic linking the interpreter should be
> > /lib/ld-musl-ARCH.so.1 otherwise there should be no
> > interpreter)
> >
> 
> 
> Elf file type is EXEC (Executable file)
> Entry point 0x8048240
> There are 7 program headers, starting at offset 52
> 
> Program Headers:
>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>   PHDR           0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
>   INTERP         0x000114 0x08048114 0x08048114 0x00013 0x00013 R   0x1
>       [Requesting program interpreter: /lib/ld-linux.so.2]

here it should say /lib/ld-musl-$ARCH.so.1

> > ls -l /lib/ld-musl-*
> >
> 
> not exactly, i found /lib/libc.so but no ld-musl* i created a symlink of
> ld-musl* to libc.so and gcc is able to work (initially gcc doesnt work as
> it cant find the lib it needs) but a.out continues to fail.
> 
> > run
> >
> > /lib/ld-musl-ARCH.so.1 ./a.out
> >
> 
> Yes, this works! albiet i used /lib/libc.so
> 

ok so fix your toolchain to pass the right -dynamic-linker
to the linker and it will probably work

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.