[PATCH 1/2] gas/as.c: print input and output details when error

2018-08-08 Thread Robert Yang
Print input and output details (filename, inode number) when error, this makes
the debug easier.

Signed-off-by: Robert Yang 
---
 gas/as.c | 4 +++-
 gas/as.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gas/as.c b/gas/as.c
index 02c7d29..6afe9a5 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -1259,8 +1259,10 @@ main (int argc, char ** argv)
  if (sib.st_ino == sob.st_ino && sib.st_ino != 0)
{
  /* Don't let as_fatal remove the output file!  */
+ saved_out_file_name = xstrdup (out_file_name);
  out_file_name = NULL;
- as_fatal (_("The input and output files must be distinct"));
+ as_fatal (_("The input (%s, ino: %ld) and output (%s, ino: 
%ld) files must be distinct"),
+  argv[i], sib.st_ino, saved_out_file_name, 
sob.st_ino);
}
}
}
diff --git a/gas/as.h b/gas/as.h
index 52bb5a7..d97d9b5 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -375,6 +375,7 @@ COMMON int flag_noexecstack;
 
 /* name of emitted object file */
 COMMON const char *out_file_name;
+COMMON const char *saved_out_file_name;
 
 /* name of file defining extensions to the basic instruction set */
 COMMON char *insttbl_file_name;
-- 
2.7.4


___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug binutils/23494] .note.gnu.property section isn't properly converted

2018-08-08 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23494

--- Comment #1 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=6404ab993797d1d6cd3d9e97cc281e3cb6226c12

commit 6404ab993797d1d6cd3d9e97cc281e3cb6226c12
Author: H.J. Lu 
Date:   Wed Aug 8 21:00:04 2018 -0700

Convert .note.gnu.property section between ELF32 and ELF64

.note.gnu.property section has different alignments and section
sizes for 32-bit and 64-bit ELF binaries.  This patch updated
bfd_convert_section_size and bfd_convert_section_contents to
properly convert .note.gnu.property section between 32-bit and
64-bit ELF binaries.

bfd/

PR binutils/23494
* bfd.c (bfd_convert_section_size): Check BFD_DECOMPRESS after
calling _bfd_elf_convert_gnu_property_size to convert
.note.gnu.property section size.
(bfd_convert_section_contents): Check BFD_DECOMPRESS after
calling _bfd_elf_convert_gnu_properties to convert
.note.gnu.property section.
* elf-bfd.h (_bfd_elf_convert_gnu_property_size): New prototype.
(_bfd_elf_convert_gnu_properties): Likewise.
* elf-properties.c (elf_get_gnu_property_section_size): New
function.
(elf_write_gnu_properties): Likewise.
(_bfd_elf_convert_gnu_property_size): Likewise.
(_bfd_elf_convert_gnu_properties): Likewise.
(_bfd_elf_link_setup_gnu_properties): Use
elf_get_gnu_property_section_size and elf_write_gnu_properties.

binutils/

PR binutils/23494
* testsuite/binutils-all/x86-64/pr23494a-x32.d: New file.
* testsuite/binutils-all/x86-64/pr23494a.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494a.s: Likewise.
* testsuite/binutils-all/x86-64/pr23494b-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494b.s: Likewise.
* testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494c.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise.
* testsuite/binutils-all/x86-64/pr23494d.d: Likewise.

-- 
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 binutils/23496] Memory Leak of objdump

2018-08-08 Thread lqliuyuwei at outlook dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23496

--- Comment #2 from Marsman1996  ---
it was found by Yanhao and Marsman1996

-- 
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 binutils/23496] Memory Leak of objdump

2018-08-08 Thread lqliuyuwei at outlook dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23496

--- Comment #1 from Marsman1996  ---
We use afl-mem, which is based on american fuzzy lop, to discover this problem.
Thanks to american fuzzy lop and its author(lcam...@coredump.cx)

-- 
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 binutils/23496] New: Memory Leak of objdump

2018-08-08 Thread lqliuyuwei at outlook dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23496

Bug ID: 23496
   Summary: Memory Leak of objdump
   Product: binutils
   Version: 2.31
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: lqliuyuwei at outlook dot com
  Target Milestone: ---

Created attachment 11168
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11168&action=edit
the poc file

on ubuntu 16.04 64bit, binutils 2.31

How to reproduce:
  1. compile: CC="gcc -fsanitize=address" CXX="g++ -fsanitize=address"
../configure
  2. objdump -d poc

asan info:
==82201==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 336 byte(s) in 1 object(s) allocated from:
#0 0x7fb3e3986602 in malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x488c62 in bfd_malloc ../../bfd/libbfd.c:271
#2 0x6120bebf  ()
#3 0x65880f  (/home/marsman/Desktop/crashana/binutils/bin/objdump+0x65880f)

Direct leak of 184 byte(s) in 1 object(s) allocated from:
#0 0x7fb3e3986602 in malloc
(/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)
#1 0x488c62 in bfd_malloc ../../bfd/libbfd.c:271

SUMMARY: AddressSanitizer: 520 byte(s) leaked in 2 allocation(s)

-- 
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 binutils/23348] binutils strip corrupts binaries produced by clang+lld+mingw-w64 toolchain

2018-08-08 Thread jacek at codeweavers dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23348

Jacek Caban  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #4 from Jacek Caban  ---
Thanks! Resolving as invalid as it wasn't binutils bug after all.

-- 
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 binutils/23061] objcopy segfault in coff_mangle_symbols

2018-08-08 Thread manisandro at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23061

Sandro Mani  changed:

   What|Removed |Added

 CC||manisandro at gmail dot com

--- Comment #5 from Sandro Mani  ---
I suppose a similar fix/sanity check is also needed for
a->u.auxent.x_sym.x_tagndx.l: running

mingw-objcopy --only-keep-debug LLVM.dll LLVM.dll.debug

results in:

Program received signal SIGSEGV, Segmentation fault.
0x0044ab5f in coff_mangle_symbols (bfd_ptr=bfd_ptr@entry=0x54c760) at
../../bfd/coffgen.c:842
842   a->u.auxent.x_sym.x_tagndx.l =
(gdb) bt
#0  0x0044ab5f in coff_mangle_symbols (bfd_ptr=bfd_ptr@entry=0x54c760)
at ../../bfd/coffgen.c:842
#1  0x00459ed7 in coff_write_object_contents (abfd=0x54c760) at
../../bfd/coffcode.h:4231
#2  0x004310fe in bfd_close (abfd=0x54c760) at ../../bfd/opncls.c:731
#3  0x00409fa6 in copy_file
(input_filename=input_filename@entry=0x7fffe0b4 "LLVM.dll",
output_filename=output_filename@entry=0x7fffe0bd "LLVM.dll.debug",
input_target=input_target@entry=0x0, 
output_target=, output_target@entry=0x0,
input_arch=input_arch@entry=0x0) at ../../binutils/objcopy.c:3530
#4  0x00404853 in copy_main (argv=, argc=) at ../../binutils/objcopy.c:5478
#5  main (argc=, argv=) at
../../binutils/objcopy.c:5582

-- 
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 gold/23495] New: gold should not compress the .debug_gdb_scripts section

2018-08-08 Thread ian at airs dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23495

Bug ID: 23495
   Summary: gold should not compress the .debug_gdb_scripts
section
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ccoutant at gmail dot com
  Reporter: ian at airs dot com
CC: ian at airs dot com
  Target Milestone: ---

gdb looks for the special section .debug_gdb_scripts.  As far as I can tell, it
does not look for .zdebug_gdb_scripts.  Therefore, gold should not generate
that.  Right now, gold will consider compressing any section whose name starts
with ".debug" (is_compressible_debug_section in gold/layout.cc).  We should
probably not try to compress .debug_gdb_scripts.

-- 
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/23486] GNU_PROPERTY_X86_ISA_1_USED isn't merged properly

2018-08-08 Thread evangelos at foutrelis dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23486

Evangelos Foutras  changed:

   What|Removed |Added

 CC||evangelos at foutrelis dot com

-- 
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 binutils/23494] New: .note.gnu.property section isn't properly converted

2018-08-08 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=23494

Bug ID: 23494
   Summary: .note.gnu.property section isn't properly converted
   Product: binutils
   Version: 2.32 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: hjl.tools at gmail dot com
  Target Milestone: ---
Target: x86-64

[hjl@gnu-tools-1 tmp]$ cat x.s
.section ".note.gnu.property", "a"
.p2align 3
.long 1f - 0f   /* name length.  */
.long 4f - 1f   /* data length.  */
/* NT_GNU_PROPERTY_TYPE_0 */
.long 5 /* note type.  */
0:
.asciz "GNU"/* vendor name.  */
1:
.p2align 3
/* GNU_PROPERTY_X86_ISA_1_NEEDED */
.long 0xc001/* pr_type.  */
.long 3f - 2f   /* pr_datasz.  */
2:
.long 0x3
3:
.p2align 3
4:
[hjl@gnu-tools-1 tmp]$ gcc -c x.s
[hjl@gnu-tools-1 tmp]$ objcopy -O elf32-x86-64 x.o x32.o
[hjl@gnu-tools-1 tmp]$ ld -shared -melf32_x86_64 x32.o
ld: warning: x32.o: corrupt GNU_PROPERTY_TYPE (5) size: 0x10
[hjl@gnu-tools-1 tmp]$

-- 
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/23486] GNU_PROPERTY_X86_ISA_1_USED isn't merged properly

2018-08-08 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=23486

--- Comment #2 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by H.J. Lu :

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f7309df20c4e787041cedc4a6aced89c15259e54

commit f7309df20c4e787041cedc4a6aced89c15259e54
Author: H.J. Lu 
Date:   Wed Aug 8 06:09:15 2018 -0700

x86: Properly merge GNU_PROPERTY_X86_ISA_1_USED

Without the GNU_PROPERTY_X86_ISA_1_USED property, all ISAs may be used.
If a bit in the GNU_PROPERTY_X86_ISA_1_USED property is unset, the
corresponding x86 instruction set isn’t used.  When merging properties
from 2 input files and one input file doesn't have the
GNU_PROPERTY_X86_ISA_1_USED property, the output file shouldn't have
it neither.  This patch removes the GNU_PROPERTY_X86_ISA_1_USED
property if an input file doesn't have it.

This patch replaces the GNU_PROPERTY_X86_ISA_1_USED property with the
GNU_PROPERTY_X86_ISA_1_NEEDED property which is the minimum ISA
requirement.

bfd/

PR ld/23486
* elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Remove
GNU_PROPERTY_X86_ISA_1_USED if an input file doesn't have it.
(_bfd_x86_elf_link_setup_gnu_properties): Adding the
GNU_PROPERTY_X86_ISA_1_NEEDED, instead of
GNU_PROPERTY_X86_ISA_1_USED, property.

ld/

PR ld/23486
* testsuite/ld-i386/i386.exp: Run PR ld/23486 tests.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr23486a.d: New file.
* testsuite/ld-i386/pr23486b.d: Likewise.
* testsuite/ld-x86-64/pr23486a-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486a.d: Likewise.
* testsuite/ld-x86-64/pr23486a.s: Likewise.
* testsuite/ld-x86-64/pr23486b-x32.d: Likewise.
* testsuite/ld-x86-64/pr23486b.d: Likewise.
* testsuite/ld-x86-64/pr23486b.s: Likewise.
* testsuite/ld-i386/property-3.r: Remove "x86 ISA used".
* testsuite/ld-i386/property-4.r: Likewise.
* testsuite/ld-i386/property-5.r: Likewise.
* testsuite/ld-i386/property-x86-ibt3a.d: Likewise.
* testsuite/ld-i386/property-x86-ibt3b.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3a.d: Likewise.
* testsuite/ld-i386/property-x86-shstk3b.d: Likewise.
* testsuite/ld-x86-64/property-3.r: Likewise.
* testsuite/ld-x86-64/property-4.r: Likewise.
* testsuite/ld-x86-64/property-5.r: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise.
* testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise.

-- 
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