mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 10:03:47 +08:00
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.
This commit is contained in:
parent
9454c9ce88
commit
906f69cf65
@ -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
|
||||
|
3
ld/testsuite/ld-s390/reloccheck-1.d
Normal file
3
ld/testsuite/ld-s390/reloccheck-1.d
Normal file
@ -0,0 +1,3 @@
|
||||
#as: -m64 -mzarch -march=z900
|
||||
#ld: -m elf64_s390 -e start -static
|
||||
#error: .*misaligned symbol.*
|
14
ld/testsuite/ld-s390/reloccheck-1.s
Normal file
14
ld/testsuite/ld-s390/reloccheck-1.s
Normal file
@ -0,0 +1,14 @@
|
||||
.machinemode zarch
|
||||
.machine "z900"
|
||||
.text
|
||||
.align 8
|
||||
.globl start
|
||||
.type start, @function
|
||||
start:
|
||||
larl %r1, test
|
||||
.globl test
|
||||
.data
|
||||
.align 4
|
||||
.byte 23
|
||||
test:
|
||||
.zero 4
|
Loading…
Reference in New Issue
Block a user