[all-commits] [llvm/llvm-project] df6d2f: [Object] Provide operator< for ELFSymbolRef (#89861)

Amir Ayupov via All-commits all-commits at lists.llvm.org
Mon Apr 29 09:07:47 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: df6d2faa22bf19fb27b5c083e590d13024a8d7cd
      https://github.com/llvm/llvm-project/commit/df6d2faa22bf19fb27b5c083e590d13024a8d7cd
  Author: Amir Ayupov <aaupov at fb.com>
  Date:   2024-04-29 (Mon, 29 Apr 2024)

  Changed paths:
    M llvm/include/llvm/Object/ELFObjectFile.h
    M llvm/unittests/Object/ELFObjectFileTest.cpp

  Log Message:
  -----------
  [Object] Provide operator< for ELFSymbolRef (#89861)

Normally, operator< accepting DataRefImpl is used when comparing
SymbolRef/ELFSymbolRef. However, it uses std::memcmp which interprets
DataRefImpl union as char string so that the result depends on host
endianness.
For ELFSymbolRef a specialized operator< can be used instead to produce
consistent ordering regardless of endianness by comparing the symbol
table index and symbol index fields separately.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list