History

Code simplification in relocate_syms

Thomas Preud'homme committed 10 years ago

Commit c4bec031 parent 25927df1 file · +4 −7Browse files

Unified · Split

tccelf.c+4−7
@@ -665,11 +665,9 @@ ST_FUNC void relocate_syms(TCCState *s1, int do_resolve) · 664 unmodified lines
665665 /* Use ld.so to resolve symbol for us (for tcc -run) */
666666 if (do_resolve) {
667667 #if defined TCC_IS_NATIVE && !defined TCC_TARGET_PE
668− void *addr;
669− name = (char *) symtab_section->link->data + sym->st_name;
670− addr = dlsym(RTLD_DEFAULT, name);
668+ void *addr = dlsym(RTLD_DEFAULT, name);
671669 if (addr) {
672− sym->st_value = (addr_t)addr;
670+ sym->st_value = (addr_t) addr;
673671 #ifdef DEBUG_RELOC
674672 printf ("relocate_sym: %s -> 0x%lx\n", name, sym->st_value);
675673 #endif
@@ -686,11 +684,10 @@ ST_FUNC void relocate_syms(TCCState *s1, int do_resolve) · 10 unmodified lines
686684 /* only weak symbols are accepted to be undefined. Their
687685 value is zero */
688686 sym_bind = ELFW(ST_BIND)(sym->st_info);
689− if (sym_bind == STB_WEAK) {
687+ if (sym_bind == STB_WEAK)
690688 sym->st_value = 0;
691− } else {
689+ else
692690 tcc_error_noabort("undefined symbol '%s'", name);
693− }
694691 } else if (sh_num < SHN_LORESERVE) {
695692 /* add section base */
696693 sym->st_value += s1->sections[sym->st_shndx]->sh_addr;

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