[PATCH] D115604: [Support] Expand `<@>` as the base directory in response files.

Jack Andersen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 22 09:55:37 PST 2021


jackoalan added inline comments.


================
Comment at: clang/docs/UsersManual.rst:920
 
+To generate paths relative to the configuration file, the `<@>` token may be
+used. This will expand to the absolute path of the directory containing the
----------------
sepavloff wrote:
> Response and configuration files are different things, so the documentation must more specific what facility is extended.
> 
> According to this implementation the response file treatment is extended. During development of configuration files couple of attempts were taken to extend the functionality of response files (see for example https://reviews.llvm.org/D36045). They were rejected as breaking compatibility with gcc. It does not mean that such extending is not possible, but it should be discussed in wider community. There must be serious reason for such extension and significant use case.
> 
> As for using this feature for configuration files, it does not look as very helpful. Configuration files are searched for in several places and the first found file is used. In this case specification of various locations relative to the config-file does not look neither safe nor natural. Specific use case also would be helpful to ground the need for such extension.
> Specific use case also would be helpful to ground the need for such extension.

An embedded architecture's community members may wish to deploy their own portable (non-installed) platform packages, while minimizing the user burden of configuring the build system of their choice to set up all the search paths. Ideally, just the `--config` option should be enough to handle everything necessary for full use of the package.

Consider an embedded architecture "foo". It deploys a common directory which contains a shared configuration file and headers:

```
-foo-common
  -config.cfg
  -include
    -foo.h
    -stdlib.h
    -string.h
    -...
```

foo-common/config.cfg:

```
--target=foo
-isystem <@>/include
```

foo is implemented by a family of boards. Each board SDK is contained in a directory located next to the common one. Each has their own device libraries and some require special feature and machine flags.

Here is the directory layout for a board named "bar":

```
-foo-bar
  -config.cfg
  -include
    -bar.h
  -lib
    -libbar.a
    -libc.a
    -libm.a
  -ldscripts
    -link.ld
```

foo-bar/config.cfg:

```
@../foo-common/config.cfg
-mcpu=<foo-variant-used-in-bar>
-isystem <@>/include
-L <@>/lib
-T <@>/ldscripts/link.ld
```

Configuration files are very convenient for setting up compiler options in an accessible way (i.e. not having to depend on hard-coded logic in the driver or cmake/makefiles/etc to set up the environment). However, the inability to express config-relative paths is a major burden for setting up search paths in this use case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115604



More information about the llvm-commits mailing list