From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8901FC433F5 for ; Thu, 26 May 2022 18:54:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345559AbiEZSyN (ORCPT ); Thu, 26 May 2022 14:54:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231255AbiEZSyL (ORCPT ); Thu, 26 May 2022 14:54:11 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F49BC5DBD for ; Thu, 26 May 2022 11:54:10 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id 184-20020a6306c1000000b003f5f304ec78so1174614pgg.20 for ; Thu, 26 May 2022 11:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=JMJVGg1qZnHH7C8ATRhIwxxHuj2y9HrWKG9Y6P+CVa4=; b=X5QPBT3rcKnwfVEC/ZgYYSC6s8s4hl/iM07SHcdQvxHX45jXMkjkR98a8tHk1s7i5i hljpwk+zr49ln6Bl0myvnXkNbU6M4CQRGem0QlWNioGpY50exkY88Nc0Apae4xthVSQR 6MPnaB64Oh1y40FPM2rQ67fKHreHbBRsrQpolC3b5t0SUpG8psfDw5rL6EuTo6QvFEsk pqJWwDC5nMfeXGHP7Yp9zVScxEy42RXSy8T8hend0JQlo9eTB/K55klwydC8EfiAT8Ow Gt+e7E1RE2ynwxJhN+IiRfttkfXCOj2DTeFCcOdejadGU7QPWJ2uPrIKTEdIbNY5XfGa Nnpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=JMJVGg1qZnHH7C8ATRhIwxxHuj2y9HrWKG9Y6P+CVa4=; b=h6fy9tMm2Lb3/vbtR4VwQ2dFnPrjcLoDynLkW64M8Ptk2rbi3Ik8Uaji0JPFf4hdfN DSKS4Ke5tcKjvbw9gxEaHbiGeKztF9GX8c531zPaq5fRbQq1vfi9M5nznpazUZC64lXk PEm/4shiodACKQ6+F5SK+u27HB0ndvOgCI5jZATA6nEVICikpz+QhsUoICeVz21cSs/H Fjq/+cXiP7ObLnKruo5RJDDac0Mmb8E6fO6syKysscLqW79llllM71HR9gqTv1S46Blu zNifbbITRuDevfDAQV0UERytq3UuGAVFk9AVmmuH4NG4YD2EMQJo13l1m+SA+JdmtMvT p51A== X-Gm-Message-State: AOAM530ltVEmK1U2InJ3hNbGkooWqm3l178ty40GJfEgijdtqWGlogDq lQTrXf3F1Sxz+L5tBEofnAqjh2YAgRnX+w== X-Google-Smtp-Source: ABdhPJwkL12I0XRvEV0PkVlYwPoUUg3RtRs/pjbKCaMCuJjBBTvAJP2uFoE18EfQYR8oMmERKPOp9uUFvMN9/w== X-Received: from spirogrip.svl.corp.google.com ([2620:15c:2cb:201:e2f9:ca60:7aad:75cb]) (user=davidgow job=sendgmr) by 2002:a05:6a00:996:b0:505:b6d2:abc8 with SMTP id u22-20020a056a00099600b00505b6d2abc8mr40111331pfg.11.1653591249518; Thu, 26 May 2022 11:54:09 -0700 (PDT) Date: Thu, 26 May 2022 11:54:02 -0700 Message-Id: <20220526185402.955870-1-davidgow@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.36.1.124.g0e6072fb45-goog Subject: [PATCH] arch: um: Fix build for statically linked UML w/ constructors From: David Gow To: Richard Weinberger , Anton Ivanov , Johannes Berg Cc: David Gow , linux-um@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If CONFIG_CONSTUCTORS is enabled on a statically linked (CONFIG_STATIC_LINK=y) build of UML, the build fails due to the .eh_frame section being both used and discarded: ERROR:root:`.eh_frame' referenced in section `.text' of /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o: defined in discarded section `.eh_frame' of /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o `.eh_frame' referenced in section `.text' of /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o: defined in discarded section `.eh_frame' of /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o Instead, keep the .eh_frame section, as we do in dyn.lds.S for dynamically linked UML. This can be reproduced with: ./tools/testing/kunit/kunit.py run --kconfig_add CONFIG_STATIC_LINK=y --kconfig_add CONFIG_GCOV_KERNEL=y --kconfig_add CONFIG_DEBUG_FS=y Signed-off-by: David Gow --- arch/um/kernel/uml.lds.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S index 7a8e2b123e29..71a59b8adbdc 100644 --- a/arch/um/kernel/uml.lds.S +++ b/arch/um/kernel/uml.lds.S @@ -95,6 +95,7 @@ SECTIONS } .got : { *(.got.plt) *(.got) } + .eh_frame : { KEEP (*(.eh_frame)) } .dynamic : { *(.dynamic) } .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } -- 2.36.1.124.g0e6072fb45-goog From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x649.google.com ([2607:f8b0:4864:20::649]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nuIce-00FeVJ-7E for linux-um@lists.infradead.org; Thu, 26 May 2022 18:54:14 +0000 Received: by mail-pl1-x649.google.com with SMTP id j13-20020a170902da8d00b00161d78a9e3eso1505557plx.17 for ; Thu, 26 May 2022 11:54:10 -0700 (PDT) Date: Thu, 26 May 2022 11:54:02 -0700 Message-Id: <20220526185402.955870-1-davidgow@google.com> Mime-Version: 1.0 Subject: [PATCH] arch: um: Fix build for statically linked UML w/ constructors From: David Gow List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: Richard Weinberger , Anton Ivanov , Johannes Berg Cc: David Gow , linux-um@lists.infradead.org, linux-kernel@vger.kernel.org If CONFIG_CONSTUCTORS is enabled on a statically linked (CONFIG_STATIC_LINK=y) build of UML, the build fails due to the .eh_frame section being both used and discarded: ERROR:root:`.eh_frame' referenced in section `.text' of /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o: defined in discarded section `.eh_frame' of /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o `.eh_frame' referenced in section `.text' of /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o: defined in discarded section `.eh_frame' of /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginT.o Instead, keep the .eh_frame section, as we do in dyn.lds.S for dynamically linked UML. This can be reproduced with: ./tools/testing/kunit/kunit.py run --kconfig_add CONFIG_STATIC_LINK=y --kconfig_add CONFIG_GCOV_KERNEL=y --kconfig_add CONFIG_DEBUG_FS=y Signed-off-by: David Gow --- arch/um/kernel/uml.lds.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S index 7a8e2b123e29..71a59b8adbdc 100644 --- a/arch/um/kernel/uml.lds.S +++ b/arch/um/kernel/uml.lds.S @@ -95,6 +95,7 @@ SECTIONS } .got : { *(.got.plt) *(.got) } + .eh_frame : { KEEP (*(.eh_frame)) } .dynamic : { *(.dynamic) } .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } -- 2.36.1.124.g0e6072fb45-goog _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um