This repository was archived by the owner on Oct 12, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-16
lines changed Expand file tree Collapse file tree 2 files changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -29,13 +29,22 @@ INSTALL_DIR=../install
29
29
DOCDIR =doc
30
30
IMPDIR =import
31
31
32
- # -fPIC is enabled by default and can be disabled with DISABLE_PIC=1
33
- ifeq (,$(DISABLE_PIC ) )
34
- PIC_FLAG: =-fPIC
32
+ OPTIONAL_COVERAGE: =$(if $(TEST_COVERAGE ) ,-cov,)
33
+
34
+ # default to PIC on x86_64, use PIC=1/0 to en-/disable PIC.
35
+ # Note that shared libraries and C files are always compiled with PIC.
36
+ ifeq ($(PIC ) ,)
37
+ ifeq ($(MODEL),64) # x86_64
38
+ PIC: =1
39
+ else
40
+ PIC: =0
41
+ endif
42
+ endif
43
+ ifeq ($(PIC ) ,1)
44
+ override PIC: =-fPIC
35
45
else
36
- PIC_FLAG : =
46
+ override PIC : =
37
47
endif
38
- OPTIONAL_COVERAGE: =$(if $(TEST_COVERAGE ) ,-cov,)
39
48
40
49
ifeq (osx,$(OS ) )
41
50
DOTDLL:=.dylib
@@ -60,7 +69,7 @@ ifeq (solaris,$(OS))
60
69
endif
61
70
62
71
# Set DFLAGS
63
- UDFLAGS:=-conf = -Isrc -Iimport -w -dip1000 $(MODEL_FLAG ) $(PIC_FLAG ) $(OPTIONAL_COVERAGE )
72
+ UDFLAGS:=-conf = -Isrc -Iimport -w -dip1000 $(MODEL_FLAG ) $(PIC ) $(OPTIONAL_COVERAGE )
64
73
ifeq ($(BUILD ) ,debug)
65
74
UDFLAGS += -g -debug
66
75
DFLAGS:=$(UDFLAGS)
@@ -186,7 +195,7 @@ $(ROOT)/threadasm.o : src/core/threadasm.S
186
195
187
196
# ####################### Create a shared library ##############################
188
197
189
- $(DRUNTIMESO ) $(DRUNTIMESOLIB ) dll : DFLAGS+=-version=Shared
198
+ $(DRUNTIMESO ) $(DRUNTIMESOLIB ) dll : DFLAGS+=-version=Shared -fPIC
190
199
dll : $(DRUNTIMESOLIB )
191
200
192
201
$(DRUNTIMESO ) : $(OBJS ) $(SRCS )
Original file line number Diff line number Diff line change @@ -14,18 +14,11 @@ SRC:=src
14
14
GENERATED: =./generated
15
15
ROOT: =$(GENERATED ) /$(OS ) /$(BUILD ) /$(MODEL )
16
16
17
- # -fPIC is enabled by default and can be disabled with DISABLE_PIC=1
18
- ifeq (,$(DISABLE_PIC ) )
19
- PIC_FLAG: =-fPIC
20
- else
21
- PIC_FLAG: =
22
- endif
23
-
24
17
ifneq (default,$(MODEL ) )
25
18
MODEL_FLAG:=-m$(MODEL)
26
19
endif
27
- CFLAGS: =$(MODEL_FLAG ) -Wall
28
- DFLAGS: =$(MODEL_FLAG ) -w -I../../src -I../../import -I$(SRC ) -defaultlib= -debuglib= -dip1000 $( PIC_FLAG )
20
+ CFLAGS: =$(MODEL_FLAG ) $( PIC ) -Wall
21
+ DFLAGS: =$(MODEL_FLAG ) $( PIC ) -w -I../../src -I../../import -I$(SRC ) -defaultlib= -debuglib= -dip1000
29
22
# LINK_SHARED may be set by importing makefile
30
23
DFLAGS+ =$(if $(LINK_SHARED ) ,-L$(DRUNTIMESO ) ,-L$(DRUNTIME ) )
31
24
ifeq ($(BUILD ) ,debug)
You can’t perform that action at this time.
0 commit comments