Hello community,

here is the log from the commit of package binutils for openSUSE:Factory 
checked in at 2018-12-03 10:02:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/binutils (Old)
 and      /work/SRC/openSUSE:Factory/.binutils.new.19453 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "binutils"

Mon Dec  3 10:02:55 2018 rev:130 rq:652180 version:2.31

Changes:
--------
--- /work/SRC/openSUSE:Factory/binutils/binutils.changes        2018-08-13 
09:53:41.290752780 +0200
+++ /work/SRC/openSUSE:Factory/.binutils.new.19453/binutils.changes     
2018-12-03 10:03:04.212111958 +0100
@@ -1,0 +2,51 @@
+Tue Nov 27 12:43:42 UTC 2018 - Martin Liška <[email protected]>
+
+- Add handle-ELF-compressed-header-alignment-correctly-by-.patch:
+  PR23919.
+
+-------------------------------------------------------------------
+Tue Aug 28 14:07:15 UTC 2018 - [email protected]
+
+- Update to binutils-2_31-branch @e51abf7e3, minor bugfixes in
+  the support for the X86_ISA_1_* notes.  Adds
+  patch binutils-2.31-branch.diff.gz .
+- Add binutils-revert-plt32-in-branches.diff on anything older
+  than Tumbleweed to not break old tools not expecting
+  PLT32 instead of PC32 relocs on x86_64.
+- Includes fixes for these CVEs:
+  * from 2.30:
+    bnc#1065643 aka CVE-2017-15996 aka PR22361
+    bnc#1065689 aka CVE-2017-15939 aka PR22205
+    bnc#1065693 aka CVE-2017-15938 aka PR22209
+    bnc#1068640 aka CVE-2017-16826 aka PR22376
+    bnc#1068643 aka CVE-2017-16832 aka PR22373
+    bnc#1068887 aka CVE-2017-16831 aka PR22385
+    bnc#1068888 aka CVE-2017-16830 aka PR22384
+    bnc#1068950 aka CVE-2017-16829 aka PR22307
+    bnc#1069176 aka CVE-2017-16828 aka PR22386
+    bnc#1069202 aka CVE-2017-16827 aka PR22306
+  * from 2.31:
+    bnc#1077745 aka CVE-2018-6323  aka PR22746
+    bnc#1079103 aka CVE-2018-6543  aka PR22769
+    bnc#1079741 aka CVE-2018-6759  aka PR22794
+    bnc#1080556 aka CVE-2018-6872  aka PR22788
+    bnc#1081527 aka CVE-2018-7208  aka PR22741
+    bnc#1083528 aka CVE-2018-7570  aka PR22881
+    bnc#1083532 aka CVE-2018-7569  aka PR22895
+    bnc#1086608 aka CVE-2018-8945  aka PR22809
+    bnc#1086784 aka CVE-2018-7643  aka PR22905
+    bnc#1086786 aka CVE-2018-7642  aka PR22887
+    bnc#1086788 aka CVE-2018-7568  aka PR22894
+    bnc#1090997 aka CVE-2018-10373 aka PR23065
+    bnc#1091015 aka CVE-2018-10372 aka PR23064
+    bnc#1091365 aka CVE-2018-10535 aka PR23113
+    bnc#1091368 aka CVE-2018-10534 aka PR23110
+- Removes binutils-fix-pr21964.diff as it's included in 2.31.
+  Rebase testsuite.diff and aarch64-common-pagesize.patch .
+
+-------------------------------------------------------------------
+Tue Jul 31 11:45:27 UTC 2018 - [email protected]
+
+- Disable -z separate-code everywhere but in Tumbleweed.
+
+-------------------------------------------------------------------
@@ -45,0 +97,9 @@
+
+-------------------------------------------------------------------
+Tue Apr  3 14:56:44 UTC 2018 - [email protected]
+
+- Fix pacemaker libqb problem with section start/stop
+  symbols, aka PR21964.  [bnc#1075418]
+  Adds binutils-fix-pr21964.diff .
+(this is a change from SLE12, that was already included in 2.31
+binutils tree, mentioned for completeness to not loose tracking)
cross-aarch64-binutils.changes: same change
cross-arm-binutils.changes: same change
cross-avr-binutils.changes: same change
cross-epiphany-binutils.changes: same change
cross-hppa-binutils.changes: same change
cross-hppa64-binutils.changes: same change
cross-i386-binutils.changes: same change
cross-ia64-binutils.changes: same change
cross-m68k-binutils.changes: same change
cross-mips-binutils.changes: same change
cross-ppc-binutils.changes: same change
cross-ppc64-binutils.changes: same change
cross-ppc64le-binutils.changes: same change
cross-riscv64-binutils.changes: same change
cross-rx-binutils.changes: same change
cross-s390-binutils.changes: same change
cross-s390x-binutils.changes: same change
cross-sparc-binutils.changes: same change
cross-sparc64-binutils.changes: same change
cross-spu-binutils.changes: same change
cross-x86_64-binutils.changes: same change

New:
----
  binutils-2.31-branch.diff.gz
  binutils-revert-plt32-in-branches.diff
  handle-ELF-compressed-header-alignment-correctly-by-.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ binutils.spec ++++++
--- /var/tmp/diff_new_pack.t3bKj6/_old  2018-12-03 10:03:12.184104696 +0100
+++ /var/tmp/diff_new_pack.t3bKj6/_new  2018-12-03 10:03:12.188104692 +0100
@@ -12,7 +12,7 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
@@ -79,7 +79,7 @@
 Source1:        pre_checkin.sh
 Source2:        README.First-for.SuSE.packagers
 Source3:        baselibs.conf
-#Patch:          binutils-2.31-branch.diff
+Patch:          binutils-2.31-branch.diff.gz
 Patch3:         binutils-skip-rpaths.patch
 Patch4:         s390-biarch.diff
 Patch5:         x86-64-biarch.patch
@@ -93,6 +93,8 @@
 Patch22:        binutils-bfd_h.patch
 Patch34:        aarch64-common-pagesize.patch
 Patch36:        binutils-pr22868.diff
+Patch37:        binutils-revert-plt32-in-branches.diff
+Patch38:        handle-ELF-compressed-header-alignment-correctly-by-.patch
 Patch90:        cross-avr-nesc-as.patch
 Patch92:        cross-avr-omit_section_dynsym.patch
 Patch93:        cross-avr-size.patch
@@ -148,7 +150,7 @@
 %setup -q -n binutils-%{version}
 # Patch is outside test_vanilla because it's supposed to be the
 # patch bringing the tarball to the newest upstream version
-#%patch -p1
+%patch -p1
 %if !%{test_vanilla}
 %patch3
 %patch4
@@ -163,6 +165,10 @@
 %patch22
 %patch34 -p1
 %patch36 -p1
+%if %{suse_version} < 1550
+%patch37 -p1
+%endif
+%patch38 -p1
 %if "%{TARGET}" == "avr"
 cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h
 %patch90
@@ -239,6 +245,9 @@
 %if %{suse_version} > 1320
        --enable-compressed-debug-sections=gas \
 %endif
+%if %{suse_version} < 1550
+       --disable-separate-code \
+%endif
        --enable-new-dtags \
 %if "%{TARGET}" != "mips"
        --enable-default-hash-style=both \

++++++ cross-aarch64-binutils.spec ++++++
--- /var/tmp/diff_new_pack.t3bKj6/_old  2018-12-03 10:03:12.208104674 +0100
+++ /var/tmp/diff_new_pack.t3bKj6/_new  2018-12-03 10:03:12.212104670 +0100
@@ -12,7 +12,7 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
@@ -82,7 +82,7 @@
 Source1:        pre_checkin.sh
 Source2:        README.First-for.SuSE.packagers
 Source3:        baselibs.conf
-#Patch:          binutils-2.31-branch.diff
+Patch:          binutils-2.31-branch.diff.gz
 Patch3:         binutils-skip-rpaths.patch
 Patch4:         s390-biarch.diff
 Patch5:         x86-64-biarch.patch
@@ -96,6 +96,8 @@
 Patch22:        binutils-bfd_h.patch
 Patch34:        aarch64-common-pagesize.patch
 Patch36:        binutils-pr22868.diff
+Patch37:        binutils-revert-plt32-in-branches.diff
+Patch38:        handle-ELF-compressed-header-alignment-correctly-by-.patch
 Patch90:        cross-avr-nesc-as.patch
 Patch92:        cross-avr-omit_section_dynsym.patch
 Patch93:        cross-avr-size.patch
@@ -151,7 +153,7 @@
 %setup -q -n binutils-%{version}
 # Patch is outside test_vanilla because it's supposed to be the
 # patch bringing the tarball to the newest upstream version
-#%patch -p1
+%patch -p1
 %if !%{test_vanilla}
 %patch3
 %patch4
@@ -166,6 +168,10 @@
 %patch22
 %patch34 -p1
 %patch36 -p1
+%if %{suse_version} < 1550
+%patch37 -p1
+%endif
+%patch38 -p1
 %if "%{TARGET}" == "avr"
 cp gas/config/tc-avr.h gas/config/tc-avr-nesc.h
 %patch90
@@ -242,6 +248,9 @@
 %if %{suse_version} > 1320
        --enable-compressed-debug-sections=gas \
 %endif
+%if %{suse_version} < 1550
+       --disable-separate-code \
+%endif
        --enable-new-dtags \
 %if "%{TARGET}" != "mips"
        --enable-default-hash-style=both \

cross-arm-binutils.spec: same change
cross-avr-binutils.spec: same change
cross-epiphany-binutils.spec: same change
cross-hppa-binutils.spec: same change
cross-hppa64-binutils.spec: same change
cross-i386-binutils.spec: same change
cross-ia64-binutils.spec: same change
cross-m68k-binutils.spec: same change
cross-mips-binutils.spec: same change
cross-ppc-binutils.spec: same change
cross-ppc64-binutils.spec: same change
cross-ppc64le-binutils.spec: same change
cross-riscv64-binutils.spec: same change
cross-rx-binutils.spec: same change
cross-s390-binutils.spec: same change
cross-s390x-binutils.spec: same change
cross-sparc-binutils.spec: same change
cross-sparc64-binutils.spec: same change
cross-spu-binutils.spec: same change
cross-x86_64-binutils.spec: same change
++++++ binutils-2.31-branch.diff.gz ++++++
++++ 18162 lines (skipped)

++++++ binutils-revert-plt32-in-branches.diff ++++++
This reverts the below commit to not generate PLT32 relocs
on branches by default.  Used for old distros to not have to
update several packages/tools that can't handle them.  I.e.
a compatibility patch.

The changes in nop-[345].d and pr22842b.S are followups to
not break the testsuite because of this revert.

commit bd7ab16b4537788ad53521c45469a1bdae84ad4a
Author: H.J. Lu <[email protected]>
Date:   Tue Feb 13 07:34:22 2018 -0800

    x86-64: Generate branch with PLT32 relocation
    
    Since there is no need to prepare for PLT branch on x86-64, generate
    R_X86_64_PLT32, instead of R_X86_64_PC32, if possible, which can be
    used as a marker for 32-bit PC-relative branches.
    
    To compile Linux kernel, this patch:
    
    From: "H.J. Lu" <[email protected]>
    Subject: [PATCH] x86: Treat R_X86_64_PLT32 as R_X86_64_PC32
    
    On i386, there are 2 types of PLTs, PIC and non-PIC.  PIE and shared
    objects must use PIC PLT.  To use PIC PLT, you need to load
    _GLOBAL_OFFSET_TABLE_ into EBX first.  There is no need for that on
    x86-64 since x86-64 uses PC-relative PLT.
    
    On x86-64, for 32-bit PC-relative branches, we can generate PLT32
    relocation, instead of PC32 relocation, which can also be used as
    a marker for 32-bit PC-relative branches.  Linker can always reduce
    PLT32 relocation to PC32 if function is defined locally.   Local
    functions should use PC32 relocation.  As far as Linux kernel is
    concerned, R_X86_64_PLT32 can be treated the same as R_X86_64_PC32
    since Linux kernel doesn't use PLT.
    
    is needed.  It is available on hjl/plt32/master branch at
    
    https://github.com/hjl-tools/linux
    
    bfd/
    
        PR gas/22791
        * elf64-x86-64.c (is_32bit_relative_branch): Removed.
        (elf_x86_64_relocate_section): Check PIC relocations in PIE.
        Remove is_32bit_relative_branch usage.  Disallow PC32 reloc
        against protected function in shared object.
    
    gas/
    
        PR gas/22791
        * config/tc-i386.c (need_plt32_p): New function.
        (output_jump): Generate BFD_RELOC_X86_64_PLT32 if possible.
        (md_estimate_size_before_relax): Likewise.
        * testsuite/gas/i386/reloc64.d: Updated.
        * testsuite/gas/i386/x86-64-jump.d: Likewise.
        * testsuite/gas/i386/x86-64-mpx-branch-1.d: Likewise.
        * testsuite/gas/i386/x86-64-mpx-branch-2.d: Likewise.
        * testsuite/gas/i386/x86-64-relax-2.d: Likewise.
        * testsuite/gas/i386/x86-64-relax-3.d: Likewise.
        * testsuite/gas/i386/ilp32/reloc64.d: Likewise.
        * testsuite/gas/i386/ilp32/x86-64-branch.d: Likewise.
    
    ld/
    
        PR gas/22791
        * testsuite/ld-x86-64/mpx1c.rd: Updated.
        * testsuite/ld-x86-64/pr22791-1.err: New file.
        * testsuite/ld-x86-64/pr22791-1a.c: Likewise.
        * testsuite/ld-x86-64/pr22791-1b.s: Likewise.
        * testsuite/ld-x86-64/pr22791-2.rd: Likewise.
        * testsuite/ld-x86-64/pr22791-2a.s: Likewise.
        * testsuite/ld-x86-64/pr22791-2b.c: Likewise.
        * testsuite/ld-x86-64/pr22791-2c.s: Likewise.
        * testsuite/ld-x86-64/x86-64.exp: Run PR ld/22791 tests.

Index: binutils-2.31/bfd/elf64-x86-64.c
===================================================================
--- binutils-2.31.orig/bfd/elf64-x86-64.c       2018-07-05 09:15:08.000000000 
+0200
+++ binutils-2.31/bfd/elf64-x86-64.c    2018-08-28 15:31:31.000000000 +0200
@@ -2359,6 +2359,24 @@ elf_x86_64_tpoff (struct bfd_link_info *
   return address - static_tls_size - htab->tls_sec->vma;
 }
 
+/* Is the instruction before OFFSET in CONTENTS a 32bit relative
+   branch?  */
+
+static bfd_boolean
+is_32bit_relative_branch (bfd_byte *contents, bfd_vma offset)
+{
+  /* Opcode            Instruction
+     0xe8              call
+     0xe9              jump
+     0x0f 0x8x         conditional jump */
+  return ((offset > 0
+          && (contents [offset - 1] == 0xe8
+              || contents [offset - 1] == 0xe9))
+         || (offset > 1
+             && contents [offset - 2] == 0x0f
+             && (contents [offset - 1] & 0xf0) == 0x80));
+}
+
 /* Relocate an x86_64 ELF section.  */
 
 static bfd_boolean
@@ -3067,18 +3085,14 @@ use_plt:
        case R_X86_64_PC32:
        case R_X86_64_PC32_BND:
          /* Don't complain about -fPIC if the symbol is undefined when
-            building executable unless it is unresolved weak symbol,
-            references a dynamic definition in PIE or -z nocopyreloc
-            is used.  */
+            building executable unless it is unresolved weak symbol or
+            -z nocopyreloc is used.  */
          if ((input_section->flags & SEC_ALLOC) != 0
              && (input_section->flags & SEC_READONLY) != 0
              && h != NULL
              && ((bfd_link_executable (info)
                   && ((h->root.type == bfd_link_hash_undefweak
                        && !resolved_to_zero)
-                      || (bfd_link_pie (info)
-                          && !h->def_regular
-                          && h->def_dynamic)
                       || ((info->nocopyreloc
                            || (eh->def_protected
                                && elf_has_no_copy_on_protected 
(h->root.u.def.section->owner)))
@@ -3087,21 +3101,26 @@ use_plt:
                  || bfd_link_dll (info)))
            {
              bfd_boolean fail = FALSE;
+             bfd_boolean branch
+               = ((r_type == R_X86_64_PC32
+                   || r_type == R_X86_64_PC32_BND)
+                  && is_32bit_relative_branch (contents, rel->r_offset));
+
              if (SYMBOL_REFERENCES_LOCAL_P (info, h))
                {
                  /* Symbol is referenced locally.  Make sure it is
-                    defined locally.  */
-                 fail = !(h->def_regular || ELF_COMMON_DEF_P (h));
+                    defined locally or for a branch.  */
+                 fail = (!(h->def_regular || ELF_COMMON_DEF_P (h))
+                         && !branch);
                }
              else if (!(bfd_link_pie (info)
                         && (h->needs_copy || eh->needs_copy)))
                {
                  /* Symbol doesn't need copy reloc and isn't referenced
-                    locally.  Address of protected function may not be
-                    reachable at run-time.  */
-                 fail = (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
-                         || (ELF_ST_VISIBILITY (h->other) == STV_PROTECTED
-                             && h->type == STT_FUNC));
+                    locally.  We only allow branch to symbol with
+                    non-default visibility. */
+                 fail = (!branch
+                         || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT);
                }
 
              if (fail)
Index: binutils-2.31/gas/config/tc-i386.c
===================================================================
--- binutils-2.31.orig/gas/config/tc-i386.c     2018-08-28 15:31:17.000000000 
+0200
+++ binutils-2.31/gas/config/tc-i386.c  2018-08-28 15:31:31.000000000 +0200
@@ -7415,46 +7415,12 @@ output_branch (void)
   frag_var (rs_machine_dependent, 5, i.reloc[0], subtype, sym, off, p);
 }
 
-#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
-/* Return TRUE iff PLT32 relocation should be used for branching to
-   symbol S.  */
-
-static bfd_boolean
-need_plt32_p (symbolS *s)
-{
-  /* PLT32 relocation is ELF only.  */
-  if (!IS_ELF)
-    return FALSE;
-
-  /* Since there is no need to prepare for PLT branch on x86-64, we
-     can generate R_X86_64_PLT32, instead of R_X86_64_PC32, which can
-     be used as a marker for 32-bit PC-relative branches.  */
-  if (!object_64bit)
-    return FALSE;
-
-  /* Weak or undefined symbol need PLT32 relocation.  */
-  if (S_IS_WEAK (s) || !S_IS_DEFINED (s))
-    return TRUE;
-
-  /* Non-global symbol doesn't need PLT32 relocation.  */
-  if (! S_IS_EXTERNAL (s))
-    return FALSE;
-
-  /* Other global symbols need PLT32 relocation.  NB: Symbol with
-     non-default visibilities are treated as normal global symbol
-     so that PLT32 relocation can be used as a marker for 32-bit
-     PC-relative branches.  It is useful for linker relaxation.  */
-  return TRUE;
-}
-#endif
-
 static void
 output_jump (void)
 {
   char *p;
   int size;
   fixS *fixP;
-  bfd_reloc_code_real_type jump_reloc = i.reloc[0];
 
   if (i.tm.opcode_modifier.jumpbyte)
     {
@@ -7522,17 +7488,8 @@ output_jump (void)
       abort ();
     }
 
-#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
-  if (size == 4
-      && jump_reloc == NO_RELOC
-      && need_plt32_p (i.op[0].disps->X_add_symbol))
-    jump_reloc = BFD_RELOC_X86_64_PLT32;
-#endif
-
-  jump_reloc = reloc (size, 1, 1, jump_reloc);
-
   fixP = fix_new_exp (frag_now, p - frag_now->fr_literal, size,
-                     i.op[0].disps, 1, jump_reloc);
+                     i.op[0].disps, 1, reloc (size, 1, 1, i.reloc[0]));
 
   /* All jumps handled here are signed, but don't use a signed limit
      check for 32 and 16 bit jumps as we want to allow wrap around at
@@ -9757,10 +9714,6 @@ md_estimate_size_before_relax (fragS *fr
        reloc_type = (enum bfd_reloc_code_real) fragP->fr_var;
       else if (size == 2)
        reloc_type = BFD_RELOC_16_PCREL;
-#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
-      else if (need_plt32_p (fragP->fr_symbol))
-       reloc_type = BFD_RELOC_X86_64_PLT32;
-#endif
       else
        reloc_type = BFD_RELOC_32_PCREL;
 
Index: binutils-2.31/gas/testsuite/gas/i386/ilp32/reloc64.d
===================================================================
--- binutils-2.31.orig/gas/testsuite/gas/i386/ilp32/reloc64.d   2018-06-24 
20:38:57.000000000 +0200
+++ binutils-2.31/gas/testsuite/gas/i386/ilp32/reloc64.d        2018-08-28 
15:31:31.000000000 +0200
@@ -16,7 +16,7 @@ Disassembly of section \.text:
 .*[    ]+R_X86_64_PC8[         ]+xtrn\+0x0*1
 .*[    ]+R_X86_64_PC32[        ]+xtrn-0x0*4
 .*[    ]+R_X86_64_PC32[        ]+xtrn-0x0*4
-.*[    ]+R_X86_64_PLT32[       ]+xtrn-0x0*4
+.*[    ]+R_X86_64_PC32[        ]+xtrn-0x0*4
 .*[    ]+R_X86_64_PC8[         ]+xtrn-0x0*1
 .*[    ]+R_X86_64_GOT32[       ]+xtrn
 .*[    ]+R_X86_64_GOT32[       ]+xtrn
Index: binutils-2.31/gas/testsuite/gas/i386/ilp32/x86-64-branch.d
===================================================================
--- binutils-2.31.orig/gas/testsuite/gas/i386/ilp32/x86-64-branch.d     
2018-06-24 20:38:57.000000000 +0200
+++ binutils-2.31/gas/testsuite/gas/i386/ilp32/x86-64-branch.d  2018-08-28 
15:31:31.000000000 +0200
@@ -20,9 +20,9 @@ Disassembly of section .text:
 [      ]*[a-f0-9]+:    66 ff 20                data16 jmpq \*\(%rax\)
 [      ]*[a-f0-9]+:    e8 00 00 00 00          callq  0x1f     1b: 
R_X86_64_PC32       \*ABS\*\+0x10003c
 [      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   0x24     20: 
R_X86_64_PC32       \*ABS\*\+0x10003c
-[      ]*[a-f0-9]+:    66 e8 00 00 00 00       data16 callq 0x2a       26: 
R_X86_64_PLT32      foo-0x4
-[      ]*[a-f0-9]+:    66 e9 00 00 00 00       data16 jmpq 0x30        2c: 
R_X86_64_PLT32      foo-0x4
-[      ]*[a-f0-9]+:    66 0f 82 00 00 00 00    data16 jb 0x37  33: 
R_X86_64_PLT32      foo-0x4
+[      ]*[a-f0-9]+:    66 e8 00 00 00 00       data16 callq 0x2a       26: 
R_X86_64_PC32       foo-0x4
+[      ]*[a-f0-9]+:    66 e9 00 00 00 00       data16 jmpq 0x30        2c: 
R_X86_64_PC32       foo-0x4
+[      ]*[a-f0-9]+:    66 0f 82 00 00 00 00    data16 jb 0x37  33: 
R_X86_64_PC32       foo-0x4
 [      ]*[a-f0-9]+:    ff d0                   callq  \*%rax
 [      ]*[a-f0-9]+:    ff d0                   callq  \*%rax
 [      ]*[a-f0-9]+:    66 ff d0                data16 callq \*%rax
Index: binutils-2.31/gas/testsuite/gas/i386/reloc64.d
===================================================================
--- binutils-2.31.orig/gas/testsuite/gas/i386/reloc64.d 2018-06-24 
20:38:57.000000000 +0200
+++ binutils-2.31/gas/testsuite/gas/i386/reloc64.d      2018-08-28 
15:31:31.000000000 +0200
@@ -18,7 +18,7 @@ Disassembly of section \.text:
 .*[    ]+R_X86_64_PC8[         ]+xtrn\+0x0*1
 .*[    ]+R_X86_64_PC32[        ]+xtrn-0x0*4
 .*[    ]+R_X86_64_PC32[        ]+xtrn-0x0*4
-.*[    ]+R_X86_64_PLT32[       ]+xtrn-0x0*4
+.*[    ]+R_X86_64_PC32[        ]+xtrn-0x0*4
 .*[    ]+R_X86_64_PC8[         ]+xtrn-0x0*1
 .*[    ]+R_X86_64_GOT64[       ]+xtrn
 .*[    ]+R_X86_64_GOT32[       ]+xtrn
Index: binutils-2.31/gas/testsuite/gas/i386/x86-64-jump.d
===================================================================
--- binutils-2.31.orig/gas/testsuite/gas/i386/x86-64-jump.d     2018-06-24 
20:38:57.000000000 +0200
+++ binutils-2.31/gas/testsuite/gas/i386/x86-64-jump.d  2018-08-28 
15:31:31.000000000 +0200
@@ -8,7 +8,7 @@ Disassembly of section .text:
 
 0+ <.text>:
 [      ]*[a-f0-9]+:    eb fe                   jmp    (0x0|0 <.text>)
-[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   0x7      3: 
R_X86_64_PLT32       xxx-0x4
+[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   0x7      3: 
R_X86_64_PC32        xxx-0x4
 [      ]*[a-f0-9]+:    ff 24 25 00 00 00 00    jmpq   \*0x0    a: R_X86_64_32S 
xxx
 [      ]*[a-f0-9]+:    ff e7                   jmpq   \*%rdi
 [      ]*[a-f0-9]+:    ff 27                   jmpq   \*\(%rdi\)
@@ -17,7 +17,7 @@ Disassembly of section .text:
 [      ]*[a-f0-9]+:    ff 2c 25 00 00 00 00    ljmp   \*0x0    24: 
R_X86_64_32S        xxx
 [      ]*[a-f0-9]+:    66 ff 2c 25 00 00 00 00         ljmpw  \*0x0    2c: 
R_X86_64_32S        xxx
 [      ]*[a-f0-9]+:    e8 cb ff ff ff          callq  0x0
-[      ]*[a-f0-9]+:    e8 00 00 00 00          callq  0x3a     36: 
R_X86_64_PLT32      xxx-0x4
+[      ]*[a-f0-9]+:    e8 00 00 00 00          callq  0x3a     36: 
R_X86_64_PC32       xxx-0x4
 [      ]*[a-f0-9]+:    ff 14 25 00 00 00 00    callq  \*0x0    3d: 
R_X86_64_32S        xxx
 [      ]*[a-f0-9]+:    ff d7                   callq  \*%rdi
 [      ]*[a-f0-9]+:    ff 17                   callq  \*\(%rdi\)
Index: binutils-2.31/gas/testsuite/gas/i386/x86-64-mpx-branch-1.d
===================================================================
--- binutils-2.31.orig/gas/testsuite/gas/i386/x86-64-mpx-branch-1.d     
2018-06-24 20:38:57.000000000 +0200
+++ binutils-2.31/gas/testsuite/gas/i386/x86-64-mpx-branch-1.d  2018-08-28 
15:31:31.000000000 +0200
@@ -20,9 +20,9 @@ Disassembly of section .text:
 [      ]*[a-f0-9]+:    f2 e8 00 00 00 00       bnd callq 24 <foo2>
 
 0+24 <foo2>:
-[      ]*[a-f0-9]+:    f2 e9 00 00 00 00       bnd jmpq 2a <foo2\+0x6> 26: 
R_X86_64_PLT32      foo-0x4
-[      ]*[a-f0-9]+:    f2 0f 82 00 00 00 00    bnd jb 31 <foo2\+0xd>   2d: 
R_X86_64_PLT32      foo-0x4
-[      ]*[a-f0-9]+:    f2 e8 00 00 00 00       bnd callq 37 <foo2\+0x13>       
33: R_X86_64_PLT32      foo-0x4
+[      ]*[a-f0-9]+:    f2 e9 00 00 00 00       bnd jmpq 2a <foo2\+0x6> 26: 
R_X86_64_PC32       foo-0x4
+[      ]*[a-f0-9]+:    f2 0f 82 00 00 00 00    bnd jb 31 <foo2\+0xd>   2d: 
R_X86_64_PC32       foo-0x4
+[      ]*[a-f0-9]+:    f2 e8 00 00 00 00       bnd callq 37 <foo2\+0x13>       
33: R_X86_64_PC32       foo-0x4
 [      ]*[a-f0-9]+:    f2 e9 00 00 00 00       bnd jmpq 3d <foo2\+0x19>        
39: R_X86_64_PLT32      foo-0x4
 [      ]*[a-f0-9]+:    f2 0f 82 00 00 00 00    bnd jb 44 <foo2\+0x20>  40: 
R_X86_64_PLT32      foo-0x4
 [      ]*[a-f0-9]+:    f2 e8 00 00 00 00       bnd callq 4a <foo2\+0x26>       
46: R_X86_64_PLT32      foo-0x4
Index: binutils-2.31/gas/testsuite/gas/i386/x86-64-mpx-branch-2.d
===================================================================
--- binutils-2.31.orig/gas/testsuite/gas/i386/x86-64-mpx-branch-2.d     
2018-06-24 20:38:57.000000000 +0200
+++ binutils-2.31/gas/testsuite/gas/i386/x86-64-mpx-branch-2.d  2018-08-28 
15:31:31.000000000 +0200
@@ -20,9 +20,9 @@ Disassembly of section .text:
 [      ]*[a-f0-9]+:    f2 e8 00 00 00 00       bnd callq 24 <foo2>
 
 0+24 <foo2>:
-[      ]*[a-f0-9]+:    f2 e9 00 00 00 00       bnd jmpq 2a <foo2\+0x6> 26: 
R_X86_64_PLT32      foo-0x4
-[      ]*[a-f0-9]+:    f2 0f 82 00 00 00 00    bnd jb 31 <foo2\+0xd>   2d: 
R_X86_64_PLT32      foo-0x4
-[      ]*[a-f0-9]+:    f2 e8 00 00 00 00       bnd callq 37 <foo2\+0x13>       
33: R_X86_64_PLT32      foo-0x4
+[      ]*[a-f0-9]+:    f2 e9 00 00 00 00       bnd jmpq 2a <foo2\+0x6> 26: 
R_X86_64_PC32       foo-0x4
+[      ]*[a-f0-9]+:    f2 0f 82 00 00 00 00    bnd jb 31 <foo2\+0xd>   2d: 
R_X86_64_PC32       foo-0x4
+[      ]*[a-f0-9]+:    f2 e8 00 00 00 00       bnd callq 37 <foo2\+0x13>       
33: R_X86_64_PC32       foo-0x4
 [      ]*[a-f0-9]+:    f2 e9 00 00 00 00       bnd jmpq 3d <foo2\+0x19>        
39: R_X86_64_PLT32      foo-0x4
 [      ]*[a-f0-9]+:    f2 0f 82 00 00 00 00    bnd jb 44 <foo2\+0x20>  40: 
R_X86_64_PLT32      foo-0x4
 [      ]*[a-f0-9]+:    f2 e8 00 00 00 00       bnd callq 4a <foo2\+0x26>       
46: R_X86_64_PLT32      foo-0x4
Index: binutils-2.31/gas/testsuite/gas/i386/x86-64-relax-2.d
===================================================================
--- binutils-2.31.orig/gas/testsuite/gas/i386/x86-64-relax-2.d  2018-06-24 
20:38:57.000000000 +0200
+++ binutils-2.31/gas/testsuite/gas/i386/x86-64-relax-2.d       2018-08-28 
15:31:31.000000000 +0200
@@ -10,12 +10,12 @@ Disassembly of section .text:
 0+ <foo>:
 [      ]*[a-f0-9]+:    eb 24                   jmp    26 <local>
 [      ]*[a-f0-9]+:    eb 1e                   jmp    22 <hidden_def>
-[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   9 <foo\+0x9>     5: 
R_X86_64_PLT32       global_def-0x4
+[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   9 <foo\+0x9>     5: 
R_X86_64_PC32        global_def-0x4
 [      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   e <foo\+0xe>     a: 
R_X86_64_PLT32       global_def-0x4
-[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   13 <foo\+0x13>   f: 
R_X86_64_PLT32       weak_def-0x4
-[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   18 <foo\+0x18>   14: 
R_X86_64_PLT32      weak_hidden_undef-0x4
-[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   1d <foo\+0x1d>   19: 
R_X86_64_PLT32      weak_hidden_def-0x4
-[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   22 <hidden_def>  1e: 
R_X86_64_PLT32      hidden_undef-0x4
+[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   13 <foo\+0x13>   f: 
R_X86_64_PC32        weak_def-0x4
+[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   18 <foo\+0x18>   14: 
R_X86_64_PC32       weak_hidden_undef-0x4
+[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   1d <foo\+0x1d>   19: 
R_X86_64_PC32       weak_hidden_def-0x4
+[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   22 <hidden_def>  1e: 
R_X86_64_PC32       hidden_undef-0x4
 
 0+22 <hidden_def>:
 [      ]*[a-f0-9]+:    c3                      retq   
Index: binutils-2.31/gas/testsuite/gas/i386/x86-64-relax-3.d
===================================================================
--- binutils-2.31.orig/gas/testsuite/gas/i386/x86-64-relax-3.d  2018-06-24 
20:38:57.000000000 +0200
+++ binutils-2.31/gas/testsuite/gas/i386/x86-64-relax-3.d       2018-08-28 
15:31:31.000000000 +0200
@@ -11,10 +11,10 @@ Disassembly of section .text:
 [      ]*[a-f0-9]+:    eb 1b                   jmp    1f <hidden_def>
 [      ]*[a-f0-9]+:    eb 1b                   jmp    21 <global_def>
 [      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   b <foo\+0xb>     7: 
R_X86_64_PLT32       global_def-0x4
-[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   10 <foo\+0x10>   c: 
R_X86_64_PLT32       weak_def-0x4
-[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   15 <foo\+0x15>   11: 
R_X86_64_PLT32      weak_hidden_undef-0x4
-[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   1a <foo\+0x1a>   16: 
R_X86_64_PLT32      weak_hidden_def-0x4
-[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   1f <hidden_def>  1b: 
R_X86_64_PLT32      hidden_undef-0x4
+[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   10 <foo\+0x10>   c: 
R_X86_64_PC32        weak_def-0x4
+[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   15 <foo\+0x15>   11: 
R_X86_64_PC32       weak_hidden_undef-0x4
+[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   1a <foo\+0x1a>   16: 
R_X86_64_PC32       weak_hidden_def-0x4
+[      ]*[a-f0-9]+:    e9 00 00 00 00          jmpq   1f <hidden_def>  1b: 
R_X86_64_PC32       hidden_undef-0x4
 
 0+1f <hidden_def>:
 [      ]*[a-f0-9]+:    c3                      retq   
Index: binutils-2.31/ld/testsuite/ld-x86-64/mpx1c.rd
===================================================================
--- binutils-2.31.orig/ld/testsuite/ld-x86-64/mpx1c.rd  2018-06-24 
20:38:58.000000000 +0200
+++ binutils-2.31/ld/testsuite/ld-x86-64/mpx1c.rd       2018-08-28 
15:31:31.000000000 +0200
@@ -1,3 +1,3 @@
 #...
-[0-9a-f ]+R_X86_64_PLT32 +0+ +.*
+[0-9a-f ]+R_X86_64_PC32 +0+ +.*
 #...
Index: binutils-2.31/ld/testsuite/ld-x86-64/pr22791-1.err
===================================================================
--- binutils-2.31.orig/ld/testsuite/ld-x86-64/pr22791-1.err     2018-06-24 
20:38:58.000000000 +0200
+++ /dev/null   1970-01-01 00:00:00.000000000 +0000
@@ -1,2 +0,0 @@
-.*relocation R_X86_64_PC32 against symbol `foo' can not be used when making a 
PIE object; recompile with -fPIC
-#...
Index: binutils-2.31/ld/testsuite/ld-x86-64/pr22791-1a.c
===================================================================
--- binutils-2.31.orig/ld/testsuite/ld-x86-64/pr22791-1a.c      2018-06-24 
20:38:58.000000000 +0200
+++ /dev/null   1970-01-01 00:00:00.000000000 +0000
@@ -1,4 +0,0 @@
-void
-foo (void)
-{
-}
Index: binutils-2.31/ld/testsuite/ld-x86-64/pr22791-1b.s
===================================================================
--- binutils-2.31.orig/ld/testsuite/ld-x86-64/pr22791-1b.s      2018-06-24 
20:38:58.000000000 +0200
+++ /dev/null   1970-01-01 00:00:00.000000000 +0000
@@ -1,6 +0,0 @@
-       .text
-       .globl  main
-       .type   main, @function
-main:
-       movl    foo(%rip), %eax
-       .size   main, .-main
Index: binutils-2.31/ld/testsuite/ld-x86-64/pr22791-2.rd
===================================================================
--- binutils-2.31.orig/ld/testsuite/ld-x86-64/pr22791-2.rd      2018-06-24 
20:38:58.000000000 +0200
+++ /dev/null   1970-01-01 00:00:00.000000000 +0000
@@ -1,6 +0,0 @@
-#failif
-#...
-.*\(TEXTREL\).*
-#...
-[0-9a-f ]+R_X86_64_NONE.*
-#...
Index: binutils-2.31/ld/testsuite/ld-x86-64/pr22791-2a.s
===================================================================
--- binutils-2.31.orig/ld/testsuite/ld-x86-64/pr22791-2a.s      2018-06-24 
20:38:58.000000000 +0200
+++ /dev/null   1970-01-01 00:00:00.000000000 +0000
@@ -1,8 +0,0 @@
-       .text
-       .p2align 4,,15
-       .globl  foo
-       .type   foo, @function
-foo:
-       jmp     bar
-       .size   foo, .-foo
-       .section        .note.GNU-stack,"",@progbits
Index: binutils-2.31/ld/testsuite/ld-x86-64/pr22791-2b.c
===================================================================
--- binutils-2.31.orig/ld/testsuite/ld-x86-64/pr22791-2b.c      2018-06-24 
20:38:58.000000000 +0200
+++ /dev/null   1970-01-01 00:00:00.000000000 +0000
@@ -1,7 +0,0 @@
-#include <stdio.h>
-
-void
-bar (void)
-{
-  puts ("PASS");
-}
Index: binutils-2.31/ld/testsuite/ld-x86-64/pr22791-2c.s
===================================================================
--- binutils-2.31.orig/ld/testsuite/ld-x86-64/pr22791-2c.s      2018-06-24 
20:38:58.000000000 +0200
+++ /dev/null   1970-01-01 00:00:00.000000000 +0000
@@ -1,12 +0,0 @@
-       .text
-       .p2align 4,,15
-       .globl  main
-       .type   main, @function
-main:
-       subq    $8, %rsp
-       call    foo
-       xorl    %eax, %eax
-       addq    $8, %rsp
-       ret
-       .size   main, .-main
-       .section        .note.GNU-stack,"",@progbits
Index: binutils-2.31/ld/testsuite/ld-x86-64/x86-64.exp
===================================================================
--- binutils-2.31.orig/ld/testsuite/ld-x86-64/x86-64.exp        2018-08-28 
15:31:17.000000000 +0200
+++ binutils-2.31/ld/testsuite/ld-x86-64/x86-64.exp     2018-08-28 
15:31:31.000000000 +0200
@@ -1180,44 +1180,6 @@ if { [isnative] && [which $CC] != 0 } {
            "pr22393-3-static" \
        ] \
        [list \
-           "Build pr22791-1.so" \
-           "-shared" \
-           "-fPIC" \
-           { pr22791-1a.c } \
-           {} \
-           "pr22791-1.so" \
-       ] \
-       [list \
-           "Build pr22791-1" \
-           "-pie -Wl,--no-as-needed tmpdir/pr22791-1.so" \
-           "$NOPIE_CFLAGS" \
-           { pr22791-1b.s } \
-           {{error_output "pr22791-1.err"}} \
-           "pr22791-1" \
-       ] \
-       [list \
-           "Build pr22791-2a.o" \
-           "" \
-           "$NOPIE_CFLAGS" \
-           { pr22791-2a.s } \
-       ] \
-       [list \
-           "Build pr22791-2.so" \
-           "-shared tmpdir/pr22791-2a.o" \
-           "-fPIC" \
-           { pr22791-2b.c } \
-           {{readelf -drW pr22791-2.rd}} \
-           "pr22791-2.so" \
-       ] \
-       [list \
-           "Build pr22791-2" \
-           "-pie -Wl,--no-as-needed tmpdir/pr22791-2.so" \
-           "$NOPIE_CFLAGS" \
-           { pr22791-2c.s } \
-           {{readelf -drW pr22791-2.rd}} \
-           "pr22791-2" \
-       ] \
-       [list \
            "Build pr22842.so" \
            "-shared" \
            "-fPIC" \
@@ -1560,15 +1522,6 @@ if { [isnative] && [which $CC] != 0 } {
            "pass.out" \
        ] \
        [list \
-           "Run pr22791-2" \
-           "-pie -Wl,--no-as-needed tmpdir/pr22791-2.so" \
-           "" \
-           { pr22791-2c.s } \
-           "pr22791-2" \
-           "pass.out" \
-           "$NOPIE_CFLAGS" \
-       ] \
-       [list \
            "Build pr22842" \
            "-pie -Wl,--no-as-needed tmpdir/pr22842.so" \
            "" \
Index: binutils-2.31/gas/testsuite/gas/i386/x86-64-nop-3.d
===================================================================
--- binutils-2.31.orig/gas/testsuite/gas/i386/x86-64-nop-3.d    2018-06-24 
20:38:57.000000000 +0200
+++ binutils-2.31/gas/testsuite/gas/i386/x86-64-nop-3.d 2018-08-28 
15:38:52.000000000 +0200
@@ -17,5 +17,5 @@ Disassembly of section .text:
 Disassembly of section .altinstr_replacement:
 
 0+ <.altinstr_replacement>:
- +[a-f0-9]+:   e9 00 00 00 00          jmpq   5 <_start\+0x5>  1: 
R_X86_64_PLT32       foo-0x4
+ +[a-f0-9]+:   e9 00 00 00 00          jmpq   5 <_start\+0x5>  1: 
R_X86_64_PC32        foo-0x4
 #pass
Index: binutils-2.31/gas/testsuite/gas/i386/x86-64-nop-4.d
===================================================================
--- binutils-2.31.orig/gas/testsuite/gas/i386/x86-64-nop-4.d    2018-06-24 
20:38:57.000000000 +0200
+++ binutils-2.31/gas/testsuite/gas/i386/x86-64-nop-4.d 2018-08-28 
15:39:03.000000000 +0200
@@ -20,5 +20,5 @@ Disassembly of section .altinstr_replace
  +[a-f0-9]+:   89 c0                   mov    %eax,%eax
  +[a-f0-9]+:   89 c0                   mov    %eax,%eax
  +[a-f0-9]+:   89 c0                   mov    %eax,%eax
- +[a-f0-9]+:   e9 00 00 00 00          jmpq   b <_start\+0xb>  7: 
R_X86_64_PLT32       foo-0x4
+ +[a-f0-9]+:   e9 00 00 00 00          jmpq   b <_start\+0xb>  7: 
R_X86_64_PC32        foo-0x4
 #pass
Index: binutils-2.31/gas/testsuite/gas/i386/x86-64-nop-5.d
===================================================================
--- binutils-2.31.orig/gas/testsuite/gas/i386/x86-64-nop-5.d    2018-06-24 
20:38:57.000000000 +0200
+++ binutils-2.31/gas/testsuite/gas/i386/x86-64-nop-5.d 2018-08-28 
15:39:11.000000000 +0200
@@ -23,5 +23,5 @@ Disassembly of section .altinstr_replace
  +[a-f0-9]+:   89 c0                   mov    %eax,%eax
  +[a-f0-9]+:   89 c0                   mov    %eax,%eax
  +[a-f0-9]+:   89 c0                   mov    %eax,%eax
- +[a-f0-9]+:   e9 00 00 00 00          jmpq   d <_start\+0xd>  9: 
R_X86_64_PLT32       foo-0x4
+ +[a-f0-9]+:   e9 00 00 00 00          jmpq   d <_start\+0xd>  9: 
R_X86_64_PC32        foo-0x4
 #pass
Index: binutils-2.31/ld/testsuite/ld-x86-64/pr22842b.S
===================================================================
--- binutils-2.31.orig/ld/testsuite/ld-x86-64/pr22842b.S        2018-08-28 
15:59:40.000000000 +0200
+++ binutils-2.31/ld/testsuite/ld-x86-64/pr22842b.S     2018-08-28 
16:00:02.000000000 +0200
@@ -7,7 +7,7 @@ main:
         leaq    bar(%rip), %rdi
        addq    %rax, %rdi
 
-       callq   foo
+       callq   foo@PLT
        xorl    %eax, %eax
        popq    %rcx
        retq
++++++ handle-ELF-compressed-header-alignment-correctly-by-.patch ++++++
>From 4207142d6a5d2359170c5f9a140fc1a2351fbda9 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <[email protected]>
Date: Tue, 27 Nov 2018 11:59:10 +0000
Subject: [PATCH] Handle ELF compressed header alignment correctly by setting
 up the section alignment correctly for the Elf32_Chdr or Elf64_Chdr type and
 respect the ch_addralign field when decompressing the section data.

        PR binutils/23919
binutils* readelf.c (dump_sections_as_strings): Remove bogus addralign check.
        (dump_sections_as_bytes): Likewise.
        (load_specific_debug_sections): Likewise.
        * testsuite/binutils-all/dw2-3.rS: Adjust alignment.
        * testsuite/binutils-all/dw2-3.rt: Likewise.

bfd     * bfd.c (bfd_update_compression_header): Explicitly set alignment.
        (bfd_check_compression_header): Add uncompressed_alignment_power
        argument. Check ch_addralign is a power of 2.
        * bfd-in2.h: Regenerated.
        * compress.c (bfd_compress_section_contents): Get and set
        orig_uncompressed_alignment_pow if section is decompressed.
        (bfd_is_section_compressed_with_header): Add and get
        uncompressed_align_pow_p argument.
        (bfd_is_section_compressed): Add uncompressed_align_power argument
        to bfd_is_section_compressed_with_header call.
        (bfd_init_section_decompress_status): Get and set
        uncompressed_alignment_power.
        * elf.c (_bfd_elf_make_section_from_shdr): Add
        uncompressed_align_power argument to
        bfd_is_section_compressed_with_header call.
---
 bfd/ChangeLog                            | 19 +++++++++++++
 bfd/bfd-in2.h                            |  6 ++--
 bfd/bfd.c                                | 20 ++++++++++----
 bfd/compress.c                           | 35 +++++++++++++++++-------
 bfd/elf.c                                |  5 ++--
 binutils/ChangeLog                       |  9 ++++++
 binutils/readelf.c                       | 18 ------------
 binutils/testsuite/binutils-all/dw2-3.rS |  2 +-
 binutils/testsuite/binutils-all/dw2-3.rt |  2 +-
 9 files changed, 77 insertions(+), 39 deletions(-)


diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index ee8cd7ef0b..6d92c51cb9 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -7419,7 +7419,8 @@ void bfd_update_compression_header
 
 bfd_boolean bfd_check_compression_header
    (bfd *abfd, bfd_byte *contents, asection *sec,
-    bfd_size_type *uncompressed_size);
+    bfd_size_type *uncompressed_size,
+    unsigned int *uncompressed_alignment_power);
 
 int bfd_get_compression_header_size (bfd *abfd, asection *sec);
 
@@ -8006,7 +8007,8 @@ void bfd_cache_section_contents
 bfd_boolean bfd_is_section_compressed_with_header
    (bfd *abfd, asection *section,
     int *compression_header_size_p,
-    bfd_size_type *uncompressed_size_p);
+    bfd_size_type *uncompressed_size_p,
+    unsigned int *uncompressed_alignment_power_p);
 
 bfd_boolean bfd_is_section_compressed
    (bfd *abfd, asection *section);
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 15becd7ae8..2b658298ea 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -2332,6 +2332,8 @@ bfd_update_compression_header (bfd *abfd, bfd_byte 
*contents,
                  bfd_put_32 (abfd, sec->size, &echdr->ch_size);
                  bfd_put_32 (abfd, 1 << sec->alignment_power,
                              &echdr->ch_addralign);
+                 /* bfd_log2 (alignof (Elf32_Chdr)) */
+                 bfd_set_section_alignment (abfd, sec, 2);
                }
              else
                {
@@ -2342,6 +2344,8 @@ bfd_update_compression_header (bfd *abfd, bfd_byte 
*contents,
                  bfd_put_64 (abfd, sec->size, &echdr->ch_size);
                  bfd_put_64 (abfd, 1 << sec->alignment_power,
                              &echdr->ch_addralign);
+                 /* bfd_log2 (alignof (Elf64_Chdr)) */
+                 bfd_set_section_alignment (abfd, sec, 3);
                }
            }
          else
@@ -2354,6 +2358,8 @@ bfd_update_compression_header (bfd *abfd, bfd_byte 
*contents,
                 order.  */
              memcpy (contents, "ZLIB", 4);
              bfd_putb64 (sec->size, contents + 4);
+             /* No way to keep the original alignment, just use 1 always. */
+             bfd_set_section_alignment (abfd, sec, 0);
            }
        }
     }
@@ -2368,12 +2374,14 @@ bfd_update_compression_header (bfd *abfd, bfd_byte 
*contents,
    SYNOPSIS
        bfd_boolean bfd_check_compression_header
          (bfd *abfd, bfd_byte *contents, asection *sec,
-         bfd_size_type *uncompressed_size);
+         bfd_size_type *uncompressed_size,
+         unsigned int *uncompressed_alignment_power);
 
 DESCRIPTION
        Check the compression header at CONTENTS of SEC in ABFD and
-       store the uncompressed size in UNCOMPRESSED_SIZE if the
-       compression header is valid.
+       store the uncompressed size in UNCOMPRESSED_SIZE and the
+       uncompressed data alignment in UNCOMPRESSED_ALIGNMENT_POWER
+       if the compression header is valid.
 
 RETURNS
        Return TRUE if the compression header is valid.
@@ -2382,7 +2390,8 @@ RETURNS
 bfd_boolean
 bfd_check_compression_header (bfd *abfd, bfd_byte *contents,
                              asection *sec,
-                             bfd_size_type *uncompressed_size)
+                             bfd_size_type *uncompressed_size,
+                             unsigned int *uncompressed_alignment_power)
 {
   if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
       && (elf_section_flags (sec) & SHF_COMPRESSED) != 0)
@@ -2404,9 +2413,10 @@ bfd_check_compression_header (bfd *abfd, bfd_byte 
*contents,
          chdr.ch_addralign = bfd_get_64 (abfd, &echdr->ch_addralign);
        }
       if (chdr.ch_type == ELFCOMPRESS_ZLIB
-         && chdr.ch_addralign == 1U << sec->alignment_power)
+         && chdr.ch_addralign == (1U << bfd_log2 (chdr.ch_addralign)))
        {
          *uncompressed_size = chdr.ch_size;
+         *uncompressed_alignment_power = bfd_log2 (chdr.ch_addralign);
          return TRUE;
        }
     }
diff --git a/bfd/compress.c b/bfd/compress.c
index 53e566e498..97ea624eb8 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -84,11 +84,13 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec,
   int zlib_size = 0;
   int orig_compression_header_size;
   bfd_size_type orig_uncompressed_size;
+  unsigned int orig_uncompressed_alignment_pow;
   int header_size = bfd_get_compression_header_size (abfd, NULL);
   bfd_boolean compressed
     = bfd_is_section_compressed_with_header (abfd, sec,
                                             &orig_compression_header_size,
-                                            &orig_uncompressed_size);
+                                            &orig_uncompressed_size,
+                                            &orig_uncompressed_alignment_pow);
 
   /* Either ELF compression header or the 12-byte, "ZLIB" + 8-byte size,
      overhead in .zdebug* section.  */
@@ -153,6 +155,9 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec,
              return 0;
            }
          free (uncompressed_buffer);
+         bfd_set_section_alignment (abfd, sec,
+                                    orig_uncompressed_alignment_pow);
+
          sec->contents = buffer;
          sec->compress_status = COMPRESS_SECTION_DONE;
          return orig_uncompressed_size;
@@ -364,20 +369,24 @@ SYNOPSIS
        bfd_boolean bfd_is_section_compressed_with_header
          (bfd *abfd, asection *section,
          int *compression_header_size_p,
-         bfd_size_type *uncompressed_size_p);
+         bfd_size_type *uncompressed_size_p,
+         unsigned int *uncompressed_alignment_power_p);
 
 DESCRIPTION
        Return @code{TRUE} if @var{section} is compressed.  Compression
-       header size is returned in @var{compression_header_size_p} and
-       uncompressed size is returned in @var{uncompressed_size_p}.  If
-       compression is unsupported, compression header size is returned
-       with -1 and uncompressed size is returned with 0.
+       header size is returned in @var{compression_header_size_p},
+       uncompressed size is returned in @var{uncompressed_size_p}
+       and the uncompressed data alignement power is returned in
+       @var{uncompressed_align_pow_p}.  If compression is
+       unsupported, compression header size is returned with -1
+       and uncompressed size is returned with 0.
 */
 
 bfd_boolean
 bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,
                                       int *compression_header_size_p,
-                                      bfd_size_type *uncompressed_size_p)
+                                      bfd_size_type *uncompressed_size_p,
+                                      unsigned int *uncompressed_align_pow_p)
 {
   bfd_byte header[MAX_COMPRESSION_HEADER_SIZE];
   int compression_header_size;
@@ -412,7 +421,8 @@ bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr 
sec,
       if (compression_header_size != 0)
        {
          if (!bfd_check_compression_header (abfd, header, sec,
-                                            uncompressed_size_p))
+                                            uncompressed_size_p,
+                                            uncompressed_align_pow_p))
            compression_header_size = -1;
        }
       /* Check for the pathalogical case of a debug string section that
@@ -449,9 +459,11 @@ bfd_is_section_compressed (bfd *abfd, sec_ptr sec)
 {
   int compression_header_size;
   bfd_size_type uncompressed_size;
+  unsigned int uncompressed_align_power;
   return (bfd_is_section_compressed_with_header (abfd, sec,
                                                 &compression_header_size,
-                                                &uncompressed_size)
+                                                &uncompressed_size,
+                                                &uncompressed_align_power)
          && compression_header_size >= 0
          && uncompressed_size > 0);
 }
@@ -480,6 +492,7 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec)
   int compression_header_size;
   int header_size;
   bfd_size_type uncompressed_size;
+  unsigned int uncompressed_alignment_power = 0;
 
   compression_header_size = bfd_get_compression_header_size (abfd, sec);
   if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE)
@@ -508,7 +521,8 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec)
       uncompressed_size = bfd_getb64 (header + 4);
     }
   else if (!bfd_check_compression_header (abfd, header, sec,
-                                        &uncompressed_size))
+                                         &uncompressed_size,
+                                         &uncompressed_alignment_power))
     {
       bfd_set_error (bfd_error_wrong_format);
       return FALSE;
@@ -516,6 +530,7 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec)
 
   sec->compressed_size = sec->size;
   sec->size = uncompressed_size;
+  bfd_set_section_alignment (abfd, sec, uncompressed_alignment_power);
   sec->compress_status = DECOMPRESS_SECTION_SIZED;
 
   return TRUE;
diff --git a/bfd/elf.c b/bfd/elf.c
index bebda20195..604971dd4c 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1177,11 +1177,12 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
       enum { nothing, compress, decompress } action = nothing;
       int compression_header_size;
       bfd_size_type uncompressed_size;
+      unsigned int uncompressed_align_power;
       bfd_boolean compressed
        = bfd_is_section_compressed_with_header (abfd, newsect,
                                                 &compression_header_size,
-                                                &uncompressed_size);
-
+                                                &uncompressed_size,
+                                                &uncompressed_align_power);
       if (compressed)
        {
          /* Compressed section.  Check if we should decompress.  */
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 39744009ab..afb039f7b7 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -13397,12 +13397,6 @@ dump_section_as_strings (Elf_Internal_Shdr * section, 
Filedata * filedata)
                    printable_section_name (filedata, section), chdr.ch_type);
              return FALSE;
            }
-         else if (chdr.ch_addralign != section->sh_addralign)
-           {
-             warn (_("compressed section '%s' is corrupted\n"),
-                   printable_section_name (filedata, section));
-             return FALSE;
-           }
          uncompressed_size = chdr.ch_size;
          start += compression_header_size;
          new_size -= compression_header_size;
@@ -13544,12 +13538,6 @@ dump_section_as_bytes (Elf_Internal_Shdr *  section,
                    printable_section_name (filedata, section), chdr.ch_type);
              return FALSE;
            }
-         else if (chdr.ch_addralign != section->sh_addralign)
-           {
-             warn (_("compressed section '%s' is corrupted\n"),
-                   printable_section_name (filedata, section));
-             return FALSE;
-           }
          uncompressed_size = chdr.ch_size;
          start += compression_header_size;
          new_size -= compression_header_size;
@@ -13719,12 +13707,6 @@ load_specific_debug_section (enum 
dwarf_section_display_enum  debug,
                    section->name, chdr.ch_type);
              return FALSE;
            }
-         else if (chdr.ch_addralign != sec->sh_addralign)
-           {
-             warn (_("compressed section '%s' is corrupted\n"),
-                   section->name);
-             return FALSE;
-           }
          uncompressed_size = chdr.ch_size;
          start += compression_header_size;
          size -= compression_header_size;
diff --git a/binutils/testsuite/binutils-all/dw2-3.rS 
b/binutils/testsuite/binutils-all/dw2-3.rS
index f1637e9149..86bc73d9a2 100644
--- a/binutils/testsuite/binutils-all/dw2-3.rS
+++ b/binutils/testsuite/binutils-all/dw2-3.rS
@@ -1,3 +1,3 @@
 #...
- +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ 
[0-9a-f]+ +C +0 +0 +1
+ +\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ 
[0-9a-f]+ +C +0 +0 +(4|8)
 #pass
diff --git a/binutils/testsuite/binutils-all/dw2-3.rt 
b/binutils/testsuite/binutils-all/dw2-3.rt
index f59cbaa22b..74e7f8deca 100644
--- a/binutils/testsuite/binutils-all/dw2-3.rt
+++ b/binutils/testsuite/binutils-all/dw2-3.rt
@@ -1,6 +1,6 @@
 #...
  +\[[ 0-9]+\] .debug_info
- +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +1
+ +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +(4|8)
  +\[0+800\]: COMPRESSED
  +ZLIB, 0+9d, 1
 #pass
-- 
2.19.1


Reply via email to