[Bug ld/25593] --as-needed breaks DT_NEEDED order with linker plugin

2020-02-24 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25593

Alan Modra  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at sourceware dot org   |amodra at gmail dot com

--- Comment #8 from Alan Modra  ---
Created attachment 12319
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12319=edit
delay adding dt_needed tags

This is what I'm testing at the moment.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/25593] --as-needed breaks DT_NEEDED order with linker plugin

2020-02-24 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25593

--- Comment #7 from H.J. Lu  ---
(In reply to Alan Modra from comment #6)
> By "won't work" I mean won't preserve the original order of libraries.  By
> the look of it, if you are linking --as-needed t.o a.so b,so c.so with a t.o
> that is lto and requires all three libraries, then your patch will result in
> dt_needed entries in the order c.so, b.so, a.so.

I will see what I can do.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/25593] --as-needed breaks DT_NEEDED order with linker plugin

2020-02-24 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25593

--- Comment #6 from Alan Modra  ---
By "won't work" I mean won't preserve the original order of libraries.  By the
look of it, if you are linking --as-needed t.o a.so b,so c.so with a t.o that
is lto and requires all three libraries, then your patch will result in
dt_needed entries in the order c.so, b.so, a.so.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/25593] --as-needed breaks DT_NEEDED order with linker plugin

2020-02-24 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25593

--- Comment #5 from H.J. Lu  ---
(In reply to Alan Modra from comment #4)
> My guess is that a simple patch like that won't work when you have more
> libraries
> and/or a mix of lto/non-lto objects.

My patch places newly discovered DT_NEEDED library by LTO plugin
before non-LTO ones. This should make LTO case similar to without.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/25593] --as-needed breaks DT_NEEDED order with linker plugin

2020-02-24 Thread amodra at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25593

Alan Modra  changed:

   What|Removed |Added

 CC||amodra at gmail dot com

--- Comment #4 from Alan Modra  ---
My guess is that a simple patch like that won't work when you have more
libraries
and/or a mix of lto/non-lto objects.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/25593] --as-needed breaks DT_NEEDED order with linker plugin

2020-02-24 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25593

--- Comment #3 from H.J. Lu  ---
Created attachment 12318
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12318=edit
Try this

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25499] Documentation typo in binutils.texi: debuging -> debugging

2020-02-24 Thread nickc at redhat dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25499

Nick Clifton  changed:

   What|Removed |Added

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

--- Comment #2 from Nick Clifton  ---
Patch applied.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/25593] --as-needed breaks DT_NEEDED order with linker plugin

2020-02-24 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=25593

--- Comment #2 from H.J. Lu  ---
(In reply to Richard Biener from comment #0)
> echo 'void foo() {}' > libt.c
> echo 'void foo(); int main() { foo(); }' > t.c
> gcc -o libt.so -shared libt.c -Wl,-soname,libt.so -fPIC -flto
> gcc -c t.c -flto
> gcc -Wl,--as-needed t.o libt.so
> readelf -d a.out | grep NEEDED
>  0x0001 (NEEDED) Shared library: [libc.so.6]
>  0x0001 (NEEDED) Shared library: [libt.so]
> 
> but libc has to come last so the program can use RTLD_NEXT to arrive at
> symbols from libc.  Works fine with gold.

[hjl@gnu-cfl-2 pr25593]$ make 
gcc  -flto   -c -o t.o t.c
gcc  -fPIC   -c -o libt.o libt.c
ld -shared -o libt.so libt.o
gcc  -Wl,--as-needed -o x t.o libt.so
readelf -d x | grep NEEDED
 0x0001 (NEEDED) Shared library: [libc.so.6]
 0x0001 (NEEDED) Shared library: [libt.so]
[hjl@gnu-cfl-2 pr25593]$ rm libt.so
[hjl@gnu-cfl-2 pr25593]$ make LD=ld.gold 
ld.gold -shared -o libt.so libt.o
gcc  -Wl,--as-needed -o x t.o libt.so
readelf -d x | grep NEEDED
 0x0001 (NEEDED) Shared library: [libc.so.6]
 0x0001 (NEEDED) Shared library: [libt.so]
[hjl@gnu-cfl-2 pr25593]$ rm libt.so
[hjl@gnu-cfl-2 pr25593]$ make LD=gcc
gcc -shared -o libt.so libt.o
gcc  -Wl,--as-needed -o x t.o libt.so
readelf -d x | grep NEEDED
 0x0001 (NEEDED) Shared library: [libc.so.6]
 0x0001 (NEEDED) Shared library: [libt.so]
[hjl@gnu-cfl-2 pr25593]$ gcc  -Wl,--as-needed -o x t.o libt.so -fuse-ld=gold
[hjl@gnu-cfl-2 pr25593]$ make
readelf -d x | grep NEEDED
 0x0001 (NEEDED) Shared library: [libt.so]
 0x0001 (NEEDED) Shared library: [libc.so.6]
[hjl@gnu-cfl-2 pr25593]$ 

ld needs to check DT_NEEDED of libt.so.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/25499] Documentation typo in binutils.texi: debuging -> debugging

2020-02-24 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25499

--- 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=83d4d556e29da05aa7aec28ae53be7524c05bedd

commit 83d4d556e29da05aa7aec28ae53be7524c05bedd
Author: Nick Clifton 
Date:   Mon Feb 24 14:39:34 2020 +

Fix a spelling mistake in the binutils documentation.

PR 25499
* doc/binutils.texi (objdump): Fix typo in description of
objdump's -g option.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/25593] --as-needed breaks DT_NEEDED order with linker plugin

2020-02-24 Thread matz at suse dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=25593

Michael Matz  changed:

   What|Removed |Added

 CC||matz at suse dot de

--- Comment #1 from Michael Matz  ---
Just to be explicit: also works fine without -flto when compiling t.c.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/25593] --as-needed breaks DT_NEEDED order with linker plugin

2020-02-24 Thread fab...@ritter-vogt.de
https://sourceware.org/bugzilla/show_bug.cgi?id=25593

Fabian Vogt  changed:

   What|Removed |Added

 CC||fab...@ritter-vogt.de

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/25593] --as-needed breaks DT_NEEDED order with linker plugin

2020-02-24 Thread rguenth at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25593

Richard Biener  changed:

   What|Removed |Added

 CC||hjl.tools at gmail dot com
   See Also||https://bugzilla.suse.com/s
   ||how_bug.cgi?id=1163744

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/25593] New: --as-needed breaks DT_NEEDED order with linker plugin

2020-02-24 Thread rguenth at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=25593

Bug ID: 25593
   Summary: --as-needed breaks DT_NEEDED order with linker plugin
   Product: binutils
   Version: 2.33
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

echo 'void foo() {}' > libt.c
echo 'void foo(); int main() { foo(); }' > t.c
gcc -o libt.so -shared libt.c -Wl,-soname,libt.so -fPIC -flto
gcc -c t.c -flto
gcc -Wl,--as-needed t.o libt.so
readelf -d a.out | grep NEEDED
 0x0001 (NEEDED) Shared library: [libc.so.6]
 0x0001 (NEEDED) Shared library: [libt.so]

but libc has to come last so the program can use RTLD_NEXT to arrive at
symbols from libc.  Works fine with gold.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug binutils/22829] objcopy/strip removes PT_GNU_RELRO from lld binaries

2020-02-24 Thread ngg at tresorit dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=22829

--- Comment #13 from NGG  ---
(In reply to Fangrui Song from comment #12)
> The lld issue was introduced by https://reviews.llvm.org/rL291523 
> and was fixed by https://reviews.llvm.org/D56828 .
> It affected lld [4.0,8.0). Before 8.0, lld was not very stable.

The fix you mentioned is not in the 8.0 lld release, but only in 9.0
(https://github.com/llvm-mirror/lld/blob/release_90/ELF/Writer.cpp contains the
fix, but https://github.com/llvm-mirror/lld/blob/release_80/ELF/Writer.cpp does
not)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


[Bug ld/25591] Should /DISCARD/ : { *(.symtab) *(.strtab) } work?

2020-02-24 Thread bp at alien8 dot de
https://sourceware.org/bugzilla/show_bug.cgi?id=25591

Borislav Petkov  changed:

   What|Removed |Added

 CC||bp at alien8 dot de

-- 
You are receiving this mail because:
You are on the CC list for the bug.