Skip to content

Commit cd3f2f6

Browse files
committed
Fix review comments
1 parent 72223e2 commit cd3f2f6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/rustc_codegen_ssa/src/back/archive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl<'a> ArArchiveBuilder<'a> {
292292
&entries,
293293
archive_kind,
294294
false,
295-
self.sess.target.arch == "arm64ec",
295+
/* is_ec = */ self.sess.target.arch == "arm64ec",
296296
)?;
297297

298298
let any_entries = !entries.is_empty();

compiler/rustc_llvm/llvm-wrapper/SymbolWrapper.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static bool isArchiveSymbol(const object::BasicSymbolRef &S) {
3838
typedef void *(*LLVMRustGetSymbolsCallback)(void *, const char *);
3939
typedef void *(*LLVMRustGetSymbolsErrorCallback)(const char *);
4040

41+
// This function is copied from ArchiveWriter.cpp.
4142
static Expected<std::unique_ptr<SymbolicFile>>
4243
getSymbolicFile(MemoryBufferRef Buf, LLVMContext &Context) {
4344
const file_magic Type = identify_magic(Buf.getBuffer());
@@ -112,6 +113,8 @@ extern "C" bool LLVMRustIs64BitSymbolicFile(char *BufPtr, size_t BufLen) {
112113
SmallString<0> SymNameBuf;
113114
auto SymName = raw_svector_ostream(SymNameBuf);
114115

116+
// Code starting from this line is copied from s64BitSymbolicFile in
117+
// ArchiveWriter.cpp.
115118
// In the scenario when LLVMContext is populated SymbolicFile will contain a
116119
// reference to it, thus SymbolicFile should be destroyed first.
117120
LLVMContext Context;
@@ -145,6 +148,8 @@ extern "C" bool LLVMRustIsECObject(char *BufPtr, size_t BufLen) {
145148
return false;
146149
}
147150

151+
// Code starting from this line is copied from isECObject in
152+
// ArchiveWriter.cpp with an extra #if to work with LLVM 17.
148153
if (Obj->isCOFF())
149154
return cast<llvm::object::COFFObjectFile>(&*Obj)->getMachine() !=
150155
COFF::IMAGE_FILE_MACHINE_ARM64;

0 commit comments

Comments
 (0)