Skip to content

Commit 0c83491

Browse files
committed
[lld] Support RUN_LLD_MAIN_TWICE for the ELF port
This enables the LLD_IN_TEST=2 testing mode for ``` path/to/llvm-lit -sv --param RUN_LLD_MAIN_TWICE=1 lld/test/ELF ``` When `Fatal` is called, `RunSafely` will return false. For the first invocation in LLD_IN_TEST=2 mode, `inTestOutputDisabled` is true and lld will not write to stdout/stderr, making many tests fail. (This essentially discourages `Fatal` calls in the source code.) Add XFAIL: main-run-twice to these tests similar to https://reviews.llvm.org/D112898 for Mach-O ``` xargs </tmp/0 sed -Ei '1s/(;|#|\/\/) REQUIRES: .*/\0\n\1 XFAIL: main-run-twice/;t;1s/^/# XFAIL: main-run-twice\n/' ```
1 parent c1f10ef commit 0c83491

23 files changed

+22
-2
lines changed

lld/test/ELF/archive-thin-missing-member.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# REQUIRES: x86
2+
# XFAIL: main-run-twice
23

34
# RUN: rm -f %t-no-syms.a
45
# RUN: rm -f %t-syms.a

lld/test/ELF/arm-thumb-thunk-v6m-xo.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// REQUIRES: arm
2+
// XFAIL: main-run-twice
23
// RUN: rm -rf %t && split-file %s %t
34
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv6m-none-eabi %t/a.s -o %t/a.o
45
// RUN: ld.lld --no-rosegment --script %t/a.t %t/a.o -o %t/a

lld/test/ELF/arm-thunk-section-too-large.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// REQUIRES: arm
2+
// XFAIL: main-run-twice
23
// RUN: llvm-mc %s -triple=armv7a-linux-gnueabihf -arm-add-build-attributes -filetype=obj -o %t.o
34
// RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
45

lld/test/ELF/arm-thunk-toolargesection.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// REQUIRES: arm
2+
// XFAIL: main-run-twice
23
// RUN: llvm-mc -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t
34
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s
45

lld/test/ELF/arm-v5-reloc-error.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// REQUIRES: arm
2+
// XFAIL: main-run-twice
23
// RUN: llvm-mc -filetype=obj -triple=armv7a-linux-gnueabi %s -o %t
34
// RUN: echo "SECTIONS { \
45
// RUN: . = SIZEOF_HEADERS; \

lld/test/ELF/bad-archive.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// REQUIRES: x86
2+
// XFAIL: main-run-twice
23

34
// Check bad archive error reporting with --whole-archive
45
// and without it.

lld/test/ELF/fatlto/fatlto.invalid.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# REQUIRES: x86
2+
# XFAIL: main-run-twice
23
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
34
# RUN: not ld.lld %t -o /dev/null --fat-lto-objects 2>&1 | FileCheck %s
45

lld/test/ELF/invalid-cie-reference.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// REQUIRES: x86
2+
// XFAIL: main-run-twice
23

34
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
45
// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s

lld/test/ELF/invalid/comdat-broken.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# REQUIRES: x86
2+
# XFAIL: main-run-twice
23

34
# RUN: yaml2obj %s -o %t.o
45
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s

lld/test/ELF/invalid/common-symbol-alignment.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# XFAIL: main-run-twice
12
## If an object contains a common symbol with zero alignment,
23
## check we report it.
34
# RUN: yaml2obj --docnum=1 %s -o %t1.o

lld/test/ELF/invalid/data-encoding.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# REQUIRES: x86
2+
# XFAIL: main-run-twice
23

34
# The object in the archive has invalid data encoding.
45
# Check we report this.

lld/test/ELF/invalid/dynamic-section-broken.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# XFAIL: main-run-twice
12
## .dynamic section has invalid sh_entsize, check we report it.
23
# RUN: yaml2obj --docnum=1 %s -o %t.so
34
# RUN: not ld.lld %t.so -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR1

lld/test/ELF/invalid/invalid-elf.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# XFAIL: main-run-twice
12
# RUN: rm -rf %t && mkdir -p %t
23
# RUN: echo > %t/empty.o
34
# RUN: llvm-ar --format=gnu cr %t/not-elf.a %t/empty.o

lld/test/ELF/invalid/invalid-file-class.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# REQUIRES: x86
2+
# XFAIL: main-run-twice
23
# RUN: rm -rf %t && mkdir -p %t
34

45
## In this test, we check that able to report objects with

lld/test/ELF/invalid/invalid-soname.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# REQUIRES: x86
2+
# XFAIL: main-run-twice
23
# RUN: yaml2obj %s -o %t.so
34
# RUN: not ld.lld %t.so -o /dev/null 2>&1 | FileCheck %s
45

lld/test/ELF/invalid/sht-group-wrong-section.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# REQUIRES: x86
2+
# XFAIL: main-run-twice
23
# RUN: yaml2obj %s -o %t.o
34
# RUN: not ld.lld %t.o %t.o -o /dev/null 2>&1 | FileCheck %s
45
# CHECK: error: {{.*}}.o: invalid section index in group: 12345

lld/test/ELF/invalid/sht-group.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# REQUIRES: x86
2+
# XFAIL: main-run-twice
23
# RUN: yaml2obj %s -o %t.o
34
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
45
# CHECK: invalid symbol index

lld/test/ELF/invalid/symtab-sh-info.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# XFAIL: main-run-twice
12
## .symtab's sh_info contains zero value. First entry in a .symtab is a
23
## zero entry that must exist in a valid object, so sh_info can't be null.
34
## Check we report a proper error for that case.

lld/test/ELF/invalid/verneed-shared.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## REQUIRES: x86
2+
# XFAIL: main-run-twice
23
## Test that we can parse SHT_GNU_verneed in a shared object and report certain errors.
34

45
# RUN: echo '.globl _start; _start:' | llvm-mc -filetype=obj -triple=x86_64 - -o %t.o

lld/test/ELF/lto/bitcode-nodatalayout.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; REQUIRES: x86
2+
; XFAIL: main-run-twice
23
; RUN: llvm-as %s -o %t.o
34
; RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
45

lld/test/ELF/lto/bitcode-wrapper.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; REQUIRES: x86
2+
; XFAIL: main-run-twice
23

34
;; The LLVM bitcode format allows for an optional wrapper header. This test
45
;; shows that LLD can handle bitcode wrapped in this way, and also that an

lld/test/ELF/unsupported-emachine.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# XFAIL: main-run-twice
12
# RUN: yaml2obj %s -o %t.o
23
# RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
34

lld/test/lit.cfg.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@
104104
config.environment["LLD_IN_TEST"] = "1"
105105
else:
106106
config.environment["LLD_IN_TEST"] = "2"
107-
# Many ELF tests fail in this mode.
108-
config.excludes.append("ELF")
109107
# Some old Mach-O backend tests fail, and it's due for removal anyway.
110108
config.excludes.append("mach-o")
111109
# Some new Mach-O backend tests fail; give them a way to mark themselves

0 commit comments

Comments
 (0)