|
@@ -96,7 +96,7 @@ Var
|
|
|
begin
|
|
|
WriteResponseFile:=False;
|
|
|
linklibc:=(SharedLibFiles.Find('c')<>nil);
|
|
|
-{$if defined(ARM) or defined(i386) or defined(x86_64) or defined(AVR) or defined(MIPSEL) or defined(RISCV32)}
|
|
|
+{$if defined(ARM) or defined(i386) or defined(x86_64) or defined(AVR) or defined(MIPSEL) or defined(RISCV32) or defined(XTENSA)}
|
|
|
prtobj:='';
|
|
|
{$else}
|
|
|
prtobj:='prt0';
|
|
@@ -1351,6 +1351,212 @@ begin
|
|
|
end;
|
|
|
{$endif RISCV32}
|
|
|
|
|
|
+ {$ifdef XTENSA}
|
|
|
+ with linkres do
|
|
|
+ begin
|
|
|
+ Add('/* Script for -z combreloc: combine and sort reloc sections */');
|
|
|
+ Add('/* Copyright (C) 2014-2018 Free Software Foundation, Inc.');
|
|
|
+ Add(' Copying and distribution of this script, with or without modification,');
|
|
|
+ Add(' are permitted in any medium without royalty provided the copyright');
|
|
|
+ Add(' notice and this notice are preserved. */');
|
|
|
+ Add('ENTRY(_start)');
|
|
|
+ Add('SEARCH_DIR("=/builds/idf/crosstool-NG/builds/xtensa-esp32-elf/xtensa-esp32-elf/lib"); 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 = 0x400000); . = 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(' }');
|
|
|
+ Add(' .rela.plt : { *(.rela.plt) }');
|
|
|
+ Add(' /* .plt* sections are embedded in .text */');
|
|
|
+ Add(' .text :');
|
|
|
+ Add(' {');
|
|
|
+ Add(' *(.got.plt* .plt*)');
|
|
|
+ Add(' KEEP (*(.init.literal))');
|
|
|
+ Add(' KEEP (*(SORT_NONE(.init)))');
|
|
|
+ Add(' *(.literal .text .stub .literal.* .text.* .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)');
|
|
|
+ Add(' /* .gnu.warning sections are handled specially by elf32.em. */');
|
|
|
+ Add(' *(.gnu.warning)');
|
|
|
+ Add(' KEEP (*(.fini.literal))');
|
|
|
+ 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(' .got.loc : { *(.got.loc) }');
|
|
|
+ Add(' .xt_except_table : ONLY_IF_RO { KEEP (*(.xt_except_table .xt_except_table.* .gnu.linkonce.e.*)) }');
|
|
|
+ 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 (*(SORT(.fini_array.*)))');
|
|
|
+ Add(' KEEP (*(.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 .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }');
|
|
|
+ Add(' .xt_except_table : ONLY_IF_RW { KEEP (*(.xt_except_table .xt_except_table.* .gnu.linkonce.e.*)) }');
|
|
|
+ Add(' .dynamic : { *(.dynamic) }');
|
|
|
+ Add(' .got : { *(.got) }');
|
|
|
+ Add(' .data :');
|
|
|
+ Add(' {');
|
|
|
+ Add(' *(.data .data.* .gnu.linkonce.d.*)');
|
|
|
+ Add(' SORT(CONSTRUCTORS)');
|
|
|
+ Add(' KEEP (*(.fpc .fpc.n_version .fpc.n_links))');
|
|
|
+ Add(' }');
|
|
|
+ Add(' .data1 : { *(.data1) }');
|
|
|
+ Add(' .xt_except_desc :');
|
|
|
+ Add(' {');
|
|
|
+ Add(' *(.xt_except_desc .xt_except_desc.* .gnu.linkonce.h.*)');
|
|
|
+ Add(' *(.xt_except_desc_end)');
|
|
|
+ Add(' }');
|
|
|
+ Add(' .lit4 :');
|
|
|
+ Add(' {');
|
|
|
+ Add(' PROVIDE (_lit4_start = .);');
|
|
|
+ Add(' *(.lit4 .lit4.* .gnu.linkonce.lit4.*)');
|
|
|
+ Add(' PROVIDE (_lit4_end = .);');
|
|
|
+ Add(' }');
|
|
|
+ Add(' _edata = .; PROVIDE (edata = .);');
|
|
|
+ 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(' . = ALIGN(32 / 8);');
|
|
|
+ Add(' . = ALIGN(32 / 8);');
|
|
|
+ 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 .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(' .debug_addr 0 : { *(.debug_addr) }');
|
|
|
+ Add(' .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }');
|
|
|
+ Add(' .xt.lit 0 : { KEEP (*(.xt.lit .xt.lit.* .gnu.linkonce.p.*)) }');
|
|
|
+ Add(' .xt.insn 0 : { KEEP (*(.xt.insn .gnu.linkonce.x.*)) }');
|
|
|
+ Add(' .xt.prop 0 : { KEEP (*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*)) }');
|
|
|
+ Add(' /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }');
|
|
|
+ Add('}');
|
|
|
+ end;
|
|
|
+{$endif XTENSA}
|
|
|
+
|
|
|
{ Write and Close response }
|
|
|
linkres.writetodisk;
|
|
|
linkres.free;
|