aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.build
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-12-28 18:13:48 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-12-28 18:13:48 -0500
commit96faec945f39cab38403f60f515bff43660b4dab (patch)
treee6681330a42303bb34be80d347cd01ff79f5b80a /scripts/Makefile.build
parent2926328554fa740518e2a6585b2cefb01e5f65f3 (diff)
parent9bb482476c6c9d1ae033306440c51ceac93ea80c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next: (25 commits) allow stripping of generated symbols under CONFIG_KALLSYMS_ALL kbuild: strip generated symbols from *.ko kbuild: simplify use of genksyms kernel-doc: check for extra kernel-doc notations kbuild: add headerdep used to detect inclusion cycles in header files kbuild: fix string equality testing in tags.sh kbuild: fix make tags/cscope kbuild: fix make incompatibility kbuild: remove TAR_IGNORE setlocalversion: add git-svn support setlocalversion: print correct subversion revision scripts: improve the decodecode script scripts/package: allow custom options to rpm genksyms: allow to ignore symbol checksum changes genksyms: track symbol checksum changes tags and cscope support really belongs in a shell script kconfig: fix options to check-lxdialog.sh kbuild: gen_init_cpio expands shell variables in file names remove bashisms from scripts/extract-ikconfig kbuild: teach mkmakfile to be silent ...
Diffstat (limited to 'scripts/Makefile.build')
-rw-r--r--scripts/Makefile.build67
1 files changed, 43 insertions, 24 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 7a176773af85..5d900307de3e 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -151,14 +151,20 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
151$(obj)/%.i: $(src)/%.c FORCE 151$(obj)/%.i: $(src)/%.c FORCE
152 $(call if_changed_dep,cc_i_c) 152 $(call if_changed_dep,cc_i_c)
153 153
154cmd_genksyms = \
155 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
156 $(GENKSYMS) -T $@ -A -a $(ARCH) \
157 $(if $(KBUILD_PRESERVE),-p) \
158 $(if $(1),-r $(firstword $(wildcard $(@:.symtypes=.symref) /dev/null)))
159
154quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ 160quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
155cmd_cc_symtypes_c = \ 161cmd_cc_symtypes_c = \
156 $(CPP) -D__GENKSYMS__ $(c_flags) $< \ 162 set -e; \
157 | $(GENKSYMS) -T $@ >/dev/null; \ 163 $(call cmd_genksyms, true) >/dev/null; \
158 test -s $@ || rm -f $@ 164 test -s $@ || rm -f $@
159 165
160$(obj)/%.symtypes : $(src)/%.c FORCE 166$(obj)/%.symtypes : $(src)/%.c FORCE
161 $(call if_changed_dep,cc_symtypes_c) 167 $(call cmd,cc_symtypes_c)
162 168
163# C (.c) files 169# C (.c) files
164# The C file is compiled and updated dependency information is generated. 170# The C file is compiled and updated dependency information is generated.
@@ -171,30 +177,38 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
171 177
172else 178else
173# When module versioning is enabled the following steps are executed: 179# When module versioning is enabled the following steps are executed:
174# o compile a .tmp_<file>.o from <file>.c 180# o compile a .tmp_<file>.s from <file>.c
175# o if .tmp_<file>.o doesn't contain a __ksymtab version, i.e. does 181# o if .tmp_<file>.s doesn't contain a __ksymtab version, i.e. does
176# not export symbols, we just rename .tmp_<file>.o to <file>.o and 182# not export symbols, we just assemble .tmp_<file>.s to <file>.o and
177# are done. 183# are done.
178# o otherwise, we calculate symbol versions using the good old 184# o otherwise, we calculate symbol versions using the good old
179# genksyms on the preprocessed source and postprocess them in a way 185# genksyms on the preprocessed source and postprocess them in a way
180# that they are usable as a linker script 186# that they are usable as assembly source
181# o generate <file>.o from .tmp_<file>.o using the linker to 187# o assemble <file>.o from .tmp_<file>.s forcing inclusion of directives
182# replace the unresolved symbols __crc_exported_symbol with 188# defining the actual values of __crc_*, followed by objcopy-ing them
183# the actual value of the checksum generated by genksyms 189# to force these symbols to be local to permit stripping them later.
190s_file = $(@D)/.tmp_$(@F:.o=.s)
191v_file = $(@D)/.tmp_$(@F:.o=.v)
192tmp_o_file = $(@D)/.tmp_$(@F)
193no_g_c_flags = $(filter-out -g%,$(c_flags))
194
195cmd_cc_o_c = $(CC) $(c_flags) -S -o $(s_file) $<
184 196
185cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $<
186cmd_modversions = \ 197cmd_modversions = \
187 if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ 198 if grep -q __ksymtab $(s_file); then \
188 $(CPP) -D__GENKSYMS__ $(c_flags) $< \ 199 if $(call cmd_genksyms, $(KBUILD_SYMTYPES)) > $(v_file) \
189 | $(GENKSYMS) $(if $(KBUILD_SYMTYPES), \ 200 && $(CC) $(no_g_c_flags) -c -Wa,$(v_file) \
190 -T $(@D)/$(@F:.o=.symtypes)) -a $(ARCH) \ 201 -o $(tmp_o_file) $(s_file) \
191 > $(@D)/.tmp_$(@F:.o=.ver); \ 202 && $(OBJCOPY) -L '__crc_*' -L '___crc_*' -w \
192 \ 203 $(tmp_o_file) $@; \
193 $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ 204 then \
194 -T $(@D)/.tmp_$(@F:.o=.ver); \ 205 : ; \
195 rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ 206 else \
207 rm -f $@; exit 1; \
208 fi; \
196 else \ 209 else \
197 mv -f $(@D)/.tmp_$(@F) $@; \ 210 rm -f $(v_file); \
211 $(CC) $(no_g_c_flags) -c -o $@ $(s_file); \
198 fi; 212 fi;
199endif 213endif
200 214
@@ -211,7 +225,12 @@ define rule_cc_o_c
211 $(cmd_record_mcount) \ 225 $(cmd_record_mcount) \
212 scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ 226 scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \
213 $(dot-target).tmp; \ 227 $(dot-target).tmp; \
214 rm -f $(depfile); \ 228 if [ -r $(@D)/.tmp_$(@F:.o=.v) ]; then \
229 echo >> $(dot-target).tmp; \
230 echo '$@: $(GENKSYMS)' >> $(dot-target).tmp; \
231 echo '$(GENKSYMS):: ;' >> $(dot-target).tmp; \
232 fi; \
233 rm -f $(depfile) $(@D)/.tmp_$(@F:.o=.?); \
215 mv -f $(dot-target).tmp $(dot-target).cmd 234 mv -f $(dot-target).tmp $(dot-target).cmd
216endef 235endef
217 236