Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1974 from MartinNowak/fix17996
Browse files Browse the repository at this point in the history
fix Issue 17966 - don't build libphobos2.a with PIC for i386
merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
  • Loading branch information
dlang-bot committed Nov 20, 2017
2 parents 9fee0ca + 84ac676 commit 7c8ca6a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
23 changes: 16 additions & 7 deletions posix.mak
Expand Up @@ -29,13 +29,22 @@ INSTALL_DIR=../install
DOCDIR=doc
IMPDIR=import

# -fPIC is enabled by default and can be disabled with DISABLE_PIC=1
ifeq (,$(DISABLE_PIC))
PIC_FLAG:=-fPIC
OPTIONAL_COVERAGE:=$(if $(TEST_COVERAGE),-cov,)

# default to PIC on x86_64, use PIC=1/0 to en-/disable PIC.
# Note that shared libraries and C files are always compiled with PIC.
ifeq ($(PIC),)
ifeq ($(MODEL),64) # x86_64
PIC:=1
else
PIC:=0
endif
endif
ifeq ($(PIC),1)
override PIC:=-fPIC
else
PIC_FLAG:=
override PIC:=
endif
OPTIONAL_COVERAGE:=$(if $(TEST_COVERAGE),-cov,)

ifeq (osx,$(OS))
DOTDLL:=.dylib
Expand All @@ -60,7 +69,7 @@ ifeq (solaris,$(OS))
endif

# Set DFLAGS
UDFLAGS:=-conf= -Isrc -Iimport -w -dip1000 $(MODEL_FLAG) $(PIC_FLAG) $(OPTIONAL_COVERAGE)
UDFLAGS:=-conf= -Isrc -Iimport -w -dip1000 $(MODEL_FLAG) $(PIC) $(OPTIONAL_COVERAGE)
ifeq ($(BUILD),debug)
UDFLAGS += -g -debug
DFLAGS:=$(UDFLAGS)
Expand Down Expand Up @@ -186,7 +195,7 @@ $(ROOT)/threadasm.o : src/core/threadasm.S

######################## Create a shared library ##############################

$(DRUNTIMESO) $(DRUNTIMESOLIB) dll: DFLAGS+=-version=Shared
$(DRUNTIMESO) $(DRUNTIMESOLIB) dll: DFLAGS+=-version=Shared -fPIC
dll: $(DRUNTIMESOLIB)

$(DRUNTIMESO): $(OBJS) $(SRCS)
Expand Down
11 changes: 2 additions & 9 deletions test/common.mak
Expand Up @@ -14,18 +14,11 @@ SRC:=src
GENERATED:=./generated
ROOT:=$(GENERATED)/$(OS)/$(BUILD)/$(MODEL)

# -fPIC is enabled by default and can be disabled with DISABLE_PIC=1
ifeq (,$(DISABLE_PIC))
PIC_FLAG:=-fPIC
else
PIC_FLAG:=
endif

ifneq (default,$(MODEL))
MODEL_FLAG:=-m$(MODEL)
endif
CFLAGS:=$(MODEL_FLAG) -Wall
DFLAGS:=$(MODEL_FLAG) -w -I../../src -I../../import -I$(SRC) -defaultlib= -debuglib= -dip1000 $(PIC_FLAG)
CFLAGS:=$(MODEL_FLAG) $(PIC) -Wall
DFLAGS:=$(MODEL_FLAG) $(PIC) -w -I../../src -I../../import -I$(SRC) -defaultlib= -debuglib= -dip1000
# LINK_SHARED may be set by importing makefile
DFLAGS+=$(if $(LINK_SHARED),-L$(DRUNTIMESO),-L$(DRUNTIME))
ifeq ($(BUILD),debug)
Expand Down

0 comments on commit 7c8ca6a

Please sign in to comment.