| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/arch/arm/kernel/module.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2002 Russell King. |
|---|
| 5 | 6 | * Modified for nommu by Hyok S. Choi |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 9 | | - * published by the Free Software Foundation. |
|---|
| 10 | 7 | * |
|---|
| 11 | 8 | * Module allocation method suggested by Andi Kleen. |
|---|
| 12 | 9 | */ |
|---|
| .. | .. |
|---|
| 20 | 17 | #include <linux/string.h> |
|---|
| 21 | 18 | #include <linux/gfp.h> |
|---|
| 22 | 19 | |
|---|
| 23 | | -#include <asm/pgtable.h> |
|---|
| 24 | 20 | #include <asm/sections.h> |
|---|
| 25 | 21 | #include <asm/smp_plat.h> |
|---|
| 26 | 22 | #include <asm/unwind.h> |
|---|
| .. | .. |
|---|
| 57 | 53 | __builtin_return_address(0)); |
|---|
| 58 | 54 | } |
|---|
| 59 | 55 | #endif |
|---|
| 56 | + |
|---|
| 57 | +bool module_init_section(const char *name) |
|---|
| 58 | +{ |
|---|
| 59 | + return strstarts(name, ".init") || |
|---|
| 60 | + strstarts(name, ".ARM.extab.init") || |
|---|
| 61 | + strstarts(name, ".ARM.exidx.init"); |
|---|
| 62 | +} |
|---|
| 63 | + |
|---|
| 64 | +bool module_exit_section(const char *name) |
|---|
| 65 | +{ |
|---|
| 66 | + return strstarts(name, ".exit") || |
|---|
| 67 | + strstarts(name, ".ARM.extab.exit") || |
|---|
| 68 | + strstarts(name, ".ARM.exidx.exit"); |
|---|
| 69 | +} |
|---|
| 60 | 70 | |
|---|
| 61 | 71 | int |
|---|
| 62 | 72 | apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, |
|---|
| .. | .. |
|---|
| 405 | 415 | #ifdef CONFIG_ARM_UNWIND |
|---|
| 406 | 416 | int i; |
|---|
| 407 | 417 | |
|---|
| 408 | | - for (i = 0; i < ARM_SEC_MAX; i++) |
|---|
| 409 | | - if (mod->arch.unwind[i]) |
|---|
| 410 | | - unwind_table_del(mod->arch.unwind[i]); |
|---|
| 418 | + for (i = 0; i < ARM_SEC_MAX; i++) { |
|---|
| 419 | + unwind_table_del(mod->arch.unwind[i]); |
|---|
| 420 | + mod->arch.unwind[i] = NULL; |
|---|
| 421 | + } |
|---|
| 422 | +#endif |
|---|
| 423 | +} |
|---|
| 424 | + |
|---|
| 425 | +void __weak module_arch_freeing_init(struct module *mod) |
|---|
| 426 | +{ |
|---|
| 427 | +#ifdef CONFIG_ARM_UNWIND |
|---|
| 428 | + unwind_table_del(mod->arch.unwind[ARM_SEC_INIT]); |
|---|
| 429 | + mod->arch.unwind[ARM_SEC_INIT] = NULL; |
|---|
| 411 | 430 | #endif |
|---|
| 412 | 431 | } |
|---|