File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -156,22 +156,28 @@ static inline int is_shndx_special(unsigned int i)
156
156
return i != SHN_XINDEX && i >= SHN_LORESERVE && i <= SHN_HIRESERVE ;
157
157
}
158
158
159
- /*
160
- * Move reserved section indices SHN_LORESERVE..SHN_HIRESERVE out of
161
- * the way to -256..-1, to avoid conflicting with real section
162
- * indices.
163
- */
164
- #define SPECIAL (i ) ((i) - (SHN_HIRESERVE + 1))
165
-
166
159
/* Accessor for sym->st_shndx, hides ugliness of "64k sections" */
167
160
static inline unsigned int get_secindex (const struct elf_info * info ,
168
161
const Elf_Sym * sym )
169
162
{
170
- if (is_shndx_special (sym -> st_shndx ))
171
- return SPECIAL (sym -> st_shndx );
172
- if (sym -> st_shndx != SHN_XINDEX )
173
- return sym -> st_shndx ;
174
- return info -> symtab_shndx_start [sym - info -> symtab_start ];
163
+ unsigned int index = sym -> st_shndx ;
164
+
165
+ /*
166
+ * Elf{32,64}_Sym::st_shndx is 2 byte. Big section numbers are available
167
+ * in the .symtab_shndx section.
168
+ */
169
+ if (index == SHN_XINDEX )
170
+ return info -> symtab_shndx_start [sym - info -> symtab_start ];
171
+
172
+ /*
173
+ * Move reserved section indices SHN_LORESERVE..SHN_HIRESERVE out of
174
+ * the way to UINT_MAX-255..UINT_MAX, to avoid conflicting with real
175
+ * section indices.
176
+ */
177
+ if (index >= SHN_LORESERVE && index <= SHN_HIRESERVE )
178
+ return index - SHN_HIRESERVE - 1 ;
179
+
180
+ return index ;
175
181
}
176
182
177
183
/* file2alias.c */
You can’t perform that action at this time.
0 commit comments