]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
native/cross: ar wrapper: don't prepend 'D' when @<file> is used
authorMartin Jansa <martin.jansa@gmail.com>
Thu, 2 Apr 2026 00:14:58 +0000 (02:14 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 7 Apr 2026 20:05:12 +0000 (21:05 +0100)
In some cases bazel-native build calls ar with
@<file>      - read options from <file>
syntax, where the ar params are generated in *.param file by
separate bazel action before ar is called.

Unfortunately this intercept breaks that syntax by prepending D like:

$ ./ar-intercept @foo
argv before: ['./ar-intercept', '@foo']
argv after:  ['./ar-intercept', 'D@foo']
./ar-intercept: invalid option -- '@'
Usage: ./ar-intercept [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
       ./ar-intercept -M [<mri-script]
...

or might trigger 'non-deterministic mode requested' error on false positive:

$ ./ar-intercept @Ufo
argv before: ['./ar-intercept', '@Ufo']
ar: non-deterministic mode requested
argv after:  ['./ar-intercept', '@Ufo']
./ar-intercept: invalid option -- '@'
Usage: ./ar-intercept [emulation options] [-]{dmpqrstx}[abcDfilMNoOPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
       ./ar-intercept -M [<mri-script]

Don't try to inject D into first line of @<file>, lets assume the caller
uses D already (bazel uses 'rcsD' by default).

       * Ar flags for combining object files into archives. If this is not set, it
       * defaults to "rcsD".
       * TODO(b/37271982): Remove after blaze with ar action_config release

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/native-intercept/ar

index dcc623e3ed51bb1dad47ded9b69c39d59f22fbdf..fd266c19d47e0a7e8cc31076f186078c739aa506 100755 (executable)
@@ -19,6 +19,11 @@ argv = sys.argv
 if argv[1].startswith('--'):
     # No modifier given
     None
+elif argv[1][0] == '@':
+    # Reading parameters from @file, we can try to inject D on the first line as well
+    # but modifying input files seems a bit too far for this intercept, bazel-native
+    # uses it but with rcsD by default
+    None
 else:
     # remove the optional '-'
     if argv[1][0] == '-':