+2014-12-23 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * emultempl/avrelf.em: Add include of elf/avr.h.
+ (avr_finish): New function.
+ (LDEMUL_FINISH): Added.
+
2014-12-23 Alan Modra <amodra@gmail.com>
* ldexp.c (update_definedness): Return false if script symbol is
#include "elf32-avr.h"
#include "ldctor.h"
+#include "elf/avr.h"
/* The fake file and it's corresponding section meant to hold
the linker stubs if needed. */
gld${EMULATION_NAME}_before_parse ();
}
+static void
+avr_finish (void)
+{
+ bfd *abfd;
+ bfd_boolean avr_link_relax;
+
+ if (link_info.relocatable)
+ {
+ avr_link_relax = TRUE;
+ for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
+ {
+ /* Don't let the linker stubs prevent the final object being
+ marked as link-relax ready. */
+ if ((elf_elfheader (abfd)->e_flags
+ & EF_AVR_LINKRELAX_PREPARED) == 0
+ && abfd != stub_file->the_bfd)
+ {
+ avr_link_relax = FALSE;
+ break;
+ }
+ }
+ }
+ else
+ {
+ avr_link_relax = RELAXATION_ENABLED;
+ }
+
+ abfd = link_info.output_bfd;
+ if (avr_link_relax)
+ elf_elfheader (abfd)->e_flags |= EF_AVR_LINKRELAX_PREPARED;
+ else
+ elf_elfheader (abfd)->e_flags &= ~EF_AVR_LINKRELAX_PREPARED;
+
+ finish_default ();
+}
EOF
LDEMUL_BEFORE_ALLOCATION=avr_elf_${EMULATION_NAME}_before_allocation
LDEMUL_AFTER_ALLOCATION=avr_elf_after_allocation
LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=avr_elf_create_output_section_statements
+LDEMUL_FINISH=avr_finish
+2014-12-23 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ld-avr/relax-elf-flags-01.d: New file.
+ * ld-avr/relax-elf-flags-02.d: New file.
+ * ld-avr/relax-elf-flags-03.d: New file.
+ * ld-avr/relax-elf-flags-04.d: New file.
+ * ld-avr/relax-elf-flags-05.d: New file.
+ * ld-avr/relax-elf-flags-06.d: New file.
+ * ld-avr/relax-elf-flags-07.d: New file.
+ * ld-avr/relax-elf-flags-08.d: New file.
+ * ld-avr/relax-elf-flags-a.s: New file.
+ * ld-avr/relax-elf-flags-b.s: New file.
+
2014-12-23 Alan Modra <amodra@gmail.com>
* ld-powerpc/sdabase.s,
--- /dev/null
+#name: AVR, check link-relax flag is set on partial link
+#as: -mmcu=avrxmega2
+#ld: -r -mavrxmega2
+#source: relax-elf-flags-a.s -mlink-relax
+#source: relax-elf-flags-b.s -mlink-relax
+#readelf: -h
+#target: avr-*-*
+
+ELF Header:
+#...
+ Flags: 0xe6, avr:102, link-relax
+#...
\ No newline at end of file
--- /dev/null
+#name: AVR, check link-relax flag is clear on partial link (first file)
+#as: -mmcu=avrxmega2
+#ld: -r -mavrxmega2
+#source: relax-elf-flags-a.s
+#source: relax-elf-flags-b.s -mlink-relax
+#readelf: -h
+#target: avr-*-*
+
+ELF Header:
+#...
+ Flags: 0x66, avr:102
+#...
\ No newline at end of file
--- /dev/null
+#name: AVR, check link-relax flag is clear on partial link, second file.
+#as: -mmcu=avrxmega2
+#ld: -r -mavrxmega2
+#source: relax-elf-flags-a.s -mlink-relax
+#source: relax-elf-flags-b.s
+#readelf: -h
+#target: avr-*-*
+
+ELF Header:
+#...
+ Flags: 0x66, avr:102
+#...
\ No newline at end of file
--- /dev/null
+#name: AVR, check link-relax flag is clear on partial link (both files)
+#as: -mmcu=avrxmega2
+#ld: -r -mavrxmega2
+#source: relax-elf-flags-a.s
+#source: relax-elf-flags-b.s
+#readelf: -h
+#target: avr-*-*
+
+ELF Header:
+#...
+ Flags: 0x66, avr:102
+#...
\ No newline at end of file
--- /dev/null
+#name: AVR, check link-relax flag is set final link (no inputs relaxable)
+#as: -mmcu=avrxmega2
+#ld: -relax -mavrxmega2
+#source: relax-elf-flags-a.s
+#source: relax-elf-flags-b.s
+#readelf: -h
+#target: avr-*-*
+
+ELF Header:
+#...
+ Flags: 0xe6, avr:102, link-relax
+#...
\ No newline at end of file
--- /dev/null
+#name: AVR, check link-relax flag is set final link (first input relaxable)
+#as: -mmcu=avrxmega2
+#ld: -relax -mavrxmega2
+#source: relax-elf-flags-a.s -mlink-relax
+#source: relax-elf-flags-b.s
+#readelf: -h
+#target: avr-*-*
+
+ELF Header:
+#...
+ Flags: 0xe6, avr:102, link-relax
+#...
\ No newline at end of file
--- /dev/null
+#name: AVR, check link-relax flag is set final link (both inputs relaxable)
+#as: -mmcu=avrxmega2
+#ld: -relax -mavrxmega2
+#source: relax-elf-flags-a.s -mlink-relax
+#source: relax-elf-flags-b.s -mlink-relax
+#readelf: -h
+#target: avr-*-*
+
+ELF Header:
+#...
+ Flags: 0xe6, avr:102, link-relax
+#...
\ No newline at end of file
--- /dev/null
+#name: AVR, check link-relax flag is clear final link (both inputs relaxable)
+#as: -mmcu=avrxmega2
+#ld: -mavrxmega2
+#source: relax-elf-flags-a.s -mlink-relax
+#source: relax-elf-flags-b.s -mlink-relax
+#readelf: -h
+#target: avr-*-*
+
+ELF Header:
+#...
+ Flags: 0x66, avr:102
+#...
\ No newline at end of file
--- /dev/null
+ .text
+ .global _start
+_start:
+ nop
--- /dev/null
+ .text
+ .global func
+func:
+ nop