aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tcc.c2
-rw-r--r--tcc.h3
-rw-r--r--tccelf.c4
3 files changed, 9 insertions, 0 deletions
diff --git a/tcc.c b/tcc.c
index 6c12b20..7e3d8b2 100644
--- a/tcc.c
+++ b/tcc.c
@@ -386,6 +386,8 @@ static int parse_args(TCCState *s, int argc, char **argv)
if (strstart(optarg, "-Ttext,", &p)) {
s->text_addr = strtoul(p, NULL, 16);
s->has_text_addr = 1;
+ } else if (strstart(optarg, "-Bsymbolic", &p)) {
+ s->symbolic = TRUE;
} else if (strstart(optarg, "--section-alignment,", &p)) {
s->section_align = strtoul(p, NULL, 16);
} else if (strstart(optarg, "--image-base,", &p)) {
diff --git a/tcc.h b/tcc.h
index 3481f64..124d7e5 100644
--- a/tcc.h
+++ b/tcc.h
@@ -445,6 +445,9 @@ struct TCCState {
/* if true, all symbols are exported */
int rdynamic;
+ /* if true, resolve symbols in the current module first (-Wl,Bsymbolic) */
+ int symbolic;
+
/* if true, only link in referenced objects from archive */
int alacarte_link;
diff --git a/tccelf.c b/tccelf.c
index a5385b1..2d884d2 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -1575,6 +1575,10 @@ static int elf_output_file(TCCState *s1, const char *filename)
put_dt(dynamic, DT_SONAME, put_elf_str(dynstr, s1->soname));
put_dt(dynamic, DT_TEXTREL, 0);
}
+
+ if (s1->symbolic)
+ put_dt(dynamic, DT_SYMBOLIC, 0);
+
/* add necessary space for other entries */
saved_dynamic_data_offset = dynamic->data_offset;
dynamic->data_offset += sizeof(ElfW(Dyn)) * EXTRA_RELITEMS;