From: Thomas Garnier Subject: [PATCH v3 26/27] x86/relocs: Add option to generate 64-bit relocations Date: Wed, 23 May 2018 12:54:20 -0700 Message-ID: <20180523195421.180248-27-thgarnie@google.com> References: <20180523195421.180248-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-doc@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.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 , Greg Kroah-Hartman , Thomas Garnier , Philippe Ombredanne , Kate Stewart , Arnaldo Carvalho de Melo , Yonghong Song , Andrey Ryabinin , Kees Cook , Tom Lendacky , "Kirill A . Shutemov" , Andy Lutomirski , Dominik Brodowski , Borislav Petkov , Borislav Petkov , "Rafael J . Wysocki" , Len Return-path: In-Reply-To: <20180523195421.180248-1-thgarnie@google.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" List-Id: linux-crypto.vger.kernel.org VGhlIHg4NiByZWxvY2F0aW9uIHRvb2wgZ2VuZXJhdGVzIGEgbGlzdCBvZiAzMi1iaXQgc2lnbmVk IGludGVnZXJzLiBUaGVyZQp3YXMgbm8gbmVlZCB0byB1c2UgNjQtYml0IGludGVnZXJzIGJlY2F1 c2UgYWxsIGFkZHJlc3NlcyB3aGVyZSBhYm92ZSB0aGUgMkcKdG9wIG9mIHRoZSBtZW1vcnkuCgpU aGlzIGNoYW5nZSBhZGQgYSBsYXJnZS1yZWxvYyBvcHRpb24gdG8gZ2VuZXJhdGUgNjQtYml0IHVu c2lnbmVkIGludGVnZXJzLgpJdCBjYW4gYmUg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