diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-21 21:41:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-21 21:41:17 -0400 |
commit | efa5bf1dd2cf3cdee0bfe97cfd76ff2296179ae4 (patch) | |
tree | 3e23385d3fa54c86689dcae49b60d47065d08a4e /scripts/mod/modpost.c | |
parent | d6f2fe98ebc2dd8f3e9926673e0d8acd2c764e71 (diff) |
Revert "kbuild: make better section mismatch reports on i386, arm and mips"
This reverts commit f892b7d480eec809a5dfbd6e65742b3f3155e50e, which
totally broke the build on x86 with CONFIG_RELOCATABLE (which, as far as
I can tell, is the only case where it should even matter!) due to a
SIGSEGV in modpost.
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r-- | scripts/mod/modpost.c | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 8424d1f53bbe..8e5610d428c5 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -384,7 +384,6 @@ static int parse_elf(struct elf_info *info, const char *filename) | |||
384 | sechdrs[i].sh_size = TO_NATIVE(sechdrs[i].sh_size); | 384 | sechdrs[i].sh_size = TO_NATIVE(sechdrs[i].sh_size); |
385 | sechdrs[i].sh_link = TO_NATIVE(sechdrs[i].sh_link); | 385 | sechdrs[i].sh_link = TO_NATIVE(sechdrs[i].sh_link); |
386 | sechdrs[i].sh_name = TO_NATIVE(sechdrs[i].sh_name); | 386 | sechdrs[i].sh_name = TO_NATIVE(sechdrs[i].sh_name); |
387 | sechdrs[i].sh_info = TO_NATIVE(sechdrs[i].sh_info); | ||
388 | } | 387 | } |
389 | /* Find symbol table. */ | 388 | /* Find symbol table. */ |
390 | for (i = 1; i < hdr->e_shnum; i++) { | 389 | for (i = 1; i < hdr->e_shnum; i++) { |
@@ -754,8 +753,6 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf_Addr addr, | |||
754 | for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { | 753 | for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { |
755 | if (sym->st_shndx != relsym->st_shndx) | 754 | if (sym->st_shndx != relsym->st_shndx) |
756 | continue; | 755 | continue; |
757 | if (ELF_ST_TYPE(sym->st_info) == STT_SECTION) | ||
758 | continue; | ||
759 | if (sym->st_value == addr) | 756 | if (sym->st_value == addr) |
760 | return sym; | 757 | return sym; |
761 | } | 758 | } |
@@ -898,68 +895,6 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec, | |||
898 | } | 895 | } |
899 | } | 896 | } |
900 | 897 | ||
901 | static void addend_386_rel(struct elf_info *elf, int section, Elf_Rela *r) | ||
902 | { | ||
903 | Elf_Shdr *sechdrs = elf->sechdrs; | ||
904 | unsigned int r_typ; | ||
905 | unsigned int *location; | ||
906 | |||
907 | r_typ = ELF_R_TYPE(r->r_info); | ||
908 | location = (void *)elf->hdr + | ||
909 | sechdrs[sechdrs[section].sh_info].sh_offset + r->r_offset; | ||
910 | switch (r_typ) { | ||
911 | case R_386_32: | ||
912 | r->r_addend = TO_NATIVE(*location); | ||
913 | break; | ||
914 | case R_386_PC32: | ||
915 | r->r_addend = TO_NATIVE(*location) + 4; | ||
916 | break; | ||
917 | } | ||
918 | } | ||
919 | |||
920 | static void addend_arm_rel(struct elf_info *elf, int section, Elf_Rela *r) | ||
921 | { | ||
922 | Elf_Shdr *sechdrs = elf->sechdrs; | ||
923 | unsigned int r_typ; | ||
924 | unsigned int *location; | ||
925 | |||
926 | r_typ = ELF_R_TYPE(r->r_info); | ||
927 | location = (void *)elf->hdr + | ||
928 | sechdrs[sechdrs[section].sh_info].sh_offset + r->r_offset; | ||
929 | switch (r_typ) { | ||
930 | case R_ARM_ABS32: | ||
931 | r->r_addend = TO_NATIVE(*location); | ||
932 | break; | ||
933 | case R_ARM_PC24: | ||
934 | r->r_addend = ((TO_NATIVE(*location) & 0x00ffffff) << 2) + 8; | ||
935 | break; | ||
936 | } | ||
937 | } | ||
938 | |||
939 | static int addend_mips_rel(struct elf_info *elf, int section, Elf_Rela *r) | ||
940 | { | ||
941 | Elf_Shdr *sechdrs = elf->sechdrs; | ||
942 | unsigned int r_typ; | ||
943 | unsigned int *location; | ||
944 | unsigned int inst; | ||
945 | |||
946 | r_typ = ELF_R_TYPE(r->r_info); | ||
947 | if (r_typ == R_MIPS_HI16) | ||
948 | return 1; /* skip this */ | ||
949 | location = (void *)elf->hdr + | ||
950 | sechdrs[sechdrs[section].sh_info].sh_offset + r->r_offset; | ||
951 | inst = TO_NATIVE(*location); | ||
952 | switch (r_typ) { | ||
953 | case R_MIPS_LO16: | ||
954 | r->r_addend = ((inst & 0xffff) ^ 0x8000) - 0x8000; | ||
955 | break; | ||
956 | case R_MIPS_26: | ||
957 | r->r_addend = (inst & 0x03ffffff) << 2; | ||
958 | break; | ||
959 | } | ||
960 | return 0; | ||
961 | } | ||
962 | |||
963 | /** | 898 | /** |
964 | * A module includes a number of sections that are discarded | 899 | * A module includes a number of sections that are discarded |
965 | * either when loaded or when used as built-in. | 900 | * either when loaded or when used as built-in. |
@@ -1003,11 +938,8 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
1003 | r.r_offset = TO_NATIVE(rela->r_offset); | 938 | r.r_offset = TO_NATIVE(rela->r_offset); |
1004 | #if KERNEL_ELFCLASS == ELFCLASS64 | 939 | #if KERNEL_ELFCLASS == ELFCLASS64 |
1005 | if (hdr->e_machine == EM_MIPS) { | 940 | if (hdr->e_machine == EM_MIPS) { |
1006 | unsigned int r_typ; | ||
1007 | r_sym = ELF64_MIPS_R_SYM(rela->r_info); | 941 | r_sym = ELF64_MIPS_R_SYM(rela->r_info); |
1008 | r_sym = TO_NATIVE(r_sym); | 942 | r_sym = TO_NATIVE(r_sym); |
1009 | r_typ = ELF64_MIPS_R_TYPE(rela->r_info); | ||
1010 | r.r_info = ELF64_R_INFO(r_sym, r_typ); | ||
1011 | } else { | 943 | } else { |
1012 | r.r_info = TO_NATIVE(rela->r_info); | 944 | r.r_info = TO_NATIVE(rela->r_info); |
1013 | r_sym = ELF_R_SYM(r.r_info); | 945 | r_sym = ELF_R_SYM(r.r_info); |
@@ -1040,11 +972,8 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
1040 | r.r_offset = TO_NATIVE(rel->r_offset); | 972 | r.r_offset = TO_NATIVE(rel->r_offset); |
1041 | #if KERNEL_ELFCLASS == ELFCLASS64 | 973 | #if KERNEL_ELFCLASS == ELFCLASS64 |
1042 | if (hdr->e_machine == EM_MIPS) { | 974 | if (hdr->e_machine == EM_MIPS) { |
1043 | unsigned int r_typ; | ||
1044 | r_sym = ELF64_MIPS_R_SYM(rel->r_info); | 975 | r_sym = ELF64_MIPS_R_SYM(rel->r_info); |
1045 | r_sym = TO_NATIVE(r_sym); | 976 | r_sym = TO_NATIVE(r_sym); |
1046 | r_typ = ELF64_MIPS_R_TYPE(rel->r_info); | ||
1047 | r.r_info = ELF64_R_INFO(r_sym, r_typ); | ||
1048 | } else { | 977 | } else { |
1049 | r.r_info = TO_NATIVE(rel->r_info); | 978 | r.r_info = TO_NATIVE(rel->r_info); |
1050 | r_sym = ELF_R_SYM(r.r_info); | 979 | r_sym = ELF_R_SYM(r.r_info); |
@@ -1054,14 +983,6 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
1054 | r_sym = ELF_R_SYM(r.r_info); | 983 | r_sym = ELF_R_SYM(r.r_info); |
1055 | #endif | 984 | #endif |
1056 | r.r_addend = 0; | 985 | r.r_addend = 0; |
1057 | if (hdr->e_machine == EM_386) | ||
1058 | addend_386_rel(elf, i, &r); | ||
1059 | else if (hdr->e_machine == EM_ARM) | ||
1060 | addend_arm_rel(elf, i, &r); | ||
1061 | else if (hdr->e_machine == EM_MIPS) { | ||
1062 | if (addend_mips_rel(elf, i, &r)) | ||
1063 | continue; | ||
1064 | } | ||
1065 | sym = elf->symtab_start + r_sym; | 986 | sym = elf->symtab_start + r_sym; |
1066 | /* Skip special sections */ | 987 | /* Skip special sections */ |
1067 | if (sym->st_shndx >= SHN_LORESERVE) | 988 | if (sym->st_shndx >= SHN_LORESERVE) |