From: Thomas Garnier Subject: [RFC 20/22] x86/relocs: Add option to generate 64-bit relocations Date: Tue, 18 Jul 2017 15:33:31 -0700 Message-ID: <20170718223333.110371-21-thgarnie@google.com> References: <20170718223333.110371-1-thgarnie@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Cc: linux-arch@vger.kernel.org, kvm@vger.kernel.org, linux-pm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org, linux-crypto@vger.kernel.org, kernel-hardening@lists.openwall.com, xen-devel@lists.xenproject.org To: Herbert Xu , "David S . Miller" , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Peter Zijlstra , Josh Poimboeuf , Thomas Garnier , Arnd Bergmann , Matthias Kaehlcke , Boris Ostrovsky , Juergen Gross , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Joerg Roedel , Andy Lutomirski , Borislav Petkov , "Kirill A . Shutemov" , Brian Gerst , Borislav Petkov , Christian Borntraeger , "Rafael J . Wysocki" , Len Brown In-Reply-To: <20170718223333.110371-1-thgarnie@google.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" List-Id: linux-crypto.vger.kernel.org VGhlIHg4NiByZWxvY2F0aW9uIHRvb2wgZ2VuZXJhdGVzIGEgbGlzdCBvZiAzMi1iaXQgc2lnbmVk IGludGVnZXJzLiBUaGVyZQp3YXMgbm8gbmVlZCB0byB1c2UgNjQtYml0IGludGVnZXJzIGJlY2F1 c2UgYWxsIGFkZHJlc3NlcyB3aGVyZSBhYm92ZSB0aGUgMkcKdG9wIG9mIHRoZSBtZW1vcnkuCgpU aGlzIGNoYW5nZSBhZGQgYSBsYXJnZS1yZWxvYyBvcHRpb24gdG8gZ2VuZXJhdGUgNjQtYml0IHVu c2lnbmVkIGludGVnZXJzLgpJdCBjYW4gYmUgdXNlZCB3aGVu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