Skip to content

Commit 9d778e0

Browse files
authored
Move -fPIC insertion to subconfigs' make_defs.mk. (#738)
* Move -fPIC insertion to subconfigs' make_defs.mk. Details: - Previously, common.mk was appending -fPIC to the CPICFLAGS variables set within the various subconfigurations' make_defs.mk files. This seemed somewhat unintuitive, and so now the -fPIC flag is assigned to the various subconfigs' CPICFLAGS variables in the respective make_defs.mk files. - This also commit changes the logic in common.mk so that instead of appending, the variable is overwritten, but now *only* in the case of Windows (since apparently -fPIC needs to be omitted there). Thanks to Nick Knight for catching and reporting this weirdness.
1 parent 04090df commit 9d778e0

File tree

39 files changed

+43
-47
lines changed

39 files changed

+43
-47
lines changed

common.mk

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -731,21 +731,17 @@ $(foreach c, $(CONFIG_LIST_FAM), $(eval $(call append-var-for,CWARNFLAGS,$(c))))
731731

732732
# --- Position-independent code flags (shared libraries only) ---
733733

734-
735-
ifeq ($(MK_ENABLE_SHARED),yes)
736-
737-
# Emit position-independent code for dynamic linking.
738-
ifeq ($(IS_MSVC),yes)
739-
# Note: Don't use any fPIC flags for Windows builds since all code is position-
734+
# Note: Avoid -fPIC flags for Windows builds since all code is position-
740735
# independent.
736+
ifeq ($(IS_MSVC),yes)
741737
CPICFLAGS :=
742-
else
743-
CPICFLAGS := -fPIC
744738
endif
745-
$(foreach c, $(CONFIG_LIST_FAM), $(eval $(call append-var-for,CPICFLAGS,$(c))))
739+
$(foreach c, $(CONFIG_LIST_FAM), $(eval $(call store-var-for,CPICFLAGS,$(c))))
746740

747741
# --- Symbol exporting flags (shared libraries only) ---
748742

743+
ifeq ($(MK_ENABLE_SHARED),yes)
744+
749745
# NOTE: These flags are only applied when building BLIS and not used by
750746
# applications that import BLIS compilation flags via the
751747
# $(get-user-cflags-for ...) function.

config/a64fx/make_defs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ THIS_CONFIG := a64fx
4747
# may specify additional flags here as needed.
4848
CPPROCFLAGS := -D_GNU_SOURCE -D_A64FX
4949
CMISCFLAGS :=
50-
CPICFLAGS :=
50+
CPICFLAGS := -fPIC
5151
CWARNFLAGS :=
5252

5353
ifneq ($(DEBUG_TYPE),off)

config/amd64/make_defs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ THIS_CONFIG := amd64
4747
# may specify additional flags here as needed.
4848
CPPROCFLAGS :=
4949
CMISCFLAGS :=
50-
CPICFLAGS :=
50+
CPICFLAGS := -fPIC
5151
CWARNFLAGS :=
5252

5353
ifneq ($(DEBUG_TYPE),off)

config/amd64_legacy/make_defs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ THIS_CONFIG := amd64_legacy
4848
# may specify additional flags here as needed.
4949
CPPROCFLAGS :=
5050
CMISCFLAGS :=
51-
CPICFLAGS :=
51+
CPICFLAGS := -fPIC
5252
CWARNFLAGS :=
5353

5454
ifneq ($(DEBUG_TYPE),off)

config/arm32/make_defs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ THIS_CONFIG := arm32
4747
# may specify additional flags here as needed.
4848
CPPROCFLAGS :=
4949
CMISCFLAGS := -mfloat-abi=hard -mfpu=neon
50-
CPICFLAGS :=
50+
CPICFLAGS := -fPIC
5151
CWARNFLAGS :=
5252

5353
ifneq ($(DEBUG_TYPE),off)

config/arm64/make_defs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ THIS_CONFIG := arm64
4747
# may specify additional flags here as needed.
4848
CPPROCFLAGS := -D_GNU_SOURCE
4949
CMISCFLAGS :=
50-
CPICFLAGS :=
50+
CPICFLAGS := -fPIC
5151
CWARNFLAGS :=
5252

5353
ifneq ($(DEBUG_TYPE),off)

config/armsve/make_defs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ THIS_CONFIG := armsve
4747
# may specify additional flags here as needed.
4848
CPPROCFLAGS := -D_GNU_SOURCE
4949
CMISCFLAGS :=
50-
CPICFLAGS :=
50+
CPICFLAGS := -fPIC
5151
CWARNFLAGS :=
5252

5353
ifneq ($(DEBUG_TYPE),off)

config/bgq/make_defs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ CMISCFLAGS := -fopenmp
5858
else
5959
$(error xlc or bgclang is required for this configuration.)
6060
endif
61-
CPICFLAGS :=
61+
CPICFLAGS := -fPIC
6262
CWARNFLAGS := -w
6363

6464
ifneq ($(DEBUG_TYPE),off)

config/bulldozer/make_defs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ THIS_CONFIG := bulldozer
4747
# may specify additional flags here as needed.
4848
CPPROCFLAGS :=
4949
CMISCFLAGS :=
50-
CPICFLAGS :=
50+
CPICFLAGS := -fPIC
5151
CWARNFLAGS :=
5252

5353
ifneq ($(DEBUG_TYPE),off)

config/cortexa15/make_defs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ THIS_CONFIG := cortexa15
4747
# may specify additional flags here as needed.
4848
CPPROCFLAGS :=
4949
CMISCFLAGS := -mfloat-abi=hard -mfpu=neon
50-
CPICFLAGS :=
50+
CPICFLAGS := -fPIC
5151
CWARNFLAGS :=
5252

5353
ifneq ($(DEBUG_TYPE),off)

0 commit comments

Comments
 (0)