lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master bb679ab 3/4: Use '-fPIC' for x86_64-pc-linux-


From: Greg Chicares
Subject: [lmi-commits] [lmi] master bb679ab 3/4: Use '-fPIC' for x86_64-pc-linux-gnu
Date: Sat, 26 Sep 2020 14:24:45 -0400 (EDT)

branch: master
commit bb679ab2dad0babe3bbf9a2d5ad083706adff2d4
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Use '-fPIC' for x86_64-pc-linux-gnu
    
    Combined '-fPIC' and '-pg' into one 'make' variable, because both those
    options must be included in both compiler and linker flags.
---
 workhorse.make | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/workhorse.make b/workhorse.make
index 0bb9e9b..aa0e776 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -768,9 +768,20 @@ wx_pdfdoc_ldflags := \
 
 # Flags.
 
-# Define FLAGS variables recursively for greater flexibility: e.g., so
-# that they reflect downstream conditional changes to the variables
-# they're composed from.
+# Define uppercase FLAGS recursively for greater flexibility: e.g., so
+# that they reflect downstream conditional changes to the lowercase
+# (and often immediately-expanded) variables they're composed from.
+
+# 'c_l_flags' are to be used in both compiler and linker commands.
+# The gprof '-pg' flag is one example. Another is '-fPIC', which
+# pc-linux-gnu requires for '-shared':
+#   https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html#DOCF1
+
+c_l_flags := $(gprof_flag)
+
+ifeq (x86_64-pc-linux-gnu,$(LMI_TRIPLET))
+  c_l_flags += -fPIC
+endif
 
 debug_flag := -ggdb
 
@@ -783,14 +794,12 @@ ifeq (3.4.2,$(gcc_version))
 endif
 
 CFLAGS = \
-  $(ggc_flags) $(debug_flag) $(optimization_flag) $(gprof_flag) \
+  $(ggc_flags) $(debug_flag) $(optimization_flag) $(c_l_flags) \
 
 CXXFLAGS = \
-  $(ggc_flags) $(debug_flag) $(optimization_flag) $(gprof_flag) \
+  $(ggc_flags) $(debug_flag) $(optimization_flag) $(c_l_flags) \
 
-LDFLAGS = \
-  $(gprof_flag) \
-  -Wl,-Map,$@.map \
+LDFLAGS = $(c_l_flags) -Wl,-Map,$@.map \
 
 # Explicitly disable the infelicitous auto-import default. See:
 #   http://article.gmane.org/gmane.comp.gnu.mingw.user/19758



reply via email to

[Prev in Thread] Current Thread [Next in Thread]