mingw-binutils/binutils-gold-mismatched-section-flags.patch
2020-10-08 17:29:50 +08:00

37 lines
1.2 KiB
Diff

diff -rupN --no-dereference binutils-2.32/gold/layout.cc binutils-2.32-new/gold/layout.cc
--- binutils-2.32/gold/layout.cc 2019-01-19 17:01:33.000000000 +0100
+++ binutils-2.32-new/gold/layout.cc 2019-11-19 20:47:10.054636935 +0100
@@ -868,6 +868,7 @@ Layout::get_output_section(const char* n
&& (same_name->flags() & elfcpp::SHF_TLS) == 0)
os = same_name;
}
+#if 0 /* BZ 1722715, PR 17556. */
else if ((flags & elfcpp::SHF_TLS) == 0)
{
elfcpp::Elf_Xword zero_flags = 0;
@@ -878,6 +879,7 @@ Layout::get_output_section(const char* n
if (p != this->section_name_map_.end())
os = p->second;
}
+#endif
}
if (os == NULL)
diff -rupN --no-dereference binutils-2.32/gold/object.cc binutils-2.32-new/gold/object.cc
--- binutils-2.32/gold/object.cc 2019-01-19 17:01:33.000000000 +0100
+++ binutils-2.32-new/gold/object.cc 2019-11-19 20:47:10.054636935 +0100
@@ -1644,6 +1644,13 @@ Sized_relobj_file<size, big_endian>::do_
omit[i] = true;
}
+ // Skip empty sections without flags.
+ if (!(shdr.get_sh_flags() & ~elfcpp::SHF_GROUP)
+ && !shdr.get_sh_size())
+ {
+ omit[i] = true;
+ }
+
bool discard = omit[i];
if (!discard)
{