public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* usage of the libdep plugin of LD
@ 2023-02-13 16:55 Marco Frigerio
  2023-02-13 17:12 ` Howard Chu
  2023-02-13 17:13 ` Ulf Samuelsson
  0 siblings, 2 replies; 6+ messages in thread
From: Marco Frigerio @ 2023-02-13 16:55 UTC (permalink / raw)
  To: binutils

Hi,
Is there a way of making sure that the libdep plugin of LD is used?

I have a static .a library with the __.LIBDEP section, but linking it to an executable raises linking errors.

All the errors go away if I specify manually the same '-lXXX' which is written in __.LIBDEP, suggesting that the latter is ignored.

GNU Binutils v 2.38, gcc 11.3.0, on Ubuntu Linux.

I could not find anything in the man pages, and the LD docs (section 4) do not say anything about enabling/loading plugins.

I hope this is the right place for this kind of questions, my apologies otherwise.
Thanks
 - MF

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: usage of the libdep plugin of LD
  2023-02-13 16:55 usage of the libdep plugin of LD Marco Frigerio
@ 2023-02-13 17:12 ` Howard Chu
  2023-02-13 17:28   ` Howard Chu
  2023-02-13 17:13 ` Ulf Samuelsson
  1 sibling, 1 reply; 6+ messages in thread
From: Howard Chu @ 2023-02-13 17:12 UTC (permalink / raw)
  To: Marco Frigerio, binutils

Marco Frigerio via Binutils wrote:
> Hi,
> Is there a way of making sure that the libdep plugin of LD is used?

Not by default. You need to make sure ld is invoked with "-plugin .../libdep_plugin.so" yourself.
Easiest way might be a wrapper script.
> 
> I have a static .a library with the __.LIBDEP section, but linking it to an executable raises linking errors.
> 
> All the errors go away if I specify manually the same '-lXXX' which is written in __.LIBDEP, suggesting that the latter is ignored.
> 
> GNU Binutils v 2.38, gcc 11.3.0, on Ubuntu Linux.
> 
> I could not find anything in the man pages, and the LD docs (section 4) do not say anything about enabling/loading plugins.
> 
> I hope this is the right place for this kind of questions, my apologies otherwise.
> Thanks
>  - MF
> 


-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: usage of the libdep plugin of LD
  2023-02-13 16:55 usage of the libdep plugin of LD Marco Frigerio
  2023-02-13 17:12 ` Howard Chu
@ 2023-02-13 17:13 ` Ulf Samuelsson
  1 sibling, 0 replies; 6+ messages in thread
From: Ulf Samuelsson @ 2023-02-13 17:13 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1510 bytes --]


Den 2023-02-13 kl. 17:55, skrev Marco Frigerio via Binutils:
> Hi,
> Is there a way of making sure that the libdep plugin of LD is used?

I think you need to supply an option to the LD command --plugin libdep 
or something similar.

|-plugin |name
    Involve a plugin in the linking process. The name parameter is the
    absolute filename of the plugin.
    Usually this parameter is automatically added by the complier, when
    using link time optimization,
    but users can also add their own plugins if they so wish.

    Note that the location of the compiler originated plugins is
    different from the place where the ar, nm and ranlib programs search
    for their plugins.
    In order for those commands to make use of a compiler based plugin
    it must first be copied into the ${libdir}/bfd-plugins directory.
    All gcc based linker plugins are backward compatible, so it is
    sufficient to just copy in the newest one.


Best Regards
Ulf Samuelsson


>
> I have a static .a library with the __.LIBDEP section, but linking it to an executable raises linking errors.
>
> All the errors go away if I specify manually the same '-lXXX' which is written in __.LIBDEP, suggesting that the latter is ignored.
>
> GNU Binutils v 2.38, gcc 11.3.0, on Ubuntu Linux.
>
> I could not find anything in the man pages, and the LD docs (section 4) do not say anything about enabling/loading plugins.
>
> I hope this is the right place for this kind of questions, my apologies otherwise.
> Thanks
>   - MF

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: usage of the libdep plugin of LD
  2023-02-13 17:12 ` Howard Chu
@ 2023-02-13 17:28   ` Howard Chu
  2023-02-14  9:45     ` Marco Frigerio
  0 siblings, 1 reply; 6+ messages in thread
From: Howard Chu @ 2023-02-13 17:28 UTC (permalink / raw)
  To: Marco Frigerio, binutils

Howard Chu wrote:
> Marco Frigerio via Binutils wrote:
>> Hi,
>> Is there a way of making sure that the libdep plugin of LD is used?
> 
> Not by default. You need to make sure ld is invoked with "-plugin .../libdep_plugin.so" yourself.
> Easiest way might be a wrapper script.
>>
>> I have a static .a library with the __.LIBDEP section, but linking it to an executable raises linking errors.
>>
>> All the errors go away if I specify manually the same '-lXXX' which is written in __.LIBDEP, suggesting that the latter is ignored.
>>
>> GNU Binutils v 2.38, gcc 11.3.0, on Ubuntu Linux.

On my Ubuntu system the plugin is in /usr/lib/x86_64-linux-gnu/bfd-plugins/libdep.so
>>
>> I could not find anything in the man pages, and the LD docs (section 4) do not say anything about enabling/loading plugins.
>>
>> I hope this is the right place for this kind of questions, my apologies otherwise.
>> Thanks
>>  - MF
>>
> 
> 


-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: usage of the libdep plugin of LD
  2023-02-13 17:28   ` Howard Chu
@ 2023-02-14  9:45     ` Marco Frigerio
  2023-02-14 12:03       ` Nick Clifton
  0 siblings, 1 reply; 6+ messages in thread
From: Marco Frigerio @ 2023-02-14  9:45 UTC (permalink / raw)
  To: Howard Chu; +Cc: binutils


> Howard Chu wrote:
> 
> > Marco Frigerio via Binutils wrote:
> > 
> > > Hi,
> > > Is there a way of making sure that the libdep plugin of LD is used?
> > 
> > Not by default. You need to make sure ld is invoked with "-plugin .../libdep_plugin.so" yourself.


Thanks, it works now.
I am sorry I was reading an online version of the man page of LD which does not include the -plugin switch (I guess the page is outdated).

(Hopefully a mention to -plugin will also be added to the online docs https://sourceware.org/binutils/docs-2.40/ld/Plugins.html) 

Best,
 -MF



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: usage of the libdep plugin of LD
  2023-02-14  9:45     ` Marco Frigerio
@ 2023-02-14 12:03       ` Nick Clifton
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Clifton @ 2023-02-14 12:03 UTC (permalink / raw)
  To: Marco Frigerio, Howard Chu; +Cc: binutils

Hi Marco,

> I am sorry I was reading an online version of the man page of LD which does not include the -plugin switch (I guess the page is outdated).

It does - but not in the section about plugins...

> (Hopefully a mention to -plugin will also be added to the online docs https://sourceware.org/binutils/docs-2.40/ld/Plugins.html)

I have updated the documentation source file (ld/ld.texi) so that the
plugin section of the document now mentions the command line option.

This will not affect the online documentation right away however - that
will happen with the next release.

Cheers
   Nick



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-02-14 12:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-13 16:55 usage of the libdep plugin of LD Marco Frigerio
2023-02-13 17:12 ` Howard Chu
2023-02-13 17:28   ` Howard Chu
2023-02-14  9:45     ` Marco Frigerio
2023-02-14 12:03       ` Nick Clifton
2023-02-13 17:13 ` Ulf Samuelsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).