Skip to content

Commit

Permalink
Omit -fPIC if shared library build is disabled. (#732)
Browse files Browse the repository at this point in the history
Details:
- Updated common.mk so that when --disable-shared option is given to
  configure:
  1. The -fPIC compiler flag is omitted from the individual 
     configuration family members' CPICFLAGS variables (which are 
     initialized in each subconfig's make_defs.mk file); and
  2. The BUILD_SYMFLAGS variable, which contains compiler flags needed 
     to control the symbol export behavior, is left blank.
- The net result of these changes is that flags specific to shared
  library builds are only used when a shared library is actually 
  scheduled to be built. Thanks to Nick Knight for reporting this issue.
- CREDITS file update.
  • Loading branch information
fgvanzee committed Mar 25, 2023
1 parent 72c37eb commit 5f84130
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ but many others have contributed code, ideas, and feedback, including
Tony Kelman @tkelman
Lee Killough @leekillough (Cray)
Mike Kistler @mkistler (IBM, Austin Research Laboratory)
Nick Knight @nick-knight (SiFive)
Ivan Korostelev @ivan23kor (University of Alberta)
Kyungmin Lee @kyungminlee (Ohio State University)
Michael Lehn @michael-lehn
Expand Down
11 changes: 11 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,9 @@ $(foreach c, $(CONFIG_LIST_FAM), $(eval $(call append-var-for,CWARNFLAGS,$(c))))

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


ifeq ($(MK_ENABLE_SHARED),yes)

# Emit position-independent code for dynamic linking.
ifeq ($(IS_MSVC),yes)
# Note: Don't use any fPIC flags for Windows builds since all code is position-
Expand Down Expand Up @@ -814,6 +817,14 @@ endif
endif
endif

else #ifeq ($(MK_ENABLE_SHARED),no)

# Don't modify CPICFLAGS for the various configuration family members.
# Don't use any special symbol export flags.
BUILD_SYMFLAGS :=

endif

# --- Language flags ---

# Enable C99.
Expand Down

0 comments on commit 5f84130

Please sign in to comment.