[Bug ld/21382] --as-needed cannot be combined with -flto

2017-04-13 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21382

H.J. Lu  changed:

   What|Removed |Added

   Attachment #9992|0   |1
is obsolete||
 CC||hjl.tools at gmail dot com

--- Comment #3 from H.J. Lu  ---
Created attachment 9993
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9993=edit
An updated 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/21382] --as-needed cannot be combined with -flto

2017-04-13 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21382

--- Comment #2 from H.J. Lu  ---
Created attachment 9992
  --> https://sourceware.org/bugzilla/attachment.cgi?id=9992=edit
A patch

This will introduce false reference from a shared library which isn't used
otherwise.

Before the change:

[hjl@gnu-6 pr15146a]$ cat foo.c 
extern int xxx;

int
bar (void)
{
  return xxx;
}

int
main ()
{ 
  return 0;
}
[hjl@gnu-6 pr15146a]$ cat yyy.c 
extern void bar (void);

void
zzz ()
{
  bar ();
}
[hjl@gnu-6 pr15146a]$ cat xxx.c 
int xxx  = 3;
[hjl@gnu-6 pr15146a]$ make
gcc -flto -O2   -c -o foo.o foo.c
gcc -shared -fPIC -o libxxx.so xxx.c
gcc -shared -fPIC -o libyyy.so yyy.c libxxx.so
gcc -flto -O2 -Wl,--as-needed  -o x foo.o libyyy.so -Wl,-rpath-link,.
[hjl@gnu-6 pr15146a]$ 

after:

[hjl@gnu-6 pr15146a]$ gcc -flto -O2 -Wl,--as-needed  -o x foo.o libyyy.so
-Wl,-rpath-link,. -B./
/tmp/ccQlE2wY.ltrans0.ltrans.o: In function `bar':
:(.text+0x2): undefined reference to `xxx'
collect2: error: ld returned 1 exit status
[hjl@gnu-6 pr15146a]$ 

Gold also failed:

[hjl@gnu-6 pr15146a]$ gcc -flto -O2 -Wl,--as-needed  -o x foo.o libyyy.so
-Wl,-rpath-link,. -fuse-ld=gold
/tmp/ccLftUeD.ltrans0.ltrans.o::function bar: error: undefined
reference to 'xxx'
collect2: error: ld returned 1 exit status
[hjl@gnu-6 pr15146a]$

-- 
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/21379] readelf: signed integer overflow

2017-04-13 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=21379

Nick Clifton  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||nickc at redhat dot com
 Resolution|--- |FIXED

--- Comment #2 from Nick Clifton  ---
Hi Agostino,

  Thanks for the bug report.  As it happens that test binary also triggered a
bug in my recent additions to readelf's note parsing code, so I have checked in
a patch that fixes both of these problems.

Cheers!
  Nick

-- 
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/21379] readelf: signed integer overflow

2017-04-13 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21379

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

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

commit 7296a62a2a237f6b1ad8db8c38b090e9f592c8cf
Author: Nick Clifton 
Date:   Thu Apr 13 16:06:30 2017 +0100

readelf: fix out of range subtraction, seg fault from a NULL pointer and
memory exhaustion, all from parsing corrupt binaries.

PR binutils/21379
* readelf.c (process_dynamic_section): Detect over large section
offsets in the DT_SYMTAB entry.

PR binutils/21345
* readelf.c (process_mips_specific): Catch an unfeasible memory
allocation before it happens and print a suitable error message.

-- 
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/21345] readelf: memory allocation failure

2017-04-13 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21345

--- Comment #4 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Nick Clifton :

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

commit 7296a62a2a237f6b1ad8db8c38b090e9f592c8cf
Author: Nick Clifton 
Date:   Thu Apr 13 16:06:30 2017 +0100

readelf: fix out of range subtraction, seg fault from a NULL pointer and
memory exhaustion, all from parsing corrupt binaries.

PR binutils/21379
* readelf.c (process_dynamic_section): Detect over large section
offsets in the DT_SYMTAB entry.

PR binutils/21345
* readelf.c (process_mips_specific): Catch an unfeasible memory
allocation before it happens and print a suitable error message.

-- 
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/21384] New: symbols defined with --dynamic-list missing in output binary

2017-04-13 Thread christian.procha...@genode-labs.com
https://sourceware.org/bugzilla/show_bug.cgi?id=21384

Bug ID: 21384
   Summary: symbols defined with --dynamic-list missing in output
binary
   Product: binutils
   Version: 2.29 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: christian.procha...@genode-labs.com
  Target Milestone: ---

Since commit "Always descend into output section statements in
lang_do_assignments"
(https://github.com/bminor/binutils-gdb/commit/f02cb058822459ea29a9fdaa928c2623df435908),
symbols defined with --dynamic-list don't appear as dynamic symbols anymore in
the linked ELF binary.

Stripped down test case:

test.ld (the .dtors section is the relevant part, the rest is copied from the
ld manual):

PHDRS
{
  headers PT_PHDR PHDRS ;
  interp PT_INTERP ;
  text PT_LOAD FILEHDR PHDRS ;
  data PT_LOAD ;
  dynamic PT_DYNAMIC ;
}

SECTIONS
{
  . = SIZEOF_HEADERS;
  .interp : { *(.interp) } :text :interp
  .text : { *(.text) } :text
  .rodata : { *(.rodata) } /* defaults to :text */
  . = . + 0x1000; /* move to a new page in memory */
  .data : { *(.data) } :data
  .dynamic : { *(.dynamic) } :data :dynamic

  .dtors :
  {
_dtors_start = .;
_dtors_end = .;
  }
}

--

test.dl (dynamic list):

{
  _dtors_start;
  _dtors_end;
};

--

test commands:

$ as /dev/null -o test.o
$ ld -T test.ld --dynamic-list test.dl -o test test.o
$ objdump -T test


output before the mentioned commit:


test: file format elf64-x86-64

DYNAMIC SYMBOL TABLE:
12a8 gD  .dynamic    _dtors_end
12a8 gD  .dynamic    _dtors_start


output with the current master branch:


test: file format elf64-x86-64

DYNAMIC SYMBOL TABLE:
no symbols

-- 
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/21382] --as-needed cannot be combined with -flto

2017-04-13 Thread rguenth at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=21382

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-04-13
 CC||rguenth at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
To clarify the linker resolution is bougs:

1
m.o 3
165 e2668d19ae58a8ab PREVAILING_DEF_IRONLY x
180 e2668d19ae58a8ab PREVAILING_DEF main
185 e2668d19ae58a8ab UNDEF y

but x should be PREVAILING_DEF_IRONLY_EXP as gold correctly says.

-- 
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/20931] STRIP crashes during copy of private bfd data

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20931

Thuan Pham  changed:

   What|Removed |Added

 CC||thuanpv at comp dot nus.edu.sg

--- Comment #3 from Thuan Pham  ---
This is CVE-2017-7304

-- 
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/20922] STRIP crashes during copy of special section fields

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20922

Thuan Pham  changed:

   What|Removed |Added

 CC||thuanpv at comp dot nus.edu.sg

--- Comment #3 from Thuan Pham  ---
This is CVE-2017-7303

-- 
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/20924] LD: Buffer Overflow when loading symbols

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20924

Thuan Pham  changed:

   What|Removed |Added

 CC||thuanpv at comp dot nus.edu.sg

--- Comment #3 from Thuan Pham  ---
This is CVE-2017-7301

-- 
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/20921] STRIP crashes when writing stripped file

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20921

Thuan Pham  changed:

   What|Removed |Added

 CC||thuanpv at comp dot nus.edu.sg

--- Comment #3 from Thuan Pham  ---
This is CVE-2017-7302

-- 
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/20909] LD crashes when loading symbols

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20909

Thuan Pham  changed:

   What|Removed |Added

 CC||thuanpv at comp dot nus.edu.sg

--- Comment #3 from Thuan Pham  ---
This is CVE-2017-7300

-- 
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/20908] LD crashes when writing linked file

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20908

Thuan Pham  changed:

   What|Removed |Added

 CC||thuanpv at comp dot nus.edu.sg

--- Comment #4 from Thuan Pham  ---
This is CVE-2017-7299

-- 
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/20906] LD: ld crashes for malformed inputs

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20906

Thuan Pham  changed:

   What|Removed |Added

 CC||thuanpv at comp dot nus.edu.sg

--- Comment #3 from Thuan Pham  ---
This is CVE-2017-7227

-- 
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/20905] Heap buffer overflow in bfd/peicode.h

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20905

--- Comment #3 from Thuan Pham  ---
This is CVE-2017-7226

-- 
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/20898] AS: Buffer Overflow when scrubing chars

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20898

Thuan Pham  changed:

   What|Removed |Added

 CC||thuanpv at comp dot nus.edu.sg

--- Comment #3 from Thuan Pham  ---
This is CVE-2017-7223

-- 
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/20892] Segfault in objdump

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=20892

--- Comment #3 from Thuan Pham  ---
This is CVE-2017-7224

-- 
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/21135] readelf segfault - invalid read

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=21135

--- Comment #5 from Thuan Pham  ---
This is CVE-2017-7209

-- 
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/21157] objdump segfault - off-by-one read

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=21157

--- Comment #3 from Thuan Pham  ---
This is CVE-2017-7210

-- 
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/21139] readelf crashes - corrupted double-linked list because of use after free

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=21139

--- Comment #8 from Thuan Pham  ---
This is CVE-2017-6966

-- 
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/21156] readelf segfault - invalid read of size 4

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=21156

--- Comment #10 from Thuan Pham  ---
This is CVE-2017-6969

-- 
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/21137] readelf - heap buffer overflow in elfcomm

2017-04-13 Thread thuanpv at comp dot nus.edu.sg
https://sourceware.org/bugzilla/show_bug.cgi?id=21137

--- Comment #8 from Thuan Pham  ---
This is CVE-2017-6965

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