diff options
author | Andreas Krebbel <krebbel@linux.ibm.com> | 2022-10-19 09:03:17 +0200 |
---|---|---|
committer | Andreas Krebbel <krebbel@linux.ibm.com> | 2022-10-19 09:03:17 +0200 |
commit | 906f69cf65daa8fee1c1c94a5c2fb221ba02b40d (patch) | |
tree | b4b68625589003e42dff226699c2387520fa8b7a /bfd | |
parent | 9454c9ce88b25646d279feed329c9cdba69b4905 (diff) | |
download | gdb-906f69cf65daa8fee1c1c94a5c2fb221ba02b40d.zip gdb-906f69cf65daa8fee1c1c94a5c2fb221ba02b40d.tar.gz gdb-906f69cf65daa8fee1c1c94a5c2fb221ba02b40d.tar.bz2 |
IBM zSystems: Issue error for *DBL relocs on misaligned symbols
Relocs like PC32DBL require a right shift of the symbol value. There
is no situation where dropping symbol value bits with the right shift
is a good thing. Hence we now issue an error to detect such problems.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/elf64-s390.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index c1ed3d6..fa44971 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -3056,6 +3056,24 @@ elf_s390_relocate_section (bfd *output_bfd, || r_type == R_390_PLT24DBL) rel->r_offset--; + /* Issue an error if the right shift implied by the relocation + would drop bits from the symbol value. */ + if (howto->rightshift + && (relocation & (((bfd_vma)1 << howto->rightshift) - 1))) + { + _bfd_error_handler + /* xgettext:c-format */ + (_("%pB(%pA+%#" PRIx64 "): " + "misaligned symbol `%s' (%#" PRIx64 ") for relocation %s"), + input_bfd, + input_section, + (uint64_t) rel->r_offset, + h->root.root.string, + (uint64_t)relocation, + howto->name); + return false; + } + if (r_type == R_390_20 || r_type == R_390_GOT20 || r_type == R_390_GOTPLT20 |