This is an archive of the discontinued LLVM Phabricator instance.

[sancov] Put .SCOV* sections into the right comdat groups on COFF
ClosedPublic

Authored by rnk on Nov 7 2018, 2:41 PM.

Details

Summary

Avoids linker errors about relocations against discarded sections.

This was uncovered during the clang roll here:
https://chromium-review.googlesource.com/c/chromium/src/+/1321863#message-717516acfcf829176f6a2f50980f7a4bdd66469a

After this change, libGLESv2 links successfully for me.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.Nov 7 2018, 2:41 PM
morehouse added inline comments.Nov 7 2018, 4:06 PM
llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
82 ↗(On Diff #173037)

Does COFF not have comdat naming collisions for local symbols like ELF does?

rnk added inline comments.Nov 7 2018, 4:16 PM
llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
82 ↗(On Diff #173037)

The model is pretty different. On COFF, the comdat group has to have a "leader" symbol. All non-leader symbols in the group are included in the final link only if the leader from their object file prevails.

Actually, adding this unique suffix breaks the LLVM IR verifier, since there is a verifier rule that says that the name of a comdat must match some symbol and that symbol must be in the comdat group. Perhaps the comment should explain that.

rnk updated this revision to Diff 173081.Nov 7 2018, 4:29 PM
  • Elaborate on comdats in a comment
This revision is now accepted and ready to land.Nov 7 2018, 4:41 PM
This revision was automatically updated to reflect the committed changes.