Lines Matching +full:- +full:alt
1 // SPDX-License-Identifier: GPL-2.0-or-later
57 void __weak arch_handle_alternative(unsigned short feature, struct special_alt *alt) in arch_handle_alternative() argument
64 *sec = reloc->sym->sec; in reloc_to_sec_off()
65 *off = reloc->sym->offset + reloc_addend(reloc); in reloc_to_sec_off()
70 struct special_alt *alt) in get_alt_entry() argument
75 offset = idx * entry->size; in get_alt_entry()
77 alt->group = entry->group; in get_alt_entry()
78 alt->jump_or_nop = entry->jump_or_nop; in get_alt_entry()
80 if (alt->group) { in get_alt_entry()
81 alt->orig_len = *(unsigned char *)(sec->data->d_buf + offset + in get_alt_entry()
82 entry->orig_len); in get_alt_entry()
83 alt->new_len = *(unsigned char *)(sec->data->d_buf + offset + in get_alt_entry()
84 entry->new_len); in get_alt_entry()
87 orig_reloc = find_reloc_by_dest(elf, sec, offset + entry->orig); in get_alt_entry()
89 WARN_FUNC("can't find orig reloc", sec, offset + entry->orig); in get_alt_entry()
90 return -1; in get_alt_entry()
93 reloc_to_sec_off(orig_reloc, &alt->orig_sec, &alt->orig_off); in get_alt_entry()
95 if (entry->feature) { in get_alt_entry()
99 *(unsigned short *)(sec->data->d_buf + in get_alt_entry()
101 entry->feature)); in get_alt_entry()
102 arch_handle_alternative(feature, alt); in get_alt_entry()
105 if (!entry->group || alt->new_len) { in get_alt_entry()
106 new_reloc = find_reloc_by_dest(elf, sec, offset + entry->new); in get_alt_entry()
109 sec, offset + entry->new); in get_alt_entry()
110 return -1; in get_alt_entry()
113 reloc_to_sec_off(new_reloc, &alt->new_sec, &alt->new_off); in get_alt_entry()
116 if (alt->new_off >= 0x7ffffff0) in get_alt_entry()
117 alt->new_off -= 0x7ffffff0; in get_alt_entry()
120 if (entry->key) { in get_alt_entry()
123 key_reloc = find_reloc_by_dest(elf, sec, offset + entry->key); in get_alt_entry()
126 sec, offset + entry->key); in get_alt_entry()
127 return -1; in get_alt_entry()
129 alt->key_addend = reloc_addend(key_reloc); in get_alt_entry()
145 struct special_alt *alt; in special_get_alts() local
150 for (entry = entries; entry->sec; entry++) { in special_get_alts()
151 sec = find_section_by_name(elf, entry->sec); in special_get_alts()
155 if (sec->sh.sh_size % entry->size != 0) { in special_get_alts()
157 sec->name, entry->size); in special_get_alts()
158 return -1; in special_get_alts()
161 nr_entries = sec->sh.sh_size / entry->size; in special_get_alts()
164 alt = malloc(sizeof(*alt)); in special_get_alts()
165 if (!alt) { in special_get_alts()
167 return -1; in special_get_alts()
169 memset(alt, 0, sizeof(*alt)); in special_get_alts()
171 ret = get_alt_entry(elf, entry, sec, idx, alt); in special_get_alts()
177 list_add_tail(&alt->list, alts); in special_get_alts()