From 2bdfabe6076c625135525bf5a55909aae4ce4b91 Mon Sep 17 00:00:00 2001 From: Karoly Balogh Date: Mon, 23 Sep 2024 11:36:53 +0200 Subject: [PATCH] windows: fix external linking with binutils >= 2.36, based on a patch by Pierre Muller --- compiler/systems/t_win.pas | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/compiler/systems/t_win.pas b/compiler/systems/t_win.pas index 554cd99760..67d44f8ba2 100644 --- a/compiler/systems/t_win.pas +++ b/compiler/systems/t_win.pas @@ -1157,15 +1157,15 @@ implementation {$ifdef arm} targetopts:='-m arm_wince_pe'; {$endif arm} - ExeCmd[1]:='ld '+targetopts+' $OPT $GCSECTIONS $MAP $STRIP $APPTYPE $ENTRY $IMAGEBASE $RELOC -o $EXE $RES'; - DllCmd[1]:='ld '+targetopts+' $OPT $GCSECTIONS $MAP $STRIP --dll $APPTYPE $ENTRY $IMAGEBASE $RELOC -o $EXE $RES'; + ExeCmd[1]:='ld '+targetopts+' $OPT $GCSECTIONS $MAP $STRIP $APPTYPE $ENTRY $IMAGEBASE $RELOC -o $EXE -T $RES'; + DllCmd[1]:='ld '+targetopts+' $OPT $GCSECTIONS $MAP $STRIP --dll $APPTYPE $ENTRY $IMAGEBASE $RELOC -o $EXE -T $RES'; { ExeCmd[2]:='dlltool --as $ASBIN --dllname $EXE --output-exp exp.$$$ $RELOC $DEF'; use short forms to avoid 128 char limitation problem } ExeCmd[2]:='dlltool -S $ASBIN -D $EXE -e exp.$$$ $RELOC $DEF'; - ExeCmd[3]:='ld '+targetopts+' $OPT $STRIP $APPTYPE $ENTRY $IMAGEBASE -o $EXE $RES exp.$$$'; + ExeCmd[3]:='ld '+targetopts+' $OPT $STRIP $APPTYPE $ENTRY $IMAGEBASE -o $EXE -T $RES exp.$$$'; { DllCmd[2]:='dlltool --as $ASBIN --dllname $EXE --output-exp exp.$$$ $RELOC $DEF'; } DllCmd[2]:='dlltool -S $ASBIN -D $EXE -e exp.$$$ $RELOC $DEF'; - DllCmd[3]:='ld '+targetopts+' $OPT $STRIP --dll $APPTYPE $ENTRY $IMAGEBASE -o $EXE $RES exp.$$$'; + DllCmd[3]:='ld '+targetopts+' $OPT $STRIP --dll $APPTYPE $ENTRY $IMAGEBASE -o $EXE -T $RES exp.$$$'; end; end; @@ -1362,6 +1362,7 @@ implementation Add(' ___crt_xt_start__ = . ;'); Add(' *(SORT(.CRT$XT*)) /* Termination */'); Add(' ___crt_xt_end__ = . ;'); + Add(' . = . ; /* This forces GNU linker to keep the section even if it is empty */'); Add(' }'); Add(' .tls BLOCK(__section_alignment__) :'); Add(' {'); @@ -1370,6 +1371,7 @@ implementation Add(' *(.tls$)'); Add(' *(SORT(.tls$*))'); Add(' ___tls_end__ = . ;'); + Add(' . = . ; /* This forces GNU linker to keep the section even if it is empty */'); Add(' }'); Add(' .rsrc BLOCK(__section_alignment__) :'); Add(' {');