binutils-gdb/ld/scripttempl
Jozef Lawrynowicz 64b63c2993 MSP430: Fix alignment of __*_array_start symbols in default linker script
__{preinit,init,fini}_array_start symbols must be word aligned in
linker scripts. If the section preceding the __*_array_start symbol
has an odd size, then a NULL byte will be present between the start
symbol and the .*_array section itself, when the section gets
automatically word-aligned.

This results in a branch to an invalid address when the CRT startup
code tries to run through the functions listed in the array sections.

Some MSP430 linker scripts do not align the __*_array start symbols, so
this added warning will catch that problem and help the user avoid
the potential incorrect execution of the program.

ld/ChangeLog:

	* emultempl/msp430.em (input_section_exists): New.
	(check_array_section_alignment): New.
	(gld${EMULATION_NAME}_finish): New.
	* scripttempl/elf32msp430.sc: Add ALIGN directives before the
	definition of __*_array_start symbols.
	* testsuite/ld-msp430-elf/finiarray-warn.ld: New test.
	* testsuite/ld-msp430-elf/finiarray-warn.r: New test.
	* testsuite/ld-msp430-elf/initarray-nowarn.ld: New test.
	* testsuite/ld-msp430-elf/initarray-warn.ld: New test.
	* testsuite/ld-msp430-elf/initarray-warn.r: New test.
	* testsuite/ld-msp430-elf/initarray.s: New test.
	* testsuite/ld-msp430-elf/msp430-elf.exp: Run new tests.
	* testsuite/ld-msp430-elf/preinitarray-warn.ld: New test.
	* testsuite/ld-msp430-elf/preinitarray-warn.r: New test.
2020-08-28 14:01:10 +01:00
..
aix.sc
alpha.sc
alphavms.sc
aout.sc
arclinux.sc
armbpabi.sc
avr.sc
crisaout.sc
dlx.sc
DWARF.sc
elf32cr16.sc
elf32crx.sc
elf32msp430.sc MSP430: Fix alignment of __*_array_start symbols in default linker script 2020-08-28 14:01:10 +01:00
elf32xc16x.sc
elf32xc16xl.sc
elf32xc16xs.sc
elf64bpf.sc
elf64hppa.sc
elf_chaos.sc
elf.sc
elfarc.sc ARC: Fix ld/pr24511 test 2020-07-31 12:15:17 +03:00
elfarcv2.sc
elfd10v.sc
elfd30v.sc
elfm9s12z.sc
elfm68hc11.sc
elfm68hc12.sc
elfmicroblaze.sc
elfxgate.sc
elfxtensa.sc
epiphany_4x4.sc
ft32.sc
hppaelf.sc
i386beos.sc
i386go32.sc
i386msdos.sc
ia64vms.sc
ip2k.sc
iq2000.sc
mcorepe.sc
mep.sc
mips.sc
mipsbsd.sc
mmo.sc
moxie.sc
nds32elf.sc
pdp11.sc
pe.sc
pep.sc
pj.sc
pru.sc
README
sh.sc
tic4xcoff.sc
tic30coff.sc
tic54xcoff.sc
v850_rh850.sc
v850.sc
vanilla.sc
visium.sc
xstormy16.sc
z80.sc
z8000.sc

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

The files in this directory are linker script templates.
genscripts.sh sets some shell variables, then sources
EMULATION.sc, to generate EMULATION.{x,xr,xu,xn,xbn} -- the script
files for default, -r, -Ur, -n, -N.

Copyright (C) 2012-2020 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.