mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 07:34:28 +02:00
* section smartlink for win32 added, disabled by default because ld.exe
ignores the --gc-sections for pe-i38 git-svn-id: trunk@2305 -
This commit is contained in:
parent
2ee18b3d8c
commit
abc49206fc
@ -2117,6 +2117,11 @@ begin
|
||||
if target_info.system=system_arm_wince then
|
||||
include(initmoduleswitches,cs_fp_emulation);
|
||||
|
||||
{ Section smartlinking conflicts with import sections on Windows }
|
||||
if GenerateImportSection and
|
||||
(target_info.system in [system_i386_win32]) then
|
||||
exclude(target_info.flags,tf_smartlink_sections);
|
||||
|
||||
{$ifdef x86_64}
|
||||
{$warning HACK: turn off smartlinking}
|
||||
exclude(initmoduleswitches,cs_create_smart);
|
||||
|
@ -98,7 +98,7 @@ implementation
|
||||
|
||||
{ Also create a smartlinked version ? }
|
||||
if (cs_create_smart in aktmoduleswitches) and
|
||||
not(af_smartlink_sections in target_asm.flags) then
|
||||
(not use_smartlink_section) then
|
||||
begin
|
||||
{ regenerate the importssection for win32 }
|
||||
if assigned(asmlist[al_imports]) and
|
||||
|
@ -32,7 +32,8 @@ unit i_win;
|
||||
system : system_i386_WIN32;
|
||||
name : 'Win32 for i386';
|
||||
shortname : 'Win32';
|
||||
flags : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses{,tf_section_threadvars}];
|
||||
flags : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses
|
||||
{,tf_smartlink_sections}{,tf_section_threadvars}];
|
||||
cpu : cpu_i386;
|
||||
unit_env : 'WIN32UNITS';
|
||||
extradefines : 'MSWINDOWS;WINDOWS';
|
||||
|
@ -898,8 +898,8 @@ begin
|
||||
{$else ARM}
|
||||
targetopts:='-b pe-i386 -m i386pe';
|
||||
{$endif ARM}
|
||||
ExeCmd[1]:='ld '+targetopts+' $OPT $STRIP $APPTYPE $IMAGEBASE $RELOC -o $EXE $RES';
|
||||
DllCmd[1]:='ld '+targetopts+' $OPT $STRIP --dll $APPTYPE $IMAGEBASE $RELOC -o $EXE $RES';
|
||||
ExeCmd[1]:='ld '+targetopts+' $OPT $GCSECTIONS $STRIP $APPTYPE $IMAGEBASE $RELOC -o $EXE $RES';
|
||||
DllCmd[1]:='ld '+targetopts+' $OPT $GCSECTIONS $STRIP --dll $APPTYPE $IMAGEBASE $RELOC -o $EXE $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';
|
||||
@ -1036,6 +1036,7 @@ var
|
||||
success : boolean;
|
||||
cmds,i : longint;
|
||||
AsBinStr : string[80];
|
||||
GCSectionsStr,
|
||||
StripStr,
|
||||
RelocStr,
|
||||
AppTypeStr,
|
||||
@ -1049,9 +1050,13 @@ begin
|
||||
AppTypeStr:='';
|
||||
ImageBaseStr:='';
|
||||
StripStr:='';
|
||||
GCSectionsStr:='';
|
||||
AsBinStr:=FindUtil(utilsprefix+'as');
|
||||
if RelocSection then
|
||||
RelocStr:='--base-file base.$$$';
|
||||
if (af_smartlink_sections in target_asm.flags) and
|
||||
(tf_smartlink_sections in target_info.flags) then
|
||||
GCSectionsStr:='--gc-sections';
|
||||
if target_info.system in [system_arm_wince,system_i386_wince] then
|
||||
begin
|
||||
AppTypeStr:='--subsystem wince';
|
||||
@ -1087,6 +1092,7 @@ begin
|
||||
Replace(cmdstr,'$ASBIN',AsbinStr);
|
||||
Replace(cmdstr,'$RELOC',RelocStr);
|
||||
Replace(cmdstr,'$IMAGEBASE',ImageBaseStr);
|
||||
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
|
||||
Replace(cmdstr,'$STRIP',StripStr);
|
||||
if not DefFile.Empty then
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user