Skip to content

Commit c60433f

Browse files
authored
Fix the compiler optimization when cross compile for Linux (#335)
Change the optimization for cross-compiled target (Android and linux systems) Related: #334
1 parent 4a3c718 commit c60433f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,13 @@ OBJ = $(SRC:c_src/%.c=$(BUILD)/%.o)
5252

5353
ifneq ($(CROSSCOMPILE),)
5454
ifeq ($(CROSSCOMPILE), Android)
55+
CFLAGS:=$(filter-out -O2,$(CFLAGS))
5556
CFLAGS += -fPIC -Os -z global
5657
LDFLAGS += -fPIC -shared -lm
58+
else ifeq ($(findstring linux,$(CROSSCOMPILE)),linux)
59+
CFLAGS:=$(filter-out -O2,$(CFLAGS))
60+
CFLAGS += -fPIC -Os -fvisibility=hidden
61+
LDFLAGS += -fPIC -shared
5762
else
5863
CFLAGS += -fPIC -fvisibility=hidden
5964
LDFLAGS += -fPIC -shared

0 commit comments

Comments
 (0)