std::make_pair(arg->getValue(0), arg->getValue(1)));
}
- // FIXME: Add a commandline flag for this too.
if (const char *zero = getenv("ZERO_AR_DATE"))
config->zeroModTime = strcmp(zero, "0") != 0;
+ if (args.getLastArg(OPT_reproducible))
+ config->zeroModTime = true;
std::array<PlatformType, 3> encryptablePlatforms{
PLATFORM_IOS, PLATFORM_WATCHOS, PLATFORM_TVOS};
def no_adhoc_codesign : Flag<["-"], "no_adhoc_codesign">,
HelpText<"Do not write an ad-hoc code signature to the output file (default for x86_64 binaries)">,
Group<grp_rare>;
+def reproducible : Flag<["-"], "reproducible">,
+ HelpText<"Make the output reproducible by removing timestamps and other non-deterministic data. This is the default behavior.">,
+ Group<grp_rare>;
def version_details : Flag<["-"], "version_details">,
HelpText<"Print the linker version in JSON form">,
Flags<[HelpHidden]>,
# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.a\(foo.o\) \
# RUN: -D#TEST_TIME=0 -D#FOO_TIME=0
+# RUN: env ZERO_AR_DATE=0 %lld -lSystem -reproducible %t/test.o %t/foo.o \
+# RUN: %t/no-debug.o -o %t/test
+# RUN: (llvm-objdump --section-headers %t/test; dsymutil -s %t/test) | \
+# RUN: FileCheck %s -DDIR=%t -DFOO_PATH=%t/foo.o \
+# RUN: -D#TEST_TIME=0 -D#FOO_TIME=0
## Check that we emit absolute paths to the object files in our OSO entries
## even if our inputs are relative paths.