aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod/modpost.c
diff options
context:
space:
mode:
authorChristopher Kenna <cjk@cs.unc.edu>2012-09-20 13:33:17 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2012-09-20 13:33:17 -0400
commit5e0a4919ccb230ab449826ef91bdf38a4ed283e5 (patch)
tree3790db1aa69ed50b08f34c21c1796785df6a0304 /scripts/mod/modpost.c
parentc00613f1fad38acec00ef2c009ae4e73110084ac (diff)
parent5dd038629bdedef22d5ecad2d5e75ad81f4dc694 (diff)
Merge remote-tracking branch 'oneiric-ubuntu/pandaboard' into pandaboard-litmus
Remote branch is from Ubuntu Oneiric (tag Ubuntu-3.0.0-1215.27) with minor patch to the TWL-RTC code. Trying to pull this into LITMUS^RT staging (as of 9/20/2012) to get LITMUS^RT running on the PandaBoard. Conflicts: Makefile fs/exec.c include/linux/fs.h kernel/fork.c
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r--scripts/mod/modpost.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 413c53693e6..e3cd3452589 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -132,8 +132,10 @@ static struct module *new_module(char *modname)
132 /* strip trailing .o */ 132 /* strip trailing .o */
133 s = strrchr(p, '.'); 133 s = strrchr(p, '.');
134 if (s != NULL) 134 if (s != NULL)
135 if (strcmp(s, ".o") == 0) 135 if (strcmp(s, ".o") == 0) {
136 *s = '\0'; 136 *s = '\0';
137 mod->is_dot_o = 1;
138 }
137 139
138 /* add to list */ 140 /* add to list */
139 mod->name = p; 141 mod->name = p;
@@ -254,6 +256,28 @@ static enum export export_no(const char *s)
254 return export_unknown; 256 return export_unknown;
255} 257}
256 258
259static const char *sec_name(struct elf_info *elf, int secindex);
260
261#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
262
263static enum export export_from_secname(struct elf_info *elf, unsigned int sec)
264{
265 const char *secname = sec_name(elf, sec);
266
267 if (strstarts(secname, "___ksymtab+"))
268 return export_plain;
269 else if (strstarts(secname, "___ksymtab_unused+"))
270 return export_unused;
271 else if (strstarts(secname, "___ksymtab_gpl+"))
272 return export_gpl;
273 else if (strstarts(secname, "___ksymtab_unused_gpl+"))
274 return export_unused_gpl;
275 else if (strstarts(secname, "___ksymtab_gpl_future+"))
276 return export_gpl_future;
277 else
278 return export_unknown;
279}
280
257static enum export export_from_sec(struct elf_info *elf, unsigned int sec) 281static enum export export_from_sec(struct elf_info *elf, unsigned int sec)
258{ 282{
259 if (sec == elf->export_sec) 283 if (sec == elf->export_sec)
@@ -563,7 +587,13 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
563 Elf_Sym *sym, const char *symname) 587 Elf_Sym *sym, const char *symname)
564{ 588{
565 unsigned int crc; 589 unsigned int crc;
566 enum export export = export_from_sec(info, get_secindex(info, sym)); 590 enum export export;
591
592 if ((!is_vmlinux(mod->name) || mod->is_dot_o) &&
593 strncmp(symname, "__ksymtab", 9) == 0)
594 export = export_from_secname(info, get_secindex(info, sym));
595 else
596 export = export_from_sec(info, get_secindex(info, sym));
567 597
568 switch (sym->st_shndx) { 598 switch (sym->st_shndx) {
569 case SHN_COMMON: 599 case SHN_COMMON:
@@ -822,7 +852,7 @@ static void check_section(const char *modname, struct elf_info *elf,
822 852
823#define ALL_INIT_DATA_SECTIONS \ 853#define ALL_INIT_DATA_SECTIONS \
824 ".init.setup$", ".init.rodata$", \ 854 ".init.setup$", ".init.rodata$", \
825 ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$" \ 855 ".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$", \
826 ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$" 856 ".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$"
827#define ALL_EXIT_DATA_SECTIONS \ 857#define ALL_EXIT_DATA_SECTIONS \
828 ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$" 858 ".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$"