[PATCH] D124729: [Driver][Ananas] -r: imply -nostdlib like GCC

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 1 20:23:39 PDT 2022


MaskRay added inline comments.


================
Comment at: clang/test/Driver/ananas.c:20
+// -r suppresses default -l and crt*.o like -nostdlib.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o \
+// RUN:     --target=x86_64-unknown-ananas -r 2>&1 \
----------------
brad wrote:
> MaskRay wrote:
> > Delete -no-canonical-prefixes
> Why here and not with the other instances of this same test? I'm trying to understand what -no-canonical-prefixes does as I see this all over the place and it seems like it has something to do with expanding symlinks with relative paths.
By default clang uses the dereferenced argv[0] to construct the -cc1 command line.

Many tests copy n paste `-no-canonical-prefixes` without a good reason.
`-no-canonical-prefixes` is only needed when writing `clang -cc1` and `%clang` has a content hash name (e.g. in Google's internal lit runner; I think Sony does something similar).

However, it is usually sufficient to omit `clang` and check just `-cc`. These tests can omit  `-no-canonical-prefixes` .


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124729



More information about the cfe-commits mailing list