This is an archive of the discontinued LLVM Phabricator instance.

Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatch
ClosedPublic

Authored by mehdi_amini on Nov 18 2016, 12:43 AM.

Details

Summary

LLVM will define a symbol, either EnableABIBreakingChecks or
DisableABIBreakingChecks depending on the configuration setting for
LLVM_ABI_BREAKING_CHECKS.

The llvm-config.h header will add weak references to these symbols in
every clients that includes this header. This should ensure that
a mismatch triggers a link failure (or a load time failure for DSO).

On MSVC, the pragma "detect_mismatch" is used instead.

Event Timeline

mehdi_amini retitled this revision from to Add link-time detection of LLVM_ABI_BREAKING_CHECKS mismatch.
mehdi_amini updated this object.
mehdi_amini added reviewers: rnk, jroelofs.
mehdi_amini added a subscriber: llvm-commits.

Note: I haven't tested the MSVC pragma path, this is just based on the doc.

Mark the uses of the symbols with hidden visibility

jroelofs added inline comments.Nov 18 2016, 6:56 AM
llvm/include/llvm/Config/llvm-config.h.cmake
99

My notes had a typo: s/VDisable/Disable/

jroelofs edited edge metadata.Nov 18 2016, 7:13 AM

The non-msvc side of this otherwise LGTM, btw.

mehdi_amini edited edge metadata.

Fix typo

Thanks!
I'll wait for @rnk for the Windows side.

llvm/include/llvm/Config/llvm-config.h.cmake
99

Yeah I noticed when testing, but apparently I git stash and failed to amend the commit before running arc diff

rnk accepted this revision.Nov 18 2016, 9:35 AM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.Nov 18 2016, 9:35 AM
This revision was automatically updated to reflect the committed changes.