+2019-02-20 Eric Tsai <erictsai@cadence.com>
+
+ * elf32-xtensa.c (is_resolvable_asm_expansion): Scan output
+ sections between the call site and call destination and adjust
+ call distance by the largest alignment.
+
2019-02-20 Alan Hayward <alan.hayward@arm.com>
* elf-bfd.h (elfcore_write_aarch_pauth): Add declaration.
bfd_boolean *is_reachable_p)
{
asection *target_sec;
+ asection *s;
+ bfd_vma first_vma;
+ bfd_vma last_vma;
+ unsigned int first_align;
+ unsigned int adjust;
bfd_vma target_offset;
r_reloc r_rel;
xtensa_opcode opcode, direct_call_opcode;
+ target_sec->output_offset + target_offset);
}
+ /* Adjust addresses with alignments for the worst case to see if call insn
+ can fit. Don't relax l32r + callx to call if the target can be out of
+ range due to alignment.
+ Caller and target addresses are highest and lowest address.
+ Search all sections between caller and target, looking for max alignment.
+ The adjustment is max alignment bytes. If the alignment at the lowest
+ address is less than the adjustment, apply the adjustment to highest
+ address. */
+
+ /* Start from lowest address.
+ Lowest address aligmnet is from input section.
+ Initial alignment (adjust) is from input section. */
+ if (dest_address > self_address)
+ {
+ s = sec->output_section;
+ last_vma = dest_address;
+ first_align = sec->alignment_power;
+ adjust = target_sec->alignment_power;
+ }
+ else
+ {
+ s = target_sec->output_section;
+ last_vma = self_address;
+ first_align = target_sec->alignment_power;
+ adjust = sec->alignment_power;
+ }
+
+ first_vma = s->vma;
+
+ /* Find the largest alignment in output section list. */
+ for (; s && s->vma >= first_vma && s->vma <= last_vma ; s = s->next)
+ {
+ if (s->alignment_power > adjust)
+ adjust = s->alignment_power;
+ }
+
+ if (adjust > first_align)
+ {
+ /* Alignment may enlarge the range, adjust highest address. */
+ adjust = 1 << adjust;
+ if (dest_address > self_address)
+ {
+ dest_address += adjust;
+ }
+ else
+ {
+ self_address += adjust;
+ }
+ }
+
*is_reachable_p = pcrel_reloc_fits (direct_call_opcode, 0,
self_address, dest_address);
+2019-02-20 Eric Tsai <erictsai@cadence.com>
+
+ * testsuite/ld-xtensa/call_overflow.d: New test definition.
+ * testsuite/ld-xtensa/call_overflow1.s: New test source.
+ * testsuite/ld-xtensa/call_overflow2.s: New test source.
+ * testsuite/ld-xtensa/call_overflow3.s: New test source.
+ * testsuite/ld-xtensa/xtensa.exp: Add call_overflow test.
+
2019-02-14 Thomas Schwinge <thomas@codesourcery.com>
* testsuite/ld-elf/elf.exp: Remove Hurd XFAILs.