Browse Source

Merged revision(s) 44002 from trunk:
* android: Changed additions to the linker script to prevent misalignment of the .data section. It fixes crash when linking using recent versions of LD where the "relro" option is default. Issue #35641.
* android: Always pass "-z relro" to the linker.
........

git-svn-id: branches/fixes_3_2@44044 -

yury 5 years ago
parent
commit
abe5757702
1 changed files with 2 additions and 2 deletions
  1. 2 2
      compiler/systems/t_android.pas

+ 2 - 2
compiler/systems/t_android.pas

@@ -168,7 +168,7 @@ begin
   with Info do
   with Info do
    begin
    begin
      { Specify correct max-page-size and common-page-size to prevent big gaps between sections in resulting executable }
      { Specify correct max-page-size and common-page-size to prevent big gaps between sections in resulting executable }
-     s:='ld -z max-page-size=0x1000 -z common-page-size=0x1000 -z noexecstack -z now --build-id $OPT -L. -T $RES -o $EXE';
+     s:='ld -z max-page-size=0x1000 -z common-page-size=0x1000 -z noexecstack -z now -z relro --build-id $OPT -L. -T $RES -o $EXE';
      ExeCmd[1]:=s + ' --entry=_start';
      ExeCmd[1]:=s + ' --entry=_start';
      DllCmd[1]:=s + ' -shared -soname $SONAME';
      DllCmd[1]:=s + ' -shared -soname $SONAME';
      DllCmd[2]:='strip --strip-unneeded $EXE';
      DllCmd[2]:='strip --strip-unneeded $EXE';
@@ -354,7 +354,7 @@ begin
       add('    KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
       add('    KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
       add('  }');
       add('  }');
       add('}');
       add('}');
-      add('INSERT BEFORE .data1');
+      add('INSERT AFTER .data1');
 
 
       // Define different aliases for normal and JNI libraries
       // Define different aliases for normal and JNI libraries
       if FJNIOnLoadName <> '' then
       if FJNIOnLoadName <> '' then