[PATCH] D153652: [llvm][Support] Don'tt set "all_exe" mode by default for file written by llvm::writeToOutput.

Haojian Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 26 00:01:55 PDT 2023


hokein updated this revision to Diff 534438.
hokein added a comment.
Herald added subscribers: MaskRay, emaste.
Herald added a reviewer: alexander-shaposhnikov.

add lit tests.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153652/new/

https://reviews.llvm.org/D153652

Files:
  llvm/lib/Support/raw_ostream.cpp
  llvm/test/tools/llvm-dwarfutil/ELF/X86/file-permissions.test
  llvm/test/tools/llvm-objcopy/ELF/file-permissions.test


Index: llvm/test/tools/llvm-objcopy/ELF/file-permissions.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-objcopy/ELF/file-permissions.test
@@ -0,0 +1,5 @@
+# RUN: cp %p/Inputs/dwarf.dwo %t-exe.dwo
+# RUN: chmod a+x %t-exe.dwo
+# RUN: llvm-objcopy --split-dwo=%t2 %t-exe.dwo %t3
+# Verify the output file preserve the executable bit from the input file.
+# RUN: test -x %t3
Index: llvm/test/tools/llvm-dwarfutil/ELF/X86/file-permissions.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-dwarfutil/ELF/X86/file-permissions.test
@@ -0,0 +1,9 @@
+# RUN: yaml2obj %p/Inputs/common.yaml -o %t.o
+# RUN: chmod a+x %t.o
+
+# Verify that the output file preserves the executable bit from the input file.
+# RUN: llvm-dwarfutil --no-garbage-collection %t.o %t1
+# RUN: test -x %t1
+
+# RUN: llvm-dwarfutil --garbage-collection --separate-debug-file %t.o %t2
+# RUN: test -x %t2.debug
Index: llvm/lib/Support/raw_ostream.cpp
===================================================================
--- llvm/lib/Support/raw_ostream.cpp
+++ llvm/lib/Support/raw_ostream.cpp
@@ -1007,7 +1007,7 @@
     return Write(Out);
   }
 
-  unsigned Mode = sys::fs::all_read | sys::fs::all_write | sys::fs::all_exe;
+  unsigned Mode = sys::fs::all_read | sys::fs::all_write;
   Expected<sys::fs::TempFile> Temp =
       sys::fs::TempFile::create(OutputFileName + ".temp-stream-%%%%%%", Mode);
   if (!Temp)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153652.534438.patch
Type: text/x-patch
Size: 1504 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230626/8430429f/attachment.bin>


More information about the llvm-commits mailing list