This is an archive of the discontinued LLVM Phabricator instance.

[asan] Fix a false positive ODR violation due to LTO ConstantMerge pass
ClosedPublic

Authored by kubamracek on Mar 1 2018, 10:27 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek created this revision.Mar 1 2018, 10:27 AM
steven_wu accepted this revision.Mar 1 2018, 10:54 AM

LGTM.

The idea is to prevent LTO (ConstMerge pass) from merging global constants that has the same value, which has the same side-effect as linker merging two weak symbols that has ODR violation.

To be extra safe, there are some linkers that are capable of dedup functions and globals. Maybe a separate investigation to see if there is any linker dedup optimization can break this? Currently, ld64 doesn't dedup none weak symbols so it should be fine for now. Maybe check if lld does that?

This revision is now accepted and ready to land.Mar 1 2018, 10:54 AM

Thanks, yes, AFAIK, ld64 is fine and I don't really know how to test lld on Darwin (is it even supposed to work?).

Thanks, yes, AFAIK, ld64 is fine and I don't really know how to test lld on Darwin (is it even supposed to work?).

no, lld is not working yet.

This revision was automatically updated to reflect the committed changes.
kubamracek reopened this revision.Mar 8 2018, 10:45 AM
This revision is now accepted and ready to land.Mar 8 2018, 10:45 AM
This revision was automatically updated to reflect the committed changes.