<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/134546>134546</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [LLD] PE delayload compatibility with IMAGE_GUARD_DELAYLOAD_IAT_IN_ITS_OWN_SECTION
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lld
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jeremyd2019
      </td>
    </tr>
</table>

<pre>
    In https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#the-load-configuration-structure-image-only, the `IMAGE_GUARD_DELAYLOAD_IAT_IN_ITS_OWN_SECTION` flag is described as "Delayload import table in its own .didat section (with nothing else in it) that can be freely reprotected."

I am preparing a patch to binutils to put the delay IAT in its own (read/write) `.didat` output section.  I would then like to prepare a pull request to LLD to do the same.  However, I see that LLD is currently using `.didat` input section for [the  delay load directory table](https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#the-delay-load-directory-table) instead.  Is this something that's done for compatibility with MS link.exe and cannot be changed, or would it be acceptable to move that into `.rdata` to put only the delay IAT in `.didat` ?

@mstorsjo @lhmouse 
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0lE9v4zYQxT8NfRlIkKk_sQ86eFfxVoA3KZoURU8GJY4lZilSJYdx_e0LykK7QXvpYU8iQGrmvTc_UnivBoNYs_ITK5uNCDRaV7-hw-kmebbdbzorb3VrYCSaPcsPjB8ZP2oUzqST6p319kJpbyfGj2iS4Bk_XpWR9rqucs74UWIXBsaPMyYX6yZBjOc0YqKtkElvzUUNwQlS1iSeXOgpOEzUJAZMrNE3xj8DjQisytqvhy-P5y-_Hn5pzs3j6fD76fnQnNvD67l9OrevL-fn357OL4-fX9vnJ1ZlcNFiAOVBou-d6lCC8MA4b1CLW2wPapqtIyDRaQRlQJEHezWQSiUFgcc-6gLGd1dFIxhL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