[PATCH] D45260: COFF: Layout sections in the same order as link.exe

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 4 11:23:33 PDT 2018


zturner added a comment.

Feel free to let me know if this comment is off topic here, but I was just investigating a similar issue.  I have an object file with this section list:

  0 .text         0000001c 0000000000000000 TEXT
  1 .data         00000000 0000000000000000 DATA
  2 .bss          00000000 0000000000000000 BSS
  3 .xdata        00000008 0000000000000000 DATA
  4 .drectve      00000030 0000000000000000
  5 .debug$S      00000144 0000000000000000 DATA
  6 .debug$T      00000044 0000000000000000 DATA
  7 .pdata        0000000c 0000000000000000 DATA

When I link this with lld, I get this section list:

  0 .pdata        0000000c 0000000140001000 DATA
  1 .text         0000001c 0000000140002000 TEXT
  2 .xdata        00000008 0000000140003000 DATA
  3 .rdata        00000063 0000000140004000 DATA

When I link with link.exe, I get this section list:

  0 .text         0000001c 0000000140001000 TEXT
  1 .rdata        00000134 0000000140002000 DATA
  2 .pdata        0000000c 0000000140003000 DATA

First of all, using link.exe `.pdata` comes before `.text` (or maybe more accurately, it appears in the same order as it does in the object file).

Secondly, we are outputting a `.xdata` section where link.exe is not.

Are these fixes also within the scope of this patch?


https://reviews.llvm.org/D45260





More information about the llvm-commits mailing list