URL: <https://savannah.gnu.org/support/?110978>
Summary: libtool.m4: Not respecting $LD when checking for --whole-archive Group: GNU Libtool Submitter: rrangel Submitted: Wed 13 Dec 2023 05:14:05 PM UTC Category: None Priority: 5 - Normal Severity: 3 - Normal Status: None Privacy: Public Assigned to: None Originator Email: Open/Closed: Open Discussion Lock: Any Operating System: None _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Wed 13 Dec 2023 05:14:05 PM UTC By: Raul E Rangel <rrangel> The following [code](https://github.com/autotools-mirror/libtool/blob/master/m4/libtool.m4#L6423) is using the `ld` linker, instead of the linker specified by `$LD`. ``` # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi ``` There is [another spot](https://github.com/autotools-mirror/libtool/blob/master/m4/libtool.m4#L5060C1-L5065C7) in the script that does correctly use `$LD` variable for the sme check: ``` # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi ``` I have attached a patch that brings the two checks in sync. https://bugs.gentoo.org/919801 has more information on how I tracked it down, and a list of packages that suffer from this problem. It looks like the code was added back in 2001: https://github.com/autotools-mirror/libtool/commit/9f9269164#diff-4ccd091c8ac4d08370b548aee711e539a559d0c53d827782e292da0b97836a3fR2231-R2237 _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Wed 13 Dec 2023 05:14:05 PM UTC Name: 0001-m4-libtool.m4-Use-LD-when-checking-for-whole-archive.patch Size: 1KiB By: rrangel <http://savannah.gnu.org/support/download.php?file_id=55446> _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/support/?110978> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/