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.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to