diff options
author | Felix Fietkau <nbd@openwrt.org> | 2016-01-21 19:00:51 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2016-01-21 19:00:51 +0000 |
commit | db2819bbbbb75264ab6f74897c50acc9939f9c9c (patch) | |
tree | 7bd6742c183566beca8feadf3114c03ec55d36c4 /toolchain/musl/patches/001-eliminate-protected-visibility-data-in-libc.so-with-.patch | |
parent | 6bee06e73ebfff58a563ab294d7267ff1f8dd214 (diff) | |
download | master-187ad058-db2819bbbbb75264ab6f74897c50acc9939f9c9c.tar.gz master-187ad058-db2819bbbbb75264ab6f74897c50acc9939f9c9c.tar.bz2 master-187ad058-db2819bbbbb75264ab6f74897c50acc9939f9c9c.zip |
musl: backport a fix that caused the wrong relocations to be emitted on some architectures
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@48444 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'toolchain/musl/patches/001-eliminate-protected-visibility-data-in-libc.so-with-.patch')
-rw-r--r-- | toolchain/musl/patches/001-eliminate-protected-visibility-data-in-libc.so-with-.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/toolchain/musl/patches/001-eliminate-protected-visibility-data-in-libc.so-with-.patch b/toolchain/musl/patches/001-eliminate-protected-visibility-data-in-libc.so-with-.patch new file mode 100644 index 0000000000..7f6f4277a6 --- /dev/null +++ b/toolchain/musl/patches/001-eliminate-protected-visibility-data-in-libc.so-with-.patch @@ -0,0 +1,55 @@ +From: Rich Felker <dalias@aerifal.cx> +Date: Tue, 29 Sep 2015 02:44:05 +0000 +Subject: [PATCH] eliminate protected-visibility data in libc.so with vis.h + preinclude + +some newer binutils versions print scary warnings about protected data +because most gcc versions fail to produce the right address +references/relocations for such data that might be subject to copy +relocations. originally vis.h explicitly assigned default visibility +to all public data symbols to avoid this issue, but commit +b8dda24fe1caa901a99580f7a52defb95aedb67c removed this treatment for +stdin/out/err to work around a gcc 3.x bug, and since they don't +actually need it (because taking their addresses is not valid C). + +instead, a check for the gcc 3.x bug is added to the configure check +for vis.h preinclude support; this feature will simply be disabled +when using a buggy version of gcc. +--- + +--- a/configure ++++ b/configure +@@ -476,10 +476,18 @@ if test "x$visibility" = xauto ; then + # - the -include option + # - the attributes/pragmas used in vis.h + # - linking code that takes the address of protected symbols ++# - gcc 3.x bug that wrongly claims declarations mismatch + printf "checking whether global visibility preinclude works... " +-echo 'int (*fp)(void);' > "$tmpc" +-echo 'int foo(void) { }' >> "$tmpc" +-echo 'int bar(void) { fp = foo; return foo(); }' >> "$tmpc" ++cat > "$tmpc" <<EOF ++__attribute__((__visibility__("default"))) ++extern struct a *const x; ++typedef struct a b; ++extern b *const x; ++b *const x; ++int (*fp)(void); ++int foo(void) { } ++int bar(void) { fp = foo; return foo(); } ++EOF + if $CC $CFLAGS_C99FSE $CPPFLAGS $CFLAGS \ + -DSHARED -fPIC -I./src/internal -include vis.h \ + -nostdlib -shared -Wl,-Bsymbolic-functions \ +--- a/src/internal/vis.h ++++ b/src/internal/vis.h +@@ -12,6 +12,9 @@ + * exported data symbols. */ + + __attribute__((__visibility__("default"))) ++extern struct _IO_FILE *const stdin, *const stdout, *const stderr; ++ ++__attribute__((__visibility__("default"))) + extern int optind, opterr, optopt, optreset, __optreset, getdate_err, h_errno, daylight, __daylight, signgam, __signgam; + + __attribute__((__visibility__("default"))) |