From 0cb15e5f0462fb6465831ca5bbe62aeee82bff74 Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Fri, 7 Dec 2012 14:49:47 +0000 Subject: [PATCH] Apply our GCC diffs. - Add ALTERNATIVES files for lang/gcc4[789] - Include the .o files from gcc4[79] in the -libs packages. - Set LOCAL_INCLUDE_DIR to LOCALBASE. - Disable -fomit-frame-pointer, we like stack traces. - DATASET-953 disable full gcc47 dependency - Implement -fstrict-calling-conventions, from richlowe. - Cleanup DEPENDS when using -libs - Fix check-shlibs in -libs - Fix joyent/pkgsrc#264 (avoid tls emulation) - Fix joyent/pkgsrc#270 (disable fixincludes) --- lang/gcc47-libs/Makefile | 17 ++++++- lang/gcc47/ALTERNATIVES | 20 ++++++++ lang/gcc47/Makefile | 5 +- lang/gcc47/buildlink3.mk | 2 +- lang/gcc47/distinfo | 9 +++- lang/gcc47/patches/patch-gcc_Makefile.in | 15 +++++- lang/gcc47/patches/patch-gcc_caller-save.c | 15 ++++++ lang/gcc47/patches/patch-gcc_common.opt | 19 +++++++ .../patches/patch-gcc_config_i386_i386.c | 50 +++++++++++++++++++ lang/gcc47/patches/patch-gcc_configure | 15 +++++- lang/gcc47/patches/patch-gcc_dojump.c | 15 ++++++ lang/gcc47/patches/patch-gcc_ira.c | 24 +++++++++ lang/gcc48/ALTERNATIVES | 20 ++++++++ lang/gcc49-libs/Makefile | 17 ++++++- lang/gcc49/ALTERNATIVES | 20 ++++++++ lang/gcc49/Makefile | 5 +- lang/gcc49/buildlink3.mk | 2 +- lang/gcc49/distinfo | 9 +++- lang/gcc49/patches/patch-gcc_Makefile.in | 12 ++++- lang/gcc49/patches/patch-gcc_caller-save.c | 15 ++++++ lang/gcc49/patches/patch-gcc_common.opt | 19 +++++++ .../patches/patch-gcc_config_i386_i386.c | 41 +++++++++++++++ lang/gcc49/patches/patch-gcc_configure | 14 +++++- lang/gcc49/patches/patch-gcc_dojump.c | 15 ++++++ lang/gcc49/patches/patch-gcc_ira.c | 24 +++++++++ 25 files changed, 400 insertions(+), 19 deletions(-) create mode 100644 lang/gcc47/ALTERNATIVES create mode 100644 lang/gcc47/patches/patch-gcc_caller-save.c create mode 100644 lang/gcc47/patches/patch-gcc_common.opt create mode 100644 lang/gcc47/patches/patch-gcc_config_i386_i386.c create mode 100644 lang/gcc47/patches/patch-gcc_dojump.c create mode 100644 lang/gcc47/patches/patch-gcc_ira.c create mode 100644 lang/gcc48/ALTERNATIVES create mode 100644 lang/gcc49/ALTERNATIVES create mode 100644 lang/gcc49/patches/patch-gcc_caller-save.c create mode 100644 lang/gcc49/patches/patch-gcc_common.opt create mode 100644 lang/gcc49/patches/patch-gcc_config_i386_i386.c create mode 100644 lang/gcc49/patches/patch-gcc_dojump.c create mode 100644 lang/gcc49/patches/patch-gcc_ira.c diff --git a/lang/gcc47-libs/Makefile b/lang/gcc47-libs/Makefile index 745ecdc891d82..e7fa4b6f33b73 100644 --- a/lang/gcc47-libs/Makefile +++ b/lang/gcc47-libs/Makefile @@ -26,6 +26,9 @@ CHECK_SHLIBS= no ## Depend on exactly ${GCC47_DIST_VERSION}. BUILD_DEPENDS+= ${GCC_PKGNAME}-${GCC47_DIST_VERSION}{,nb[0-9]*}:../../lang/gcc47 +# Finds libs from gcc47 due to rpath +CHECK_SHLIBS= no + .include "../../mk/bsd.prefs.mk" LIBGCC_SUBPREFIX= ${GCC_PKGNAME} @@ -41,9 +44,11 @@ SHLIB_EXT= so .endif LIBRARY_FILES= ${WRKDIR}/lib_files +OBJECT_FILES= ${WRKDIR}/obj_files GENERATE_PLIST+= ${SED} -e 's,^,${LIBGCC_SUBPREFIX}/${GCC_TARGET_MACHINE}/,' \ - ${LIBRARY_FILES}; + -e 's,gcc/${MACHINE_GNU_PLATFORM}/${GCC47_DIST_VERSION}/,,' \ + ${LIBRARY_FILES} ${OBJECT_FILES}; GENERATE_PLIST+= ${GREP} -q 'lib/' ${LIBRARY_FILES} || \ ${ECHO} '@pkgdir ${LIBGCC_SUBPREFIX}/${GCC_TARGET_MACHINE}/lib' ; @@ -53,11 +58,19 @@ ${LIBRARY_FILES}: -e'/libgcj/d;/libgij/d;/libgo\./d;/libjvm/d' \ -e'/lib.*\.${SHLIB_EXT}/p' >${LIBRARY_FILES} -do-install: ${LIBRARY_FILES} +${OBJECT_FILES}: + ${PKG_INFO} -qL '${GCC_PKGNAME}-${GCC47_DIST_VERSION}*' | \ + ${SED} -n -e's,^${LIBGCC_PREFIX}/,,' \ + -e'/\.o/p' >${OBJECT_FILES} + +do-install: ${LIBRARY_FILES} ${OBJECT_FILES} ${TEST} -d ${DESTDIR}${LIBGCC_PREFIX}/${GCC_TARGET_MACHINE}/lib || \ ${MKDIR} ${DESTDIR}${LIBGCC_PREFIX}/${GCC_TARGET_MACHINE}/lib cd ${LIBGCC_PREFIX} && \ ${PAX} -rw ${DESTDIR}${LIBGCC_PREFIX}/${GCC_TARGET_MACHINE} <${LIBRARY_FILES} + cd ${LIBGCC_PREFIX} && \ + ${PAX} -r -s ',gcc/${MACHINE_GNU_PLATFORM}/${GCC47_DIST_VERSION}/,,' \ + -w ${DESTDIR}${LIBGCC_PREFIX}/${GCC_TARGET_MACHINE} <${OBJECT_FILES} .include "../../mk/dlopen.buildlink3.mk" .include "../../mk/pthread.buildlink3.mk" diff --git a/lang/gcc47/ALTERNATIVES b/lang/gcc47/ALTERNATIVES new file mode 100644 index 0000000000000..df3956146b4c1 --- /dev/null +++ b/lang/gcc47/ALTERNATIVES @@ -0,0 +1,20 @@ +bin/c++ @PREFIX@/gcc47/bin/c++ +bin/cc @PREFIX@/gcc47/bin/cc +bin/cpp @PREFIX@/gcc47/bin/cpp +bin/g++ @PREFIX@/gcc47/bin/g++ +bin/gcc @PREFIX@/gcc47/bin/gcc +bin/gcc-ar @PREFIX@/gcc47/bin/gcc-ar +bin/gcc-nm @PREFIX@/gcc47/bin/gcc-nm +bin/gcc-ranlib @PREFIX@/gcc47/bin/gcc-ranlib +bin/gccgo @PREFIX@/gcc47/bin/gccgo +bin/gcov @PREFIX@/gcc47/bin/gcov +bin/gfortran @PREFIX@/gcc47/bin/gfortran +bin/@MACHINE_GNU_PLATFORM@-c++ @PREFIX@/gcc47/bin/@MACHINE_GNU_PLATFORM@-c++ +bin/@MACHINE_GNU_PLATFORM@-g++ @PREFIX@/gcc47/bin/@MACHINE_GNU_PLATFORM@-g++ +bin/@MACHINE_GNU_PLATFORM@-gcc @PREFIX@/gcc47/bin/@MACHINE_GNU_PLATFORM@-gcc +bin/@MACHINE_GNU_PLATFORM@-gcc-@GCC47_DIST_VERSION@ @PREFIX@/gcc47/bin/@MACHINE_GNU_PLATFORM@-gcc-@GCC47_DIST_VERSION@ +bin/@MACHINE_GNU_PLATFORM@-gcc-ar @PREFIX@/gcc47/bin/@MACHINE_GNU_PLATFORM@-gcc-ar +bin/@MACHINE_GNU_PLATFORM@-gcc-nm @PREFIX@/gcc47/bin/@MACHINE_GNU_PLATFORM@-gcc-nm +bin/@MACHINE_GNU_PLATFORM@-gcc-ranlib @PREFIX@/gcc47/bin/@MACHINE_GNU_PLATFORM@-gcc-ranlib +bin/@MACHINE_GNU_PLATFORM@-gccgo @PREFIX@/gcc47/bin/@MACHINE_GNU_PLATFORM@-gccgo +bin/@MACHINE_GNU_PLATFORM@-gfortran @PREFIX@/gcc47/bin/@MACHINE_GNU_PLATFORM@-gfortran diff --git a/lang/gcc47/Makefile b/lang/gcc47/Makefile index 1f0b2e4217397..8f7bb6db3c015 100644 --- a/lang/gcc47/Makefile +++ b/lang/gcc47/Makefile @@ -40,6 +40,9 @@ INFO_FILES= yes UNLIMIT_RESOURCES+= datasize UNLIMIT_RESOURCES+= stacksize +FILES_SUBST+= GCC47_DIST_VERSION=${GCC47_DIST_VERSION} +FILES_SUBST+= MACHINE_GNU_PLATFORM=${MACHINE_GNU_PLATFORM} + SUBST_CLASSES+= vars SUBST_STAGE.vars= pre-configure SUBST_FILES.vars= gcc/Makefile.in @@ -71,7 +74,7 @@ CONFIGURE_ENV+= LDFLAGS_FOR_TARGET=${LDFLAGS_FOR_TARGET:Q} CONFIGURE_ARGS+= --enable-languages=${LANGS:Q} CONFIGURE_ARGS+= --enable-shared CONFIGURE_ARGS+= --enable-long-long -CONFIGURE_ARGS+= --with-local-prefix=${GCC_PREFIX:Q} +CONFIGURE_ARGS+= --with-local-prefix=${LOCALBASE:Q} CONFIGURE_ARGS+= --enable-libssp CONFIGURE_ARGS+= --enable-threads=posix CONFIGURE_ARGS+= --with-boot-ldflags=${BOOT_LDFLAGS:Q} diff --git a/lang/gcc47/buildlink3.mk b/lang/gcc47/buildlink3.mk index dba01132a513d..2f6f5c5188db8 100644 --- a/lang/gcc47/buildlink3.mk +++ b/lang/gcc47/buildlink3.mk @@ -16,7 +16,7 @@ BUILDLINK_FILES.gcc47= #empty BUILDLINK_AUTO_VARS.gcc47= no # Packages that link against shared libraries need a full dependency. -.if defined(_USE_GCC_SHLIB) +.if defined(_USE_GCC_SHLIB) && empty(USE_PKGSRC_GCC_RUNTIME:M[Yy][Ee][Ss]) DEPENDS+= {gcc47,gcc47-libs}>=4.7:../../lang/gcc47-libs ABI_DEPENDS+= {gcc47,gcc47-libs}>=4.7.0:../../lang/gcc47-libs .endif diff --git a/lang/gcc47/distinfo b/lang/gcc47/distinfo index 24a4807c4f110..eba966ef048f8 100644 --- a/lang/gcc47/distinfo +++ b/lang/gcc47/distinfo @@ -9,18 +9,23 @@ RMD160 (gcc-4.7.4.tar.bz2) = d0a8e421b9c62a923f765b97828b12d5af388199 SHA512 (gcc-4.7.4.tar.bz2) = dfcb737073191e628231031a3571ec77ee760a59377630f4a6e4fdfa66f9ddad39fde47e3f0f227eb43cdf90e0d34cde5abdc9ac892c1e111a911062a66c9189 Size (gcc-4.7.4.tar.bz2) = 82935453 bytes SHA1 (patch-configure) = 51c0978c60baddd90ef7e512445fdef913c04e6c -SHA1 (patch-gcc_Makefile.in) = a61187af64943ef38088442397fcd0f3f65fe2b5 +SHA1 (patch-gcc_Makefile.in) = ab307ae9f48bd05b4fafca5c618588ef3d37408d +SHA1 (patch-gcc_caller-save.c) = 85d985d1fd9736908be6e99028aa5fe7dcadca59 +SHA1 (patch-gcc_common.opt) = 0f1212c9f9ab4a73e4ac6d56ebffbb89477f1e31 SHA1 (patch-gcc_config.gcc) = efa4ecabd71bdec14d5dd1f8bb836116c7a9d6e9 SHA1 (patch-gcc_config_dragonfly-stdint.h) = 740dc819b446d5f1476506322c4b280ffdb5a6c0 SHA1 (patch-gcc_config_dragonfly.h) = 82f549cdc7543b4bf413a44d481ef42b10f59c82 SHA1 (patch-gcc_config_dragonfly.opt) = 92f615c73c2e94664bae5b5935ab8b09bca15f73 SHA1 (patch-gcc_config_i386_dragonfly.h) = 0d3f785434c02beb9c4561fe59842a970e8f7896 +SHA1 (patch-gcc_config_i386_i386.c) = 7b452589ae5deb228236529166bf096fda40718a SHA1 (patch-gcc_config_netbsd-stdint.h) = 025fc883101a187e84ed4c0772406720d645d550 SHA1 (patch-gcc_config_sol2.h) = 4f6ffe871840dcf7e2e469fdcc5d327b9b00f957 -SHA1 (patch-gcc_configure) = a4b670d0c54c410d38715b7a2a572a7048e3ec5e +SHA1 (patch-gcc_configure) = 01464863f31087390d612023a849e9c8f626b751 +SHA1 (patch-gcc_dojump.c) = 6a095ae23d0ed0469dbcf746bcbefc3f33613482 SHA1 (patch-gcc_fortran_f95-lang.c) = 6edd2adc7de0d6db36fc5670535b55f61664f5fd SHA1 (patch-gcc_gcc.c) = d28e633c8961161562db960054aaa5aa6a1ac645 SHA1 (patch-gcc_ginclude_stddef.h) = 87d7c2ff4400ad0719b2351d2f4c4b05bd257db3 +SHA1 (patch-gcc_ira.c) = 48ce489c48eb5b618ba58db89bd32f737fa3f96c SHA1 (patch-gcc_testsuite_g++.dg_eh_unwind-direct.C) = fd85ccee102e9618a8010d2dcbb2d9916b28f1cc SHA1 (patch-include_libiberty.h) = ad2c64e9a14405c89b02ff68811b1c889405d0a1 SHA1 (patch-libgcc_config.host) = 6b54e18c6348c4aeb3fda3093fbe990b59456af7 diff --git a/lang/gcc47/patches/patch-gcc_Makefile.in b/lang/gcc47/patches/patch-gcc_Makefile.in index 009480faaf651..dff54a499cedd 100644 --- a/lang/gcc47/patches/patch-gcc_Makefile.in +++ b/lang/gcc47/patches/patch-gcc_Makefile.in @@ -5,9 +5,11 @@ are found. NOTE: the %M spec string is added by patch-gcc_gcc.c ---- gcc/Makefile.in.orig 2012-03-07 10:59:56.000000000 +0000 +Disable fixincludes, as per joyent/pkgsrc#270 + +--- gcc/Makefile.in.orig 2013-07-08 09:15:35.000000000 +0000 +++ gcc/Makefile.in -@@ -2074,6 +2074,7 @@ prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_ +@@ -2090,6 +2090,7 @@ prefix.o: prefix.c $(CONFIG_H) $(SYSTEM_ # Language-independent files. DRIVER_DEFINES = \ @@ -15,3 +17,12 @@ NOTE: the %M spec string is added by patch-gcc_gcc.c -DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \ -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \ -DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \ +@@ -4204,7 +4205,7 @@ stmp-fixinc: gsyslimits.h macro_list fix + gcc_dir=`${PWD_COMMAND}` ; \ + export TARGET_MACHINE srcdir SHELL MACRO_LIST && \ + cd $(build_objdir)/fixincludes && \ +- $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \ ++ $(SHELL) -c true "$${gcc_dir}/$${fix_dir}" \ + $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \ + rm -f $${fix_dir}/syslimits.h; \ + if [ -f $${fix_dir}/limits.h ]; then \ diff --git a/lang/gcc47/patches/patch-gcc_caller-save.c b/lang/gcc47/patches/patch-gcc_caller-save.c new file mode 100644 index 0000000000000..6ee68ebf03d6e --- /dev/null +++ b/lang/gcc47/patches/patch-gcc_caller-save.c @@ -0,0 +1,15 @@ +$NetBSD$ + +Disable -fomit-frame-pointer. + +--- gcc/caller-save.c.orig 2011-11-08 17:36:45.000000000 +0000 ++++ gcc/caller-save.c +@@ -380,7 +380,7 @@ saved_hard_reg_compare_func (const void + const struct saved_hard_reg *p1 = *(struct saved_hard_reg * const *) v1p; + const struct saved_hard_reg *p2 = *(struct saved_hard_reg * const *) v2p; + +- if (flag_omit_frame_pointer) ++ if (0) + { + if (p1->call_freq - p2->call_freq != 0) + return p1->call_freq - p2->call_freq; diff --git a/lang/gcc47/patches/patch-gcc_common.opt b/lang/gcc47/patches/patch-gcc_common.opt new file mode 100644 index 0000000000000..d89db66916d24 --- /dev/null +++ b/lang/gcc47/patches/patch-gcc_common.opt @@ -0,0 +1,19 @@ +$NetBSD$ + +Implement -fstrict-calling-conventions, from: + + https://github.com/richlowe/gcc/commit/c245a538375d071928782a1564cd7e55d70bd4a0 + +--- gcc/common.opt.orig 2013-01-14 16:32:37.000000000 +0000 ++++ gcc/common.opt +@@ -1855,6 +1855,10 @@ fstrict-aliasing + Common Report Var(flag_strict_aliasing) Optimization + Assume strict aliasing rules apply + ++fstrict-calling-conventions ++Common Report Var(flag_strict_calling_conventions) Init(1) ++Use strict ABI calling conventions even for static functions ++ + fstrict-overflow + Common Report Var(flag_strict_overflow) + Treat signed overflow as undefined diff --git a/lang/gcc47/patches/patch-gcc_config_i386_i386.c b/lang/gcc47/patches/patch-gcc_config_i386_i386.c new file mode 100644 index 0000000000000..6eb10d6788a1d --- /dev/null +++ b/lang/gcc47/patches/patch-gcc_config_i386_i386.c @@ -0,0 +1,50 @@ +$NetBSD$ + +Disable -fomit-frame-pointer. +Add support for -fstrict-calling-conventions. + +--- gcc/config/i386/i386.c.orig 2013-04-02 16:54:39.000000000 +0000 ++++ gcc/config/i386/i386.c +@@ -3547,7 +3547,7 @@ ix86_option_override_internal (bool main + } + + /* Keep nonleaf frame pointers. */ +- if (flag_omit_frame_pointer) ++ if (0) + target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER; + else if (TARGET_OMIT_LEAF_FRAME_POINTER) + flag_omit_frame_pointer = 1; +@@ -3685,7 +3685,7 @@ ix86_option_override_internal (bool main + around edges. */ + if ((flag_unwind_tables || flag_asynchronous_unwind_tables + || flag_exceptions || flag_non_call_exceptions) +- && flag_omit_frame_pointer ++ && 0 + && !(target_flags & MASK_ACCUMULATE_OUTGOING_ARGS)) + { + if (target_flags_explicit & MASK_ACCUMULATE_OUTGOING_ARGS) +@@ -5171,6 +5171,7 @@ ix86_function_regparm (const_tree type, + if (decl + && TREE_CODE (decl) == FUNCTION_DECL + && optimize ++ && (TARGET_64BIT || !flag_strict_calling_conventions) + && !(profile_flag && !flag_fentry)) + { + /* FIXME: remove this CONST_CAST when cgraph.[ch] is constified. */ +@@ -5248,6 +5249,7 @@ ix86_function_sseregparm (const_tree typ + /* For local functions, pass up to SSE_REGPARM_MAX SFmode + (and DFmode for SSE2) arguments in SSE registers. */ + if (decl && TARGET_SSE_MATH && optimize ++ && (TARGET_64BIT || !flag_strict_calling_conventions) + && !(profile_flag && !flag_fentry)) + { + /* FIXME: remove this CONST_CAST when cgraph.[ch] is constified. */ +@@ -9973,7 +9975,7 @@ ix86_finalize_stack_realign_flags (void) + && !crtl->need_drap + && frame_pointer_needed + && current_function_is_leaf +- && flag_omit_frame_pointer ++ && 0 + && current_function_sp_is_unchanging + && !ix86_current_function_calls_tls_descriptor + && !crtl->accesses_prior_frames diff --git a/lang/gcc47/patches/patch-gcc_configure b/lang/gcc47/patches/patch-gcc_configure index 0ef815b01544c..0ebb79d222b6e 100644 --- a/lang/gcc47/patches/patch-gcc_configure +++ b/lang/gcc47/patches/patch-gcc_configure @@ -4,9 +4,20 @@ Add dl_iterate_phdr detection for FreeBSD and DragonFly. Detection for NetBSD and OpenBSD is added but commented out in case this error handling mechanism is activated for these platforms later. ---- gcc/configure.orig 2012-03-08 13:54:54.000000000 +0000 +Fix detection of native TLS on SunOS, joyent/pkgsrc#264 + +--- gcc/configure.orig 2014-02-12 16:43:47.000000000 +0000 +++ gcc/configure -@@ -26802,6 +26802,20 @@ case "$target" in +@@ -23374,7 +23374,7 @@ $as_echo "#define TLS_SECTION_ASM_FLAG ' + .section ".tdata","awT",@progbits' + tls_first_major=2 + tls_first_minor=14 +- tls_as_opt="--fatal-warnings" ++ tls_as_opt="-32 --fatal-warnings" + fi + conftest_s="$conftest_s + foo: .long 25 +@@ -26906,6 +26906,20 @@ case "$target" in gcc_cv_target_dl_iterate_phdr=no fi ;; diff --git a/lang/gcc47/patches/patch-gcc_dojump.c b/lang/gcc47/patches/patch-gcc_dojump.c new file mode 100644 index 0000000000000..5a3c08d0ec4a9 --- /dev/null +++ b/lang/gcc47/patches/patch-gcc_dojump.c @@ -0,0 +1,15 @@ +$NetBSD$ + +Disable -fomit-frame-pointer. + +--- gcc/dojump.c.orig 2012-02-09 14:46:02.000000000 +0000 ++++ gcc/dojump.c +@@ -81,7 +81,7 @@ void + clear_pending_stack_adjust (void) + { + if (optimize > 0 +- && (! flag_omit_frame_pointer || cfun->calls_alloca) ++ && (! 0 || cfun->calls_alloca) + && EXIT_IGNORE_STACK) + discard_pending_stack_adjust (); + } diff --git a/lang/gcc47/patches/patch-gcc_ira.c b/lang/gcc47/patches/patch-gcc_ira.c new file mode 100644 index 0000000000000..d96823a2531bd --- /dev/null +++ b/lang/gcc47/patches/patch-gcc_ira.c @@ -0,0 +1,24 @@ +$NetBSD$ + +Disable -fomit-frame-pointer. + +--- gcc/ira.c.orig 2012-02-21 23:27:59.000000000 +0000 ++++ gcc/ira.c +@@ -1620,7 +1620,7 @@ ira_init (void) + { + free_register_move_costs (); + setup_reg_mode_hard_regset (); +- setup_alloc_regs (flag_omit_frame_pointer != 0); ++ setup_alloc_regs (0 != 0); + setup_class_subset_and_memory_move_costs (); + setup_reg_class_nregs (); + setup_prohibited_class_mode_regs (); +@@ -1785,7 +1785,7 @@ ira_setup_eliminable_regset (void) + case. At some point, we should improve this by emitting the + sp-adjusting insns for this case. */ + int need_fp +- = (! flag_omit_frame_pointer ++ = (! 0 + || (cfun->calls_alloca && EXIT_IGNORE_STACK) + /* We need the frame pointer to catch stack overflow exceptions + if the stack pointer is moving. */ diff --git a/lang/gcc48/ALTERNATIVES b/lang/gcc48/ALTERNATIVES new file mode 100644 index 0000000000000..098e048b8b2dc --- /dev/null +++ b/lang/gcc48/ALTERNATIVES @@ -0,0 +1,20 @@ +bin/c++ @PREFIX@/gcc48/bin/c++ +bin/cc @PREFIX@/gcc48/bin/cc +bin/cpp @PREFIX@/gcc48/bin/cpp +bin/g++ @PREFIX@/gcc48/bin/g++ +bin/gcc @PREFIX@/gcc48/bin/gcc +bin/gcc-ar @PREFIX@/gcc48/bin/gcc-ar +bin/gcc-nm @PREFIX@/gcc48/bin/gcc-nm +bin/gcc-ranlib @PREFIX@/gcc48/bin/gcc-ranlib +bin/gccgo @PREFIX@/gcc48/bin/gccgo +bin/gcov @PREFIX@/gcc48/bin/gcov +bin/gfortran @PREFIX@/gcc48/bin/gfortran +bin/@MACHINE_GNU_PLATFORM@-c++ @PREFIX@/gcc48/bin/@MACHINE_GNU_PLATFORM@-c++ +bin/@MACHINE_GNU_PLATFORM@-g++ @PREFIX@/gcc48/bin/@MACHINE_GNU_PLATFORM@-g++ +bin/@MACHINE_GNU_PLATFORM@-gcc @PREFIX@/gcc48/bin/@MACHINE_GNU_PLATFORM@-gcc +bin/@MACHINE_GNU_PLATFORM@-gcc-@GCC48_DIST_VERSION@ @PREFIX@/gcc48/bin/@MACHINE_GNU_PLATFORM@-gcc-@GCC48_DIST_VERSION@ +bin/@MACHINE_GNU_PLATFORM@-gcc-ar @PREFIX@/gcc48/bin/@MACHINE_GNU_PLATFORM@-gcc-ar +bin/@MACHINE_GNU_PLATFORM@-gcc-nm @PREFIX@/gcc48/bin/@MACHINE_GNU_PLATFORM@-gcc-nm +bin/@MACHINE_GNU_PLATFORM@-gcc-ranlib @PREFIX@/gcc48/bin/@MACHINE_GNU_PLATFORM@-gcc-ranlib +bin/@MACHINE_GNU_PLATFORM@-gccgo @PREFIX@/gcc48/bin/@MACHINE_GNU_PLATFORM@-gccgo +bin/@MACHINE_GNU_PLATFORM@-gfortran @PREFIX@/gcc48/bin/@MACHINE_GNU_PLATFORM@-gfortran diff --git a/lang/gcc49-libs/Makefile b/lang/gcc49-libs/Makefile index 1be326fbff3b3..c8845f1ae810e 100644 --- a/lang/gcc49-libs/Makefile +++ b/lang/gcc49-libs/Makefile @@ -28,6 +28,9 @@ CHECK_SHLIBS= no ## Depend on exactly ${GCC49_DIST_VERSION}. BUILD_DEPENDS+= ${GCC_PKGNAME}-${GCC49_DIST_VERSION}{,nb[0-9]*}:../../lang/gcc49 +# Finds libs from gcc49 due to rpath +CHECK_SHLIBS= no + .include "../../mk/bsd.prefs.mk" LIBGCC_SUBPREFIX= ${GCC_PKGNAME} @@ -43,9 +46,11 @@ SHLIB_EXT= so .endif LIBRARY_FILES= ${WRKDIR}/lib_files +OBJECT_FILES= ${WRKDIR}/obj_files GENERATE_PLIST+= ${SED} -e 's,^,${LIBGCC_SUBPREFIX}/${GCC_TARGET_MACHINE}/,' \ - ${LIBRARY_FILES}; + -e 's,gcc/${MACHINE_GNU_PLATFORM}/${GCC49_DIST_VERSION}/,,' \ + ${LIBRARY_FILES} ${OBJECT_FILES}; GENERATE_PLIST+= ${GREP} -q 'lib/' ${LIBRARY_FILES} || \ ${ECHO} '@pkgdir ${LIBGCC_SUBPREFIX}/${GCC_TARGET_MACHINE}/lib' ; @@ -55,11 +60,19 @@ ${LIBRARY_FILES}: -e'/libgij/d;/libgcj/d;/libjvm/d' \ -e'/lib.*\.${SHLIB_EXT}/p' >${LIBRARY_FILES} -do-install: ${LIBRARY_FILES} +${OBJECT_FILES}: + ${PKG_INFO} -qL '${GCC_PKGNAME}-${GCC49_DIST_VERSION}*' | \ + ${SED} -n -e 's,^${LIBGCC_PREFIX}/,,' \ + -e '/\.o/p' -e '/libgcc\.a/p' -e '/libssp_nonshared\.a/p' >${OBJECT_FILES} + +do-install: ${LIBRARY_FILES} ${OBJECT_FILES} ${TEST} -d ${DESTDIR}${LIBGCC_PREFIX}/${GCC_TARGET_MACHINE}/lib || \ ${MKDIR} ${DESTDIR}${LIBGCC_PREFIX}/${GCC_TARGET_MACHINE}/lib cd ${LIBGCC_PREFIX} && \ ${PAX} -rw ${DESTDIR}${LIBGCC_PREFIX}/${GCC_TARGET_MACHINE} <${LIBRARY_FILES} + cd ${LIBGCC_PREFIX} && \ + ${PAX} -r -s ',gcc/${MACHINE_GNU_PLATFORM}/${GCC49_DIST_VERSION}/,,' \ + -w ${DESTDIR}${LIBGCC_PREFIX}/${GCC_TARGET_MACHINE} <${OBJECT_FILES} .include "../../mk/dlopen.buildlink3.mk" .include "../../mk/pthread.buildlink3.mk" diff --git a/lang/gcc49/ALTERNATIVES b/lang/gcc49/ALTERNATIVES new file mode 100644 index 0000000000000..83d0c5c5637c4 --- /dev/null +++ b/lang/gcc49/ALTERNATIVES @@ -0,0 +1,20 @@ +bin/c++ @PREFIX@/gcc49/bin/c++ +bin/cc @PREFIX@/gcc49/bin/cc +bin/cpp @PREFIX@/gcc49/bin/cpp +bin/g++ @PREFIX@/gcc49/bin/g++ +bin/gcc @PREFIX@/gcc49/bin/gcc +bin/gcc-ar @PREFIX@/gcc49/bin/gcc-ar +bin/gcc-nm @PREFIX@/gcc49/bin/gcc-nm +bin/gcc-ranlib @PREFIX@/gcc49/bin/gcc-ranlib +bin/gccgo @PREFIX@/gcc49/bin/gccgo +bin/gcov @PREFIX@/gcc49/bin/gcov +bin/gfortran @PREFIX@/gcc49/bin/gfortran +bin/@MACHINE_GNU_PLATFORM@-c++ @PREFIX@/gcc49/bin/@MACHINE_GNU_PLATFORM@-c++ +bin/@MACHINE_GNU_PLATFORM@-g++ @PREFIX@/gcc49/bin/@MACHINE_GNU_PLATFORM@-g++ +bin/@MACHINE_GNU_PLATFORM@-gcc @PREFIX@/gcc49/bin/@MACHINE_GNU_PLATFORM@-gcc +bin/@MACHINE_GNU_PLATFORM@-gcc-@GCC49_DIST_VERSION@ @PREFIX@/gcc49/bin/@MACHINE_GNU_PLATFORM@-gcc-@GCC49_DIST_VERSION@ +bin/@MACHINE_GNU_PLATFORM@-gcc-ar @PREFIX@/gcc49/bin/@MACHINE_GNU_PLATFORM@-gcc-ar +bin/@MACHINE_GNU_PLATFORM@-gcc-nm @PREFIX@/gcc49/bin/@MACHINE_GNU_PLATFORM@-gcc-nm +bin/@MACHINE_GNU_PLATFORM@-gcc-ranlib @PREFIX@/gcc49/bin/@MACHINE_GNU_PLATFORM@-gcc-ranlib +bin/@MACHINE_GNU_PLATFORM@-gccgo @PREFIX@/gcc49/bin/@MACHINE_GNU_PLATFORM@-gccgo +bin/@MACHINE_GNU_PLATFORM@-gfortran @PREFIX@/gcc49/bin/@MACHINE_GNU_PLATFORM@-gfortran diff --git a/lang/gcc49/Makefile b/lang/gcc49/Makefile index b191970e4e0d4..58b7aedd1367e 100644 --- a/lang/gcc49/Makefile +++ b/lang/gcc49/Makefile @@ -42,6 +42,9 @@ INFO_FILES= yes UNLIMIT_RESOURCES+= datasize UNLIMIT_RESOURCES+= stacksize +FILES_SUBST+= GCC49_DIST_VERSION=${GCC49_DIST_VERSION} +FILES_SUBST+= MACHINE_GNU_PLATFORM=${MACHINE_GNU_PLATFORM} + SUBST_CLASSES+= vars SUBST_STAGE.vars= pre-configure SUBST_FILES.vars= gcc/Makefile.in @@ -73,7 +76,7 @@ CONFIGURE_ENV+= LDFLAGS_FOR_TARGET=${LDFLAGS_FOR_TARGET:Q} CONFIGURE_ARGS+= --enable-languages=${LANGS:Q} CONFIGURE_ARGS+= --enable-shared CONFIGURE_ARGS+= --enable-long-long -CONFIGURE_ARGS+= --with-local-prefix=${GCC_PREFIX:Q} +CONFIGURE_ARGS+= --with-local-prefix=${LOCALBASE:Q} CONFIGURE_ARGS+= --enable-libssp CONFIGURE_ARGS+= --enable-threads=posix CONFIGURE_ARGS+= --with-boot-ldflags=${BOOT_LDFLAGS:Q} diff --git a/lang/gcc49/buildlink3.mk b/lang/gcc49/buildlink3.mk index 1573d18af4bd6..f3f430020b425 100644 --- a/lang/gcc49/buildlink3.mk +++ b/lang/gcc49/buildlink3.mk @@ -16,7 +16,7 @@ BUILDLINK_FILES.gcc49= #empty BUILDLINK_AUTO_VARS.gcc49= no # Packages that link against shared libraries need a full dependency. -.if defined(_USE_GCC_SHLIB) +.if defined(_USE_GCC_SHLIB) && empty(USE_PKGSRC_GCC_RUNTIME:M[Yy][Ee][Ss]) DEPENDS+= {gcc49,gcc49-libs}>=4.9:../../lang/gcc49-libs .endif diff --git a/lang/gcc49/distinfo b/lang/gcc49/distinfo index a532b083210e4..08f9e17e4d78e 100644 --- a/lang/gcc49/distinfo +++ b/lang/gcc49/distinfo @@ -9,7 +9,9 @@ RMD160 (gcc-4.9.3.tar.bz2) = 799d45b4231d9417a4648bbef224657df76fca95 SHA512 (gcc-4.9.3.tar.bz2) = 9ac57377a6975fc7adac704ec81355262b9f537def6955576753b87715470a20ee6a2a3144a79cc8fcba3443f7b44c7337d79d704b522d053f54f79aa6b442df Size (gcc-4.9.3.tar.bz2) = 90006707 bytes SHA1 (patch-contrib_make__sunver.pl) = 49cbd1a83c9b65d07a373262fcf6f71069283d2e -SHA1 (patch-gcc_Makefile.in) = 45c7a61cf22d02299d2308ba34f0ceb272ad5c5e +SHA1 (patch-gcc_Makefile.in) = e5ef780f98e80ce7ccd48b013830dbfed679af85 +SHA1 (patch-gcc_caller-save.c) = 5d26b2ab0f0ea8292b63e0a43b3ac782c619deed +SHA1 (patch-gcc_common.opt) = d45228e1560e1cb087b07dc748196a6c17587a9c SHA1 (patch-gcc_config.gcc) = f8dc39c70aff31b1b9479895a14710ee9b168b3c SHA1 (patch-gcc_config.host) = 1b1e11cd199eb93f49443d51c0063b09b7327858 SHA1 (patch-gcc_config_dragonfly-stdint.h) = 249e78bf2171fcd29eae498e41a12bf747015a19 @@ -17,12 +19,15 @@ SHA1 (patch-gcc_config_dragonfly.h) = 5d671b7cdf8b8e3798dd7ec47f56708aa3548f38 SHA1 (patch-gcc_config_dragonfly.opt) = b01bee26978f7feb62fc2ec21186449ccaea0db7 SHA1 (patch-gcc_config_host-netbsd.c) = 765295f07edb8a68f1910e3a9b4dd2a7dcd491a5 SHA1 (patch-gcc_config_i386_dragonfly.h) = 5756b62791273f77866f06be1df0c267dc90a2ee +SHA1 (patch-gcc_config_i386_i386.c) = 16f036cebc009d18ece46399b3099aac8196098f SHA1 (patch-gcc_config_netbsd-stdint.h) = fc430c80adda9d3f58eea47816338f697a659889 SHA1 (patch-gcc_config_x-netbsd) = 6dc3d78e26df62054ea29f98ca51592858e671e3 -SHA1 (patch-gcc_configure) = eb52890725d2eabb200275b6cb61fd86d976ee31 +SHA1 (patch-gcc_configure) = 8d9c9f5e8ca7811acc141f1c017533c59beed23a +SHA1 (patch-gcc_dojump.c) = d9066b1d2ac6f7ddce876edf3cc61aca420d2686 SHA1 (patch-gcc_fortran_f95-lang.c) = 9dbac16c146821eed9b06e1e9f0da85ff5c4ee75 SHA1 (patch-gcc_ggc-common.c) = fa577bc25260d7e6304f166686ba51c0b677d7f6 SHA1 (patch-gcc_ginclude_stddef.h) = 8af3e4b4058fc623c61e91f5771699f0ce679957 +SHA1 (patch-gcc_ira.c) = eb65856ba989e93bf385e5c8bd381cd9cae08fdb SHA1 (patch-gcc_system.h) = 4c959a6b1c4d524cbdf44cfb80f0e5758ec20783 SHA1 (patch-include_libiberty.h) = 5254c6a421ae16c71571820f6f07906367f042ba SHA1 (patch-libcilkrts_runtime_os-unix.c) = 165e736decbc6e0e3d905d418d71cf4873927925 diff --git a/lang/gcc49/patches/patch-gcc_Makefile.in b/lang/gcc49/patches/patch-gcc_Makefile.in index 5e8be2a9545f4..27cd92a0165c1 100644 --- a/lang/gcc49/patches/patch-gcc_Makefile.in +++ b/lang/gcc49/patches/patch-gcc_Makefile.in @@ -1,8 +1,9 @@ $NetBSD: patch-gcc_Makefile.in,v 1.1 2014/09/04 18:43:11 jperkin Exp $ Add this GCC libdir to rpath. +Disable fixincludes, as per joyent/pkgsrc#270 ---- gcc/Makefile.in.orig 2014-04-15 08:04:17.000000000 +0000 +--- gcc/Makefile.in.orig 2014-10-16 13:50:42.000000000 +0000 +++ gcc/Makefile.in @@ -1930,6 +1930,7 @@ prefix.o: $(BASEVER) # Language-independent files. @@ -12,3 +13,12 @@ Add this GCC libdir to rpath. -DSTANDARD_STARTFILE_PREFIX=\"$(unlibsubdir)/\" \ -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \ -DSTANDARD_LIBEXEC_PREFIX=\"$(libexecdir)/gcc/\" \ +@@ -2730,7 +2731,7 @@ stmp-fixinc: gsyslimits.h macro_list fix + gcc_dir=`${PWD_COMMAND}` ; \ + export TARGET_MACHINE srcdir SHELL MACRO_LIST && \ + cd $(build_objdir)/fixincludes && \ +- $(SHELL) ./fixinc.sh "$${gcc_dir}/$${fix_dir}" \ ++ $(SHELL) -c true "$${gcc_dir}/$${fix_dir}" \ + $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS) ); \ + rm -f $${fix_dir}/syslimits.h; \ + if [ -f $${fix_dir}/limits.h ]; then \ diff --git a/lang/gcc49/patches/patch-gcc_caller-save.c b/lang/gcc49/patches/patch-gcc_caller-save.c new file mode 100644 index 0000000000000..d63f4c03937bb --- /dev/null +++ b/lang/gcc49/patches/patch-gcc_caller-save.c @@ -0,0 +1,15 @@ +$NetBSD$ + +Disable -fomit-frame-pointer. + +--- gcc/caller-save.c.orig 2014-01-02 22:23:26.000000000 +0000 ++++ gcc/caller-save.c +@@ -378,7 +378,7 @@ saved_hard_reg_compare_func (const void + const struct saved_hard_reg *p1 = *(struct saved_hard_reg * const *) v1p; + const struct saved_hard_reg *p2 = *(struct saved_hard_reg * const *) v2p; + +- if (flag_omit_frame_pointer) ++ if (0) + { + if (p1->call_freq - p2->call_freq != 0) + return p1->call_freq - p2->call_freq; diff --git a/lang/gcc49/patches/patch-gcc_common.opt b/lang/gcc49/patches/patch-gcc_common.opt new file mode 100644 index 0000000000000..027979203517c --- /dev/null +++ b/lang/gcc49/patches/patch-gcc_common.opt @@ -0,0 +1,19 @@ +$NetBSD$ + +Implement -fstrict-calling-conventions, from: + + https://github.com/richlowe/gcc/commit/c245a538375d071928782a1564cd7e55d70bd4a0 + +--- gcc/common.opt.orig 2015-02-26 02:43:52.000000000 +0000 ++++ gcc/common.opt +@@ -1991,6 +1991,10 @@ fstrict-aliasing + Common Report Var(flag_strict_aliasing) Optimization + Assume strict aliasing rules apply + ++fstrict-calling-conventions ++Common Report Var(flag_strict_calling_conventions) Init(1) ++Use strict ABI calling conventions even for static functions ++ + fstrict-overflow + Common Report Var(flag_strict_overflow) + Treat signed overflow as undefined diff --git a/lang/gcc49/patches/patch-gcc_config_i386_i386.c b/lang/gcc49/patches/patch-gcc_config_i386_i386.c new file mode 100644 index 0000000000000..de845e8ca3c11 --- /dev/null +++ b/lang/gcc49/patches/patch-gcc_config_i386_i386.c @@ -0,0 +1,41 @@ +$NetBSD$ + +Disable -fomit-frame-pointer. +Add support for -fstrict-calling-conventions. + +--- gcc/config/i386/i386.c.orig 2015-06-10 09:26:06.000000000 +0000 ++++ gcc/config/i386/i386.c +@@ -3857,7 +3857,7 @@ ix86_option_override_internal (bool main + } + + /* Keep nonleaf frame pointers. */ +- if (opts->x_flag_omit_frame_pointer) ++ if (0) + opts->x_target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER; + else if (TARGET_OMIT_LEAF_FRAME_POINTER_P (opts->x_target_flags)) + opts->x_flag_omit_frame_pointer = 1; +@@ -5636,6 +5636,7 @@ ix86_function_regparm (const_tree type, + and callee not, or vice versa. Instead look at whether the callee + is optimized or not. */ + && opt_for_fn (decl, optimize) ++ && (TARGET_64BIT || !flag_strict_calling_conventions) + && !(profile_flag && !flag_fentry)) + { + /* FIXME: remove this CONST_CAST when cgraph.[ch] is constified. */ +@@ -5713,6 +5714,7 @@ ix86_function_sseregparm (const_tree typ + /* For local functions, pass up to SSE_REGPARM_MAX SFmode + (and DFmode for SSE2) arguments in SSE registers. */ + if (decl && TARGET_SSE_MATH && optimize ++ && (TARGET_64BIT || !flag_strict_calling_conventions) + && !(profile_flag && !flag_fentry)) + { + /* FIXME: remove this CONST_CAST when cgraph.[ch] is constified. */ +@@ -10650,7 +10652,7 @@ ix86_finalize_stack_realign_flags (void) + if (stack_realign + && frame_pointer_needed + && crtl->is_leaf +- && flag_omit_frame_pointer ++ && 0 + && crtl->sp_is_unchanging + && !ix86_current_function_calls_tls_descriptor + && !crtl->accesses_prior_frames diff --git a/lang/gcc49/patches/patch-gcc_configure b/lang/gcc49/patches/patch-gcc_configure index ca701ce1e2d8e..cc30ab0346797 100644 --- a/lang/gcc49/patches/patch-gcc_configure +++ b/lang/gcc49/patches/patch-gcc_configure @@ -3,10 +3,20 @@ $NetBSD: patch-gcc_configure,v 1.1 2014/09/04 18:43:11 jperkin Exp $ Add dl_iterate_phdr detection for FreeBSD and DragonFly. Detection for NetBSD and OpenBSD is added but commented out in case this error handling mechanism is activated for these platforms later. +Fix detection of native TLS on SunOS, joyent/pkgsrc#264 ---- gcc/configure.orig 2014-05-28 11:37:50.000000000 +0000 +--- gcc/configure.orig 2015-05-12 08:55:54.000000000 +0000 +++ gcc/configure -@@ -27449,6 +27449,20 @@ case "$target" in +@@ -23330,7 +23330,7 @@ $as_echo "#define TLS_SECTION_ASM_FLAG ' + tls_first_major=2 + tls_first_minor=14 + tls_section_flag=T +- tls_as_opt="--fatal-warnings" ++ tls_as_opt="-32 --fatal-warnings" + fi + conftest_s="$conftest_s + foo: .long 25 +@@ -27570,6 +27570,20 @@ case "$target" in gcc_cv_target_dl_iterate_phdr=no fi ;; diff --git a/lang/gcc49/patches/patch-gcc_dojump.c b/lang/gcc49/patches/patch-gcc_dojump.c new file mode 100644 index 0000000000000..35c3a7112e761 --- /dev/null +++ b/lang/gcc49/patches/patch-gcc_dojump.c @@ -0,0 +1,15 @@ +$NetBSD$ + +Disable -fomit-frame-pointer. + +--- gcc/dojump.c.orig 2014-03-27 00:41:10.000000000 +0000 ++++ gcc/dojump.c +@@ -79,7 +79,7 @@ void + clear_pending_stack_adjust (void) + { + if (optimize > 0 +- && (! flag_omit_frame_pointer || cfun->calls_alloca) ++ && (! 0 || cfun->calls_alloca) + && EXIT_IGNORE_STACK) + discard_pending_stack_adjust (); + } diff --git a/lang/gcc49/patches/patch-gcc_ira.c b/lang/gcc49/patches/patch-gcc_ira.c new file mode 100644 index 0000000000000..22d0d5d25f806 --- /dev/null +++ b/lang/gcc49/patches/patch-gcc_ira.c @@ -0,0 +1,24 @@ +$NetBSD$ + +Disable -fomit-frame-pointer. + +--- gcc/ira.c.orig 2015-06-12 11:54:43.000000000 +0000 ++++ gcc/ira.c +@@ -1707,7 +1707,7 @@ ira_init (void) + { + free_register_move_costs (); + setup_reg_mode_hard_regset (); +- setup_alloc_regs (flag_omit_frame_pointer != 0); ++ setup_alloc_regs (0 != 0); + setup_class_subset_and_memory_move_costs (); + setup_reg_class_nregs (); + setup_prohibited_class_mode_regs (); +@@ -2396,7 +2396,7 @@ ira_setup_eliminable_regset (void) + case. At some point, we should improve this by emitting the + sp-adjusting insns for this case. */ + frame_pointer_needed +- = (! flag_omit_frame_pointer ++ = (! 0 + || (cfun->calls_alloca && EXIT_IGNORE_STACK) + /* We need the frame pointer to catch stack overflow exceptions + if the stack pointer is moving. */