On Tue, Jan 14, 2014 at 1:45 PM, Joseph S. Myers <jos...@codesourcery.com> wrote: > On Tue, 14 Jan 2014, H.J. Lu wrote: > >> On Tue, Jan 14, 2014 at 11:37 AM, Joseph S. Myers >> <jos...@codesourcery.com> wrote: >> > On Tue, 14 Jan 2014, H.J. Lu wrote: >> > >> >> When there is -static, -dynamic-linker won't passed to ld. -static, >> >> -shared, -pie should be mutually exclusive for GCC driver. >> > >> > A static PIE shouldn't specify an interpreter; it should handle all >> > dynamic relocation processing itself. Thus, it's correct not to specify >> > -dynamic-linker when building a static PIE. >> >> If -dynamic-linker isn't specified, linker will use >> the default dynamic linker: > > I'd say that's a bug in ld - that it shouldn't specify an interpreter at > all (that the startup code / libc for static PIEs needs to include all the > relevant parts of the dynamic linker to make the binary relocate itself). >
The -static part of "-static -pie" passed to linker tells linker searches libfoo.a, not libfoo.so for -lfoo. You can add -Bdynamic to change it for latter inputs. It has nothing to do if interpreter is used or not. -- H.J.