OSDN Git Service

[MC] Always emit relocations for same-section function references
authorReid Kleckner <rnk@google.com>
Wed, 14 Mar 2018 19:24:32 +0000 (19:24 +0000)
committerReid Kleckner <rnk@google.com>
Wed, 14 Mar 2018 19:24:32 +0000 (19:24 +0000)
commit9232972575cafac29c3e4817c8714c9aca0e8585
tree3330f84f2d5f4b119e7cebb77650cd9e429626f1
parent0f6b1bf2e5eb4d890c5c6c1767eaa32a36056003
[MC] Always emit relocations for same-section function references

Summary:
We already emit relocations in this case when the "incremental linker
compatible" flag is set, but it turns out these relocations are also
required for /guard:cf. Now that we have two use cases for this
behavior, let's make it unconditional to try to keep things simple.

We never hit this problem in Clang because it always sets the
"incremental linker compatible" flag when targeting MSVC. However, LLD
LTO doesn't set this flag, so we'd get CFG failures at runtime when
using ThinLTO and /guard:cf. We probably don't want LLD LTO to set the
"incremental linker compatible" assembler flag, since this has nothing
to do with incremental linking, and we don't need to timestamp LTO
temporary objects.

Fixes PR36624.

Reviewers: inglorion, espindola, majnemer

Subscribers: mehdi_amini, llvm-commits, hiraditya

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327557 91177308-0d34-0410-b5e6-96231b3b80d8
lib/MC/WinCOFFObjectWriter.cpp
test/MC/COFF/diff.s