summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-02-02 21:26:03 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-07 17:30:00 +0000
commit92ae4e290292d88ae6dabc0a53ef7aa5c9cedf28 (patch)
tree97b9d06a7c629bc18f69274c5ad077eed2ce331d
parent9e5222c532a5232a8971f3beecb7100b35ea6537 (diff)
downloadpoky-92ae4e290292d88ae6dabc0a53ef7aa5c9cedf28.tar.gz
gcc: musl related fixes for ppc/secure-plt and gthr
These issues are fixing building gcc for target, ppc issue helps in fixing discrepency between gcc cmdline and linker cmdline (From OE-Core rev: 6af50d8865335aed68fb4f9b319edb81ce93a04e) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.3.inc2
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.3/0049-Disable-the-weak-reference-logic-in-gthr.h-for-os-ge.patch78
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.3/0050-powerpc-pass-secure-plt-to-the-linker.patch66
3 files changed, 146 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-5.3.inc b/meta/recipes-devtools/gcc/gcc-5.3.inc
index 83e061f44f..214af10c51 100644
--- a/meta/recipes-devtools/gcc/gcc-5.3.inc
+++ b/meta/recipes-devtools/gcc/gcc-5.3.inc
@@ -78,6 +78,8 @@ SRC_URI = "\
78 file://0046-Get-rid-of-ever-broken-fixincludes-on-musl.patch \ 78 file://0046-Get-rid-of-ever-broken-fixincludes-on-musl.patch \
79 file://0047-nios2-Define-MUSL_DYNAMIC_LINKER.patch \ 79 file://0047-nios2-Define-MUSL_DYNAMIC_LINKER.patch \
80 file://0048-ssp_nonshared.patch \ 80 file://0048-ssp_nonshared.patch \
81 file://0049-Disable-the-weak-reference-logic-in-gthr.h-for-os-ge.patch \
82 file://0050-powerpc-pass-secure-plt-to-the-linker.patch \
81 " 83 "
82 84
83BACKPORTS = "" 85BACKPORTS = ""
diff --git a/meta/recipes-devtools/gcc/gcc-5.3/0049-Disable-the-weak-reference-logic-in-gthr.h-for-os-ge.patch b/meta/recipes-devtools/gcc/gcc-5.3/0049-Disable-the-weak-reference-logic-in-gthr.h-for-os-ge.patch
new file mode 100644
index 0000000000..0ea5143e0d
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-5.3/0049-Disable-the-weak-reference-logic-in-gthr.h-for-os-ge.patch
@@ -0,0 +1,78 @@
1From 553d8e3b9073ff3e0a9d2fac9b1823fb17ad247c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 2 Feb 2016 21:00:18 -0800
4Subject: [PATCH 49/51] Disable the weak reference logic in gthr.h for
5 os/generic
6
7It does not work unless work arounds are there in gthr-posix.h
8
9origin of patch
10http://port70.net/~nsz/musl/gcc-5.3.0/0004-gthr.patch
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14Upstream-Status: Pending
15
16 libgfortran/acinclude.m4 | 2 +-
17 libgfortran/configure | 2 +-
18 libstdc++-v3/config/os/generic/os_defines.h | 5 +++++
19 libstdc++-v3/configure.host | 3 +++
20 4 files changed, 10 insertions(+), 2 deletions(-)
21
22diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4
23index ba890f9..30b8b1a6 100644
24--- a/libgfortran/acinclude.m4
25+++ b/libgfortran/acinclude.m4
26@@ -100,7 +100,7 @@ void foo (void);
27 [Define to 1 if the target supports #pragma weak])
28 fi
29 case "$host" in
30- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
31+ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
32 AC_DEFINE(GTHREAD_USE_WEAK, 0,
33 [Define to 0 if the target shouldn't use #pragma weak])
34 ;;
35diff --git a/libgfortran/configure b/libgfortran/configure
36index 5d47e65..cdf9695 100755
37--- a/libgfortran/configure
38+++ b/libgfortran/configure
39@@ -26456,7 +26456,7 @@ $as_echo "#define SUPPORTS_WEAK 1" >>confdefs.h
40
41 fi
42 case "$host" in
43- *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* )
44+ *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | *-*-musl* )
45
46 $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h
47
48diff --git a/libstdc++-v3/config/os/generic/os_defines.h b/libstdc++-v3/config/os/generic/os_defines.h
49index 45bf52a..103ec0e 100644
50--- a/libstdc++-v3/config/os/generic/os_defines.h
51+++ b/libstdc++-v3/config/os/generic/os_defines.h
52@@ -33,4 +33,9 @@
53 // System-specific #define, typedefs, corrections, etc, go here. This
54 // file will come before all others.
55
56+// Disable the weak reference logic in gthr.h for os/generic because it
57+// is broken on every platform unless there is implementation specific
58+// workaround in gthr-posix.h and at link-time for static linking.
59+#define _GLIBCXX_GTHREAD_USE_WEAK 0
60+
61 #endif
62diff --git a/libstdc++-v3/configure.host b/libstdc++-v3/configure.host
63index 1756444..2a87bb8 100644
64--- a/libstdc++-v3/configure.host
65+++ b/libstdc++-v3/configure.host
66@@ -273,6 +273,9 @@ case "${host_os}" in
67 freebsd*)
68 os_include_dir="os/bsd/freebsd"
69 ;;
70+ linux-musl*)
71+ os_include_dir="os/generic"
72+ ;;
73 gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
74 # check for musl by target
75 case "${host_os}" in
76--
772.7.0
78
diff --git a/meta/recipes-devtools/gcc/gcc-5.3/0050-powerpc-pass-secure-plt-to-the-linker.patch b/meta/recipes-devtools/gcc/gcc-5.3/0050-powerpc-pass-secure-plt-to-the-linker.patch
new file mode 100644
index 0000000000..b2f2bbdf46
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-5.3/0050-powerpc-pass-secure-plt-to-the-linker.patch
@@ -0,0 +1,66 @@
1From 4fa0cf03678f849917dcc3d149989b7fecdbe276 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 2 Feb 2016 21:10:00 -0800
4Subject: [PATCH 50/51] powerpc pass --secure-plt to the linker
5
6Secure-plt when enabled does not pass right options to linker
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10Upstream-Status: Pending
11 gcc/config/rs6000/linux64.h | 4 ++++
12 gcc/config/rs6000/sysv4.h | 2 ++
13 2 files changed, 6 insertions(+)
14
15diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
16index 679da4b..3ca7cd7 100644
17--- a/gcc/config/rs6000/linux64.h
18+++ b/gcc/config/rs6000/linux64.h
19@@ -174,20 +174,24 @@ extern int dot_symbols;
20 #undef ASM_DEFAULT_SPEC
21 #undef ASM_SPEC
22 #undef LINK_OS_LINUX_SPEC
23+#undef LINK_SECURE_PLT_SPEC
24
25 #ifndef RS6000_BI_ARCH
26 #define ASM_DEFAULT_SPEC "-mppc64"
27 #define ASM_SPEC "%(asm_spec64) %(asm_spec_common)"
28 #define LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)"
29+#define LINK_SECURE_PLT_SPEC ""
30 #else
31 #if DEFAULT_ARCH64_P
32 #define ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
33 #define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
34 #define LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}"
35+#define LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
36 #else
37 #define ASM_DEFAULT_SPEC "-mppc%{m64:64}"
38 #define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
39 #define LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}"
40+#define LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
41 #endif
42 #endif
43
44diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
45index 8794fa5..0835551 100644
46--- a/gcc/config/rs6000/sysv4.h
47+++ b/gcc/config/rs6000/sysv4.h
48@@ -571,6 +571,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
49 : %(link_start_default) }"
50
51 #define LINK_START_DEFAULT_SPEC ""
52+#define LINK_SECURE_PLT_SPEC LINK_SECURE_PLT_DEFAULT_SPEC
53
54 #undef LINK_SPEC
55 #define LINK_SPEC "\
56@@ -578,6 +579,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
57 %{R*} \
58 %(link_shlib) \
59 %{!T*: %(link_start) } \
60+%{!static: %{!mbss-plt: %(link_secure_plt_default)}} \
61 %(link_os)"
62
63 /* Shared libraries are not default. */
64--
652.7.0
66