From 07737584e73714eff3481fcf17f9f0331c8a5b88 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 18 Aug 2017 12:41:11 +0200 Subject: Check for -z,defs, -z,relro, -fPIC, -fPIE before using them Those flags are not available on all platforms, and omitting them when not available will not cause any harm. In particular: -z,defs disallows undefined symbols in object files. This option is unsupported if the target binary format enforces the same condition already. Furthermore it is only a compile time sanity check. When it is omitted, the same binary is produced. -z,relro instructs the loader to mark sections read-only after loading the library, where possible. This is a hardening mechanism. If it is unavailable, the functionality of the code is not affected in any way. -fPIC instructs the compiler to produce position independent code. While this is preferable to relocatable code, relocatable code also works and may even be faster. Relocatable code might just be loaded into memory multiple times for different processes. -fPIE is the same thing as -fPIC for executables rather than shared libraries. Signed-off-by: Ulf Hermann --- config/eu.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'config/eu.am') diff --git a/config/eu.am b/config/eu.am index 8fe1e259..796f3883 100644 --- a/config/eu.am +++ b/config/eu.am @@ -86,14 +86,14 @@ endif %.os: %.c %.o if AMDEP - $(AM_V_CC)if $(COMPILE.os) -c -o $@ -fPIC $(DEFS.os) -MT $@ -MD -MP \ + $(AM_V_CC)if $(COMPILE.os) -c -o $@ $(fpic_CFLAGS) $(DEFS.os) -MT $@ -MD -MP \ -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ rm -f "$(DEPDIR)/$*.Tpo"; \ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ fi else - $(AM_V_CC)$(COMPILE.os) -c -o $@ -fPIC $(DEFS.os) $< + $(AM_V_CC)$(COMPILE.os) -c -o $@ $(fpic_CFLAGS) $(DEFS.os) $< endif CLEANFILES = *.gcno *.gcda -- cgit v1.2.3