From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726945AbgFQVGY (ORCPT ); Wed, 17 Jun 2020 17:06:24 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 829B7C061755 for ; Wed, 17 Jun 2020 14:06:24 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id e82so4039598ybh.12 for ; Wed, 17 Jun 2020 14:06:24 -0700 (PDT) Date: Wed, 17 Jun 2020 14:06:13 -0700 Message-ID: <20200617210613.95432-1-ndesaulniers@google.com> Mime-Version: 1.0 Subject: [PATCH] vmlinux.lds: consider .text.{hot|unlikely}.* part of .text too From: Nick Desaulniers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-arch-owner@vger.kernel.org List-ID: To: Arnd Bergmann Cc: clang-built-linux@googlegroups.com, Kees Cook , Nick Desaulniers , stable@vger.kernel.org, Jian Cai , Luis Lozano , =?UTF-8?q?F=C4=81ng-ru=C3=AC=20S=C3=B2ng?= , Manoj Gupta , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <20200617210613.UDhXIzD0HPAA_ThDDQFi77PF2hnkc7jkaPMLYCMqY2M@z> ld.bfd's internal linker script considers .text.hot AND .text.hot.* to be part of .text, as well as .text.unlikely and .text.unlikely.*. ld.lld will produce .text.hot.*/.text.unlikely.* sections. Make sure to group these together. Otherwise these orphan sections may be placed outside of the the _stext/_etext boundaries. Cc: stable@vger.kernel.org Link: https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommitdiff;h=3Da= dd44f8d5c5c05e08b11e033127a744d61c26aee Link: https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommitdiff;h=3D1= de778ed23ce7492c523d5850c6c6dbb34152655 Link: https://reviews.llvm.org/D79600 Reported-by: Jian Cai Debugged-by: Luis Lozano Suggested-by: F=C4=81ng-ru=C3=AC S=C3=B2ng Tested-by: Luis Lozano Tested-by: Manoj Gupta Signed-off-by: Nick Desaulniers --- include/asm-generic/vmlinux.lds.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index d7c7c7f36c4a..fe5aaef169e3 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -560,7 +560,9 @@ */ #define TEXT_TEXT \ ALIGN_FUNCTION(); \ - *(.text.hot TEXT_MAIN .text.fixup .text.unlikely) \ + *(.text.hot .text.hot.*) \ + *(TEXT_MAIN .text.fixup) \ + *(.text.unlikely .text.unlikely.*) \ NOINSTR_TEXT \ *(.text..refcount) \ *(.ref.text) \ --=20 2.27.0.290.gba653c62da-goog