cosmopolitan/libc/nt/struct
Justine Tunney dd53f31147
Introduce post-linker that converts ELF to PE
If you build a static ELF executable in `ld -q` mode (which leaves rela
sections inside the binary) then you can run it through the elf2pe.com
program afterwards, which will turn it into a PE executable. We have a
new trick for defining WIN32 DLL imports in C without any assembly code.
This also achieves the optimally tiny and perfect PE binary structure.

We need this because it isn't possible to have a GNU ld linker script
generate a PE file where the virtual pointer and the file pointer can
drift apart. This post-linker can do that. One cool benefit is we can
now use a smaller 512-byte alignment in the file, and an even bigger
64kb alignment for the segment virtual addresses, and the executable
ends up being smaller.

Another program introduced by this change is pecheck.com which can do
extensive linting of PE static executables to help explain why Windows
won't load it.
2023-08-09 18:46:06 -07:00
..
acl.h Initial import 2020-06-15 07:18:57 -07:00
afd.h Add epoll and do more release readiness changes 2020-11-28 12:01:51 -08:00
ansistring.h Initial import 2020-06-15 07:18:57 -07:00
byhandlefileinformation.h Initial import 2020-06-15 07:18:57 -07:00
charinfo.h Initial import 2020-06-15 07:18:57 -07:00
clientid.h Initial import 2020-06-15 07:18:57 -07:00
consolecursorinfo.h Initial import 2020-06-15 07:18:57 -07:00
consolescreenbufferinfo.h Initial import 2020-06-15 07:18:57 -07:00
consolescreenbufferinfoex.h Initial import 2020-06-15 07:18:57 -07:00
consoleselectioninfo.h Initial import 2020-06-15 07:18:57 -07:00
context.h Fix XNU / FreeBSD / OpenBSD / RHEL5 / NT bugs 2021-01-25 18:31:17 -08:00
coord.h Initial import 2020-06-15 07:18:57 -07:00
criticalsection.h Add epoll and do more release readiness changes 2020-11-28 12:01:51 -08:00
criticalsectiondebug.h Add epoll and do more release readiness changes 2020-11-28 12:01:51 -08:00
drawtextparams.h Get fork() working on Windows 2020-11-13 03:14:39 -08:00
editmenu.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
exceptionframe.h Initial import 2020-06-15 07:18:57 -07:00
fdset.h Make fixes and improvements 2022-06-25 21:09:09 -07:00
fileaccessinformation.h Initial import 2020-06-15 07:18:57 -07:00
filealignmentinformation.h Initial import 2020-06-15 07:18:57 -07:00
fileallinformation.h Initial import 2020-06-15 07:18:57 -07:00
fileallocationinformation.h Initial import 2020-06-15 07:18:57 -07:00
fileattributetaginformation.h Initial import 2020-06-15 07:18:57 -07:00
filebasicinfo.h Initial import 2020-06-15 07:18:57 -07:00
filebasicinformation.h Initial import 2020-06-15 07:18:57 -07:00
filebothdirectoryinformation.h Initial import 2020-06-15 07:18:57 -07:00
filecompressioninfo.h Initial import 2020-06-15 07:18:57 -07:00
filedirectoryinformation.h Initial import 2020-06-15 07:18:57 -07:00
filedispositioninformation.h Initial import 2020-06-15 07:18:57 -07:00
fileeainformation.h Initial import 2020-06-15 07:18:57 -07:00
fileendoffileinformation.h Initial import 2020-06-15 07:18:57 -07:00
filefsfullsizeinformation.h Polyfill statfs() and fstatfs() on Windows 2022-08-17 19:01:51 -07:00
filefulldirectoryinformation.h Initial import 2020-06-15 07:18:57 -07:00
filefulleainformation.h Initial import 2020-06-15 07:18:57 -07:00
fileinternalinformation.h Initial import 2020-06-15 07:18:57 -07:00
filemailslotqueryinformation.h Initial import 2020-06-15 07:18:57 -07:00
filemailslotsetinformation.h Initial import 2020-06-15 07:18:57 -07:00
filemodeinformation.h Initial import 2020-06-15 07:18:57 -07:00
filenameinformation.h Initial import 2020-06-15 07:18:57 -07:00
filenamesinformation.h Initial import 2020-06-15 07:18:57 -07:00
filenetworkopeninformation.h Initial import 2020-06-15 07:18:57 -07:00
filepipelocalinformation.h Initial import 2020-06-15 07:18:57 -07:00
filepositioninformation.h Initial import 2020-06-15 07:18:57 -07:00
filerenameinformation.h Initial import 2020-06-15 07:18:57 -07:00
filesegmentelement.h Initial import 2020-06-15 07:18:57 -07:00
filestandardinformation.h Initial import 2020-06-15 07:18:57 -07:00
filestreaminformation.h Initial import 2020-06-15 07:18:57 -07:00
filetime.h Initial import 2020-06-15 07:18:57 -07:00
filezerodatainformation.h Initial import 2020-06-15 07:18:57 -07:00
fpodata.h Initial import 2020-06-15 07:18:57 -07:00
genericmapping.h Initial import 2020-06-15 07:18:57 -07:00
guid.h Make terminal ui binaries work well everywhere 2020-10-19 06:38:31 -07:00
imagearchivememberheader.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageauxsymbol.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageauxsymbolex.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageauxsymboltokendef.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagebaserelocation.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageboundforwarderref.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageboundimportdescriptor.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageceruntimefunctionentry.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagecoffsymbolsheader.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagedatadirectory.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagedebugdirectory.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagedebugmisc.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagedelayloaddescriptor.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagedosheader.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagedynamicrelocation.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagedynamicrelocationtable.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagedynamicrelocationv2.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageenclaveconfig.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageenclaveimport.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageepiloguedynamicrelocationheader.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageexportdirectory.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagefileheader.internal.h Introduce post-linker that converts ELF to PE 2023-08-09 18:46:06 -07:00
imagehotpatchbase.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagehotpatchhashes.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagehotpatchinfo.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageimportbyname.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageimportdescriptor.internal.h Tune the page sizes 2023-07-24 00:49:06 -07:00
imagelinenumber.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageloadconfigcodeintegrity.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageloadconfigdirectory.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagentheaders.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageoptionalheader.internal.h Introduce post-linker that converts ELF to PE 2023-08-09 18:46:06 -07:00
imageprologuedynamicrelocationheader.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagerelocation.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageresourcedataentry.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageresourcedirectory.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageresourcedirectoryentry.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageresourcedirstring.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageromoptionalheader.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imageruntimefunctionentry.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagesectionheader.internal.h Better document PE headers 2023-08-09 00:29:01 -07:00
imageseparatedebugheader.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagesymbol.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagesymbolex.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagethunkdata.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
imagetlsdirectory.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
importobjectheader.internal.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
inputrecord.h Initial import 2020-06-15 07:18:57 -07:00
iocounters.h Initial import 2020-06-15 07:18:57 -07:00
iostatusblock.h Initial import 2020-06-15 07:18:57 -07:00
iovec.h Reduce build graph by another eight percent 2022-08-13 13:11:56 -07:00
ipadapteraddresses.h Add test for ioctl(SIOCGIFCONF) and polyfill on BSDs 2021-06-25 18:44:04 -07:00
kernelusertimes.h Initial import 2020-06-15 07:18:57 -07:00
ldr.h Initial import 2020-06-15 07:18:57 -07:00
ldrdatatableentry.h Initial import 2020-06-15 07:18:57 -07:00
linger.h Improve redbean 2022-04-25 08:30:14 -07:00
linkedlist.h Initial import 2020-06-15 07:18:57 -07:00
luid.h Initial import 2020-06-15 07:18:57 -07:00
luidandattributes.h Initial import 2020-06-15 07:18:57 -07:00
memorybasicinformation.h Initial import 2020-06-15 07:18:57 -07:00
memoryrangeentry.h Initial import 2020-06-15 07:18:57 -07:00
memorystatusex.h Initial import 2020-06-15 07:18:57 -07:00
msg.h Clean up more code 2023-06-18 01:00:05 -07:00
nonpageddebuginfo.h Initial import 2020-06-15 07:18:57 -07:00
ntexceptionpointers.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
ntexceptionrecord.h Initial import 2020-06-15 07:18:57 -07:00
objectallinformation.h Initial import 2020-06-15 07:18:57 -07:00
objectattributes.h Add epoll and do more release readiness changes 2020-11-28 12:01:51 -08:00
objectbasicinformation.h Initial import 2020-06-15 07:18:57 -07:00
objectnameinformation.h Initial import 2020-06-15 07:18:57 -07:00
objecttypeinformation.h Initial import 2020-06-15 07:18:57 -07:00
openfilename.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
osversioninfo.h Make numerous improvements 2021-09-28 01:52:34 -07:00
overlapped.h Initial import 2020-06-15 07:18:57 -07:00
overlappedentry.h Make terminal ui binaries work well everywhere 2020-10-19 06:38:31 -07:00
paintstruct.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
pdhfmtcountervalue.h Fix some win32 definitions 2022-03-22 19:54:36 -07:00
peb.h Initial import 2020-06-15 07:18:57 -07:00
point.h Initial import 2020-06-15 07:18:57 -07:00
pollfd.h Remove dollars from system call support symbols 2021-02-03 19:35:29 -08:00
privilegeset.h Initial import 2020-06-15 07:18:57 -07:00
processbasicinformation.h Initial import 2020-06-15 07:18:57 -07:00
processentry32.h Make fixes and improvements 2022-05-19 16:57:49 -07:00
processinformation.h Initial import 2020-06-15 07:18:57 -07:00
processmemorycounters.h Fix some win32 definitions 2022-03-22 19:54:36 -07:00
procthreadattributelist.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
rect.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
reparsedatabuffer.h Improve Libc by making Python work even better 2021-08-18 22:16:23 -07:00
rtluserprocessinformation.h Initial import 2020-06-15 07:18:57 -07:00
rtluserprocessparameters.h Add epoll and do more release readiness changes 2020-11-28 12:01:51 -08:00
sectionimageinformation.h Initial import 2020-06-15 07:18:57 -07:00
securityattributes.h Fix a bunch of Windows bugs reported on Discord 2023-07-28 06:17:34 -07:00
securitydescriptor.h Add epoll and do more release readiness changes 2020-11-28 12:01:51 -08:00
size.h Get fork() working on Windows 2020-11-13 03:14:39 -08:00
smallrect.h Initial import 2020-06-15 07:18:57 -07:00
startupinfo.h Initial import 2020-06-15 07:18:57 -07:00
startupinfoex.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
systembasicinformation.h Initial import 2020-06-15 07:18:57 -07:00
systemexceptioninformation.h Initial import 2020-06-15 07:18:57 -07:00
systemhandleentry.h Initial import 2020-06-15 07:18:57 -07:00
systemhandleinformation.h Initial import 2020-06-15 07:18:57 -07:00
systeminfo.h Initial import 2020-06-15 07:18:57 -07:00
systeminterruptinformation.h Initial import 2020-06-15 07:18:57 -07:00
systemlookasideinformation.h Initial import 2020-06-15 07:18:57 -07:00
systemperformanceinformation.h Initial import 2020-06-15 07:18:57 -07:00
systemprocessinformation.h Initial import 2020-06-15 07:18:57 -07:00
systemprocessorinformation.h Initial import 2020-06-15 07:18:57 -07:00
systemprocessorperformanceinformation.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
systemregistryquotainformation.h Initial import 2020-06-15 07:18:57 -07:00
systemthreads.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
systemtime.h Initial import 2020-06-15 07:18:57 -07:00
systemtimeofdayinformation.h Initial import 2020-06-15 07:18:57 -07:00
teb.h Mint APE Loader v1.5 2023-07-26 13:54:49 -07:00
timeval.h Make fixes and improvements 2022-06-25 21:09:09 -07:00
tokenprivileges.h Initial import 2020-06-15 07:18:57 -07:00
unicodestring.h Initial import 2020-06-15 07:18:57 -07:00
userstack.h Initial import 2020-06-15 07:18:57 -07:00
valent.h Initial import 2020-06-15 07:18:57 -07:00
vmcounters.h Initial import 2020-06-15 07:18:57 -07:00
win32fileattributedata.h Initial import 2020-06-15 07:18:57 -07:00
win32finddata.h Make improvements 2020-09-14 00:02:34 -07:00
windowplacement.h Get Cosmopolitan into releasable state 2020-11-25 08:19:00 -08:00
wndclass.h Get fork() working on Windows 2020-11-13 03:14:39 -08:00
wndclassex.h Get fork() working on Windows 2020-11-13 03:14:39 -08:00