History

Add -znodelete linker option

This option is needed for openssl to create a correct library.

herman ten brugge committed 1 year ago

Commit f8eb5f41 parent 19fdef43 files · +5 −0Browse files

Unified · Split

3 files
  1. libtcc.c +2 −0
  2. tcc.h +1 −0
  3. tccelf.c +2 −0
libtcc.c+2−0
@@ -1457,6 +1457,8 @@ static int tcc_set_linker(TCCState *s, const char *optarg) · 1456 unmodified lines
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+1−0
@@ -741,6 +741,7 @@ struct TCCState { · 740 unmodified lines
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+2−0
@@ -2939,6 +2939,8 @@ static int elf_output_file(TCCState *s1, const char *filename) · 2938 unmodified lines
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);

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