Commit Graph

12 Commits

Author SHA1 Message Date
Martin Storsjo cc80776eff [COFF] Implement the remaining ARM64 relocations
Now only IMAGE_REL_ARM64_ABSOLUTE and IMAGE_REL_ARM64_TOKEN
are unhandled.

Also add range checks for the existing BRANCH26 relocation.

Differential Revision: https://reviews.llvm.org/D46354

llvm-svn: 331505
2018-05-04 06:06:27 +00:00
Peter Collingbourne 66f1c9a858 Reland r330223, "COFF: Merge .idata, .didat and .edata into .rdata by default.", which was reverted in r330228.
In this reland I removed an unnecessary use of /debug in the test
delayimports32.test and used the /pdbaltpath flag in the test
pdb-publics-import.test, both of which avoid embedding absolute PDB
paths in executables which could affect later RVAs.

Original commit message:
> COFF: Merge .idata, .didat and .edata into .rdata by default.
>
> This saves a little space and matches what link.exe does.
>
> Tested using the chromium Windows trybots:
> https://chromium-review.googlesource.com/c/chromium/src/+/1014784

Differential Revision: https://reviews.llvm.org/D45737

llvm-svn: 330233
2018-04-17 23:28:52 +00:00
Peter Collingbourne 1254f3e77c Revert r330223, "COFF: Merge .idata, .didat and .edata into .rdata by default."
Seems to have uncovered some sort of non-determinism on the bots.

llvm-svn: 330228
2018-04-17 22:16:39 +00:00
Peter Collingbourne 09e0e2e656 COFF: Merge .idata, .didat and .edata into .rdata by default.
This saves a little space and matches what link.exe does.

Tested using the chromium Windows trybots:
https://chromium-review.googlesource.com/c/chromium/src/+/1014784

Differential Revision: https://reviews.llvm.org/D45737

llvm-svn: 330223
2018-04-17 21:44:31 +00:00
Hans Wennborg 9a9fc78744 COFF: Layout sections in the same order as link.exe
One place where this seems to matter is to make sure the .rsrc section comes
after .text. The Win32 UpdateResource() function can change the contents of
.rsrc. It will move the sections that come after, but if .text gets moved, the
entry point header will not get updated and the executable breaks. This was
found by a test in Chromium.

Differential Revision: https://reviews.llvm.org/D45260

llvm-svn: 329221
2018-04-04 19:15:55 +00:00
Martin Storsjo ef4f78bbf2 [COFF] Add support for ARM64 secrel relocations for add/load instructions
Differential Revision: https://reviews.llvm.org/D43287

llvm-svn: 325396
2018-02-16 22:02:38 +00:00
Martin Storsjo bfe2fed2c4 [COFF] Add support for IMAGE_REL_ARM64_SECREL
I never ran into this until lld-link started enabling debug output
by default for the mingw mode. I haven't been able to verify that
this actually behaves correctly, but this relocation is handled
identically on all other architectures so far.

Differential Revision: https://reviews.llvm.org/D39754

llvm-svn: 317669
2017-11-08 07:31:50 +00:00
Martin Storsjo e2e8e08ec3 Update tests for ARMNT/ARM64 reloc names
After ObjectYAML learnt the proper enum names for ARMNT/ARM64
relocations, it no longer accepts the numerical values.

This fixes LLD tests after SVN r317459 in LLVM.

llvm-svn: 317460
2017-11-06 07:22:17 +00:00
Martin Storsjo ea460a2d0c [COFF] Implement support for IMAGE_REL_ARM64_ADDR32NB
This is implemented in the same way as the other ADDR32NB relocations
for ARM and X64.

Differential Revision: https://reviews.llvm.org/D38815

llvm-svn: 315561
2017-10-12 05:37:06 +00:00
Martin Storsjo 38608c0975 [COFF, ARM64] Handle ADRP immediate offsets in relocations
Also handle overflow correctly in LDR/STR relocations. Even if the
offset range of a 8 byte LDR instruction is 15 bit (even if the immediate
itself is 12 bit) due to a 3 bit shift, only include up to 12 bits of offset
after doing the relocation, by limiting the range of the immediate by the
number of shifted bits.

Differential Revision: https://reviews.llvm.org/D35792

llvm-svn: 309175
2017-07-26 20:51:47 +00:00
Martin Storsjo 5ae7649a4e [COFF] Support 128 bit SIMD/FP ldr/str in IMAGE_REL_ARM64_PAGEOFFSET_12L
Also extend the tests for IMAGE_REL_ARM64_PAGEOFFSET_12L to test
all 8/16/32/64 bit GPR and 8/16/32/64/128 SIMD/FP bit ldr/str variants,
and a ldr with an existing offset.

Differential revision: https://reviews.llvm.org/D35647

llvm-svn: 308631
2017-07-20 16:48:33 +00:00
Martin Storsjo 2779165d8c [COFF] Add initial support for some ARM64 relocations and import thunks
This is enough to link a working hello world executable, with
a call to an imported function, a string constant passed to
the imported function, and loads from a global variable.

Differential Revision: https://reviews.llvm.org/D34964

llvm-svn: 307629
2017-07-11 07:22:44 +00:00