Skip to content

Commit bd6a606

Browse files
committed
arm: compile all thumb with -mthumb-interwork and cleanup -O3
To enable this option use ENABLE_ARM_THUMB_INTERWORK := true This may slightly increase binary size but will include more arm instructions for increased performance. https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html Change-Id: I0ba0a2d34b84e34309c20ce0cbb85ea3ee6dda15 Signed-off-by: Paul Beeler <pbeeler80@gmail.com>
1 parent 37fb144 commit bd6a606

File tree

3 files changed

+55
-25
lines changed

3 files changed

+55
-25
lines changed

core/O3.mk

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,14 @@
1414
#
1515

1616
ifneq (1,$(words $(filter $(LOCAL_DISABLE_O3),$(LOCAL_MODULE))))
17-
LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
18-
ifeq (arm,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
19-
arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm)
20-
normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
21-
22-
# Read the values from something like TARGET_arm_CFLAGS or
23-
# TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't
24-
# actually used (although they are usually empty).
25-
arm_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(arm_objects_mode)_CFLAGS)
26-
normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS)
17+
ifdef LOCAL_CONLYFLAGS
18+
LOCAL_CONLYFLAGS += $(O3_FLAGS)
2719
else
28-
arm_objects_mode :=
29-
normal_objects_mode :=
30-
arm_objects_cflags :=
31-
normal_objects_cflags :=
20+
LOCAL_CONLYFLAGS := $(O3_FLAGS)
3221
endif
33-
ifeq ($(filter $(LOCAL_DISABLE_O3_CFLAGS),$(arm_objects_cflags)$(normal_objects_cflags)),)
34-
ifdef LOCAL_CONLYFLAGS
35-
LOCAL_CONLYFLAGS += $(O3_FLAGS)
36-
else
37-
LOCAL_CONLYFLAGS := $(O3_FLAGS)
38-
endif
39-
ifdef LOCAL_CPPFLAGS
40-
LOCAL_CPPFLAGS += $(O3_FLAGS)
41-
else
42-
LOCAL_CPPFLAGS := $(O3_FLAGS)
43-
endif
22+
ifdef LOCAL_CPPFLAGS
23+
LOCAL_CPPFLAGS += $(O3_FLAGS)
24+
else
25+
LOCAL_CPPFLAGS := $(O3_FLAGS)
4426
endif
4527
endif

core/binary.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ endif
114114

115115
# Include custom gcc flags. Seperate them so they can be easily managed.
116116

117+
# arm thumb
118+
ifeq ($(strip $(ENABLE_ARM_THUMB_INTERWORK)),true)
119+
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),true)
120+
include $(BUILD_SYSTEM)/thumb_interwork.mk
121+
endif
122+
endif
123+
117124
# O3
118125
ifeq ($(strip $(O3_OPTIMIZATIONS)),true)
119126
include $(BUILD_SYSTEM)/O3.mk

core/thumb_interwork.mk

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Copyright (C) 2014-2015 The SaberMod Project
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
16+
# Copyright (C) 2014-2015 The SaberMod Project
17+
#
18+
# Licensed under the Apache License, Version 2.0 (the "License");
19+
# you may not use this file except in compliance with the License.
20+
# You may obtain a copy of the License at
21+
#
22+
# http://www.apache.org/licenses/LICENSE-2.0
23+
#
24+
# Unless required by applicable law or agreed to in writing, software
25+
# distributed under the License is distributed on an "AS IS" BASIS,
26+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27+
# See the License for the specific language governing permissions and
28+
# limitations under the License.
29+
#
30+
31+
ifeq ($(strip (TARGET_ARCH)),arm)
32+
ifneq (1,$(words $(filter $(LOCAL_DISABLE_THUMB_INTERWORK),$(LOCAL_MODULE))))
33+
ifdef LOCAL_CFLAGS
34+
LOCAL_CFLAGS += \
35+
-mthumb-interwork
36+
else
37+
LOCAL_CFLAGS := \
38+
-mthumb-interwork
39+
endif
40+
endif
41+
endif

0 commit comments

Comments
 (0)