about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-07-07 17:07:36 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-07-07 17:08:55 +0000
commitcd3f2f68c042e2957fff85ca89ba10cb0f2f12b3 (patch)
tree2533b3ab3927f032c4756645728242b81c6ddb18
parent72223e205d91e4d689718a9f61b3f6c0346d19e8 (diff)
downloadrust-cd3f2f68c042e2957fff85ca89ba10cb0f2f12b3.tar.gz
rust-cd3f2f68c042e2957fff85ca89ba10cb0f2f12b3.zip
Fix review comments
-rw-r--r--compiler/rustc_codegen_ssa/src/back/archive.rs2
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp5
2 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/archive.rs b/compiler/rustc_codegen_ssa/src/back/archive.rs
index f673675bdbb..ae649cd77c4 100644
--- a/compiler/rustc_codegen_ssa/src/back/archive.rs
+++ b/compiler/rustc_codegen_ssa/src/back/archive.rs
@@ -292,7 +292,7 @@ impl<'a> ArArchiveBuilder<'a> {
             &entries,
             archive_kind,
             false,
-            self.sess.target.arch == "arm64ec",
+            /* is_ec = */ self.sess.target.arch == "arm64ec",
         )?;
 
         let any_entries = !entries.is_empty();
diff --git a/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp
index 37e9e41a874..ccf1a5429e2 100644
--- a/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp
@@ -38,6 +38,7 @@ static bool isArchiveSymbol(const object::BasicSymbolRef &S) {
 typedef void *(*LLVMRustGetSymbolsCallback)(void *, const char *);
 typedef void *(*LLVMRustGetSymbolsErrorCallback)(const char *);
 
+// This function is copied from ArchiveWriter.cpp.
 static Expected<std::unique_ptr<SymbolicFile>>
 getSymbolicFile(MemoryBufferRef Buf, LLVMContext &Context) {
   const file_magic Type = identify_magic(Buf.getBuffer());
@@ -112,6 +113,8 @@ extern "C" bool LLVMRustIs64BitSymbolicFile(char *BufPtr, size_t BufLen) {
   SmallString<0> SymNameBuf;
   auto SymName = raw_svector_ostream(SymNameBuf);
 
+  // Code starting from this line is copied from s64BitSymbolicFile in
+  // ArchiveWriter.cpp.
   // In the scenario when LLVMContext is populated SymbolicFile will contain a
   // reference to it, thus SymbolicFile should be destroyed first.
   LLVMContext Context;
@@ -145,6 +148,8 @@ extern "C" bool LLVMRustIsECObject(char *BufPtr, size_t BufLen) {
     return false;
   }
 
+  // Code starting from this line is copied from isECObject in
+  // ArchiveWriter.cpp with an extra #if to work with LLVM 17.
   if (Obj->isCOFF())
     return cast<llvm::object::COFFObjectFile>(&*Obj)->getMachine() !=
            COFF::IMAGE_FILE_MACHINE_ARM64;