Page MenuHomePhabricator

[LLD] [COFF] Error out if creating a DLL with too many exported symbols
ClosedPublic

Authored by mstorsjo on Aug 27 2020, 5:00 AM.

Details

Summary

The PE/DLL format has a limit on 64k exported symbols per DLL; make sure to check this.

Diff Detail

Event Timeline

mstorsjo created this revision.Aug 27 2020, 5:00 AM
Herald added a project: Restricted Project. · View Herald Transcript
mstorsjo requested review of this revision.Aug 27 2020, 5:00 AM

The change looks fine.

For testing, I like the idea of one function exported with 64K names. What about an object file that has just one function, and a module-definition file (.DEF file) that exports 64K aliases of it at link time? The .DEF file would be about as large as your generated .c file is now, but the object file would be tiny.

I'd have no concerns about generating the test inputs on demand--that's done quite a bit for the debugger tests--but lld is not my baby.

mstorsjo updated this revision to Diff 288868.Aug 30 2020, 1:19 PM
mstorsjo edited the summary of this revision. (Show Details)

Added a testcase with a tiny python script that generates def files that export the same symbol a number of times. It generates two 566 KB def files, for testing the case below and above the limit. The successful link case produces a 1 MB DLL and a 8 MB import library.

amccarth accepted this revision.Aug 31 2020, 8:57 AM

I like it.

This revision is now accepted and ready to land.Aug 31 2020, 8:57 AM