This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/4590: String merging breaks ia64 linker
"H. J. Lu" <hjl@lucon.org> writes:
> On Sat, Jun 09, 2007 at 11:29:02AM -0700, H. J. Lu wrote:
>> When a string is merged with another one, we have to remove its
>> addend from the array of addends. Otherwise, get_dyn_sym_info
>> may return the entry whose addend has been merged. This patch
>> calls sort_dyn_sym_info to remove the merged addends from the
>> array.
>>
>
> The got entry may be allocated for the original or merged string.
> This updated patch handles both cases.
That still does not work right. With the original unreduced testcase
there are many assertion failures in elf64-ia64.c:4128 (got_offset is
-1).
One problem is that this hunk needs to be moved in the following loop:
@@ -2255,6 +2255,31 @@ sort_dyn_sym_info (struct elfNN_ia64_dyn
{
/* We need to move a block of elements to here. */
dest = i++;
+
+ if (merged)
+ {
+ /* If a string is merged with another one, we need to
+ make sure that the kept entry has a valid got_offset. */
+ unsigned int kept = dest - 1;
+
+ if (info [kept].got_offset == (bfd_vma) -1)
+ {
+ unsigned int j;
+
+ for (j = dest; j < count; j++)
+ {
+ if (info [j].addend != curr)
+ break;
+
+ if (info [j].got_offset != (bfd_vma) -1)
+ {
+ info [kept].got_offset = info [j].got_offset;
+ break;
+ }
+ }
+ }
+ }
+
while (i < count)
{
curr = info [i].addend;
Another problem is the loop that tries to combine with the next
duplicate:
if (len == 1 && dup < count)
{
/* If we only move 1 element, we combine it with the next
one. Find the next different one. */
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."