diff options
author | marino <marino@pkgsrc.org> | 2014-05-13 08:18:04 +0000 |
---|---|---|
committer | marino <marino@pkgsrc.org> | 2014-05-13 08:18:04 +0000 |
commit | b31f10a9e6e512056b6420e8b0e55ad520d54b3c (patch) | |
tree | 40c481efe8fcf5efdaba8ef6ac42db3e5606a3c9 /lang/gcc-aux/files | |
parent | b9710c9ddea3142357834fb61566087cdc3c8b8d (diff) | |
download | pkgsrc-b31f10a9e6e512056b6420e8b0e55ad520d54b3c.tar.gz |
lang/gcc-aux: Enable dl_iterate_phdr and link with gold
These changes are for NetBSD only although non-functional OpenBSD support
continues to be added. The biggest change is configuring the compiler to
use the gold linker from binutils 2.24 instead of the system linker. The
ld.bfd linker from binutils 2.24 is buggy on NetBSD and OpenBSD; it cannot
properly produce/recognize PIC files in every case, which is why gcc-aux
had been limited to the system linker. The system linker was too old for
gcc-aux and devel/gps failed to link because of it.
At the same time, the dormant dl_iterate_phdr support has been activated
for NetBSD. It seems to work; the Ada testsuite still passes perfectly.
Due to lack of testing, gold is restricted from building on NetBSD 5,
which means lang/gcc-aux will fail to build as a result. If someone
verifies gold builds on NetBSD 5, then the restriction on binutils can
be removed and lang/gcc-aux will be able to build on NetBSD 5 again.
Diffstat (limited to 'lang/gcc-aux/files')
-rw-r--r-- | lang/gcc-aux/files/diff-ada | 8 | ||||
-rw-r--r-- | lang/gcc-aux/files/diff-core | 114 |
2 files changed, 109 insertions, 13 deletions
diff --git a/lang/gcc-aux/files/diff-ada b/lang/gcc-aux/files/diff-ada index 6ee0ad37559..4b22475cd16 100644 --- a/lang/gcc-aux/files/diff-ada +++ b/lang/gcc-aux/files/diff-ada @@ -7741,7 +7741,7 @@ + Always_Compatible_Rep : constant Boolean := False; + Suppress_Standard_Library : constant Boolean := False; + Use_Ada_Main_Program_Name : constant Boolean := False; -+ ZCX_By_Default : constant Boolean := True; ++ ZCX_By_Default : constant Boolean := False; + +end System; --- /dev/null @@ -7888,7 +7888,7 @@ + Always_Compatible_Rep : constant Boolean := False; + Suppress_Standard_Library : constant Boolean := False; + Use_Ada_Main_Program_Name : constant Boolean := False; -+ ZCX_By_Default : constant Boolean := True; ++ ZCX_By_Default : constant Boolean := False; + +end System; --- gcc/ada/terminals.c.orig @@ -8372,7 +8372,7 @@ + EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o + EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o + -+ EH_MECHANISM=-gcc ++ EH_MECHANISM= + THREADSLIB= -lpthread + GMEM_LIB = gmemlib + LIBRARY_VERSION := $(LIB_VERSION) @@ -8407,7 +8407,7 @@ + EXTRA_GNATRTL_NONTASKING_OBJS=g-sse.o g-ssvety.o + EXTRA_GNATRTL_TASKING_OBJS=a-exetim.o + -+ EH_MECHANISM=-gcc ++ EH_MECHANISM= + THREADSLIB= -lpthread + GMEM_LIB = gmemlib + LIBRARY_VERSION := $(LIB_VERSION) diff --git a/lang/gcc-aux/files/diff-core b/lang/gcc-aux/files/diff-core index e4c7ddf44a4..e3cc3919f64 100644 --- a/lang/gcc-aux/files/diff-core +++ b/lang/gcc-aux/files/diff-core @@ -350,10 +350,23 @@ #endif #undef LIB_SPEC -@@ -285,5 +285,9 @@ +@@ -143,6 +143,9 @@ + #define LIB_SPEC OBSD_LIB_SPEC + #endif + ++#undef LINK_PIE_SPEC ++#define LINK_PIE_SPEC "%{pie:-pie} %{p|pg|nopie:-nopie} " ++ + #define TARGET_POSIX_IO + + /* All new versions of OpenBSD have C99 functions. We redefine this hook +@@ -285,5 +288,12 @@ /* Storage layout. */ ++/* Silence "unsafe GNU crap" messages */ ++#define NO_UNSAFE_BUILTINS ++ +/* The system headers on OpenBSD are C++-aware. */ +#undef NO_IMPLICIT_EXTERN_C +#define NO_IMPLICIT_EXTERN_C @@ -1325,6 +1338,60 @@ #endif +#endif } +--- gcc/builtins.c.orig ++++ gcc/builtins.c +@@ -125,9 +125,11 @@ + static rtx expand_builtin_mempcpy (tree, rtx, enum machine_mode); + static rtx expand_builtin_mempcpy_args (tree, tree, tree, rtx, + enum machine_mode, int); ++#ifndef NO_UNSAFE_BUILTINS + static rtx expand_builtin_strcpy (tree, rtx); + static rtx expand_builtin_strcpy_args (tree, tree, rtx); + static rtx expand_builtin_stpcpy (tree, rtx, enum machine_mode); ++#endif + static rtx expand_builtin_strncpy (tree, rtx); + static rtx builtin_memset_gen_str (void *, HOST_WIDE_INT, enum machine_mode); + static rtx expand_builtin_memset (tree, rtx, enum machine_mode); +@@ -3370,6 +3372,7 @@ + # define CODE_FOR_movstr CODE_FOR_nothing + #endif + ++#ifndef NO_UNSAFE_BUILTINS + /* Expand into a movstr instruction, if one is available. Return NULL_RTX if + we failed, the caller should emit a normal call, otherwise try to + get the result in TARGET, if convenient. If ENDP is 0 return the +@@ -3521,6 +3524,7 @@ + return expand_movstr (dst, src, target, /*endp=*/2); + } + } ++#endif + + /* Callback routine for store_by_pieces. Read GET_MODE_BITSIZE (MODE) + bytes from constant string DATA + OFFSET and return it as target +@@ -6140,9 +6144,11 @@ + break; + + case BUILT_IN_STRCPY: ++#ifndef NO_UNSAFE_BUILTINS + target = expand_builtin_strcpy (exp, target); + if (target) + return target; ++#endif + break; + + case BUILT_IN_STRNCPY: +@@ -6152,9 +6158,11 @@ + break; + + case BUILT_IN_STPCPY: ++#ifndef NO_UNSAFE_BUILTINS + target = expand_builtin_stpcpy (exp, target, mode); + if (target) + return target; ++#endif + break; + + case BUILT_IN_MEMCPY: --- gcc/config.gcc.orig +++ gcc/config.gcc @@ -687,6 +687,26 @@ @@ -1394,7 +1461,36 @@ ;; i[34567]86-*-openbsd2.*|i[34567]86-*openbsd3.[0123]) tm_file="i386/i386.h i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h openbsd-oldgas.h openbsd.h i386/openbsd.h" -@@ -4109,6 +4140,8 @@ +@@ -1375,6 +1406,7 @@ + use_collect2=yes + ;; + i[34567]86-*-openbsd*) ++ tm_defines="${tm_defines} PIE_DEFAULT=1" + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h" + tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/openbsdelf.h" + extra_options="${extra_options} openbsd.opt" +@@ -1382,6 +1414,7 @@ + gnu_ld=yes + ;; + x86_64-*-openbsd*) ++ tm_defines="${tm_defines} PIE_DEFAULT=1" + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h" + tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/x86-64.h i386/openbsdelf.h" + extra_options="${extra_options} openbsd.opt" +@@ -2927,6 +2960,12 @@ + arch_without_sse2=yes + arch_without_64bit=yes + ;; ++ i386-*-openbsd*) ++ arch=i486 ++ cpu=generic ++ arch_without_sse2=yes ++ arch_without_64bit=yes ++ ;; + i386-*-*) + arch=i386 + cpu=i386 +@@ -4109,6 +4148,8 @@ ;; i[34567]86-*-mingw* | x86_64-*-mingw*) ;; @@ -1416,13 +1512,13 @@ + gcc_cv_target_dl_iterate_phdr=no + fi + ;; -+# *-*-netbsd* | *-*-openbsd*) -+# if grep dl_iterate_phdr $target_header_dir/link_elf.h > /dev/null 2>&1; then -+# gcc_cv_target_dl_iterate_phdr=yes -+# else -+# gcc_cv_target_dl_iterate_phdr=no -+# fi -+# ;; ++ *-*-netbsd*) ++ if grep dl_iterate_phdr $target_header_dir/link_elf.h > /dev/null 2>&1; then ++ gcc_cv_target_dl_iterate_phdr=yes ++ else ++ gcc_cv_target_dl_iterate_phdr=no ++ fi ++ ;; esac if test x$gcc_cv_target_dl_iterate_phdr = xyes; then |