hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/arm/kernel/module.c
....@@ -1,12 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/arch/arm/kernel/module.c
34 *
45 * Copyright (C) 2002 Russell King.
56 * 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.
107 *
118 * Module allocation method suggested by Andi Kleen.
129 */
....@@ -20,7 +17,6 @@
2017 #include <linux/string.h>
2118 #include <linux/gfp.h>
2219
23
-#include <asm/pgtable.h>
2420 #include <asm/sections.h>
2521 #include <asm/smp_plat.h>
2622 #include <asm/unwind.h>
....@@ -57,6 +53,20 @@
5753 __builtin_return_address(0));
5854 }
5955 #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
+}
6070
6171 int
6272 apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
....@@ -405,8 +415,17 @@
405415 #ifdef CONFIG_ARM_UNWIND
406416 int i;
407417
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;
411430 #endif
412431 }