Skip to content

Commit 61a535a

Browse files
authored
[lld][ELF] Fix gc-sections-print.s failure in read-only directories (#160204)
If ld.lld is invoked without the `-o` option, it defaults to writing its output to `a.out` in the current directory. This can cause 'Permission denied' errors if a test is executed in a directory without write permissions, as can happen in some build environments. Add `-o %t2` to this command, consistent with other commands in the same test file, to prevent this failure by ensuring ld.lld writes to a temporary file instead of `a.out`.
1 parent 360b059 commit 61a535a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lld/test/ELF/gc-sections-print.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
33
# RUN: ld.lld %t --gc-sections --print-gc-sections -o %t2 2>&1 | FileCheck -check-prefix=PRINT %s
44
# RUN: ld.lld %t --gc-sections --print-gc-sections=- -o %t2 2>&1 | FileCheck -check-prefix=PRINT %s
5-
# RUN: ld.lld %t --gc-sections --print-gc-sections=%t.txt
5+
# RUN: ld.lld %t --gc-sections --print-gc-sections=%t.txt -o %t2
66
# RUN: FileCheck --check-prefix=PRINT %s --input-file=%t.txt
77

88
# PRINT: removing unused section {{.*}}:(.text.x)

0 commit comments

Comments
 (0)