This option is needed for openssl to create a correct library.
Unified · Split
| @@ -1457,6 +1457,8 @@ static int tcc_set_linker(TCCState *s, const char *optarg) · 1456 unmodified lines | ||
| 1457 | 1457 | s->filetype |= AFF_WHOLE_ARCHIVE; |
| 1458 | 1458 | } else if (link_option(&o, "no-whole-archive")) { |
| 1459 | 1459 | s->filetype &= ~AFF_WHOLE_ARCHIVE; |
| 1460 | + } else if (link_option(&o, "znodelete")) { | |
| 1461 | + s->znodelete = 1; | |
| 1460 | 1462 | #ifdef TCC_TARGET_PE |
| 1461 | 1463 | } else if (link_option(&o, "large-address-aware")) { |
| 1462 | 1464 | s->pe_characteristics |= 0x20; |
| @@ -741,6 +741,7 @@ struct TCCState { · 740 unmodified lines | ||
| 741 | 741 | unsigned char static_link; /* if true, static linking is performed */ |
| 742 | 742 | unsigned char rdynamic; /* if true, all symbols are exported */ |
| 743 | 743 | unsigned char symbolic; /* if true, resolve symbols in the current module first */ |
| 744 | + unsigned char znodelete; /* Set DF_1_NODELETE in dynamic section */ | |
| 744 | 745 | unsigned char filetype; /* file type for compilation (NONE,C,ASM) */ |
| 745 | 746 | unsigned char optimize; /* only to #define __OPTIMIZE__ */ |
| 746 | 747 | unsigned char option_pthread; /* -pthread option */ |
| @@ -2939,6 +2939,8 @@ static int elf_output_file(TCCState *s1, const char *filename) · 2938 unmodified lines | ||
| 2939 | 2939 | put_dt(dynamic, DT_TEXTREL, 0); |
| 2940 | 2940 | if (file_type & TCC_OUTPUT_EXE) |
| 2941 | 2941 | dt_flags_1 = DF_1_NOW | DF_1_PIE; |
| 2942 | + if (s1->znodelete) | |
| 2943 | + dt_flags_1 |= DF_1_NODELETE; | |
| 2942 | 2944 | } |
| 2943 | 2945 | put_dt(dynamic, DT_FLAGS, DF_BIND_NOW); |
| 2944 | 2946 | put_dt(dynamic, DT_FLAGS_1, dt_flags_1); |