summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--abs/core/binutils/0001-PR22741-objcopy-segfault-on-fuzzed-COFF-object.patch29
-rw-r--r--abs/core/binutils/0001-x86-64_Dont_pass_output_bfd_to_info-callbacks-minfo.patch29
-rw-r--r--abs/core/binutils/0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch145
-rw-r--r--abs/core/binutils/0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch233
-rw-r--r--abs/core/binutils/0004-PR22868-Fix-case-where-IR-file-provides-symbol-visibility.patch275
-rw-r--r--abs/core/binutils/PKGBUILD57
6 files changed, 718 insertions, 50 deletions
diff --git a/abs/core/binutils/0001-PR22741-objcopy-segfault-on-fuzzed-COFF-object.patch b/abs/core/binutils/0001-PR22741-objcopy-segfault-on-fuzzed-COFF-object.patch
new file mode 100644
index 0000000..24c814e
--- /dev/null
+++ b/abs/core/binutils/0001-PR22741-objcopy-segfault-on-fuzzed-COFF-object.patch
@@ -0,0 +1,29 @@
+From eb77f6a4621795367a39cdd30957903af9dbb815 Mon Sep 17 00:00:00 2001
+From: Alan Modra <amodra@gmail.com>
+Date: Sat, 27 Jan 2018 08:19:33 +1030
+Subject: [PATCH] PR22741, objcopy segfault on fuzzed COFF object
+
+ PR 22741
+ * coffgen.c (coff_pointerize_aux): Ensure auxent tagndx is in
+ range before converting to a symbol table pointer.
+---
+ bfd/coffgen.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/bfd/coffgen.c b/bfd/coffgen.c
+index b2410873d0..4f90eaddd9 100644
+--- a/bfd/coffgen.c
++++ b/bfd/coffgen.c
+@@ -1555,7 +1555,8 @@ coff_pointerize_aux (bfd *abfd,
+ }
+ /* A negative tagndx is meaningless, but the SCO 3.2v4 cc can
+ generate one, so we must be careful to ignore it. */
+- if (auxent->u.auxent.x_sym.x_tagndx.l > 0)
++ if ((unsigned long) auxent->u.auxent.x_sym.x_tagndx.l
++ < obj_raw_syment_count (abfd))
+ {
+ auxent->u.auxent.x_sym.x_tagndx.p =
+ table_base + auxent->u.auxent.x_sym.x_tagndx.l;
+--
+2.16.2
+
diff --git a/abs/core/binutils/0001-x86-64_Dont_pass_output_bfd_to_info-callbacks-minfo.patch b/abs/core/binutils/0001-x86-64_Dont_pass_output_bfd_to_info-callbacks-minfo.patch
deleted file mode 100644
index ce719e7..0000000
--- a/abs/core/binutils/0001-x86-64_Dont_pass_output_bfd_to_info-callbacks-minfo.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 7a7431ddc2332ddc3753330a8dd815bb5f7193c0 Mon Sep 17 00:00:00 2001
-From: "H.J. Lu" <hjl.tools@gmail.com>
-Date: Tue, 26 Sep 2017 14:41:22 -0700
-Subject: [PATCH] x86-64: Don't pass output_bfd to info->callbacks->minfo
-
-Don't pass output_bfd to info->callbacks->minfo when dumping local IFUNC
-functions in the map file.
-
- PR ld/22199
- * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't pass
- output_bfd to info->callbacks->minfo.
-
-(cherry picked from commit ac69a0d75bf472a140e5405c8a90420d5f63a998)
-
-diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
-index d9225ad..1f6dfb8 100644
---- a/bfd/elf64-x86-64.c
-+++ b/bfd/elf64-x86-64.c
-@@ -6133,7 +6133,6 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
- if (SYMBOL_REFERENCES_LOCAL (info, h))
- {
- info->callbacks->minfo (_("Local IFUNC function `%s' in %B\n"),
-- output_bfd,
- h->root.root.string,
- h->root.u.def.section->owner);
-
---
-2.9.3
-
diff --git a/abs/core/binutils/0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch b/abs/core/binutils/0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch
new file mode 100644
index 0000000..3b73a6a
--- /dev/null
+++ b/abs/core/binutils/0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch
@@ -0,0 +1,145 @@
+From 3b56a1358768563d9cf320559ebdedfb30f122dd Mon Sep 17 00:00:00 2001
+From: Alan Modra <amodra@gmail.com>
+Date: Mon, 12 Feb 2018 13:06:07 +1030
+Subject: [PATCH] PR22829, objcopy/strip removes PT_GNU_RELRO from lld binaries
+
+lld lays out the relro segment differently to GNU ld, not bothering to
+include the first few bytes of .got.plt and padding out to a page at
+the end of the segment. This patch teaches binutils to recognize the
+different (and somewhat inferior) layout as valid.
+
+bfd/
+ PR 22829
+ * elf.c (assign_file_positions_for_non_load_sections): Rewrite
+ PT_GNU_RELRO setup.
+ld/
+ * testsuite/ld-x86-64/pr14207.d: Adjust relro p_filesz.
+
+(cherry picked from commit f2731e0c374e5323ce4cdae2bcc7b7fe22da1a6f)
+---
+ bfd/elf.c | 78 ++++++++++++++++++++++++++--------------
+ ld/testsuite/ld-x86-64/pr14207.d | 2 +-
+ 2 files changed, 52 insertions(+), 28 deletions(-)
+
+diff --git a/bfd/elf.c b/bfd/elf.c
+index bbaab26918..f5a230cd77 100644
+--- a/bfd/elf.c
++++ b/bfd/elf.c
+@@ -5826,50 +5826,74 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
+ {
+ if (p->p_type == PT_GNU_RELRO)
+ {
+- const Elf_Internal_Phdr *lp;
+- struct elf_segment_map *lm;
++ bfd_vma start, end;
+
+ if (link_info != NULL)
+ {
+ /* During linking the range of the RELRO segment is passed
+- in link_info. */
++ in link_info. Note that there may be padding between
++ relro_start and the first RELRO section. */
++ start = link_info->relro_start;
++ end = link_info->relro_end;
++ }
++ else if (m->count != 0)
++ {
++ if (!m->p_size_valid)
++ abort ();
++ start = m->sections[0]->vma;
++ end = start + m->p_size;
++ }
++ else
++ {
++ start = 0;
++ end = 0;
++ }
++
++ if (start < end)
++ {
++ struct elf_segment_map *lm;
++ const Elf_Internal_Phdr *lp;
++ unsigned int i;
++
++ /* Find a LOAD segment containing a section in the RELRO
++ segment. */
+ for (lm = elf_seg_map (abfd), lp = phdrs;
+ lm != NULL;
+ lm = lm->next, lp++)
+ {
+ if (lp->p_type == PT_LOAD
+- && lp->p_vaddr < link_info->relro_end
+ && lm->count != 0
+- && lm->sections[0]->vma >= link_info->relro_start)
++ && lm->sections[lm->count - 1]->vma >= start
++ && lm->sections[0]->vma < end)
+ break;
+ }
+-
+ BFD_ASSERT (lm != NULL);
+- }
+- else
+- {
+- /* Otherwise we are copying an executable or shared
+- library, but we need to use the same linker logic. */
+- for (lp = phdrs; lp < phdrs + count; ++lp)
++
++ /* Find the section starting the RELRO segment. */
++ for (i = 0; i < lm->count; i++)
+ {
+- if (lp->p_type == PT_LOAD
+- && lp->p_paddr == p->p_paddr)
++ asection *s = lm->sections[i];
++ if (s->vma >= start
++ && s->vma < end
++ && s->size != 0)
+ break;
+ }
+- }
++ BFD_ASSERT (i < lm->count);
++
++ p->p_vaddr = lm->sections[i]->vma;
++ p->p_paddr = lm->sections[i]->lma;
++ p->p_offset = lm->sections[i]->filepos;
++ p->p_memsz = end - p->p_vaddr;
++ p->p_filesz = p->p_memsz;
++
++ /* The RELRO segment typically ends a few bytes into
++ .got.plt but other layouts are possible. In cases
++ where the end does not match any loaded section (for
++ instance is in file padding), trim p_filesz back to
++ correspond to the end of loaded section contents. */
++ if (p->p_filesz > lp->p_vaddr + lp->p_filesz - p->p_vaddr)
++ p->p_filesz = lp->p_vaddr + lp->p_filesz - p->p_vaddr;
+
+- if (lp < phdrs + count)
+- {
+- p->p_vaddr = lp->p_vaddr;
+- p->p_paddr = lp->p_paddr;
+- p->p_offset = lp->p_offset;
+- if (link_info != NULL)
+- p->p_filesz = link_info->relro_end - lp->p_vaddr;
+- else if (m->p_size_valid)
+- p->p_filesz = m->p_size;
+- else
+- abort ();
+- p->p_memsz = p->p_filesz;
+ /* Preserve the alignment and flags if they are valid. The
+ gold linker generates RW/4 for the PT_GNU_RELRO section.
+ It is better for objcopy/strip to honor these attributes
+diff --git a/ld/testsuite/ld-x86-64/pr14207.d b/ld/testsuite/ld-x86-64/pr14207.d
+index f6558e7cd7..41f92b8bd8 100644
+--- a/ld/testsuite/ld-x86-64/pr14207.d
++++ b/ld/testsuite/ld-x86-64/pr14207.d
+@@ -13,7 +13,7 @@ Program Headers:
+ LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001c8 0x0001c8 R 0x200000
+ LOAD 0x000b.8 0x0000000000200b.8 0x0000000000200b.8 0x0004.0 0x000c.8 RW 0x200000
+ DYNAMIC 0x000b.0 0x0000000000200b.0 0x0000000000200b.0 0x0001.0 0x0001.0 RW 0x8
+- GNU_RELRO 0x000b.8 0x0000000000200b.8 0x0000000000200b.8 0x0004.8 0x0004.8 R 0x1
++ GNU_RELRO 0x000b.8 0x0000000000200b.8 0x0000000000200b.8 0x0004.0 0x0004.8 R 0x1
+
+ Section to Segment mapping:
+ Segment Sections...
+--
+2.16.2
+
diff --git a/abs/core/binutils/0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch b/abs/core/binutils/0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch
new file mode 100644
index 0000000..2f3c652
--- /dev/null
+++ b/abs/core/binutils/0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch
@@ -0,0 +1,233 @@
+From d957f81cb38d7e82ae546cd03265ee3087ba8a85 Mon Sep 17 00:00:00 2001
+From: Alan Modra <amodra@gmail.com>
+Date: Tue, 13 Feb 2018 14:09:48 +1030
+Subject: [PATCH] PR22836, "-r -s" doesn't work with -g3 using GCC 7
+
+This fixes the case where all of a group is removed with ld -r, the
+situation in the PR, and failures where part of a group is removed
+that contain relocs.
+
+bfd/
+ PR 22836
+ * elf.c (_bfd_elf_fixup_group_sections): Account for removed
+ relocation sections. If size reduces to just the flag word,
+ remove that too and mark with SEC_EXCLUDE.
+ * elflink.c (bfd_elf_final_link): Strip empty group sections.
+binutils/
+ * testsuite/binutils-all/group-7.s,
+ * testsuite/binutils-all/group-7a.d,
+ * testsuite/binutils-all/group-7b.d,
+ * testsuite/binutils-all/group-7c.d: New tests.
+ * testsuite/binutils-all/objcopy.exp: Run them.
+ld/
+ * testsuite/ld-elf/pr22836-2.d,
+ * testsuite/ld-elf/pr22836-2.s: New test.
+
+(cherry picked from commit 6e5e9d58c1eeef5677c90886578a895cb8c164c5)
+---
+ bfd/ChangeLog | 11 +++++++++++
+ bfd/elf.c | 25 +++++++++++++++++++++----
+ bfd/elflink.c | 7 +++++++
+ binutils/ChangeLog | 12 ++++++++++++
+ binutils/testsuite/binutils-all/group-7.s | 6 ++++++
+ binutils/testsuite/binutils-all/group-7a.d | 16 ++++++++++++++++
+ binutils/testsuite/binutils-all/group-7b.d | 19 +++++++++++++++++++
+ binutils/testsuite/binutils-all/group-7c.d | 8 ++++++++
+ binutils/testsuite/binutils-all/objcopy.exp | 3 +++
+ ld/ChangeLog | 9 +++++++++
+ ld/testsuite/ld-elf/pr22836-2.d | 7 +++++++
+ ld/testsuite/ld-elf/pr22836-2.s | 7 +++++++
+ 12 files changed, 126 insertions(+), 4 deletions(-)
+ create mode 100644 binutils/testsuite/binutils-all/group-7.s
+ create mode 100644 binutils/testsuite/binutils-all/group-7a.d
+ create mode 100644 binutils/testsuite/binutils-all/group-7b.d
+ create mode 100644 binutils/testsuite/binutils-all/group-7c.d
+ create mode 100644 ld/testsuite/ld-elf/pr22836-2.d
+ create mode 100644 ld/testsuite/ld-elf/pr22836-2.s
+
+diff --git a/bfd/elf.c b/bfd/elf.c
+index 325bdd5..e95c8a9 100644
+--- a/bfd/elf.c
++++ b/bfd/elf.c
+@@ -7579,7 +7579,16 @@ _bfd_elf_fixup_group_sections (bfd *ibfd, asection *discarded)
+ but the SHT_GROUP section is, then adjust its size. */
+ else if (s->output_section == discarded
+ && isec->output_section != discarded)
+- removed += 4;
++ {
++ struct bfd_elf_section_data *elf_sec = elf_section_data (s);
++ removed += 4;
++ if (elf_sec->rel.hdr != NULL
++ && (elf_sec->rel.hdr->sh_flags & SHF_GROUP) != 0)
++ removed += 4;
++ if (elf_sec->rela.hdr != NULL
++ && (elf_sec->rela.hdr->sh_flags & SHF_GROUP) != 0)
++ removed += 4;
++ }
+ s = elf_next_in_group (s);
+ if (s == first)
+ break;
+@@ -7589,18 +7598,26 @@ _bfd_elf_fixup_group_sections (bfd *ibfd, asection *discarded)
+ if (discarded != NULL)
+ {
+ /* If we've been called for ld -r, then we need to
+- adjust the input section size. This function may
+- be called multiple times, so save the original
+- size. */
++ adjust the input section size. */
+ if (isec->rawsize == 0)
+ isec->rawsize = isec->size;
+ isec->size = isec->rawsize - removed;
++ if (isec->size <= 4)
++ {
++ isec->size = 0;
++ isec->flags |= SEC_EXCLUDE;
++ }
+ }
+ else
+ {
+ /* Adjust the output section size when called from
+ objcopy. */
+ isec->output_section->size -= removed;
++ if (isec->output_section->size <= 4)
++ {
++ isec->output_section->size = 0;
++ isec->output_section->flags |= SEC_EXCLUDE;
++ }
+ }
+ }
+ }
+diff --git a/bfd/elflink.c b/bfd/elflink.c
+index 72aa3ac..69cb5ab 100644
+--- a/bfd/elflink.c
++++ b/bfd/elflink.c
+@@ -11618,6 +11618,13 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
+ else
+ o->flags |= SEC_EXCLUDE;
+ }
++ else if ((o->flags & SEC_GROUP) != 0 && o->size == 0)
++ {
++ /* Remove empty group section from linker output. */
++ o->flags |= SEC_EXCLUDE;
++ bfd_section_list_remove (abfd, o);
++ abfd->section_count--;
++ }
+ }
+
+ /* Count up the number of relocations we will output for each output
+diff --git a/binutils/testsuite/binutils-all/group-7.s b/binutils/testsuite/binutils-all/group-7.s
+new file mode 100644
+index 0000000..5028afc
+--- /dev/null
++++ b/binutils/testsuite/binutils-all/group-7.s
+@@ -0,0 +1,6 @@
++ .section .data.foo,"awG",%progbits,foo,comdat
++here:
++ .dc.a here
++
++ .section .data2.foo,"awG",%progbits,foo,comdat
++ .dc.a 0
+diff --git a/binutils/testsuite/binutils-all/group-7a.d b/binutils/testsuite/binutils-all/group-7a.d
+new file mode 100644
+index 0000000..fa8db60
+--- /dev/null
++++ b/binutils/testsuite/binutils-all/group-7a.d
+@@ -0,0 +1,16 @@
++#name: copy removing reloc group member
++#source: group-7.s
++#PROG: objcopy
++#DUMPPROG: readelf
++#objcopy: --remove-section .data.foo
++#readelf: -Sg --wide
++
++#...
++ \[[ 0-9]+\] \.group[ \t]+GROUP[ \t]+.*
++#...
++ \[[ 0-9]+\] \.data2\.foo[ \t]+PROGBITS[ \t0-9a-f]+WAG.*
++#...
++COMDAT group section \[[ 0-9]+\] `\.group' \[foo\] contains 1 section.*
++ \[Index\] Name
++ \[[ 0-9]+\] \.data2\.foo
++#pass
+diff --git a/binutils/testsuite/binutils-all/group-7b.d b/binutils/testsuite/binutils-all/group-7b.d
+new file mode 100644
+index 0000000..b674545
+--- /dev/null
++++ b/binutils/testsuite/binutils-all/group-7b.d
+@@ -0,0 +1,19 @@
++#name: copy removing non-reloc group member
++#source: group-7.s
++#PROG: objcopy
++#DUMPPROG: readelf
++#objcopy: --remove-section .data2.foo
++#readelf: -Sg --wide
++
++#...
++ \[[ 0-9]+\] \.group[ \t]+GROUP[ \t]+.*
++#...
++ \[[ 0-9]+\] \.data\.foo[ \t]+PROGBITS[ \t0-9a-f]+WAG.*
++#...
++ \[[ 0-9]+\] \.rela?\.data\.foo[ \t]+RELA?[ \t0-9a-f]+IG.*
++#...
++COMDAT group section \[[ 0-9]+\] `\.group' \[foo\] contains 2 sections:
++ \[Index\] Name
++ \[[ 0-9]+\] \.data\.foo
++ \[[ 0-9]+\] \.rela?\.data\.foo
++#pass
+diff --git a/binutils/testsuite/binutils-all/group-7c.d b/binutils/testsuite/binutils-all/group-7c.d
+new file mode 100644
+index 0000000..83e9115
+--- /dev/null
++++ b/binutils/testsuite/binutils-all/group-7c.d
+@@ -0,0 +1,8 @@
++#name: copy removing reloc and non-reloc group member
++#source: group-7.s
++#PROG: objcopy
++#DUMPPROG: readelf
++#objcopy: -R .data.foo -R .data2.foo
++#readelf: -g --wide
++
++There are no section groups in this file\.
+diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
+index 377f88c..f4a7692 100644
+--- a/binutils/testsuite/binutils-all/objcopy.exp
++++ b/binutils/testsuite/binutils-all/objcopy.exp
+@@ -1051,6 +1051,9 @@ if [is_elf_format] {
+ objcopy_test_readelf "GNU_MBIND section" mbind1.s
+ run_dump_test "group-5"
+ run_dump_test "group-6"
++ run_dump_test "group-7a"
++ run_dump_test "group-7b"
++ run_dump_test "group-7c"
+ run_dump_test "copy-1"
+ run_dump_test "note-1"
+ if [is_elf64 tmpdir/bintest.o] {
+diff --git a/ld/testsuite/ld-elf/pr22836-2.d b/ld/testsuite/ld-elf/pr22836-2.d
+new file mode 100644
+index 0000000..10133e4
+--- /dev/null
++++ b/ld/testsuite/ld-elf/pr22836-2.d
+@@ -0,0 +1,7 @@
++#source: pr22836-2.s
++#ld: -r -S
++#readelf: -g --wide
++
++group section \[[ 0-9]+\] `\.group' \[foo\] contains 1 section.*
++ \[Index\] Name
++ \[[ 0-9]+\] \.comment
+diff --git a/ld/testsuite/ld-elf/pr22836-2.s b/ld/testsuite/ld-elf/pr22836-2.s
+new file mode 100644
+index 0000000..77cd83a
+--- /dev/null
++++ b/ld/testsuite/ld-elf/pr22836-2.s
+@@ -0,0 +1,7 @@
++ .section .debug_macro,"G",%progbits,foo
++ .long .LASF0
++.LASF0:
++ .string "__STDC__ 1"
++
++ .section .comment,"G",%progbits,foo
++ .asciz "hi"
+--
+2.9.3
+
diff --git a/abs/core/binutils/0004-PR22868-Fix-case-where-IR-file-provides-symbol-visibility.patch b/abs/core/binutils/0004-PR22868-Fix-case-where-IR-file-provides-symbol-visibility.patch
new file mode 100644
index 0000000..999260d
--- /dev/null
+++ b/abs/core/binutils/0004-PR22868-Fix-case-where-IR-file-provides-symbol-visibility.patch
@@ -0,0 +1,275 @@
+From 330b90b5ffbbc20c5de6ae6c7f60c40fab2e7a4f Mon Sep 17 00:00:00 2001
+From: Cary Coutant <ccoutant@gmail.com>
+Date: Fri, 23 Mar 2018 09:03:34 -0700
+Subject: [PATCH] Fix case where IR file provides symbol visibility but
+ replacement file does not.
+
+In PR 22868, two IR files provide conflicting visibility for a symbol.
+When a def with PROTECTED visibility is seen after a def with DEFAULT
+visibility, gold does not override the visibility. Later, if the
+replacement object define the symbol with DEFAULT visibility, the symbol
+remains DEFAULT. This was caused by a recent change to allow multiply-defined
+absolute symbols, combined with the fact that the plugin framework was using
+SHN_ABS as the section index for placeholder symbols. The solution is to
+use a real (but arbitrary) section index.
+
+gold/
+ PR gold/22868
+ * plugin.cc (Sized_pluginobj::do_add_symbols): Use a real section
+ index instead of SHN_ABS for defined symbols.
+ * testsuite/Makefile.am (plugin_pr22868): New test case.
+ * testsuite/Makefile.in: Regenerate
+ * testsuite/plugin_pr22868.sh: New test script.
+ * testsuite/plugin_pr22868_a.c: New source file.
+ * testsuite/plugin_pr22868_b.c: New source file.
+---
+ gold/plugin.cc | 3 ++-
+ gold/testsuite/Makefile.am | 21 ++++++++++++++++++
+ gold/testsuite/Makefile.in | 28 +++++++++++++++++++++---
+ gold/testsuite/plugin_pr22868.sh | 45 +++++++++++++++++++++++++++++++++++++++
+ gold/testsuite/plugin_pr22868_a.c | 28 ++++++++++++++++++++++++
+ gold/testsuite/plugin_pr22868_b.c | 39 +++++++++++++++++++++++++++++++++
+ 6 files changed, 160 insertions(+), 4 deletions(-)
+ create mode 100755 gold/testsuite/plugin_pr22868.sh
+ create mode 100644 gold/testsuite/plugin_pr22868_a.c
+ create mode 100644 gold/testsuite/plugin_pr22868_b.c
+
+diff --git a/gold/plugin.cc b/gold/plugin.cc
+index 02fef25..a59f19d 100644
+--- a/gold/plugin.cc
++++ b/gold/plugin.cc
+@@ -1144,7 +1144,8 @@ Sized_pluginobj<size, big_endian>::do_add_symbols(Symbol_table* symtab,
+ {
+ case LDPK_DEF:
+ case LDPK_WEAKDEF:
+- shndx = elfcpp::SHN_ABS;
++ // We use an arbitrary section number for a defined symbol.
++ shndx = 1;
+ break;
+ case LDPK_COMMON:
+ shndx = elfcpp::SHN_COMMON;
+diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
+index 16cae80..d086dad 100644
+--- a/gold/testsuite/Makefile.am
++++ b/gold/testsuite/Makefile.am
+@@ -2433,6 +2433,27 @@ plugin_section_alignment.so: plugin_section_alignment.o gcctestdir/ld
+ plugin_section_alignment.o: plugin_section_alignment.cc
+ $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
+
++check_SCRIPTS += plugin_pr22868.sh
++check_DATA += plugin_pr22868.stdout
++MOSTLYCLEANFILES += plugin_pr22868.stdout
++plugin_pr22868.stdout: plugin_pr22868.so
++ $(TEST_READELF) -W --dyn-syms $< >$@ 2>/dev/null
++plugin_pr22868.so: plugin_pr22868_a.o.syms plugin_pr22868_b.o.syms plugin_pr22868_b.o plugin_test.so gcctestdir/ld
++ $(LINK) -Bgcctestdir/ -shared -Wl,--plugin,"./plugin_test.so" plugin_pr22868_a.o.syms plugin_pr22868_b.o.syms
++plugin_pr22868_a.o.syms: plugin_pr22868_a.o
++ $(TEST_READELF) -sW $< >$@ 2>/dev/null
++# Generate the .syms file from an alternate version of the original source
++# file, with a "protected" visibility attribute. We'll link with a
++# "replacement" object that does not have that attribute.
++plugin_pr22868_b.o.syms: plugin_pr22868_b_ir.o
++ $(TEST_READELF) -sW $< >$@ 2>/dev/null
++plugin_pr22868_a.o: plugin_pr22868_a.c
++ $(COMPILE) -c -fpic -o $@ $<
++plugin_pr22868_b_ir.o: plugin_pr22868_b.c
++ $(COMPILE) -c -DIR -fpic -o $@ $<
++plugin_pr22868_b.o: plugin_pr22868_b.c
++ $(COMPILE) -c -fpic -o $@ $<
++
+ endif PLUGINS
+
+ check_PROGRAMS += exclude_libs_test
+diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
+index bbf8dc1..22940ca 100644
+--- a/gold/testsuite/Makefile.in
++++ b/gold/testsuite/Makefile.in
+@@ -591,16 +591,19 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@am__append_52 = unused.c \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_final_layout \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_layout_new_file \
+-@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_layout_with_alignment
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_layout_with_alignment \
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_pr22868.stdout
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@am__append_53 = plugin_final_layout.sh \
+-@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_layout_with_alignment.sh
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_layout_with_alignment.sh \
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_pr22868.sh
+
+ # Uses the plugin_final_layout.sh script above to avoid duplication
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@am__append_54 = plugin_final_layout.stdout \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_final_layout_readelf.stdout \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_layout_new_file.stdout \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_layout_new_file_readelf.stdout \
+-@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_layout_with_alignment.stdout
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_layout_with_alignment.stdout \
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_pr22868.stdout
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_55 = exclude_libs_test \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ local_labels_test \
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ discard_locals_test
+@@ -5299,6 +5302,8 @@ plugin_final_layout.sh.log: plugin_final_layout.sh
+ @p='plugin_final_layout.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+ plugin_layout_with_alignment.sh.log: plugin_layout_with_alignment.sh
+ @p='plugin_layout_with_alignment.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
++plugin_pr22868.sh.log: plugin_pr22868.sh
++ @p='plugin_pr22868.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+ exclude_libs_test.sh.log: exclude_libs_test.sh
+ @p='exclude_libs_test.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
+ discard_locals_test.sh.log: discard_locals_test.sh
+@@ -7086,6 +7091,23 @@ uninstall-am:
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared plugin_section_alignment.o
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_section_alignment.o: plugin_section_alignment.cc
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_pr22868.stdout: plugin_pr22868.so
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(TEST_READELF) -W --dyn-syms $< >$@ 2>/dev/null
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_pr22868.so: plugin_pr22868_a.o.syms plugin_pr22868_b.o.syms plugin_pr22868_b.o plugin_test.so gcctestdir/ld
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(LINK) -Bgcctestdir/ -shared -Wl,--plugin,"./plugin_test.so" plugin_pr22868_a.o.syms plugin_pr22868_b.o.syms
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_pr22868_a.o.syms: plugin_pr22868_a.o
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(TEST_READELF) -sW $< >$@ 2>/dev/null
++# Generate the .syms file from an alternate version of the original source
++# file, with a "protected" visibility attribute. We'll link with a
++# "replacement" object that does not have that attribute.
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_pr22868_b.o.syms: plugin_pr22868_b_ir.o
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(TEST_READELF) -sW $< >$@ 2>/dev/null
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_pr22868_a.o: plugin_pr22868_a.c
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(COMPILE) -c -fpic -o $@ $<
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_pr22868_b_ir.o: plugin_pr22868_b.c
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(COMPILE) -c -DIR -fpic -o $@ $<
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_pr22868_b.o: plugin_pr22868_b.c
++@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(COMPILE) -c -fpic -o $@ $<
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@exclude_libs_test.syms: exclude_libs_test
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -sW $< >$@ 2>/dev/null
+ @GCC_TRUE@@NATIVE_LINKER_TRUE@libexclude_libs_test_1.a: exclude_libs_test_1.o
+diff --git a/gold/testsuite/plugin_pr22868.sh b/gold/testsuite/plugin_pr22868.sh
+new file mode 100755
+index 0000000..72f364b
+--- /dev/null
++++ b/gold/testsuite/plugin_pr22868.sh
+@@ -0,0 +1,45 @@
++#!/bin/sh
++
++# plugin_pr22868.sh -- a test case for the plugin API.
++
++# Copyright (C) 2018 Free Software Foundation, Inc.
++# Written by Cary Coutant <ccoutant@google.com>.
++
++# This file is part of gold.
++
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 3 of the License, or
++# (at your option) any later version.
++
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++
++# You should have received a copy of the GNU General Public License
++# along with this program; if not, write to the Free Software
++# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
++# MA 02110-1301, USA.
++
++# This file goes with plugin_pr22868_a.c and plugin_pr22868_b.c,
++# which check that if a symbol is declared PROTECTED in any IR file,
++# it will remain PROTECTED in the output even if the replacement file(s)
++# fail to declare it PROTECTED.
++
++check()
++{
++ if ! grep -q "$2" "$1"
++ then
++ echo "Did not find expected output in $1:"
++ echo " $2"
++ echo ""
++ echo "Actual output below:"
++ cat "$1"
++ exit 1
++ fi
++}
++
++check plugin_pr22868.stdout "PROTECTED.*foo"
++
++exit 0
+diff --git a/gold/testsuite/plugin_pr22868_a.c b/gold/testsuite/plugin_pr22868_a.c
+new file mode 100644
+index 0000000..86a9843
+--- /dev/null
++++ b/gold/testsuite/plugin_pr22868_a.c
+@@ -0,0 +1,28 @@
++/* plugin_pr22868_a.c -- a test case for the plugin API with GC.
++
++ Copyright (C) 2018 Free Software Foundation, Inc.
++ Written by Cary Coutant <ccoutant@gmail.com>.
++
++ This file is part of gold.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
++ MA 02110-1301, USA. */
++
++int foo(int i) __attribute__ (( weak ));
++
++int foo(int i)
++{
++ return i + 1;
++}
+diff --git a/gold/testsuite/plugin_pr22868_b.c b/gold/testsuite/plugin_pr22868_b.c
+new file mode 100644
+index 0000000..92d2145
+--- /dev/null
++++ b/gold/testsuite/plugin_pr22868_b.c
+@@ -0,0 +1,39 @@
++/* plugin_pr22868_b_ir.c -- a test case for the plugin API with GC.
++
++ Copyright (C) 2018 Free Software Foundation, Inc.
++ Written by Cary Coutant <ccoutant@gmail.com>.
++
++ This file is part of gold.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 3 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
++ MA 02110-1301, USA. */
++
++/* This file is compiled with -DIR to generate the .syms file,
++ and without -DIR for use as the replacement object.
++ The .syms file declares foo with protected visibility, but
++ the replacement file does not. */
++
++#ifdef IR
++#define PROTECTED __attribute__ (( visibility ("protected") ))
++#else
++#define PROTECTED
++#endif
++
++int foo(int i) __attribute__ (( weak )) PROTECTED;
++
++int foo(int i)
++{
++ return i + 1;
++}
+--
+2.9.3
+
diff --git a/abs/core/binutils/PKGBUILD b/abs/core/binutils/PKGBUILD
index 1efbd7b..e2b300c 100644
--- a/abs/core/binutils/PKGBUILD
+++ b/abs/core/binutils/PKGBUILD
@@ -1,30 +1,34 @@
# $Id$
-# Maintainer: Allan McRae <allan@archlinux.org>
+# Maintainer: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
+# Contributor: Allan McRae <allan@archlinux.org>
# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
pkgname=binutils
-pkgver=2.29.1
-pkgrel=2
+pkgver=2.30
+pkgrel=5
pkgdesc='A set of programs to assemble and manipulate binary and object files'
arch=(x86_64)
url='http://www.gnu.org/software/binutils/'
license=(GPL)
-groups=('base-devel')
-depends=('glibc>=2.26' zlib)
-makedepends=(git)
+groups=(base-devel)
+depends=(glibc zlib)
checkdepends=(dejagnu bc)
conflicts=(binutils-multilib)
replaces=(binutils-multilib)
options=(staticlibs !distcc !ccache)
-#_commit=d1a6e7195b9bb0255fa77588985b969ad8aaacf5
-#source=(git+https://sourceware.org/git/binutils-gdb.git#commit=${_commit}
source=(https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.xz{,.sig}
- 0001-x86-64_Dont_pass_output_bfd_to_info-callbacks-minfo.patch)
+ 0001-PR22741-objcopy-segfault-on-fuzzed-COFF-object.patch
+ 0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch
+ 0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch
+ 0004-PR22868-Fix-case-where-IR-file-provides-symbol-visibility.patch)
validpgpkeys=(3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F)
-md5sums=('acc9cd826edb9954ac7cecb81c727793'
+md5sums=('ffc476dd46c96f932875d1b2e27e929f'
'SKIP'
- 'e4be936139ef46122cb3841881c432b2')
+ '469164f3c93a0e92a697537b60c9806c'
+ '0c679b37e90fb23de60a4d28329b956a'
+ '53b5682e09c0a27e9994c3efdfe01d29'
+ '0fac94f7fa54a95354454677d3e43994')
prepare() {
mkdir -p binutils-build
@@ -35,8 +39,17 @@ prepare() {
# hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS"
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
- # https://bugs.archlinux.org/task/55741
- git apply ../0001-x86-64_Dont_pass_output_bfd_to_info-callbacks-minfo.patch
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=22741
+ patch -p1 -i "$srcdir/0001-PR22741-objcopy-segfault-on-fuzzed-COFF-object.patch"
+
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=22829
+ patch -p1 -i "$srcdir/0002-PR22829-objcopy-strip-removes-PT_GNU_RELRO-from-lld-.patch"
+
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=22836
+ patch -p1 -i "$srcdir/0003-PR22836-r-s-doesnt-work-with-g3-using-GCC-7.patch"
+
+ # https://sourceware.org/bugzilla/show_bug.cgi?id=22868
+ patch -p1 -i "$srcdir/0004-PR22868-Fix-case-where-IR-file-provides-symbol-visibility.patch"
}
build() {
@@ -46,16 +59,18 @@ build() {
--prefix=/usr \
--with-lib-path=/usr/lib:/usr/local/lib \
--with-bugurl=https://bugs.archlinux.org/ \
- --enable-threads \
- --enable-shared \
- --enable-ld=default \
+ --enable-deterministic-archives \
--enable-gold \
+ --enable-ld=default \
+ --enable-lto \
--enable-plugins \
--enable-relro \
- --enable-deterministic-archives \
- --with-pic \
- --disable-werror \
+ --enable-shared \
+ --enable-targets=x86_64-pep \
+ --enable-threads \
--disable-gdb \
+ --disable-werror \
+ --with-pic \
--with-system-zlib
make configure-host
@@ -79,6 +94,6 @@ package() {
# No shared linking to these files outside binutils
rm -f "$pkgdir"/usr/lib/lib{bfd,opcodes}.so
- echo "INPUT( /usr/lib/libbfd.a -liberty -lz -ldl )" > "$pkgdir/usr/lib/libbfd.so"
- echo "INPUT( /usr/lib/libopcodes.a -lbfd )" > "$pkgdir/usr/lib/libopcodes.so"
+ echo 'INPUT( /usr/lib/libbfd.a -liberty -lz -ldl )' > "$pkgdir/usr/lib/libbfd.so"
+ echo 'INPUT( /usr/lib/libopcodes.a -lbfd )' > "$pkgdir/usr/lib/libopcodes.so"
}