From a880b0246c7a3822401ee1a55065cfa932d0b6c2 Mon Sep 17 00:00:00 2001 From: Christian Kroll Date: Sun, 9 Oct 2016 00:29:11 +0200 Subject: [PATCH] renewed linker skripts for latest avr-binutils Signed-off-by: Christian Kroll --- ld_scripts/avr5.x | 65 +++++++++++++++++++++++++++++++--------------- ld_scripts/avr51.x | 65 +++++++++++++++++++++++++++++++--------------- ld_scripts/avr6.x | 65 +++++++++++++++++++++++++++++++--------------- 3 files changed, 132 insertions(+), 63 deletions(-) diff --git a/ld_scripts/avr5.x b/ld_scripts/avr5.x index 30312af..cd9fda1 100644 --- a/ld_scripts/avr5.x +++ b/ld_scripts/avr5.x @@ -1,14 +1,19 @@ /* Default linker script, for normal executables */ +/* Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") OUTPUT_ARCH(avr:5) MEMORY { - text (rx) : ORIGIN = 0, LENGTH = 128K - data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0 - eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K + text (rx) : ORIGIN = 0, LENGTH = 128K + data (rw!x) : ORIGIN = 0x800060, LENGTH = 0xffa0 + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = 1K } SECTIONS { @@ -70,26 +75,32 @@ SECTIONS .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } /* Internal text space or external memory. */ - .text : + .text : { *(.vectors) KEEP(*(.vectors)) /* For data that needs to reside in the lower 64k of progmem. */ - *(.progmem.gcc*) - *(.progmem*) + *(.progmem.gcc*) + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ . = ALIGN(2); __trampolines_start = . ; /* The jump trampolines for the 16-bit limited relocs will reside here. */ *(.trampolines) - *(.trampolines*) + *(.trampolines*) __trampolines_end = . ; + /* avr-libc expects these data to reside in lower 64K. */ + *libprintf_flt.a:*(.progmem.data) + *libc.a:*(.progmem.data) + *(.progmem*) + . = ALIGN(2); /* For future tablejump instruction arrays for 3 byte pc devices. We don't relax jump/call instructions within these sections. */ *(.jumptables) - *(.jumptables*) + *(.jumptables*) /* For code that needs to reside in the lower 128k progmem. */ *(.lowtext) - *(.lowtext*) + *(.lowtext*) __ctors_start = . ; *(.ctors) __ctors_end = . ; @@ -122,7 +133,7 @@ SECTIONS KEEP (*(.init9)) *(.text) . = ALIGN(2); - *(.text.*) + *(.text.*) . = ALIGN(2); *(.fini9) /* _exit() starts here. */ KEEP (*(.fini9)) @@ -146,13 +157,13 @@ SECTIONS KEEP (*(.fini0)) _etext = . ; } > text - .data : AT (ADDR (.text) + SIZEOF (.text)) + .data : { PROVIDE (__data_start = .) ; - *(.data) - *(.data*) + *(.data) + *(.data*) *(.rodata) /* We need to include .rodata here if gcc is used */ - *(.rodata*) /* with -fdata-sections. */ + *(.rodata*) /* with -fdata-sections. */ *(.gnu.linkonce.d*) PROVIDE (_game_descriptors_start__ = .) ; *(.game_descriptors) @@ -160,19 +171,19 @@ SECTIONS . = ALIGN(2); _edata = . ; PROVIDE (__data_end = .) ; - } > data - .bss SIZEOF(.data) + ADDR(.data) : + } > data AT> text + .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss)) { PROVIDE (__bss_start = .) ; *(.bss) - *(.bss*) + *(.bss*) *(COMMON) PROVIDE (__bss_end = .) ; } > data __data_load_start = LOADADDR(.data); __data_load_end = __data_load_start + SIZEOF(.data); /* Global data not cleared after reset. */ - .noinit SIZEOF(.bss) + ADDR(.bss) : + .noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit)) { PROVIDE (__noinit_start = .) ; *(.noinit*) @@ -182,7 +193,8 @@ SECTIONS } > data .eeprom : { - *(.eeprom*) + /* See .data above... */ + KEEP(*(.eeprom*)) __eeprom_end = . ; } > eeprom .fuse : @@ -208,6 +220,7 @@ SECTIONS .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning of the section so we begin them at 0. */ @@ -221,11 +234,21 @@ SECTIONS .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } } diff --git a/ld_scripts/avr51.x b/ld_scripts/avr51.x index 3be4c35..8a58159 100644 --- a/ld_scripts/avr51.x +++ b/ld_scripts/avr51.x @@ -1,14 +1,19 @@ /* Default linker script, for normal executables */ +/* Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") OUTPUT_ARCH(avr:51) MEMORY { - text (rx) : ORIGIN = 0, LENGTH = 128K - data (rw!x) : ORIGIN = 0x800100, LENGTH = 0xff00 - eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K + text (rx) : ORIGIN = 0, LENGTH = 128K + data (rw!x) : ORIGIN = 0x800100, LENGTH = 0xff00 + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = 1K } SECTIONS { @@ -70,26 +75,32 @@ SECTIONS .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } /* Internal text space or external memory. */ - .text : + .text : { *(.vectors) KEEP(*(.vectors)) /* For data that needs to reside in the lower 64k of progmem. */ - *(.progmem.gcc*) - *(.progmem*) + *(.progmem.gcc*) + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ . = ALIGN(2); __trampolines_start = . ; /* The jump trampolines for the 16-bit limited relocs will reside here. */ *(.trampolines) - *(.trampolines*) + *(.trampolines*) __trampolines_end = . ; + /* avr-libc expects these data to reside in lower 64K. */ + *libprintf_flt.a:*(.progmem.data) + *libc.a:*(.progmem.data) + *(.progmem*) + . = ALIGN(2); /* For future tablejump instruction arrays for 3 byte pc devices. We don't relax jump/call instructions within these sections. */ *(.jumptables) - *(.jumptables*) + *(.jumptables*) /* For code that needs to reside in the lower 128k progmem. */ *(.lowtext) - *(.lowtext*) + *(.lowtext*) __ctors_start = . ; *(.ctors) __ctors_end = . ; @@ -122,7 +133,7 @@ SECTIONS KEEP (*(.init9)) *(.text) . = ALIGN(2); - *(.text.*) + *(.text.*) . = ALIGN(2); *(.fini9) /* _exit() starts here. */ KEEP (*(.fini9)) @@ -146,13 +157,13 @@ SECTIONS KEEP (*(.fini0)) _etext = . ; } > text - .data : AT (ADDR (.text) + SIZEOF (.text)) + .data : { PROVIDE (__data_start = .) ; - *(.data) - *(.data*) + *(.data) + *(.data*) *(.rodata) /* We need to include .rodata here if gcc is used */ - *(.rodata*) /* with -fdata-sections. */ + *(.rodata*) /* with -fdata-sections. */ *(.gnu.linkonce.d*) PROVIDE (_game_descriptors_start__ = .) ; *(.game_descriptors) @@ -160,19 +171,19 @@ SECTIONS . = ALIGN(2); _edata = . ; PROVIDE (__data_end = .) ; - } > data - .bss SIZEOF(.data) + ADDR(.data) : + } > data AT> text + .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss)) { PROVIDE (__bss_start = .) ; *(.bss) - *(.bss*) + *(.bss*) *(COMMON) PROVIDE (__bss_end = .) ; } > data __data_load_start = LOADADDR(.data); __data_load_end = __data_load_start + SIZEOF(.data); /* Global data not cleared after reset. */ - .noinit SIZEOF(.bss) + ADDR(.bss) : + .noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit)) { PROVIDE (__noinit_start = .) ; *(.noinit*) @@ -182,7 +193,8 @@ SECTIONS } > data .eeprom : { - *(.eeprom*) + /* See .data above... */ + KEEP(*(.eeprom*)) __eeprom_end = . ; } > eeprom .fuse : @@ -208,6 +220,7 @@ SECTIONS .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning of the section so we begin them at 0. */ @@ -221,11 +234,21 @@ SECTIONS .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } } diff --git a/ld_scripts/avr6.x b/ld_scripts/avr6.x index 26db017..175300d 100644 --- a/ld_scripts/avr6.x +++ b/ld_scripts/avr6.x @@ -1,14 +1,19 @@ /* Default linker script, for normal executables */ +/* Copyright (C) 2014-2016 Free Software Foundation, Inc. + Copying and distribution of this script, with or without modification, + are permitted in any medium without royalty provided the copyright + notice and this notice are preserved. */ OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr") OUTPUT_ARCH(avr:6) MEMORY { - text (rx) : ORIGIN = 0, LENGTH = 1024K - data (rw!x) : ORIGIN = 0x800200, LENGTH = 0xfe00 - eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K + text (rx) : ORIGIN = 0, LENGTH = 1024K + data (rw!x) : ORIGIN = 0x800200, LENGTH = 0xfe00 + eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K fuse (rw!x) : ORIGIN = 0x820000, LENGTH = 1K lock (rw!x) : ORIGIN = 0x830000, LENGTH = 1K signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K + user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = 1K } SECTIONS { @@ -70,26 +75,32 @@ SECTIONS .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } /* Internal text space or external memory. */ - .text : + .text : { *(.vectors) KEEP(*(.vectors)) /* For data that needs to reside in the lower 64k of progmem. */ - *(.progmem.gcc*) - *(.progmem*) + *(.progmem.gcc*) + /* PR 13812: Placing the trampolines here gives a better chance + that they will be in range of the code that uses them. */ . = ALIGN(2); __trampolines_start = . ; /* The jump trampolines for the 16-bit limited relocs will reside here. */ *(.trampolines) - *(.trampolines*) + *(.trampolines*) __trampolines_end = . ; + /* avr-libc expects these data to reside in lower 64K. */ + *libprintf_flt.a:*(.progmem.data) + *libc.a:*(.progmem.data) + *(.progmem*) + . = ALIGN(2); /* For future tablejump instruction arrays for 3 byte pc devices. We don't relax jump/call instructions within these sections. */ *(.jumptables) - *(.jumptables*) + *(.jumptables*) /* For code that needs to reside in the lower 128k progmem. */ *(.lowtext) - *(.lowtext*) + *(.lowtext*) __ctors_start = . ; *(.ctors) __ctors_end = . ; @@ -122,7 +133,7 @@ SECTIONS KEEP (*(.init9)) *(.text) . = ALIGN(2); - *(.text.*) + *(.text.*) . = ALIGN(2); *(.fini9) /* _exit() starts here. */ KEEP (*(.fini9)) @@ -146,13 +157,13 @@ SECTIONS KEEP (*(.fini0)) _etext = . ; } > text - .data : AT (ADDR (.text) + SIZEOF (.text)) + .data : { PROVIDE (__data_start = .) ; - *(.data) - *(.data*) + *(.data) + *(.data*) *(.rodata) /* We need to include .rodata here if gcc is used */ - *(.rodata*) /* with -fdata-sections. */ + *(.rodata*) /* with -fdata-sections. */ *(.gnu.linkonce.d*) PROVIDE (_game_descriptors_start__ = .) ; *(.game_descriptors) @@ -160,19 +171,19 @@ SECTIONS . = ALIGN(2); _edata = . ; PROVIDE (__data_end = .) ; - } > data - .bss SIZEOF(.data) + ADDR(.data) : + } > data AT> text + .bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss)) { PROVIDE (__bss_start = .) ; *(.bss) - *(.bss*) + *(.bss*) *(COMMON) PROVIDE (__bss_end = .) ; } > data __data_load_start = LOADADDR(.data); __data_load_end = __data_load_start + SIZEOF(.data); /* Global data not cleared after reset. */ - .noinit SIZEOF(.bss) + ADDR(.bss) : + .noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit)) { PROVIDE (__noinit_start = .) ; *(.noinit*) @@ -182,7 +193,8 @@ SECTIONS } > data .eeprom : { - *(.eeprom*) + /* See .data above... */ + KEEP(*(.eeprom*)) __eeprom_end = . ; } > eeprom .fuse : @@ -208,6 +220,7 @@ SECTIONS .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } + .note.gnu.build-id : { *(.note.gnu.build-id) } /* DWARF debug sections. Symbols in the DWARF debugging sections are relative to the beginning of the section so we begin them at 0. */ @@ -221,11 +234,21 @@ SECTIONS .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) } + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } + .debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + /* DWARF Extension. */ + .debug_macro 0 : { *(.debug_macro) } }