Skip to content

Commit f8eb5f4

Browse files
committed
Add -znodelete linker option
This option is needed for openssl to create a correct library.
1 parent 19fdef4 commit f8eb5f4

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

libtcc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,8 @@ static int tcc_set_linker(TCCState *s, const char *optarg)
14571457
s->filetype |= AFF_WHOLE_ARCHIVE;
14581458
} else if (link_option(&o, "no-whole-archive")) {
14591459
s->filetype &= ~AFF_WHOLE_ARCHIVE;
1460+
} else if (link_option(&o, "znodelete")) {
1461+
s->znodelete = 1;
14601462
#ifdef TCC_TARGET_PE
14611463
} else if (link_option(&o, "large-address-aware")) {
14621464
s->pe_characteristics |= 0x20;

tcc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ struct TCCState {
741741
unsigned char static_link; /* if true, static linking is performed */
742742
unsigned char rdynamic; /* if true, all symbols are exported */
743743
unsigned char symbolic; /* if true, resolve symbols in the current module first */
744+
unsigned char znodelete; /* Set DF_1_NODELETE in dynamic section */
744745
unsigned char filetype; /* file type for compilation (NONE,C,ASM) */
745746
unsigned char optimize; /* only to #define __OPTIMIZE__ */
746747
unsigned char option_pthread; /* -pthread option */

tccelf.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,6 +2939,8 @@ static int elf_output_file(TCCState *s1, const char *filename)
29392939
put_dt(dynamic, DT_TEXTREL, 0);
29402940
if (file_type & TCC_OUTPUT_EXE)
29412941
dt_flags_1 = DF_1_NOW | DF_1_PIE;
2942+
if (s1->znodelete)
2943+
dt_flags_1 |= DF_1_NODELETE;
29422944
}
29432945
put_dt(dynamic, DT_FLAGS, DF_BIND_NOW);
29442946
put_dt(dynamic, DT_FLAGS_1, dt_flags_1);

0 commit comments

Comments
 (0)