Skip to content
Snippets Groups Projects
Commit 11bfccd5 authored by Andrey Prokopenko's avatar Andrey Prokopenko Committed by Todd Gamblin
Browse files

Adding pic_flag property to compilers (#2375)

Different compilers have different flags for PIC (position-independent
code). This patch provides a common ground to accessing it inside specs.

See discussions in #508 and #2373. This patch does not address the issue
of mixed compilers as mentioned in #508.
parent 261d36e8
No related branches found
No related tags found
No related merge requests found
...@@ -78,6 +78,10 @@ def cxx11_flag(self): ...@@ -78,6 +78,10 @@ def cxx11_flag(self):
else: else:
return "-std=c++11" return "-std=c++11"
@property
def pic_flag(self):
return "-fPIC"
@classmethod @classmethod
def default_version(cls, comp): def default_version(cls, comp):
"""The '--version' option works for clang compilers. """The '--version' option works for clang compilers.
......
...@@ -74,6 +74,10 @@ def cxx14_flag(self): ...@@ -74,6 +74,10 @@ def cxx14_flag(self):
else: else:
return "-std=c++14" return "-std=c++14"
@property
def pic_flag(self):
return "-fPIC"
@classmethod @classmethod
def fc_version(cls, fc): def fc_version(cls, fc):
return get_compiler_version( return get_compiler_version(
......
...@@ -65,6 +65,10 @@ def cxx11_flag(self): ...@@ -65,6 +65,10 @@ def cxx11_flag(self):
else: else:
return "-std=c++11" return "-std=c++11"
@property
def pic_flag(self):
return "-fPIC"
@classmethod @classmethod
def default_version(cls, comp): def default_version(cls, comp):
"""The '--version' option seems to be the most consistent one """The '--version' option seems to be the most consistent one
......
...@@ -56,6 +56,10 @@ def cxx11_flag(self): ...@@ -56,6 +56,10 @@ def cxx11_flag(self):
# However, it can be mixed with a compiler that does support it # However, it can be mixed with a compiler that does support it
return "-std=c++11" return "-std=c++11"
@property
def pic_flag(self):
return "-PIC"
# Unlike other compilers, the NAG compiler passes options to GCC, which # Unlike other compilers, the NAG compiler passes options to GCC, which
# then passes them to the linker. Therefore, we need to doubly wrap the # then passes them to the linker. Therefore, we need to doubly wrap the
# options with '-Wl,-Wl,,' # options with '-Wl,-Wl,,'
......
...@@ -55,6 +55,10 @@ def openmp_flag(self): ...@@ -55,6 +55,10 @@ def openmp_flag(self):
def cxx11_flag(self): def cxx11_flag(self):
return "-std=c++11" return "-std=c++11"
@property
def pic_flag(self):
return "-fpic"
@classmethod @classmethod
def default_version(cls, comp): def default_version(cls, comp):
"""The '-V' option works for all the PGI compilers. """The '-V' option works for all the PGI compilers.
......
...@@ -58,6 +58,10 @@ def cxx11_flag(self): ...@@ -58,6 +58,10 @@ def cxx11_flag(self):
else: else:
return "-qlanglvl=extended0x" return "-qlanglvl=extended0x"
@property
def pic_flag(self):
return "-qpic"
@classmethod @classmethod
def default_version(cls, comp): def default_version(cls, comp):
"""The '-qversion' is the standard option fo XL compilers. """The '-qversion' is the standard option fo XL compilers.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment