public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][Gold] Fix for incremental copy test
@ 2020-02-13  5:22 Miguel Saldivar
  2020-12-22 20:34 ` Cary Coutant
  0 siblings, 1 reply; 2+ messages in thread
From: Miguel Saldivar @ 2020-02-13  5:22 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

This is a possible solution for fixing the incremental_copy_test
within the gold testsuite.
The issue stems from how gcc-9 handles .rodata sections, more can be
seen here: https://sourceware.org/bugzilla/show_bug.cgi?id=24123.

I figured there was two possible ways to solve this problem, either
handle this on the first run or on the second run.
The first run, compiling with the `--incremental-full`, a solution
would be to set any `.rodata` prefix flag to `A`
instead of `AM`; `AM` is the flag that is outputted in the first run for.

Or the other method when running: `--incremental-update`, or the
second run would be to expect an `AM` rather than a `A`.

But for this case I chose the former rather than the latter, because
the ELF file should have an `.rodata`
section with a flag of `A`, and this ensures that.

[-- Attachment #2: incremental-copy-test-fix.txt --]
[-- Type: text/plain, Size: 1354 bytes --]

From 4d9a34e2de9d61c78e276c0d14ed3e53a59bfa43 Mon Sep 17 00:00:00 2001
From: Miguel Saldivar <saldivarcher@gmail.com>
Date: Sat, 8 Feb 2020 23:06:59 -0800
Subject: [PATCH] Fix for incremental_copy_test

	* output.cc (add_input_section): Handle cases
	when there are no .rodata sections present
	within the object.
---
 gold/ChangeLog | 5 +++++
 gold/output.cc | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/gold/ChangeLog b/gold/ChangeLog
index 5afceea683..1d99507716 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,8 @@
+2020-02-08  Miguel Saldivar <saldivarcher@gmail.com>
+	* output.cc (add_input_section): Handle cases
+	when there are no .rodata sections present
+	within the object.
+
 2020-01-20  Nick Clifton  <nickc@redhat.com>
 
 	* po/uk.po: Updated Ukranian translation.
diff --git a/gold/output.cc b/gold/output.cc
index 75d2fc354a..5c9fd3fc2c 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -2476,6 +2476,11 @@ Output_section::add_input_section(Layout* layout,
       entsize = 1;
     }
 
+  // Handle instances where there are no .rodata sections present,
+  // within the object only .rodata.strN.N sections.
+  if (is_prefix_of(".rodata", secname))
+    sh_flags &= ~(elfcpp::SHF_MERGE | elfcpp::SHF_STRINGS);
+
   this->update_flags_for_input_section(sh_flags);
   this->set_entsize(entsize);
 
-- 
2.25.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][Gold] Fix for incremental copy test
  2020-02-13  5:22 [PATCH][Gold] Fix for incremental copy test Miguel Saldivar
@ 2020-12-22 20:34 ` Cary Coutant
  0 siblings, 0 replies; 2+ messages in thread
From: Cary Coutant @ 2020-12-22 20:34 UTC (permalink / raw)
  To: Miguel Saldivar; +Cc: Binutils

> I figured there was two possible ways to solve this problem, either
> handle this on the first run or on the second run.
> The first run, compiling with the `--incremental-full`, a solution
> would be to set any `.rodata` prefix flag to `A`
> instead of `AM`; `AM` is the flag that is outputted in the first run for.
>
> Or the other method when running: `--incremental-update`, or the
> second run would be to expect an `AM` rather than a `A`.
>
> But for this case I chose the former rather than the latter, because
> the ELF file should have an `.rodata`
> section with a flag of `A`, and this ensures that.

The problem was that gold was failing to mask out the MERGE flag when
processing the base file during an incremental update, so that the
incoming replacement .rodata sections didn't match the one in the base
image. This patch should have fixed the problem:

  https://sourceware.org/pipermail/binutils/2020-December/114482.html

Thanks for looking at it, though, and sorry to have taken so long to get to it.

-cary

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-22 20:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13  5:22 [PATCH][Gold] Fix for incremental copy test Miguel Saldivar
2020-12-22 20:34 ` Cary Coutant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).