aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-07-26 12:11:11 +0930
committerAlan Modra <amodra@gmail.com>2018-07-26 12:53:50 +0930
commit33cb30a1f932b5a211aa319a01783d4957ae5d57 (patch)
treea3f75b30d87e0e461c47f3e1c786eaa67ad760b3 /gas
parent6cf212b445b4222bef4f74544896a3be332d5a12 (diff)
downloadbinutils-33cb30a1f932b5a211aa319a01783d4957ae5d57.zip
binutils-33cb30a1f932b5a211aa319a01783d4957ae5d57.tar.gz
binutils-33cb30a1f932b5a211aa319a01783d4957ae5d57.tar.bz2
Implement PowerPC64 .localentry for value 1
This adds support for ".localentry 1", a new st_other STO_PPC64_LOCAL_MASK encoding that signifies a function with a single entry point like ".localentry 0", but unlike a ".localentry 0" function does not preserve r2. include/ * elf/ppc64.h: Specify byte offset to local entry for values of two to six in STO_PPC64_LOCAL_MASK. Clarify r2 return value for such functions when entering via global entry point. Specify meaning of a value of one in STO_PPC64_LOCAL_MASK. bfd/ * elf64-ppc.c (ppc64_elf_size_stubs): Use a ppc_stub_long_branch_r2off for calls to symbols with STO_PPC64_LOCAL_MASK bits set to 1. gas/ * config/tc-ppc.c (ppc_elf_localentry): Allow .localentry values of 1 and 7 to directly set value into STO_PPC64_LOCAL_MASK bits. ld/testsuite/ * ld-powerpc/elfv2.s: Add .localentry f5,1 testcase. * ld-powerpc/elfv2exe.d: Update. * ld-powerpc/elfv2so.d: Update.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-ppc.c18
2 files changed, 19 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index e0de16e..fa8a7c5 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-26 Alan Modra <amodra@gmail.com>
+
+ * config/tc-ppc.c (ppc_elf_localentry): Allow .localentry values
+ of 1 and 7 to directly set value into STO_PPC64_LOCAL_MASK bits.
+
2018-07-25 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (Broadcast_Operation): Add bytes.
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 92e5eb5..4388b25 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -2378,13 +2378,23 @@ ppc_elf_localentry (int ignore ATTRIBUTE_UNUSED)
if (resolve_expression (&exp)
&& exp.X_op == O_constant)
{
- unsigned char encoded = PPC64_SET_LOCAL_ENTRY_OFFSET (exp.X_add_number);
+ unsigned int encoded, ok;
- if (exp.X_add_number != (offsetT) PPC64_LOCAL_ENTRY_OFFSET (encoded))
- as_bad (_(".localentry expression for `%s' "
- "is not a valid power of 2"), S_GET_NAME (sym));
+ ok = 1;
+ if (exp.X_add_number == 1 || exp.X_add_number == 7)
+ encoded = exp.X_add_number << STO_PPC64_LOCAL_BIT;
else
{
+ encoded = PPC64_SET_LOCAL_ENTRY_OFFSET (exp.X_add_number);
+ if (exp.X_add_number != (offsetT) PPC64_LOCAL_ENTRY_OFFSET (encoded))
+ {
+ as_bad (_(".localentry expression for `%s' "
+ "is not a valid power of 2"), S_GET_NAME (sym));
+ ok = 0;
+ }
+ }
+ if (ok)
+ {
bfdsym = symbol_get_bfdsym (sym);
elfsym = elf_symbol_from (bfd_asymbol_bfd (bfdsym), bfdsym);
gas_assert (elfsym);