Skip to content

Conversation

itf
Copy link
Contributor

@itf itf commented Sep 22, 2025

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.

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`.
@llvmbot
Copy link
Member

llvmbot commented Sep 22, 2025

@llvm/pr-subscribers-lld

Author: Ivan Tadeu Ferreira Antunes Filho (itf)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/160204.diff

1 Files Affected:

  • (modified) lld/test/ELF/gc-sections-print.s (+1-1)
diff --git a/lld/test/ELF/gc-sections-print.s b/lld/test/ELF/gc-sections-print.s
index f105dc10c2471..a6451912c05ed 100644
--- a/lld/test/ELF/gc-sections-print.s
+++ b/lld/test/ELF/gc-sections-print.s
@@ -2,7 +2,7 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
 # RUN: ld.lld %t --gc-sections --print-gc-sections -o %t2 2>&1 | FileCheck -check-prefix=PRINT %s
 # RUN: ld.lld %t --gc-sections --print-gc-sections=- -o %t2 2>&1 | FileCheck -check-prefix=PRINT %s
-# RUN: ld.lld %t --gc-sections --print-gc-sections=%t.txt
+# RUN: ld.lld %t --gc-sections --print-gc-sections=%t.txt -o %t2
 # RUN: FileCheck --check-prefix=PRINT %s --input-file=%t.txt
 
 # PRINT:      removing unused section {{.*}}:(.text.x)

@llvmbot
Copy link
Member

llvmbot commented Sep 22, 2025

@llvm/pr-subscribers-lld-elf

Author: Ivan Tadeu Ferreira Antunes Filho (itf)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/160204.diff

1 Files Affected:

  • (modified) lld/test/ELF/gc-sections-print.s (+1-1)
diff --git a/lld/test/ELF/gc-sections-print.s b/lld/test/ELF/gc-sections-print.s
index f105dc10c2471..a6451912c05ed 100644
--- a/lld/test/ELF/gc-sections-print.s
+++ b/lld/test/ELF/gc-sections-print.s
@@ -2,7 +2,7 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
 # RUN: ld.lld %t --gc-sections --print-gc-sections -o %t2 2>&1 | FileCheck -check-prefix=PRINT %s
 # RUN: ld.lld %t --gc-sections --print-gc-sections=- -o %t2 2>&1 | FileCheck -check-prefix=PRINT %s
-# RUN: ld.lld %t --gc-sections --print-gc-sections=%t.txt
+# RUN: ld.lld %t --gc-sections --print-gc-sections=%t.txt -o %t2
 # RUN: FileCheck --check-prefix=PRINT %s --input-file=%t.txt
 
 # PRINT:      removing unused section {{.*}}:(.text.x)

@pranavk pranavk self-requested a review September 22, 2025 21:27
Copy link
Contributor

@pranavk pranavk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@itf itf enabled auto-merge (squash) September 22, 2025 21:32
@itf itf merged commit 61a535a into llvm:main Sep 22, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants