https://sourceware.org/bugzilla/show_bug.cgi?id=28138
Bug ID: 28138 Summary: [2.37 Regression][bisected] Linker plugin complains about "malformed archive" on thin archines Product: binutils Version: 2.37 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: slyfox at inbox dot ru CC: hjl.tools at gmail dot com Target Milestone: --- Initially noticed as a nodejs-14.17.3 link failure against gcc-HEAD+binutils-2.37 on x86_64-linux. I did not manage to extract minimal example yet, but was able to bisect binutils down to seemingly relevant commit 7a30ac441a4e776e68399cb916c4731b5192e931 Author: H.J. Lu <hjl.to...@gmail.com> Date: Tue Jul 6 06:21:54 2021 -0700 ld: Check archive only for archive member Since plugin_maybe_claim calls bfd_close on the original input BFD if it isn't an archive member, pass NULL to bfd_plugin_close_file_descriptor to indicate that the BFD isn't an archive member. bfd/ PR ld/18028 * plugin.c (bfd_plugin_close_file_descriptor): Check archive only of abfd != NULL. (try_claim): Pass NULL to bfd_plugin_close_file_descriptor if it isn't an archive member. ld/ PR ld/18028 * plugin.c (plugin_input_file): Add comments for abfd and ibfd. (plugin_object_p): Set input->ibfd to NULL if it isn't an archive member. bfd/plugin.c | 25 +++++++++++++------------ ld/plugin.c | 4 +++- 2 files changed, 16 insertions(+), 13 deletions(-) Looks relevant. Build failure is visible as: x86_64-pc-linux-gnu-g++ -o /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/mksnapshot -pthread -rdynamic -m64 -m64 -Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu -Wl,--start-group /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/embedded/embedded-empty.o /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/embedded/embedded-file-writer.o /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-aix.o /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-base.o /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.o /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-mac.o /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/embedded/platform-embedded-file-writer-win.o /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/mksnapshot.o /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/mksnapshot/deps/v8/src/snapshot/snapshot-empty.o /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/tools/v8_gypfiles/libv8_base_without_compiler.a /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/tools/v8_gypfiles/libv8_init.a /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/tools/v8_gypfiles/libv8_libbase.a /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/tools/v8_gypfiles/libv8_libplatform.a /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/tools/icu/libicui18n.a /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/tools/icu/libicuucx.a /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/tools/icu/libicudata.a /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/tools/v8_gypfiles/libv8_zlib.a /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/tools/v8_gypfiles/libv8_compiler.a /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/tools/v8_gypfiles/libv8_initializers.a -lz -luv -lbrotlidec -lbrotlienc -lcares -lnghttp2 -lcrypto -lssl -ldl -lrt -Wl,--end-group /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/tools/v8_gypfiles/libv8_compiler.a: error adding symbols: malformed archive collect2: error: ld returned 1 exit status The special thing here is lib*.a thin archives, built as: x86_64-pc-linux-gnu-ar crsT /dev/shm/portage/net-libs/nodejs-16.5.0/work/node-v16.5.0/out/Release/obj.target/tools/v8_gypfiles/libv8_compiler.a /dev/shm/portage/... I'll attach full build.log if it's of any help to craft artificial example. -- You are receiving this mail because: You are on the CC list for the bug.