[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/23560] New: ld generates bad aarch64 veneers/long branch stubs
From: |
rafaelauler at gmail dot com |
Subject: |
[Bug ld/23560] New: ld generates bad aarch64 veneers/long branch stubs |
Date: |
Tue, 21 Aug 2018 16:03:47 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=23560
Bug ID: 23560
Summary: ld generates bad aarch64 veneers/long branch stubs
Product: binutils
Version: 2.31
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: rafaelauler at gmail dot com
Target Milestone: ---
Hi,
I noticed ld is failing to generate long branch stubs for aarch64 under certain
conditions. After debugging the issue to try to understand what was happening,
I observed that the function elfNN_aarch64_size_stubs() has a loop to compute
the veneers, cache them into a special hash table and then redo layout (calling
the layout_sections_again callback), doing this until no new stubs are needed.
It then writes the stubs later by traversing the stub hash table with
aarch64_build_one_stub() calls in elfNN_aarch64_build_stubs().
The problem is that layout_sections_again may change a symbol value (by
changing its containing section's output_offset) but will not update the hash
entry containing the stub destination, which was pre-computed with a now
outdated value, thus generating a veneer with a bad target.
I could reproduce this on ld 2.31, but I wrote the patch for ld 2.36.
diff --git a/binutils-2.26.1/bfd/elfnn-aarch64.c
b/binutils-2.26.1/bfd/elfnn-aarch64.c
--- a/binutils-2.26.1/bfd/elfnn-aarch64.c
+++ b/binutils-2.26.1/bfd/elfnn-aarch64.c
@@ -4163,6 +4163,9 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
{
/* The proper stub has already been created. */
free (stub_name);
+ /* Always update this stub target since it may have
+ changed after layout */
+ stub_entry->target_value = sym_value + irela->r_addend;
continue;
}
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/23560] New: ld generates bad aarch64 veneers/long branch stubs,
rafaelauler at gmail dot com <=