[llvm-dev] lld based tool
Alexander Linne via llvm-dev
llvm-dev at lists.llvm.org
Mon Mar 25 13:56:47 PDT 2019
verbose with -o /dev/null seems like a good option for what I'm currently trying to achieve. Thank you!
On 25.03.2019 20:47, Rui Ueyama wrote:
The other option is to just pass --verbose to the linker to print out a filename as the linker opens a file.
On Mon, Mar 25, 2019 at 12:44 PM Rui Ueyama <ruiu at google.com<mailto:ruiu at google.com>> wrote:
If you want to analyze file dependencies, analyzing command line arguments are perhaps not enough due to archive files (".a" files). The linker pulls up only needed files from archive files, so the dependency to static archive files is somewhat partial.
Have you ever tried "-M" linker option? That option lets the linker to print out what files and symbols are included in the output file. If you don't need an actual executable, you could redirect it to /dev/null by passing `-o /dev/null` to the linker. That's might be better choice than analyzing program dependencies yourself.
On Mon, Mar 25, 2019 at 11:54 AM Alexander Linne <alexander.linne at outlook.com<mailto:alexander.linne at outlook.com>> wrote:
Hi Rui,
what I am trying to achieve is actually getting all input files that are linked into the result, yes.
The first thing I currently try to achieve is to determine the object files that are being linked. My problem there exactly is to decide if an argument without dash belongs to an option or if it is an input file.
To give some context:
I'm currently trying to write a build analysis tool that works independently of build scripts/systems by tracking calls performed during the build.
Therefore, for a C++ project, I get a list of gcc/clang/ld calls and their command lines. From there I try to build a graph of which source files are built into which object files, libraries, ...
On 25.03.2019 19:19, Rui Ueyama wrote:
Hi Alexander,
Could you explain a little bit more about what you are trying to achieve? Most of the input files given to a linker is obvious -- if a command line argument does not start with dash and if is not an argument for an option, it is a filename. So I'm guessing you want to resolve library file names given by -l. Am I correct?
On Mon, Mar 25, 2019 at 11:14 AM Alexander Linne via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
Hello,
i am currently trying to write a tool based on lld. Specifically I want
to parse a ld command line to determine the input and output files and
the kind of each input file given a ld command line.
Unfortunately, the ELF linker does not expose any API to just parse the
command line.
My question: if I would refactor this module to expose such an API,
would this have any chance of being merged back into the official
repository?
Regards
Alexander Linne
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-dev&data=02%7C01%7C%7Cf5b6897270a549f81b1f08d6b15ad265%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636891400960911184&sdata=ABgtLLO%2BAqZVOFIbDqVl%2B8EvQ9J0yKdv1ei0V0xbgF8%3D&reserved=0>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190325/692902c3/attachment.html>
More information about the llvm-dev
mailing list