[llvm] [Object] Provide operator< for ELFSymbolRef (PR #89861)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 00:39:59 PDT 2024


================
@@ -1504,3 +1504,39 @@ TEST(ELFObjectFileTest, GetSectionAndRelocations) {
                "SHT_RELA section with index 1: failed to get a "
                "relocated section: invalid section index: 255");
 }
+
+TEST(ELFObjectFileTest, ELFSymbolRefLess) {
+  SmallString<0> Storage;
+  Expected<ELFObjectFile<ELF64LE>> ElfOrErr = toBinary<ELF64LE>(Storage, R"(
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_DYN
+  Machine: EM_X86_64
+)");
+
+  ASSERT_THAT_EXPECTED(ElfOrErr, Succeeded());
+  const ELFObjectFile<ELF64LE> &Obj = *ElfOrErr;
+
+  llvm::object::DataRefImpl Data1;
+  Data1.d.a = 0x00000000;
----------------
jh7370 wrote:

Let's use a non-zero value for all the elements for all cases, since a value of `0` is the same regardless of endianness. (It's not strictly required, but I think it helps clarify a little).

https://github.com/llvm/llvm-project/pull/89861


More information about the llvm-commits mailing list