bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/22269] Undefined weak symbols isn't resolved to 0 in static PIE


From: amodra at gmail dot com
Subject: [Bug ld/22269] Undefined weak symbols isn't resolved to 0 in static PIE
Date: Tue, 10 Oct 2017 23:14:14 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=22269

--- Comment #9 from Alan Modra <amodra at gmail dot com> ---
> Since call is PC relative, this doesn't branch to address 0.

I don't see why this matters.  A symbol that resolves to zero without dynamic
relocs in a PIE or shared lib results in an address of zero.  If that zero is
in a PC-relative instruction then you get zero relative to the shared library
or PIE base.  Typical code for dealing with weakly defined functions like
  if (foo)
    foo ();
will give you a load of zero (absolute) on the condition, but a relative zero
for the call.

> This doesn't work with
> 
> -pie --no-dynamic-linker -z dynamic-undefined-weak

Define "doesn't work".  I would have said that combination of options ought to
result in a dynamic reloc for "func" on the original testcase.  Which is what
powerpc will do.  It may not work in the runtime environment for static PIE,
but that's a different issue.  By passing -z dynamic-undefined-weak you asked
for dynamic relocs!

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]