aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/sortextable.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:45:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:45:43 -0500
commit5cbb3d216e2041700231bcfc383ee5f8b7fc8b74 (patch)
treea738fa82dbcefa9bd283c08bc67f38827be63937 /scripts/sortextable.h
parent9bc9ccd7db1c9f043f75380b5a5b94912046a60e (diff)
parent4e9b45a19241354daec281d7a785739829b52359 (diff)
Merge branch 'akpm' (patches from Andrew Morton)
Merge first patch-bomb from Andrew Morton: "Quite a lot of other stuff is banked up awaiting further next->mainline merging, but this batch contains: - Lots of random misc patches - OCFS2 - Most of MM - backlight updates - lib/ updates - printk updates - checkpatch updates - epoll tweaking - rtc updates - hfs - hfsplus - documentation - procfs - update gcov to gcc-4.7 format - IPC" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (269 commits) ipc, msg: fix message length check for negative values ipc/util.c: remove unnecessary work pending test devpts: plug the memory leak in kill_sb ./Makefile: export initial ramdisk compression config option init/Kconfig: add option to disable kernel compression drivers: w1: make w1_slave::flags long to avoid memory corruption drivers/w1/masters/ds1wm.cuse dev_get_platdata() drivers/memstick/core/ms_block.c: fix unreachable state in h_msb_read_page() drivers/memstick/core/mspro_block.c: fix attributes array allocation drivers/pps/clients/pps-gpio.c: remove redundant of_match_ptr kernel/panic.c: reduce 1 byte usage for print tainted buffer gcov: reuse kbasename helper kernel/gcov/fs.c: use pr_warn() kernel/module.c: use pr_foo() gcov: compile specific gcov implementation based on gcc version gcov: add support for gcc 4.7 gcov format gcov: move gcov structs definitions to a gcc version specific file kernel/taskstats.c: return -ENOMEM when alloc memory fails in add_del_listener() kernel/taskstats.c: add nla_nest_cancel() for failure processing between nla_nest_start() and nla_nest_end() kernel/sysctl_binary.c: use scnprintf() instead of snprintf() ...
Diffstat (limited to 'scripts/sortextable.h')
-rw-r--r--scripts/sortextable.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/scripts/sortextable.h b/scripts/sortextable.h
index f5eb43d42926..8fac3fd697a6 100644
--- a/scripts/sortextable.h
+++ b/scripts/sortextable.h
@@ -98,6 +98,8 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort)
98 Elf_Shdr *symtab_sec = NULL; 98 Elf_Shdr *symtab_sec = NULL;
99 Elf_Shdr *extab_sec = NULL; 99 Elf_Shdr *extab_sec = NULL;
100 Elf_Sym *sym; 100 Elf_Sym *sym;
101 const Elf_Sym *symtab;
102 Elf32_Word *symtab_shndx_start = NULL;
101 Elf_Sym *sort_needed_sym; 103 Elf_Sym *sort_needed_sym;
102 Elf_Shdr *sort_needed_sec; 104 Elf_Shdr *sort_needed_sec;
103 Elf_Rel *relocs = NULL; 105 Elf_Rel *relocs = NULL;
@@ -109,11 +111,22 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort)
109 int extab_index = 0; 111 int extab_index = 0;
110 int i; 112 int i;
111 int idx; 113 int idx;
114 unsigned int num_sections;
115 unsigned int secindex_strings;
112 116
113 shdr = (Elf_Shdr *)((char *)ehdr + _r(&ehdr->e_shoff)); 117 shdr = (Elf_Shdr *)((char *)ehdr + _r(&ehdr->e_shoff));
114 shstrtab_sec = shdr + r2(&ehdr->e_shstrndx); 118
119 num_sections = r2(&ehdr->e_shnum);
120 if (num_sections == SHN_UNDEF)
121 num_sections = _r(&shdr[0].sh_size);
122
123 secindex_strings = r2(&ehdr->e_shstrndx);
124 if (secindex_strings == SHN_XINDEX)
125 secindex_strings = r(&shdr[0].sh_link);
126
127 shstrtab_sec = shdr + secindex_strings;
115 secstrtab = (const char *)ehdr + _r(&shstrtab_sec->sh_offset); 128 secstrtab = (const char *)ehdr + _r(&shstrtab_sec->sh_offset);
116 for (i = 0; i < r2(&ehdr->e_shnum); i++) { 129 for (i = 0; i < num_sections; i++) {
117 idx = r(&shdr[i].sh_name); 130 idx = r(&shdr[i].sh_name);
118 if (strcmp(secstrtab + idx, "__ex_table") == 0) { 131 if (strcmp(secstrtab + idx, "__ex_table") == 0) {
119 extab_sec = shdr + i; 132 extab_sec = shdr + i;
@@ -129,6 +142,9 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort)
129 symtab_sec = shdr + i; 142 symtab_sec = shdr + i;
130 if (strcmp(secstrtab + idx, ".strtab") == 0) 143 if (strcmp(secstrtab + idx, ".strtab") == 0)
131 strtab_sec = shdr + i; 144 strtab_sec = shdr + i;
145 if (r(&shdr[i].sh_type) == SHT_SYMTAB_SHNDX)
146 symtab_shndx_start = (Elf32_Word *)(
147 (const char *)ehdr + _r(&shdr[i].sh_offset));
132 } 148 }
133 if (strtab_sec == NULL) { 149 if (strtab_sec == NULL) {
134 fprintf(stderr, "no .strtab in file: %s\n", fname); 150 fprintf(stderr, "no .strtab in file: %s\n", fname);
@@ -138,6 +154,8 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort)
138 fprintf(stderr, "no .symtab in file: %s\n", fname); 154 fprintf(stderr, "no .symtab in file: %s\n", fname);
139 fail_file(); 155 fail_file();
140 } 156 }
157 symtab = (const Elf_Sym *)((const char *)ehdr +
158 _r(&symtab_sec->sh_offset));
141 if (extab_sec == NULL) { 159 if (extab_sec == NULL) {
142 fprintf(stderr, "no __ex_table in file: %s\n", fname); 160 fprintf(stderr, "no __ex_table in file: %s\n", fname);
143 fail_file(); 161 fail_file();
@@ -176,7 +194,9 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort)
176 fname); 194 fname);
177 fail_file(); 195 fail_file();
178 } 196 }
179 sort_needed_sec = &shdr[r2(&sort_needed_sym->st_shndx)]; 197 sort_needed_sec = &shdr[get_secindex(r2(&sym->st_shndx),
198 sort_needed_sym - symtab,
199 symtab_shndx_start)];
180 sort_done_location = (void *)ehdr + 200 sort_done_location = (void *)ehdr +
181 _r(&sort_needed_sec->sh_offset) + 201 _r(&sort_needed_sec->sh_offset) +
182 _r(&sort_needed_sym->st_value) - 202 _r(&sort_needed_sym->st_value) -