diff options
| author | Alessio Igor Bogani <abogani@kernel.org> | 2011-04-14 08:59:39 -0400 |
|---|---|---|
| committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-05-19 03:25:27 -0400 |
| commit | f02e8a6596b7dc9b2171f7ff5654039ef0950cdc (patch) | |
| tree | 7e306a718415a53aea737c434f33eb36f3e53abc /include | |
| parent | de4d8d53465483168d6a627d409ee2d09d8e3308 (diff) | |
module: Sort exported symbols
This patch places every exported symbol in its own section
(i.e. "___ksymtab+printk"). Thus the linker will use its SORT() directive
to sort and finally merge all symbol in the right and final section
(i.e. "__ksymtab").
The symbol prefixed archs use an underscore as prefix for symbols.
To avoid collision we use a different character to create the temporary
section names.
This work was supported by a hardware donation from the CE Linux Forum.
Signed-off-by: Alessio Igor Bogani <abogani@kernel.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (folded in '+' fixup)
Tested-by: Dirk Behme <dirk.behme@googlemail.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-generic/vmlinux.lds.h | 20 | ||||
| -rw-r--r-- | include/linux/module.h | 4 |
2 files changed, 12 insertions, 12 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index bd297a20ab98..b27445e00b6c 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
| @@ -274,70 +274,70 @@ | |||
| 274 | /* Kernel symbol table: Normal symbols */ \ | 274 | /* Kernel symbol table: Normal symbols */ \ |
| 275 | __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ | 275 | __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ |
| 276 | VMLINUX_SYMBOL(__start___ksymtab) = .; \ | 276 | VMLINUX_SYMBOL(__start___ksymtab) = .; \ |
| 277 | *(__ksymtab) \ | 277 | *(SORT(___ksymtab+*)) \ |
| 278 | VMLINUX_SYMBOL(__stop___ksymtab) = .; \ | 278 | VMLINUX_SYMBOL(__stop___ksymtab) = .; \ |
| 279 | } \ | 279 | } \ |
| 280 | \ | 280 | \ |
| 281 | /* Kernel symbol table: GPL-only symbols */ \ | 281 | /* Kernel symbol table: GPL-only symbols */ \ |
| 282 | __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ | 282 | __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ |
| 283 | VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \ | 283 | VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \ |
| 284 | *(__ksymtab_gpl) \ | 284 | *(SORT(___ksymtab_gpl+*)) \ |
| 285 | VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ | 285 | VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \ |
| 286 | } \ | 286 | } \ |
| 287 | \ | 287 | \ |
| 288 | /* Kernel symbol table: Normal unused symbols */ \ | 288 | /* Kernel symbol table: Normal unused symbols */ \ |
| 289 | __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \ | 289 | __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \ |
| 290 | VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \ | 290 | VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \ |
| 291 | *(__ksymtab_unused) \ | 291 | *(SORT(___ksymtab_unused+*)) \ |
| 292 | VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \ | 292 | VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \ |
| 293 | } \ | 293 | } \ |
| 294 | \ | 294 | \ |
| 295 | /* Kernel symbol table: GPL-only unused symbols */ \ | 295 | /* Kernel symbol table: GPL-only unused symbols */ \ |
| 296 | __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \ | 296 | __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \ |
| 297 | VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \ | 297 | VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \ |
| 298 | *(__ksymtab_unused_gpl) \ | 298 | *(SORT(___ksymtab_unused_gpl+*)) \ |
| 299 | VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \ | 299 | VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \ |
| 300 | } \ | 300 | } \ |
| 301 | \ | 301 | \ |
| 302 | /* Kernel symbol table: GPL-future-only symbols */ \ | 302 | /* Kernel symbol table: GPL-future-only symbols */ \ |
| 303 | __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \ | 303 | __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \ |
| 304 | VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \ | 304 | VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \ |
| 305 | *(__ksymtab_gpl_future) \ | 305 | *(SORT(___ksymtab_gpl_future+*)) \ |
| 306 | VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \ | 306 | VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \ |
| 307 | } \ | 307 | } \ |
| 308 | \ | 308 | \ |
| 309 | /* Kernel symbol table: Normal symbols */ \ | 309 | /* Kernel symbol table: Normal symbols */ \ |
| 310 | __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \ | 310 | __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \ |
| 311 | VMLINUX_SYMBOL(__start___kcrctab) = .; \ | 311 | VMLINUX_SYMBOL(__start___kcrctab) = .; \ |
| 312 | *(__kcrctab) \ | 312 | *(SORT(___kcrctab+*)) \ |
| 313 | VMLINUX_SYMBOL(__stop___kcrctab) = .; \ | 313 | VMLINUX_SYMBOL(__stop___kcrctab) = .; \ |
| 314 | } \ | 314 | } \ |
| 315 | \ | 315 | \ |
| 316 | /* Kernel symbol table: GPL-only symbols */ \ | 316 | /* Kernel symbol table: GPL-only symbols */ \ |
| 317 | __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \ | 317 | __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \ |
| 318 | VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \ | 318 | VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \ |
| 319 | *(__kcrctab_gpl) \ | 319 | *(SORT(___kcrctab_gpl+*)) \ |
| 320 | VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \ | 320 | VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \ |
| 321 | } \ | 321 | } \ |
| 322 | \ | 322 | \ |
| 323 | /* Kernel symbol table: Normal unused symbols */ \ | 323 | /* Kernel symbol table: Normal unused symbols */ \ |
| 324 | __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \ | 324 | __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \ |
| 325 | VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \ | 325 | VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \ |
| 326 | *(__kcrctab_unused) \ | 326 | *(SORT(___kcrctab_unused+*)) \ |
| 327 | VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \ | 327 | VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \ |
| 328 | } \ | 328 | } \ |
| 329 | \ | 329 | \ |
| 330 | /* Kernel symbol table: GPL-only unused symbols */ \ | 330 | /* Kernel symbol table: GPL-only unused symbols */ \ |
| 331 | __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \ | 331 | __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \ |
| 332 | VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \ | 332 | VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \ |
| 333 | *(__kcrctab_unused_gpl) \ | 333 | *(SORT(___kcrctab_unused_gpl+*)) \ |
| 334 | VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \ | 334 | VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \ |
| 335 | } \ | 335 | } \ |
| 336 | \ | 336 | \ |
| 337 | /* Kernel symbol table: GPL-future-only symbols */ \ | 337 | /* Kernel symbol table: GPL-future-only symbols */ \ |
| 338 | __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \ | 338 | __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \ |
| 339 | VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \ | 339 | VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \ |
| 340 | *(__kcrctab_gpl_future) \ | 340 | *(SORT(___kcrctab_gpl_future+*)) \ |
| 341 | VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \ | 341 | VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \ |
| 342 | } \ | 342 | } \ |
| 343 | \ | 343 | \ |
diff --git a/include/linux/module.h b/include/linux/module.h index 49f4ad0ddec2..d9ca2d5dc6d0 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -224,7 +224,7 @@ struct module_use { | |||
| 224 | extern void *__crc_##sym __attribute__((weak)); \ | 224 | extern void *__crc_##sym __attribute__((weak)); \ |
| 225 | static const unsigned long __kcrctab_##sym \ | 225 | static const unsigned long __kcrctab_##sym \ |
| 226 | __used \ | 226 | __used \ |
| 227 | __attribute__((section("__kcrctab" sec), unused)) \ | 227 | __attribute__((section("___kcrctab" sec "+" #sym), unused)) \ |
| 228 | = (unsigned long) &__crc_##sym; | 228 | = (unsigned long) &__crc_##sym; |
| 229 | #else | 229 | #else |
| 230 | #define __CRC_SYMBOL(sym, sec) | 230 | #define __CRC_SYMBOL(sym, sec) |
| @@ -239,7 +239,7 @@ struct module_use { | |||
| 239 | = MODULE_SYMBOL_PREFIX #sym; \ | 239 | = MODULE_SYMBOL_PREFIX #sym; \ |
| 240 | static const struct kernel_symbol __ksymtab_##sym \ | 240 | static const struct kernel_symbol __ksymtab_##sym \ |
| 241 | __used \ | 241 | __used \ |
| 242 | __attribute__((section("__ksymtab" sec), unused)) \ | 242 | __attribute__((section("___ksymtab" sec "+" #sym), unused)) \ |
| 243 | = { (unsigned long)&sym, __kstrtab_##sym } | 243 | = { (unsigned long)&sym, __kstrtab_##sym } |
| 244 | 244 | ||
| 245 | #define EXPORT_SYMBOL(sym) \ | 245 | #define EXPORT_SYMBOL(sym) \ |
