This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Does ld/gold-l always simply add files to the command line
- From: "Ian Lance Taylor via binutils" <binutils at sourceware dot org>
- To: Niklas Hambüchen <mail at nh2 dot me>
- Cc: Binutils <binutils at sourceware dot org>, Ben Gamari <bgamari dot foss at gmail dot com>
- Date: Wed, 26 Jul 2017 15:49:04 -0700
- Subject: Re: Does ld/gold-l always simply add files to the command line
- Authentication-results: sourceware.org; auth=none
- References: <dc0d7185-bdc1-f1e4-578e-eab9f4caf80c@nh2.me>
- Reply-to: Ian Lance Taylor <iant at google dot com>
On Wed, Jul 26, 2017 at 1:44 PM, Niklas Hambüchen <mail@nh2.me> wrote:
>
> is the -l flag to ld and gold guaranteed to have the same effect as
> passing the found library file (.so or .a) directly on the command line?
>
> In other words, is it just "lookup convenience", or are there cases
> where -l might do something different than passing the relevant file
> directly?
>
> (I'm asking this for the GHC Haskell compiler, specifically for this
> linker related issue: https://ghc.haskell.org/trac/ghc/ticket/14031)
It is mostly just lookup convenience. If you replace the -l option
with the full path of the library that is found, the result will be
almost identical. The only differences I know of are error messages
and the soname that will be used for a shared library with no
DT_SONAME dynamic tag.
Ian