about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/back/write.rs
diff options
context:
space:
mode:
authorklensy <klensy@users.noreply.github.com>2023-12-03 14:02:31 +0300
committerklensy <klensy@users.noreply.github.com>2023-12-03 14:54:09 +0300
commit26e69a88167bd68ad65b22d5ca013f1270b163be (patch)
treed207d9c69505302c4b165920c2df8446a15b1a47 /compiler/rustc_codegen_llvm/src/back/write.rs
parent71940e0a8a87ec685b338384ff5b4d98c3d926c1 (diff)
downloadrust-26e69a88167bd68ad65b22d5ca013f1270b163be.tar.gz
rust-26e69a88167bd68ad65b22d5ca013f1270b163be.zip
compiler: replace cstr macro with c str literals in compiler and few other c str replacements
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/write.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/back/write.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs
index 1a567c0fce8..54c915210c4 100644
--- a/compiler/rustc_codegen_llvm/src/back/write.rs
+++ b/compiler/rustc_codegen_llvm/src/back/write.rs
@@ -916,6 +916,7 @@ fn target_is_aix(cgcx: &CodegenContext<LlvmCodegenBackend>) -> bool {
     cgcx.opts.target_triple.triple().contains("-aix")
 }
 
+//FIXME use c string literals here too
 pub(crate) fn bitcode_section_name(cgcx: &CodegenContext<LlvmCodegenBackend>) -> &'static str {
     if target_is_apple(cgcx) {
         "__LLVM,__bitcode\0"
@@ -994,7 +995,7 @@ unsafe fn embed_bitcode(
         let llglobal = llvm::LLVMAddGlobal(
             llmod,
             common::val_ty(llconst),
-            "rustc.embedded.module\0".as_ptr().cast(),
+            c"rustc.embedded.module".as_ptr().cast(),
         );
         llvm::LLVMSetInitializer(llglobal, llconst);
 
@@ -1007,15 +1008,15 @@ unsafe fn embed_bitcode(
         let llglobal = llvm::LLVMAddGlobal(
             llmod,
             common::val_ty(llconst),
-            "rustc.embedded.cmdline\0".as_ptr().cast(),
+            c"rustc.embedded.cmdline".as_ptr().cast(),
         );
         llvm::LLVMSetInitializer(llglobal, llconst);
         let section = if is_apple {
-            "__LLVM,__cmdline\0"
+            c"__LLVM,__cmdline"
         } else if is_aix {
-            ".info\0"
+            c".info"
         } else {
-            ".llvmcmd\0"
+            c".llvmcmd"
         };
         llvm::LLVMSetSection(llglobal, section.as_ptr().cast());
         llvm::LLVMRustSetLinkage(llglobal, llvm::Linkage::PrivateLinkage);