[PATCH] D63024: [LLD] [Driver] Look for -flavor/-m in response files as well

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 8 11:53:26 PDT 2019


mstorsjo added a comment.

In D63024#1534763 <https://reviews.llvm.org/D63024#1534763>, @rnk wrote:

> For links that use response files (i.e. most of them) this effectively leaks a second copy of the entire response file. Every argument needs to be put in the string saver so it can be null terminated. Response files tend to be large enough that I'd prefer it if we didn't do that.
>
> One way we could address this is to try to calculate the flavor twice:
>
> - First, use the unexpanded arguments to guess the flavor
> - Use the guessed flavor to expand response files: Windows tokenization for lld-link, GNU for everyone else
> - Re-parse the flavor using the expanded arguments, and call the appropriate entry point with those arguments
> - Remove existing rsp expansion code


This sounds sensible in general. But there's one gotcha that I'm a bit unsure about how to handle best; the COFF and ELF linkers support the option `rsp-quoting` (`-rsp-quoting val`, `--rsp-quoting val`, `-rsp-quoting=val` or `--rsp-quoting=val` for the ELF one, `--rsp-quoting=val` for COFF). So after getting the unexpanded arguments and guessing flavor based on that, we'd need to interpret the arguments to handle the rsp-quoting option. For the flavor option, we have only one spelling and it's handled without the tablegen options. Should I try to do some similar handwritten parsing of `rsp-quoting` for the ELF syntax (which is a supserset of the variants accepted for COFF) and use that expanding response files at that stage?

For the `-flavor` option, we remove it from the args we pass on to the individual linkers - should we do that for rsp-quoting as well , or keep it, along with the rsp-quoting options in the individual linkers for printing in the help listings (even if they aren't actually used at that level)?


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63024/new/

https://reviews.llvm.org/D63024





More information about the llvm-commits mailing list