[Bug binutils/25018] New: readelf crash on 32bits (at least i386 and armhf)

2019-09-19 Thread costamagnagianfranco at yahoo dot it
https://sourceware.org/bugzilla/show_bug.cgi?id=25018

Bug ID: 25018
   Summary: readelf crash on 32bits (at least i386 and armhf)
   Product: binutils
   Version: 2.33 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: costamagnagianfranco at yahoo dot it
  Target Milestone: ---

Created attachment 11996
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11996&action=edit
example of failing file

I already reported to Ubuntu
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1844119

This is a regression started after binutils_2.32.51.20190821-1
and before 2.32.51.20190905-0

so this is the changelog of changes in bfd
+2019-09-05  Alan Modra  
+
+   * elf64-ppc.c (xlate_pcrel_opt): Handle prefix loads and stores
+   in second instruction.
+   (ppc64_elf_relocate_section): Likewise.
+
+2019-09-05  Alan Modra  
+
+   PR 24955
+   * libbfd-in.h (bfd_strdup): New inline function.
+   * archive.c (_bfd_get_elt_at_filepos): Use bfd_strdup.  Close
+   bfd on error.
+   * elfcode.h (_bfd_elf_bfd_from_remote_memory): Use bfd_strdup.
+   * opncls.c (bfd_fopen): Use bfd_strdup.  Close fd and stream
+   on error.
+   (bfd_openstreamr): Use bfd_strdup.
+   (bfd_openr_iovec, bfd_openw, bfd_create): Likewise.
+   * plugin.c (try_load_plugin): Use bfd_malloc.
+   * libbfd.h: Regenerate.
+
+2019-09-02  Alan Modra  
+
+   PR 11983
+   * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Free debug_filename
+   on success.  Tidy.
+   (read_alt_indirect_string): Likewise.
+   (read_alt_indirect_ref): Likewise.
+
+2019-08-31  Jim Wilson  
+
+   PR 23825
+   * elfnn-riscv.c (riscv_elf_create_dynamic_sections): Add SEC_LOAD,
+   SEC_DATA, and SEC_HAS_CONTENTS to .tdata.dyn section.
+
+2019-08-30  Jim Wilson  
+
+   * elfnn-riscv.c (riscv_elf_relocate_section): For unresolvable reloc
+   error, call bfd_set_error, set ret to FALSE, and goto out label.
+
+2019-08-30  H.J. Lu  
+
+   PR ld/24951
+   * archive.c (_bfd_get_elt_at_filepos): Copy BFD_COMPRESS,
+   BFD_DECOMPRESS and BFD_COMPRESS_GABI flags for thin archive.
+
+2019-08-29  Alan Modra  
+
+   PR 24697
+   * elf32-ppc.c (ppc_elf_check_relocs): Call bad_shared_reloc
+   when !bfd_link_executable for R_PPC_EMB_SDA2I16 and
+   R_PPC_EMB_SDA2REL.  Don't call bad_shared_reloc for any other
+   reloc.
+
+2019-08-29  Alan Modra  
+
+   * elf64-ppc.c (xlate_pcrel_opt): Add poff parameter.  Allow offset
+   on second insn, return it in poff.
+   (ppc64_elf_relocate_section): Add offset to paddi addend for
+   PCREL_OPT.
+
+2019-08-28  Jim Wilson  
+
+   * elfnn-riscv.c (_bfd_riscv_relax_lui): Add check to exclude abs
+   section when setting max_alignment.  Update comment.
+   (_bfd_riscv_relax_pc): Likewise.
+
+2019-08-29  Alan Modra  
+
+   PR 24891
+   * bfd.c (struct bfd): Add no_element_cache.
+   * archive.c (_bfd_get_elt_at_filepos): Don't add element to
+   archive cache when no_element_cache.
+   (bfd_generic_archive_p): Set no_element_cache when opening first
+   element to check format.  Close first element too.
+   (do_slurp_bsd_armap): Don't zero ardata->cache here.
+   * bfd-in2.h: Regenerate.
+
+2019-08-24  Alan Modra  
+
+   * elf64-ppc.c (ppc64_elf_edit_toc): Exclude undefined weak
+   symbols from GOT optimisation.
+
+2019-08-23  Stafford Horne  
+
+   * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Use correct value for
+   PLT GOT entries.
+
+2019-08-23  Nick Clifton  
+
+   PR 24456
+   * elf.c (bfd_section_from_shdr): Issue an informative warning
+   message and continue processing other sections after encountering
+   a reloc section for a section which already has other relocs
+   associated with it.
+
+2019-08-23  Alan Modra  
+
+   PR 24933
+   * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Don't exit
+   on error without freeing plts[] contents.
+
+2019-08-22  Dennis Zhang  
+
+   * cpu-arm.c: New entries for Cortex-M35P, Cortex-A77, Cortex-A76AE.
+
+2019-08-22  Nick Clifton  
+
+   PR 24922
+   * pei-x86_64.c (pex64_xdata_print_uwd_codes): Add checks before
+   reading data from extra records.
+
+2019-08-22  Tamar Christina  
+
+   PR ld/24601
+   * elfnn-aarch64.c (aarch64_relocate): Handle weak TLS and undefined
TLS.
+   Also Pass input_bfd to _bfd_aarch64_elf_resolve_relocation.
+   * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Use it.
+   * elfxx-aarch64.h (_bfd_aarch64_elf_resolve_relocation): Emit warning
+   for weak TLS.
+
+2019-08-22  Alan Modra  
+
+   * elf32-arm.c (cmse_scan): Don't use ARM_GET_SYM_CMSE_SPCL,
+   instead recognize CMSE_PREFIX in symbol name.
+   (elf32_

[Bug gas/24991] the assembler generates incorrect offset for jumps on arm thumb2

2019-09-19 Thread tnfchris at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=24991

Tamar Christina  changed:

   What|Removed |Added

 CC||tnfchris at sourceware dot org
Version|2.32|2.33 (HEAD)
   Assignee|unassigned at sourceware dot org   |tnfchris at sourceware 
dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/24991] the assembler generates incorrect offset for jumps on arm thumb2

2019-09-19 Thread tnfchris at sourceware dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=24991

Tamar Christina  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-09-19
 Ever confirmed|0   |1

--- Comment #6 from Tamar Christina  ---
GCC bug filed https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91816 here.
Gas patch being submitted.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gas/25012] pushq/popq %gs/%fs in .code64 now unsupported

2019-09-19 Thread jbeulich at suse dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25012

--- Comment #3 from Jan Beulich  ---
Hmm, yes - No_qSuf gets in the way here. Simply removing the attribute won't
work though, I'm afraid. I'll try to find time soon to look into this. (And I'm
surprised there's nothing in the testsuite that would have allowed me to notice
this before even submitting the patch.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/25020] New: Report "sh_link of section ... points to discarded section ..." for more input sections

2019-09-19 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=25020

Bug ID: 25020
   Summary: Report "sh_link of section ... points to discarded
section ..." for more input sections
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: i at maskray dot me
  Target Milestone: ---

bfd/elf.c
static bfd_boolean
assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
...

  /* We need to set up sh_link for SHF_LINK_ORDER.  */
  if ((d->this_hdr.sh_flags & SHF_LINK_ORDER) != 0)
{
  s = elf_linked_to_section (sec);
  if (s)
{
  /* elf_linked_to_section points to the input section.  */
  if (link_info != NULL)
{
  /* Check discarded linkonce section.  */
  if (discarded_section (s))
{
  asection *kept;
  _bfd_error_handler
/* xgettext:c-format */
(_("%pB: sh_link of section `%pA' points to"
   " discarded section `%pA' of `%pB'"),
 abfd, d->this_hdr.bfd_section,
 s, s->owner);

The error is reported if the linked-to section of the first input section is
discarded. If the linked-to section of the second, or third, ... section is
discarded, this error is not issued.




# a.s
.globl _start
_start:
  call .foo1
  call bar0
  call bar1
  call baz0
  call baz1

.section .foo0,"a"
.section .foo1,"a"

## The linked-to section of the first input section is discarded.
.section .bar,"ao",@progbits,.foo0,unique,0
bar0:
.byte 0
.section .bar,"ao",@progbits,.foo1,unique,1
bar1:
.byte 1

## Test another case: the linked-to section of the second input section is
discarded.
.section .baz,"ao",@progbits,.foo1,unique,0
baz0:
.byte 0
.section .baz,"ao",@progbits,.foo0,unique,1
baz1:
.byte 1


# I don't know whether GNU as provides a way to set sh_link + SHF_LINK_ORDER so
I use an llvm-mc extension.

% llvm-mc -filetype=obj a.s -o a.o; ld.bfd a.o -o a --gc-sections   
ld.bfd: a: sh_link of section `.bar' points to discarded section `.foo0' of
`a.o'  
ld.bfd: final link failed: bad value

The error can be reported on .baz as well

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/25021] New: Garbage collecting non-alloc SHF_LINK_ORDER sections

2019-09-19 Thread i at maskray dot me
https://sourceware.org/bugzilla/show_bug.cgi?id=25021

Bug ID: 25021
   Summary: Garbage collecting non-alloc SHF_LINK_ORDER sections
   Product: binutils
   Version: unspecified
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: i at maskray dot me
  Target Milestone: ---

clang -fstack-size-section emits a non-alloc SHF_LINK_ORDER section
.stack_sizes linking to .text

  [ 2] .text PROGBITS 40 06 00  AX 
0   0 16
  [ 3] .stack_sizes  PROGBITS 46 09 00   L 
2   0  1

Below is a hypothetical -ffunction-sections -fstack-size-section output.
The contents of .stack_sizes are irrelevant to the feature request, so
arbitrary .byte 1 and .byte 2 are used.

# a.s
.section .text.live,"ax",@progbits
.globl live
live:
 nop

# "o" is an llvm-mc extension that sets the SHF_LINK_ORDER flag and sets
sh_link to the referenced section number.
.section .stack_sizes,"o",@progbits,.text.live,unique,0
.byte 1

.section .text.dead,"ax",@progbits
.globl dead
dead:
 nop

.section .stack_sizes,"o",@progbits,.text.dead,unique,1
.byte 2

.section .text.main,"ax",@progbits
.globl _start
_start:
  callq live@PLT


llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
ld.bfd --gc-sections a.o -o a.bfd   # size(.stack_sizes) = 2
ld.lld --gc-sections a.o -o a.lld   # size(.stack_sizes) = 1

As the result shows, lld can garbage collect non-SHF_ALLOC sections.
The rule is: a non-SHF_ALLOC section is discarded if it has the SHF_LINK_ORDER
flag and its sh_link references a discarded section.

I havn't found other examples leveraging non-alloc SHF_LINK_ORDER sections in
the wild.
Just wanted to ask: is this garbage collecting rule GNU linkers want to have as
well?

The "Possible Duplicates" feature suggested that I posted a related feature
request a few months ago. https://sourceware.org/bugzilla/show_bug.cgi?id=24526
It'd be nice to have feedback on that as well.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils