arm64: sync make file rules from arch/arm

Summary:
  sync makefile build rules from arch/arm to fix some compile
issue

Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
This commit is contained in:
qinwei1 2023-02-20 20:22:54 +08:00 committed by Xiang Xiao
parent f41383d998
commit 335c83e3c0

View File

@ -86,36 +86,46 @@ EXTRA_LIBS += $(wildcard $(APPDIR)$(DELIM)staging$(DELIM)*$(LIBEXT))
# Override in Make.defs if linker is not 'ld'
ifeq ($(LD),$(CC))
ifeq ($(CONFIG_STACK_CANARIES),y)
# filter out ssp(Stack Smashing Protector) related flags:
# -fstack-protector
# -fstack-protector-all
# -fstack-protector-strong
# -fstack-protector-explicit
STRIPCFLAGS = $(filter -fstack-protector%,$(CFLAGS))
ifeq ($(CONFIG_ARM_TOOLCHAIN_ARMCLANG),)
ifeq ($(LD),$(CC))
ifeq ($(CONFIG_STACK_CANARIES),y)
# filter out ssp(Stack Smashing Protector) related flags:
# -fstack-protector
# -fstack-protector-all
# -fstack-protector-strong
# -fstack-protector-explicit
STRIPCFLAGS = $(filter -fstack-protector%,$(CFLAGS))
endif
LDSTARTGROUP ?= -Wl,--start-group
LDENDGROUP ?= -Wl,--end-group
LDFLAGS := $(addprefix -Xlinker ,$(LDFLAGS))
LDFLAGS += $(filter-out $(STRIPCFLAGS),$(CFLAGS))
else
LDSTARTGROUP ?= --start-group
LDENDGROUP ?= --end-group
endif
LDSTARTGROUP ?= -Wl,--start-group
LDENDGROUP ?= -Wl,--end-group
LDFLAGS := $(addprefix -Xlinker ,$(LDFLAGS))
LDFLAGS += $(filter-out $(STRIPCFLAGS),$(CFLAGS))
else
LDSTARTGROUP ?= --start-group
LDENDGROUP ?= --end-group
endif
BOARDMAKE = $(if $(wildcard board$(DELIM)Makefile),y,)
LIBPATH_OPT = -L
LIBRARY_OPT = -l
SCRIPT_OPT = -T
else
LIBPATH_OPT = --userlibpath
LIBRARY_OPT = --library=
SCRIPT_OPT = --scatter=
endif
ARCHSCRIPT := $(call CONVERT_PATH,$(ARCHSCRIPT))
LDFLAGS += $(addprefix -T,$(addsuffix .tmp,$(ARCHSCRIPT))) $(EXTRALINKCMDS)
LIBPATHS += -L $(call CONVERT_PATH,$(TOPDIR)$(DELIM)staging)
LDFLAGS += $(addprefix $(SCRIPT_OPT),$(addsuffix .tmp,$(ARCHSCRIPT))) $(EXTRALINKCMDS)
LIBPATHS += $(LIBPATH_OPT) $(call CONVERT_PATH,$(TOPDIR)$(DELIM)staging)
BOARDMAKE = $(if $(wildcard board$(DELIM)Makefile),y,)
ifeq ($(BOARDMAKE),y)
LIBPATHS += -L $(call CONVERT_PATH,$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board)
LIBPATHS += $(LIBPATH_OPT) $(call CONVERT_PATH,$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board)
endif
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,-l%,$(LINKLIBS)))
LDLIBS = $(patsubst %.a,%,$(patsubst lib%,$(LIBRARY_OPT)%,$(LINKLIBS)))
ifeq ($(BOARDMAKE),y)
LDLIBS += -lboard
LDLIBS += $(LIBRARY_OPT)board
endif
VPATH += chip