public inbox for
 help / color / mirror / Atom feed
From: Christian Tramnitz <>
To: Nick Clifton <>,
Subject: Re: ld: document static libraries when performing static linking
Date: Thu, 29 Feb 2024 00:50:03 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

Hi Nick,

thanks for your detailed response!

> If post-processing is an option, then how about using the linker map
> file and parsing that ?  Ie link with and then post-link
> scan  That would give you full details of which libraries were
> used, and which components from inside those libraries if they are
> archives.

-Map does indeed provide the required information - thanks a lot for
the hint, that is already much better than parsing through verbose
build logs or the dependency-file.
However, like --depedency-file, it has one major drawback: when
multiple targets exist, the "last" action overwrites the output file.
I haven't seen an option to use a dynamic file names (foo-$$.map
doesn't seem to work).

> There is another possibility...
> Check out the annobin project:
> The compiler plugins that are part of this project record notes that
> include the filename associated with each compilation unit.  These
> notes are aggregated together during a link and end up in the resulting
> binary.  So you could scan the binary for these notes, extract the
> filenames and you would end up with a list of (main) sources for the
> program.  If your static libraries are also compiled with annobin enabled
> then they will contain notes of their own that will also contribute to
> the final binary.

I indeed looked into annobin initially, but did not get that the notes
also contain references to the sources/archive/library (only compile
options as per
But since you're the author, you know better for sure. Will have a
look again as it may cover large parts of what I'm trying to achieve
already. Except for the lookup which package owns that file of course.
But that could be a post-processing step again.

Best regards,

  reply	other threads:[~2024-02-28 23:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2024-02-21 18:01 ` Christian Tramnitz
2024-02-21 20:55   ` Howard Chu
2024-02-22  3:49     ` Howard Chu
2024-02-28 14:02   ` Nick Clifton
2024-02-28 23:50     ` Christian Tramnitz [this message]
2024-02-29 10:58       ` Nick Clifton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).