This is an archive of the discontinued LLVM Phabricator instance.

Don't try to emit size information for unsized types
ClosedPublic

Authored by who8877 on Nov 1 2017, 4:24 PM.

Details

Summary

This is to fix bug 35164.

The following program shows the issue:

struct ASTRUCT;
extern struct ASTRUCT g_struct;

int main()
{

return &g_struct;

}

In this program there is no size information associated with the ASTRUCT type, yet the code unconditionally tries to emit sizes for globals causing an assert. This change respects this scenario. I've tested and linked a simple test file.

Note however I'm very new to this code so a cautious eye in reviewing this would be appreciated.

Diff Detail

Repository
rL LLVM

Event Timeline

who8877 created this revision.Nov 1 2017, 4:24 PM
who8877 updated this revision to Diff 121210.Nov 1 2017, 4:37 PM
who8877 set the repository for this revision to rL LLVM.

Full path of file name

sunfish accepted this revision.Nov 29 2017, 9:28 AM

I don't think we actually need the ELFSize for externally-defined symbols, but it at least does make sense to omit it if we don't know the size.

This revision is now accepted and ready to land.Nov 29 2017, 9:28 AM
This revision was automatically updated to reflect the committed changes.