On Sunday, June 7, 2015 at 9:47:51 PM UTC-4, Jeffrey Walton wrote:
>
> The GNUmakefile has the following:
>
>     # -fPIC is supported. Please report any breakage of -fPIC as a bug.
>     # CXXFLAGS += -fPIC
>
> Compiling a x86_64 shared object results in a compile failure if -fPIC is 
> not present...
>
> QUESTION: is anyone aware of modern x86_64 compilers or platforms that 
> cannot tolerate PIC? (For some reasonable definition of modern).
>

The following is the patch we are considering. It adds -fPIC for x86_64 
targets:

diff --git a/GNUmakefile b/GNUmakefile
index 61204cf..8f8e643 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -12,6 +12,7 @@ MKDIR = mkdir
 EGREP = egrep
 UNAME = $(shell uname)
 IS_X86 = $(shell uname -m | $(EGREP) -c "i.86|x86|i86|amd64")
+IS_X86_64 = $(shell uname -m | $(EGREP) -c "_64|d64")
 IS_SUN_CC = $(shell $(CXX) -V 2>&1 | $(EGREP) -c "CC: Sun")
 IS_LINUX = $(shell $(CXX) -dumpmachine 2>&1 | $(EGREP) -c "linux")
 IS_MINGW = $(shell $(CXX) -dumpmachine 2>&1 | $(EGREP) -c "mingw")
@@ -26,6 +27,11 @@ ifeq ($(CXX),gcc)    # for some reason CXX is gcc on 
cygwin 1
 CXX = g++
 endif
 
+# Enable PIC for x86_64 targets
+ifneq ($(IS_X86_64),0)
+CXXFLAGS += -fPIC
+endif
+
 ifeq ($(IS_X86),1)
 
 GCC42_OR_LATER = $(shell $(CXX) -v 2>&1 | $(EGREP) -c "^gcc version 
(4.[2-9]|[5
@@ -81,7 +87,7 @@ endif
 
 ifeq ($(IS_LINUX),1)
 LDFLAGS += -pthread
-ifneq ($(shell uname -i | $(EGREP) -c "(_64|d64)"),0)
+ifneq ($(IS_X86_64),0)
 M32OR64 = -m64
 endif
 endif

-fPIC does not appear to be needed on OS X 10.7 - 10.9/10.10 or OpenBSD 
5.7. But rather that special case it (GNU make lacks logical operators), I 
think its easiest/cleanest to add it for all targets.

Jeff 

-- 
-- 
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
--- 
You received this message because you are subscribed to the Google Groups 
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to