[Bug gold/28139] ld.gold fails while ld.bfd succeeds: error: relocation refers to local symbol "" [2], which is defined in a discarded section

2021-07-26 Thread devurandom at gmx dot net
https://sourceware.org/bugzilla/show_bug.cgi?id=28139

Dennis Schridde  changed:

   What|Removed |Added

 CC||devurandom at gmx dot net

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


[Bug ld/28143] New: start-stop-gc feature addition broke link with ldscript

2021-07-26 Thread andy at omniosce dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=28143

Bug ID: 28143
   Summary: start-stop-gc feature addition broke link with
ldscript
   Product: binutils
   Version: 2.37
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: andy at omniosce dot org
  Target Milestone: ---

Updating to binutils 2.37 has broken the build of the boot loader in the
illumos project.

The loader uses linker sets to implement its internal commands, and ld in
binutils 2.37 is stripping the command symbols where it did not before, with no
change in linker options.

The loader is built with an ldscript which contains:

.data :
{
...
__start_set_Xcommand_set = .;
*(set_Xcommand_set)
__stop_set_Xcommand_set = .;
...
}

and the linker is invoked with:

static -T ldscript -N --gc-sections

an example of a symbol which was present with ld from binutils 2.36.1 but is
now stripped:

  [65]  0x00063de0 0x0004  OBJT LOCL  D0 .data 
__set_Xcommand_set_sym__cmd_lsdev

additionally, the visibility of the __start and __stop symbols has changed from
protected to default.

- [1943]  0x00063e50 0x  NOTY GLOB  P0 .data 
__start_set_Xcommand_set
+ [2232]  0x0005dd80 0x  NOTY GLOB  D0 .data 
__start_set_Xcommand_set

Adding KEEP(*(set_Xcommand_set)) to the ldscript stops the symbols from being
stripped, but the visibility change for __start/__stop is still happening.

I used git bisect to narrow down this change in behaviour to the commit which
introduced -z start-stop-gc
(https://sourceware.org/bugzilla/show_bug.cgi?id=27451 )

The commit message for that includes:

(bfd_elf_define_start_stop): Don't modify ldscript_def syms.

and I see a couple of additional tests for ldscript being added here - removing
those restores previous behaviour.

was this change in behaviour around ldscripts intentional or is this a bug?

Note - there's no difference in output with -z start-stop-gc and -z
nostart-stop-gc

Thanks

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


[Bug ld/28143] start-stop-gc feature addition broke link with ldscript

2021-07-26 Thread andy at omniosce dot org
https://sourceware.org/bugzilla/show_bug.cgi?id=28143

andy at omniosce dot org changed:

   What|Removed |Added

 CC||amodra at gmail dot com,
   ||andy at omniosce dot org,
   ||tsoome at me dot com

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


[Bug ld/28138] [2.37 Regression][bisected] Linker plugin complains about "malformed archive" on thin archines

2021-07-26 Thread slyfox at inbox dot ru
https://sourceware.org/bugzilla/show_bug.cgi?id=28138

--- Comment #7 from Sergei Trofimovich  ---
I think I got closer to the problem: it's a bad error handling related to
-EMFILE (too many open files). nodejs is probably just very close to open file
limit (default 1023):

$ strace -f -olog -etrace=execve,openat ./mk.bash
...
684205
execve("/usr/lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../x86_64-pc-linux-gnu/bin/ld",
...
684205 openat(AT_FDCWD,
"/tmp/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/v8_compiler/deps/v8/src/compiler/simd-scalar-lowering.o",
O_RDONLY) = 10
23
684205 openat(AT_FDCWD,
"/tmp/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/v8_compiler/deps/v8/src/compiler/simd-scalar-lowering.o",
O_RDONLY) = 89
8
684205 openat(AT_FDCWD,
"/tmp/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/v8_compiler/deps/v8/src/compiler/backend/instruction-scheduler.o",
O_RDO
NLY) = -1 EMFILE (Too many open files)
684205 +++ exited with 1 +++


Don't yet know why EMFILE handling did not kick in.

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


[Bug ld/28138] [2.37 Regression][bisected] Linker plugin complains about "malformed archive" on thin archines

2021-07-26 Thread slyfox at inbox dot ru
https://sourceware.org/bugzilla/show_bug.cgi?id=28138

--- Comment #8 from Sergei Trofimovich  ---
Here is the full reproducer: 1200 interdependent files required for a thin
archive.

gcc-11.1.0 + binutils-2.36.1:
  $ ./mk.bash
  thin archive for 1200
  176

gcc-11.1.0 + binutils-2.37:
  $ ./mk.bash
  thin archive for 1200
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld:
//libthin.a: error adding symbols: malformed archive

Full script:

$ cat mk.bash

#!/bin/bash

rm -rf -- libthin.a main.o m s

mkdir -p s

cc=x86_64-pc-linux-gnu-gcc
ar=x86_64-pc-linux-gnu-ar

nfiles=${1-1200}

for i in `seq 1 ${nfiles}`; do
prev_i=$((i - 1))
printf "extern int a${prev_i}(void); int a${i}(void) { return 1 +
a${prev_i}(); }" > s/a${i}.c
$cc -c s/a${i}.c -o s/a${i}.o
done

printf "int a0(void) { return 0; }; extern int a${nfiles}(void); int main() {
return a${nfiles}(); }" > main.c
$cc -c main.c -o main.o

# thin archive
echo "thin archive for $nfiles" >&2
$ar crsT libthin.a s/a*.o

$cc -pthread -o m -rdynamic -m64 main.o ${PWD}/libthin.a

./m; echo $?

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


[Bug ld/28138] [2.37 Regression][bisected] Linker plugin complains about "malformed archive" on thin archines

2021-07-26 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28138

--- Comment #9 from H.J. Lu  ---
A patch is posted at

https://sourceware.org/pipermail/binutils/2021-July/117502.html

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


[Bug gold/28139] ld.gold fails while ld.bfd succeeds: error: relocation refers to local symbol "" [2], which is defined in a discarded section

2021-07-26 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28139

--- Comment #3 from H.J. Lu  ---
BFD linker has

  /* Start at sections marked with SEC_KEEP (ref _bfd_elf_gc_keep).
 Also treat note sections as a root, if the section is not part
 of a group.  We must keep all PREINIT_ARRAY, INIT_ARRAY as
 well as FINI_ARRAY sections for ld -r.  */

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


[Bug ld/28138] [2.37 Regression][bisected] Linker plugin complains about "malformed archive" on thin archines

2021-07-26 Thread slyfox at inbox dot ru
https://sourceware.org/bugzilla/show_bug.cgi?id=28138

--- Comment #10 from Sergei Trofimovich  ---
(In reply to H.J. Lu from comment #9)
> A patch is posted at
> 
> https://sourceware.org/pipermail/binutils/2021-July/117502.html

The patch works for nodejs. Thank you!

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


[Bug binutils/28144] New: [2.37 regression] binutils build compile zero-sized mans (probably due to extra --no-split option)

2021-07-26 Thread slyfox at inbox dot ru
https://sourceware.org/bugzilla/show_bug.cgi?id=28144

Bug ID: 28144
   Summary: [2.37 regression] binutils build compile zero-sized
mans (probably due to extra --no-split option)
   Product: binutils
   Version: 2.37
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: binutils
  Assignee: unassigned at sourceware dot org
  Reporter: slyfox at inbox dot ru
CC: vapier at gentoo dot org
  Target Milestone: ---

It's a forward of downstream https://bugs.gentoo.org/804187

# LANG=C ls -lh /usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/*
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/addr2line.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/ar.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/as.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/c++filt.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/dlltool.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/elfedit.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/gprof.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/ld.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/nm.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/objcopy.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/objdump.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/ranlib.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/readelf.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/size.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/strings.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/strip.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/windmc.1
-rw-r--r-- 1 root root 0 Jul 22 23:35
/usr/share/binutils-data/x86_64-pc-linux-gnu/2.37/man/man1/windres.1

Also reproducible on vanilla binutils-gdb. The main suspect of build log:

touch ar.1
perl ../../../binutils-gdb/binutils/../etc/texi2pod.pl -I
"../../../binutils-gdb/binutils/doc" -I
"../../../binutils-gdb/binutils/../libiberty" -I
"../../../binutils-gdb/binutils/../bfd/doc" -I ../../bfd/doc --no-split -Dman
-Dar < ../../../binutils-gdb/binutils/doc/binutils.texi > ar.pod
usage: ../../../binutils-gdb/binutils/../etc/texi2pod.pl [-D toggle...] [infile
[outfile]]
make[3]: [Makefile:927: ar.1] Error 255 (ignored)
(pod2man --center="GNU Development Tools" --release="binutils-2.37.50"
--section=1 ar.pod | sed -e '/^.if n .na/d' > ar.1.T$$ && \
mv -f ar.1.T$$ ar.1) || (rm -f ar.1.T$$ && exit 1)
pod2man: unable to format ar.pod
rm -f ar.pod
make[3]: Leaving directory '/home/sl

Note that --no-split is not recognized by texi2pod.pl.

I suspect --no-split comes from.

commit 2faf902da5109e31ad08d84a24f827f0e6f60dc4
Author: Mike Frysinger 
Date:   Sun May 2 12:09:00 2021 -0400

generate single html manual page by default

This better matches other GNU projects like autoconf/automake where
the html manual is the single page form.  We'll support the multi-page
form in a follow up change.

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


[Bug binutils/28144] [2.37 regression] binutils build compile zero-sized mans (probably due to extra --no-split option)

2021-07-26 Thread slyfox at inbox dot ru
https://sourceware.org/bugzilla/show_bug.cgi?id=28144

--- Comment #1 from Sergei Trofimovich  ---
Sent https://sourceware.org/pipermail/binutils/2021-July/117503.html for
review.

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


[Bug ld/28138] [2.37 Regression][bisected] Linker plugin complains about "malformed archive" on thin archines

2021-07-26 Thread cvs-commit at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=28138

--- Comment #11 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=5b37a5ca1d2e90ea1fc29593046428f7ed116a7f

commit 5b37a5ca1d2e90ea1fc29593046428f7ed116a7f
Author: H.J. Lu 
Date:   Mon Jul 26 05:37:57 2021 -0700

bfd: Set error to bfd_error_malformed_archive only if unset

When reading an archive member, set error to bfd_error_malformed_archive
on open_nested_file failure only if the error is unset.

PR ld/28138
* archive.c (_bfd_get_elt_at_filepos): Don't set error to
bfd_error_malformed_archive if it has been set.

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


[Bug binutils/28144] [2.37 regression] binutils build compile zero-sized mans (probably due to extra --no-split option)

2021-07-26 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28144

H.J. Lu  changed:

   What|Removed |Added

 CC||xry111 at mengyan1223 dot wang

--- Comment #2 from H.J. Lu  ---
*** Bug 28134 has been marked as a duplicate of this bug. ***

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


[Bug binutils/28134] empty man pages in binutils 2.37 release tarball

2021-07-26 Thread hjl.tools at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=28134

H.J. Lu  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

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

*** This bug has been marked as a duplicate of bug 28144 ***

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