Patches for gcc PR 20218

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Wed, 17 Nov 2010 23:02:11 +0100
Hi,

When I was doing my own ports sort-of-exp-run, using the binutils 2.17
branch, I encountered an issue with the glib20 port on amd64.  Some
files in it failed to link with the error:

relocation R_X86_64_PC32 against `_g_atomic_thread_init' can not be used
when making a shared object; recompile with -fPIC

After some digging, I found this to be due to gcc PR 20218, which boils
down to '__attribute__ ((visibility ("hidden"))) does not work':

   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20218

This is unfortunately *not* yet fixed in our tree.  There is a (GPLv2)
backport of the fix to the 4.2 branch in the PR, but it does not apply
cleanly to our tree, so I have fixed it up, and attached it here as
pr20218.diff.

I have run a "make universe" with this patch, and the only problem I
encountered was with ia64:

===> gnu/lib/libgcc (obj,depend,all,install)
...
building shared library libgcc_s.so.1
unwind-ia64.So(.text+0x1762): In function `_Unwind_FindEnclosingFunction':
: undefined reference to `_Unwind_FindTableEntry'
unwind-ia64.So(.text+0x1d82): In function `uw_frame_state_for':
: undefined reference to `_Unwind_FindTableEntry'
/usr/obj/ia64.ia64/home/dim/src/freebsd/stage/head/tmp/usr/bin/ld:
libgcc_s.so.1: hidden symbol `_Unwind_FindTableEntry' isn't defined
*** Error code 1

It turns out libgcc declares the _Unwind_FindTableEntry() function with
a hidden attribute in contrib/gcc/config/ia64/unwind-ia64.h, which is
fine for the glibc and VMS (!) implementations in that directory.

However, FreeBSD's _Unwind_FindTableEntry() is in libc, so the function
declaration should be stripped of its hidden attribute to make it link.
I have attached a separate patch for this as unwind-ia64.diff.

Please review and test both patches.  There could possibly be some
fallout in ports that do weird things with hidden attributes, as those
attributes have never worked before.  So if they start working again,
some link steps might fall over...

Received on Wed Nov 17 2010 - 21:02:10 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:09 UTC