diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-05 17:10:07 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-05 17:10:07 -0400 |
| commit | da9e82b3b8989fc09e2a4c45b9da604ba2b4c46d (patch) | |
| tree | 7355d2afe95be27fddb8fa4baa46476c76aeb8ee /scripts | |
| parent | 90d3417a3a4e810d67081dd106f0e603a856978f (diff) | |
| parent | 772320e84588dcbe1600ffb83e5f328f2209ac2a (diff) | |
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
modpost: support objects with more than 64k sections
trivial: fix a typo in a filename
frv: clean up arch/frv/Makefile
kbuild: allow assignment to {A,C}FLAGS_KERNEL on the command line
kbuild: allow assignment to {A,C,LD}FLAGS_MODULE on the command line
Kbuild: Add option to set -femit-struct-debug-baseonly
Makefile: "make kernelrelease" should show the correct full kernel version
Makefile.build: make KBUILD_SYMTYPES work again
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Makefile.build | 37 | ||||
| -rw-r--r-- | scripts/Makefile.modpost | 9 | ||||
| -rw-r--r-- | scripts/mod/file2alias.c | 6 | ||||
| -rw-r--r-- | scripts/mod/modpost.c | 102 | ||||
| -rw-r--r-- | scripts/mod/modpost.h | 43 |
5 files changed, 147 insertions, 50 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index e4deb73e9a8..a1a5cf95a68 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -115,7 +115,10 @@ endif | |||
| 115 | # --------------------------------------------------------------------------- | 115 | # --------------------------------------------------------------------------- |
| 116 | 116 | ||
| 117 | # Default is built-in, unless we know otherwise | 117 | # Default is built-in, unless we know otherwise |
| 118 | modkern_cflags = $(if $(part-of-module), $(CFLAGS_MODULE), $(CFLAGS_KERNEL)) | 118 | modkern_cflags = \ |
| 119 | $(if $(part-of-module), \ | ||
| 120 | $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \ | ||
| 121 | $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) | ||
| 119 | quiet_modtag := $(empty) $(empty) | 122 | quiet_modtag := $(empty) $(empty) |
| 120 | 123 | ||
| 121 | $(real-objs-m) : part-of-module := y | 124 | $(real-objs-m) : part-of-module := y |
| @@ -156,14 +159,14 @@ $(obj)/%.i: $(src)/%.c FORCE | |||
| 156 | 159 | ||
| 157 | cmd_gensymtypes = \ | 160 | cmd_gensymtypes = \ |
| 158 | $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ | 161 | $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ |
| 159 | $(GENKSYMS) -T $@ -a $(ARCH) \ | 162 | $(GENKSYMS) $(if $(1), -T $(2)) -a $(ARCH) \ |
| 160 | $(if $(KBUILD_PRESERVE),-p) \ | 163 | $(if $(KBUILD_PRESERVE),-p) \ |
| 161 | $(if $(1),-r $(firstword $(wildcard $(@:.symtypes=.symref) /dev/null))) | 164 | -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) |
| 162 | 165 | ||
| 163 | quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ | 166 | quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ |
| 164 | cmd_cc_symtypes_c = \ | 167 | cmd_cc_symtypes_c = \ |
| 165 | set -e; \ | 168 | set -e; \ |
| 166 | $(call cmd_gensymtypes, true) >/dev/null; \ | 169 | $(call cmd_gensymtypes,true,$@) >/dev/null; \ |
| 167 | test -s $@ || rm -f $@ | 170 | test -s $@ || rm -f $@ |
| 168 | 171 | ||
| 169 | $(obj)/%.symtypes : $(src)/%.c FORCE | 172 | $(obj)/%.symtypes : $(src)/%.c FORCE |
| @@ -192,16 +195,16 @@ else | |||
| 192 | # the actual value of the checksum generated by genksyms | 195 | # the actual value of the checksum generated by genksyms |
| 193 | 196 | ||
| 194 | cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< | 197 | cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< |
| 195 | cmd_modversions = \ | 198 | cmd_modversions = \ |
| 196 | if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ | 199 | if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ |
| 197 | $(call cmd_gensymtypes, $(KBUILD_SYMTYPES)) \ | 200 | $(call cmd_gensymtypes,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ |
| 198 | > $(@D)/.tmp_$(@F:.o=.ver); \ | 201 | > $(@D)/.tmp_$(@F:.o=.ver); \ |
| 199 | \ | 202 | \ |
| 200 | $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ | 203 | $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ |
| 201 | -T $(@D)/.tmp_$(@F:.o=.ver); \ | 204 | -T $(@D)/.tmp_$(@F:.o=.ver); \ |
| 202 | rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ | 205 | rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ |
| 203 | else \ | 206 | else \ |
| 204 | mv -f $(@D)/.tmp_$(@F) $@; \ | 207 | mv -f $(@D)/.tmp_$(@F) $@; \ |
| 205 | fi; | 208 | fi; |
| 206 | endif | 209 | endif |
| 207 | 210 | ||
| @@ -248,10 +251,10 @@ $(obj)/%.lst: $(src)/%.c FORCE | |||
| 248 | # Compile assembler sources (.S) | 251 | # Compile assembler sources (.S) |
| 249 | # --------------------------------------------------------------------------- | 252 | # --------------------------------------------------------------------------- |
| 250 | 253 | ||
| 251 | modkern_aflags := $(AFLAGS_KERNEL) | 254 | modkern_aflags := $(KBUILD_AFLAGS_KERNEL) $(AFLAGS_KERNEL) |
| 252 | 255 | ||
| 253 | $(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE) | 256 | $(real-objs-m) : modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE) |
| 254 | $(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE) | 257 | $(real-objs-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE) |
| 255 | 258 | ||
| 256 | quiet_cmd_as_s_S = CPP $(quiet_modtag) $@ | 259 | quiet_cmd_as_s_S = CPP $(quiet_modtag) $@ |
| 257 | cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< | 260 | cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< |
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 8f14c81abbc..7d22056582c 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | # - See include/linux/module.h for more details | 30 | # - See include/linux/module.h for more details |
| 31 | 31 | ||
| 32 | # Step 4 is solely used to allow module versioning in external modules, | 32 | # Step 4 is solely used to allow module versioning in external modules, |
| 33 | # where the CRC of each module is retrieved from the Module.symers file. | 33 | # where the CRC of each module is retrieved from the Module.symvers file. |
| 34 | 34 | ||
| 35 | # KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined | 35 | # KBUILD_MODPOST_WARN can be set to avoid error out in case of undefined |
| 36 | # symbols in the final module linking stage | 36 | # symbols in the final module linking stage |
| @@ -107,7 +107,7 @@ $(modules:.ko=.mod.c): __modpost ; | |||
| 107 | modname = $(notdir $(@:.mod.o=)) | 107 | modname = $(notdir $(@:.mod.o=)) |
| 108 | 108 | ||
| 109 | quiet_cmd_cc_o_c = CC $@ | 109 | quiet_cmd_cc_o_c = CC $@ |
| 110 | cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \ | 110 | cmd_cc_o_c = $(CC) $(c_flags) $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE) \ |
| 111 | -c -o $@ $< | 111 | -c -o $@ $< |
| 112 | 112 | ||
| 113 | $(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE | 113 | $(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE |
| @@ -117,8 +117,9 @@ targets += $(modules:.ko=.mod.o) | |||
| 117 | 117 | ||
| 118 | # Step 6), final link of the modules | 118 | # Step 6), final link of the modules |
| 119 | quiet_cmd_ld_ko_o = LD [M] $@ | 119 | quiet_cmd_ld_ko_o = LD [M] $@ |
| 120 | cmd_ld_ko_o = $(LD) -r $(LDFLAGS) $(LDFLAGS_MODULE) -o $@ \ | 120 | cmd_ld_ko_o = $(LD) -r $(LDFLAGS) \ |
| 121 | $(filter-out FORCE,$^) | 121 | $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ |
| 122 | -o $@ $(filter-out FORCE,$^) | ||
| 122 | 123 | ||
| 123 | $(modules): %.ko :%.o %.mod.o FORCE | 124 | $(modules): %.ko :%.o %.mod.o FORCE |
| 124 | $(call if_changed,ld_ko_o) | 125 | $(call if_changed,ld_ko_o) |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 5758aab0d8b..88f3f07205f 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -884,16 +884,16 @@ void handle_moddevtable(struct module *mod, struct elf_info *info, | |||
| 884 | char *zeros = NULL; | 884 | char *zeros = NULL; |
| 885 | 885 | ||
| 886 | /* We're looking for a section relative symbol */ | 886 | /* We're looking for a section relative symbol */ |
| 887 | if (!sym->st_shndx || sym->st_shndx >= info->hdr->e_shnum) | 887 | if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections) |
| 888 | return; | 888 | return; |
| 889 | 889 | ||
| 890 | /* Handle all-NULL symbols allocated into .bss */ | 890 | /* Handle all-NULL symbols allocated into .bss */ |
| 891 | if (info->sechdrs[sym->st_shndx].sh_type & SHT_NOBITS) { | 891 | if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) { |
| 892 | zeros = calloc(1, sym->st_size); | 892 | zeros = calloc(1, sym->st_size); |
| 893 | symval = zeros; | 893 | symval = zeros; |
| 894 | } else { | 894 | } else { |
| 895 | symval = (void *)info->hdr | 895 | symval = (void *)info->hdr |
| 896 | + info->sechdrs[sym->st_shndx].sh_offset | 896 | + info->sechdrs[get_secindex(info, sym)].sh_offset |
| 897 | + sym->st_value; | 897 | + sym->st_value; |
| 898 | } | 898 | } |
| 899 | 899 | ||
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index f6127b9f5ac..c827309c29c 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
| @@ -253,7 +253,7 @@ static enum export export_no(const char *s) | |||
| 253 | return export_unknown; | 253 | return export_unknown; |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | static enum export export_from_sec(struct elf_info *elf, Elf_Section sec) | 256 | static enum export export_from_sec(struct elf_info *elf, unsigned int sec) |
| 257 | { | 257 | { |
| 258 | if (sec == elf->export_sec) | 258 | if (sec == elf->export_sec) |
| 259 | return export_plain; | 259 | return export_plain; |
| @@ -373,6 +373,8 @@ static int parse_elf(struct elf_info *info, const char *filename) | |||
| 373 | Elf_Ehdr *hdr; | 373 | Elf_Ehdr *hdr; |
| 374 | Elf_Shdr *sechdrs; | 374 | Elf_Shdr *sechdrs; |
| 375 | Elf_Sym *sym; | 375 | Elf_Sym *sym; |
| 376 | const char *secstrings; | ||
| 377 | unsigned int symtab_idx = ~0U, symtab_shndx_idx = ~0U; | ||
| 376 | 378 | ||
| 377 | hdr = grab_file(filename, &info->size); | 379 | hdr = grab_file(filename, &info->size); |
| 378 | if (!hdr) { | 380 | if (!hdr) { |
| @@ -417,8 +419,27 @@ static int parse_elf(struct elf_info *info, const char *filename) | |||
| 417 | return 0; | 419 | return 0; |
| 418 | } | 420 | } |
| 419 | 421 | ||
| 422 | if (hdr->e_shnum == 0) { | ||
| 423 | /* | ||
| 424 | * There are more than 64k sections, | ||
| 425 | * read count from .sh_size. | ||
| 426 | * note: it doesn't need shndx2secindex() | ||
| 427 | */ | ||
| 428 | info->num_sections = TO_NATIVE(sechdrs[0].sh_size); | ||
| 429 | } | ||
| 430 | else { | ||
| 431 | info->num_sections = hdr->e_shnum; | ||
| 432 | } | ||
| 433 | if (hdr->e_shstrndx == SHN_XINDEX) { | ||
| 434 | info->secindex_strings = | ||
| 435 | shndx2secindex(TO_NATIVE(sechdrs[0].sh_link)); | ||
| 436 | } | ||
| 437 | else { | ||
| 438 | info->secindex_strings = hdr->e_shstrndx; | ||
