[Bug ld/27441] Small inconsistency in between gold and bfd

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

--- Comment #13 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Alan Modra :

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

commit bbaddd4bbeba65200ee805d87c2e3a845842e3eb
Author: Alan Modra 
Date:   Wed Feb 24 18:01:16 2021 +1030

PR27441, inconsistency in weak definitions

This makes IR objects use the same logic as normal objects with
respect to what sort of ref/def makes an as-needed library needed.
Testing the binding of the definition is just plain wrong.  What
matters is the binding of the reference.

PR 27441
* elf-bfd.h (struct elf_link_hash_entry): Add ref_ir_nonweak.
* elflink.c (elf_link_add_object_symbols): Set ref_ir_nonweak and
use when deciding an as-needed library should be loaded instead
of using the binding of the library definition.

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


[Bug ld/27441] Small inconsistency in between gold and bfd

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

--- Comment #12 from Alan Modra  ---
(In reply to Michael Matz from comment #11)
> Yes, I thought so as well, until I read ELF.txt again :)

Huh, I can hardly believe I was making such a completely wrong assumption.  How
stupid is that?  I just checked elflink.c plus archive.c code and ran a test to
properly convince myself I was wrong.  Yes, a weak definition does indeed cause
an archive element to be extracted to satisfy a strong undefined reference.

Testing the binding of the definition was just plain wrong.

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


[Bug binutils/27456] Link failure due to the use of lstat in rename.c on MinGW

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

--- Comment #10 from cvs-commit at gcc dot gnu.org  ---
The master branch has been updated by Alan Modra :

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

commit 40b02646ec5b197e63ba904f95ea101d95a50cf4
Author: Alan Modra 
Date:   Thu Feb 25 09:46:02 2021 +1030

Re: Use make_tempname file descriptor in smart_rename

PR 27456
* rename.c (simple_copy): Mark target_stat ATTRIBUTE_UNUSED.

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


[Bug binutils/27285] False results/ misinformation, unpredictable behavior and potential crash through 2 Integer Overflows in elf32_avr_get_memory_usage() based on bfd_section_size()

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

Nick Clifton  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

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

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


[Bug binutils/27285] False results/ misinformation, unpredictable behavior and potential crash through 2 Integer Overflows in elf32_avr_get_memory_usage() based on bfd_section_size()

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

--- Comment #3 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=9d3fcfe06896afd0ef1df4b22355d3822ca89e08

commit 9d3fcfe06896afd0ef1df4b22355d3822ca89e08
Author: Nick Clifton 
Date:   Wed Feb 24 14:14:45 2021 +

Fix a potential integer overflow when adding together section sizes for the
AVR port of objdump.

PR 27285
* od-elf32_avr.c (elf32_avr_get_memory_usage): Check for overflows
when adding together the section sizes.

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


[Bug ld/27441] Small inconsistency in between gold and bfd

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

--- Comment #11 from Michael Matz  ---
(In reply to Alan Modra from comment #8)
> (In reply to Michael Matz from comment #3)
> > % gcc -fPIC -Wl,--as-needed -fno-lto -shared -o good.so  bad4.c -L. -l2 -l1
> > % readelf-dW good.so | grep lib
> >  0x0001 (NEEDED) Shared library: [lib2.so]
> >  0x0001 (NEEDED) Shared library: [lib1.so]
> 
> I'd actually like to fix the above to *not* have DT_NEEDED lib2.so.  The
> reason is that as-needed was supposed to be modeled on the way archive
> entries are treated, and if you were using static libraries you'd find the
> weak func1 in lib2.a would not be enough to cause lib2.o to be extracted.. 

Yes, I thought so as well, until I read ELF.txt again :) :

* When the link editor searches archive libraries, it extracts archive
  members that contain definitions of undefined global symbols. The
  member's definition may be either a global or a weak symbol. The
  link editor does not extract archive members to resolve undefined
  weak symbols. Unresolved weak symbols have a zero value.

"may be either a global or a weak symbol".  It's weak undefs that don't cause
things to be pulled in, but a strong ref should pull in a weak def.

Independend of that I considered the current (non-LTO) behaviour more useful.

> Unfortunately I can't do that, libm.so.6 for instance is full of weak
> dynamic symbols.

(huh, I never noticed that; indeed)

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


[Bug binutils/27456] Link failure due to the use of lstat in rename.c on MinGW

2021-02-24 Thread pexu at sourceware dot mail.kapsi.fi
https://sourceware.org/bugzilla/show_bug.cgi?id=27456

Pekka Seppänen  changed:

   What|Removed |Added

 CC||pexu at sourceware dot 
mail.kapsi.
   ||fi

--- Comment #9 from Pekka Seppänen  ---
Hi,

the latest commit (c42c71a1527dd70417d3966dce7ba9edbcf4bdb4) regarding this
matter yet again breaks MinGW targets :)

<...>/src/binutils/binutils/rename.c: In function 'simple_copy':
<...>/src/binutils/binutils/rename.c:38:55: error: unused parameter
'target_stat' [-Werror=unused-parameter]
   38 | simple_copy (int fromfd, const char *to, struct stat *target_stat)
  |  ~^~~
cc1: all warnings being treated as errors

I presume 'target_stat' should be marked ATTRIBUTE_UNUSED like it was with
smart_rename().

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


[Bug ld/27441] Small inconsistency in between gold and bfd

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

--- Comment #10 from Alan Modra  ---
Created attachment 13259
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13259=edit
patch under test

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