.. | .. |
---|
6 | 6 | |
---|
7 | 7 | #include <asm-generic/module.h> |
---|
8 | 8 | |
---|
9 | | -#define MODULE_ARCH_VERMAGIC "riscv" |
---|
10 | | - |
---|
11 | 9 | struct module; |
---|
12 | | -u64 module_emit_got_entry(struct module *mod, u64 val); |
---|
13 | | -u64 module_emit_plt_entry(struct module *mod, u64 val); |
---|
| 10 | +unsigned long module_emit_got_entry(struct module *mod, unsigned long val); |
---|
| 11 | +unsigned long module_emit_plt_entry(struct module *mod, unsigned long val); |
---|
14 | 12 | |
---|
15 | 13 | #ifdef CONFIG_MODULE_SECTIONS |
---|
16 | 14 | struct mod_section { |
---|
17 | | - struct elf64_shdr *shdr; |
---|
| 15 | + Elf_Shdr *shdr; |
---|
18 | 16 | int num_entries; |
---|
19 | 17 | int max_entries; |
---|
20 | 18 | }; |
---|
.. | .. |
---|
26 | 24 | }; |
---|
27 | 25 | |
---|
28 | 26 | struct got_entry { |
---|
29 | | - u64 symbol_addr; /* the real variable address */ |
---|
| 27 | + unsigned long symbol_addr; /* the real variable address */ |
---|
30 | 28 | }; |
---|
31 | 29 | |
---|
32 | | -static inline struct got_entry emit_got_entry(u64 val) |
---|
| 30 | +static inline struct got_entry emit_got_entry(unsigned long val) |
---|
33 | 31 | { |
---|
34 | 32 | return (struct got_entry) {val}; |
---|
35 | 33 | } |
---|
36 | 34 | |
---|
37 | | -static inline struct got_entry *get_got_entry(u64 val, |
---|
| 35 | +static inline struct got_entry *get_got_entry(unsigned long val, |
---|
38 | 36 | const struct mod_section *sec) |
---|
39 | 37 | { |
---|
40 | | - struct got_entry *got = (struct got_entry *)sec->shdr->sh_addr; |
---|
| 38 | + struct got_entry *got = (struct got_entry *)(sec->shdr->sh_addr); |
---|
41 | 39 | int i; |
---|
42 | 40 | for (i = 0; i < sec->num_entries; i++) { |
---|
43 | 41 | if (got[i].symbol_addr == val) |
---|
.. | .. |
---|
62 | 60 | #define REG_T0 0x5 |
---|
63 | 61 | #define REG_T1 0x6 |
---|
64 | 62 | |
---|
65 | | -static inline struct plt_entry emit_plt_entry(u64 val, u64 plt, u64 got_plt) |
---|
| 63 | +static inline struct plt_entry emit_plt_entry(unsigned long val, |
---|
| 64 | + unsigned long plt, |
---|
| 65 | + unsigned long got_plt) |
---|
66 | 66 | { |
---|
67 | 67 | /* |
---|
68 | 68 | * U-Type encoding: |
---|
.. | .. |
---|
76 | 76 | * +------------+------------+--------+----------+----------+ |
---|
77 | 77 | * |
---|
78 | 78 | */ |
---|
79 | | - u64 offset = got_plt - plt; |
---|
| 79 | + unsigned long offset = got_plt - plt; |
---|
80 | 80 | u32 hi20 = (offset + 0x800) & 0xfffff000; |
---|
81 | 81 | u32 lo12 = (offset - hi20); |
---|
82 | 82 | return (struct plt_entry) { |
---|
.. | .. |
---|
86 | 86 | }; |
---|
87 | 87 | } |
---|
88 | 88 | |
---|
89 | | -static inline int get_got_plt_idx(u64 val, const struct mod_section *sec) |
---|
| 89 | +static inline int get_got_plt_idx(unsigned long val, const struct mod_section *sec) |
---|
90 | 90 | { |
---|
91 | 91 | struct got_entry *got_plt = (struct got_entry *)sec->shdr->sh_addr; |
---|
92 | 92 | int i; |
---|
.. | .. |
---|
97 | 97 | return -1; |
---|
98 | 98 | } |
---|
99 | 99 | |
---|
100 | | -static inline struct plt_entry *get_plt_entry(u64 val, |
---|
101 | | - const struct mod_section *sec_plt, |
---|
102 | | - const struct mod_section *sec_got_plt) |
---|
| 100 | +static inline struct plt_entry *get_plt_entry(unsigned long val, |
---|
| 101 | + const struct mod_section *sec_plt, |
---|
| 102 | + const struct mod_section *sec_got_plt) |
---|
103 | 103 | { |
---|
104 | 104 | struct plt_entry *plt = (struct plt_entry *)sec_plt->shdr->sh_addr; |
---|
105 | 105 | int got_plt_idx = get_got_plt_idx(val, sec_got_plt); |
---|