[Gold] Fix for incremental copy test

Message ID CA+pbi+6ChUYWX51gygHUq4oWY5iNktjF==BMeeYeK_vBeU_bLg@mail.gmail.com
State New
Headers show
  • [Gold] Fix for incremental copy test
Related show

Commit Message

Miguel Saldivar Feb. 13, 2020, 5:21 a.m.
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.
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);