&& SYMBOL_REFERENCES_LOCAL (info, h))
|| resolved_to_zero)
{
+ Elf_Internal_Sym *isym;
+ asection *sym_sec;
+
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
locally, or the symbol was forced to be local
h->got.offset |= 1;
}
+ /* When turning a GOT slot dereference into a direct
+ reference using larl we have to make sure that
+ the symbol is 1. properly aligned and 2. it is no
+ ABS symbol or will become one. */
if ((h->def_regular
&& bfd_link_pic (info)
&& SYMBOL_REFERENCES_LOCAL (info, h))
contents + rel->r_offset - 2)
& 0xff00f000) == 0xe300c000
&& bfd_get_8 (input_bfd,
- contents + rel->r_offset + 3) == 0x04)))
-
+ contents + rel->r_offset + 3) == 0x04))
+ && (isym = bfd_sym_from_r_symndx (&htab->sym_cache,
+ input_bfd, r_symndx))
+ && isym->st_shndx != SHN_ABS
+ && h != htab->elf.hdynamic
+ && h != htab->elf.hgot
+ && h != htab->elf.hplt
+ && !(isym->st_value & 1)
+ && (sym_sec = bfd_section_from_elf_index (input_bfd,
+ isym->st_shndx))
+ && sym_sec->alignment_power)
{
unsigned short new_insn =
(0xc000 | (bfd_get_8 (input_bfd,
- .text
+.text
.globl foo
foo:
lgrl %r1,bar@GOTENT
lrl %r1,bar@GOTENT
l %r1,bar@GOT(%r12)
ly %r1,bar@GOT(%r12)
+ lgrl %r1,_GLOBAL_OFFSET_TABLE_@GOTENT
+ lgrl %r1,misaligned_sym@GOTENT
+.data
.globl bar
-bar: .long 0x123
+bar: .quad 0x123
+
+.globl misaligned_sym
+ .byte 1
+misaligned_sym:
+ .quad 42
-{ local: bar; };
+{ local: bar; misaligned_sym; };
Disassembly of section .text:
.* <foo>:
-.*: c4 18 00 00 08 4e [ ]*lgrl %r1,118c <_GLOBAL_OFFSET_TABLE_\+0xc>
-.*: e3 10 c0 0c 00 04 [ ]*lg %r1,12\(%r12\)
-.*: c0 10 00 00 00 08 [ ]*larl %r1,10c <bar>
-.*: 58 10 c0 0c [ ]*l %r1,12\(%r12\)
-.*: c0 10 00 00 00 03 [ ]*larl %r1,10c <bar>
-.* <bar>:
-.*: 00 00 01 23 .long 0x00000123
+.*: c4 18 00 00 08 56 [ ]*lgrl %r1,11b4 <_GLOBAL_OFFSET_TABLE_\+0x14>
+.*: e3 10 c0 14 00 04 [ ]*lg %r1,20\(%r12\)
+.*: c0 10 00 00 08 52 [ ]*larl %r1,11b8 <bar>
+.*: 58 10 c0 14 [ ]*l %r1,20\(%r12\)
+.*: c0 10 00 00 08 4d [ ]*larl %r1,11b8 <bar>
+.*: c4 18 00 00 08 46 [ ]*lgrl %r1,11b0 <_GLOBAL_OFFSET_TABLE_\+0x10>
+.*: c4 18 00 00 08 41 [ ]*lgrl %r1,11ac <_GLOBAL_OFFSET_TABLE_\+0xc>
Disassembly of section .text:
.* <foo>:
-.*: c0 10 00 00 00 0e [ ]*larl %r1,.* <bar>
-.*: c0 10 00 00 00 0b [ ]*larl %r1,.* <bar>
-.*: c4 1d 00 00 08 86 [ ]*lrl %r1,.* <_GLOBAL_OFFSET_TABLE_\+0x18>
-.*: 58 10 c0 18 [ ]*l %r1,24\(%r12\)
-.*: e3 10 c0 18 00 58 [ ]*ly %r1,24\(%r12\)
-.* <bar>:
-.*: 00 00 01 23 .long 0x00000123
+.*: c0 10 00 00 08 9c [ ]*larl %r1,12e8 <bar>
+.*: c0 10 00 00 08 99 [ ]*larl %r1,12e8 <bar>
+.*: c4 1d 00 00 08 92 [ ]*lrl %r1,12e0 <_GLOBAL_OFFSET_TABLE_\+0x28>
+.*: 58 10 c0 28 [ ]*l %r1,40\(%r12\)
+.*: e3 10 c0 28 00 58 [ ]*ly %r1,40\(%r12\)
+.*: c4 18 00 00 08 86 [ ]*lgrl %r1,12d8 <_GLOBAL_OFFSET_TABLE_\+0x20>
+.*: c4 18 00 00 08 7f [ ]*lgrl %r1,12d0 <_GLOBAL_OFFSET_TABLE_\+0x18>
Disassembly of section .text:
.* <foo>:
-.*: c0 10 00 00 00 0e [ ]*larl %r1,.* <bar>
-.*: c0 10 00 00 00 0b [ ]*larl %r1,.* <bar>
-.*: c4 1d 00 00 0f 1a [ ]*lrl %r1,.* <_GLOBAL_OFFSET_TABLE_\+0x18>
-.*: 58 10 c0 18 [ ]*l %r1,24\(%r12\)
-.*: e3 10 c0 18 00 58 [ ]*ly %r1,24\(%r12\)
-.* <bar>:
-.*: 00 00 01 23 .long 0x00000123
+.*: c0 10 00 00 0f 0c [ ]*larl %r1,2000 <bar>
+.*: c0 10 00 00 0f 09 [ ]*larl %r1,2000 <bar>
+.*: c4 1d 00 00 0f 02 [ ]*lrl %r1,1ff8 <_GLOBAL_OFFSET_TABLE_\+0x28>
+.*: 58 10 c0 28 [ ]*l %r1,40\(%r12\)
+.*: e3 10 c0 28 00 58 [ ]*ly %r1,40\(%r12\)
+.*: c4 18 00 00 0e f6 [ ]*lgrl %r1,1ff0 <_GLOBAL_OFFSET_TABLE_\+0x20>
+.*: c4 18 00 00 0e ef [ ]*lgrl %r1,1fe8 <_GLOBAL_OFFSET_TABLE_\+0x18>