Commit graph

217 commits

Author SHA1 Message Date
wiz
6ea199b786 mk: fix a duplicate GCC9 variable to refer to GCC10 instead
Noted by Jackson Bryn in PR 55842.
2020-12-05 09:24:00 +00:00
wiz
8bb51a1d49 mk: expand _USE_GCC_SHLIB section to gcc9/gcc10 2020-10-28 13:19:25 +00:00
rillig
c44518e90f mk: fix undefined variables for current make running in -dL mode
In lint mode, NetBSD's make is stricter about undefined variables.  In
conditions, the function arguments must be fully defined.
2020-10-06 17:36:50 +00:00
ryoon
e00f3c4739 mk/compiler: Support GCC_REQD=9 or 10
A pert of PR pkg/55637.
2020-09-02 16:16:43 +00:00
rillig
c42fb662dc mk/compiler.mk: check for too late GCC_REQD and USE_LANGUAGES
For USE_LANGUAGES there is already a pkglint warning, but for GCC_REQD it
is missing.  It's better to have this check directly in the
infrastructure since it is more reliable.

This check is disabled by default, to not cause any new breakage.
It should be enabled in bulk builds.
2020-06-02 06:58:13 +00:00
sjmulder
a376838f3a mk/compiler: Set -fcommon for GCC 10
As with clang. Default got flipped with v10.
2020-05-31 00:00:13 +00:00
sjmulder
9014f3f496 mk/compiler: Fix version check for GCC 10
Caused SSP flags to be omitted in GCC 10. Check flipped because all new
GCC versions can be expected to support it.
2020-05-30 22:45:36 +00:00
nia
73411e4b5f mk/compiler: Make gfortran the default fortran compiler.
Discussed on tech-pkg@ before freeze.
2020-03-30 09:39:24 +00:00
nia
f4ab3d48e8 mk: default to gfortran on aarch64, there's no g95 for aarch64 2020-03-14 10:00:37 +00:00
rillig
1604275256 mk/compiler/gcc.mk: reorder variables in _VARGROUPS section
By listing the public variables first, the focus is put on the most
important variables.
2019-09-19 06:46:59 +00:00
rillig
95fe8ca6c6 mk/compiler/gcc.mk: add missing variables to _VARGROUPS section 2019-09-18 06:46:13 +00:00
rillig
fe8d2392e3 mk/compiler/gcc.mk: search for GCCBASE/bin/gcc as well
A default installation of GCC doesn't install bin/cc but only bin/gcc.
Adding bin/cc is only done by the pgksrc packages, not by the upstream
package.

The previous strategy of just checking whether ${GCCBASE}/bin/${CC:[1]}
exists did not work in such a situation. Therefore, if CC still has its
default value from sys.mk, that is changed to the intended gcc, which
then detects the base GCC properly.

See https://mail-index.netbsd.org/pkgsrc-users/2019/09/07/msg029329.html.
See https://mail-index.netbsd.org/tech-pkg/2019/09/18/msg021976.html.
2019-09-18 06:35:12 +00:00
rillig
d7f638ee99 mk/compiler: replace complicated :M_asdf_ modifier with :[1]
The :[1] modifier has been added to bmake in 2006.
2019-09-18 06:15:13 +00:00
rillig
e8b4d71240 mk/compiler/gcc.mk: refactoring for PKGPATH comparison
Since PKGPATH can only ever consist of a single path, there is no point
in applying the :M modifier to it.
2019-09-08 09:24:52 +00:00
rillig
a504a7a55a mk/compiler/gcc.mk: improve _VARGROUPS section 2019-09-07 22:20:32 +00:00
rillig
22bac2bbe2 mk/compiler/gcc.mk: update _VARGROUPS 2019-09-07 07:10:15 +00:00
ryoon
a73d906dd6 Do not pass -std=c++03 to GCC 4.4
No objection on tech-pkg@.
2019-07-15 16:06:19 +00:00
riastradh
14df6bc748 aarch64 has no compiler flag for ABI=64. 2019-07-09 15:46:02 +00:00
riastradh
2f9efeb223 Avoid passing _CC as cross-compiler to recursive makes.
This way we don't inadvertently tell a native dependency that it is
supposed to be compiled with the cross-compiler.

No functional change intended for USE_CROSS_COMPILE=no.
2019-07-09 15:45:46 +00:00
jperkin
71e098497c mk: Add CTF infrastructure support.
Platform support is determined by _OPSYS_SUPPORTS_CTF from mk/platform, the
user enables support by setting PKGSRC_USE_CTF=yes, and packages can
explicitly disable support with CTF_SUPPORTED=no or skip certain files with
CTF_FILES_SKIP.

The path to ctfconvert is configured via TOOLS_PLATFORM.ctfconvert.

If all of the requisite variables are enabled, a compiler-specific debug flag
is passed via the wrappers to ensure we have DWARF information to convert,
_INSTALL_UNSTRIPPED is explicitly defined to avoid binaries being stripped
prior to conversion, and the conversion is performed during the install stage.

It is recommended that users who enable the feature also set STRIP_DEBUG=yes
to reduce the final binary size once the conversion has been performed.

This has been used for the past year in Joyent SmartOS builds.  FreeBSD is
marked as supported but is untested.
2018-11-12 14:22:58 +00:00
abs
c025aae024 Don't rely on gcc version fallthrough for GCC_REQD+=8
(Thanks to eagle eyes from leot@)
2018-10-29 11:53:18 +00:00
abs
2c974aa3c5 Add GCC_REQD+=8 support to compiler/gcc.mk 2018-10-28 22:22:19 +00:00
abs
752fb11aed Support single digit GCC_REQ values (5, 6 or 7)
Do not add 4 to avoid confusion between gcc44/48/49

Also switch USE_PKGSRC_GCC_RUNTIME checks to use _GCC_PKGBASE to match
against selected gcc
2018-10-09 15:02:48 +00:00
rillig
b353c90862 Remove trailing whitespace 2018-10-08 20:02:17 +00:00
jperkin
593ba9f18c mk/compiler/gcc.mk: Darwin needs _USE_GCC_SHLIB too. 2018-07-11 11:11:52 +00:00
wiz
b621cbd744 mk/compiler/gcc.mk: move _GCC_LDFLAGS setting for relro.
At the previous location it was overridden if a gcc from pkgsrc was used.

Problem found by bacon@
2018-05-24 05:47:21 +00:00
jperkin
d8bb1d8957 mk: Fix GCC PKGPATH matches. 2018-05-23 10:17:58 +00:00
jperkin
512dfdee29 mk: Add USE_PKGSRC_GCC_RUNTIME gcc7-libs support. 2018-05-23 08:11:59 +00:00
khorben
fd7a4f25a3 Also append the CFLAGS for MKPIE for c++(1)
From spz@, thanks!
2017-11-29 22:55:15 +00:00
khorben
542893c887 Revert "Always add "-fPIC" when linking with PKGSRC_MKPIE"
It seems to break emulators/qemu.
2017-11-15 19:04:24 +00:00
khorben
42bd86cfb0 Add initial support for building packages reproducibly
It currently tackles two problems:
- gcc(1) hard-coding full paths in debugging information (with one
  caveat at the moment)
- ar(1) hard-coding user IDs in archive headers

This allows packages built from the same tree and options to produce
identical results bit by bit. This option should be combined with ASLR
and PKGSRC_MKPIE to avoid predictable address offsets for attackers
attempting to exploit security vulnerabilities.

This is still disabled by default, and only supports NetBSD so far.

As discussed on tech-pkg@
2017-11-12 13:34:14 +00:00
khorben
24807e5120 Always add "-fPIC" when linking with PKGSRC_MKPIE
This makes sure a simple "cc -o hello hello.c" will still build a valid
executable. It does not let us detect when CFLAGS or LDFLAGS are
ignored anymore, but it is legitimate for packages to expect it to work
without any additional parameter.

ld(1) does not expect "-fPIC" but it seems to be ignored by our wrappers
in this case, so no disruption is expected there.
2017-11-07 16:57:58 +00:00
jperkin
8dbb87e55a mk: Fix SSP detection when using pkgsrc GCC.
We can't rely on _GCC_VERSION as an accurate indicator of the GCC version,
as when using a pkgsrc GCC it will be set to 0 until the pkgsrc GCC is
available and we can detect its version.  Instead, move the logic later to
after CC_VERSION is set and use that instead.
2017-10-03 09:38:16 +00:00
jperkin
3f417abb31 Limit GCC SSP support to 4.x and newer. 2017-09-11 09:06:41 +00:00
khorben
6b7f07a1e4 Add support for PKGSRC_MKPIE with cwrappers
This is based on a patch submitted on 16/04/2017 on tech-pkg@ and
adapted by joerg@ for pkgtools/cwrappers. It only consists in the
missing part to actually generate PIE executables with cwrappers if
configured to do so (currently disabled by default). The aim is really
to produce safer binaries where ASLR is in use.

This part in pkgsrc is only supported on NetBSD (x86) with GCC at the
moment.

Tested on NetBSD/amd64, with and without cwrappers, with and without
PKGSRC_MKPIE (all four combinations).
2017-08-25 01:43:17 +00:00
jperkin
7c713c8b68 Remove obsolete and unused SunOS fortify section. 2017-08-04 08:53:33 +00:00
brook
590147deae Add logic so GCC_REQD+=7.x works. 2017-07-18 18:27:31 +00:00
khorben
e519f07826 Register support for PKGSRC_USE_STACK_CHECK
This adds -fstack-check to the CFLAGS (with GCC on NetBSD x86). Only
tested on NetBSD/amd64 so far.

Disabled by default.
2017-07-09 14:30:07 +00:00
joerg
5f789069ad Fix typo. 2017-06-25 01:41:15 +00:00
jperkin
c657f15637 Consolidate setting of SSP flags now that multiple compilers support it. 2017-05-18 08:14:08 +00:00
joerg
8b20e378ad Add GCC_VERSION_SUFFIX, which can be used i.e. on SuSE systems to select
between different compiler versions.
2017-05-04 18:44:12 +00:00
khorben
4211ac7e85 Add granularity to PKGSRC_USE_FORTIFY and PKGSRC_USE_RELRO
The new options are, for FORTIFY:
  "no"     Do not pass any flags for FORTIFY
  "weak"   Pass -D_FORTIFY_SOURCE=1
  "strong" Pass -D_FORTIFY_SOURCE=2

This allows users to reduce the level of FORTIFY specified if necessary
or desired. The previous setting as "yes" is now equivalent to "strong"
(the default when enabling).

The new options are, for RELRO:
  "no"      Do not pass any flags for RELRO
  "partial" Pass -Wl,-z,relro
  "full"    Pass -Wl,-z,relro -Wl,-z,now

This allows users to reduce the level of RELRO specified if necessary or
desired. The previous setting as "yes" is now equivalent to "full" (the
default when enabling).

This is intended to match the changes committed by jperkin@ (for SSP)
after our discussion a (long) while back.

No functional change intended (with the settings supported so far).
2017-04-16 23:12:37 +00:00
jperkin
4c279ad5d4 Let GCC 4.4 handle requests for GCC 4.[0-4] to ensure we are consistent in
using the closest match for each request, as well as fixing platforms where
GCC 6 does not yet build or is unsupported.
2017-04-10 12:22:07 +00:00
maya
2ab36e5237 Remove last mentions of gcc45,46,47 in mk/.
No functional change intended.
2016-12-29 23:16:26 +00:00
maya
bc1d2b7489 Remove some of the mentions for gcc{45,46,47}.
No functional change intended.
Still a few left.
2016-12-29 23:07:17 +00:00
maya
e2f57f6d5e Make GCC_REQD+= 4.5 to 4.8 resolve to 4.8 (dropping the possibility to
match for 4.5, 4.6, 4.7, which will soon be dropped).

This commit is the functional change. Cleanup will be done in separate
commits.
2016-12-29 22:21:13 +00:00
marino
e7a91fc2fa Upgrade USE_LANGUAGES=ada to use lang/gcc5-aux instead of lang/gcc-aux
This large commit accomplishes the following:

1) Switch USE_LANGUAGES=ada to require lang/gcc5-aux (gcc 5.4) instead
   of lang/gcc-aux (gcc 4.9.2) on gcc.mk
2) Bump affected ports and fix paths as necessary
3) Upgrade devel/gprbuild to the latest release
   - No longer requires lang/gnat_util
   - gprslave requires gcc6-aux, so it was disabled for now
4) Fix lang/gnat_util but set PKG_SKIP_REASON
   - It has no further purpose in the pkgsrc tree
   - It has no practical purpose outside of the pkgsrc tree
   - Indicate intent to remove from tree in Jan. 2017
5) Set devel/GPS as failed with PKG_FAIL_REASON
   - This version of GPS is several years old and at the time they were
     strongly tied to compiler.
   - Latest release of GPS require gcc6-aux (not available) and several
     new and complex dependencies
   - maintainer (me) has no interest to continue supporting it
   - Leaving GPS in place until Jan 2017 to give another person chance to
     upgrade and take over support
   - Latest version in FreeBSD Ports Collection as a reference point
2016-11-25 20:36:49 +00:00
jperkin
c034060ef5 Fix mips ABI setup which cannot have possibly worked for a long time. 2016-10-10 08:26:08 +00:00
maya
7068769a8f Add logic so GCC_REQD+=6.x works
ok jperkin@
2016-09-13 07:59:15 +00:00
jperkin
c02e752f64 Change PKGSRC_USE_SSP to a quad option. The options are now:
"no"     Do not pass any stack protection flags (the default)
   "yes"    Pass -fstack-protector
   "strong" Pass -fstack-protector-strong
   "all"    Pass -fstack-protector-all

This allows users to configure the level of stack smashing protection they
require, and ensures consistent behaviour across platforms.  Users running
on NetBSD who previously used the option will need to change "yes" to "all"
to match the previous default configuration for that platform.

While here use _WRAP_EXTRA_ARGS to ensure the flag gets passed regardless
of whether the package honours CFLAGS, and support additional wrappers.

Discussed a while back with khorben, and used in production for the SmartOS
2016Q1 package sets with the "strong" option.
2016-06-13 13:26:42 +00:00