diff options
author | Alan Modra <amodra@gcc.gnu.org> | 2016-05-04 22:47:51 +0930 |
---|---|---|
committer | Alan Modra <amodra@gcc.gnu.org> | 2016-05-04 22:47:51 +0930 |
commit | d577ba89642ebb5701d6e2ca7aaf31de2a427794 (patch) | |
tree | 99af9d5e1f698297936c922f6d20d99a26e39c45 | |
parent | a793339b732e4a0cd883de9db8698afbcb88bfdf (diff) | |
download | gcc-d577ba89642ebb5701d6e2ca7aaf31de2a427794.zip gcc-d577ba89642ebb5701d6e2ca7aaf31de2a427794.tar.gz gcc-d577ba89642ebb5701d6e2ca7aaf31de2a427794.tar.bz2 |
[RS6000] Align .toc section
Lack of any .toc section alignment causes kexec and kdump failure
when linking without the usual linker script. This of course is
really a kexec-tools error, but it is also true that .toc ought to
always be word aligned.
* config/rs6000/rs6000.c (rs6000_elf_output_toc_section_asm_op):
Align .toc.
From-SVN: r235874
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 14 |
2 files changed, 18 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ea32ba5..f339b0ec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,9 @@ -2016-06-04 Matthew Fortune <matthew.fortune@imgtec.com> +2016-05-04 Alan Modra <amodra@gmail.com> + + * config/rs6000/rs6000.c (rs6000_elf_output_toc_section_asm_op): + Align .toc. + +2016-05-04 Matthew Fortune <matthew.fortune@imgtec.com> * config/mips/mips-cpus.def (p5600): Avoid IMADD by default. Clean up p5600 comments. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index a88cb19..fb522fb 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -31339,8 +31339,8 @@ rs6000_elf_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED) { if (!toc_initialized) { - toc_initialized = 1; fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); + ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2); (*targetm.asm_out.internal_label) (asm_out_file, "LCTOC", 0); fprintf (asm_out_file, "\t.tc "); ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1[TC],"); @@ -31348,20 +31348,30 @@ rs6000_elf_output_toc_section_asm_op (const void *data ATTRIBUTE_UNUSED) fprintf (asm_out_file, "\n"); fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); + ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2); ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); fprintf (asm_out_file, " = .+32768\n"); + toc_initialized = 1; } else fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); } else if ((DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2) && !TARGET_RELOCATABLE) - fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); + { + fprintf (asm_out_file, "%s\n", TOC_SECTION_ASM_OP); + if (!toc_initialized) + { + ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2); + toc_initialized = 1; + } + } else { fprintf (asm_out_file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); if (!toc_initialized) { + ASM_OUTPUT_ALIGN (asm_out_file, TARGET_64BIT ? 3 : 2); ASM_OUTPUT_INTERNAL_LABEL_PREFIX (asm_out_file, "LCTOC1"); fprintf (asm_out_file, " = .+32768\n"); toc_initialized = 1; |