openwrt/toolchain/gcc/patches/4.6-linaro/850-use_shared_libgcc.patch
Felix Fietkau 06a3d35eda gcc: fix visibility of symbols libgcc.a
Symbols need to be hidden, even for the static variant

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 39749
2014-02-24 21:09:37 +00:00

87 lines
2.5 KiB
Diff

--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -115,10 +115,6 @@
#define ENDFILE_SPEC \
LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
- do not use -lfloat. */
-#undef LIBGCC_SPEC
-
/* Clear the instruction cache from `beg' to `end'. This is
implemented in lib1funcs.asm, so ensure an error if this definition
is used. */
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -60,8 +60,6 @@
%{shared:-lc} \
%{!shared:%{profile:-lc_p}%{!profile:-lc}}"
-#define LIBGCC_SPEC "-lgcc"
-
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
#define LINUX_TARGET_LINK_SPEC "%{h*} \
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -52,6 +52,10 @@ see the files COPYING3 and COPYING.RUNTI
builtin_assert ("system=posix"); \
} while (0)
+#ifndef LIBGCC_SPEC
+#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
+#endif
+
/* Determine which dynamic linker to use depending on whether GLIBC or
uClibc or Bionic is the default C library and whether
-muclibc or -mglibc or -mbionic has been passed to change the default. */
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -88,6 +88,8 @@
#define USE_LD_AS_NEEDED 1
#endif
+#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
+
#undef TARGET_VERSION
#define TARGET_VERSION fprintf (stderr, " (PowerPC GNU/Linux)");
--- a/gcc/mkmap-symver.awk
+++ b/gcc/mkmap-symver.awk
@@ -132,5 +132,5 @@ function output(lib) {
else if (inherit[lib])
printf("} %s;\n", inherit[lib]);
else
- printf ("\n local:\n\t*;\n};\n");
+ printf ("\n\t*;\n};\n");
}
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -269,6 +269,12 @@ ifeq ($(enable_shared),yes)
install-libunwind = install-libunwind
endif
+else
+# Not enable_shared.
+iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
+endif
+
+
# For -fvisibility=hidden. We need both a -fvisibility=hidden on
# the command line, and a #define to prevent libgcc2.h etc from
# overriding that with #pragmas.
@@ -291,13 +297,6 @@ else
gen-hide-list = echo > $@
endif
-else
-# Not enable_shared.
-iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
-vis_hide =
-gen-hide-list = echo > \$@
-endif
-
ifneq ($(EXTRA_PARTS),)
extra-parts = libgcc-extra-parts
INSTALL_PARTS = $(EXTRA_PARTS)