From patchwork Fri Sep 14 04:06:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 969613 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42BMdd6B8Dz9s9N for ; Fri, 14 Sep 2018 14:16:05 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mUxdr3AN"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42BMdd4dLrzF3V2 for ; Fri, 14 Sep 2018 14:16:05 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mUxdr3AN"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::644; helo=mail-pl1-x644.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mUxdr3AN"; dkim-atps=neutral Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42BMRf215HzF3Tr for ; Fri, 14 Sep 2018 14:07:26 +1000 (AEST) Received: by mail-pl1-x644.google.com with SMTP id t19-v6so3544469ply.13 for ; Thu, 13 Sep 2018 21:07:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=9+V3kqOThv8KSEaJLUF0qOZ8pfuqwes0yc4Ohkvg5mA=; b=mUxdr3AN0INpbyaiv9p2gYi6qimeEOLiEglzLvoSEC7fWqAm5jDd53oVVZHcPNVTrF WFRIgshSa3ixx+izaHFncqODE5QjLAC7bAs2GLBt+9hC/CIuzAnxpjSI9SrOtT2xl/Xj OnVcJslQ+mB3VhlckRcnrfoBseXkmiAzsOMhrunkjJTJgf+O1irQSPm5JHjwATfmOMpR kD5hT8awLChcxvmnX/oCNcQxolnTkTl9Z1gwtqJ/2OtzMgsNVAIqyMG4NX3gvv2YZs3q 6ZT1JibuMz8YINhDBl7PKX5AjhePUbkUUBaE6h5JgKoeySSesgnF3he/AECFz+mYSOwv TjoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=9+V3kqOThv8KSEaJLUF0qOZ8pfuqwes0yc4Ohkvg5mA=; b=Yfib5tY3RPY9p52W8CSZGA1M1kU8nfG4ter7V9nWrgXMj3ncCshDkpsqzzQhBshOSc feEJ0M4P6Vt/dOLbPBmUZ2pSc4bfREMmLIK6X4PAa42rK0K/IC/rfSO5B0A2vRlPpOUH EwUBMRtzyYf2sKFdEwq3wCLuTTahSpV9rEscGL1xAp2IYUgEAoA2fhuCXfyUNoBUQCme 71cEWBG0UOtrJZ+cPkXlCsZZ2au+DXaKIS4Erv2vTEeb7NS0uT6udyMzWyS23qWi0Xki eJ68i3njSxs7FzsIIPI+43/aiQqAnP73abr6ALBzvvN3Uw4VusLScTDwtCCVIBP08o3G pd9A== X-Gm-Message-State: APzg51BwZnjAw/06jg8v66XB5PRLt1YgZFDe6J9xuOgiQ8NECC1BzHRd fh/DkLyryFhVrdOxctkltQ0nUwxi X-Google-Smtp-Source: ANB0VdbcGssM16auJbUyS0RXNuaKPtbaVStNeHsS3426sES1Au4/Oi+Cj5PEN1jsWKzrNOwam+7b/w== X-Received: by 2002:a17:902:7586:: with SMTP id j6-v6mr10023402pll.295.1536898044297; Thu, 13 Sep 2018 21:07:24 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id b18-v6sm6636194pgk.15.2018.09.13.21.07.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Sep 2018 21:07:23 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Fri, 14 Sep 2018 13:37:17 +0930 From: Joel Stanley To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 3/5] powerpc/boot: Ensure _zimage_start is a weak symbol Date: Fri, 14 Sep 2018 13:36:47 +0930 Message-Id: <20180914040649.1794-4-joel@jms.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180914040649.1794-1-joel@jms.id.au> References: <20180914040649.1794-1-joel@jms.id.au> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nick Desaulniers Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" When building with clang crt0's _zimage_start is not marked weak, which breaks the build when linking the kernel image: $ objdump -t arch/powerpc/boot/crt0.o |grep _zimage_start$ 0000000000000058 g .text 0000000000000000 _zimage_start ld: arch/powerpc/boot/wrapper.a(crt0.o): in function '_zimage_start': (.text+0x58): multiple definition of '_zimage_start'; arch/powerpc/boot/pseries-head.o:(.text+0x0): first defined here Clang requires the .weak directive to appear after the symbol is declared. The binutils manual says: This directive sets the weak attribute on the comma separated list of symbol names. If the symbols do not already exist, they will be created. So it appears this is different with clang. The only reference I could see for this was an OpenBSD mailing list post[1]. Changing it to be after the declaration fixes building with Clang, and still works with GCC. $ objdump -t arch/powerpc/boot/crt0.o |grep _zimage_start$ 0000000000000058 w .text 0000000000000000 _zimage_start Reported to clang as https://bugs.llvm.org/show_bug.cgi?id=38921 [1] https://groups.google.com/forum/#!topic/fa.openbsd.tech/PAgKKen2YCY Signed-off-by: Joel Stanley Reviewed-by: Nick Desaulniers --- v2: Add comment explaining this is a workaround for clang. I have also opened a clang bug to see if they plan on changing behaviour --- arch/powerpc/boot/crt0.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S index e453e011d7e7..4e32bd251b99 100644 --- a/arch/powerpc/boot/crt0.S +++ b/arch/powerpc/boot/crt0.S @@ -47,8 +47,10 @@ p_end: .long _end p_pstack: .long _platform_stack_top #endif - .weak _zimage_start .globl _zimage_start + /* Clang appears to require the .weak directive to be after the symbol + * is defined. See https://bugs.llvm.org/show_bug.cgi?id=38921 */ + .weak _zimage_start _zimage_start: .globl _zimage_start_lib _zimage_start_lib: