mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-04 06:30:10 +08:00
Error on unrecognized relocations
This commit is contained in:
parent
557c5c1f11
commit
e22249b81c
3
tcc.h
3
tcc.h
@ -1323,13 +1323,14 @@ enum gotplt_entry {
|
||||
|
||||
/* what kind of relocation is it */
|
||||
struct reloc_info {
|
||||
int known; /* true for known relocation */
|
||||
int code_reloc; /* if false, that's a data reloc */
|
||||
int gotplt_entry; /* wether and when to create a GOT/PLT entry */
|
||||
int pltoff_addend; /* wether to store the PLT offset in addend */
|
||||
};
|
||||
|
||||
#define INIT_RELOC_INFO(rtype, code_reloc, gotplt_entry, pltoff_addend) \
|
||||
[rtype] = {code_reloc, gotplt_entry, pltoff_addend},
|
||||
[rtype] = {1, code_reloc, gotplt_entry, pltoff_addend},
|
||||
ST_DATA struct reloc_info relocs_info[R_NUM];
|
||||
|
||||
ST_DATA Section *text_section, *data_section, *bss_section; /* predefined sections */
|
||||
|
4
tccelf.c
4
tccelf.c
@ -1042,6 +1042,10 @@ ST_FUNC void build_got_entries(TCCState *s1)
|
||||
type = ELFW(R_TYPE)(rel->r_info);
|
||||
sym_index = ELFW(R_SYM)(rel->r_info);
|
||||
sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
|
||||
|
||||
if (type >= R_NUM || !relocs_info[type].known)
|
||||
tcc_error("Unknown relocation: %d\n", type);
|
||||
|
||||
if (relocs_info[type].gotplt_entry == NO_GOTPLT_ENTRY)
|
||||
continue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user