Skip to content

Commit

Permalink
Apply our GCC diffs.
Browse files Browse the repository at this point in the history
 - 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 TritonDataCenter/pkgsrc#264 (avoid tls emulation)
 - Fix TritonDataCenter/pkgsrc#270 (disable fixincludes)
 - Disable RPATHs for tools build.
  • Loading branch information
Jonathan Perkin committed Jan 16, 2017
1 parent 159b66f commit 9ba9772
Show file tree
Hide file tree
Showing 12 changed files with 194 additions and 8 deletions.
17 changes: 15 additions & 2 deletions lang/gcc49-libs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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' ;

Expand All @@ -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"
Expand Down
20 changes: 20 additions & 0 deletions lang/gcc49/ALTERNATIVES
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions lang/gcc49/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,23 @@ 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
SUBST_VARS.vars= GCC_TARGET_MACHINE

.include "../../mk/bsd.prefs.mk"

# For the tools build (i.e. when not using USE_GCC_LOCALBASE_PREFIX) we
# do not want rpaths to leak into final binaries.
.if ${USE_GCC_LOCALBASE_PREFIX:Uno:tl} != "yes"
SUBST_SED.vars+= -e '/-R/d'
SUBST_SED.vars+= -e '/-DLINK_LIBGCC_SPEC=/d'
.endif

LANGS= c

# In some cases LINKER_RPATH_FLAG needs a trailing space.
Expand Down Expand Up @@ -79,7 +89,11 @@ CONFIGURE_ARGS+= --enable-libssp
CONFIGURE_ARGS+= --enable-languages=${LANGS:Q}
CONFIGURE_ARGS+= --enable-shared
CONFIGURE_ARGS+= --enable-long-long
.if ${USE_GCC_LOCALBASE_PREFIX:Uno:tl} == "yes"
CONFIGURE_ARGS+= --with-local-prefix=${LOCALBASE:Q}
.else
CONFIGURE_ARGS+= --with-local-prefix=${GCC_PREFIX:Q}
.endif
CONFIGURE_ARGS+= --enable-threads=posix
CONFIGURE_ARGS+= --with-boot-ldflags=${BOOT_LDFLAGS:Q}

Expand Down
2 changes: 1 addition & 1 deletion lang/gcc49/buildlink3.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions lang/gcc49/distinfo
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,26 @@ RMD160 (gcc-4.9.4.tar.bz2) = 180d4aaa9d2c34084f3f01261f8cb00ddb921529
SHA512 (gcc-4.9.4.tar.bz2) = 93abb78e16277454f41a8e9810f41f66c0fdffdc539a762ff6b67d3037f78db971378683fd2ebf707d1d51c059fad2161fe42d110c330027f40214b7db0f3efe
Size (gcc-4.9.4.tar.bz2) = 90097606 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
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_netbsd.h) = 086b593cf9f05e654df9e1a527485ca727ec44cc
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) = 37bfd4118a9393d7d0fc142ee13379526fd733ee
SHA1 (patch-gcc_system.h) = 4c959a6b1c4d524cbdf44cfb80f0e5758ec20783
SHA1 (patch-include_libiberty.h) = 5254c6a421ae16c71571820f6f07906367f042ba
SHA1 (patch-libcilkrts_runtime_os-unix.c) = 165e736decbc6e0e3d905d418d71cf4873927925
Expand Down
12 changes: 11 additions & 1 deletion lang/gcc49/patches/patch-gcc_Makefile.in
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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 \
15 changes: 15 additions & 0 deletions lang/gcc49/patches/patch-gcc_caller-save.c
Original file line number Diff line number Diff line change
@@ -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;
19 changes: 19 additions & 0 deletions lang/gcc49/patches/patch-gcc_common.opt
Original file line number Diff line number Diff line change
@@ -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
41 changes: 41 additions & 0 deletions lang/gcc49/patches/patch-gcc_config_i386_i386.c
Original file line number Diff line number Diff line change
@@ -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
14 changes: 12 additions & 2 deletions lang/gcc49/patches/patch-gcc_configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Expand Down
15 changes: 15 additions & 0 deletions lang/gcc49/patches/patch-gcc_dojump.c
Original file line number Diff line number Diff line change
@@ -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 ();
}
24 changes: 24 additions & 0 deletions lang/gcc49/patches/patch-gcc_ira.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$NetBSD$

Disable -fomit-frame-pointer.

--- gcc/ira.c.orig 2016-03-31 13:21: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 (as for the alloca case just above). */

0 comments on commit 9ba9772

Please sign in to comment.