File: zero-ar-date.c

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (40 lines) | stat: -rw-r--r-- 1,575 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Test that clang tells the linker to create reproducible executables, in
// spite of the Darwin executable's debug map having a field for each object
// file's timestamp.
//
// FIXME: Should be split up into various tests outside of clang/test/CAS.

// Needs 'shell' for touch and 'system-darwin' for calling through to the
// linker.
// REQUIRES: shell
// REQUIRES: system-darwin

// RUN: rm -rf %t
// RUN: mkdir %t

// Confirm "-greproducible" is passed through to -cc1.
// RUN: %clang -greproducible -target x86_64-apple-macos11.0 -x c -o %t/t.o -c %s -### 2>&1 \
// RUN: | FileCheck %s -check-prefix=CHECK-CC1
// CHECK-CC1: "-greproducible"

// Build an object file with debug info. Confirm the link command sets
// ZERO_AR_DATE to make the output reproducible.
// RUN: %clang -greproducible -target x86_64-apple-macos11.0 -x c -o %t/t.o -c %s
// RUN: %clang -greproducible -target x86_64-apple-macos11.0 -o %t/exec %t/t.o -### 2>&1 \
// RUN: | FileCheck %s -check-prefix=CHECK-LINK
// CHECK-LINK: env "ZERO_AR_DATE=1" "{{[^"]*}}/ld"

// Set the modtime to the start of January 1st and build an executable.
// RUN: touch -t 202001010000.00 %t/t.o
// RUN: %clang -greproducible -target x86_64-apple-macos11.0 -o %t/exec %t/t.o
// RUN: cp %t/exec %t/exec1

// Set the modtime to the end of January 31st and build an executable.
// RUN: touch -t 202012312359.59 %t/t.o
// RUN: %clang -greproducible -target x86_64-apple-macos11.0 -o %t/exec %t/t.o
// RUN: cp %t/exec %t/exec2

// Confirm the executables match.
// RUN: diff %t/exec1 %t/exec2

int main(void) { return 0; }