Generate SHA-1 build ID for host-generated *.oat files (1/2).
For host-generated *.oat files, generate a SHA-1 build ID based on the
file content and write it to .note.gnu.build-id ELF section. This
should allow various developer tools like profilers correlate the data
captured for files like boot.oat on the device with the corresponding
known version of the file during an offline analysis.
Test: Verified that boot.oat contains the build ID section now (with
this change and https://android-review.googlesource.com/#/c/275630
applied)
Test: Added ElfWriterTest::CheckBuildIdPresent test.
Test: make test-art-host
Bug: 31292208
Change-Id: Ie5e89da2ef87e34c27c0237ab34ddc7d2dc0aa3b
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index 292aff4..3e8adc0 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -339,6 +339,11 @@
UsageError("");
UsageError(" --no-generate-mini-debug-info: Do not generate backtrace info.");
UsageError("");
+ UsageError(" --generate-build-id: Generate GNU-compatible linker build ID ELF section with");
+ UsageError(" SHA-1 of the file content (and thus stable across identical builds)");
+ UsageError("");
+ UsageError(" --no-generate-build-id: Do not generate the build ID ELF section.");
+ UsageError("");
UsageError(" --debuggable: Produce code debuggable with Java debugger.");
UsageError("");
UsageError(" --runtime-arg <argument>: used to specify various arguments for the runtime,");