[Bug binutils/21943] Memory leak in asymbol.name

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

--- 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=98c5dfc99444094652c2f2259126f70e5cacf56f

commit 98c5dfc99444094652c2f2259126f70e5cacf56f
Author: H.J. Lu 
Date:   Fri Aug 11 09:32:44 2017 -0700

x86: Allocate space for symbol names with symbol table

When synthesizing symbols for PLT entries, allocate space for symbol
names with @plt suffixes together with symbol table so that all memory
is returned when symbol table is freed.

PR binutils/21943
* elf32-i386.c (elf_i386_get_synthetic_symtab): Allocate space
for @plt suffixes first.
* elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): 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/21943] Memory leak in asymbol.name

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

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |2.30

--- Comment #1 from H.J. Lu  ---
Fixed.

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

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

H.J. Lu  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #32 from H.J. Lu  ---
Fixed for master and 2.29 branch.

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

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

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

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

commit 4a1c35c0165f9cbcc63d3af93574b2f6c4544eb7
Author: Nick Clifton 
Date:   Mon Aug 7 10:09:51 2017 +0100

Do not choose a non-ELF format input file to hold the linker created GOT
sections.

bfd/

PR 21884
* elf32-i386.c (elf_i386_link_setup_gnu_properties): If the dynobj
has not been set then use the bfd returned by
_bfd_elf_link_setup_gnu_properties.  If that is null then search
through all the input bfds selecting the first normal, ELF format
one.
* elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.

ld/

PR ld/21884
* testsuite/ld-i386/i386.exp: Run pr21884.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr21884.d: New file.
* testsuite/ld-i386/pr21884.t: Likewise.
* testsuite/ld-x86-64/pr21884.d: Likewise.
* testsuite/ld-x86-64/pr21884.t: Likewise.

(cherry picked from commit b7a18930e3925c4092bd975e95bc3603aa1418d9 and
 9593aade74f0da0c08a4ab55e4c59173b07b1f63)

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

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

--- Comment #30 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=9593aade74f0da0c08a4ab55e4c59173b07b1f63

commit 9593aade74f0da0c08a4ab55e4c59173b07b1f63
Author: H.J. Lu 
Date:   Fri Aug 11 08:05:00 2017 -0700

Add 2 more tests for PR ld/21884

PR ld/21884
* testsuite/ld-i386/i386.exp: Run pr21884.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr21884.d: New file.
* testsuite/ld-i386/pr21884.t: Likewise.
* testsuite/ld-x86-64/pr21884.d: Likewise.
* testsuite/ld-x86-64/pr21884.t: 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 gas/21667] Global alias of common symbol is silently dropped

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

H.J. Lu  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |2.30

--- Comment #5 from H.J. Lu  ---
Fixed.

-- 
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/21667] Global alias of common symbol is silently dropped

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

--- Comment #4 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=76db0a2e171d2c6780e0388840e3a10ffe7e9ee2

commit 76db0a2e171d2c6780e0388840e3a10ffe7e9ee2
Author: H.J. Lu 
Date:   Fri Aug 11 07:41:51 2017 -0700

Also disallow global alias of common symbol

We can't create alias of common symbol.  Local alias of common symbol has
been disallowed.  But global alias of common symbol is disallowed when the
common symbol is seen first and silently dropped otherwise.  This patch
disallows alias of common symbol in all cases.

gas/

PR gas/21667
* read.c (pseudo_set): Update error message for alias of common
symbol.
* write.c (write_object_file): Disallow both local and global
aliases of common symbol.
* testsuite/gas/elf/common5a.d: New file.
* testsuite/gas/elf/common5a.l: Likewise.
* testsuite/gas/elf/common5a.s: Likewise.
* testsuite/gas/elf/common5b.d: Likewise.
* testsuite/gas/elf/common5b.l: Likewise.
* testsuite/gas/elf/common5b.s: Likewise.
* testsuite/gas/elf/common5c.d: Likewise.
* testsuite/gas/elf/common5c.s: Likewise.
* testsuite/gas/elf/common5d.d: Likewise.
* testsuite/gas/elf/common5d.s: Likewise.
* testsuite/gas/elf/elf.exp: Run common5a, common5b, common5c
and common5d.

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-11 Thread matz at suse dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

--- Comment #29 from Michael Matz  ---
And commit b7a18930 from Nick fixed it on master for a x86_64 hosted binutils
(I'm qualifying this because I haven't checked a i586 hosted binutils yet).

So at the very minimum this patch needs to be on the 2.29 branch as well.

As testcase my comment #28 should suffice.

-- 
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/21884] [2.29/2.30 Regression] ld segfaulting building memtest86

2017-08-11 Thread matz at suse dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=21884

Michael Matz  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 CC||matz at suse dot de
 Resolution|FIXED   |---

--- Comment #28 from Michael Matz  ---
This still reproduces for me, on i586 and on x86_64.  I don't need to build
binutils in any special way, on my host x86_64, with gcc 4.7:

% git status
# On branch binutils-2_29-branch
...
nothing added to commit but untracked files present (use "git add" to track)
% mkdir dev && cd dev
% ../configure --disable-gdb
% make CFLAGS=-g -j8
...
% echo "" > foo
% cat memtest.lds
OUTPUT_FORMAT("elf32-i386");
OUTPUT_ARCH(i386);

ENTRY(_start); 
SECTIONS {
. = 0x1;
_start = . ;
.data : {
*(.data)
}
}
% ./ld/ld-new -T memtest.lds -b binary foo -o memtest

valgrind shows me this backtrace:

==3890== Invalid read of size 4
==3890==at 0x49386B: _bfd_elf_create_got_section (elflink.c:158)
==3890==by 0x4D3B62: elf_i386_link_setup_gnu_properties (elf32-i386.c:7025)
==3890==by 0x42C393: gldelf_x86_64_after_open (eelf_x86_64.c:1169)
==3890==by 0x42373C: ldemul_after_open (ldemul.c:64)
==3890==by 0x418E3D: lang_process (ldlang.c:7093)
==3890==by 0x41D1E5: main (ldmain.c:437)
==3890==  Address 0x28 is not stack'd, malloc'd or (recently) free'd

So yes, the elf_i386_link_setup_gnu_properties function is most definitely
called.

-- 
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/21931] glibc 2.26 Exception handling problem on powerpc

2017-08-11 Thread marc.balem...@c-s.fr
https://sourceware.org/bugzilla/show_bug.cgi?id=21931

--- Comment #2 from marc.balem...@c-s.fr ---
(In reply to Alan Modra from comment #1)
> I'm not sure why you think this is a binutils issue.  You said adding
> "-Wl,lc" (was that supposed to be "-Wl,-lc"?) resulted in a working
> executable, which says to me you have a configuration or installation
> problem if you need to search libc twice.


Yes, I made a mistake, it is "-Wl,-lc".

Since I'm not sure what is happening, I may very well be wrong, but shouldn't I
get an unresolved symbol/undefined reference error in the first case ?
I don't know why the linker would need to search the same lib twice (because it
missed the symbol the first time ?). Is there some (wrong)
configuration/installation that would cause this ?

-- 
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/21943] Memory leak in asymbol.name

2017-08-11 Thread qiyao at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21943

Yao Qi  changed:

   What|Removed |Added

   Host||x86_64-pc-linux-gnu

-- 
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/21943] New: Memory leak in asymbol.name

2017-08-11 Thread qiyao at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21943

Bug ID: 21943
   Summary: Memory leak in asymbol.name
   Product: binutils
   Version: 2.30 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: qiyao at gcc dot gnu.org
  Target Milestone: ---

$ valgrind --leak-check=full ./objdump  -d /tmp/1.x86.exe

==20024== 50 bytes in 1 blocks are definitely lost in loss record 1 of 1
==20024==at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20024==by 0x44E302: bfd_malloc (libbfd.c:193)
==20024==by 0x459987: elf_x86_64_get_synthetic_symtab (elf64-x86-64.c:6935)
==20024==by 0x408226: dump_bfd (objdump.c:3525)
==20024==by 0x408ACF: display_object_bfd (objdump.c:3603)
==20024==by 0x408ACF: display_any_bfd (objdump.c:3692)
==20024==by 0x40AD63: display_file (objdump.c:3713)
==20024==by 0x404E2D: main (objdump.c:4015)

$ cat /tmp/1.c 
#include 

int main (void)
{
  printf ("hello\n");
  return 0;
}

elf_x86_64_get_synthetic_symtab malloc asymbol.name, but caller of
elf_x86_64_get_synthetic_symtab only free asymbol, so asymbol.name is leaked.

Note that some targets don't leak, because their get_synthetic_symtab allocate
memory for both asymbol and asymbol.name.  AArch64, ARM and MIPS do so.

$ valgrind --leak-check=full ./objdump  -d /tmp/1.aarch64.exe

==20045== LEAK SUMMARY:
==20045==definitely lost: 0 bytes in 0 blocks
==20045==indirectly lost: 0 bytes in 0 blocks
==20045==  possibly lost: 0 bytes in 0 blocks
==20045==still reachable: 744 bytes in 31 blocks
==20045== suppressed: 0 bytes in 0 blocks

-- 
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/21931] glibc 2.26 Exception handling problem on powerpc

2017-08-11 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21931

Alan Modra  changed:

   What|Removed |Added

 CC||amodra at gmail dot com

--- Comment #1 from Alan Modra  ---
I'm not sure why you think this is a binutils issue.  You said adding "-Wl,lc"
(was that supposed to be "-Wl,-lc"?) resulted in a working executable, which
says to me you have a configuration or installation problem if you need to
search libc twice.

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