[PATCH] D44018: [COFF] Make the DOS stub a real DOS program

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 5 03:01:09 PST 2018


hans added inline comments.


================
Comment at: COFF/Writer.cpp:64
+*/
+static unsigned char DOSProgram[] = {
+  0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd, 0x21, 0xb8, 0x01, 0x4c,
----------------
ruiu wrote:
> Maybe it's easier to make it always 64-byte long and use sizeof(DOSProgram) instead of alignTo()
> 
>   static unsigned char DOSProgram[64] = { ... };
> 
> 
That seems wasteful since the program doesn't need 64 bytes (and it seems fragile in case it would ever change and require more than 64 bytes).

A better idea I think would be to put an

```
align   8, db 0
```

directive in the asm above to pad the program itself to a multiple of 8. That way we're not wasting bytes, it won't break if someone changes the program, and it simplifies the lld code a little. What do you think?


https://reviews.llvm.org/D44018





More information about the llvm-commits mailing list