Browse Source

gcc: update to version 7.4.0, Add config options

for coping libc.a, libpthread.a and libstdc++ to target.
Add config option to eliminate need for -lstdc++ and -lgcc_pic
switches when linking statically

Signed-off-by: Noble Pepper <noblepepper@gmail.com>
lilik-openwrt-22.03
Noble Pepper 5 years ago
committed by Rosen Penev
parent
commit
5caa181b17
No known key found for this signature in database GPG Key ID: 36D31CFA845F0E3B
46 changed files with 644 additions and 1373 deletions
  1. +34
    -0
      devel/gcc/Config.in
  2. +70
    -27
      devel/gcc/Makefile
  3. +3
    -3
      devel/gcc/README
  4. +13
    -1
      devel/gcc/patches/001-revert_register_mode_search.patch
  5. +10
    -0
      devel/gcc/patches/002-case_insensitive.patch
  6. +0
    -38
      devel/gcc/patches/003-mpfr-longlong-mips.patch
  7. +13
    -1
      devel/gcc/patches/010-documentation.patch
  8. +0
    -28
      devel/gcc/patches/020-no-plt-backport.patch
  9. +0
    -23
      devel/gcc/patches/040-fix-mips-ICE-PR-68400.patch
  10. +0
    -33
      devel/gcc/patches/100-uclibc-conf.patch
  11. +20
    -0
      devel/gcc/patches/110-Fix-MIPS-PR-84790.patch
  12. +0
    -309
      devel/gcc/patches/200-musl_config.patch
  13. +0
    -43
      devel/gcc/patches/201-musl_arm.patch
  14. +0
    -35
      devel/gcc/patches/202-musl_mips.patch
  15. +0
    -209
      devel/gcc/patches/203-musl_powerpc.patch
  16. +0
    -39
      devel/gcc/patches/204-musl_sh.patch
  17. +0
    -41
      devel/gcc/patches/205-musl_x86.patch
  18. +0
    -31
      devel/gcc/patches/206-musl_aarch64.patch
  19. +0
    -30
      devel/gcc/patches/207-musl_fixincludes.patch
  20. +0
    -72
      devel/gcc/patches/209-musl_libstdc++.patch
  21. +16
    -1
      devel/gcc/patches/230-musl_libssp.patch
  22. +0
    -61
      devel/gcc/patches/240-musl-libitm-fixes.patch
  23. +0
    -120
      devel/gcc/patches/250-add-musl.patch
  24. +0
    -24
      devel/gcc/patches/270-musl-add-powerpc-softfloat-fix.patch
  25. +10
    -3
      devel/gcc/patches/300-mips_Os_cpu_rtx_cost_model.patch
  26. +22
    -1
      devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch
  27. +9
    -1
      devel/gcc/patches/810-arm-softfloat-libgcc.patch
  28. +12
    -4
      devel/gcc/patches/820-libgcc_pic.patch
  29. +0
    -13
      devel/gcc/patches/830-arm_unbreak_armv4t.patch
  30. +10
    -1
      devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch
  31. +10
    -3
      devel/gcc/patches/850-use_shared_libgcc.patch
  32. +10
    -0
      devel/gcc/patches/851-libgcc_no_compat.patch
  33. +8
    -1
      devel/gcc/patches/870-ppc_no_crtsavres.patch
  34. +0
    -11
      devel/gcc/patches/880-no_java_section.patch
  35. +22
    -0
      devel/gcc/patches/881-no_tm_section.patch
  36. +21
    -0
      devel/gcc/patches/900-bad-mips16-crt.patch
  37. +19
    -95
      devel/gcc/patches/910-mbsd_multi.patch
  38. +11
    -4
      devel/gcc/patches/920-specs_nonfatal_getenv.patch
  39. +3
    -3
      devel/gcc/patches/930-fix-mips-noexecstack.patch
  40. +0
    -13
      devel/gcc/patches/930-osdefines.patch
  41. +175
    -0
      devel/gcc/patches/931-libffi-fix-MIPS-softfloat-build-issue.patch
  42. +23
    -1
      devel/gcc/patches/940-no-clobber-stamp-bits.patch
  43. +27
    -28
      devel/gcc/patches/950-cpp_file_path_translation.patch
  44. +0
    -11
      devel/gcc/patches/960-go_libm.patch
  45. +73
    -0
      devel/gcc/patches/960-gotools-fix-compilation-when-making-cross-compiler.patch
  46. +0
    -11
      devel/gcc/patches/970-warn_bug.patch

+ 34
- 0
devel/gcc/Config.in View File

@ -0,0 +1,34 @@
# gcc library configuration
menu "Libraries"
depends on PACKAGE_gcc
config INCLUDE_STATIC_LIBC
bool "Include static libc on target"
help
Copies libc.a to target device
Increases the size of an already
very large package
default n
config INCLUDE_STATIC_LIBPTHREAD
bool "Include static libptread on target"
help
Copies libpthread.a to target device
Increases the size of an already
very large package
default n
config INCLUDE_STATIC_LIBSTDC
bool "Include static libstdc++ on target"
help
Copies libstdc++.a to target device
Increases the size of an already
very large package
default n
config INCLUDE_STATIC_LINK_SPEC
depends on INCLUDE_STATIC_LIBSTDC
bool "Generate spec file for easy static c++ linking on target"
help
Creates a spec file for gcc to eliminate the need for
-lstdc++, libgcc_pic and -static-libstdc flags when
statically linking c++ programs
default n
endmenu

+ 70
- 27
devel/gcc/Makefile View File

@ -6,19 +6,61 @@
#
include $(TOPDIR)/rules.mk
define Package/gcc/description
Build a native toolchain for compiling on target
device.
endef
define Package/gcc
SECTION:=devel
CATEGORY:=Development
TITLE:=gcc
MAINTAINER:=Noble Pepper <gccmaintain@noblepepper.com>
DEPENDS:= +binutils +libstdcpp @!arc
MENU:=1
endef
PKG_NAME:=gcc
PKG_VERSION:=5.4.0
PKG_RELEASE:=3
# PKG_VERSION=7.3.0
PKG_VERSION=7.4.0
PKG_RELEASE:=4
PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
PKG_HASH:=608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_INSTALL:=1
PKG_FIXUP:=libtool
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
ifeq ($(PKG_VERSION),7.3.0)
PKG_HASH:=832ca6ae04636adbb430e865a1451adf6979ab44ca1c8374f61fba65645ce15c
endif
ifeq ($(PKG_VERSION),7.4.0)
PKG_HASH:=eddde28d04f334aec1604456e536416549e9b1aa137fc69204e65eb0c009fe51
endif
define Package/gcc/config
source "$(SOURCE)/Config.in"
endef
ifeq ($(CONFIG_INCLUDE_STATIC_LIBC),y)
COPY_STATIC_LIBC=cp -a $(TOOLCHAIN_DIR)/lib/libc.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
endif
ifeq ($(CONFIG_INCLUDE_STATIC_LIBPTHREAD),y)
COPY_STATIC_LIBPTHREAD=cp -a $(TOOLCHAIN_DIR)/lib/libpthread.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
endif
ifeq ($(CONFIG_INCLUDE_STATIC_LIBSTDC),y)
COPY_STATIC_LIBSTDC=cp -a $(TOOLCHAIN_DIR)/lib/libstdc++.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
endif
ifeq ($(CONFIG_INCLUDE_STATIC_LINK_SPEC),y)
INSTALL_STATIC_SPEC=g++ -dumpspecs |sed s/--start-group}\ %G\ %L\ /--start-group}\ %G\ %L\ -lstdc++\ -lgcc_pic\ / >/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/specs
REMOVE_STATIC_SPEC=rm /usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/specs
endif
include $(INCLUDE_DIR)/package.mk
TARGET_LANGUAGES:="c,c++"
BUGURL=https://dev.openwrt.org/
PKGVERSION=OpenWrt GCC $(PKG_VERSION)
@ -37,43 +79,30 @@ ifneq ($(CONFIG_SOFT_FLOAT),y)
ARM_FLOAT_OPTION:= --with-float=hard
endif
endif
define Package/gcc
SECTION:=devel
CATEGORY:=Development
TITLE:=gcc
MAINTAINER:=Noble Pepper <gccmaintain@noblepepper.com>
DEPENDS:= +binutils +libstdcpp
endef
define Package/gcc/description
build a native toolchain for compiling on target
endef
GMPSRC=gmp-4.3.2
GMPSRC=gmp-6.1.0
define Download/gmp
URL:=ftp://gcc.gnu.org/pub/gcc/infrastructure/
FILE:=$(GMPSRC).tar.bz2
HASH:=936162c0312886c21581002b79932829aa048cfaf9937c6265aeaa14f1cd1775
HASH:=498449a994efeba527885c10405993427995d3f86b8768d8cdf8d9dd7c6b73e8
endef
$(eval $(call Download,gmp))
MPCSRC=mpc-0.8.1
MPCSRC=mpc-1.0.3
define Download/mpc
URL:=ftp://gcc.gnu.org/pub/gcc/infrastructure/
FILE:=$(MPCSRC).tar.gz
HASH:=e664603757251fd8a352848276497a4c79b7f8b21fd8aedd5cc0598a38fee3e4
HASH:=617decc6ea09889fb08ede330917a00b16809b8db88c29c31bfbb49cbf88ecc3
endef
$(eval $(call Download,mpc))
MPFRSRC=mpfr-2.4.2
MPFRSRC=mpfr-3.1.4
define Download/mpfr
URL:=ftp://gcc.gnu.org/pub/gcc/infrastructure/
FILE:=$(MPFRSRC).tar.bz2
HASH:=c7e75a08a8d49d2082e4caee1591a05d11b9d5627514e678f02d66a124bcf2ba
HASH:=d3103a80cdad2407ed581f3618c4bed04e0c92d1cf771a65ead662cc397f7775
endef
$(eval $(call Download,mpfr))
@ -90,11 +119,11 @@ define Build/Prepare
# poor man's fix for `none-openwrt-linux' not recognized when building with musl
cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpfr/
cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/gmp/
chmod u+w $(PKG_BUILD_DIR)/mpc/config.sub
cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpc/
endef
TARGET_CXX += -std=gnu++03
CONFIGURE_ARGS += CXX_FOR_TARGET="$(TARGET_CXX)" CXXFLAGS_FOR_TARGET="-g -O2 -D_GLIBCXX_INCLUDE_NEXT_C_HEADERS"
CONFIGURE_ARGS += CXXFLAGS_FOR_TARGET="-g -O2 -D_GLIBCXX_INCLUDE_NEXT_C_HEADERS"
define Build/Configure
(cd $(PKG_BUILD_DIR); rm -f config.cache; \
@ -128,6 +157,7 @@ define Build/Configure
--prefix=/usr \
--libexecdir=/usr/lib \
--with-local-prefix=/usr \
--with-stage1-ldflags=-lstdc++ \
$(ARM_FLOAT_OPTION) \
$(SOFT_FLOAT_CONFIG_OPTION) \
$(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
@ -149,7 +179,7 @@ ifeq ($(CONFIG_SOFT_FLOAT),y)
endif
ENVCFLAGS+="
ENVLDFLAGS:="-Wl,-rpath=/usr/lib -Wl,--dynamic-linker=/usr/lib/$(DYNLINKER) -L/usr/lib"
ENVLDFLAGS:="-Wl,-rpath=/usr/lib -Wl,--dynamic-linker=/usr/lib/$(DYNLINKER) -L/usr/lib, -lstdc++"
define Package/gcc/install
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
@ -165,6 +195,9 @@ define Package/gcc/install
cp -a $(TOOLCHAIN_DIR)/lib/*.{o,so*} $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
cp -a $(TOOLCHAIN_DIR)/lib/*nonshared*.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
cp -a $(TOOLCHAIN_DIR)/lib/libm.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
$(COPY_STATIC_LIBC)
$(COPY_STATIC_LIBPTHREAD)
$(COPY_STATIC_LIBSTDC)
rm -f $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/libgo*
rm -f $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/libcc1*
echo '#!/bin/sh' > $(1)/usr/bin/gcc_env.sh
@ -173,4 +206,14 @@ define Package/gcc/install
chmod +x $(1)/usr/bin/gcc_env.sh
endef
define Package/gcc/postinst
#!/bin/sh
$(INSTALL_STATIC_SPEC)
endef
define Package/gcc/postrm
#!/bin/sh
$(REMOVE_STATIC_SPEC)
endef
$(eval $(call BuildPackage,gcc))

+ 3
- 3
devel/gcc/README View File

@ -1,8 +1,8 @@
Native GCC that runs on target.
To save disk space, this GCC only supports dynamic linking on the target box,
there are no static libraries shipped except libgcc.a on those architectures
that need it.
To save disk space, this GCC uses dynamic linking on the target box. There
are configuration options to include libstdc++.a, libc.a and libpthread.a
if staticly linked binaries are needed.
For now, this was only tested on arm (EABI) and mips targets. Others to be
done...


+ 13
- 1
devel/gcc/patches/001-revert_register_mode_search.patch View File

@ -1,3 +1,15 @@
commit 31285a20390a5e53a74a2a71d1b5c82f366ddd5a
Author: Felix Fietkau <nbd@openwrt.org>
Date: Tue May 6 11:49:05 2014 +0000
gcc: revert an upstream patch that is causing a regression on powerpc
https://forum.openwrt.org/viewtopic.php?pid=232494#p232494
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 40709
Revert of:
commit 275035b56823b26d5fb7e90fad945b998648edf2
@ -14,7 +26,7 @@ Date: Thu Sep 5 14:09:07 2013 +0000
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -665,35 +665,40 @@ choose_hard_reg_mode (unsigned int regno
@@ -637,35 +637,40 @@ choose_hard_reg_mode (unsigned int regno
mode = GET_MODE_WIDER_MODE (mode))
if ((unsigned) hard_regno_nregs[regno][mode] == nregs
&& HARD_REGNO_MODE_OK (regno, mode)


+ 10
- 0
devel/gcc/patches/002-case_insensitive.patch View File

@ -1,3 +1,13 @@
commit 81cc26c706b2bc8c8c1eb1a322e5c5157900836e
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun Oct 19 21:45:51 2014 +0000
gcc: do not assume that the Mac OS X filesystem is case insensitive
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 42973
--- a/include/filenames.h
+++ b/include/filenames.h
@@ -43,11 +43,6 @@ extern "C" {


+ 0
- 38
devel/gcc/patches/003-mpfr-longlong-mips.patch View File

@ -1,38 +0,0 @@
diff -Naurd mpfr-2.4.2-a/mpfr-longlong.h mpfr-2.4.2-b/mpfr-longlong.h
--- -a/mpfr-2.4.2/mpfr-longlong.h 2009-11-30 02:43:08.000000000 +0000
+++ -b/mpfr-2.4.2/mpfr-longlong.h 2009-12-18 12:04:29.000000000 +0000
@@ -1011,7 +1011,15 @@
#endif /* __m88000__ */
#if defined (__mips) && W_TYPE_SIZE == 32
-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
+#if (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ UDItype _r; \
+ _r = (UDItype) u * v; \
+ (w1) = _r >> 32; \
+ (w0) = (USItype) _r; \
+ } while (0)
+#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("multu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
#else
@@ -1024,7 +1032,16 @@
#endif /* __mips */
#if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
+#if (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
+typedef unsigned int UTItype __attribute__ ((mode (TI)));
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ UTItype _r; \
+ _r = (UTItype) u * v; \
+ (w1) = _r >> 64; \
+ (w0) = (UDItype) _r; \
+ } while (0)
+#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("dmultu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
#else

+ 13
- 1
devel/gcc/patches/010-documentation.patch View File

@ -1,6 +1,18 @@
commit 098bd91f5eae625c7d2ee621e10930fc4434e5e2
Author: Luka Perkov <luka@openwrt.org>
Date: Tue Feb 26 16:16:33 2013 +0000
gcc: don't build documentation
This closes #13039.
Signed-off-by: Luka Perkov <luka@openwrt.org>
SVN-Revision: 35807
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2941,18 +2941,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
@@ -3121,18 +3121,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
doc/gccint.info: $(TEXI_GCCINT_FILES)
doc/cppinternals.info: $(TEXI_CPPINT_FILES)


+ 0
- 28
devel/gcc/patches/020-no-plt-backport.patch View File

@ -1,28 +0,0 @@
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -225,6 +225,12 @@ prepare_call_address (tree fndecl_or_typ
&& targetm.small_register_classes_for_mode_p (FUNCTION_MODE))
? force_not_mem (memory_address (FUNCTION_MODE, funexp))
: memory_address (FUNCTION_MODE, funexp));
+ else if (flag_pic && !flag_plt && fndecl_or_type
+ && TREE_CODE (fndecl_or_type) == FUNCTION_DECL
+ && !targetm.binds_local_p (fndecl_or_type))
+ {
+ funexp = force_reg (Pmode, funexp);
+ }
else if (! sibcallp)
{
#ifndef NO_FUNCTION_CSE
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1779,6 +1779,10 @@ fpie
Common Report Var(flag_pie,1) Negative(fPIC)
Generate position-independent code for executables if possible (small mode)
+fplt
+Common Report Var(flag_plt) Init(1)
+Use PLT for PIC calls (-fno-plt: load the address from GOT at call site)
+
fplugin=
Common Joined RejectNegative Var(common_deferred_options) Defer
Specify a plugin to load

+ 0
- 23
devel/gcc/patches/040-fix-mips-ICE-PR-68400.patch View File

@ -1,23 +0,0 @@
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -8001,9 +8001,17 @@ mask_low_and_shift_p (machine_mode mode,
bool
and_operands_ok (machine_mode mode, rtx op1, rtx op2)
{
- return (memory_operand (op1, mode)
- ? and_load_operand (op2, mode)
- : and_reg_operand (op2, mode));
+ if (!memory_operand (op1, mode))
+ return and_reg_operand (op2, mode);
+
+ if (!and_load_operand (op2, mode))
+ return false;
+
+ if (!TARGET_MIPS16 || si_mask_operand(op2, mode))
+ return true;
+
+ op1 = XEXP (op1, 0);
+ return !(REG_P (op1) && REGNO (op1) == STACK_POINTER_REGNUM);
}
/* The canonical form of a mask-low-and-shift-left operation is

+ 0
- 33
devel/gcc/patches/100-uclibc-conf.patch View File

@ -1,33 +0,0 @@
--- a/contrib/regression/objs-gcc.sh
+++ b/contrib/regression/objs-gcc.sh
@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
then
make all-gdb all-dejagnu all-ld || exit 1
make install-gdb install-dejagnu install-ld || exit 1
+elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
+ then
+ make all-gdb all-dejagnu all-ld || exit 1
+ make install-gdb install-dejagnu install-ld || exit 1
elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
make bootstrap || exit 1
make install || exit 1
--- a/libjava/classpath/ltconfig
+++ b/libjava/classpath/ltconfig
@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
case $host_os in
-linux-gnu*) ;;
+linux-gnu*|linux-uclibc*) ;;
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
esac
@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
;;
# This must be Linux ELF.
-linux-gnu*)
+linux*)
version_type=linux
need_lib_prefix=no
need_version=no

+ 20
- 0
devel/gcc/patches/110-Fix-MIPS-PR-84790.patch View File

@ -0,0 +1,20 @@
Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790.
MIPS16 functions have a static assembler prologue which clobbers
registers v0 and v1. Add these register clobbers to function call
instructions.
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -3098,6 +3098,12 @@ mips_emit_call_insn (rtx pattern, rtx or
emit_insn (gen_update_got_version ());
}
+ if (TARGET_MIPS16 && TARGET_USE_GOT)
+ {
+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS16_PIC_TEMP);
+ clobber_reg (&CALL_INSN_FUNCTION_USAGE (insn), MIPS_PROLOGUE_TEMP (word_mode));
+ }
+
if (TARGET_MIPS16
&& TARGET_EXPLICIT_RELOCS
&& TARGET_CALL_CLOBBERED_GP)

+ 0
- 309
devel/gcc/patches/200-musl_config.patch View File

@ -1,309 +0,0 @@
From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 8 May 2015 08:25:47 +0000 (+0000)
Subject: [PATCH 2/13] musl libc config
X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=a9173ceabaf29c16f8ef226fbf98af373a4b2ceb
[PATCH 2/13] musl libc config
2015-05-08 Gregor Richards <gregor.richards@uwaterloo.ca>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* config.gcc (LIBC_MUSL): New tm_defines macro.
* config/linux.h (OPTION_MUSL): Define.
(MUSL_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER32,)
(MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32,)
(INCLUDE_DEFAULTS_MUSL_GPP, INCLUDE_DEFAULTS_MUSL_LOCAL,)
(INCLUDE_DEFAULTS_MUSL_PREFIX, INCLUDE_DEFAULTS_MUSL_CROSS,)
(INCLUDE_DEFAULTS_MUSL_TOOL, INCLUDE_DEFAULTS_MUSL_NATIVE): Define.
* config/linux.opt (mmusl): New option.
* doc/invoke.texi (GNU/Linux Options): Document -mmusl.
* configure.ac (gcc_cv_libc_provides_ssp): Add *-*-musl*.
(gcc_cv_target_dl_iterate_phdr): Add *-linux-musl*.
* configure: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222904 138bc75d-0d04-0410-961f-82ee72b054a4
---
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -575,7 +575,7 @@ case ${target} in
esac
# Common C libraries.
-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
# 32-bit x86 processors supported by --with-arch=. Each processor
# MUST be separated by exactly one space.
@@ -720,6 +720,9 @@ case ${target} in
*-*-*uclibc*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
;;
+ *-*-*musl*)
+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
+ ;;
*)
tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
;;
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -32,10 +32,12 @@ see the files COPYING3 and COPYING.RUNTI
#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
#else
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
#define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
+#define OPTION_MUSL (linux_libc == LIBC_MUSL)
#endif
#define GNU_USER_TARGET_OS_CPP_BUILTINS() \
@@ -50,21 +52,25 @@ see the files COPYING3 and COPYING.RUNTI
} while (0)
/* 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. */
+ uClibc or Bionic or musl is the default C library and whether
+ -muclibc or -mglibc or -mbionic or -mmusl has been passed to change
+ the default. */
-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3) \
- "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
+#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4) \
+ "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
#if DEFAULT_LIBC == LIBC_GLIBC
-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
- CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
+ CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
#elif DEFAULT_LIBC == LIBC_UCLIBC
-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
- CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
+ CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
#elif DEFAULT_LIBC == LIBC_BIONIC
-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
- CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
+ CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
+#elif DEFAULT_LIBC == LIBC_MUSL
+#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
+ CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
#else
#error "Unsupported DEFAULT_LIBC"
#endif /* DEFAULT_LIBC */
@@ -81,24 +87,100 @@ see the files COPYING3 and COPYING.RUNTI
#define BIONIC_DYNAMIC_LINKER32 "/system/bin/linker"
#define BIONIC_DYNAMIC_LINKER64 "/system/bin/linker64"
#define BIONIC_DYNAMIC_LINKERX32 "/system/bin/linkerx32"
+/* Should be redefined for each target that supports musl. */
+#define MUSL_DYNAMIC_LINKER "/dev/null"
+#define MUSL_DYNAMIC_LINKER32 "/dev/null"
+#define MUSL_DYNAMIC_LINKER64 "/dev/null"
+#define MUSL_DYNAMIC_LINKERX32 "/dev/null"
#define GNU_USER_DYNAMIC_LINKER \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
- BIONIC_DYNAMIC_LINKER)
+ BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
#define GNU_USER_DYNAMIC_LINKER32 \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
- BIONIC_DYNAMIC_LINKER32)
+ BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
#define GNU_USER_DYNAMIC_LINKER64 \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
- BIONIC_DYNAMIC_LINKER64)
+ BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
#define GNU_USER_DYNAMIC_LINKERX32 \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
- BIONIC_DYNAMIC_LINKERX32)
+ BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
/* Whether we have Bionic libc runtime */
#undef TARGET_HAS_BIONIC
#define TARGET_HAS_BIONIC (OPTION_BIONIC)
+/* musl avoids problematic includes by rearranging the include directories.
+ * Unfortunately, this is mostly duplicated from cppdefault.c */
+#if DEFAULT_LIBC == LIBC_MUSL
+#define INCLUDE_DEFAULTS_MUSL_GPP \
+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
+
+#ifdef LOCAL_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_LOCAL \
+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
+#else
+#define INCLUDE_DEFAULTS_MUSL_LOCAL
+#endif
+
+#ifdef PREFIX_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_PREFIX \
+ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_PREFIX
+#endif
+
+#ifdef CROSS_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_CROSS \
+ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_CROSS
+#endif
+
+#ifdef TOOL_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_TOOL \
+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_TOOL
+#endif
+
+#ifdef NATIVE_SYSTEM_HEADER_DIR
+#define INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
+#else
+#define INCLUDE_DEFAULTS_MUSL_NATIVE
+#endif
+
+#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
+# undef INCLUDE_DEFAULTS_MUSL_LOCAL
+# define INCLUDE_DEFAULTS_MUSL_LOCAL
+# undef INCLUDE_DEFAULTS_MUSL_NATIVE
+# define INCLUDE_DEFAULTS_MUSL_NATIVE
+#else
+# undef INCLUDE_DEFAULTS_MUSL_CROSS
+# define INCLUDE_DEFAULTS_MUSL_CROSS
+#endif
+
+#undef INCLUDE_DEFAULTS
+#define INCLUDE_DEFAULTS \
+ { \
+ INCLUDE_DEFAULTS_MUSL_GPP \
+ INCLUDE_DEFAULTS_MUSL_PREFIX \
+ INCLUDE_DEFAULTS_MUSL_CROSS \
+ INCLUDE_DEFAULTS_MUSL_TOOL \
+ INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
+ { 0, 0, 0, 0, 0, 0 } \
+ }
+#endif
+
#if (DEFAULT_LIBC == LIBC_UCLIBC) && defined (SINGLE_LIBC) /* uClinux */
/* This is a *uclinux* target. We don't define below macros to normal linux
versions, because doing so would require *uclinux* targets to include
--- a/gcc/config/linux.opt
+++ b/gcc/config/linux.opt
@@ -28,5 +28,9 @@ Target Report RejectNegative Var(linux_l
Use GNU C library
muclibc
-Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
+Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mmusl)
Use uClibc C library
+
+mmusl
+Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mbionic)
+Use musl C library
--- a/gcc/configure
+++ b/gcc/configure
@@ -27833,6 +27833,9 @@ if test "${gcc_cv_libc_provides_ssp+set}
else
gcc_cv_libc_provides_ssp=no
case "$target" in
+ *-*-musl*)
+ # All versions of musl provide stack protector
+ gcc_cv_libc_provides_ssp=yes;;
*-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
# glibc 2.4 and later provides __stack_chk_fail and
# either __stack_chk_guard, or TLS access to stack guard canary.
@@ -27865,6 +27868,7 @@ fi
# <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
# simply assert that glibc does provide this, which is true for all
# realistically usable GNU/Hurd configurations.
+ # All supported versions of musl provide it as well
gcc_cv_libc_provides_ssp=yes;;
*-*-darwin* | *-*-freebsd*)
ac_fn_c_check_func "$LINENO" "__stack_chk_fail" "ac_cv_func___stack_chk_fail"
@@ -27961,6 +27965,9 @@ case "$target" in
gcc_cv_target_dl_iterate_phdr=no
fi
;;
+ *-linux-musl*)
+ gcc_cv_target_dl_iterate_phdr=yes
+ ;;
esac
if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5287,6 +5287,9 @@ AC_CACHE_CHECK(__stack_chk_fail in targe
gcc_cv_libc_provides_ssp,
[gcc_cv_libc_provides_ssp=no
case "$target" in
+ *-*-musl*)
+ # All versions of musl provide stack protector
+ gcc_cv_libc_provides_ssp=yes;;
*-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu)
# glibc 2.4 and later provides __stack_chk_fail and
# either __stack_chk_guard, or TLS access to stack guard canary.
@@ -5313,6 +5316,7 @@ AC_CACHE_CHECK(__stack_chk_fail in targe
# <http://gcc.gnu.org/ml/gcc/2008-10/msg00130.html>) and for now
# simply assert that glibc does provide this, which is true for all
# realistically usable GNU/Hurd configurations.
+ # All supported versions of musl provide it as well
gcc_cv_libc_provides_ssp=yes;;
*-*-darwin* | *-*-freebsd*)
AC_CHECK_FUNC(__stack_chk_fail,[gcc_cv_libc_provides_ssp=yes],
@@ -5386,6 +5390,9 @@ case "$target" in
gcc_cv_target_dl_iterate_phdr=no
fi
;;
+ *-linux-musl*)
+ gcc_cv_target_dl_iterate_phdr=yes
+ ;;
esac
GCC_TARGET_TEMPLATE([TARGET_DL_ITERATE_PHDR])
if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -667,7 +667,7 @@ Objective-C and Objective-C++ Dialects}.
-mcpu=@var{cpu}}
@emph{GNU/Linux Options}
-@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
+@gccoptlist{-mglibc -muclibc -mmusl -mbionic -mandroid @gol
-tno-android-cc -tno-android-ld}
@emph{H8/300 Options}
@@ -15340,13 +15340,19 @@ These @samp{-m} options are defined for
@item -mglibc
@opindex mglibc
Use the GNU C library. This is the default except
-on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
+on @samp{*-*-linux-*uclibc*}, @samp{*-*-linux-*musl*} and
+@samp{*-*-linux-*android*} targets.
@item -muclibc
@opindex muclibc
Use uClibc C library. This is the default on
@samp{*-*-linux-*uclibc*} targets.
+@item -mmusl
+@opindex mmusl
+Use the musl C library. This is the default on
+@samp{*-*-linux-*musl*} targets.
+
@item -mbionic
@opindex mbionic
Use Bionic C library. This is the default on

+ 0
- 43
devel/gcc/patches/201-musl_arm.patch View File

@ -1,43 +0,0 @@
From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 27 May 2015 13:17:11 +0000 (+0000)
Subject: [PATCH 4/13] arm musl support
X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=de799bd087ab9a179768fea75bd195a31d3432a4
[PATCH 4/13] arm musl support
On behalf of szabolcs.nagy@arm.com
2015-05-27 Gregor Richards <gregor.richards@uwaterloo.ca>
* config/arm/linux-eabi.h (MUSL_DYNAMIC_LINKER): Define.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223749 138bc75d-0d04-0410-961f-82ee72b054a4
---
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -77,6 +77,23 @@
%{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
%{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
+/* For ARM musl currently supports four dynamic linkers:
+ - ld-musl-arm.so.1 - for the EABI-derived soft-float ABI
+ - ld-musl-armhf.so.1 - for the EABI-derived hard-float ABI
+ - ld-musl-armeb.so.1 - for the EABI-derived soft-float ABI, EB
+ - ld-musl-armebhf.so.1 - for the EABI-derived hard-float ABI, EB
+ musl does not support the legacy OABI mode.
+ All the dynamic linkers live in /lib.
+ We default to soft-float, EL. */
+#undef MUSL_DYNAMIC_LINKER
+#if TARGET_BIG_ENDIAN_DEFAULT
+#define MUSL_DYNAMIC_LINKER_E "%{mlittle-endian:;:eb}"
+#else
+#define MUSL_DYNAMIC_LINKER_E "%{mbig-endian:eb}"
+#endif
+#define MUSL_DYNAMIC_LINKER \
+ "/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"
+
/* At this point, bpabi.h will have clobbered LINK_SPEC. We want to
use the GNU/Linux version, not the generic BPABI version. */
#undef LINK_SPEC

+ 0
- 35
devel/gcc/patches/202-musl_mips.patch View File

@ -1,35 +0,0 @@
From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 8 May 2015 15:16:50 +0000 (+0000)
Subject: [PATCH 6/13] mips musl support
X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=2550b6a866c887472b587bef87d433c51cf1ebc8
[PATCH 6/13] mips musl support
2015-05-08 Gregor Richards <gregor.richards@uwaterloo.ca>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/mips/linux.h (MUSL_DYNAMIC_LINKER32): Define.
(MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERN32): Define.
(GNU_USER_DYNAMIC_LINKERN32): Update.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222915 138bc75d-0d04-0410-961f-82ee72b054a4
---
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
@@ -37,7 +37,13 @@ along with GCC; see the file COPYING3.
#define UCLIBC_DYNAMIC_LINKERN32 \
"%{mnan=2008:/lib32/ld-uClibc-mipsn8.so.0;:/lib32/ld-uClibc.so.0}"
+#undef MUSL_DYNAMIC_LINKER32
+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips%{EL:el}%{msoft-float:-sf}.so.1"
+#undef MUSL_DYNAMIC_LINKER64
+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips64%{EL:el}%{msoft-float:-sf}.so.1"
+#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mipsn32%{EL:el}%{msoft-float:-sf}.so.1"
+
#define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
#define GNU_USER_DYNAMIC_LINKERN32 \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
- BIONIC_DYNAMIC_LINKERN32)
+ BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)

+ 0
- 209
devel/gcc/patches/203-musl_powerpc.patch View File

@ -1,209 +0,0 @@
gcc/Changelog:
2015-04-24 Gregor Richards <gregor.richards@uwaterloo.ca>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* config.gcc (secure_plt): Add *-linux*-musl*.
* config/rs6000/linux64.h (MUSL_DYNAMIC_LINKER32): Define.
(MUSL_DYNAMIC_LINKER64): Define.
(GNU_USER_DYNAMIC_LINKER32): Update.
(GNU_USER_DYNAMIC_LINKER64): Update.
(CHOOSE_DYNAMIC_LINKER): Update.
* config/rs6000/secureplt.h (LINK_SECURE_PLT_DEFAULT_SPEC): Define.
* config/rs6000/sysv4.h (GNU_USER_DYNAMIC_LINKER): Update.
(MUSL_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER_E,)
(INCLUDE_DEFAULTS_MUSL_GPP, INCLUDE_DEFAULTS_MUSL_LOCAL,)
(INCLUDE_DEFAULTS_MUSL_PREFIX, INCLUDE_DEFAULTS_MUSL_CROSS,)
(INCLUDE_DEFAULTS_MUSL_TOOL, INCLUDE_DEFAULTS_MUSL_NATIVE): Define.
(LINK_SECURE_PLT_DEFAULT_SPEC): Define.
(CHOOSE_DYNAMIC_LINKER, LINK_TARGET_SPEC, LINK_OS_LINUX_SPEC): Update.
* config/rs6000/sysv4le.h (MUSL_DYNAMIC_LINKER_E): Define.
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -365,17 +365,21 @@ extern int dot_symbols;
#endif
#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1"
+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E ".so.1"
#if DEFAULT_LIBC == LIBC_UCLIBC
-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
#elif DEFAULT_LIBC == LIBC_GLIBC
-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
+#elif DEFAULT_LIBC == LIBC_MUSL
+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
#else
#error "Unsupported DEFAULT_LIBC"
#endif
#define GNU_USER_DYNAMIC_LINKER32 \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
#define GNU_USER_DYNAMIC_LINKER64 \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
#undef DEFAULT_ASM_ENDIAN
#if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
--- a/gcc/config/rs6000/secureplt.h
+++ b/gcc/config/rs6000/secureplt.h
@@ -18,3 +18,4 @@ along with GCC; see the file COPYING3.
<http://www.gnu.org/licenses/>. */
#define CC1_SECURE_PLT_DEFAULT_SPEC "-msecure-plt"
+#define LINK_SECURE_PLT_DEFAULT_SPEC "--secure-plt"
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -537,6 +537,9 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
#ifndef CC1_SECURE_PLT_DEFAULT_SPEC
#define CC1_SECURE_PLT_DEFAULT_SPEC ""
#endif
+#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
+#define LINK_SECURE_PLT_DEFAULT_SPEC ""
+#endif
/* Pass -G xxx to the compiler. */
#undef CC1_SPEC
@@ -574,7 +577,8 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
%{R*} \
%(link_shlib) \
%{!T*: %(link_start) } \
-%(link_os)"
+%(link_os)" \
+"%{!mbss-plt: %{!msecure-plt: %(link_secure_plt_default)}}"
/* Shared libraries are not default. */
#define LINK_SHLIB_SPEC "\
@@ -757,17 +761,22 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
#define LINK_START_LINUX_SPEC ""
+#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","")
+
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1"
#if DEFAULT_LIBC == LIBC_UCLIBC
-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
+#elif DEFAULT_LIBC == LIBC_MUSL
+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
#elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
+#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
#else
#error "Unsupported DEFAULT_LIBC"
#endif
#define GNU_USER_DYNAMIC_LINKER \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
+ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
@@ -889,6 +898,7 @@ ncrtn.o%s"
{ "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
{ "link_os_default", LINK_OS_DEFAULT_SPEC }, \
{ "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
+ { "link_secure_plt_default", LINK_SECURE_PLT_DEFAULT_SPEC }, \
{ "cpp_os_ads", CPP_OS_ADS_SPEC }, \
{ "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
{ "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
@@ -943,3 +953,72 @@ ncrtn.o%s"
/* This target uses the sysv4.opt file. */
#define TARGET_USES_SYSV4_OPT 1
+/* Include order changes for musl, same as in generic linux.h. */
+#if DEFAULT_LIBC == LIBC_MUSL
+#define INCLUDE_DEFAULTS_MUSL_GPP \
+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
+
+#ifdef LOCAL_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_LOCAL \
+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
+#else
+#define INCLUDE_DEFAULTS_MUSL_LOCAL
+#endif
+
+#ifdef PREFIX_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_PREFIX \
+ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_PREFIX
+#endif
+
+#ifdef CROSS_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_CROSS \
+ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_CROSS
+#endif
+
+#ifdef TOOL_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_TOOL \
+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_TOOL
+#endif
+
+#ifdef NATIVE_SYSTEM_HEADER_DIR
+#define INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
+#else
+#define INCLUDE_DEFAULTS_MUSL_NATIVE
+#endif
+
+#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
+# undef INCLUDE_DEFAULTS_MUSL_LOCAL
+# define INCLUDE_DEFAULTS_MUSL_LOCAL
+# undef INCLUDE_DEFAULTS_MUSL_NATIVE
+# define INCLUDE_DEFAULTS_MUSL_NATIVE
+#else
+# undef INCLUDE_DEFAULTS_MUSL_CROSS
+# define INCLUDE_DEFAULTS_MUSL_CROSS
+#endif
+
+#undef INCLUDE_DEFAULTS
+#define INCLUDE_DEFAULTS \
+ { \
+ INCLUDE_DEFAULTS_MUSL_GPP \
+ INCLUDE_DEFAULTS_MUSL_PREFIX \
+ INCLUDE_DEFAULTS_MUSL_CROSS \
+ INCLUDE_DEFAULTS_MUSL_TOOL \
+ INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
+ { 0, 0, 0, 0, 0, 0 } \
+ }
+#endif
--- a/gcc/config/rs6000/sysv4le.h
+++ b/gcc/config/rs6000/sysv4le.h
@@ -31,3 +31,5 @@
/* Little-endian PowerPC64 Linux uses the ELF v2 ABI by default. */
#define LINUX64_DEFAULT_ABI_ELFv2
+#undef MUSL_DYNAMIC_LINKER_E
+#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","le")
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2416,6 +2416,10 @@ powerpc*-*-linux*)
powerpc*-*-linux*paired*)
tm_file="${tm_file} rs6000/750cl.h" ;;
esac
+ case ${target} in
+ *-linux*-musl*)
+ enable_secureplt=yes ;;
+ esac
if test x${enable_secureplt} = xyes; then
tm_file="rs6000/secureplt.h ${tm_file}"
fi

+ 0
- 39
devel/gcc/patches/204-musl_sh.patch View File

@ -1,39 +0,0 @@
gcc/Changelog:
2015-04-27 Gregor Richards <gregor.richards@uwaterloo.ca>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/sh/linux.h (MUSL_DYNAMIC_LINKER): Define.
(MUSL_DYNAMIC_LINKER_E, MUSL_DYNAMIC_LINKER_FP): Define.
--- a/gcc/config/sh/linux.h
+++ b/gcc/config/sh/linux.h
@@ -43,6 +43,28 @@ along with GCC; see the file COPYING3.
#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
+#if TARGET_ENDIAN_DEFAULT == MASK_LITTLE_ENDIAN
+#define MUSL_DYNAMIC_LINKER_E "%{mb:eb}"
+#else
+#define MUSL_DYNAMIC_LINKER_E "%{!ml:eb}"
+#endif
+
+#if TARGET_CPU_DEFAULT & ( MASK_HARD_SH2A_DOUBLE | MASK_SH4 )
+/* "-nofpu" if any nofpu option is specified */
+#define MUSL_DYNAMIC_LINKER_FP \
+ "%{m1|m2|m2a-nofpu|m3|m4-nofpu|m4-100-nofpu|m4-200-nofpu|m4-300-nofpu|" \
+ "m4-340|m4-400|m4-500|m4al|m5-32media-nofpu|m5-64media-nofpu|" \
+ "m5-compact-nofpu:-nofpu}"
+#else
+/* "-nofpu" if none of the hard fpu options are specified */
+#define MUSL_DYNAMIC_LINKER_FP \
+ "%{m2a|m4|m4-100|m4-200|m4-300|m4a|m5-32media|m5-64media|m5-compact:;:-nofpu}"
+#endif
+
+#undef MUSL_DYNAMIC_LINKER
+#define MUSL_DYNAMIC_LINKER \
+ "/lib/ld-musl-sh" MUSL_DYNAMIC_LINKER_E MUSL_DYNAMIC_LINKER_FP ".so.1"
+
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
#undef SUBTARGET_LINK_EMUL_SUFFIX

+ 0
- 41
devel/gcc/patches/205-musl_x86.patch View File

@ -1,41 +0,0 @@
From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 15 May 2015 13:20:01 +0000 (+0000)
Subject: [PATCH 9/13] x86 musl support
X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=5551c8d927c17f60837f15f8dfe46f945ba3fa9c
[PATCH 9/13] x86 musl support
On behalf of Szabolcs Nagy.
2015-05-15 Gregor Richards <gregor.richards@uwaterloo.ca>
* config/i386/linux.h (MUSL_DYNAMIC_LINKER): Define.
* config/i386/linux64.h (MUSL_DYNAMIC_LINKER32): Define.
(MUSL_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKERX32): Define.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223218 138bc75d-0d04-0410-961f-82ee72b054a4
---
--- a/gcc/config/i386/linux.h
+++ b/gcc/config/i386/linux.h
@@ -21,3 +21,6 @@ along with GCC; see the file COPYING3.
#define GNU_USER_LINK_EMULATION "elf_i386"
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+
+#undef MUSL_DYNAMIC_LINKER
+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
--- a/gcc/config/i386/linux64.h
+++ b/gcc/config/i386/linux64.h
@@ -30,3 +30,10 @@ see the files COPYING3 and COPYING.RUNTI
#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
#define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
+
+#undef MUSL_DYNAMIC_LINKER32
+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
+#undef MUSL_DYNAMIC_LINKER64
+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
+#undef MUSL_DYNAMIC_LINKERX32
+#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"

+ 0
- 31
devel/gcc/patches/206-musl_aarch64.patch View File

@ -1,31 +0,0 @@
From: jgreenhalgh <jgreenhalgh@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 27 May 2015 16:46:39 +0000 (+0000)
Subject: [PATCH 3/13] aarch64 musl support
X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=b3ff21cf0531be91bc3fb8200296a7633090ec78
[PATCH 3/13] aarch64 musl support
gcc/Changelog:
2015-05-27 Gregor Richards <gregor.richards@uwaterloo.ca>
Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/aarch64/aarch64-linux.h (MUSL_DYNAMIC_LINKER): Define.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223766 138bc75d-0d04-0410-961f-82ee72b054a4
---
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -23,6 +23,9 @@
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
+#undef MUSL_DYNAMIC_LINKER
+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-aarch64%{mbig-endian:_be}%{mabi=ilp32:_ilp32}.so.1"
+
#undef ASAN_CC1_SPEC
#define ASAN_CC1_SPEC "%{%:sanitize(address):-funwind-tables}"

+ 0
- 30
devel/gcc/patches/207-musl_fixincludes.patch View File

@ -1,30 +0,0 @@
From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 22 Apr 2015 14:18:16 +0000 (+0000)
Subject: fixincludes update for musl support
X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=2dc727de2e87c2756a514cbb43cea23c99deaa3d
fixincludes update for musl support
On behalf of Szabolcs.Nagy@arm.com
2015-04-22 Gregor Richards <gregor.richards@uwaterloo.ca>
* mkfixinc.sh: Add *-musl* with no fixes.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222327 138bc75d-0d04-0410-961f-82ee72b054a4
---
--- a/fixincludes/mkfixinc.sh
+++ b/fixincludes/mkfixinc.sh
@@ -19,7 +19,8 @@ case $machine in
powerpc-*-eabi* | \
powerpc-*-rtems* | \
powerpcle-*-eabisim* | \
- powerpcle-*-eabi* )
+ powerpcle-*-eabi* | \
+ *-musl* )
# IF there is no include fixing,
# THEN create a no-op fixer and exit
(echo "#! /bin/sh" ; echo "exit 0" ) > ${target}

+ 0
- 72
devel/gcc/patches/209-musl_libstdc++.patch View File

@ -1,72 +0,0 @@
From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 22 Apr 2015 14:24:11 +0000 (+0000)
Subject: libstdc++, libgfortran gthr workaround for musl
X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=1e5f711c11cb80ce609db9e9c1d8b2da0f7b5b61
libstdc++, libgfortran gthr workaround for musl
On behalf of szabolcs.nagy@arm.com
[libstdc++-v3/]
2015-04-22 Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/os/generic/os_defines.h (_GLIBCXX_GTHREAD_USE_WEAK): Define.
* configure.host (os_include_dir): Set to "os/generic" for linux-musl*.
[libgfortran/]
2015-04-22 Szabolcs Nagy <szabolcs.nagy@arm.com>
* acinclude.m4 (GTHREAD_USE_WEAK): Define as 0 for *-*-musl*.
* configure: Regenerate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222329 138bc75d-0d04-0410-961f-82ee72b054a4
---
--- a/libgfortran/acinclude.m4
+++ b/libgfortran/acinclude.m4
@@ -100,7 +100,7 @@ void foo (void);
[Define to 1 if the target supports #pragma weak])
fi
case "$host" in
- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
+ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
AC_DEFINE(GTHREAD_USE_WEAK, 0,
[Define to 0 if the target shouldn't use #pragma weak])
;;
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -26456,7 +26456,7 @@ $as_echo "#define SUPPORTS_WEAK 1" >>con
fi
case "$host" in
- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
+ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
$as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h
--- a/libstdc++-v3/config/os/generic/os_defines.h
+++ b/libstdc++-v3/config/os/generic/os_defines.h
@@ -33,4 +33,9 @@
// System-specific #define, typedefs, corrections, etc, go here. This
// file will come before all others.
+// Disable the weak reference logic in gthr.h for os/generic because it
+// is broken on every platform unless there is implementation specific
+// workaround in gthr-posix.h and at link-time for static linking.
+#define _GLIBCXX_GTHREAD_USE_WEAK 0
+
#endif
--- a/libstdc++-v3/configure.host
+++ b/libstdc++-v3/configure.host
@@ -273,6 +273,9 @@ case "${host_os}" in
freebsd*)
os_include_dir="os/bsd/freebsd"
;;
+ linux-musl*)
+ os_include_dir="os/generic"
+ ;;
gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
if [ "$uclibc" = "yes" ]; then
os_include_dir="os/uclibc"

+ 16
- 1
devel/gcc/patches/230-musl_libssp.patch View File

@ -1,6 +1,21 @@
commit 1877bc9d8f2be143fbe530347a945850d0ecd234
Author: Steven Barth <cyrus@openwrt.org>
Date: Mon Jun 22 10:31:07 2015 +0000
gcc/musl: rework SSP-support
Make musl provide libssp_nonshared.a and make GCC link it unconditionally
if musl is used. This should be a no-op if SSP is disabled and seems to be
the only reliable way of dealing with SSP over all packages due to the mess
that is linkerflags handling in packages.
Signed-off-by: Steven Barth <steven@midlink.org>
SVN-Revision: 46108
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -727,7 +727,9 @@ proper position among the other output f
@@ -861,7 +861,9 @@ proper position among the other output f
#endif
#ifndef LINK_SSP_SPEC


+ 0
- 61
devel/gcc/patches/240-musl-libitm-fixes.patch View File

@ -1,61 +0,0 @@
From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed, 22 Apr 2015 14:11:25 +0000 (+0000)
Subject: libitm fixes for musl support
X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=e53a4d49c3d03ab8eaddb073cf972c1c46d75338
libitm fixes for musl support
On behalf of Szabolcs.Nagy@arm.com
2015-04-22 Gregor Richards <gregor.richards@uwaterloo.ca>
* config/arm/hwcap.cc: Use fcntl.h instead of sys/fcntl.h.
* config/linux/x86/tls.h: Only use __GLIBC_PREREQ if defined.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222325 138bc75d-0d04-0410-961f-82ee72b054a4
---
--- a/libitm/config/arm/hwcap.cc
+++ b/libitm/config/arm/hwcap.cc
@@ -40,7 +40,7 @@ int GTM_hwcap HIDDEN = 0
#ifdef __linux__
#include <unistd.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include <elf.h>
static void __attribute__((constructor))
--- a/libitm/config/linux/x86/tls.h
+++ b/libitm/config/linux/x86/tls.h
@@ -25,16 +25,19 @@
#ifndef LIBITM_X86_TLS_H
#define LIBITM_X86_TLS_H 1
-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
+#if defined(__GLIBC_PREREQ)
+#if __GLIBC_PREREQ(2, 10)
/* Use slots in the TCB head rather than __thread lookups.
GLIBC has reserved words 10 through 13 for TM. */
#define HAVE_ARCH_GTM_THREAD 1
#define HAVE_ARCH_GTM_THREAD_DISP 1
#endif
+#endif
#include "config/generic/tls.h"
-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
+#if defined(__GLIBC_PREREQ)
+#if __GLIBC_PREREQ(2, 10)
namespace GTM HIDDEN {
#ifdef __x86_64__
@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a
} // namespace GTM
#endif /* >= GLIBC 2.10 */
+#endif
#endif // LIBITM_X86_TLS_H

+ 0
- 120
devel/gcc/patches/250-add-musl.patch View File

@ -1,120 +0,0 @@
From: ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 8 May 2015 08:30:40 +0000 (+0000)
Subject: [PATCH 0/13] Add musl support to GCC
X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=f2d678afa5b8385d763b93772d73d6bf80a9739e
[PATCH 0/13] Add musl support to GCC
2015-05-08 Szabolcs Nagy <szabolcs.nagy@arm.com>
* config/glibc-stdint.h (OPTION_MUSL): Define.
(INT_FAST16_TYPE, INT_FAST32_TYPE, UINT_FAST16_TYPE, UINT_FAST32_TYPE):
Change the definition based on OPTION_MUSL for 64 bit targets.
* config/linux.h (OPTION_MUSL): Redefine.
* config/alpha/linux.h (OPTION_MUSL): Redefine.
* config/rs6000/linux.h (OPTION_MUSL): Redefine.
* config/rs6000/linux64.h (OPTION_MUSL): Redefine.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@222905 138bc75d-0d04-0410-961f-82ee72b054a4
---
--- a/gcc/config/alpha/linux.h
+++ b/gcc/config/alpha/linux.h
@@ -61,10 +61,14 @@ along with GCC; see the file COPYING3.
#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
+#undef OPTION_MUSL
+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
#else
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
#define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
+#undef OPTION_MUSL
+#define OPTION_MUSL (linux_libc == LIBC_MUSL)
#endif
/* Determine what functions are present at the runtime;
--- a/gcc/config/glibc-stdint.h
+++ b/gcc/config/glibc-stdint.h
@@ -22,6 +22,12 @@ a copy of the GCC Runtime Library Except
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+/* Systems using musl libc should use this header and make sure
+ OPTION_MUSL is defined correctly before using the TYPE macros. */
+#ifndef OPTION_MUSL
+#define OPTION_MUSL 0
+#endif
+
#define SIG_ATOMIC_TYPE "int"
#define INT8_TYPE "signed char"
@@ -43,12 +49,12 @@ see the files COPYING3 and COPYING.RUNTI
#define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
#define INT_FAST8_TYPE "signed char"
-#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
-#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
+#define INT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int")
+#define INT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long int" : "int")
#define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
#define UINT_FAST8_TYPE "unsigned char"
-#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
-#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
+#define UINT_FAST16_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int")
+#define UINT_FAST32_TYPE (LONG_TYPE_SIZE == 64 && !OPTION_MUSL ? "long unsigned int" : "unsigned int")
#define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int")
--- a/gcc/config/linux.h
+++ b/gcc/config/linux.h
@@ -32,11 +32,13 @@ see the files COPYING3 and COPYING.RUNTI
#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
+#undef OPTION_MUSL
#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
#else
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
#define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
+#undef OPTION_MUSL
#define OPTION_MUSL (linux_libc == LIBC_MUSL)
#endif
--- a/gcc/config/rs6000/linux.h
+++ b/gcc/config/rs6000/linux.h
@@ -30,10 +30,14 @@
#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
+#undef OPTION_MUSL
+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
#else
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
#define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
+#undef OPTION_MUSL
+#define OPTION_MUSL (linux_libc == LIBC_MUSL)
#endif
/* Determine what functions are present at the runtime;
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -299,10 +299,14 @@ extern int dot_symbols;
#define OPTION_GLIBC (DEFAULT_LIBC == LIBC_GLIBC)
#define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
#define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
+#undef OPTION_MUSL
+#define OPTION_MUSL (DEFAULT_LIBC == LIBC_MUSL)
#else
#define OPTION_GLIBC (linux_libc == LIBC_GLIBC)
#define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
#define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
+#undef OPTION_MUSL
+#define OPTION_MUSL (linux_libc == LIBC_MUSL)
#endif
/* Determine what functions are present at the runtime;

+ 0
- 24
devel/gcc/patches/270-musl-add-powerpc-softfloat-fix.patch View File

@ -1,24 +0,0 @@
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -369,8 +369,8 @@ extern int dot_symbols;
#endif
#define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
#define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
-#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1"
-#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E ".so.1"
+#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
+#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
#if DEFAULT_LIBC == LIBC_UCLIBC
#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
#elif DEFAULT_LIBC == LIBC_GLIBC
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -765,7 +765,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
-#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E ".so.1"
+#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
#if DEFAULT_LIBC == LIBC_UCLIBC
#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
#elif DEFAULT_LIBC == LIBC_MUSL

+ 10
- 3
devel/gcc/patches/300-mips_Os_cpu_rtx_cost_model.patch View File

@ -1,9 +1,16 @@
Use the proper rtx cost model for the selected CPU, even when optimizing
for size. This generates better code.
commit ecf7671b769fe96f7b5134be442089f8bdba55d2
Author: Felix Fietkau <nbd@nbd.name>
Date: Thu Aug 4 20:29:45 2016 +0200
gcc: add a patch to generate better code with Os on mips
Also happens to reduce compressed code size a bit
Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -17483,7 +17483,7 @@ mips_option_override (void)
@@ -19790,7 +19790,7 @@ mips_option_override (void)
flag_pcc_struct_return = 0;
/* Decide which rtx_costs structure to use. */


+ 22
- 1
devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch View File

@ -1,6 +1,27 @@
commit b050f87d13b5dc7ed82feb9a90f4529de58bdf25
Author: Felix Fietkau <nbd@openwrt.org>
Date: Wed Feb 19 19:20:10 2014 +0000
gcc: prevent the use of LDRD/STRD on ARMv5TE
These instructions are for 64-bit load/store. On ARMv5TE, the CPU
requires addresses to be aligned to 64-bit. When misaligned, behavior is
undefined (effectively either loads the same word twice on LDRD, or
corrupts surrounding memory on STRD).
On ARMv6 and newer, unaligned access is safe.
Removing these instructions for ARMv5TE is necessary, because GCC
ignores alignment information in pointers and does unsafe optimizations
that have shown up as bugs in various places.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 39638
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -285,7 +285,7 @@ extern void (*arm_lang_output_object_att
@@ -150,7 +150,7 @@ extern tree arm_fp16_type_node;
/* Thumb-1 only. */
#define TARGET_THUMB1_ONLY (TARGET_THUMB1 && !arm_arch_notm)


+ 9
- 1
devel/gcc/patches/810-arm-softfloat-libgcc.patch View File

@ -1,3 +1,11 @@
commit 8570c4be394cff7282f332f97da2ff569a927ddb
Author: Imre Kaloz <kaloz@openwrt.org>
Date: Wed Feb 2 20:06:12 2011 +0000
fixup arm soft-float symbols
SVN-Revision: 25325
--- a/libgcc/config/arm/t-linux
+++ b/libgcc/config/arm/t-linux
@@ -1,6 +1,10 @@
@ -14,7 +22,7 @@
# difference.
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -60,8 +60,6 @@
@@ -58,8 +58,6 @@
%{shared:-lc} \
%{!shared:%{profile:-lc_p}%{!profile:-lc}}"


+ 12
- 4
devel/gcc/patches/820-libgcc_pic.patch View File

@ -1,6 +1,14 @@
commit c96312958c0621e72c9b32da5bc224ffe2161384
Author: Felix Fietkau <nbd@openwrt.org>
Date: Mon Oct 19 23:26:09 2009 +0000
gcc: create a proper libgcc_pic.a static library for relinking (4.3.3+ for now, backport will follow)
SVN-Revision: 18086
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -887,11 +887,12 @@ $(libgcov-driver-objects): %$(objext): $
@@ -920,11 +920,12 @@ $(libgcov-driver-objects): %$(objext): $
# Static libraries.
libgcc.a: $(libgcc-objects)
@ -14,7 +22,7 @@
-rm -f $@
objects="$(objects)"; \
@@ -913,7 +914,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
@@ -945,7 +946,7 @@ all: libunwind.a
endif
ifeq ($(enable_shared),yes)
@ -22,8 +30,8 @@
+all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
endif
@@ -1108,6 +1109,10 @@ install-shared:
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
@@ -1151,6 +1152,10 @@ install-shared:
chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a


+ 0
- 13
devel/gcc/patches/830-arm_unbreak_armv4t.patch View File

@ -1,13 +0,0 @@
http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -45,7 +45,7 @@
The ARM10TDMI core is the default for armv5t, so set
SUBTARGET_CPU_DEFAULT to achieve this. */
#undef SUBTARGET_CPU_DEFAULT
-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
/* TARGET_BIG_ENDIAN_DEFAULT is set in
config.gcc for big endian configurations. */

+ 10
- 1
devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch View File

@ -1,6 +1,15 @@
commit 7edc8ca5456d9743dd0075eb3cc5b04f4f24c8cc
Author: Imre Kaloz <kaloz@openwrt.org>
Date: Wed Feb 2 19:34:36 2011 +0000
add armv4 fixup patches
SVN-Revision: 25322
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -94,10 +94,15 @@
@@ -88,10 +88,15 @@
#define MUSL_DYNAMIC_LINKER \
"/lib/ld-musl-arm" MUSL_DYNAMIC_LINKER_E "%{mfloat-abi=hard:hf}.so.1"


+ 10
- 3
devel/gcc/patches/850-use_shared_libgcc.patch View File

@ -1,7 +1,14 @@
commit dcfc40358b5a3cae7320c17f8d1cebd5ad5540cd
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun Feb 12 20:25:47 2012 +0000
gcc 4.6: port over the missing patch 850-use_shared_libgcc.patch to prevent libgcc crap from leaking into every single binary
SVN-Revision: 30486
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -131,10 +131,6 @@
#define ENDFILE_SPEC \
@@ -126,10 +126,6 @@
"%{Ofast|ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \
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
@ -26,7 +33,7 @@
-muclibc or -mglibc or -mbionic or -mmusl has been passed to change
--- a/libgcc/mkmap-symver.awk
+++ b/libgcc/mkmap-symver.awk
@@ -132,5 +132,5 @@ function output(lib) {
@@ -136,5 +136,5 @@ function output(lib) {
else if (inherit[lib])
printf("} %s;\n", inherit[lib]);
else


+ 10
- 0
devel/gcc/patches/851-libgcc_no_compat.patch View File

@ -1,3 +1,13 @@
commit 64661de100da1ec1061ef3e5e400285dce115e6b
Author: Felix Fietkau <nbd@openwrt.org>
Date: Sun May 10 13:16:35 2015 +0000
gcc: add some size optimization patches
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 45664
--- a/libgcc/config/t-libunwind
+++ b/libgcc/config/t-libunwind
@@ -2,8 +2,7 @@


+ 8
- 1
devel/gcc/patches/870-ppc_no_crtsavres.patch View File

@ -1,6 +1,13 @@
commit d8c570a1531035c3e26bcd94741e5f5b9c36b5d9
Author: Felix Fietkau <nbd@openwrt.org>
Date: Mon Mar 5 00:51:01 2012 +0000
gcc: do not emit references to _savegpr_* and _restgpr_* on powerpc, as they are tricky to deal with wrt. libgcc. they cannot be linked dynamically
SVN-Revision: 30814
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -21500,7 +21500,7 @@ rs6000_savres_strategy (rs6000_stack_t *
@@ -26981,7 +26981,7 @@ rs6000_savres_strategy (rs6000_stack_t *
/* Define cutoff for using out-of-line functions to save registers. */
if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
{


+ 0
- 11
devel/gcc/patches/880-no_java_section.patch View File

@ -1,11 +0,0 @@
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -380,7 +380,7 @@ see the files COPYING3 and COPYING.RUNTI
/* If we have named section and we support weak symbols, then use the
.jcr section for recording java classes which need to be registered
at program start-up time. */
-#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
+#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
#ifndef JCR_SECTION_NAME
#define JCR_SECTION_NAME ".jcr"
#endif

+ 22
- 0
devel/gcc/patches/881-no_tm_section.patch View File

@ -0,0 +1,22 @@
commit 565988ab47bd9b96b50608564aee2104aeb4b7ae
Author: Felix Fietkau <nbd@nbd.name>
Date: Tue Dec 13 14:20:49 2016 +0100
gcc: rip out transactional memory related bloat from crtbegin
Slightly improves compression for each executable, saving about 4k from
the default ar71xx rootfs
Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/libgcc/crtstuff.c
+++ b/libgcc/crtstuff.c
@@ -152,7 +152,7 @@ call_ ## FUNC (void) \
#endif
#if !defined(USE_TM_CLONE_REGISTRY) && defined(OBJECT_FORMAT_ELF)
-# define USE_TM_CLONE_REGISTRY 1
+# define USE_TM_CLONE_REGISTRY 0
#endif
/* We do not want to add the weak attribute to the declarations of these

+ 21
- 0
devel/gcc/patches/900-bad-mips16-crt.patch View File

@ -1,3 +1,24 @@
commit 9dc38e48f7a6f88b7ac7bfaced91f53660204e46
Author: Florian Fainelli <florian@openwrt.org>
Date: Fri Apr 5 12:36:06 2013 +0000
toolchain/gcc: .init and .fini need to pick one ISA
The .init and .fini sections are built by concatenating code
fragments. Putting mips16 code in the middle of a mips32 code block
doesn't work. Make gcc built the magic crt stuff in no-mips16 mode.
This is specific to 4.6-linaro but is probably portable to other gcc
flavors. Adding this to the t-libgcc-mips16 makefile fragment is a
hack not suitable for pushing upstream, but there is no mips/t-linux
or mips/t-uclibc and I am not going to touch gcc/configure for two
lines.
Signed-off-by: Jay Carlson <nop@nop.com>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
SVN-Revision: 36200
--- a/libgcc/config/mips/t-mips16
+++ b/libgcc/config/mips/t-mips16
@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16


+ 19
- 95
devel/gcc/patches/910-mbsd_multi.patch View File

@ -1,22 +1,23 @@
commit 99368862e44740ff4fd33760893f04e14f9dbdf1
Author: Felix Fietkau <nbd@openwrt.org>
Date: Tue Jul 31 00:52:27 2007 +0000
This patch brings over a few features from MirBSD:
Port the mbsd_multi patch from freewrt, which adds -fhonour-copts. This will emit warnings in packages that don't use our target cflags properly
SVN-Revision: 8256
This patch brings over a feature from MirBSD:
* -fhonour-copts
If this option is not given, it's warned (depending
on environment variables). This is to catch errors
of misbuilt packages which override CFLAGS themselves.
* -Werror-maybe-reset
Has the effect of -Wno-error if GCC_NO_WERROR is
set and not '0', a no-operation otherwise. This is
to be able to use -Werror in "make" but prevent
GNU autoconf generated configure scripts from
freaking out.
This patch was authored by Thorsten Glaser <tg at mirbsd.de>
with copyright assignment to the FSF in effect.
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -122,6 +122,9 @@ static int class_dump_flags;
@@ -108,6 +108,9 @@ static int class_dump_flags;
/* Whether any standard preincluded header has been preincluded. */
static bool done_preinclude;
@ -26,7 +27,7 @@
static void handle_OPT_d (const char *);
static void set_std_cxx98 (int);
static void set_std_cxx11 (int);
@@ -449,6 +452,12 @@ c_common_handle_option (size_t scode, co
@@ -456,6 +459,12 @@ c_common_handle_option (size_t scode, co
flag_no_builtin = !value;
break;
@ -39,7 +40,7 @@
case OPT_fconstant_string_class_:
constant_string_class_name = arg;
break;
@@ -1034,6 +1043,47 @@ c_common_init (void)
@@ -1084,6 +1093,47 @@ c_common_init (void)
return false;
}
@ -89,18 +90,7 @@
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -431,6 +431,10 @@ Wfloat-conversion
C ObjC C++ ObjC++ Var(warn_float_conversion) LangEnabledBy(C ObjC C++ ObjC++,Wconversion)
Warn for implicit type conversions that cause loss of floating point precision
+Werror-maybe-reset
+C ObjC C++ ObjC++
+; Documented in common.opt
+
Wfloat-equal
C ObjC C++ ObjC++ Var(warn_float_equal) Warning
Warn if testing floating point numbers for equality
@@ -1161,6 +1165,9 @@ C++ ObjC++ Optimization Alias(fexception
@@ -1412,6 +1412,9 @@ C++ ObjC++ Optimization Alias(fexception
fhonor-std
C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
@ -109,23 +99,12 @@
+
fhosted
C ObjC
Assume normal C execution environment
Assume normal C execution environment.
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -561,6 +561,10 @@ Werror=
Common Joined
Treat specified warning as error
+Werror-maybe-reset
+Common
+If environment variable GCC_NO_WERROR is set, act as -Wno-error
+
Wextra
Common Var(extra_warnings) Warning
Print extra (possibly unwanted) warnings
@@ -1360,6 +1364,9 @@ fguess-branch-probability
@@ -1510,6 +1510,9 @@ fguess-branch-probability
Common Report Var(flag_guess_branch_prob) Optimization
Enable guessing of branch probabilities
Enable guessing of branch probabilities.
+fhonour-copts
+Common RejectNegative
@ -135,60 +114,24 @@
; On SVR4 targets, it also controls whether or not to emit a
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1699,6 +1699,17 @@ common_handle_option (struct gcc_options
@@ -1954,6 +1954,9 @@ common_handle_option (struct gcc_options
opts, opts_set, loc, dc);
break;
+ case OPT_Werror_maybe_reset:
+ {
+ char *ev = getenv ("GCC_NO_WERROR");
+ if ((ev != NULL) && (*ev != '0'))
+ warnings_are_errors = 0;
+ }
+ break;
+
+ case OPT_fhonour_copts:
+ break;
+
case OPT_Wlarger_than_:
opts->x_larger_than_size = value;
opts->x_warn_larger_than = value != -1;
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
@@ -163,6 +163,11 @@ in older programs. This warning is on b
Make all warnings into hard errors. Source code which triggers warnings
will be rejected.
+ at item -Werror-maybe-reset
+ at opindex Werror-maybe-reset
+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
+variable is set to anything other than 0 or empty.
+
@item -Wsystem-headers
@opindex Wsystem-headers
Issue warnings for code in system headers. These are normally unhelpful
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -251,7 +251,7 @@ Objective-C and Objective-C++ Dialects}.
-Wdisabled-optimization @gol
-Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
-Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
--Wno-endif-labels -Werror -Werror=* @gol
+-Wno-endif-labels -Werror -Werror=* -Werror-maybe-reset @gol
-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
-Wformat-security -Wformat-signedness -Wformat-y2k @gol
@@ -5382,6 +5382,22 @@ This option is only supported for C and
@@ -6572,6 +6572,17 @@ This option is only supported for C and
@option{-Wall} and by @option{-Wpedantic}, which can be disabled with
@option{-Wno-pointer-sign}.
+ at item -Werror-maybe-reset
+ at opindex Werror-maybe-reset
+Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
+variable is set to anything other than 0 or empty.
+
+ at item -fhonour-copts
+ at opindex fhonour-copts
+@item -fhonour-copts
+@opindex fhonour-copts
+If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
+given at least once, and warn if it is given more than once.
+If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
@ -201,22 +144,3 @@
@item -Wstack-protector
@opindex Wstack-protector
@opindex Wno-stack-protector
@@ -7860,7 +7876,7 @@ so, the first branch is redirected to ei
second branch or a point immediately following it, depending on whether
the condition is known to be true or false.
-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+Enabled at levels @option{-O3}.
@item -fsplit-wide-types
@opindex fsplit-wide-types
--- a/gcc/java/jvspec.c
+++ b/gcc/java/jvspec.c
@@ -629,6 +629,7 @@ lang_specific_pre_link (void)
class name. Append dummy `.c' that can be stripped by set_input so %b
is correct. */
set_input (concat (main_class_name, "main.c", NULL));
+ putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack! */
err = do_spec (jvgenmain_spec);
if (err == 0)
{

+ 11
- 4
devel/gcc/patches/920-specs_nonfatal_getenv.patch View File

@ -1,13 +1,20 @@
Author: Jo-Philipp Wich <jow@openwrt.org>
Date: Sat Apr 21 03:02:39 2012 +0000
gcc: add patch to make the getenv() spec function nonfatal if requested environment variable is unset
SVN-Revision: 31390
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -8807,8 +8807,10 @@ getenv_spec_function (int argc, const ch
@@ -9281,8 +9281,10 @@ getenv_spec_function (int argc, const ch
value = varname;
value = getenv (argv[0]);
if (!value)
- fatal_error (input_location,
- "environment variable %qs not defined", argv[0]);
- "environment variable %qs not defined", varname);
+ {
+ warning (input_location, "environment variable %qs not defined", argv[0]);
+ warning (input_location, "environment variable %qs not defined", varname);
+ value = "";
+ }


+ 3
- 3
devel/gcc/patches/930-fix-mips-noexecstack.patch View File

@ -48,9 +48,9 @@ sellcey@mips.com
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -19629,6 +19629,9 @@ mips_lra_p (void)
#undef TARGET_LRA_P
#define TARGET_LRA_P mips_lra_p
@@ -22567,6 +22567,9 @@ mips_promote_function_mode (const_tree t
#undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS
#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 2
+#undef TARGET_ASM_FILE_END
+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack


+ 0
- 13
devel/gcc/patches/930-osdefines.patch View File

@ -1,13 +0,0 @@
--- a/libstdc++-v3/config/os/gnu-linux/os_defines.h 2015-01-05 06:33:28.000000000 -0600
+++ b/libstdc++-v3/config/os/gnu-linux/os_defines.h 2016-04-15 12:32:49.374356001 -0500
@@ -41,8 +41,8 @@
// Provide a declaration for the possibly deprecated gets function, as
// glibc 2.15 and later does not declare gets for ISO C11 when
// __GNU_SOURCE is defined.
-#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)
+//#if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE)
# undef _GLIBCXX_HAVE_GETS
-#endif
+//#endif
#endif

+ 175
- 0
devel/gcc/patches/931-libffi-fix-MIPS-softfloat-build-issue.patch View File

@ -0,0 +1,175 @@
From c0c62fa4256f805389f16ebfc4a60cf789129b50 Mon Sep 17 00:00:00 2001
From: BangLang Huang <banglang.huang@foxmail.com>
Date: Wed, 9 Nov 2016 10:36:49 +0800
Subject: [PATCH] libffi: fix MIPS softfloat build issue
Backported from github.com/libffi/libffi#272
Signed-off-by: BangLang Huang <banglang.huang@foxmail.com>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
libffi/src/mips/n32.S | 17 +++++++++++++++++
libffi/src/mips/o32.S | 17 +++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/libffi/src/mips/n32.S b/libffi/src/mips/n32.S
index c6985d30a6f..8f25994773c 100644
--- a/libffi/src/mips/n32.S
+++ b/libffi/src/mips/n32.S
@@ -107,6 +107,16 @@ loadregs:
REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6.
+#ifdef __mips_soft_float
+ REG_L a0, 0*FFI_SIZEOF_ARG(t9)
+ REG_L a1, 1*FFI_SIZEOF_ARG(t9)
+ REG_L a2, 2*FFI_SIZEOF_ARG(t9)
+ REG_L a3, 3*FFI_SIZEOF_ARG(t9)
+ REG_L a4, 4*FFI_SIZEOF_ARG(t9)
+ REG_L a5, 5*FFI_SIZEOF_ARG(t9)
+ REG_L a6, 6*FFI_SIZEOF_ARG(t9)
+ REG_L a7, 7*FFI_SIZEOF_ARG(t9)
+#else
and t4, t6, ((1<<FFI_FLAG_BITS)-1)
REG_L a0, 0*FFI_SIZEOF_ARG(t9)
beqz t4, arg1_next
@@ -193,6 +203,7 @@ arg7_next:
arg8_doublep:
l.d $f19, 7*FFI_SIZEOF_ARG(t9)
arg8_next:
+#endif
callit:
# Load the function pointer
@@ -214,6 +225,7 @@ retint:
b epilogue
retfloat:
+#ifndef __mips_soft_float
bne t6, FFI_TYPE_FLOAT, retdouble
jal t9
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
@@ -272,6 +284,7 @@ retstruct_f_d:
s.s $f0, 0(t4)
s.d $f2, 8(t4)
b epilogue
+#endif
retstruct_d_soft:
bne t6, FFI_TYPE_STRUCT_D_SOFT, retstruct_f_soft
@@ -429,6 +442,7 @@ ffi_closure_N32:
REG_S a6, A6_OFF2($sp)
REG_S a7, A7_OFF2($sp)
+#ifndef __mips_soft_float
# Store all possible float/double registers.
s.d $f12, F12_OFF2($sp)
s.d $f13, F13_OFF2($sp)
@@ -438,6 +452,7 @@ ffi_closure_N32:
s.d $f17, F17_OFF2($sp)
s.d $f18, F18_OFF2($sp)
s.d $f19, F19_OFF2($sp)
+#endif
# Call ffi_closure_mips_inner_N32 to do the real work.
LA t9, ffi_closure_mips_inner_N32
@@ -458,6 +473,7 @@ cls_retint:
b cls_epilogue
cls_retfloat:
+#ifndef __mips_soft_float
bne v0, FFI_TYPE_FLOAT, cls_retdouble
l.s $f0, V0_OFF2($sp)
b cls_epilogue
@@ -500,6 +516,7 @@ cls_retstruct_f_d:
l.s $f0, V0_OFF2($sp)
l.d $f2, V1_OFF2($sp)
b cls_epilogue
+#endif
cls_retstruct_small2:
REG_L v0, V0_OFF2($sp)
diff --git a/libffi/src/mips/o32.S b/libffi/src/mips/o32.S
index eb279813a76..1aff4b14814 100644
--- a/libffi/src/mips/o32.S
+++ b/libffi/src/mips/o32.S
@@ -82,13 +82,16 @@ sixteen:
ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args
+#ifndef __mips_soft_float
bnez t0, pass_d # make it quick for int
+#endif
REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the
REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs.
REG_L a2, 2*FFI_SIZEOF_ARG($sp)
REG_L a3, 3*FFI_SIZEOF_ARG($sp)
b call_it
+#ifndef __mips_soft_float
pass_d:
bne t0, FFI_ARGS_D, pass_f
l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
@@ -130,6 +133,7 @@ pass_f_d:
# bne t0, FFI_ARGS_F_D, call_it
l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float
+#endif
call_it:
# Load the function pointer
@@ -158,14 +162,23 @@ retfloat:
bne t2, FFI_TYPE_FLOAT, retdouble
jalr t9
REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
s.s $f0, 0(t0)
+#else
+ REG_S v0, 0(t0)
+#endif
b epilogue
retdouble:
bne t2, FFI_TYPE_DOUBLE, noretval
jalr t9
REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
s.d $f0, 0(t0)
+#else
+ REG_S v1, 4(t0)
+ REG_S v0, 0(t0)
+#endif
b epilogue
noretval:
@@ -261,9 +274,11 @@ $LCFI7:
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT
+#ifndef __mips_soft_float
# Store all possible float/double registers.
s.d $f12, FA_0_0_OFF2($fp)
s.d $f14, FA_1_0_OFF2($fp)
+#endif
1:
# Call ffi_closure_mips_inner_O32 to do the work.
la t9, ffi_closure_mips_inner_O32
@@ -281,6 +296,7 @@ $LCFI7:
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT
+#ifndef __mips_soft_float
li $9, FFI_TYPE_FLOAT
l.s $f0, V0_OFF2($fp)
beq $8, $9, closure_done
@@ -288,6 +304,7 @@ $LCFI7:
li $9, FFI_TYPE_DOUBLE
l.d $f0, V0_OFF2($fp)
beq $8, $9, closure_done
+#endif
1:
REG_L $3, V1_OFF2($fp)
REG_L $2, V0_OFF2($fp)
--
2.16.3

+ 23
- 1
devel/gcc/patches/940-no-clobber-stamp-bits.patch View File

@ -1,6 +1,28 @@
commit 548d9a008ff265e9eaa3c7e0e6e301c6bd5645e6
Author: Felix Fietkau <nbd@openwrt.org>
Date: Fri Dec 12 17:01:57 2014 +0000
gcc: don't clobber stamp-bits with a symlink to itself
Several versions of gcc have an issue in libstdc++v3 where the build may
clobber stamp-bits with a link to itself. This doesn't manifest itself
on all systems. On several Ubuntu systems, this doesn't appear to be a
problem, but it is an issue on Fedora 16 systems.
To fix the issue, we'll simply filter out stamp-bits from the symlinks
to be generated.
Note: gcc 4.4.7 is unaffected by this issue, so no fix is necessary
there.
Signed-off-by: John Szakmeister <john@szakmeister.net>
SVN-Revision: 43669
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -1421,7 +1421,7 @@ stamp-bits: ${bits_headers}
@@ -1474,7 +1474,7 @@ stamp-bits: ${bits_headers}
@$(STAMP) stamp-bits
stamp-bits-sup: stamp-bits ${bits_sup_headers}


+ 27
- 28
devel/gcc/patches/950-cpp_file_path_translation.patch View File

@ -1,8 +1,18 @@
commit 331735a357a73c7b8adc205241ac3cc6543d985e
Author: Felix Fietkau <nbd@openwrt.org>
Date: Tue Nov 17 12:38:22 2015 +0000
gcc: add a patch to 5.x that supports translation of __FILE__ paths
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 47490
Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47047
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -581,6 +581,10 @@ c_common_handle_option (size_t scode, co
@@ -588,6 +588,10 @@ c_common_handle_option (size_t scode, co
add_path (xstrdup (arg), SYSTEM, 0, true);
break;
@ -15,9 +25,9 @@ Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4
break;
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1528,6 +1528,10 @@ iquote
@@ -1825,6 +1825,10 @@ iquote
C ObjC C++ ObjC++ Joined Separate MissingArgError(missing path after %qs)
-iquote <dir> Add <dir> to the end of the quote include path
-iquote <dir> Add <dir> to the end of the quote include path.
+iremap
+C ObjC C++ ObjC++ Joined Separate
@ -25,22 +35,22 @@ Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4
+
iwithprefix
C ObjC C++ ObjC++ Joined Separate
-iwithprefix <dir> Add <dir> to the end of the system include path
-iwithprefix <dir> Add <dir> to the end of the system include path.
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -4441,6 +4441,7 @@ without notice.
@@ -4272,6 +4272,7 @@ Refer to the GCC manual for full documen
@c man begin SYNOPSIS
cpp [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
[@option{-I}@var{dir}@dots{}] [@option{-iquote}@var{dir}@dots{}]
+ [@option{-iremap}@var{src}:@var{dst}]
[@option{-W}@var{warn}@dots{}]
[@option{-M}|@option{-MM}] [@option{-MG}] [@option{-MF} @var{filename}]
[@option{-MP}] [@option{-MQ} @var{target}@dots{}]
[@option{-MT} @var{target}@dots{}]
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
@@ -532,6 +532,12 @@ Search @var{dir} only for header files r
If @var{dir} begins with @code{=}, then the @code{=} will be replaced
by the sysroot prefix; see @option{--sysroot} and @option{-isysroot}.
@@ -220,6 +220,12 @@ extensions @samp{.i}, @samp{.ii} or @sam
extensions that GCC uses for preprocessed files created by
@option{-save-temps}.
+@item -iremap @var{src}:@var{dst}
+@opindex iremap
@ -53,20 +63,9 @@ Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4
When preprocessing, handle directives, but do not expand macros.
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -494,8 +494,8 @@ Objective-C and Objective-C++ Dialects}.
@item Directory Options
@xref{Directory Options,,Options for Directory Search}.
@gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
--iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
---sysroot=@var{dir} --no-sysroot-suffix}
+-iquote@var{dir} -iremap@var{src}:@var{dst} -L@var{dir} -specs=@var{file} @gol
+-I- --sysroot=@var{dir} --no-sysroot-suffix}
@item Machine Dependent Options
@xref{Submodel Options,,Hardware Models and Configurations}.
@@ -11479,6 +11479,12 @@ be searched for header files only for th
"@var{file}"}; they are not searched for @code{#include <@var{file}>},
otherwise just like @option{-I}.
@@ -11871,6 +11871,12 @@ by @option{-fplugin=@var{name}} instead
@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
to be used by the user, but only passed by the driver.
+@item -iremap @var{src}:@var{dst}
+@opindex iremap
@ -79,7 +78,7 @@ Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4
Add directory @var{dir} to the list of directories to be searched
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -751,6 +751,9 @@ extern void cpp_set_lang (cpp_reader *,
@@ -820,6 +820,9 @@ extern void cpp_set_lang (cpp_reader *,
/* Set the include paths. */
extern void cpp_set_include_chains (cpp_reader *, cpp_dir *, cpp_dir *, int);
@ -91,7 +90,7 @@ Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4
call cpp_finish on that reader. You can either edit the callbacks
--- a/libcpp/macro.c
+++ b/libcpp/macro.c
@@ -224,6 +224,64 @@ static const char * const monthnames[] =
@@ -227,6 +227,64 @@ static const char * const monthnames[] =
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
@ -156,7 +155,7 @@ Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4
/* Helper function for builtin_macro. Returns the text generated by
a builtin macro. */
const uchar *
@@ -286,6 +344,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
@@ -290,6 +348,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
{
unsigned int len;
const char *name;
@ -164,7 +163,7 @@ Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4
uchar *buf;
if (node->value.builtin == BT_FILE)
@@ -297,6 +356,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
@@ -301,6 +360,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
if (!name)
abort ();
}
@ -172,7 +171,7 @@ Forward ported from attachment to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=4
len = strlen (name);
buf = _cpp_unaligned_alloc (pfile, len * 2 + 3);
result = buf;
@@ -304,6 +364,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
@@ -308,6 +368,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi
buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len);
*buf++ = '"';
*buf = '\0';


+ 0
- 11
devel/gcc/patches/960-go_libm.patch View File

@ -1,11 +0,0 @@
--- a/gcc/go/Make-lang.in
+++ b/gcc/go/Make-lang.in
@@ -74,7 +74,7 @@ go_OBJS = $(GO_OBJS) go/gospec.o
go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
+$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
- $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
+ $(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS) -lm
# Documentation.

+ 73
- 0
devel/gcc/patches/960-gotools-fix-compilation-when-making-cross-compiler.patch View File

@ -0,0 +1,73 @@
From dda6b050cd74a352670787a294596a9c56c21327 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Fri, 4 May 2018 18:20:53 +0800
Subject: [PATCH] gotools: fix compilation when making cross compiler
libgo is "the runtime support library for the Go programming language.
This library is intended for use with the Go frontend."
gccgo will link target files with libgo.so which depends on libgcc_s.so.1, but
the linker will complain that it cannot find it. That's because shared libgcc
is not present in the install directory yet. libgo.so was made without problem
because gcc will emit -lgcc_s when compiled with -shared option. When gotools
were being made, it was supplied with -static-libgcc thus no link option was
provided. Check LIBGO in gcc/go/gcc-spec.c for how gccgo make a builtin spec
for linking with libgo.so
- GccgoCrossCompilation, https://github.com/golang/go/wiki/GccgoCrossCompilation
- Cross-building instructions, http://www.eglibc.org/archives/patches/msg00078.html
When 3-pass GCC compilation is used, shared libgcc runtime libraries will be
available after gcc pass2 completed and will meet the gotools link requirement
at gcc pass3
---
gotools/Makefile.am | 4 +++-
gotools/Makefile.in | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/gotools/Makefile.am b/gotools/Makefile.am
index 5f3940a278b..9c22f5df103 100644
--- a/gotools/Makefile.am
+++ b/gotools/Makefile.am
@@ -26,6 +26,7 @@ PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >
libgodir = ../$(target_noncanonical)/libgo
+libgccdir = ../$(target_noncanonical)/libgcc
LIBGODEP = $(libgodir)/libgo.la
if NATIVE
@@ -38,7 +39,8 @@ endif
GOCFLAGS = $(CFLAGS_FOR_TARGET)
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
cmdsrcdir = $(srcdir)/../libgo/go/cmd
diff --git a/gotools/Makefile.in b/gotools/Makefile.in
index 4386576b011..0bdd9290e01 100644
--- a/gotools/Makefile.in
+++ b/gotools/Makefile.in
@@ -252,13 +252,15 @@ mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
PWD_COMMAND = $${PWDCMD-pwd}
STAMP = echo timestamp >
libgodir = ../$(target_noncanonical)/libgo
+libgccdir = ../$(target_noncanonical)/libgcc
LIBGODEP = $(libgodir)/libgo.la
@NATIVE_FALSE@GOCOMPILER = $(GOC)
# Use the compiler we just built.
@NATIVE_TRUE@GOCOMPILER = $(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET)
GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS)
-AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs
+AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs \
+ -L $(libgccdir) -L $(libgccdir)/.libs -lgcc_s
GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@
cmdsrcdir = $(srcdir)/../libgo/go/cmd
go_cmd_go_files = \
--
2.16.3

+ 0
- 11
devel/gcc/patches/970-warn_bug.patch View File

@ -1,11 +0,0 @@
--- a/libgo/runtime/mprof.goc
+++ b/libgo/runtime/mprof.goc
@@ -403,7 +403,7 @@ func ThreadCreateProfile(p Slice) (n int
func Stack(b Slice, all bool) (n int) {
byte *pc, *sp;
- bool enablegc;
+ bool enablegc = false; /* workaround GCC bug #36550 */
sp = runtime_getcallersp(&b);
pc = (byte*)(uintptr)runtime_getcallerpc(&b);

Loading…
Cancel
Save