New package: gcc6-6.5.0

This is the first part of an effort to allow bootstrapping openjdk
without downloading any binaries. The next part will be an openjdk7
package that will be used to bootstrap openjdk8.

After that, we can proceed to add the missing parts to go all the
way up to 11.

[ci skip]
This commit is contained in:
q66 2019-11-12 18:06:45 +01:00 committed by Duncan Overbruck
parent 9046ff61b7
commit 6f1c7ff607
32 changed files with 1853 additions and 0 deletions

View file

@ -3665,3 +3665,7 @@ librte_cryptodev.so.8 dpdk-19.08_1
librte_rawdev.so.1 dpdk-19.08_1
librte_kni.so.2 dpdk-19.08_1
libredwg.so.0 libredwg-0.9_1
libgcj-tools.so.17 libgcj-6.5.0_1
libgcj_bc.so.1 libgcj-6.5.0_1
libgcj.so.17 libgcj-6.5.0_1
libgij.so.17 libgcj-6.5.0_1

1
srcpkgs/gcc6-gcj Symbolic link
View file

@ -0,0 +1 @@
gcc6

1
srcpkgs/gcc6-gcj-ecj Symbolic link
View file

@ -0,0 +1 @@
gcc6

1
srcpkgs/gcc6-gcj-jdk-compat Symbolic link
View file

@ -0,0 +1 @@
gcc6

View file

@ -0,0 +1,215 @@
# DP: Turn on -fstack-protector by default for C, C++, ObjC, ObjC++.
# DP: Build libgcc using -fno-stack-protector.
---
gcc/Makefile.in | 2 ++
gcc/cp/lang-specs.h | 6 +++---
gcc/doc/invoke.texi | 4 ++++
gcc/gcc.c | 18 ++++++++++++++----
gcc/objc/lang-specs.h | 10 +++++-----
gcc/objcp/lang-specs.h | 8 ++++----
6 files changed, 32 insertions(+), 16 deletions(-)
Index: b/gcc/gcc.c
===================================================================
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -858,6 +858,14 @@ proper position among the other output f
#define LINK_GCC_C_SEQUENCE_SPEC "%G %L %G"
#endif
+#ifndef SSP_DEFAULT_SPEC
+#ifdef TARGET_LIBC_PROVIDES_SSP
+#define SSP_DEFAULT_SPEC "%{!fno-stack-protector:%{!fstack-protector-all:%{!ffreestanding:%{!nostdlib:%{!fstack-protector:-fstack-protector-strong}}}}}"
+#else
+#define SSP_DEFAULT_SPEC ""
+#endif
+#endif
+
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
@@ -1057,6 +1065,7 @@ static const char *cc1_spec = CC1_SPEC;
static const char *cc1plus_spec = CC1PLUS_SPEC;
static const char *link_gcc_c_sequence_spec = LINK_GCC_C_SEQUENCE_SPEC;
static const char *link_ssp_spec = LINK_SSP_SPEC;
+static const char *ssp_default_spec = SSP_DEFAULT_SPEC;
static const char *asm_spec = ASM_SPEC;
static const char *asm_final_spec = ASM_FINAL_SPEC;
static const char *link_spec = LINK_SPEC;
@@ -1112,7 +1121,7 @@ static const char *cpp_unique_options =
static const char *cpp_options =
"%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
%{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\
- %{undef} %{save-temps*:-fpch-preprocess}";
+ %{undef} %{save-temps*:-fpch-preprocess} %(ssp_default)";
/* This contains cpp options which are not passed when the preprocessor
output will be used by another program. */
@@ -1301,9 +1310,9 @@ static const struct compiler default_com
%{save-temps*|traditional-cpp|no-integrated-cpp:%(trad_capable_cpp) \
%(cpp_options) -o %{save-temps*:%b.i} %{!save-temps*:%g.i} \n\
cc1 -fpreprocessed %{save-temps*:%b.i} %{!save-temps*:%g.i} \
- %(cc1_options)}\
+ %(cc1_options) %(ssp_default)}\
%{!save-temps*:%{!traditional-cpp:%{!no-integrated-cpp:\
- cc1 %(cpp_unique_options) %(cc1_options)}}}\
+ cc1 %(cpp_unique_options) %(cc1_options) %(ssp_default)}}}\
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 1},
{"-",
"%{!E:%e-E or -x required when input is from standard input}\
@@ -1328,7 +1337,7 @@ static const struct compiler default_com
%W{o*:--output-pch=%*}}%V}}}}}}}", 0, 0, 0},
{".i", "@cpp-output", 0, 0, 0},
{"@cpp-output",
- "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
+ "%{!M:%{!MM:%{!E:cc1 -fpreprocessed %i %(cc1_options) %(ssp_default) %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
{".s", "@assembler", 0, 0, 0},
{"@assembler",
"%{!M:%{!MM:%{!E:%{!S:as %(asm_debug) %(asm_options) %i %A }}}}", 0, 0, 0},
@@ -1560,6 +1569,7 @@ static struct spec_list static_specs[] =
INIT_STATIC_SPEC ("cc1plus", &cc1plus_spec),
INIT_STATIC_SPEC ("link_gcc_c_sequence", &link_gcc_c_sequence_spec),
INIT_STATIC_SPEC ("link_ssp", &link_ssp_spec),
+ INIT_STATIC_SPEC ("ssp_default", &ssp_default_spec),
INIT_STATIC_SPEC ("endfile", &endfile_spec),
INIT_STATIC_SPEC ("link", &link_spec),
INIT_STATIC_SPEC ("lib", &lib_spec),
Index: b/gcc/cp/lang-specs.h
===================================================================
--- a/gcc/cp/lang-specs.h
+++ b/gcc/cp/lang-specs.h
@@ -46,7 +46,7 @@ along with GCC; see the file COPYING3.
%(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
%{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
- %(cc1_options) %2\
+ %(cc1_options) %(ssp_default) %2\
%{!fsyntax-only:-o %g.s \
%{!fdump-ada-spec*:%{!o*:--output-pch=%i.gch}\
%W{o*:--output-pch=%*}}%V}}}}",
@@ -58,11 +58,11 @@ along with GCC; see the file COPYING3.
%(cpp_options) %2 -o %{save-temps*:%b.ii} %{!save-temps*:%g.ii} \n}\
cc1plus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.ii} %{!save-temps*:%g.ii}}\
%{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
- %(cc1_options) %2\
+ %(cc1_options) %(ssp_default) %2\
%{!fsyntax-only:%(invoke_as)}}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{".ii", "@c++-cpp-output", 0, 0, 0},
{"@c++-cpp-output",
"%{!M:%{!MM:%{!E:\
- cc1plus -fpreprocessed %i %(cc1_options) %2\
+ cc1plus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
Index: b/gcc/params.def
===================================================================
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -673,7 +673,7 @@ DEFPARAM (PARAM_INTEGER_SHARE_LIMIT,
DEFPARAM (PARAM_SSP_BUFFER_SIZE,
"ssp-buffer-size",
"The lower bound for a buffer to be considered for stack smashing protection.",
- 8, 1, 0)
+ 4, 1, 0)
DEFPARAM (PARAM_MIN_SIZE_FOR_STACK_SHARING,
"min-size-for-stack-sharing",
Index: b/gcc/objc/lang-specs.h
===================================================================
--- a/gcc/objc/lang-specs.h
+++ b/gcc/objc/lang-specs.h
@@ -29,9 +29,9 @@ along with GCC; see the file COPYING3.
%{traditional|traditional-cpp:\
%eGNU Objective C no longer supports traditional compilation}\
%{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
- cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}\
+ cc1obj -fpreprocessed %{save-temps*:%b.mi} %{!save-temps*:%g.mi} %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}}\
%{!save-temps*:%{!no-integrated-cpp:\
- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}}}\
+ cc1obj %(cpp_unique_options) %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}}}\
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
{"@objective-c-header",
"%{E|M|MM:cc1obj -E %{traditional|traditional-cpp:-traditional-cpp}\
@@ -40,18 +40,18 @@ along with GCC; see the file COPYING3.
%{traditional|traditional-cpp:\
%eGNU Objective C no longer supports traditional compilation}\
%{save-temps*|no-integrated-cpp:cc1obj -E %(cpp_options) -o %{save-temps*:%b.mi} %{!save-temps*:%g.mi} \n\
- cc1obj -fpreprocessed %b.mi %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
+ cc1obj -fpreprocessed %b.mi %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
-o %g.s %{!o*:--output-pch=%i.gch}\
%W{o*:--output-pch=%*}%V}\
%{!save-temps*:%{!no-integrated-cpp:\
- cc1obj %(cpp_unique_options) %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
+ cc1obj %(cpp_unique_options) %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
-o %g.s %{!o*:--output-pch=%i.gch}\
%W{o*:--output-pch=%*}%V}}}}}", 0, 0, 0},
{".mi", "@objective-c-cpp-output", 0, 0, 0},
{"@objective-c-cpp-output",
- "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
+ "%{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
{"@objc-cpp-output",
"%nobjc-cpp-output is deprecated; please use objective-c-cpp-output instead\n\
- %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %{print-objc-runtime-info} %{gen-decls}\
+ %{!M:%{!MM:%{!E:cc1obj -fpreprocessed %i %(cc1_options) %(ssp_default) %{print-objc-runtime-info} %{gen-decls}\
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
Index: b/gcc/objcp/lang-specs.h
===================================================================
--- a/gcc/objcp/lang-specs.h
+++ b/gcc/objcp/lang-specs.h
@@ -36,7 +36,7 @@ along with GCC; see the file COPYING3.
%(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
%{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
- %(cc1_options) %2\
+ %(cc1_options) %(ssp_default) %2\
-o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*}%V}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{"@objective-c++",
@@ -46,16 +46,16 @@ along with GCC; see the file COPYING3.
%(cpp_options) %2 -o %{save-temps*:%b.mii} %{!save-temps*:%g.mii} \n}\
cc1objplus %{save-temps*|no-integrated-cpp:-fpreprocessed %{save-temps*:%b.mii} %{!save-temps*:%g.mii}}\
%{!save-temps*:%{!no-integrated-cpp:%(cpp_unique_options)}}\
- %(cc1_options) %2\
+ %(cc1_options) %(ssp_default) %2\
%{!fsyntax-only:%(invoke_as)}}}}",
CPLUSPLUS_CPP_SPEC, 0, 0},
{".mii", "@objective-c++-cpp-output", 0, 0, 0},
{"@objective-c++-cpp-output",
"%{!M:%{!MM:%{!E:\
- cc1objplus -fpreprocessed %i %(cc1_options) %2\
+ cc1objplus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
{"@objc++-cpp-output",
"%nobjc++-cpp-output is deprecated; please use objective-c++-cpp-output instead\n\
%{!M:%{!MM:%{!E:\
- cc1objplus -fpreprocessed %i %(cc1_options) %2\
+ cc1objplus -fpreprocessed %i %(cc1_options) %(ssp_default) %2\
%{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0},
Index: b/gcc/doc/invoke.texi
===================================================================
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -9247,6 +9247,9 @@
The minimum size of variables taking part in stack slot sharing when not
optimizing. The default value is 32.
+The Alpine Linux default is "4", to increase
+the number of functions protected by the stack protector.
+
@item max-jump-thread-duplication-stmts
Maximum number of statements allowed in a block that needs to be
duplicated when threading jumps.
@@ -10185,6 +10188,11 @@
Like @option{-fstack-protector} but includes additional functions to
be protected --- those that have local array definitions, or have
references to local frame addresses.
+
+NOTE: In Alpine Linux,
+@option{-fstack-protector-strong} is enabled by default for C,
+C++, ObjC, ObjC++, if none of @option{-fno-stack-protector},
+@option{-nostdlib}, nor @option{-ffreestanding} are found.
@item -fstack-protector-explicit
@opindex fstack-protector-explicit

View file

@ -0,0 +1,33 @@
# Turn on -Wl,-z,relro,-z,now by default.
---
gcc/doc/invoke.texi | 3 +++
gcc/gcc.c | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
Index: b/gcc/doc/invoke.texi
===================================================================
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -11424,6 +11424,9 @@ For example, @option{-Wl,-Map,output.map
linker. When using the GNU linker, you can also get the same effect with
@option{-Wl,-Map=output.map}.
+NOTE: In Alpine Linux, for LDFLAGS, the option
+@option{-Wl,-z,relro,now} is used. To disable, use @option{-Wl,-z,norelro}.
+
@item -u @var{symbol}
@opindex u
Pretend the symbol @var{symbol} is undefined, to force linking of
Index: b/gcc/gcc.c
===================================================================
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -890,6 +890,7 @@ proper position among the other output f
"%{flto|flto=*:%<fcompare-debug*} \
%{flto} %{fno-lto} %{flto=*} %l " LINK_PIE_SPEC \
"%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
+ "-z relro -z now " \
"%X %{o*} %{e*} %{N} %{n} %{r}\
%{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}} " VTABLE_VERIFICATION_SPEC " \
%{static:} %{L*} %(mfwrap) %(link_libgcc) " SANITIZER_EARLY_SPEC " %o\

View file

@ -0,0 +1,40 @@
# DP: Turn on -D_FORTIFY_SOURCE=2 by default for C, C++, ObjC, ObjC++,
# DP: if the optimization level is > 0
---
gcc/doc/invoke.texi | 6 ++++++
gcc/c-family/c-cppbuiltin.c | 3 +
2 files changed, 9 insertions(+), 0 deletions(-)
Index: b/gcc/doc/invoke.texi
===================================================================
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -7840,6 +7840,12 @@ also turns on the following optimization
Please note the warning under @option{-fgcse} about
invoking @option{-O2} on programs that use computed gotos.
+NOTE: In Alpine Linux, @option{-D_FORTIFY_SOURCE=2} is
+set by default, and is activated when @option{-O} is set to 2 or higher.
+This enables additional compile-time and run-time checks for several libc
+functions. To disable, specify either @option{-U_FORTIFY_SOURCE} or
+@option{-D_FORTIFY_SOURCE=0}.
+
@item -O3
@opindex O3
Optimize yet more. @option{-O3} turns on all optimizations specified
Index: b/gcc/c-family/c-cppbuiltin.c
===================================================================
--- a/gcc/c-family/c-cppbuiltin.c
+++ b/gcc/c-family/c-cppbuiltin.c
@@ -1176,6 +1176,10 @@ c_cpp_builtins (cpp_reader *pfile)
builtin_define_with_value ("__REGISTER_PREFIX__", REGISTER_PREFIX, 0);
builtin_define_with_value ("__USER_LABEL_PREFIX__", user_label_prefix, 0);
+ /* Fortify Source enabled by default for optimization levels > 0 */
+ if (optimize)
+ builtin_define_with_int_value ("_FORTIFY_SOURCE", 2);
+
/* Misc. */
if (flag_gnu89_inline)
cpp_define (pfile, "__GNUC_GNU_INLINE__");

View file

@ -0,0 +1,241 @@
# DP: On linux targets pass --as-needed by default to the linker, but always
# DP: link the sanitizer libraries with --no-as-needed.
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -568,8 +568,11 @@ proper position among the other output f
#ifdef LIBTSAN_EARLY_SPEC
#define LIBTSAN_SPEC STATIC_LIBTSAN_LIBS
#elif defined(HAVE_LD_STATIC_DYNAMIC)
-#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION \
- "} -ltsan %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
+#define LIBTSAN_SPEC "%{static-libtsan:" LD_STATIC_OPTION "}" \
+ " %{!static-libtsan:%{!fuse-ld=gold:--push-state }--no-as-needed}" \
+ " -ltsan " \
+ " %{static-libtsan:" LD_DYNAMIC_OPTION "}" \
+ " %{!static-libtsan:%{fuse-ld=gold:--as-needed;:--pop-state}}" \
STATIC_LIBTSAN_LIBS
#else
#define LIBTSAN_SPEC "-ltsan" STATIC_LIBTSAN_LIBS
--- a/gcc/config/gnu-user.h
+++ b/gcc/config/gnu-user.h
@@ -124,13 +124,13 @@
#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \
"%{static-libasan:%{!shared:" \
LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
- LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
+ LD_DYNAMIC_OPTION "}}%{!static-libasan:%{!fuse-ld=gold:--push-state} --no-as-needed -lasan %{fuse-ld=gold:--as-needed;:--pop-state}}"
#undef LIBTSAN_EARLY_SPEC
#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \
LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \
- LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}"
+ LD_DYNAMIC_OPTION "}}%{!static-libtsan:%{!fuse-ld=gold:--push-state} --no-as-needed -ltsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
#undef LIBLSAN_EARLY_SPEC
#define LIBLSAN_EARLY_SPEC "%{static-liblsan:%{!shared:" \
LD_STATIC_OPTION " --whole-archive -llsan --no-whole-archive " \
- LD_DYNAMIC_OPTION "}}%{!static-liblsan:-llsan}"
+ LD_DYNAMIC_OPTION "}}%{!static-liblsan:%{!fuse-ld=gold:--push-state} --no-as-needed -llsan %{fuse-ld=gold:--as-needed;:--pop-state}}"
#endif
Index: b/gcc/config/aarch64/aarch64-linux.h
===================================================================
--- a/gcc/config/aarch64/aarch64-linux.h
+++ b/gcc/config/aarch64/aarch64-linux.h
@@ -36,5 +36,6 @@
#define LINUX_TARGET_LINK_SPEC "%{h*} \
+ --as-needed \
%{static:-Bstatic} \
%{shared:-shared} \
%{symbolic:-Bsymbolic} \
Index: b/gcc/config/ia64/linux.h
===================================================================
--- a/gcc/config/ia64/linux.h
+++ b/gcc/config/ia64/linux.h
@@ -58,7 +58,7 @@ do { \
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
#undef LINK_SPEC
-#define LINK_SPEC "\
+#define LINK_SPEC " --as-needed \
%{shared:-shared} \
%{!shared: \
%{!static: \
Index: b/gcc/config/sparc/linux.h
===================================================================
--- a/gcc/config/sparc/linux.h
+++ b/gcc/config/sparc/linux.h
@@ -86,7 +86,7 @@ extern const char *host_detect_local_cpu
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
#undef LINK_SPEC
-#define LINK_SPEC "-m elf32_sparc %{shared:-shared} \
+#define LINK_SPEC "-m elf32_sparc --as-needed %{shared:-shared} \
%{!mno-relax:%{!r:-relax}} \
%{!shared: \
%{!static: \
Index: b/gcc/config/s390/linux.h
===================================================================
--- a/gcc/config/s390/linux.h
+++ b/gcc/config/s390/linux.h
@@ -65,7 +65,7 @@ along with GCC; see the file COPYING3.
#undef LINK_SPEC
#define LINK_SPEC \
- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --as-needed \
%{shared:-shared} \
%{!shared: \
%{static:-static} \
Index: b/gcc/config/rs6000/linux64.h
===================================================================
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -466,12 +466,12 @@ extern int dot_symbols;
" -m elf64ppc")
#endif
-#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " --as-needed %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}} \
%(link_os_extra_spec32)"
-#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " --as-needed %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}} \
%(link_os_extra_spec64)"
Index: b/gcc/config/rs6000/sysv4.h
===================================================================
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -784,7 +784,7 @@ ENDIAN_SELECT(" -mbig", " -mlittle", DEF
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
MUSL_DYNAMIC_LINKER)
-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --as-needed %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
Index: b/gcc/config/i386/gnu-user64.h
===================================================================
--- a/gcc/config/i386/gnu-user64.h
+++ b/gcc/config/i386/gnu-user64.h
@@ -57,5 +57,6 @@ see the files COPYING3 and COPYING.RUNTI
%{" SPEC_32 ":-m " GNU_USER_LINK_EMULATION32 "} \
%{" SPEC_X32 ":-m " GNU_USER_LINK_EMULATIONX32 "} \
+ --as-needed \
%{shared:-shared} \
%{!shared: \
%{!static: \
Index: b/gcc/config/i386/gnu-user.h
===================================================================
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -74,7 +74,7 @@ along with GCC; see the file COPYING3.
{ "link_emulation", GNU_USER_LINK_EMULATION },\
{ "dynamic_linker", GNU_USER_DYNAMIC_LINKER }
-#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
+#define GNU_USER_TARGET_LINK_SPEC "-m %(link_emulation) --as-needed %{shared:-shared} \
%{!shared: \
%{!static: \
%{rdynamic:-export-dynamic} \
Index: b/gcc/config/alpha/linux-elf.h
===================================================================
--- a/gcc/config/alpha/linux-elf.h
+++ b/gcc/config/alpha/linux-elf.h
@@ -37,7 +37,7 @@ along with GCC; see the file COPYING3.
#define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER
-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
+#define LINK_SPEC "-m elf64alpha --as-needed %{G*} %{relax:-relax} \
%{O*:-O3} %{!O*:-O1} \
%{shared:-shared} \
%{!shared: \
Index: b/gcc/config/arm/linux-elf.h
===================================================================
--- a/gcc/config/arm/linux-elf.h
+++ b/gcc/config/arm/linux-elf.h
@@ -73,5 +73,6 @@
%{!shared:-dynamic-linker " GNU_USER_DYNAMIC_LINKER "}} \
-X \
+ --as-needed \
%{mbig-endian:-EB} %{mlittle-endian:-EL}" \
SUBTARGET_EXTRA_LINK_SPEC
Index: b/gcc/config/mips/gnu-user.h
===================================================================
--- a/gcc/config/mips/gnu-user.h
+++ b/gcc/config/mips/gnu-user.h
@@ -55,6 +55,7 @@ along with GCC; see the file COPYING3.
#undef GNU_USER_TARGET_LINK_SPEC
#define GNU_USER_TARGET_LINK_SPEC "\
%{G*} %{EB} %{EL} %{mips*} %{shared} \
+ --as-needed \
%{!shared: \
%{!static: \
%{rdynamic:-export-dynamic} \
Index: b/libjava/Makefile.am
===================================================================
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -627,14 +631,14 @@
rm .libs/libgcj_bc.so; \
mv .libs/libgcj_bc.so.1.0.0 .libs/libgcj_bc.so; \
$(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
- -o .libs/libgcj_bc.so.1.0.0 -lgcj || exit; \
+ -o .libs/libgcj_bc.so.1.0.0 -Wl,--no-as-needed -lgcj || exit; \
rm .libs/libgcj_bc.so.1; \
$(LN_S) libgcj_bc.so.1.0.0 .libs/libgcj_bc.so.1
## This rule creates the libgcj_bc library that is actually installed.
install/libgcj_bc.la: $(libgcj_bc_la_OBJECTS) $(libgcj_bc_la_DEPENDENCIES) install/$(am__dirstamp)
$(libgcj_bc_la_LINK) $(am_libgcj_bc_la_rpath) $(libgcj_bc_la_LDFLAGS) \
- $(libgcj_bc_la_OBJECTS) $(libgcj_bc_la_LIBADD) $(LIBS)
+ $(libgcj_bc_la_OBJECTS) $(libgcj_bc_la_LIBADD) $(LIBS) -Wl,--no-as-needed -lgcj
## Note that property_files is defined in sources.am.
propertyo_files = $(patsubst classpath/resource/%,%,$(addsuffix .lo,$(property_files)))
@@ -762,7 +766,7 @@
rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
mv $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
$(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
- -o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -lgcj || exit; \
+ -o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -Wl,--no-as-needed -lgcj || exit; \
rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
$(LN_S) libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.la;
Index: b/libjava/Makefile.in
===================================================================
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -10644,13 +10648,13 @@
rm .libs/libgcj_bc.so; \
mv .libs/libgcj_bc.so.1.0.0 .libs/libgcj_bc.so; \
$(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
- -o .libs/libgcj_bc.so.1.0.0 -lgcj || exit; \
+ -o .libs/libgcj_bc.so.1.0.0 -Wl,--no-as-needed -lgcj || exit; \
rm .libs/libgcj_bc.so.1; \
$(LN_S) libgcj_bc.so.1.0.0 .libs/libgcj_bc.so.1
install/libgcj_bc.la: $(libgcj_bc_la_OBJECTS) $(libgcj_bc_la_DEPENDENCIES) install/$(am__dirstamp)
$(libgcj_bc_la_LINK) $(am_libgcj_bc_la_rpath) $(libgcj_bc_la_LDFLAGS) \
- $(libgcj_bc_la_OBJECTS) $(libgcj_bc_la_LIBADD) $(LIBS)
+ $(libgcj_bc_la_OBJECTS) $(libgcj_bc_la_LIBADD) $(LIBS) -Wl,--no-as-needed -lgcj
$(propertyo_files): %.lo: classpath/resource/%
$(mkinstalldirs) `dirname $@`; \
@@ -12494,7 +12498,7 @@
@USE_LIBGCJ_BC_TRUE@ rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
@USE_LIBGCJ_BC_TRUE@ mv $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so; \
@USE_LIBGCJ_BC_TRUE@ $(libgcj_bc_dummy_LINK) -xc /dev/null -Wl,-soname,libgcj_bc.so.1 \
-@USE_LIBGCJ_BC_TRUE@ -o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -lgcj || exit; \
+@USE_LIBGCJ_BC_TRUE@ -o $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1.0.0 -Wl,--no-as-needed -lgcj || exit; \
@USE_LIBGCJ_BC_TRUE@ rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
@USE_LIBGCJ_BC_TRUE@ $(LN_S) libgcj_bc.so.1.0.0 $(DESTDIR)$(toolexeclibdir)/libgcj_bc.so.1; \
@USE_LIBGCJ_BC_TRUE@ rm $(DESTDIR)$(toolexeclibdir)/libgcj_bc.la;

View file

@ -0,0 +1,39 @@
Ensure that msgfmt doesn't encounter problems during gcc bootstrapping.
Solves error messages like the following:
msgfmt: /var/tmp/portage/sys-devel/gcc-4.1.2/work/build/./gcc/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/libstdc++.so.6)
The libgcc_s.so used during build doesn't satisfy the needs of the
libstdc++.so that msgfmt is linked against. On the other hand, msgfmt
is used as a stand-alone application here, and what library it uses
behind the scenes is of no concern to the gcc build process.
Therefore, simply invoking it "as usual", i.e. without any special
library path, will make it work as expected here.
2011-09-19 Martin von Gagern
References:
https://bugs.gentoo.org/372377
https://bugs.gentoo.org/295480
--- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.am
+++ gcc-4.1.2/libstdc++-v3/po/Makefile.am
@@ -39,6 +39,7 @@ MSGFMT = msgfmt
EXTRA_DIST = string_literals.cc POTFILES.in $(PACKAGE).pot $(LOCALE_IN)
.po.mo:
+ env --unset=LD_LIBRARY_PATH \
$(MSGFMT) -o $@ $<
all-local: all-local-$(USE_NLS)
--- gcc-4.1.2.orig/libstdc++-v3/po/Makefile.in
+++ gcc-4.1.2/libstdc++-v3/po/Makefile.in
@@ -419,6 +419,7 @@ uninstall-am: uninstall-info-am
.po.mo:
+ env --unset=LD_LIBRARY_PATH \
$(MSGFMT) -o $@ $<
all-local: all-local-$(USE_NLS)

View file

@ -0,0 +1,18 @@
2008-07-25 Magnus Granberg <zorry@ume.nu>
* include/libiberty.h (asprintf): Don't declare if defined as a macro
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -609,8 +609,11 @@ extern int pwait (int, int *, int);
/* Like sprintf but provides a pointer to malloc'd storage, which must
be freed by the caller. */
+/* asprintf may be declared as a macro by glibc with __USE_FORTIFY_LEVEL. */
+#ifndef asprintf
extern int asprintf (char **, const char *, ...) ATTRIBUTE_PRINTF_2;
#endif
+#endif
#if !HAVE_DECL_VASPRINTF
/* Like vsprintf but provides a pointer to malloc'd storage, which

View file

@ -0,0 +1,10 @@
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -246,6 +246,7 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS)
$(AR) $(AR_FLAGS) $(TARGETLIB) \
$(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \
$(RANLIB) $(TARGETLIB); \
+ cp $(TARGETLIB) ../ ; \
cd ..; \
else true; fi

View file

@ -0,0 +1,27 @@
https://bugs.gentoo.org/508852
https://gcc.gnu.org/PR61164
2014-04-27 Magnus Granberg <zorry@gentoo.org>
#508852
* libitm/configure.tgt: Disable FORTIFY
--- a/libitm/configure.tgt
+++ b/libitm/configure.tgt
@@ -43,6 +43,16 @@ if test "$gcc_cv_have_tls" = yes ; then
esac
fi
+# FIXME: error: inlining failed in call to always_inline
+# int vfprintf(FILE*, const char*, __va_list_tag*)
+# : function body can be overwritten at link time
+# Disable Fortify in libitm for now. #508852
+case "${target}" in
+ *-*-linux*)
+ XCFLAGS="${XCFLAGS} -U_FORTIFY_SOURCE"
+ ;;
+esac
+
# Map the target cpu to an ARCH sub-directory. At the same time,
# work out any special compilation flags as necessary.
case "${target_cpu}" in

View file

@ -0,0 +1,59 @@
From 594e3c1ab576daddeb86015efc8b1677020b1878 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 24 Oct 2015 20:39:30 +0000
Subject: [PATCH 1/6] cilkrts
---
libcilkrts/runtime/os-unix.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/libcilkrts/runtime/os-unix.c b/libcilkrts/runtime/os-unix.c
index cb582dd..e43d7d5 100644
--- a/libcilkrts/runtime/os-unix.c
+++ b/libcilkrts/runtime/os-unix.c
@@ -51,6 +51,7 @@
#if defined __linux__
# include <sys/sysinfo.h>
# include <sys/syscall.h>
+# include <sched.h>
#elif defined __APPLE__
# include <sys/sysctl.h>
// Uses sysconf(_SC_NPROCESSORS_ONLN) in verbose output
@@ -400,28 +401,19 @@ COMMON_SYSDEP void __cilkrts_sleep(void)
COMMON_SYSDEP void __cilkrts_yield(void)
{
-#if __APPLE__ || __FreeBSD__ || __VXWORKS__
- // On MacOS, call sched_yield to yield quantum. I'm not sure why we
- // don't do this on Linux also.
- sched_yield();
-#elif defined(__DragonFly__)
- // On DragonFly BSD, call sched_yield to yield quantum.
- sched_yield();
-#elif defined(__MIC__)
+#if defined(__MIC__)
// On MIC, pthread_yield() really trashes things. Arch's measurements
// showed that calling _mm_delay_32() (or doing nothing) was a better
// option. Delaying 1024 clock cycles is a reasonable compromise between
// giving up the processor and latency starting up when work becomes
// available
_mm_delay_32(1024);
-#elif defined(__ANDROID__) || (defined(__sun__) && defined(__svr4__))
- // On Android and Solaris, call sched_yield to yield quantum. I'm not
- // sure why we don't do this on Linux also.
- sched_yield();
-#else
- // On Linux, call pthread_yield (which in turn will call sched_yield)
- // to yield quantum.
+#elif defined(__sun__) && !defined(__svr4__)
+ // On old SunOS call pthread_yield to yield a quantum.
pthread_yield();
+#else
+ // On other platforms call sched_yield to yield a quantum.
+ sched_yield();
#endif
}
--
2.8.1

View file

@ -0,0 +1,56 @@
From 9e3eab51e518018d9d99b3123598b1e2322a6af3 Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Sat, 24 Oct 2015 20:09:53 +0000
Subject: [PATCH 3/6] libgcc_s
---
gcc/config/i386/i386.c | 4 ++--
libgcc/config/i386/cpuinfo.c | 6 +++---
libgcc/config/i386/t-linux | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 3d044e8..82523e1 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -40269,10 +40269,10 @@ ix86_expand_builtin (tree exp, rtx target, rtx subtarget,
{
case IX86_BUILTIN_CPU_INIT:
{
- /* Make it call __cpu_indicator_init in libgcc. */
+ /* Make it call __cpu_indicator_init_local in libgcc.a. */
tree call_expr, fndecl, type;
type = build_function_type_list (integer_type_node, NULL_TREE);
- fndecl = build_fn_decl ("__cpu_indicator_init", type);
+ fndecl = build_fn_decl ("__cpu_indicator_init_local", type);
call_expr = build_call_expr (fndecl, 0);
return expand_expr (call_expr, target, mode, EXPAND_NORMAL);
}
diff --git a/libgcc/config/i386/cpuinfo.c b/libgcc/config/i386/cpuinfo.c
index 8c2248d..6c82f15 100644
--- a/libgcc/config/i386/cpuinfo.c
+++ b/libgcc/config/i386/cpuinfo.c
@@ -485,7 +485,7 @@ __cpu_indicator_init (void)
return 0;
}
-#if defined SHARED && defined USE_ELF_SYMVER
-__asm__ (".symver __cpu_indicator_init, __cpu_indicator_init@GCC_4.8.0");
-__asm__ (".symver __cpu_model, __cpu_model@GCC_4.8.0");
+#ifndef SHARED
+int __cpu_indicator_init_local (void)
+ __attribute__ ((weak, alias ("__cpu_indicator_init")));
#endif
diff --git a/libgcc/config/i386/t-linux b/libgcc/config/i386/t-linux
index 11bb46e..4f47f7b 100644
--- a/libgcc/config/i386/t-linux
+++ b/libgcc/config/i386/t-linux
@@ -3,4 +3,4 @@
# t-slibgcc-elf-ver and t-linux
SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-glibc.ver
-HOST_LIBGCC2_CFLAGS += -mlong-double-80 -DUSE_ELF_SYMVER
+HOST_LIBGCC2_CFLAGS += -mlong-double-80
--
2.8.1

View file

@ -0,0 +1,25 @@
From edec78452d693fb524daa9a6efd45c850b27b25c Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Fri, 6 Nov 2015 23:59:20 +0000
Subject: [PATCH 4/6] linux_libc_has_function
---
gcc/config/linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/linux.c b/gcc/config/linux.c
index 250296b..16c3768 100644
--- a/gcc/config/linux.c
+++ b/gcc/config/linux.c
@@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see
bool
linux_libc_has_function (enum function_class fn_class)
{
- if (OPTION_GLIBC)
+ if (OPTION_GLIBC || OPTION_MUSL)
return true;
if (OPTION_BIONIC)
if (fn_class == function_c94
--
2.8.1

View file

@ -0,0 +1,39 @@
Highly inspired by:
http://landley.net/hg/aboriginal/file/7e0747a665ab/sources/patches/gcc-core-libgcceh.patch
diff -durN gcc-4.6.0.orig/libgcc/Makefile.in gcc-4.6.0/libgcc/Makefile.in
--- gcc-4.6.0.orig/libgcc/Makefile.in 2011-01-26 05:19:58.000000000 +0100
+++ gcc-4.6.0/libgcc/Makefile.in 2011-09-12 18:17:12.743718974 +0200
@@ -772,8 +772,9 @@
libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
endif
+all: libgcc_eh.a
ifeq ($(enable_shared),yes)
-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
+all: libgcc_s$(SHLIB_EXT)
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
endif
@@ -950,10 +951,6 @@
install-shared:
$(mkinstalldirs) $(DESTDIR)$(inst_libdir)
- $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
- chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
- $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
-
$(subst @multilib_dir@,$(MULTIDIR),$(subst \
@shlib_base_name@,libgcc_s,$(subst \
@shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
@@ -968,6 +965,10 @@
chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
+ $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
+ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
+ $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
+
parts="$(INSTALL_PARTS)"; \
for file in $$parts; do \
rm -f $(DESTDIR)$(inst_libdir)/$$file; \

View file

@ -0,0 +1,11 @@
--- gcc-4.9.2/gcc/config/linux.h.orig 2015-03-09 13:27:13.289736710 +0000
+++ gcc-4.9.2/gcc/config/linux.h 2015-03-09 13:29:32.295625046 +0000
@@ -146,6 +146,8 @@
#ifdef NATIVE_SYSTEM_HEADER_DIR
#define INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 2 }, \
+ { NATIVE_SYSTEM_HEADER_DIR "/fortify", 0, 0, 0, 1, 0 }, \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
{ NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
#else

View file

@ -0,0 +1,20 @@
Author: Timo Teräs <timo.teras@iki.fi>
Alpine musl package provides libssp_nonshared.a. We link to it unconditionally,
as otherwise we get link failures if some objects are -fstack-protector built
and final link happens with -fno-stack-protector. This seems to be the common
case when bootstrapping gcc, the piepatches do not seem to fully fix the
crosstoolchain and bootstrap sequence wrt. stack-protector flag usage.
--- gcc-6.1.0/gcc/gcc.c.orig
+++ gcc-6.1.0/gcc/gcc.c
@@ -870,8 +870,7 @@
#ifndef LINK_SSP_SPEC
#ifdef TARGET_LIBC_PROVIDES_SSP
-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
- "|fstack-protector-strong|fstack-protector-explicit:}"
+#define LINK_SSP_SPEC "-lssp_nonshared"
#else
#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
"|fstack-protector-strong|fstack-protector-explicit" \

View file

@ -0,0 +1,62 @@
--- gcc-4.8.1/boehm-gc/os_dep.c.orig 2013-09-17 07:46:00.969884340 +0000
+++ gcc-4.8.1/boehm-gc/os_dep.c 2013-09-17 06:53:53.629884946 +0000
@@ -26,7 +26,7 @@
# define __KERNEL__
# include <asm/signal.h>
# undef __KERNEL__
-# else
+# elif defined(__GLIBC__)
/* Kernels prior to 2.1.1 defined struct sigcontext_struct instead of */
/* struct sigcontext. libc6 (glibc2) uses "struct sigcontext" in */
/* prototypes, so we have to include the top-level sigcontext.h to */
--- gcc-4.8.2/boehm-gc/dyn_load.c.orig 2014-02-17 14:13:09.519850231 +0200
+++ gcc-4.8.2/boehm-gc/dyn_load.c 2014-02-17 14:14:27.906093514 +0200
@@ -459,9 +459,7 @@
/* For glibc 2.2.4+. Unfortunately, it doesn't work for older */
/* versions. Thanks to Jakub Jelinek for most of the code. */
-# if (defined(LINUX) || defined (__GLIBC__)) /* Are others OK here, too? */ \
- && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
- || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
+# if (defined(LINUX) || defined (__GLIBC__))
/* We have the header files for a glibc that includes dl_iterate_phdr. */
/* It may still not be available in the library on the target system. */
--- gcc-4.8.2/boehm-gc/include/private/gcconfig.h.orig 2014-02-17 14:14:36.026049422 +0200
+++ gcc-4.8.2/boehm-gc/include/private/gcconfig.h 2014-02-17 14:17:11.345207887 +0200
@@ -684,7 +684,7 @@
# ifdef __ELF__
# define DYNAMIC_LOADING
# include <features.h>
-# if defined(__GLIBC__)&& __GLIBC__>=2
+# if 1
# define SEARCH_FOR_DATA_START
# else /* !GLIBC2 */
extern char **__environ;
@@ -1147,7 +1147,7 @@
# define DATASTART ((ptr_t)((((word) (_etext)) + 0xfff) & ~0xfff))
# endif
# include <features.h>
-# if defined(__GLIBC__) && __GLIBC__ >= 2
+# if 1
# define SEARCH_FOR_DATA_START
# else
extern char **__environ;
@@ -1367,7 +1367,7 @@
# define HBLKSIZE 4096
# endif
# define USE_GENERIC_PUSH_REGS
-# if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 2 || __GLIBC__ > 2
+# if 1
# define LINUX_STACKBOTTOM
# else
# define STACKBOTTOM 0x80000000
@@ -1858,7 +1858,7 @@
# ifdef __ELF__
# define DYNAMIC_LOADING
# include <features.h>
-# if defined(__GLIBC__) && __GLIBC__ >= 2
+# if 1
# define SEARCH_FOR_DATA_START
# else
extern char **__environ;

View file

@ -0,0 +1,27 @@
--- a/boehm-gc/include/private/gc_locks.h
+++ b/boehm-gc/include/private/gc_locks.h
@@ -282,7 +282,9 @@
# define GC_TEST_AND_SET_DEFINED
# endif
# ifdef MIPS
-# ifdef LINUX
+# if (__GNUC__>4)||((__GNUC__==4)&&(__GNUC_MINOR__>=4))
+# define GC_test_and_set(addr) __sync_lock_test_and_set (addr, 1)
+# elif defined(LINUX)
# include <sys/tas.h>
# define GC_test_and_set(addr) _test_and_set((int *) addr,1)
# define GC_TEST_AND_SET_DEFINED
--- a/boehm-gc/include/private/gcconfig.h
+++ b/boehm-gc/include/private/gcconfig.h
@@ -1373,10 +1373,9 @@
/* needs to be tweaked for workstation class machines. */
# define OS_TYPE "LINUX"
# define DYNAMIC_LOADING
+# define SEARCH_FOR_DATA_START
extern int _end[];
# define DATAEND (_end)
- extern int __data_start[];
-# define DATASTART ((ptr_t)(__data_start))
# ifdef _MIPS_SZPTR
# define CPP_WORDSZ _MIPS_SZPTR
# define ALIGNMENT (_MIPS_SZPTR/8)

View file

@ -0,0 +1,13 @@
diff --git a/libffi/closures.c.orig b/libffi/closures.c
index 721ff00..22a699c 100644
--- a/libffi/src/closures.c.orig
+++ b/libffi/src/closures.c
@@ -34,7 +34,7 @@
#include <ffi_common.h>
#if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE
-# if __gnu_linux__ && !defined(__ANDROID__)
+# if __linux__ && !defined(__ANDROID__)
/* This macro indicates it may be forbidden to map anonymous memory
with both write and execute permission. Code compiled when this
option is defined will attempt to map such pages once, but if it

View file

@ -0,0 +1,89 @@
--- ./gcc/config/i386/t-linux64.orig 2013-01-14 16:32:37.000000000 +0000
+++ ./gcc/config/i386/t-linux64 2013-04-22 06:12:32.984439677 +0000
@@ -34,6 +34,6 @@
comma=,
MULTILIB_OPTIONS = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
MULTILIB_DIRNAMES = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
--- ./gcc/config/aarch64/t-aarch64-linux.orig
+++ ./gcc/config/aarch64/t-aarch64-linux
@@ -22,7 +22,7 @@
LIB1ASMFUNCS = _aarch64_sync_cache_range
AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
+MULTILIB_OSDIRNAMES = mabi.lp64=../lib
MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32
--- ./gcc/config/s390/t-linux64.orig
+++ ./gcc/config/s390/t-linux64
@@ -7,5 +7,5 @@
MULTILIB_OPTIONS = m64/m31
MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
--- ./gcc/config/rs6000/t-linux.orig
+++ ./gcc/config/rs6000/t-linux
@@ -2,7 +2,8 @@
# or soft-float.
ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float)))
ifneq (,$(findstring powerpc64,$(target)))
-MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
+MULTILIB_OSDIRNAMES := m64=../lib
+MULTILIB_OSDIRNAMES += m32=../lib32
else
ifneq (,$(findstring spe,$(target)))
MULTIARCH_DIRNAME := powerpc-linux-gnuspe$(if $(findstring 8548,$(with_cpu)),,v1)
@@ -14,7 +15,8 @@
MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME))
endif
ifneq (,$(findstring powerpc64le,$(target)))
-MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))
+MULTILIB_OSDIRNAMES := m64=../lib
+MULTILIB_OSDIRNAMES += m32=../lib32
endif
endif
--- ./gcc/config/rs6000/t-linux64.orig
+++ ./gcc/config/rs6000/t-linux64
@@ -28,8 +28,8 @@
MULTILIB_OPTIONS := m64/m32
MULTILIB_DIRNAMES := 64 32
MULTILIB_EXTRA_OPTS :=
-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
+MULTILIB_OSDIRNAMES := m64=../lib
+MULTILIB_OSDIRNAMES += m32=../lib32
rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
$(COMPILE) $<
--- ./gcc/config/rs6000/t-linux64bele.orig
+++ ./gcc/config/rs6000/t-linux64bele
@@ -2,6 +2,6 @@
MULTILIB_OPTIONS += mlittle
MULTILIB_DIRNAMES += le
-MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))))))
-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES)))
+MULTILIB_OSDIRNAMES = m64=../lib
+MULTILIB_OSDIRNAMES+= m32=../lib32
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}
--- ./gcc/config/rs6000/t-linux64lebe.orig
+++ ./gcc/config/rs6000/t-linux64lebe
@@ -2,6 +2,6 @@
MULTILIB_OPTIONS += mbig
MULTILIB_DIRNAMES += be
-MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES))))))
-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES)))
+MULTILIB_OSDIRNAMES := m64=../lib
+MULTILIB_OSDIRNAMES += m32=../lib32
MULTILIB_MATCHES := ${MULTILIB_MATCHES_ENDIAN}

View file

@ -0,0 +1,35 @@
--- gcc-6.1.0/libjava/Makefile.am
+++ gcc-6.1.0/libjava/Makefile.am
@@ -488,10 +488,14 @@
nat_files = $(nat_source_files:.cc=.lo)
xlib_nat_files = $(xlib_nat_source_files:.cc=.lo)
+libgcj_la_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+
# Include THREADLIBS here to ensure that the correct version of
# certain linuxthread functions get linked:
## The mysterious backslash in the grep pattern is consumed by make.
-libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \
+libgcj_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDFLAGS) -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \
$(LIBLTDL) $(SYS_ZLIBS) $(LIBJAVA_LDFLAGS_NOUNDEF) \
-version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBGCJ_LD_EXPORT_ALL)
--- gcc-6.1.0/libjava/Makefile.in
+++ gcc-6.1.0/libjava/Makefile.in
@@ -1103,9 +1103,13 @@
nat_files = $(nat_source_files:.cc=.lo)
xlib_nat_files = $(xlib_nat_source_files:.cc=.lo)
+libgcj_la_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ $(LIBSTDCXX_RAW_CXX_CXXFLAGS)
+
# Include THREADLIBS here to ensure that the correct version of
# certain linuxthread functions get linked:
-libgcj_la_LDFLAGS = -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \
+libgcj_la_LDFLAGS = $(LIBSTDCXX_RAW_CXX_LDFLAGS) -rpath $(toolexeclibdir) $(THREADLDFLAGS) $(extra_ldflags) $(THREADLIBS) \
$(LIBLTDL) $(SYS_ZLIBS) $(LIBJAVA_LDFLAGS_NOUNDEF) \
-version-info `grep -v '^\#' $(srcdir)/libtool-version` \
$(LIBGCJ_LD_SYMBOLIC_FUNCTIONS) $(LIBGCJ_LD_EXPORT_ALL)

View file

@ -0,0 +1,49 @@
--- gcc-4.8.2/libjava/gnu/classpath/natSystemProperties.cc.orig 2014-02-18 10:55:08.617678779 +0200
+++ gcc-4.8.2/libjava/gnu/classpath/natSystemProperties.cc 2014-02-18 10:56:31.927227453 +0200
@@ -289,7 +289,7 @@
// just default to `en_US'.
setlocale (LC_ALL, "");
char *locale = setlocale (LC_MESSAGES, "");
- if (locale && strlen (locale) >= 2)
+ if (locale && strlen (locale) >= 2 && (locale[2] == '\0' || locale[2] == '_'))
{
char buf[3];
buf[2] = '\0';
--- gcc-4.8.2/libjava/posix-threads.cc.orig 2014-02-18 13:22:01.789933726 +0200
+++ gcc-4.8.2/libjava/posix-threads.cc 2014-02-18 13:29:50.924058875 +0200
@@ -657,6 +657,7 @@
struct sched_param param;
pthread_attr_t attr;
struct starter *info;
+ size_t ss;
if (data->flags & FLAG_START)
return;
@@ -675,8 +676,25 @@
// Set stack size if -Xss option was given.
if (gcj::stack_size > 0)
{
- int e = pthread_attr_setstacksize (&attr, gcj::stack_size);
+ ss = gcj::stack_size;
+ }
+ else
+ {
+ int e = pthread_attr_getstacksize (&attr, &ss);
+ if (e != 0)
+ JvFail (strerror (e));
+
+ // Request at least 1meg of stack
+ if (ss >= 1024 * 1024)
+ ss = 0;
+ else
+ ss = 1024 * 1024;
+ }
+
+ if (ss)
+ {
+ int e = pthread_attr_setstacksize (&attr, ss);
if (e != 0)
JvFail (strerror (e));
}
info = (struct starter *) _Jv_AllocBytes (sizeof (struct starter));

View file

@ -0,0 +1,120 @@
--- gcc-4.8.2/libjava/gnu/gcj/convert/natIconv.cc.orig 2014-02-18 18:46:14.897880526 +0200
+++ gcc-4.8.2/libjava/gnu/gcj/convert/natIconv.cc 2014-02-18 18:50:08.766613550 +0200
@@ -24,6 +24,13 @@
#ifdef HAVE_ICONV
#include <iconv.h>
+#include <endian.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define UCS2_CHARSET "UCS-2BE"
+#else
+#define UCS2_CHARSET "UCS-2LE"
+#endif
template<typename T>
static inline size_t
@@ -45,7 +52,7 @@
_Jv_GetStringUTFRegion (encoding, 0, encoding->length(), buffer);
buffer[len] = '\0';
- iconv_t h = iconv_open ("UCS-2", buffer);
+ iconv_t h = iconv_open (UCS2_CHARSET, buffer);
if (h == (iconv_t) -1)
throw new ::java::io::UnsupportedEncodingException (encoding);
@@ -99,18 +106,6 @@
throw new ::java::io::CharConversionException ();
}
- if (iconv_byte_swap)
- {
- size_t max = (old_out - outavail) / sizeof (jchar);
- for (size_t i = 0; i < max; ++i)
- {
- // Byte swap.
- jchar c = (((out[outpos + i] & 0xff) << 8)
- | ((out[outpos + i] >> 8) & 0xff));
- outbuf[i] = c;
- }
- }
-
inpos += old_in - inavail;
return (old_out - outavail) / sizeof (jchar);
#else /* HAVE_ICONV */
@@ -145,7 +140,7 @@
_Jv_GetStringUTFRegion (encoding, 0, encoding->length(), buffer);
buffer[len] = '\0';
- iconv_t h = iconv_open (buffer, "UCS-2");
+ iconv_t h = iconv_open (buffer, UCS2_CHARSET);
if (h == (iconv_t) -1)
throw new ::java::io::UnsupportedEncodingException (encoding);
@@ -187,20 +182,6 @@
char *inbuf = (char *) &chars[inpos];
char *outbuf = (char *) &out[count];
- if (iconv_byte_swap)
- {
- // Ugly performance penalty -- don't use losing systems!
- temp_buffer = (jchar *) _Jv_Malloc (inlength * sizeof (jchar));
- for (int i = 0; i < inlength; ++i)
- {
- // Byte swap.
- jchar c = (((chars[inpos + i] & 0xff) << 8)
- | ((chars[inpos + i] >> 8) & 0xff));
- temp_buffer[i] = c;
- }
- inbuf = (char *) temp_buffer;
- }
-
size_t loop_old_in = old_in;
while (1)
{
@@ -252,44 +233,7 @@
jboolean
gnu::gcj::convert::IOConverter::iconv_init (void)
{
- // Some versions of iconv() always return their UCS-2 results in
- // big-endian order, and they also require UCS-2 inputs to be in
- // big-endian order. For instance, glibc 2.1.3 does this. If the
- // UTF-8=>UCS-2 iconv converter has this feature, then we assume
- // that all UCS-2 converters do. (This might not be the best
- // heuristic, but is is all we've got.)
- jboolean result = false;
-#ifdef HAVE_ICONV
- iconv_t handle = iconv_open ("UCS-2", "UTF-8");
- if (handle != (iconv_t) -1)
- {
- jchar c;
- unsigned char in[4];
- char *inp, *outp;
- size_t inc, outc, r;
-
- // This is the UTF-8 encoding of \ufeff. At least Tru64 UNIX libiconv
- // needs the trailing NUL byte, otherwise iconv fails with EINVAL.
- in[0] = 0xef;
- in[1] = 0xbb;
- in[2] = 0xbf;
- in[3] = 0x00;
-
- inp = (char *) in;
- inc = 4;
- outp = (char *) &c;
- outc = 2;
-
- r = iconv_adapter (iconv, handle, &inp, &inc, &outp, &outc);
- // Conversion must be complete for us to use the result.
- if (r != (size_t) -1 && inc == 0 && outc == 0)
- result = (c != 0xfeff);
-
- // Release iconv handle.
- iconv_close (handle);
- }
-#endif /* HAVE_ICONV */
- return result;
+ return false;
}
void

View file

@ -0,0 +1,23 @@
diff -ruN gcc/libjava/configure.host gcc/libjava/configure.host
--- gcc/libjava/configure.host 2015-05-28 21:13:55.185034000 +0300
+++ gcc/libjava/configure.host 2018-12-27 09:26:16.579326441 +0200
@@ -407,6 +407,10 @@
descriptor_h=sysdep/powerpc/descriptor.h
;;
+ arm*-*)
+ descriptor_h=sysdep/arm/descriptor.h
+ ;;
+
*)
descriptor_h=sysdep/descriptor-n.h
;;
diff -ruN gcc/libjava/sysdep/arm/descriptor.h gcc/libjava/sysdep/arm/descriptor.h
--- gcc/libjava/sysdep/arm/descriptor.h 1970-01-01 02:00:00.000000000 +0200
+++ gcc/libjava/sysdep/arm/descriptor.h 2018-12-27 09:27:38.714979452 +0200
@@ -0,0 +1,4 @@
+// Given a function pointer, return the code address.
+// Strip out the ARM/Thumb mode indicator bit
+
+#define UNWRAP_FUNCTION_DESCRIPTOR(X) ((void*)(((unsigned long)X) & ~1UL))

View file

@ -0,0 +1,10 @@
--- gcc-4.8.1/Makefile.in.orig
+++ gcc-4.8.1/Makefile.in
@@ -169,6 +169,7 @@
# built for the build system to override those in BASE_FLAGS_TO_PASSS.
EXTRA_BUILD_FLAGS = \
CFLAGS="$(CFLAGS_FOR_BUILD)" \
+ CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"
# This is the list of directories to built for the host system.

View file

@ -0,0 +1,76 @@
From 47467f3ab0fb2f2fcede81060fe8bb339d0909eb Mon Sep 17 00:00:00 2001
From: Szabolcs Nagy <nsz@port70.net>
Date: Wed, 28 Feb 2018 00:54:05 +0000
Subject: [PATCH 10/12] ldbl128 config
---
gcc/configure | 13 +++++++++++++
gcc/configure.ac | 16 ++++++++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git gcc/configure gcc/configure
index 6121e163259..07ff8597d48 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -29309,6 +29309,15 @@ if test "${with_long_double_128+set}" = set; then :
withval=$with_long_double_128; gcc_cv_target_ldbl128="$with_long_double_128"
else
+ case "$target" in
+ s390*-*-linux-musl*)
+ gcc_cv_target_ldbl128=yes
+ ;;
+ powerpc*-*-linux-musl*)
+ gcc_cv_target_ldbl128=no
+ ;;
+ *)
+
if test $glibc_version_major -gt 2 \
|| ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 4 ); then :
gcc_cv_target_ldbl128=yes
@@ -29320,6 +29329,10 @@ else
&& gcc_cv_target_ldbl128=yes
fi
+
+ ;;
+ esac
+
fi
;;
diff --git gcc/configure.ac gcc/configure.ac
index b066cc609e1..6c15ed898c0 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5971,13 +5971,25 @@ case "$target" in
AC_ARG_WITH(long-double-128,
[AS_HELP_STRING([--with-long-double-128],
[use 128-bit long double by default])],
- gcc_cv_target_ldbl128="$with_long_double_128",
+ gcc_cv_target_ldbl128="$with_long_double_128", [
+ case "$target" in
+ s390*-*-linux-musl*)
+ gcc_cv_target_ldbl128=yes
+ ;;
+ powerpc*-*-linux-musl*)
+ gcc_cv_target_ldbl128=no
+ ;;
+ *)]
[GCC_GLIBC_VERSION_GTE_IFELSE([2], [4], [gcc_cv_target_ldbl128=yes], [
[gcc_cv_target_ldbl128=no
grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \
$target_header_dir/bits/wordsize.h > /dev/null 2>&1 \
&& gcc_cv_target_ldbl128=yes
- ]])])
+ ]])]
+ [
+ ;;
+ esac
+ ])
;;
esac
if test x$gcc_cv_target_ldbl128 = xyes; then
--
2.17.1

View file

@ -0,0 +1,138 @@
From 330788a7acde436c1ee8fcb0c1fd657e6ffab8fd Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Thu, 2 May 2019 18:58:29 +0200
Subject: [PATCH] libgcc: do not build 128-bit long double runtime support for
musl
Another patch was already disabling 128-bit long doubles for the
compiler itself, this one additionally avoids building the runtime
support for that.
Musl does not support 128-bit long doubles, and building libgcc
with 128-bit long double ABI was breaking things like ld.gold
which refuses to link two objects with different FP ABI tags.
---
libgcc/config.host | 10 +++++++++-
libgcc/config/rs6000/ppc64-fp.c | 14 ++++++++++++++
libgcc/config/rs6000/t-musl | 8 ++++++++
3 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 libgcc/config/rs6000/t-musl
diff --git a/libgcc/config.host b/libgcc/config.host
index 11b4aca..51ceef5 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -1071,8 +1071,16 @@ powerpc-*-rtems*)
extra_parts="$extra_parts crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
powerpc*-*-linux*)
- tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff rs6000/t-linux t-dfprules rs6000/t-ppc64-fp t-slibgcc-libgcc"
+ tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-savresfgpr rs6000/t-crtstuff t-dfprules rs6000/t-ppc64-fp t-slibgcc-libgcc"
tmake_file="${tmake_file} t-stack rs6000/t-stack-rs6000"
+ case ${host} in
+ powerpc*-*-linux-musl*)
+ tmake_file="${tmake_file} rs6000/t-musl"
+ ;;
+ *)
+ tmake_file="${tmake_file} rs6000/t-linux"
+ ;;
+ esac
case $ppc_fp_type in
64)
;;
diff --git a/libgcc/config/rs6000/ppc64-fp.c b/libgcc/config/rs6000/ppc64-fp.c
index faffc82..9f479ee 100644
--- a/libgcc/config/rs6000/ppc64-fp.c
+++ b/libgcc/config/rs6000/ppc64-fp.c
@@ -25,25 +25,34 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
#if defined(__powerpc64__) || defined (__64BIT__) || defined(__ppc64__)
+#if __LDBL_MANT_DIG__ > __DBL_MANT_DIG__
#define TMODES
+#endif
#include "fp-bit.h"
+#ifdef TMODES
extern DItype __fixtfdi (TFtype);
+#endif
extern DItype __fixdfdi (DFtype);
extern DItype __fixsfdi (SFtype);
extern USItype __fixunsdfsi (DFtype);
extern USItype __fixunssfsi (SFtype);
+#ifdef TMODES
extern TFtype __floatditf (DItype);
extern TFtype __floatunditf (UDItype);
+#endif
extern DFtype __floatdidf (DItype);
extern DFtype __floatundidf (UDItype);
extern SFtype __floatdisf (DItype);
extern SFtype __floatundisf (UDItype);
+#ifdef TMODES
extern DItype __fixunstfdi (TFtype);
+#endif
static DItype local_fixunssfdi (SFtype);
static DItype local_fixunsdfdi (DFtype);
+#ifdef TMODES
DItype
__fixtfdi (TFtype a)
{
@@ -51,6 +60,7 @@ __fixtfdi (TFtype a)
return - __fixunstfdi (-a);
return __fixunstfdi (a);
}
+#endif
DItype
__fixdfdi (DFtype a)
@@ -86,6 +96,7 @@ __fixunssfsi (SFtype a)
return (SItype) a;
}
+#ifdef TMODES
TFtype
__floatditf (DItype u)
{
@@ -109,6 +120,7 @@ __floatunditf (UDItype u)
return (TFtype) dh + (TFtype) dl;
}
+#endif
DFtype
__floatdidf (DItype u)
@@ -183,6 +195,7 @@ __floatundisf (UDItype u)
return (SFtype) f;
}
+#ifdef TMODES
DItype
__fixunstfdi (TFtype a)
{
@@ -206,6 +219,7 @@ __fixunstfdi (TFtype a)
v += (USItype) a;
return v;
}
+#endif
/* This version is needed to prevent recursion; fixunsdfdi in libgcc
calls fixdfdi, which in turn calls calls fixunsdfdi. */
diff --git a/libgcc/config/rs6000/t-musl b/libgcc/config/rs6000/t-musl
new file mode 100644
index 0000000..f261d8a
--- /dev/null
+++ b/libgcc/config/rs6000/t-musl
@@ -0,0 +1,8 @@
+# Overrides for musl; we want to avoid building all these implementations
+# required for quad-precision float handling as musl does not support that,
+# ibm-ldouble.c is added into the build by t-ppccomm
+
+HOST_LIBGCC2_CFLAGS += -mlong-double-64 -mno-minimal-toc
+
+# We do not want to build ibm-ldouble.c.
+LIB2ADD := $(filter-out %ibm-ldouble.c, $(LIB2ADD))
--
2.21.0

369
srcpkgs/gcc6/template Normal file
View file

@ -0,0 +1,369 @@
# Template file for 'gcc6'
_majorver=6
_minorver=${_majorver}.5
# old isl is necessary
_isl_version=0.16
pkgname=gcc6
version=${_minorver}.0
revision=1
wrksrc=gcc-${version}
hostmakedepends="automake libtool perl flex zip unzip"
makedepends="gmp-devel mpfr-devel libmpc-devel zlib-devel"
depends="binutils"
short_desc="GNU C Compiler (6.x)"
maintainer="q66 <daniel@octaforge.org>"
license="GFDL-1.2-or-later, GPL-3.0-or-later, LGPL-2.1-or-later, EPL"
homepage="http://gcc.gnu.org"
distfiles="
${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz
http://isl.gforge.inria.fr/isl-${_isl_version}.tar.bz2
https://sourceware.org/pub/java/ecj-4.9.jar"
checksum="
7ef1796ce497e89479183702635b14bb7a46b53249209a5e0f999bebf4740945
3899e68047d0a18db5a7d73bdabcbe9246865e73e86efbd95387817d342fd554
9506e75b862f782213df61af67338eb7a23c35ff425d328affc65585477d34cd"
skip_extraction="ecj-4.9.jar"
nopie=yes
lib32disabled=yes
patch_args="-Np1"
nocross=yes
subpackages="gcc6-gcj gcc6-gcj-ecj libgcj-devel libgcj gcc6-gcj-jdk-compat"
case "$XBPS_TARGET_MACHINE" in
i686) _triplet="i686-pc-linux-gnu";;
i686-musl) _triplet="i686-linux-musl";;
x86_64) _triplet="x86_64-unknown-linux-gnu";;
x86_64-musl) _triplet="x86_64-linux-musl";;
armv5tel) _triplet="arm-linux-gnueabi";;
armv5tel-musl) _triplet="arm-linux-musleabi";;
armv6l) _triplet="arm-linux-gnueabihf";;
armv7l) _triplet="armv7l-linux-gnueabihf";;
armv6l-musl) _triplet="arm-linux-musleabihf";;
armv7l-musl) _triplet="armv7l-linux-musleabihf";;
aarch64) _triplet="aarch64-linux-gnu";;
aarch64-musl) _triplet="aarch64-linux-musl";;
ppc) _triplet="powerpc-linux-gnu";;
ppc-musl) _triplet="powerpc-linux-musl";;
ppc64le) _triplet="powerpc64le-linux-gnu";;
ppc64le-musl) _triplet="powerpc64le-linux-musl";;
ppc64) _triplet="powerpc64-linux-gnu";;
ppc64-musl) _triplet="powerpc64-linux-musl";;
mips-musl) _triplet="mips-linux-musl";;
mipshf-musl) _triplet="mips-linux-muslhf";;
mipsel-musl) _triplet="mipsel-linux-musl";;
mipselhf-musl) _triplet="mipsel-linux-muslhf";;
esac
case "$XBPS_TARGET_MACHINE" in
*-musl) depends+=" musl-devel";;
*) depends+=" glibc-devel";;
esac
post_extract() {
mkdir -p ${wrksrc}/isl
cp -ar ${XBPS_BUILDDIR}/isl-${_isl_version}/* ${wrksrc}/isl/
# https://gcc.gnu.org/ml/java/2008-04/msg00027.html
cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/ecj-*.jar ${wrksrc}/ecj.jar
}
pre_configure() {
# _FORTIFY_SOURCE needs an optimization level.
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {gcc,libiberty}/configure
# old isl normally tries to call aclocal-1.14 to reconfigure itself
pushd ${wrksrc}/isl
autoreconf -if
popd
}
do_configure() {
local _args _hash
_hash=gnu
case "$XBPS_TARGET_MACHINE" in
mipselhf-musl) _args+=" --with-arch=mips32r2 --with-float=hard"; _hash=sysv;;
mipsel-musl) _args+=" --with-arch=mips32r2 --with-float=soft"; _hash=sysv;;
mipshf-musl) _args+=" --with-arch=mips32r2 --with-float=hard";;
mips-musl) _args+=" --with-arch=mips32r2 --with-float=soft";;
armv5*) _args+=" --with-arch=armv5te --with-float=soft";;
armv6l*) _args+=" --with-arch=armv6 --with-fpu=vfp --with-float=hard";;
armv7l*) _args+=" --with-arch=armv7-a --with-fpu=vfpv3 --with-float=hard";;
aarch64*) _args+=" --with-arch=armv8-a";;
ppc) _args+=" --enable-secureplt";;
ppc-musl) _args+=" --enable-secureplt --disable-decimal-float";;
ppc64*)
_args+=" --with-abi=elfv2 --enable-secureplt"
sed -i 's/lib64/lib/' gcc/config/rs6000/linux64.h
;;
ppc64*-musl)
_args+=" --with-abi=elfv2 --enable-secureplt --disable-decimal-float"
sed -i 's/lib64/lib/' gcc/config/rs6000/linux64.h
;;
x86_64*)
sed -i 's/lib64/lib/' gcc/config/i386/linux64.h
;;
esac
export CFLAGS="${CFLAGS/-D_FORTIFY_SOURCE=2/}"
export CXXFLAGS="${CXXFLAGS/-D_FORTIFY_SOURCE=2/}"
# Disable explicit -fno-PIE, gcc will figure this out itself.
export CFLAGS="${CFLAGS//-fno-PIE/}"
export CXXFLAGS="${CXXFLAGS//-fno-PIE/}"
export LDFLAGS="${LDFLAGS//-no-pie/}"
_args+=" --build=${_triplet}"
_args+=" --program-suffix=-${_majorver}"
_args+=" --enable-version-specific-runtime-libs"
_args+=" --prefix=/usr"
_args+=" --mandir=/usr/share/man"
_args+=" --infodir=/usr/share/info"
_args+=" --libexecdir=/usr/lib"
_args+=" --libdir=/usr/lib"
_args+=" --with-gxx-include-dir=/usr/include/c++/${version}"
_args+=" --enable-languages=c,c++,java,lto"
_args+=" --enable-java-gc=boehm"
_args+=" --with-jvm-root=/usr/lib/jvm/java-1.5-gcj"
_args+=" --enable-fast-character"
_args+=" --disable-fixed-point"
_args+=" --enable-threads=posix"
_args+=" --enable-__cxa_atexit"
_args+=" --disable-multilib"
_args+=" --enable-lto"
_args+=" --disable-bootstrap"
_args+=" --with-system-zlib"
_args+=" --enable-shared"
_args+=" --enable-linker-build-id"
_args+=" --disable-werror"
_args+=" --disable-nls"
_args+=" --enable-default-pie"
_args+=" --enable-default-ssp"
_args+=" --enable-checking=release"
_args+=" --disable-libstdcxx-pch"
_args+=" --with-isl"
_args+=" --with-linker-hash-style=$_hash"
_args+=" --disable-libunwind-exceptions"
_args+=" --disable-target-libiberty"
_args+=" --disable-libquadmath"
_args+=" --disable-libsanitizer"
_args+=" --disable-vtable-verify"
_args+=" --disable-libitm"
_args+=" --disable-libgomp"
_args+=" --disable-libatomic"
_args+=" --disable-libmpx"
_args+=" --disable-libmudflap"
_args+=" --disable-libssp"
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
_args+=" --disable-symvers"
_args+=" libat_cv_have_ifunc=no"
fi
mkdir -p build
cd build
CONFIG_SHELL=/bin/bash ${wrksrc}/configure ${_args}
}
do_build() {
cd build
make ${makejobs}
}
do_install() {
cd build
if [ "$XBPS_TARGET_WORDSIZE" = "64" ]; then
vmkdir usr/lib
ln -sfr ${DESTDIR}/usr/lib ${DESTDIR}/usr/lib64
fi
mkdir -p ${DESTDIR}/usr/include/c++/${version}
make DESTDIR=${DESTDIR} install
# Make version a symlink of major version to make all versions
# from the same series work automagically.
mv ${DESTDIR}/usr/lib/gcc/${_triplet}/${version} \
${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}
ln -sfr ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver} \
${DESTDIR}/usr/lib/gcc/${_triplet}/${version}
# Ditto for c++ headers.
mv ${DESTDIR}/usr/include/c++/${version} \
${DESTDIR}/usr/include/c++/${_minorver}
ln -sfr ${DESTDIR}/usr/include/c++/${_minorver} \
${DESTDIR}/usr/include/c++/${version}
if [ -e ${DESTDIR}/usr/lib64 ]; then
rm -f ${DESTDIR}/usr/lib64
fi
# Remove python stuff
rm -rf ${DESTDIR}/usr/share/gcc-${version}/python
# Avoid conflict with gcc
mv ${DESTDIR}/usr/lib/libcc1* ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}
# Version info files to avoid conflicts with gcc
for f in cp-tools cpp cppinternals gcc gccinstall gccint gcj; do
if [ -f ${DESTDIR}/usr/share/info/${f}.info ]; then
mv ${DESTDIR}/usr/share/info/${f}.info \
${DESTDIR}/usr/share/info/${f}-${_majorver}.info
fi
done
# Conflicting manpages, provided by gcc
rm -rf ${DESTDIR}/usr/share/man/man7
# Provided by main libgcc
rm -f ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/libgcc_s.so*
# Gcj libs need to be available in primary libdir
mv ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/libgcj*.so* \
${DESTDIR}/usr/lib
mv ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/libgij.so* \
${DESTDIR}/usr/lib
# Move pkg-config file into a path pkg-config knows about
mkdir -p ${DESTDIR}/usr/lib/pkgconfig
mv ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/pkgconfig/*.pc \
${DESTDIR}/usr/lib/pkgconfig
rmdir ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/pkgconfig
# Build ecj - needed for compat package
${DESTDIR}/usr/bin/gcj-6 -Wl,-Bsymbolic -findirect-dispatch \
-o ${DESTDIR}/usr/bin/ecj-gcj -lgcj \
--main=org.eclipse.jdt.internal.compiler.batch.Main \
${DESTDIR}/usr/share/java/ecj.jar
}
gcc6-gcj_package() {
lib32disabled=yes
depends="gcc6>=${_minorver} libgcj-devel>=${_minorver}"
short_desc+=" - Java compiler frontend"
pkg_install() {
for f in gcj jv-convert gjarsigner gjar grmic jcf-dump \
gtnameserv gcjh gnative2ascii gserialver gkeytool \
gij grmiregistry grmid gorbd gcj-dbtool gjavah \
gc-analyze gappletviewer rebuild-gcj-db aot-compile; do
vmove usr/bin/${f}-${_majorver}
done
for f in gcj jv-convert gjarsigner gjar grmic jcf-dump gjdoc \
gtnameserv gcjh gnative2ascii gserialver gkeytool \
gij grmiregistry grmid gorbd gcj-dbtool gjavah \
gc-analyze gappletviewer rebuild-gcj-db aot-compile; do
if [ -f ${DESTDIR}/usr/share/man/man1/${f}-${_majorver}.1 ]; then
vmove usr/share/man/man1/${f}-${_majorver}.1
fi
done
vmove usr/bin/${_triplet}-gcj-${_majorver}
vmove usr/lib/gcc/${_triplet}/${_minorver}/jc1
vmove usr/lib/gcc/${_triplet}/${_minorver}/jvgenmain
vmove usr/lib/gcc/${_triplet}/${_minorver}/ecj1
vmove usr/share/info/gcj-${_majorver}.info
touch ${PKGDESTDIR}/usr/share/info/dir
}
}
gcc6-gcj-ecj_package() {
short_desc+=" - Eclipse Java Compiler frontend"
pkg_install() {
vmove usr/bin/ecj-gcj
}
}
gcc6-gcj-jdk-compat_package() {
lib32disabled=yes
depends="gcc6-gcj gcc6-gcj-ecj fastjar"
short_desc+=" - JDK compatiblity layer"
pkg_install() {
local jvm_dir=$PKGDESTDIR/usr/lib/jvm
local jdk_dir=$jvm_dir/java-1.5-gcj
local jdk_bin_dir=$jdk_dir/bin
local jdk_lib_dir=$jdk_dir/lib
local jdk_inc_dir=$jdk_dir/include
local jre_dir=$jdk_dir/jre
local jre_bin_dir=$jre_dir/bin
local jre_lib_dir=$jre_dir/lib
local arch=
case "$XBPS_TARGET_MACHINE" in
i686*) arch=i386 ;;
x86_64*) arch=amd64 ;;
arm*) arch=arm ;;
aarch64*) arch=aarch64 ;;
ppc64le*) arch=ppc64le ;;
ppc64*) arch=ppc64 ;;
ppc*) arch=ppc ;;
mipsel*) arch=mipsel ;;
mips*) arch=mips ;;
esac
mkdir -p $jdk_bin_dir $jdk_lib_dir
ln -sfr ${PKGDESTDIR}/usr/bin/gij-${_majorver} $jdk_bin_dir/java
ln -sfr ${PKGDESTDIR}/usr/bin/fastjar $jdk_bin_dir/fastjar
ln -sfr ${PKGDESTDIR}/usr/bin/grmic-${_majorver} $jdk_bin_dir/rmic
ln -sfr ${PKGDESTDIR}/usr/bin/gjavah-${_majorver} $jdk_bin_dir/javah
ln -sfr ${PKGDESTDIR}/usr/bin/gappletviewer-${_majorver} $jdk_bin_dir/appletviewer
ln -sfr ${PKGDESTDIR}/usr/bin/gjarsigner-${_majorver} $jdk_bin_dir/jarsigner
ln -sfr ${PKGDESTDIR}/usr/bin/grmiregistry-${_majorver} $jdk_bin_dir/rmiregistry
ln -sfr ${PKGDESTDIR}/usr/bin/gkeytool-${_majorver} $jdk_bin_dir/keytool
ln -sfr ${PKGDESTDIR}/usr/bin/gjar-${_majorver} $jdk_bin_dir/gjar
ln -sfr ${PKGDESTDIR}/usr/bin/gnative2ascii-${_majorver} $jdk_bin_dir/gnative2ascii
ln -sfr ${PKGDESTDIR}/usr/bin/ecj-gcj $jdk_bin_dir/javac
ln -sfr ${PKGDESTDIR}/usr/share/java/libgcj-tools-${version}.jar $jdk_lib_dir/tools.jar
# symlink headers for jni.h and so on, don't do the whole directory
# otherwise undesirable gcc include files might leak into the builds
mkdir -p $jdk_inc_dir
ln -sfr ${PKGDESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/include/gcj $jdk_inc_dir/gcj
ln -sfr ${PKGDESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/include/jawt.h $jdk_inc_dir/jawt.h
ln -sfr ${PKGDESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/include/jawt_md.h $jdk_inc_dir/jawt_md.h
ln -sfr ${PKGDESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/include/jni.h $jdk_inc_dir/jni.h
ln -sfr ${PKGDESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/include/jni_md.h $jdk_inc_dir/jni_md.h
ln -sfr ${PKGDESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/include/jvmpi.h $jdk_inc_dir/jvmpi.h
mkdir -p $jre_bin_dir $jre_lib_dir/$arch
ln -sfr ${PKGDESTDIR}/usr/bin/gij-${_majorver} $jre_bin_dir/java
ln -sfr ${PKGDESTDIR}/usr/bin/grmiregistry-${_majorver} $jre_bin_dir/rmiregistry
ln -sfr ${PKGDESTDIR}/usr/bin/gkeytool-${_majorver} $jre_bin_dir/keytool
ln -sfr ${PKGDESTDIR}/usr/share/java/libgcj-${version}.jar $jre_lib_dir/rt.jar
ln -sfr ${PKGDESTDIR}/usr/share/java/libgcj-tools-${version}.jar $jre_lib_dir/tools.jar
ln -sfr ${PKGDESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/gcj-$version-*/libjvm.so $jre_lib_dir/$arch
ln -sfr ${PKGDESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/gcj-$version-*/libjavamath.so $jre_lib_dir/$arch
ln -sfr ${PKGDESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/gcj-$version-*/classmap.db $jre_lib_dir/$arch
}
}
libgcj-devel_package() {
lib32disabled=yes
depends="libgcj-${version}_${revision}"
short_desc+=" - Java library - development files"
pkg_install() {
vmove usr/include/c++/${_minorver}/gnu
vmove usr/include/c++/${_minorver}/java
vmove usr/include/c++/${_minorver}/javax
vmove usr/include/c++/${_minorver}/sun
vmove usr/include/c++/${_minorver}/gcj
vmove usr/include/c++/${_minorver}/org
vmove "usr/lib/gcc/${_triplet}/${_minorver}/plugin/include/java"
vmove "usr/lib/gcc/${_triplet}/${_minorver}/include/jni*"
vmove "usr/lib/gcc/${_triplet}/${_minorver}/include/gcj*"
vmove "usr/lib/gcc/${_triplet}/${_minorver}/include/jvm*"
vmove "usr/lib/gcc/${_triplet}/${_minorver}/include/jawt*"
vmove usr/lib/pkgconfig/libgcj-${_majorver}.pc
}
}
libgcj_package() {
lib32disabled=yes
short_desc+=" - Java libraries"
pkg_install() {
vmove "usr/lib/libgcj*.so*"
vmove "usr/lib/libgij.so*"
vmove usr/lib/gcc/${_triplet}/${_minorver}/gcj-${version}-*
vmove usr/lib/gcc/${_triplet}/${_minorver}/logging.properties
vmove usr/lib/gcc/${_triplet}/${_minorver}/libgcj.spec
vmove usr/lib/gcc/${_triplet}/${_minorver}/security/classpath.security
vmove usr/share/java
}
}

1
srcpkgs/libgcj Symbolic link
View file

@ -0,0 +1 @@
gcc6

1
srcpkgs/libgcj-devel Symbolic link
View file

@ -0,0 +1 @@
gcc6