mainGNU Libtool - Support: sr #110978, libtool.m4: Not respecting $LD...

 
 

sr #110978: libtool.m4: Not respecting $LD when checking for --whole-archive

Submitter:  Raul E Rangel <rrangel>
Submitted:  Wed 13 Dec 2023 05:14:05 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Done
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 16 Jan 2024 08:32:57 PM UTC, comment #1: 
Mike Frysinger <vapier>
Group Member
Wed 13 Dec 2023 05:14:05 PM UTC, original submission:  

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

Raul E Rangel <rrangel>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by vapier (Posted a comment)
  • -email is unavailable- added by rrangel (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-16 vapier StatusNone Done
        Open/ClosedOpen Closed
    2023-12-13 rrangel Attached File- Added 0001-m4-libtool.m4-Use-LD-when-checking-for-whole-archive.patch, #55446

    Back to the top

    Powered by Savane 3.13-04b1.
    Corresponding source code