forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/arch/um/Makefile
....@@ -23,8 +23,6 @@
2323 # features.
2424 SHELL := /bin/bash
2525
26
-filechk_gen_header = $<
27
-
2826 core-y += $(ARCH_DIR)/kernel/ \
2927 $(ARCH_DIR)/drivers/ \
3028 $(ARCH_DIR)/os-$(OS)/
....@@ -75,7 +73,7 @@
7573 USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \
7674 $(ARCH_INCLUDE) $(MODE_INCLUDE) $(filter -I%,$(CFLAGS)) \
7775 -D_FILE_OFFSET_BITS=64 -idirafter $(srctree)/include \
78
- -idirafter $(obj)/include -D__KERNEL__ -D__UM_HOST__
76
+ -idirafter $(objtree)/include -D__KERNEL__ -D__UM_HOST__
7977
8078 #This will adjust *FLAGS accordingly to the platform.
8179 include $(ARCH_DIR)/Makefile-os-$(OS)
....@@ -116,14 +114,14 @@
116114 archheaders:
117115 $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) asm-generic archheaders
118116
119
-archprepare: include/generated/user_constants.h
117
+archprepare:
118
+ $(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h
120119
121120 LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
122121 LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib $(call cc-option, -no-pie)
123122
124123 CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \
125
- $(call cc-option, -fno-stack-protector,) \
126
- $(call cc-option, -fno-stack-protector-all,)
124
+ -fno-stack-protector $(call cc-option, -fno-stack-protector-all)
127125
128126 # Options used by linker script
129127 export LDS_START := $(START)
....@@ -133,38 +131,26 @@
133131 # The wrappers will select whether using "malloc" or the kernel allocator.
134132 LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
135133
134
+# Avoid binutils 2.39+ warnings by marking the stack non-executable and
135
+# ignorning warnings for the kallsyms sections.
136
+LDFLAGS_EXECSTACK = -z noexecstack
137
+ifeq ($(CONFIG_LD_IS_BFD),y)
138
+LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments)
139
+endif
140
+
136141 LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt))
137142
138143 # Used by link-vmlinux.sh which has special support for um link
139144 export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
145
+export LDFLAGS_vmlinux := $(LDFLAGS_EXECSTACK)
140146
141147 # When cleaning we don't include .config, so we don't include
142148 # TT or skas makefiles and don't clean skas_ptregs.h.
143149 CLEAN_FILES += linux x.i gmon.out
150
+MRPROPER_FILES += $(HOST_DIR)/include/generated
144151
145152 archclean:
146153 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
147154 -o -name '*.gcov' \) -type f -print | xargs rm -f
148
-
149
-# Generated files
150
-
151
-$(HOST_DIR)/um/user-offsets.s: __headers FORCE
152
- $(Q)$(MAKE) $(build)=$(HOST_DIR)/um $@
153
-
154
-define filechk_gen-asm-offsets
155
- (set -e; \
156
- echo "/*"; \
157
- echo " * DO NOT MODIFY."; \
158
- echo " *"; \
159
- echo " * This file was generated by arch/$(ARCH)/Makefile"; \
160
- echo " *"; \
161
- echo " */"; \
162
- echo ""; \
163
- sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" < $<; \
164
- echo ""; )
165
-endef
166
-
167
-include/generated/user_constants.h: $(HOST_DIR)/um/user-offsets.s
168
- $(call filechk,gen-asm-offsets)
169155
170156 export HEADER_ARCH SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH