diff options
Diffstat (limited to 'avx512-0037785/compiler/systems')
-rw-r--r-- | avx512-0037785/compiler/systems/i_linux.pas | 4 | ||||
-rw-r--r-- | avx512-0037785/compiler/systems/i_macos.pas | 6 | ||||
-rw-r--r-- | avx512-0037785/compiler/systems/i_sinclairql.pas | 107 | ||||
-rw-r--r-- | avx512-0037785/compiler/systems/i_win.pas | 2 | ||||
-rw-r--r-- | avx512-0037785/compiler/systems/t_amiga.pas | 14 | ||||
-rw-r--r-- | avx512-0037785/compiler/systems/t_atari.pas | 7 | ||||
-rw-r--r-- | avx512-0037785/compiler/systems/t_embed.pas | 153 | ||||
-rw-r--r-- | avx512-0037785/compiler/systems/t_linux.pas | 793 | ||||
-rw-r--r-- | avx512-0037785/compiler/systems/t_msdos.pas | 10 | ||||
-rw-r--r-- | avx512-0037785/compiler/systems/t_sinclairql.pas | 402 | ||||
-rw-r--r-- | avx512-0037785/compiler/systems/t_win16.pas | 2 | ||||
-rw-r--r-- | avx512-0037785/compiler/systems/t_zxspectrum.pas | 10 |
12 files changed, 580 insertions, 930 deletions
diff --git a/avx512-0037785/compiler/systems/i_linux.pas b/avx512-0037785/compiler/systems/i_linux.pas index 3ff8669aa0..5c0313999c 100644 --- a/avx512-0037785/compiler/systems/i_linux.pas +++ b/avx512-0037785/compiler/systems/i_linux.pas @@ -187,7 +187,7 @@ unit i_linux; unit_env : 'LINUXUNITS'; extradefines : 'UNIX;HASUNIX'; exeext : ''; - defext : ''; + defext : '.def'; scriptext : '.sh'; smartext : '.sl'; unitext : '.ppu'; @@ -442,7 +442,7 @@ unit i_linux; constalignmin : 0; constalignmax : 16; varalignmin : 0; - varalignmax : 16; + varalignmax : 64; localalignmin : 4; localalignmax : 16; recordalignmin : 0; diff --git a/avx512-0037785/compiler/systems/i_macos.pas b/avx512-0037785/compiler/systems/i_macos.pas index 7e4759c6c5..61e21688e6 100644 --- a/avx512-0037785/compiler/systems/i_macos.pas +++ b/avx512-0037785/compiler/systems/i_macos.pas @@ -129,9 +129,9 @@ unit i_macos; dirsep : ':'; assem : as_gas; assemextern : as_gas; - link : ld_none; - linkextern : ld_none; - ar : ar_gnu_ar; + link : ld_mpw; + linkextern : ld_mpw; + ar : ar_mpw_ar; res : res_none; dbg : dbg_stabs; script : script_mpw; diff --git a/avx512-0037785/compiler/systems/i_sinclairql.pas b/avx512-0037785/compiler/systems/i_sinclairql.pas new file mode 100644 index 0000000000..df98301482 --- /dev/null +++ b/avx512-0037785/compiler/systems/i_sinclairql.pas @@ -0,0 +1,107 @@ +{ + Copyright (c) 2020 by Karoly Balogh + + This unit implements support information structures for the Sinclair QL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + **************************************************************************** +} +{ This unit implements support information structures for the Sinclair QL. } +unit i_sinclairql; + +{$i fpcdefs.inc} + + interface + + uses + systems; + + const + system_m68k_sinclairql_info : tsysteminfo = + ( + system : system_m68k_sinclairql; + name : 'Sinclair QL'; + shortname : 'sinclairql'; + flags : [tf_use_8_3,tf_requires_proper_alignment, + tf_smartlink_sections,tf_under_development]; + cpu : cpu_m68k; + unit_env : ''; + extradefines : ''; + exeext : '.exe'; + defext : ''; + scriptext : ''; + smartext : '.sl'; + unitext : '.ppu'; + unitlibext : '.ppl'; + asmext : '.s'; + objext : '.o'; + resext : '.res'; + resobjext : '.or'; + sharedlibext : '.dll'; + staticlibext : '.a'; + staticlibprefix : ''; + sharedlibprefix : ''; + sharedClibext : '.dll'; + staticClibext : '.a'; + staticClibprefix : 'lib'; + sharedClibprefix : ''; + importlibprefix : 'libimp'; + importlibext : '.a'; + Cprefix : '_'; + newline : #10; + dirsep : '/'; { ... the underlying tools (binutils/vlink/vasm) prefer Unix paths } + assem : as_m68k_vasm; + assemextern : as_m68k_vasm; + link : ld_none; + linkextern : ld_sinclairql; + ar : ar_gnu_ar; + res : res_ext; + dbg : dbg_stabs; + script : script_unix; + endian : endian_big; + alignment : + ( + procalign : 4; + loopalign : 4; + jumpalign : 0; + jumpalignskipmax : 0; + coalescealign : 0; + coalescealignskipmax: 0; + constalignmin : 0; + constalignmax : 4; + varalignmin : 0; + varalignmax : 4; + localalignmin : 0; + localalignmax : 4; + recordalignmin : 0; + recordalignmax : 2; + maxCrecordalign : 4 + ); + first_parm_offset : 8; + stacksize : 8192; + stackalign : 2; + abi : abi_default; + llvmdatalayout : 'todo'; + ); + + implementation + +initialization +{$ifdef cpu68} + {$ifdef atari} + set_source_info(system_m68k_sinclairql_info); + {$endif atari} +{$endif cpu68} +end. diff --git a/avx512-0037785/compiler/systems/i_win.pas b/avx512-0037785/compiler/systems/i_win.pas index d4e8f842d5..e5f77c37c3 100644 --- a/avx512-0037785/compiler/systems/i_win.pas +++ b/avx512-0037785/compiler/systems/i_win.pas @@ -157,7 +157,7 @@ unit i_win; constalignmin : 0; constalignmax : 16; varalignmin : 0; - varalignmax : 16; + varalignmax : 64; localalignmin : 4; localalignmax : 16; recordalignmin : 0; diff --git a/avx512-0037785/compiler/systems/t_amiga.pas b/avx512-0037785/compiler/systems/t_amiga.pas index e094f8933c..8efdd79a57 100644 --- a/avx512-0037785/compiler/systems/t_amiga.pas +++ b/avx512-0037785/compiler/systems/t_amiga.pas @@ -82,7 +82,7 @@ begin end else begin - ExeCmd[1]:='vlink -b amigahunk $GCSECTIONS $OPT $STRIP -o $EXE -T $RES'; + ExeCmd[1]:='vlink -b amigahunk -e_start $MAP $GCSECTIONS $OPT $STRIP -o $EXE -T $RES'; end; end; end; @@ -97,7 +97,7 @@ begin end else begin - ExeCmd[1]:='vlink -q -n -b elf32amigaos -P_start -P__amigaos4__ -nostdlib $GCSECTIONS $OPT $STRIP -o $EXE -T $RES'; + ExeCmd[1]:='vlink -q -n -b elf32amigaos -P_start -P__amigaos4__ -nostdlib $MAP $GCSECTIONS $OPT $STRIP -o $EXE -T $RES'; end; end; end; @@ -349,11 +349,15 @@ var StripStr: string[40]; DynLinkStr : string; GCSectionsStr : string; + MapStr: string; begin StripStr:=''; GCSectionsStr:=''; DynLinkStr:=''; + MapStr:=''; + if UseVlink and (cs_link_map in current_settings.globalswitches) then + MapStr:='-M'+Unix2AmigaPath(maybequoted(ScriptFixFilename(current_module.mapfilename))); if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; if rlinkpath<>'' Then @@ -370,6 +374,7 @@ begin Replace(cmdstr,'$OPT',Info.ExtraOptions); Replace(cmdstr,'$EXE',Unix2AmigaPath(maybequoted(ScriptFixFileName(current_module.exefilename)))); Replace(cmdstr,'$RES',Unix2AmigaPath(maybequoted(ScriptFixFileName(outputexedir+Info.ResName)))); + Replace(cmdstr,'$MAP',MapStr); Replace(cmdstr,'$STRIP',StripStr); Replace(cmdstr,'$GCSECTIONS',GCSectionsStr); Replace(cmdstr,'$DYNLINK',DynLinkStr); @@ -385,11 +390,15 @@ var StripStr: string[40]; DynLinkStr : string; GCSectionsStr : string; + MapStr: string; begin StripStr:=''; GCSectionsStr:=''; DynLinkStr:=''; + MapStr:=''; + if UseVlink and (cs_link_map in current_settings.globalswitches) then + MapStr:='-M'+Unix2AmigaPath(maybequoted(ScriptFixFilename(current_module.mapfilename))); if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; if rlinkpath<>'' Then @@ -406,6 +415,7 @@ begin Replace(cmdstr,'$OPT',Info.ExtraOptions); Replace(cmdstr,'$EXE',Unix2AmigaPath(maybequoted(ScriptFixFileName(current_module.exefilename)))); Replace(cmdstr,'$RES',Unix2AmigaPath(maybequoted(ScriptFixFileName(outputexedir+Info.ResName)))); + Replace(cmdstr,'$MAP',MapStr); Replace(cmdstr,'$STRIP',StripStr); Replace(cmdstr,'$GCSECTIONS',GCSectionsStr); Replace(cmdstr,'$DYNLINK',DynLinkStr); diff --git a/avx512-0037785/compiler/systems/t_atari.pas b/avx512-0037785/compiler/systems/t_atari.pas index 5eb2366de0..0cf5e3359a 100644 --- a/avx512-0037785/compiler/systems/t_atari.pas +++ b/avx512-0037785/compiler/systems/t_atari.pas @@ -73,7 +73,7 @@ begin end else begin - ExeCmd[1]:='vlink -b ataritos $FLAGS $GCSECTIONS $OPT $STRIP -o $EXE -T $RES'; + ExeCmd[1]:='vlink -b ataritos $FLAGS $GCSECTIONS $OPT $STRIP $MAP -o $EXE -T $RES'; end; end; end; @@ -215,13 +215,17 @@ var DynLinkStr : string; GCSectionsStr : string; FlagsStr : string; + MapStr: string; ExeName: string; begin StripStr:=''; GCSectionsStr:=''; DynLinkStr:=''; + MapStr:=''; FlagsStr:='-tos-flags fastload,fastram'; + if UseVlink and (cs_link_map in current_settings.globalswitches) then + MapStr:='-M'+maybequoted(ScriptFixFileName(current_module.mapfilename)); if (cs_link_strip in current_settings.globalswitches) then StripStr:='-s'; if rlinkpath<>'' then @@ -242,6 +246,7 @@ begin Replace(cmdstr,'$OPT',Info.ExtraOptions); Replace(cmdstr,'$EXE',maybequoted(ScriptFixFileName(ExeName))); Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName))); + Replace(cmdstr,'$MAP',MapStr); Replace(cmdstr,'$FLAGS',FlagsStr); Replace(cmdstr,'$STRIP',StripStr); Replace(cmdstr,'$GCSECTIONS',GCSectionsStr); diff --git a/avx512-0037785/compiler/systems/t_embed.pas b/avx512-0037785/compiler/systems/t_embed.pas index f4728d8932..a6e4b684f2 100644 --- a/avx512-0037785/compiler/systems/t_embed.pas +++ b/avx512-0037785/compiler/systems/t_embed.pas @@ -1664,159 +1664,8 @@ end; function TLinkerEmbedded.postprocessexecutable(const fn : string;isdll:boolean):boolean; - type - TElf32header=packed record - magic0123 : longint; - file_class : byte; - data_encoding : byte; - file_version : byte; - padding : array[$07..$0f] of byte; - - e_type : word; - e_machine : word; - e_version : longint; - e_entry : longint; { entrypoint } - e_phoff : longint; { program header offset } - - e_shoff : longint; { sections header offset } - e_flags : longint; - e_ehsize : word; { elf header size in bytes } - e_phentsize : word; { size of an entry in the program header array } - e_phnum : word; { 0..e_phnum-1 of entrys } - e_shentsize : word; { size of an entry in sections header array } - e_shnum : word; { 0..e_shnum-1 of entrys } - e_shstrndx : word; { index of string section header } - end; - TElf32sechdr=packed record - sh_name : longint; - sh_type : longint; - sh_flags : longint; - sh_addr : longint; - - sh_offset : longint; - sh_size : longint; - sh_link : longint; - sh_info : longint; - - sh_addralign : longint; - sh_entsize : longint; - end; - - function MayBeSwapHeader(h : telf32header) : telf32header; - begin - result:=h; - if source_info.endian<>target_info.endian then - with h do - begin - result.e_type:=swapendian(e_type); - result.e_machine:=swapendian(e_machine); - result.e_version:=swapendian(e_version); - result.e_entry:=swapendian(e_entry); - result.e_phoff:=swapendian(e_phoff); - result.e_shoff:=swapendian(e_shoff); - result.e_flags:=swapendian(e_flags); - result.e_ehsize:=swapendian(e_ehsize); - result.e_phentsize:=swapendian(e_phentsize); - result.e_phnum:=swapendian(e_phnum); - result.e_shentsize:=swapendian(e_shentsize); - result.e_shnum:=swapendian(e_shnum); - result.e_shstrndx:=swapendian(e_shstrndx); - end; - end; - - function MaybeSwapSecHeader(h : telf32sechdr) : telf32sechdr; - begin - result:=h; - if source_info.endian<>target_info.endian then - with h do - begin - result.sh_name:=swapendian(sh_name); - result.sh_type:=swapendian(sh_type); - result.sh_flags:=swapendian(sh_flags); - result.sh_addr:=swapendian(sh_addr); - result.sh_offset:=swapendian(sh_offset); - result.sh_size:=swapendian(sh_size); - result.sh_link:=swapendian(sh_link); - result.sh_info:=swapendian(sh_info); - result.sh_addralign:=swapendian(sh_addralign); - result.sh_entsize:=swapendian(sh_entsize); - end; - end; - - var - f : file; - - function ReadSectionName(pos : longint) : String; - var - oldpos : longint; - c : char; - begin - oldpos:=filepos(f); - seek(f,pos); - Result:=''; - while true do - begin - blockread(f,c,1); - if c=#0 then - break; - Result:=Result+c; - end; - seek(f,oldpos); - end; - - var - elfheader : TElf32header; - secheader : TElf32sechdr; - i : longint; - stringoffset : longint; - secname : string; begin - postprocessexecutable:=false; - { open file } - assign(f,fn); - {$push}{$I-} - reset(f,1); - if ioresult<>0 then - Message1(execinfo_f_cant_open_executable,fn); - { read header } - blockread(f,elfheader,sizeof(tElf32header)); - elfheader:=MayBeSwapHeader(elfheader); - seek(f,elfheader.e_shoff); - { read string section header } - seek(f,elfheader.e_shoff+sizeof(TElf32sechdr)*elfheader.e_shstrndx); - blockread(f,secheader,sizeof(secheader)); - secheader:=MaybeSwapSecHeader(secheader); - stringoffset:=secheader.sh_offset; - - seek(f,elfheader.e_shoff); - status.datasize:=0; - for i:=0 to elfheader.e_shnum-1 do - begin - blockread(f,secheader,sizeof(secheader)); - secheader:=MaybeSwapSecHeader(secheader); - secname:=ReadSectionName(stringoffset+secheader.sh_name); - if secname='.text' then - begin - Message1(execinfo_x_codesize,tostr(secheader.sh_size)); - status.codesize:=secheader.sh_size; - end - else if secname='.data' then - begin - Message1(execinfo_x_initdatasize,tostr(secheader.sh_size)); - inc(status.datasize,secheader.sh_size); - end - else if secname='.bss' then - begin - Message1(execinfo_x_uninitdatasize,tostr(secheader.sh_size)); - inc(status.datasize,secheader.sh_size); - end; - - end; - close(f); - {$pop} - if ioresult<>0 then - ; - postprocessexecutable:=true; + Result:=PostProcessELFExecutable(fn,isdll); end; diff --git a/avx512-0037785/compiler/systems/t_linux.pas b/avx512-0037785/compiler/systems/t_linux.pas index 11fd7b103f..aab48cbcae 100644 --- a/avx512-0037785/compiler/systems/t_linux.pas +++ b/avx512-0037785/compiler/systems/t_linux.pas @@ -49,6 +49,7 @@ interface reorder : boolean; linklibc: boolean; Function WriteResponseFile(isdll:boolean) : Boolean; + function postprocessexecutable(const fn: string; isdll: boolean): boolean; public constructor Create;override; procedure SetDefaultInfo;override; @@ -686,768 +687,23 @@ begin else info.ExeCmd[1]:=info.ExeCmd[1]+' -e _start'; - { If we are using the default sysroot, use the default linker script and - just augment it with the FPC-specific parts. - } - if sysrootpath='' then - begin - add('SECTIONS'); - add('{'); - if not(cs_link_pre_binutils_2_19 in current_settings.globalswitches) then - { we can't use ".data", as that would hide the .data from the - original linker script in combination with the INSERT at the end } - add(' .fpcdata :') - else - add(' .data :'); - add(' {'); - add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))'); - add(' }'); - add(' .threadvar : { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }'); - add('}'); - { this "INSERT" means "merge into the original linker script, even if - -T is used" } - if not(cs_link_pre_binutils_2_19 in current_settings.globalswitches) then - add('INSERT AFTER .data;'); - end + add('SECTIONS'); + add('{'); + if not(cs_link_pre_binutils_2_19 in current_settings.globalswitches) then + { we can't use ".data", as that would hide the .data from the + original linker script in combination with the INSERT at the end } + add(' .fpcdata :') else - begin -{$ifdef x86_64} -{$define LINKERSCRIPT_INCLUDED} - add('SECTIONS'); - add('{'); - {Read-only sections, merged into text segment:} - if current_module.islibrary then - add(' . = 0 + SIZEOF_HEADERS;') - else - add(' PROVIDE (__executable_start = 0x0400000); . = 0x0400000 + SIZEOF_HEADERS;'); - add(' .interp : { *(.interp) }'); - add(' .hash : { *(.hash) }'); - add(' .dynsym : { *(.dynsym) }'); - add(' .dynstr : { *(.dynstr) }'); - add(' .gnu.version : { *(.gnu.version) }'); - add(' .gnu.version_d : { *(.gnu.version_d) }'); - add(' .gnu.version_r : { *(.gnu.version_r) }'); - add(' .rel.dyn :'); - add(' {'); - add(' *(.rel.init)'); - add(' *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)'); - add(' *(.rel.fini)'); - add(' *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)'); - add(' *(.rel.data.rel.ro*)'); - add(' *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)'); - add(' *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)'); - add(' *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)'); - add(' *(.rel.got)'); - add(' *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)'); - add(' }'); - add(' .rela.dyn :'); - add(' {'); - add(' *(.rela.init)'); - add(' *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)'); - add(' *(.rela.fini)'); - add(' *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)'); - add(' *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)'); - add(' *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)'); - add(' *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)'); - add(' *(.rela.got)'); - add(' *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)'); - add(' }'); - add(' .rel.plt : { *(.rel.plt) }'); - add(' .rela.plt : { *(.rela.plt) }'); - add(' .init :'); - add(' {'); - add(' KEEP (*(.init))'); - add(' } =0x90909090'); - add(' .plt : { *(.plt) }'); - add(' .text :'); - add(' {'); - add(' *(.text .stub .text.* .gnu.linkonce.t.*)'); - add(' KEEP (*(.text.*personality*))'); - {.gnu.warning sections are handled specially by elf32.em.} - add(' *(.gnu.warning)'); - add(' } =0x90909090'); - add(' .fini :'); - add(' {'); - add(' KEEP (*(.fini))'); - add(' } =0x90909090'); - add(' PROVIDE (_etext = .);'); - add(' .rodata :'); - add(' {'); - add(' *(.rodata .rodata.* .gnu.linkonce.r.*)'); - add(' }'); - {Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up.} - add(' . = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1));'); - add(' .dynamic : { *(.dynamic) }'); - add(' .got : { *(.got .toc) }'); - add(' .got.plt : { *(.got.plt .toc.plt) }'); - add(' .data :'); - add(' {'); - add(' *(.data .data.* .gnu.linkonce.d.*)'); - add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))'); - add(' KEEP (*(.gnu.linkonce.d.*personality*))'); - add(' }'); - add(' PROVIDE (_edata = .);'); - add(' PROVIDE (edata = .);'); - {$ifdef zsegment_threadvars} - add(' _z = .;'); - add(' .threadvar 0 : AT (_z) { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }'); - add(' PROVIDE (_threadvar_size = SIZEOF(.threadvar));'); - add(' . = _z + SIZEOF (.threadvar);'); - {$else} - add(' .threadvar : { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }'); - {$endif} - add(' __bss_start = .;'); - add(' .bss :'); - add(' {'); - add(' *(.dynbss)'); - add(' *(.bss .bss.* .gnu.linkonce.b.*)'); - add(' *(COMMON)'); - {Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections.} - add(' . = ALIGN(32 / 8);'); - add('}'); - add(' . = ALIGN(32 / 8);'); - add(' PROVIDE (_end = .);'); - add(' PROVIDE (end = .);'); - {Stabs debugging sections.} - add(' .stab 0 : { *(.stab) }'); - add(' .stabstr 0 : { *(.stabstr) }'); - add(' /* DWARF debug sections.'); - add(' Symbols in the DWARF debugging sections are relative to the beginning'); - add(' of the section so we begin them at 0. */'); - add(' /* DWARF 1 */'); - add(' .debug 0 : { *(.debug) }'); - add(' .line 0 : { *(.line) }'); - add(' /* GNU DWARF 1 extensions */'); - add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }'); - add(' .debug_sfnames 0 : { *(.debug_sfnames) }'); - add(' /* DWARF 1.1 and DWARF 2 */'); - add(' .debug_aranges 0 : { *(.debug_aranges) }'); - add(' .debug_pubnames 0 : { *(.debug_pubnames) }'); - add(' /* DWARF 2 */'); - add(' .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }'); - add(' .debug_abbrev 0 : { *(.debug_abbrev) }'); - add(' .debug_line 0 : { *(.debug_line) }'); - add(' .debug_frame 0 : { *(.debug_frame) }'); - add(' .debug_str 0 : { *(.debug_str) }'); - add(' .debug_loc 0 : { *(.debug_loc) }'); - add(' .debug_macinfo 0 : { *(.debug_macinfo) }'); - add(' /* SGI/MIPS DWARF 2 extensions */'); - add(' .debug_weaknames 0 : { *(.debug_weaknames) }'); - add(' .debug_funcnames 0 : { *(.debug_funcnames) }'); - add(' .debug_typenames 0 : { *(.debug_typenames) }'); - add(' .debug_varnames 0 : { *(.debug_varnames) }'); - add(' /DISCARD/ : { *(.note.GNU-stack) }'); - add('}'); -{$endif x86_64} - -{$ifdef AArch64} -{$define LINKERSCRIPT_INCLUDED} - { Complete linker script for aarch64-linux: } - add('SECTIONS'); - add('{'); - add(' /* Read-only sections, merged into text segment: */'); - add(' PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS;'); - add(' .interp : { *(.interp) }'); - add(' .note.gnu.build-id : { *(.note.gnu.build-id) }'); - add(' .hash : { *(.hash) }'); - add(' .gnu.hash : { *(.gnu.hash) }'); - add(' .dynsym : { *(.dynsym) }'); - add(' .dynstr : { *(.dynstr) }'); - add(' .gnu.version : { *(.gnu.version) }'); - add(' .gnu.version_d : { *(.gnu.version_d) }'); - add(' .gnu.version_r : { *(.gnu.version_r) }'); - add(' .rela.dyn :'); - add(' {'); - add(' *(.rela.init)'); - add(' *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)'); - add(' *(.rela.fini)'); - add(' *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)'); - add(' *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)'); - add(' *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)'); - add(' *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)'); - add(' *(.rela.ctors)'); - add(' *(.rela.dtors)'); - add(' *(.rela.got)'); - add(' *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)'); - add(' *(.rela.ifunc)'); - add(' }'); - add(' .rela.plt :'); - add(' {'); - add(' *(.rela.plt)'); - add(' PROVIDE_HIDDEN (__rela_iplt_start = .);'); - add(' *(.rela.iplt)'); - add(' PROVIDE_HIDDEN (__rela_iplt_end = .);'); - add(' }'); - add(' .init :'); - add(' {'); - add(' KEEP (*(SORT_NONE(.init)))'); - add(' } =0'); - add(' .plt : ALIGN(16) { *(.plt) *(.iplt) }'); - add(' .text :'); - add(' {'); - add(' *(.text.unlikely .text.*_unlikely .text.unlikely.*)'); - add(' *(.text.exit .text.exit.*)'); - add(' *(.text.startup .text.startup.*)'); - add(' *(.text.hot .text.hot.*)'); - add(' *(.text .stub .text.* .gnu.linkonce.t.*)'); - add(' /* .gnu.warning sections are handled specially by elf32.em. */'); - add(' *(.gnu.warning)'); - add(' } =0'); - add(' .fini :'); - add(' {'); - add(' KEEP (*(SORT_NONE(.fini)))'); - add(' } =0'); - add(' PROVIDE (__etext = .);'); - add(' PROVIDE (_etext = .);'); - add(' PROVIDE (etext = .);'); - add(' .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }'); - add(' .rodata1 : { *(.rodata1) }'); - add(' .eh_frame_hdr : { *(.eh_frame_hdr) }'); - add(' .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }'); - add(' .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table'); - add(' .gcc_except_table.*) }'); - add(' /* These sections are generated by the Sun/Oracle C++ compiler. */'); - add(' .exception_ranges : ONLY_IF_RO { *(.exception_ranges'); - add(' .exception_ranges*) }'); - add(' /* Adjust the address for the data segment. We want to adjust up to'); - add(' the same address within the page on the next page up. */'); - add(' . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));'); - add(' /* Exception handling */'); - add(' .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }'); - add(' .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }'); - add(' .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }'); - add(' /* Thread Local Storage sections */'); - add(' .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }'); - add(' .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }'); - add(' .preinit_array :'); - add(' {'); - add(' PROVIDE_HIDDEN (__preinit_array_start = .);'); - add(' KEEP (*(.preinit_array))'); - add(' PROVIDE_HIDDEN (__preinit_array_end = .);'); - add(' }'); - add(' .init_array :'); - add(' {'); - add(' PROVIDE_HIDDEN (__init_array_start = .);'); - add(' KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))'); - add(' KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))'); - add(' PROVIDE_HIDDEN (__init_array_end = .);'); - add(' }'); - add(' .fini_array :'); - add(' {'); - add(' PROVIDE_HIDDEN (__fini_array_start = .);'); - add(' KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))'); - add(' KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))'); - add(' PROVIDE_HIDDEN (__fini_array_end = .);'); - add(' }'); - add(' .ctors :'); - add(' {'); - add(' /* gcc uses crtbegin.o to find the start of'); - add(' the constructors, so we make sure it is'); - add(' first. Because this is a wildcard, it'); - add(' doesn''t matter if the user does not'); - add(' actually link against crtbegin.o; the'); - add(' linker won''t look for a file to match a'); - add(' wildcard. The wildcard also means that it'); - add(' doesn''t matter which directory crtbegin.o'); - add(' is in. */'); - add(' KEEP (*crtbegin.o(.ctors))'); - add(' KEEP (*crtbegin?.o(.ctors))'); - add(' /* We don''t want to include the .ctor section from'); - add(' the crtend.o file until after the sorted ctors.'); - add(' The .ctor section from the crtend file contains the'); - add(' end of ctors marker and it must be last */'); - add(' KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))'); - add(' KEEP (*(SORT(.ctors.*)))'); - add(' KEEP (*(.ctors))'); - add(' }'); - add(' .dtors :'); - add(' {'); - add(' KEEP (*crtbegin.o(.dtors))'); - add(' KEEP (*crtbegin?.o(.dtors))'); - add(' KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))'); - add(' KEEP (*(SORT(.dtors.*)))'); - add(' KEEP (*(.dtors))'); - add(' }'); - add(' .jcr : { KEEP (*(.jcr)) }'); - add(' .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }'); - add(' .dynamic : { *(.dynamic) }'); - add(' .got : { *(.got) *(.igot) }'); - add(' . = DATA_SEGMENT_RELRO_END (24, .);'); - add(' .got.plt : { *(.got.plt) *(.igot.plt) }'); - add(' .data :'); - add(' {'); - add(' PROVIDE (__data_start = .);'); - - { extra by FPC } - add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))'); - - add(' *(.data .data.* .gnu.linkonce.d.*)'); - add(' SORT(CONSTRUCTORS)'); - add(' }'); - add(' .data1 : { *(.data1) }'); - add(' _edata = .; PROVIDE (edata = .);'); - add(' . = .;'); - add(' __bss_start = .;'); - add(' __bss_start__ = .;'); - add(' .bss :'); - add(' {'); - add(' *(.dynbss)'); - add(' *(.bss .bss.* .gnu.linkonce.b.*)'); - add(' *(COMMON)'); - add(' /* Align here to ensure that the .bss section occupies space up to'); - add(' _end. Align after .bss to ensure correct alignment even if the'); - add(' .bss section disappears because there are no input sections.'); - add(' FIXME: Why do we need it? When there is no .bss section, we don''t'); - add(' pad the .data section. */'); - add(' . = ALIGN(. != 0 ? 64 / 8 : 1);'); - add(' }'); - add(' _bss_end__ = . ; __bss_end__ = . ;'); - add(' . = ALIGN(64 / 8);'); - add(' . = SEGMENT_START("ldata-segment", .);'); - add(' . = ALIGN(64 / 8);'); - add(' __end__ = . ;'); - add(' _end = .; PROVIDE (end = .);'); - add(' . = DATA_SEGMENT_END (.);'); - add(' /* Stabs debugging sections. */'); - add(' .stab 0 : { *(.stab) }'); - add(' .stabstr 0 : { *(.stabstr) }'); - add(' .stab.excl 0 : { *(.stab.excl) }'); - add(' .stab.exclstr 0 : { *(.stab.exclstr) }'); - add(' .stab.index 0 : { *(.stab.index) }'); - add(' .stab.indexstr 0 : { *(.stab.indexstr) }'); - add(' .comment 0 : { *(.comment) }'); - add(' /* DWARF debug sections.'); - add(' Symbols in the DWARF debugging sections are relative to the beginning'); - add(' of the section so we begin them at 0. */'); - add(' /* DWARF 1 */'); - add(' .debug 0 : { *(.debug) }'); - add(' .line 0 : { *(.line) }'); - add(' /* GNU DWARF 1 extensions */'); - add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }'); - add(' .debug_sfnames 0 : { *(.debug_sfnames) }'); - add(' /* DWARF 1.1 and DWARF 2 */'); - add(' .debug_aranges 0 : { *(.debug_aranges) }'); - add(' .debug_pubnames 0 : { *(.debug_pubnames) }'); - add(' /* DWARF 2 */'); - add(' .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }'); - add(' .debug_abbrev 0 : { *(.debug_abbrev) }'); - add(' .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }'); - add(' .debug_frame 0 : { *(.debug_frame) }'); - add(' .debug_str 0 : { *(.debug_str) }'); - add(' .debug_loc 0 : { *(.debug_loc) }'); - add(' .debug_macinfo 0 : { *(.debug_macinfo) }'); - add(' /* SGI/MIPS DWARF 2 extensions */'); - add(' .debug_weaknames 0 : { *(.debug_weaknames) }'); - add(' .debug_funcnames 0 : { *(.debug_funcnames) }'); - add(' .debug_typenames 0 : { *(.debug_typenames) }'); - add(' .debug_varnames 0 : { *(.debug_varnames) }'); - add(' /* DWARF 3 */'); - add(' .debug_pubtypes 0 : { *(.debug_pubtypes) }'); - add(' .debug_ranges 0 : { *(.debug_ranges) }'); - add(' /* DWARF Extension. */'); - add(' .debug_macro 0 : { *(.debug_macro) }'); - add(' .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }'); - add(' .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'); - add(' /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }'); - add('}'); -{$endif AArch64} - -{$ifdef ARM} - if target_info.abi in [abi_eabi,abi_eabihf] then - begin - { from GNU ld (CodeSourcery Sourcery G++ Lite 2007q3-53) 2.18.50.20070820 } - add('/* Script for -z combreloc: combine and sort reloc sections */'); - add('OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm",'); - add(' "elf32-littlearm")'); - add('OUTPUT_ARCH(arm)'); - add('SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); SEARCH_DIR("=/usr/lib");'); - add('SECTIONS'); - add('{'); - add(' /* Read-only sections, merged into text segment: */'); - add(' PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x10000)); . = SEGMENT_START("text-segment", 0x10000) + SIZEOF_HEADERS;'); - add(' .interp : { *(.interp) }'); - add(' .note.gnu.build-id : { *(.note.gnu.build-id) }'); - add(' .hash : { *(.hash) }'); - add(' .gnu.hash : { *(.gnu.hash) }'); - add(' .dynsym : { *(.dynsym) }'); - add(' .dynstr : { *(.dynstr) }'); - add(' .gnu.version : { *(.gnu.version) }'); - add(' .gnu.version_d : { *(.gnu.version_d) }'); - add(' .gnu.version_r : { *(.gnu.version_r) }'); - add(' .rel.dyn :'); - add(' {'); - add(' *(.rel.init)'); - add(' *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)'); - add(' *(.rel.fini)'); - add(' *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)'); - add(' *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*)'); - add(' *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)'); - add(' *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)'); - add(' *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)'); - add(' *(.rel.ctors)'); - add(' *(.rel.dtors)'); - add(' *(.rel.got)'); - add(' *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)'); - add(' }'); - add(' .rela.dyn :'); - add(' {'); - add(' *(.rela.init)'); - add(' *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)'); - add(' *(.rela.fini)'); - add(' *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)'); - add(' *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)'); - add(' *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)'); - add(' *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)'); - add(' *(.rela.ctors)'); - add(' *(.rela.dtors)'); - add(' *(.rela.got)'); - add(' *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)'); - add(' }'); - add(' .rel.plt : { *(.rel.plt) }'); - add(' .rela.plt : { *(.rela.plt) }'); - add(' .init :'); - add(' {'); - add(' KEEP (*(.init))'); - add(' } =0'); - add(' .plt : { *(.plt) }'); - add(' .text :'); - add(' {'); - add(' *(.text .stub .text.* .gnu.linkonce.t.*)'); - add(' KEEP (*(.text.*personality*))'); - add(' /* .gnu.warning sections are handled specially by elf32.em. */'); - add(' *(.gnu.warning)'); - add(' *(.glue_7t) *(.glue_7) *(.vfp11_veneer)'); - add(' } =0'); - add(' .fini :'); - add(' {'); - add(' KEEP (*(.fini))'); - add(' } =0'); - add(' PROVIDE (__etext = .);'); - add(' PROVIDE (_etext = .);'); - add(' PROVIDE (etext = .);'); - add(' .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }'); - add(' .rodata1 : { *(.rodata1) }'); - add(' .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) }'); - add(' __exidx_start = .;'); - add(' .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }'); - add(' __exidx_end = .;'); - add(' .eh_frame_hdr : { *(.eh_frame_hdr) }'); - add(' .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }'); - add(' .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) }'); - add(' /* Adjust the address for the data segment. We want to adjust up to'); - add(' the same address within the page on the next page up. */'); - add(' . = ALIGN(CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 1));'); - add(' /* Exception handling */'); - add(' .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }'); - add(' .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }'); - add(' /* Thread Local Storage sections */'); - add(' .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }'); - add(' .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }'); - add(' .preinit_array :'); - add(' {'); - add(' PROVIDE_HIDDEN (__preinit_array_start = .);'); - add(' KEEP (*(.preinit_array))'); - add(' PROVIDE_HIDDEN (__preinit_array_end = .);'); - add(' }'); - add(' .init_array :'); - add(' {'); - add(' PROVIDE_HIDDEN (__init_array_start = .);'); - add(' KEEP (*(SORT(.init_array.*)))'); - add(' KEEP (*(.init_array))'); - add(' PROVIDE_HIDDEN (__init_array_end = .);'); - add(' }'); - add(' .fini_array :'); - add(' {'); - add(' PROVIDE_HIDDEN (__fini_array_start = .);'); - add(' KEEP (*(.fini_array))'); - add(' KEEP (*(SORT(.fini_array.*)))'); - add(' PROVIDE_HIDDEN (__fini_array_end = .);'); - add(' }'); - add(' .ctors :'); - add(' {'); - add(' /* gcc uses crtbegin.o to find the start of'); - add(' the constructors, so we make sure it is'); - add(' first. Because this is a wildcard, it'); - add(' doesn''t matter if the user does not'); - add(' actually link against crtbegin.o; the'); - add(' linker won''t look for a file to match a'); - add(' wildcard. The wildcard also means that it'); - add(' doesn''t matter which directory crtbegin.o'); - add(' is in. */'); - add(' KEEP (*crtbegin.o(.ctors))'); - add(' KEEP (*crtbegin?.o(.ctors))'); - add(' /* We don''t want to include the .ctor section from'); - add(' the crtend.o file until after the sorted ctors.'); - add(' The .ctor section from the crtend file contains the'); - add(' end of ctors marker and it must be last */'); - add(' KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))'); - add(' KEEP (*(SORT(.ctors.*)))'); - add(' KEEP (*(.ctors))'); - add(' }'); - add(' .dtors :'); - add(' {'); - add(' KEEP (*crtbegin.o(.dtors))'); - add(' KEEP (*crtbegin?.o(.dtors))'); - add(' KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))'); - add(' KEEP (*(SORT(.dtors.*)))'); - add(' KEEP (*(.dtors))'); - add(' }'); - add(' .jcr : { KEEP (*(.jcr)) }'); - add(' .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) }'); - add(' .dynamic : { *(.dynamic) }'); - add(' .got : { *(.got.plt) *(.got) }'); - add(' .data :'); - add(' {'); - add(' __data_start = . ;'); - add(' *(.data .data.* .gnu.linkonce.d.*)'); - - { extra by FPC } - add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))'); - - add(' KEEP (*(.gnu.linkonce.d.*personality*))'); - add(' SORT(CONSTRUCTORS)'); - add(' }'); - add(' .data1 : { *(.data1) }'); - add(' _edata = .; PROVIDE (edata = .);'); - add(' __bss_start = .;'); - add(' __bss_start__ = .;'); - add(' .bss :'); - add(' {'); - add(' *(.dynbss)'); - add(' *(.bss .bss.* .gnu.linkonce.b.*)'); - add(' *(COMMON)'); - add(' /* Align here to ensure that the .bss section occupies space up to'); - add(' _end. Align after .bss to ensure correct alignment even if the'); - add(' .bss section disappears because there are no input sections.'); - add(' FIXME: Why do we need it? When there is no .bss section, we don''t'); - add(' pad the .data section. */'); - add(' . = ALIGN(. != 0 ? 32 / 8 : 1);'); - add(' }'); - add(' _bss_end__ = . ; __bss_end__ = . ;'); - add(' . = ALIGN(32 / 8);'); - add(' . = ALIGN(32 / 8);'); - add(' __end__ = . ;'); - add(' _end = .; PROVIDE (end = .);'); - add(' /* Stabs debugging sections. */'); - add(' .stab 0 : { *(.stab) }'); - add(' .stabstr 0 : { *(.stabstr) }'); - add(' .stab.excl 0 : { *(.stab.excl) }'); - add(' .stab.exclstr 0 : { *(.stab.exclstr) }'); - add(' .stab.index 0 : { *(.stab.index) }'); - add(' .stab.indexstr 0 : { *(.stab.indexstr) }'); - add(' .comment 0 : { *(.comment) }'); - add(' /* DWARF debug sections.'); - add(' Symbols in the DWARF debugging sections are relative to the beginning'); - add(' of the section so we begin them at 0. */'); - add(' /* DWARF 1 */'); - add(' .debug 0 : { *(.debug) }'); - add(' .line 0 : { *(.line) }'); - add(' /* GNU DWARF 1 extensions */'); - add(' .debug_srcinfo 0 : { *(.debug_srcinfo) }'); - add(' .debug_sfnames 0 : { *(.debug_sfnames) }'); - add(' /* DWARF 1.1 and DWARF 2 */'); - add(' .debug_aranges 0 : { *(.debug_aranges) }'); - add(' .debug_pubnames 0 : { *(.debug_pubnames) }'); - add(' /* DWARF 2 */'); - add(' .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }'); - add(' .debug_abbrev 0 : { *(.debug_abbrev) }'); - add(' .debug_line 0 : { *(.debug_line) }'); - add(' .debug_frame 0 : { *(.debug_frame) }'); - add(' .debug_str 0 : { *(.debug_str) }'); - add(' .debug_loc 0 : { *(.debug_loc) }'); - add(' .debug_macinfo 0 : { *(.debug_macinfo) }'); - add(' /* SGI/MIPS DWARF 2 extensions */'); - add(' .debug_weaknames 0 : { *(.debug_weaknames) }'); - add(' .debug_funcnames 0 : { *(.debug_funcnames) }'); - add(' .debug_typenames 0 : { *(.debug_typenames) }'); - add(' .debug_varnames 0 : { *(.debug_varnames) }'); - add(' /* DWARF 3 */'); - add(' .debug_pubtypes 0 : { *(.debug_pubtypes) }'); - add(' .debug_ranges 0 : { *(.debug_ranges) }'); - add(' .stack 0x80000 :'); - add(' {'); - add(' _stack = .;'); - add(' *(.stack)'); - add(' }'); - add(' .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) KEEP (*(.gnu.attributes)) }'); - add(' .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }'); - add(' /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }'); - add('}'); - end - else -{$endif ARM} - -{$ifndef LINKERSCRIPT_INCLUDED} - begin - {Sections.} - add('SECTIONS'); - add('{'); - {Read-only sections, merged into text segment:} - add(' PROVIDE (__executable_start = 0x010000); . = 0x010000 + SIZEOF_HEADERS;'); - add(' .interp : { *(.interp) }'); - add(' .hash : { *(.hash) }'); - add(' .dynsym : { *(.dynsym) }'); - add(' .dynstr : { *(.dynstr) }'); - add(' .gnu.version : { *(.gnu.version) }'); - add(' .gnu.version_d : { *(.gnu.version_d) }'); - add(' .gnu.version_r : { *(.gnu.version_r) }'); - add(' .rel.dyn :'); - add(' {'); - add(' *(.rel.init)'); - add(' *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)'); - add(' *(.rel.fini)'); - add(' *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)'); - add(' *(.rel.data.rel.ro*)'); - add(' *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)'); - add(' *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)'); - add(' *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)'); - add(' *(.rel.got)'); - add(' *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)'); - add(' }'); - add(' .rela.dyn :'); - add(' {'); - add(' *(.rela.init)'); - add(' *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)'); - add(' *(.rela.fini)'); - add(' *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)'); - add(' *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)'); - add(' *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)'); - add(' *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)'); - add(' *(.rela.got)'); - add(' *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)'); - add(' }'); - add(' .rel.plt : { *(.rel.plt) }'); - add(' .rela.plt : { *(.rela.plt) }'); - add(' .init :'); - add(' {'); - add(' KEEP (*(.init))'); - add(' } =0x90909090'); - add(' .plt : { *(.plt) }'); - add(' .text :'); - add(' {'); - add(' *(.text .stub .text.* .gnu.linkonce.t.*)'); - add(' KEEP (*(.text.*personality*))'); - {.gnu.warning sections are handled specially by elf32.em.} - add(' *(.gnu.warning)'); - add(' } =0x90909090'); - add(' .fini :'); - add(' {'); - add(' KEEP (*(.fini))'); - add(' } =0x90909090'); - add(' PROVIDE (_etext = .);'); - add(' .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }'); - add(' .rodata1 : { *(.rodata1) }'); - add(' .eh_frame_hdr : { *(.eh_frame_hdr) }'); - add(' .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }'); - add(' .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table'); - add(' .gcc_except_table.*) }'); - add(' /* These sections are generated by the Sun/Oracle C++ compiler. */'); - add(' .exception_ranges : ONLY_IF_RO { *(.exception_ranges'); - add(' .exception_ranges*) }'); - add(' /* Adjust the address for the data segment. We want to adjust up to'); - add(' the same address within the page on the next page up. */'); - add(' . = ALIGN (CONSTANT (MAXPAGESIZE)) - ((CONSTANT (MAXPAGESIZE) - .) & (CONSTANT (MAXPAGESIZE) - 1)); . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE));'); - add(' /* Exception handling */'); - add(' .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }'); - add(' .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }'); - add(' .exception_ranges : ONLY_IF_RW { *(.exception_ranges .exception_ranges*) }'); - add(' /* Thread Local Storage sections */'); - add(' .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }'); - add(' .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }'); - add(' .preinit_array :'); - add(' {'); - add(' PROVIDE_HIDDEN (__preinit_array_start = .);'); - add(' KEEP (*(.preinit_array))'); - add(' PROVIDE_HIDDEN (__preinit_array_end = .);'); - add(' }'); - add(' .init_array :'); - add(' {'); - add(' PROVIDE_HIDDEN (__init_array_start = .);'); - add(' KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))'); - add(' KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))'); - add(' PROVIDE_HIDDEN (__init_array_end = .);'); - add(' }'); - add(' .fini_array :'); - add(' {'); - add(' PROVIDE_HIDDEN (__fini_array_start = .);'); - add(' KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))'); - add(' KEEP (*(.fini_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .dtors))'); - add(' PROVIDE_HIDDEN (__fini_array_end = .);'); - add(' }'); - add(' .ctors :'); - add(' {'); - add(' /* gcc uses crtbegin.o to find the start of'); - add(' the constructors, so we make sure it is'); - add(' first. Because this is a wildcard, it'); - add(' doesn''t matter if the user does not'); - add(' actually link against crtbegin.o; the'); - add(' linker won''t look for a file to match a'); - add(' wildcard. The wildcard also means that it'); - add(' doesn''t matter which directory crtbegin.o'); - add(' is in. */'); - add(' KEEP (*crtbegin.o(.ctors))'); - add(' KEEP (*crtbegin?.o(.ctors))'); - add(' /* We don''t want to include the .ctor section from'); - add(' the crtend.o file until after the sorted ctors.'); - add(' The .ctor section from the crtend file contains the'); - add(' end of ctors marker and it must be last */'); - add(' KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))'); - add(' KEEP (*(SORT(.ctors.*)))'); - add(' KEEP (*(.ctors))'); - add(' }'); - add(' .dtors :'); - add(' {'); - add(' KEEP (*crtbegin.o(.dtors))'); - add(' KEEP (*crtbegin?.o(.dtors))'); - add(' KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))'); - add(' KEEP (*(SORT(.dtors.*)))'); - add(' KEEP (*(.dtors))'); - add(' }'); - add(' .jcr : { KEEP (*(.jcr)) }'); - add(' .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }'); - add(' .dynamic : { *(.dynamic) }'); - add(' .got : { *(.got) }'); - add(' .got.plt : { *(.got.plt) }'); - add(' .data :'); - add(' {'); - add(' *(.data .data.* .gnu.linkonce.d.*)'); - add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))'); - add(' KEEP (*(.gnu.linkonce.d.*personality*))'); - add(' }'); - add(' PROVIDE (_edata = .);'); - add(' PROVIDE (edata = .);'); - {$ifdef zsegment_threadvars} - add(' _z = .;'); - add(' .threadvar 0 : AT (_z) { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }'); - add(' PROVIDE (_threadvar_size = SIZEOF(.threadvar));'); - add(' . = _z + SIZEOF (.threadvar);'); - {$else} - add(' .threadvar : { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }'); - {$endif} - add(' __bss_start = .;'); - add(' .bss :'); - add(' {'); - add(' *(.dynbss)'); - add(' *(.bss .bss.* .gnu.linkonce.b.*)'); - add(' *(COMMON)'); - {Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections.} - add(' . = ALIGN(32 / 8);'); - add(' }'); - add(' . = ALIGN(32 / 8);'); - add(' PROVIDE (_end = .);'); - add(' PROVIDE (end = .);'); - {Stabs debugging sections.} - add(' .stab 0 : { *(.stab) }'); - add(' .stabstr 0 : { *(.stabstr) }'); - add('}'); - end; -{$endif LINKERSCRIPT_INCLUDED} - end; + add(' .data :'); + add(' {'); + add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))'); + add(' }'); + add(' .threadvar : { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }'); + add('}'); + { this "INSERT" means "merge into the original linker script, even if + -T is used" } + if not(cs_link_pre_binutils_2_19 in current_settings.globalswitches) then + add('INSERT AFTER .data;'); { Write and Close response } writetodisk; Free; @@ -1532,6 +788,9 @@ begin if tf_use_psabieh in target_info.flags then cmdstr:=cmdstr+ ' --eh-frame-hdr'; + if cs_large in current_settings.globalswitches then + cmdstr:=cmdstr+' --no-relax'; + success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,false); { Create external .dbg file with debuginfo } @@ -1554,6 +813,12 @@ begin if (success) and not(cs_link_nolink in current_settings.globalswitches) then DeleteFile(outputexedir+Info.ResName); + { Post process, + as it only writes sections sizes so far, do this only if V_Info is set } + if success and CheckVerbosity(V_Info) and not(cs_link_nolink in current_settings.globalswitches) then + { do not change success here as we are only writing some info, so if this fails, it does not matter } + { success:= }PostProcessExecutable(current_module.exefilename,false); + MakeExecutable:=success; { otherwise a recursive call to link method } end; @@ -1631,6 +896,12 @@ begin MakeSharedLibrary:=success; { otherwise a recursive call to link method } end; + +function TLinkerLinux.postprocessexecutable(const fn : string;isdll:boolean):boolean; + begin + Result:=PostProcessELFExecutable(fn,isdll); + end; + {***************************************************************************** TINTERNALLINKERLINUX *****************************************************************************} diff --git a/avx512-0037785/compiler/systems/t_msdos.pas b/avx512-0037785/compiler/systems/t_msdos.pas index 325d9aaebe..b5833a3c54 100644 --- a/avx512-0037785/compiler/systems/t_msdos.pas +++ b/avx512-0037785/compiler/systems/t_msdos.pas @@ -117,12 +117,12 @@ implementation exit; if tcalo_vectorized_dead_strip_start in options then secname:='1_START' + else if tcalo_vectorized_dead_strip_item in options then + secname:='2_ITEM' + else if tcalo_vectorized_dead_strip_end in options then + secname:='3_END' else - if tcalo_vectorized_dead_strip_end in options then - secname:='3_END' - else - if tcalo_vectorized_dead_strip_item in options then - secname:='2_ITEM'; + secname:='4_INV'; secname:=make_mangledname(basename,st,secname); end; diff --git a/avx512-0037785/compiler/systems/t_sinclairql.pas b/avx512-0037785/compiler/systems/t_sinclairql.pas new file mode 100644 index 0000000000..42da38a77b --- /dev/null +++ b/avx512-0037785/compiler/systems/t_sinclairql.pas @@ -0,0 +1,402 @@ +{ + Copyright (c) 2020 by Free Pascal Development Team + + This unit implements support import, export, link routines + for the m68k Sinclair QL target + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit t_sinclairql; + +{$i fpcdefs.inc} + +interface + + uses + rescmn, comprsrc, link; + +type + PLinkerSinclairQL = ^TLinkerSinclairQL; + TLinkerSinclairQL = class(texternallinker) + private + Origin: DWord; + UseVLink: boolean; + function WriteResponseFile(isdll: boolean): boolean; + procedure SetSinclairQLInfo; + function MakeSinclairQLExe: boolean; + public + constructor Create; override; + procedure SetDefaultInfo; override; + procedure InitSysInitUnitName; override; + function MakeExecutable: boolean; override; + end; + + +implementation + + uses + sysutils,cutils,cfileutl,cclasses,aasmbase, + globtype,globals,systems,verbose,cscript,fmodule,i_sinclairql; + + type + TQLHeader = packed record + hdr_id: array[0..17] of char; + hdr_reserved: byte; + hdr_length: byte; + hdr_access: byte; + hdr_type: byte; + hdr_data: dword; + hdr_extra: dword; + end; + + TXTccData = packed record + xtcc_id: array[0..3] of char; + xtcc_data: dword; + end; + + const + DefaultQLHeader: TQLHeader = ( + hdr_id: ']!QDOS File Header'; + hdr_reserved: 0; + hdr_length: $f; + hdr_access: 0; + hdr_type: 1; + hdr_data: 0; + hdr_extra: 0; + ); + + DefaultXTccData: TXTCCData = ( + xtcc_id: 'XTcc'; + xtcc_data: 0; + ); + + const + DefaultOrigin = $0; + ProgramHeaderName = 'main'; + + +constructor TLinkerSinclairQL.Create; +begin + UseVLink:=(cs_link_vlink in current_settings.globalswitches); + + Inherited Create; + { allow duplicated libs (PM) } + SharedLibFiles.doubles:=true; + StaticLibFiles.doubles:=true; +end; + + +procedure TLinkerSinclairQL.SetSinclairQLInfo; +begin + if ImageBaseSetExplicity then + Origin:=ImageBase + else + Origin:=DefaultOrigin; + + with Info do + begin + if not UseVLink then + begin + ExeCmd[1]:='ld $DYNLINK $OPT -d -n -o $EXE $RES'; + end + else + begin + ExeCmd[1]:='vlink -b rawseg -q $FLAGS $GCSECTIONS $OPT $STRIP $MAP -o $EXE -T $RES'; + end; + end; +end; + + +procedure TLinkerSinclairQL.SetDefaultInfo; +begin + if target_info.system = system_m68k_sinclairql then + SetSinclairQLInfo; +end; + + +procedure TLinkerSinclairQL.InitSysInitUnitName; +begin + sysinitunit:='si_prc'; +end; + + +function TLinkerSinclairQL.WriteResponseFile(isdll: boolean): boolean; +var + linkres : TLinkRes; + HPath : TCmdStrListItem; + s : string; +begin + WriteResponseFile:=False; + + { Open link.res file } + LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,true); + + { Write path to search libraries } + HPath:=TCmdStrListItem(current_module.locallibrarysearchpath.First); + while assigned(HPath) do + begin + s:=HPath.Str; + if (cs_link_on_target in current_settings.globalswitches) then + s:=ScriptFixFileName(s); + LinkRes.Add('-L'+s); + HPath:=TCmdStrListItem(HPath.Next); + end; + HPath:=TCmdStrListItem(LibrarySearchPath.First); + while assigned(HPath) do + begin + s:=HPath.Str; + if s<>'' then + LinkRes.Add('SEARCH_DIR("'+s+'")'); + HPath:=TCmdStrListItem(HPath.Next); + end; + + LinkRes.Add('INPUT ('); + { add objectfiles, start with prt0 always } + if not (target_info.system in systems_internal_sysinit) then + begin + s:=FindObjectFile('prt0','',false); + LinkRes.AddFileName(maybequoted(s)); + end; + while not ObjectFiles.Empty do + begin + s:=ObjectFiles.GetFirst; + if s<>'' then + begin + { vlink doesn't use SEARCH_DIR for object files } + if UseVLink then + s:=FindObjectFile(s,'',false); + LinkRes.AddFileName(maybequoted(s)); + end; + end; + + { Write staticlibraries } + if not StaticLibFiles.Empty then + begin + { vlink doesn't need, and doesn't support GROUP } + if not UseVLink then + begin + LinkRes.Add(')'); + LinkRes.Add('GROUP('); + end; + while not StaticLibFiles.Empty do + begin + S:=StaticLibFiles.GetFirst; + LinkRes.AddFileName(maybequoted(s)); + end; + end; + + LinkRes.Add(')'); + + with LinkRes do + begin + Add(''); + Add('PHDRS {'); + Add(' '+ProgramHeaderName+' PT_LOAD;'); + Add('}'); + Add('SECTIONS'); + Add('{'); + Add(' . = 0x'+hexstr(Origin,8)+';'); + Add(' .text : {'); + Add(' _stext = .;'); + Add(' *(.text .text.* )'); + Add(' *(.data .data.* .rodata .rodata.* .fpc.* )'); + Add(' *(.stack .stack.*)'); + { force the end of section to be word aligned } + Add(' . = ALIGN(2); SHORT(0x514C);'); + Add(' _etext = .;'); + Add(' } :'+ProgramHeaderName); + Add(' .bss (NOLOAD): {'); + Add(' _sbss = .;'); + Add(' *(.bss .bss.*)'); + Add(' _ebss = .;'); + Add(' } :'+ProgramHeaderName); + Add('}'); + end; + +{ Write and Close response } + linkres.writetodisk; + linkres.free; + + WriteResponseFile:=True; +end; + + +function TLinkerSinclairQL.MakeSinclairQLExe: boolean; +var + BinStr, + CmdStr : TCmdStr; + StripStr: string[40]; + DynLinkStr : string; + GCSectionsStr : string; + FlagsStr : string; + MapStr : string; + ExeName: string; + fd,fs: file; + fhdr: text; + buf: pointer; + bufread,bufsize: longint; + HdrName: string; + HeaderLine: string; + HeaderSize: longint; + code: word; + QLHeader: TQLHeader; + XTccData: TXTccData; + BinSize: longint; + DataSpace: DWord; +begin + StripStr:=''; + GCSectionsStr:=''; + DynLinkStr:=''; + FlagsStr:=''; + MapStr:=''; + + if (cs_link_map in current_settings.globalswitches) then + MapStr:='-M'+maybequoted(ScriptFixFilename(current_module.mapfilename)); + if (cs_link_strip in current_settings.globalswitches) then + StripStr:='-s'; + if rlinkpath<>'' then + DynLinkStr:='--rpath-link '+rlinkpath; + if UseVLink then + begin + if create_smartlink_sections then + GCSectionsStr:='-gc-all'; + end; + + ExeName:=current_module.exefilename; + HdrName:=ExeName+'.hdr'; + + { Call linker } + SplitBinCmd(Info.ExeCmd[1],BinStr,CmdStr); + binstr:=FindUtil(utilsprefix+BinStr); + Replace(cmdstr,'$OPT',Info.ExtraOptions); + Replace(cmdstr,'$EXE',maybequoted(ScriptFixFileName(ExeName))); + Replace(cmdstr,'$RES',maybequoted(ScriptFixFileName(outputexedir+Info.ResName))); + Replace(cmdstr,'$MAP',MapStr); + Replace(cmdstr,'$FLAGS',FlagsStr); + Replace(cmdstr,'$STRIP',StripStr); + Replace(cmdstr,'$GCSECTIONS',GCSectionsStr); + Replace(cmdstr,'$DYNLINK',DynLinkStr); + + MakeSinclairQLExe:=DoExec(BinStr,CmdStr,true,false); + + { Kludge: + With the above linker script, vlink will produce two files. The main binary + and the relocation info. Here we copy the two together. (KB) } + if MakeSinclairQLExe then + begin + QLHeader:=DefaultQLHeader; + XTccData:=DefaultXTccData; + + BinSize:=0; + bufsize:=16384; +{$push} +{$i-} + { Rename vlink's output file into the header file it is, then parse the + expected length from it. Later we use either this size or the final binary + size in the BASIC loader, depending on which one is bigger. (KB) } + RenameFile(ExeName,HdrName); + assign(fhdr,HdrName); + reset(fhdr); + readln(fhdr,HeaderLine); + Val(Copy(HeaderLine,RPos('0x',HeaderLine),Length(HeaderLine)),HeaderSize,code); + close(fhdr); + + buf:=GetMem(bufsize); + assign(fd,ExeName); + rewrite(fd,1); + + assign(fs,ExeName+'.'+ProgramHeaderName); + reset(fs,1); + BinSize := FileSize(fs); + + { We assume .bss size is total size indicated by linker minus emmited binary. + DataSpace size is .bss + stack space } + DataSpace := NToBE(DWord(HeaderSize - BinSize + StackSize)); + + { Option: prepend QEmuLator and QPC2 v5 compatible header to EXE } + if sinclairql_metadata_format='QHDR' then + begin + QLHeader.hdr_data:=DataSpace; + blockwrite(fd, QLHeader, sizeof(QLHeader)); + end; + + repeat + blockread(fs,buf^,bufsize,bufread); + blockwrite(fd,buf^,bufread); + until eof(fs); + close(fs); + // erase(fs); + + assign(fs,ExeName+'.'+ProgramHeaderName+'.rel'+ProgramHeaderName); + reset(fs,1); + repeat + blockread(fs,buf^,bufsize,bufread); + blockwrite(fd,buf^,bufread); + until eof(fs); + close(fs); + // erase(fs); + + { Option: append cross compilation data space marker, this can be picked up by + a special version of InfoZIP (compiled with -DQLZIP and option -Q) or by any + of the XTcc unpack utilities } + if sinclairql_metadata_format='XTCC' then + begin + XTccData.xtcc_data:=DataSpace; + blockwrite(fd, XTccData, sizeof(XTccData)); + end; + + close(fd); +{$pop} + FreeMem(buf); + + MakeSinclairQLExe:=(code = 0) and not (BinSize = 0) and (IOResult = 0); + end; +end; + + +function TLinkerSinclairQL.MakeExecutable:boolean; +var + success : boolean; + bootfile : TScript; + ExeName: String; +begin + if not(cs_link_nolink in current_settings.globalswitches) then + Message1(exec_i_linking,current_module.exefilename); + + { Write used files and libraries } + WriteResponseFile(false); + + success:=MakeSinclairQLExe; + + { Remove ReponseFile } + if (success) and not(cs_link_nolink in current_settings.globalswitches) then + DeleteFile(outputexedir+Info.ResName); + + MakeExecutable:=success; { otherwise a recursive call to link method } +end; + + + + +{***************************************************************************** + Initialize +*****************************************************************************} + +initialization + RegisterLinker(ld_sinclairql,TLinkerSinclairQL); + RegisterTarget(system_m68k_sinclairql_info); +end. diff --git a/avx512-0037785/compiler/systems/t_win16.pas b/avx512-0037785/compiler/systems/t_win16.pas index 7c59808dec..8b76d09151 100644 --- a/avx512-0037785/compiler/systems/t_win16.pas +++ b/avx512-0037785/compiler/systems/t_win16.pas @@ -202,7 +202,7 @@ begin procsym: DllExport_COMENT_EXPDEF.InternalName:=tprocdef(tprocsym(hp.sym).ProcdefList[0]).mangledname; else - internalerror(2015092701); + internalerror(2015092705); end else DllExport_COMENT_EXPDEF.InternalName:=hp.name^; diff --git a/avx512-0037785/compiler/systems/t_zxspectrum.pas b/avx512-0037785/compiler/systems/t_zxspectrum.pas index 9bce9fbe04..6c055000ed 100644 --- a/avx512-0037785/compiler/systems/t_zxspectrum.pas +++ b/avx512-0037785/compiler/systems/t_zxspectrum.pas @@ -175,7 +175,7 @@ function TLinkerZXSpectrum.WriteResponseFile_Vlink: Boolean; Add(' . = 0x'+hexstr(FOrigin,4)+';'); Add(' .text : { *(.text .text.* _CODE _CODE.* ) }'); Add(' .data : { *(.data .data.* .rodata .rodata.* .fpc.* ) }'); - Add(' .bss : { *(.bss .bss.* _BSS _BSS.* _BSSEND _BSSEND.* _HEAP _HEAP.* .stack .stack.* _STACK _STACK.* ) }'); + Add(' .bss : { *(_BSS _BSS.*) *(.bss .bss.*) *(_BSSEND _BSSEND.*) *(_HEAP _HEAP.*) *(.stack .stack.*) *(_STACK _STACK.*) }'); Add('}'); end; @@ -210,7 +210,7 @@ procedure TLinkerZXSpectrum.SetDefaultInfo_Vlink; FOrigin:=DefaultOrigin; with Info do begin - ExeCmd[1]:=ExeName+' -bihex $GCSECTIONS -e $STARTSYMBOL $STRIP $OPT -o $EXE -T $RES' + ExeCmd[1]:=ExeName+' -bihex $GCSECTIONS -e $STARTSYMBOL $STRIP $OPT $MAP -o $EXE -T $RES' end; end; @@ -280,13 +280,18 @@ function TLinkerZXSpectrum.MakeExecutable_Vlink: boolean; GCSectionsStr, StripStr, StartSymbolStr, + MapStr, FixedExeFilename: string; begin GCSectionsStr:='-gc-all -mtype'; StripStr:=''; + MapStr:=''; StartSymbolStr:='start'; FixedExeFileName:=maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.ihx'))); + if (cs_link_map in current_settings.globalswitches) then + MapStr:='-M'+maybequoted(ScriptFixFileName(current_module.mapfilename)); + { Write used files and libraries } WriteResponseFile_Vlink(); @@ -296,6 +301,7 @@ function TLinkerZXSpectrum.MakeExecutable_Vlink: boolean; Replace(cmdstr,'$EXE',FixedExeFileName); Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName)))); + Replace(cmdstr,'$MAP',MapStr); Replace(cmdstr,'$STRIP',StripStr); Replace(cmdstr,'$STARTSYMBOL',StartSymbolStr); Replace(cmdstr,'$GCSECTIONS',GCSectionsStr); |