[PATCH] ld: Properly check static link of dynamic object

H.J. Lu hjl.tools@gmail.com
Thu Mar 12 09:36:06 GMT 2020


On Wed, Mar 11, 2020 at 9:19 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Wed, Mar 11, 2020 at 04:57:52PM -0700, H.J. Lu via Binutils wrote:
> > When -static is passed to gcc, gcc passes it to linker before any input
> > files to create static executable.  If -Bdynamic is also passed to linker
> > from command-line, linker should issue an error if dynamic object is used.
>
> I can't say I like the idea of giving -static special meaning when it
> occurs before input files, making its effect sticky.  The sticky
> effect just seems wrong to me and liable to break some project
> somewhere.
>
> PR 24920 is really just a user being surprised when they misuse their
> tools.  That and the default dynamic linker being wrong.  Why not fix
> the x86_64 default dynamic linker?
>

I want to use the generic x86-64 ELF backend for Linux.  I will see
if I can just do -static for x86.

Besides, when -static is passed to GCC driver, I don't think -Wl,-Bdynamic
can completely override it at the linker command-line.

-- 
H.J.



More information about the Binutils mailing list