Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes

* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes:
  kbuild, modpost: Check the section flags, to catch missing "ax"/"aw"
  kbuild: fix comment in modpost.c
  kbuild: fix scripts/setlocalversion with git
  kbuild: fix Module.markers permission error under cygwin
  docs: also clean index.html
  kbuild: remove a tag file before it is regenerated
  kbuild: "make prepare" should be "make modules_prepare"
  kbuild: clean Module.markers and modules.order for out-of-tree modules
  avr32: drop unused CLEAN_FILES
This commit is contained in:
Linus Torvalds 2009-05-02 16:33:56 -07:00
commit 414772fa49
6 changed files with 34 additions and 45 deletions

View File

@ -143,7 +143,8 @@ quiet_cmd_db2pdf = PDF $@
$(call cmd,db2pdf)
main_idx = Documentation/DocBook/index.html
index = index.html
main_idx = Documentation/DocBook/$(index)
build_main_index = rm -rf $(main_idx) && \
echo '<h1>Linux Kernel HTML Documentation</h1>' >> $(main_idx) && \
echo '<h2>Kernel Version: $(KERNELVERSION)</h2>' >> $(main_idx) && \
@ -232,7 +233,7 @@ clean-files := $(DOCBOOKS) \
$(patsubst %.xml, %.pdf, $(DOCBOOKS)) \
$(patsubst %.xml, %.html, $(DOCBOOKS)) \
$(patsubst %.xml, %.9, $(DOCBOOKS)) \
$(C-procfs-example)
$(C-procfs-example) $(index)
clean-dirs := $(patsubst %.xml,%,$(DOCBOOKS)) man

View File

@ -1293,7 +1293,7 @@ help:
@echo ' dir/ - Build all files in dir and below'
@echo ' dir/file.[ois] - Build specified target only'
@echo ' dir/file.ko - Build module including final link'
@echo ' prepare - Set up for building external modules'
@echo ' modules_prepare - Set up for building external modules'
@echo ' tags/TAGS - Generate tags file for editors'
@echo ' cscope - Generate cscope index'
@echo ' kernelrelease - Output the release version string'
@ -1421,7 +1421,9 @@ $(clean-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
clean: rm-dirs := $(MODVERDIR)
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers \
$(KBUILD_EXTMOD)/Module.markers \
$(KBUILD_EXTMOD)/modules.order
clean: $(clean-dirs)
$(call cmd,rmdirs)
$(call cmd,rmfiles)

View File

@ -43,8 +43,6 @@ core-y += arch/avr32/mm/
drivers-$(CONFIG_OPROFILE) += arch/avr32/oprofile/
libs-y += arch/avr32/lib/
CLEAN_FILES += include/asm-avr32/.arch include/asm-avr32/arch
BOOT_TARGETS := vmlinux.elf vmlinux.bin uImage uImage.srec
.PHONY: $(BOOT_TARGETS) install

View File

@ -716,41 +716,27 @@ int match(const char *sym, const char * const pat[])
/* sections that we do not want to do full section mismatch check on */
static const char *section_white_list[] =
{ ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
{ ".comment", ".debug*", ".stab*", ".note*", ".got*", ".toc*", NULL };
/*
* Is this section one we do not want to check?
* This is often debug sections.
* If we are going to check this section then
* test if section name ends with a dot and a number.
* This is used to find sections where the linker have
* appended a dot-number to make the name unique.
* This is used to find sections missing the SHF_ALLOC flag.
* The cause of this is often a section specified in assembler
* without "ax" / "aw" and the same section used in .c
* code where gcc add these.
* without "ax" / "aw".
*/
static int check_section(const char *modname, const char *sec)
static void check_section(const char *modname, struct elf_info *elf,
Elf_Shdr *sechdr)
{
const char *e = sec + strlen(sec) - 1;
if (match(sec, section_white_list))
return 1;
const char *sec = sech_name(elf, sechdr);
if (*e && isdigit(*e)) {
/* consume all digits */
while (*e && e != sec && isdigit(*e))
e--;
if (*e == '.' && !strstr(sec, ".linkonce")) {
warn("%s (%s): unexpected section name.\n"
"The (.[number]+) following section name are "
"ld generated and not expected.\n"
"Did you forget to use \"ax\"/\"aw\" "
"in a .S file?\n"
"Note that for example <linux/init.h> contains\n"
"section definitions for use in .S files.\n\n",
modname, sec);
}
if (sechdr->sh_type == SHT_PROGBITS &&
!(sechdr->sh_flags & SHF_ALLOC) &&
!match(sec, section_white_list)) {
warn("%s (%s): unexpected non-allocatable section.\n"
"Did you forget to use \"ax\"/\"aw\" in a .S file?\n"
"Note that for example <linux/init.h> contains\n"
"section definitions for use in .S files.\n\n",
modname, sec);
}
return 0;
}
@ -928,8 +914,7 @@ static int section_mismatch(const char *fromsec, const char *tosec)
* *probe_one, *_console, *_timer
*
* Pattern 3:
* Whitelist all refereces from .text.head to .init.data
* Whitelist all refereces from .text.head to .init.text
* Whitelist all references from .head.text to any init section
*
* Pattern 4:
* Some symbols belong to init section but still it is ok to reference
@ -1359,7 +1344,7 @@ static void section_rela(const char *modname, struct elf_info *elf,
fromsec = sech_name(elf, sechdr);
fromsec += strlen(".rela");
/* if from section (name) is know good then skip it */
if (check_section(modname, fromsec))
if (match(fromsec, section_white_list))
return;
for (rela = start; rela < stop; rela++) {
@ -1403,7 +1388,7 @@ static void section_rel(const char *modname, struct elf_info *elf,
fromsec = sech_name(elf, sechdr);
fromsec += strlen(".rel");
/* if from section (name) is know good then skip it */
if (check_section(modname, fromsec))
if (match(fromsec, section_white_list))
return;
for (rel = start; rel < stop; rel++) {
@ -1466,6 +1451,7 @@ static void check_sec_ref(struct module *mod, const char *modname,
/* Walk through all sections */
for (i = 0; i < elf->hdr->e_shnum; i++) {
check_section(modname, elf, &elf->sechdrs[i]);
/* We want to process only relocation sections and not .init */
if (sechdrs[i].sh_type == SHT_RELA)
section_rela(modname, elf, &elf->sechdrs[i]);
@ -1990,6 +1976,7 @@ static void read_markers(const char *fname)
if (!mod->skip)
add_marker(mod, marker, fmt);
}
release_file(file, size);
return;
fail:
fatal("parse error in markers list file\n");

View File

@ -10,13 +10,12 @@ cd "${1:-.}" || usage
# Check for git and a git repo.
if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
# Do we have an untagged version?
if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
if tag=`git describe 2>/dev/null`; then
echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
else
printf '%s%s' -g $head
fi
# Do we have an untagged tag?
if atag=`git describe 2>/dev/null`; then
echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
# add -g${head}, if there is no usable tag
else
printf '%s%s' -g $head
fi
# Is this git on svn?

View File

@ -164,10 +164,12 @@ case "$1" in
;;
"tags")
rm -f tags
xtags ctags
;;
"TAGS")
rm -f TAGS
xtags etags
;;
esac