[all-commits] [llvm/llvm-project] 8de2ec: [ExecutionEngine] Fix the call to DWARFContext::cr...

Kazu Hirata via All-commits all-commits at lists.llvm.org
Sun Oct 1 15:54:17 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8de2ecc2e75d496fc7fc8a24c3acf71732a3bd0c
      https://github.com/llvm/llvm-project/commit/8de2ecc2e75d496fc7fc8a24c3acf71732a3bd0c
  Author: Kazu Hirata <kazu at google.com>
  Date:   2023-10-01 (Sun, 01 Oct 2023)

  Changed paths:
    M llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp

  Log Message:
  -----------
  [ExecutionEngine] Fix the call to DWARFContext::create

Without this patch, we pass G.getEndianness() as one of the parameters
to DWARFContext::create.  The problem is that G.getEndianness() is of:

  enum endianness {big, little, native};

whereas DWARFContext::create is expecting "bool isLittleEndian".  That
is, we are relying on an implicit conversion to convert big and little
to false and true, respectively.

When we migrate llvm::support::endianness to std::endian in future, we
can no longer rely on an implicit conversion because std::endian is
declared with "enum class".  Even if we could, the conversion would
not be guaranteed to work because, for example, libcxx defines:

  enum class endian {
    little = 0xDEAD,
    big = 0xFACE,
    :

where big and little are not boolean values.

This patch fixes the problem by properly converting G.getEndianness()
to a boolean value.


  Commit: a7517e12caab0750d3dfd7c0c6faec9acc7e5a2b
      https://github.com/llvm/llvm-project/commit/a7517e12caab0750d3dfd7c0c6faec9acc7e5a2b
  Author: Kazu Hirata <kazu at google.com>
  Date:   2023-10-01 (Sun, 01 Oct 2023)

  Changed paths:
    M bolt/lib/Core/DebugData.cpp

  Log Message:
  -----------
  [BOLT] Fix the initialization of DWARFDataExtractor

Without this patch, we pass Endian as one of the parameters to the
constructor of DWARFDataExtractor.  The problem is that Endian is of:

  enum endianness {big, little, native};

whereas the constructor is expecting "bool IsLittleEndian".  That is,
we are relying on an implicit conversion to convert big and little to
false and true, respectively.

When we migrate llvm::support::endianness to std::endian in future, we
can no longer rely on an implicit conversion because std::endian is
declared with "enum class".  Even if we could, the conversion would
not be guaranteed to work because, for example, libcxx defines:

  enum class endian {
    little = 0xDEAD,
    big = 0xFACE,
    :

where big and little are not boolean values.

This patch fixes the problem by properly converting Endian to a
boolean value.


Compare: https://github.com/llvm/llvm-project/compare/9580468302a1...a7517e12caab


More information about the All-commits mailing list