.. | .. |
---|
23 | 23 | # features. |
---|
24 | 24 | SHELL := /bin/bash |
---|
25 | 25 | |
---|
26 | | -filechk_gen_header = $< |
---|
27 | | - |
---|
28 | 26 | core-y += $(ARCH_DIR)/kernel/ \ |
---|
29 | 27 | $(ARCH_DIR)/drivers/ \ |
---|
30 | 28 | $(ARCH_DIR)/os-$(OS)/ |
---|
.. | .. |
---|
75 | 73 | USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \ |
---|
76 | 74 | $(ARCH_INCLUDE) $(MODE_INCLUDE) $(filter -I%,$(CFLAGS)) \ |
---|
77 | 75 | -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__ |
---|
79 | 77 | |
---|
80 | 78 | #This will adjust *FLAGS accordingly to the platform. |
---|
81 | 79 | include $(ARCH_DIR)/Makefile-os-$(OS) |
---|
.. | .. |
---|
116 | 114 | archheaders: |
---|
117 | 115 | $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(HEADER_ARCH) asm-generic archheaders |
---|
118 | 116 | |
---|
119 | | -archprepare: include/generated/user_constants.h |
---|
| 117 | +archprepare: |
---|
| 118 | + $(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h |
---|
120 | 119 | |
---|
121 | 120 | LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static |
---|
122 | 121 | LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib $(call cc-option, -no-pie) |
---|
123 | 122 | |
---|
124 | 123 | 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) |
---|
127 | 125 | |
---|
128 | 126 | # Options used by linker script |
---|
129 | 127 | export LDS_START := $(START) |
---|
.. | .. |
---|
133 | 131 | # The wrappers will select whether using "malloc" or the kernel allocator. |
---|
134 | 132 | LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc |
---|
135 | 133 | |
---|
| 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 | + |
---|
136 | 141 | LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt)) |
---|
137 | 142 | |
---|
138 | 143 | # Used by link-vmlinux.sh which has special support for um link |
---|
139 | 144 | export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) |
---|
| 145 | +export LDFLAGS_vmlinux := $(LDFLAGS_EXECSTACK) |
---|
140 | 146 | |
---|
141 | 147 | # When cleaning we don't include .config, so we don't include |
---|
142 | 148 | # TT or skas makefiles and don't clean skas_ptregs.h. |
---|
143 | 149 | CLEAN_FILES += linux x.i gmon.out |
---|
| 150 | +MRPROPER_FILES += $(HOST_DIR)/include/generated |
---|
144 | 151 | |
---|
145 | 152 | archclean: |
---|
146 | 153 | @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ |
---|
147 | 154 | -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) |
---|
169 | 155 | |
---|
170 | 156 | export HEADER_ARCH SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH |
---|