This is an archive of the discontinued LLVM Phabricator instance.

CodeGen: Assign an appropriate comdat to thunks.
ClosedPublic

Authored by pcc on Jun 29 2015, 8:32 PM.

Details

Summary

Previously we were not assigning a comdat to thunks in the Microsoft
ABI, which
would have required us to emit these functions outside of a comdat.
(Due to an inconsistency in how we were emitting objects, we
were getting this right most of the time, but only when compiling
without function sections.) This code generator change causes
us to create a comdat for each thunk.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc updated this revision to Diff 28746.Jun 29 2015, 8:32 PM
pcc retitled this revision from to CodeGen: Assign an appropriate comdat to thunks..
pcc updated this object.
pcc edited the test plan for this revision. (Show Details)
pcc added a reviewer: majnemer.
pcc added a subscriber: Unknown Object (MLST).
majnemer edited edge metadata.Jun 30 2015, 1:48 AM

Can't this be fixed by moving the call of CGM.getCXXABI().setThunkLinkage in CodeGenVTables::emitThunk to CodeGenFunction::GenerateThunk right after the call to CGM.setFunctionLinkage?

pcc added a comment.Jun 30 2015, 11:41 AM

Would that do the right thing with varargs thunks?

It seems that moving the call to setComdat to emitThunk would do the right thing.

pcc updated this revision to Diff 28804.Jun 30 2015, 11:42 AM
pcc edited edge metadata.

New implementation

majnemer accepted this revision.Jun 30 2015, 11:51 AM
majnemer edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jun 30 2015, 11:51 AM
This revision was automatically updated to reflect the committed changes.