History

Control symbol table of which to relocate symbols

Pass pointer to symbol table to relocate the symbols of in relocate_syms

Thomas Preud'homme committed 10 years ago

Commit 097cf3a1 parent c4bec034 files · +6 −6Browse files

Unified · Split

4 files
  1. tcc.h +1 −1
  2. tccelf.c +3 −3
  3. tccpe.c +1 −1
  4. tccrun.c +1 −1
tcc.h+1−1
@@ -1375,7 +1375,7 @@ ST_FUNC void put_stabn(int type, int other, int desc, int value); · 1374 unmodified lines
1375ST_FUNC void put_stabd(int type, int other, int desc);1375ST_FUNC void put_stabd(int type, int other, int desc);
1376 1376
1377ST_FUNC void relocate_common_syms(void);1377ST_FUNC void relocate_common_syms(void);
1378ST_FUNC void relocate_syms(TCCState *s1, int do_resolve);1378ST_FUNC void relocate_syms(TCCState *s1, Section *symtab, int do_resolve);
1379ST_FUNC void relocate_section(TCCState *s1, Section *s);1379ST_FUNC void relocate_section(TCCState *s1, Section *s);
1380ST_FUNC void relocate_plt(TCCState *s1);1380ST_FUNC void relocate_plt(TCCState *s1);
1381 1381
tccelf.c+3−3
@@ -652,13 +652,13 @@ ST_FUNC void relocate_common_syms(void) · 651 unmodified lines
652 652
653/* relocate symbol table, resolve undefined symbols if do_resolve is653/* relocate symbol table, resolve undefined symbols if do_resolve is
654 true and output error if undefined symbol. */654 true and output error if undefined symbol. */
655ST_FUNC void relocate_syms(TCCState *s1, int do_resolve)655ST_FUNC void relocate_syms(TCCState *s1, Section *symtab, int do_resolve)
656{656{
657 ElfW(Sym) *sym;657 ElfW(Sym) *sym;
658 int sym_bind, sh_num;658 int sym_bind, sh_num;
659 const char *name;659 const char *name;
660 660
661 for_each_elem(symtab_section, 1, sym, ElfW(Sym)) {661 for_each_elem(symtab, 1, sym, ElfW(Sym)) {
662 sh_num = sym->st_shndx;662 sh_num = sym->st_shndx;
663 if (sh_num == SHN_UNDEF) {663 if (sh_num == SHN_UNDEF) {
664 name = (char *) strtab_section->data + sym->st_name;664 name = (char *) strtab_section->data + sym->st_name;
@@ -1898,7 +1898,7 @@ static int final_sections_reloc(TCCState *s1) · 1233 unmodified lines
1898 int i;1898 int i;
1899 Section *s;1899 Section *s;
1900 1900
1901 relocate_syms(s1, 0);1901 relocate_syms(s1, s1->symtab, 0);
1902 1902
1903 if (s1->nb_errors != 0)1903 if (s1->nb_errors != 0)
1904 return -1;1904 return -1;
tccpe.c+1−1
@@ -1872,7 +1872,7 @@ ST_FUNC int pe_output_file(TCCState *s1, const char *filename) · 1871 unmodified lines
1872 ;1872 ;
1873 else if (filename) {1873 else if (filename) {
1874 pe_assign_addresses(&pe);1874 pe_assign_addresses(&pe);
1875 relocate_syms(s1, 0);1875 relocate_syms(s1, s1->symtab, 0);
1876 for (i = 1; i < s1->nb_sections; ++i) {1876 for (i = 1; i < s1->nb_sections; ++i) {
1877 Section *s = s1->sections[i];1877 Section *s = s1->sections[i];
1878 if (s->reloc) {1878 if (s->reloc) {
tccrun.c+1−1
@@ -211,7 +211,7 @@ static int tcc_relocate_ex(TCCState *s1, void *ptr) · 210 unmodified lines
211 }211 }
212 212
213 /* relocate symbols */213 /* relocate symbols */
214 relocate_syms(s1, 1);214 relocate_syms(s1, s1->symtab, 1);
215 if (s1->nb_errors)215 if (s1->nb_errors)
216 return -1;216 return -1;
217 217

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t