This is an archive of the discontinued LLVM Phabricator instance.

COFF: Move .rsrc to the end of the list of non-discardable sections.
AbandonedPublic

Authored by pcc on Apr 4 2018, 10:54 AM.

Details

Summary

The Win32 UpdateResource function can change the contents of .rsrc. It
will move the sections that come after, but if any of those sections
contain references to sections before .rsrc or vice versa (such as
call or PC-relative lea instructions), or if references to those
sections appear in the PE header (such as the entry point), those
references will break. This was found by a test in Chromium.