|
Message-ID: <20170305024403.GK1520@brightrain.aerifal.cx> Date: Sat, 4 Mar 2017 21:44:03 -0500 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: Static PIE with musl and clang On Sat, Mar 04, 2017 at 07:47:31PM -0600, Paul Sturm wrote: > Has anyone managed to build static PIE with musl and clang, > preferably linking with lld? > > I see that this has been done using GCC and rcrt1.o, but I cannot > find a combination of command line parameters that will successfully > link and execute with clang. > > I am using clang 4.0.0RC2 and musl 1.1.16. I have also tried to use > binutils ld instead of llvm lld to no avail. I doubt lld can do it yet; you need some equivalent of the --no-dynamic-linker option I added to BFD ld. It should be possible with clang using binutils/BFD ld. You might also be able to hack it by using -shared -Bsymbolic and explicitly linking rcrt1.o on the link command line (essentially doing the same thing you'd do to make an executable shared library) but there are corner-case things that break when you try to do it this way. The right approach would be adding --no-dynamic-linker to lld and teaching clang to pass it when linking with -static -pie. Rich
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.