Skip to content

Conversation

@jalopezg-git
Copy link

Some data members are only part of a class definition in a Debug build, e.g. LVObject::ID. If debuginfologicalview is used as a library, NDEBUG cannot be used for this purpose, as this PP macro may have a different definition in a downstream project, which in turn triggers an ODR violation.

  • For LVObject::ID, temporarily went for #if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS (instead of plain #ifndef NDEBUG). This should fix the original issue.
  • The LVObject::dump() function is virtual, and hence appears in the vtable for class LVObject. Thus, it participates also in class layout and is subject to the same issue. Fixed it by making LVObject::dump() non-virtual.
    Rationale: virtual is not needed (and it calls print(), which is virtual anyway).

This is a backport of upstream PR llvm#140265.

Fixes llvm#139098.

`LVObject::dump()` does not need to be virtual as it relays to
`LVObject::print()` that is.
…LVObject

Fix ODR violation in `LVObject` when `DebugInfoLogicalView` library
is used in a downstream project.

Depending solely on `NDEBUG` for exposing some data members may cause
trouble in downstream projects.
Enable such cases only if `LLVM_ENABLE_ABI_BREAKING_CHECKS`.
@jalopezg-git jalopezg-git self-assigned this Jun 9, 2025
@jalopezg-git jalopezg-git added the bug Something isn't working label Jun 9, 2025
Copy link

@peledins-zimperium peledins-zimperium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you recompile llvm libraries, you could also add arm64 compilation - both asan and not or maybe just the plain one.

@jalopezg-git jalopezg-git merged commit e8ee4f1 into Zimperium:zmpr-b-llvmorg-20.1.5-patches Jun 10, 2025
7 checks passed
@jalopezg-git jalopezg-git deleted the jalopezg-backport140265-llvmorg-20.1.5 branch June 10, 2025 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants