dynamic executables (PIE)

Allows to create dynamic executables, using the code path
for TCC_OUTPUT_DLL but add an .interp header (plus a FLAGS_1
entry in the dynamic section to make 'readelf' say "PIE")

Introduces TCC_OUTPUT_DYN as alias for TCC_OUTPUT_DLL.
There is no runtime option,  only one to configure:

    ./configure --config-pie

100 insertions(+), 76 deletions(-)
This commit is contained in:
grischka
2022-05-28 21:00:40 +02:00
parent e460f7dbb2
commit ebaa5c81f4
13 changed files with 100 additions and 76 deletions

View File

@@ -380,7 +380,7 @@ void relocate(TCCState *s1, ElfW_Rel *rel, int type, unsigned char *ptr, addr_t
return;
case R_ARM_ABS32:
case R_ARM_TARGET1:
if (s1->output_type == TCC_OUTPUT_DLL) {
if (s1->output_type & TCC_OUTPUT_DYN) {
esym_index = get_sym_attr(s1, sym_index, 0)->dyn_index;
qrel->r_offset = rel->r_offset;
if (esym_index) {