<div dir="ltr">Hi,<div><br></div><div>It seems that there are assumptions about the ability to create relative address across sections which doesn't seem possible on Windows ARM.</div><div><br></div><div>Consider the following swift code:</div><div><br></div><div>final class _ContiguousArrayStorage<Element> { }</div><div><br></div><div>When compiled for Windows x86 (via swiftc -c -target i686-windows -parse-as-library -parse-stdlib -module-name Swift -o Swift.obj reduced.swift) it will generate the metadata pattern as:</div><div><br></div><div> __TMPCs23_ContiguousArrayStorage:</div><div> ...</div><div> .long __TMnCs23_ContiguousArrayStorage-(__MPCs23_ContiguousArrayStorage+128)</div><div> ...</div><div><br></div><div>This generates a IMAGE_REL_I386_REL32 relocation which is the 32-bit relative displacement of the target.</div><div><br></div><div>On Windows ARM (swiftc -c -target i686-windows -parse-pas-library -parse-stdlib -module-name Swift -o Swift.obj reduced.swift) it will generate similar assembly:</div><div><br></div><div><div> _TMPCs23_ContiguousArrayStorage:</div><div> ...</div><div> .long _TMnCs23_ContiguousArrayStorage-(_MPCs23_ContiguousArrayStorage+128)</div><div> ...</div></div><div><div><br></div><div>However, this generates an IMAGE_REL_ARM_ADDR32 relocation which is the 32-bit VA of the target. If the symbol are in the same section, it is possible to get a relative value. However, I don't really see a way to generate a relative offset across sections. There is no relocation in the COFF ARM specification which provides the 32-bit relative displacement of the target. There are 20, 23, and 24 bit relative displacements designed specifically for branch instructions, but none that would operate on generic data.</div><div><br></div><div>Is there a good way to address this ABI issue? Or perhaps do we need something more invasive to support such targets? Now, I might be completely overlooking something simple that I didn't consider, so pointing that out would be greatly appreciated as well.</div><div><br></div>-- <br><div class="gmail_signature">Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org</div>
</div></div>