diff options
author | Alan Modra <amodra@gmail.com> | 2014-11-24 12:41:33 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2014-11-24 12:56:59 +1030 |
commit | e05fa0bad203f7236cfe374181e1bd72ccbcaa35 (patch) | |
tree | b3b4df2711cbd31ef2d8f596f40ec56f6f80b18d | |
parent | 1ae92035c29475c97a0795e3f93f068f8e612f25 (diff) | |
download | gdb-e05fa0bad203f7236cfe374181e1bd72ccbcaa35.zip gdb-e05fa0bad203f7236cfe374181e1bd72ccbcaa35.tar.gz gdb-e05fa0bad203f7236cfe374181e1bd72ccbcaa35.tar.bz2 |
PowerPC64 --plt-align
Alignment of plt stubs was broken, firstly because the option was
being dropped due to the alignment value not being set in the "params"
struct used in elf64-ppc.c, and secondly due to not calculating the
number of alignment boundary crossings correctly.
bfd/
* elf64-ppc.c (plt_stub_pad): Correct.
ld/
* ld.texinfo: Correct --plt-align documentation.
* emultempl/ppc64elf.em (plt_stub_align): Delete. Use and set
params.plt_stub_align instead.
-rw-r--r-- | bfd/ChangeLog | 4 | ||||
-rw-r--r-- | bfd/elf64-ppc.c | 2 | ||||
-rw-r--r-- | ld/ChangeLog | 6 | ||||
-rw-r--r-- | ld/emultempl/ppc64elf.em | 13 | ||||
-rw-r--r-- | ld/ld.texinfo | 7 |
5 files changed, 21 insertions, 11 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ac5e299..4472daf 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2014-11-24 Alan Modra <amodra@gmail.com> + + * elf64-ppc.c (plt_stub_pad): Correct. + 2014-11-23 H.J. Lu <hongjiu.lu@intel.com> * elf64-x86-64.c (elf_x86_64_check_relocs): Assert size of diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 0245a2c..c1029df 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -10209,7 +10209,7 @@ plt_stub_pad (struct ppc_link_hash_table *htab, bfd_vma stub_off = stub_entry->stub_sec->size; if (((stub_off + stub_size - 1) & -stub_align) - (stub_off & -stub_align) - > (stub_size & -stub_align)) + > ((stub_size - 1) & -stub_align)) return stub_align - (stub_off & (stub_align - 1)); return 0; } diff --git a/ld/ChangeLog b/ld/ChangeLog index a966603..f33a424 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2014-11-24 Alan Modra <amodra@gmail.com> + + * ld.texinfo: Correct --plt-align documentation. + * emultempl/ppc64elf.em (plt_stub_align): Delete. Use and set + params.plt_stub_align instead. + 2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com> * emulparams/elf_x86_64.sh (BNDPLT): Set to yes for x86_64. diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index 59ea786..9646903 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -62,9 +62,6 @@ static int no_toc_opt = 0; /* Whether to sort input toc and got sections. */ static int no_toc_sort = 0; -/* Set if individual PLT call stubs should be aligned. */ -static int plt_stub_align = 0; - static asection *toc_section = 0; /* This is called before the input files are opened. We create a new @@ -377,7 +374,9 @@ ppc_add_stub_section (const char *stub_sec_name, asection *input_section) stub_sec_name, flags); if (stub_sec == NULL || !bfd_set_section_alignment (stub_file->the_bfd, stub_sec, - plt_stub_align > 5 ? plt_stub_align : 5)) + (params.plt_stub_align > 5 + ? params.plt_stub_align + : 5))) goto err_ret; output_section = input_section->output_section; @@ -800,14 +799,14 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LIST_ARGS_CASES}' unsigned long val = strtoul (optarg, &end, 0); if (*end || val > 8) einfo (_("%P%F: invalid --plt-align `%s'\''\n"), optarg); - plt_stub_align = val; + params.plt_stub_align = val; } else - plt_stub_align = 5; + params.plt_stub_align = 5; break; case OPTION_NO_PLT_ALIGN: - plt_stub_align = 0; + params.plt_stub_align = 0; break; case OPTION_STUBSYMS: diff --git a/ld/ld.texinfo b/ld/ld.texinfo index bb386e4..502582c 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -7052,9 +7052,10 @@ off this feature. @item --plt-align @itemx --no-plt-align Use these options to control whether individual PLT call stubs are -aligned to a 32-byte boundary, or to the specified power of two -boundary when using @code{--plt-align=}. By default PLT call stubs -are packed tightly. +padded so that they don't cross a 32-byte boundary, or to the +specified power of two boundary when using @code{--plt-align=}. Note +that this isn't alignment in the usual sense. By default PLT call +stubs are packed tightly. @cindex PowerPC64 PLT call stub static chain @kindex --plt-static-chain |