From 9c851217b6d0d7a2d80f1d379654cae8ce045744 Mon Sep 17 00:00:00 2001 From: Rui Paulo Date: Wed, 13 Aug 2014 01:27:51 +0000 Subject: Make sure the DTrace header files are built before depend and before the build starts. This adds a new variable DHDRS that contains a list of all DTrace header files. Then, we use the beforedepend hook to make sure the heaeder files are built. Introduce a beforebuild dependency (from projects/bmake) based on feedback from Simon J. Gerraty. This lets us generate the header files without running make depend. Reviewed by: sjg, imp MFC after: 3 days --- share/mk/bsd.prog.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'share/mk/bsd.prog.mk') diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 229ce8e1fe64..b83e2ca1f00b 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -159,7 +159,8 @@ MAN1= ${MAN} .endif .endif # defined(PROG) -all: objwarn ${PROG} ${SCRIPTS} +all: beforebuild .WAIT ${PROG} ${SCRIPTS} +beforebuild: objwarn .if ${MK_MAN} != "no" all: _manpages .endif -- cgit v1.2.3 From 5608fd23c27fa1e8ee595d7b678cbfd35d657fbe Mon Sep 17 00:00:00 2001 From: Bryan Drewery Date: Tue, 19 Aug 2014 15:04:32 +0000 Subject: Revert r267233 for now. PIE support needs to be reworked. 1. 50+% of NO_PIE use is fixed by adding -fPIC to INTERNALLIB and other build-only utility libraries. 2. Another 40% is fixed by generating _pic.a variants of various libraries. 3. Some of the NO_PIE use is a bit absurd as it is disabling PIE (and ASLR) where it never would work anyhow, such as csu or loader. This suggests there may be better ways of adding support to the tree. Many of these cases can be fixed such that -fPIE will work but there is really no reason to have it in those cases. 4. Some of the uses are working around hacks done to some Makefiles that are really building libraries but have been using bsd.prog.mk because the code is cleaner. Had they been using bsd.lib.mk then NO_PIE would not have been needed. We likely do want to enable PIE by default (opt-out) for non-tree consumers (such as ports). For in-tree though we probably want to only enable PIE (opt-in) for common attack targets such as remote service daemons and setuid utilities. This is also a great performance compromise since ASLR is expected to reduce performance. As such it does not make sense to enable it in all utilities such as ls(1) that have little benefit to having it enabled. Reported by: kib --- share/mk/bsd.prog.mk | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'share/mk/bsd.prog.mk') diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index b83e2ca1f00b..c49b2bb44422 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -11,18 +11,6 @@ CFLAGS+=${COPTS} .endif -.if ${MK_PIE} != "no" && (!defined(NO_PIE) || ${NO_PIE} == "no") -.if !defined(RESCUE) && !defined(NO_SHARED) -CFLAGS+= -fPIE -pie -LDFLAGS+= -pie -.elif defined(NO_SHARED) -.if ${NO_SHARED} == "no" || ${NO_SHARED} == "NO" -CFLAGS+= -fPIE -pie -LDFLAGS+= -pie -.endif -.endif -.endif - .if ${MK_ASSERT_DEBUG} == "no" CFLAGS+= -DNDEBUG NO_WERROR= -- cgit v1.2.3 From 6e52173261f9b844f1f44d0b79be9193d1b1bf33 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 2 Sep 2014 19:05:34 +0000 Subject: Allow standalone debug for non-default ${PROG} targets This allows WITH_DEBUG_FILES to produce standalone debug for the ELF runtime linker. We previously disabled standalone debug files for bsd.prog.mk consumers that included a non-default ${PROG} target, but this is not required. Consumers that do not support standalone debug are still handled by disabling it for statically linked binaries, and for those that specify a non-default binary format. Sponsored by: DARPA, AFRL --- share/mk/bsd.prog.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'share/mk/bsd.prog.mk') diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index c49b2bb44422..340950a3cdd2 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -29,9 +29,7 @@ CTFFLAGS+= -g PROG= ${PROG_CXX} .endif -.if defined(PROG) && target(${PROG}) -MK_DEBUG_FILES= no -.elif !empty(LDFLAGS:M-Wl,*--oformat,*) || !empty(LDFLAGS:M-static) +.if !empty(LDFLAGS:M-Wl,*--oformat,*) || !empty(LDFLAGS:M-static) MK_DEBUG_FILES= no .endif -- cgit v1.2.3 From 59a9e2ca26a0bf55d908e6be6befd5c60e0f9d21 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Thu, 6 Nov 2014 22:46:40 +0000 Subject: Automatically build with debug symbols when building with WITH_CTF. Otherwise there's nothing for ctfconvert to do, and it ends up emitting an error for each object file. Also remove some redundant checks from bsd.prog.mk and bsd.lib.mk. Differential Revision: https://reviews.freebsd.org/D1111 Reviewed by: imp --- share/mk/bsd.prog.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'share/mk/bsd.prog.mk') diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 340950a3cdd2..e4f71045ab21 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -20,7 +20,7 @@ NO_WERROR= CFLAGS+=${DEBUG_FLAGS} CXXFLAGS+=${DEBUG_FLAGS} -.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != "" +.if ${MK_CTF} != "no" CTFFLAGS+= -g .endif .endif -- cgit v1.2.3 From e977d70f4573d2643415b32028fd791c8381600b Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sat, 8 Nov 2014 18:16:39 +0000 Subject: Revert r274200. Implicitly setting DEBUG_FLAGS when WITH_CTF is true is not the right way to do this. Requested by: kan --- share/mk/bsd.prog.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'share/mk/bsd.prog.mk') diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index e4f71045ab21..340950a3cdd2 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -20,7 +20,7 @@ NO_WERROR= CFLAGS+=${DEBUG_FLAGS} CXXFLAGS+=${DEBUG_FLAGS} -.if ${MK_CTF} != "no" +.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != "" CTFFLAGS+= -g .endif .endif -- cgit v1.2.3