History

Recognize -Wl,-Bsymbolic

Without -Bsymbolic, a symbol/function in a *.so can be overridden by a symbol/function in the main module. That is the default search order, but not supported by tcc. With -Bsymbolic, the linker tries to resolve a symbol/function in the current module first. The loader in tcc implements this search order. We do not distinguish -Bsymbolic and -Bsymbolic-function -- By by ... Detlef

Detlef Riekenberg committed 16 years ago

Commit 26505841 parent 5caf6233 files · +9 −0Browse files

Unified · Split

3 files
  1. tcc.c +2 −0
  2. tcc.h +3 −0
  3. tccelf.c +4 −0
tcc.c+2−0
@@ -386,6 +386,8 @@ static int parse_args(TCCState *s, int argc, char **argv) · 385 unmodified lines
386 if (strstart(optarg, "-Ttext,", &p)) {386 if (strstart(optarg, "-Ttext,", &p)) {
387 s->text_addr = strtoul(p, NULL, 16);387 s->text_addr = strtoul(p, NULL, 16);
388 s->has_text_addr = 1;388 s->has_text_addr = 1;
389 } else if (strstart(optarg, "-Bsymbolic", &p)) {
390 s->symbolic = TRUE;
389 } else if (strstart(optarg, "--section-alignment,", &p)) {391 } else if (strstart(optarg, "--section-alignment,", &p)) {
390 s->section_align = strtoul(p, NULL, 16);392 s->section_align = strtoul(p, NULL, 16);
391 } else if (strstart(optarg, "--image-base,", &p)) {393 } else if (strstart(optarg, "--image-base,", &p)) {
tcc.h+3−0
@@ -445,6 +445,9 @@ struct TCCState { · 444 unmodified lines
445 /* if true, all symbols are exported */445 /* if true, all symbols are exported */
446 int rdynamic;446 int rdynamic;
447 447
448 /* if true, resolve symbols in the current module first (-Wl,Bsymbolic) */
449 int symbolic;
450
448 /* if true, only link in referenced objects from archive */451 /* if true, only link in referenced objects from archive */
449 int alacarte_link;452 int alacarte_link;
450 453
tccelf.c+4−0
@@ -1575,6 +1575,10 @@ static int elf_output_file(TCCState *s1, const char *filename) · 1574 unmodified lines
1575 put_dt(dynamic, DT_SONAME, put_elf_str(dynstr, s1->soname));1575 put_dt(dynamic, DT_SONAME, put_elf_str(dynstr, s1->soname));
1576 put_dt(dynamic, DT_TEXTREL, 0);1576 put_dt(dynamic, DT_TEXTREL, 0);
1577 }1577 }
1578
1579 if (s1->symbolic)
1580 put_dt(dynamic, DT_SYMBOLIC, 0);
1581
1578 /* add necessary space for other entries */1582 /* add necessary space for other entries */
1579 saved_dynamic_data_offset = dynamic->data_offset;1583 saved_dynamic_data_offset = dynamic->data_offset;
1580 dynamic->data_offset += sizeof(ElfW(Dyn)) * EXTRA_RELITEMS;1584 dynamic->data_offset += sizeof(ElfW(Dyn)) * EXTRA_RELITEMS;

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