musl: Don't use gthr weak refs in libgcc PR91737

The gthr weak reference based single thread detection is unsafe with
static linking and in case of dynamic linking it's ineffective on musl
since pthread symbols are defined in libc.so.

(Ideally this should be fixed for all targets, since glibc plans to move
libpthread.so into libc.so too and users want to static link to pthread
without --whole-archive: PR87189.)

For now we have to explicitly opt out from the broken behaviour in the
config machinery of each target lib and libgcc was previously missed.

libgcc/ChangeLog:

2019-11-18  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* config.host: Add t-gthr-noweak on *-*-musl*.
	* config/t-gthr-noweak: New file.

From-SVN: r278399
This commit is contained in:
Szabolcs Nagy 2019-11-18 12:08:18 +00:00 committed by Szabolcs Nagy
parent 8d7be8d614
commit 3d3a96a26e
3 changed files with 14 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2019-11-18 Szabolcs Nagy <szabolcs.nagy@arm.com>
* config.host: Add t-gthr-noweak on *-*-musl*.
* config/t-gthr-noweak: New file.
2019-11-17 John David Anglin <danglin@gcc.gnu.org>
* config/pa/linux-atomic.c (__kernel_cmpxchg): Change argument 1 to

View File

@ -1531,3 +1531,10 @@ vxworks)
;;
esac
esac
case ${host} in
*-*-musl*)
# The gthr weak references are unsafe with static linking
tmake_file="$tmake_file t-gthr-noweak"
;;
esac

View File

@ -0,0 +1,2 @@
# Don't use weak references for single-thread detection
HOST_LIBGCC2_CFLAGS += -DGTHREAD_USE_WEAK=0