Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1594330imd; Sun, 4 Nov 2018 06:01:49 -0800 (PST) X-Google-Smtp-Source: AJdET5dLJH1q34O4FyoRBpM94QlTZBHQL1kb1AsDtowrHgfh7IHixF8ps0HQ0ijlr76hOVgTN8iD X-Received: by 2002:a62:6fc7:: with SMTP id k190-v6mr74231pfc.97.1541340109089; Sun, 04 Nov 2018 06:01:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541340109; cv=none; d=google.com; s=arc-20160816; b=GpJoDVVgkJpzP7cRAJFjRfNxDMJnaQJp+ru4bLx7+CeDehk/+bSu3o89yjcmpz2PA5 /+5SiR5k4LA0Hh9ED3qZyV90PBwUl1fn4VJpNVJV/OskUIHTy5P61jlSDW4SztU17Au1 zxbzrc0NUtQV4Qe4SWhgdZtBdQV/leyfDwvGf+09LfC/UbEo11GCaoudW0iK6rkOVO8f Pb27Q0tLZ+P/LIWhE7/z6YRn47wcU8mbh4SxQ1eWMzI9cRDMVY7ng+q48TejNMs9lqI5 MPzlskZdb8AGKEpttCJ3U5YoqQhk/RmwaapLa6e5RksYW6YUkcONhwutCLHK8rC/5d5n lbBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=7oXcIrqtSmuyBPYUG1e+EHqqso2pIJMI76WGppdfM4s=; b=hnu3t5bGk0d5RJVr58YJMkPadvbQugIFN9YQmqG4Fk4BdhVExh4y+d9KrHsu93Pets seCKepTcH8J+tswFa8YzoYrzfjDafOxsWFJr65KmdnbbckxWpFqLLUhoarEeg4ZoACfG i4RuUycnvrXh4HMuTVqKW1hM1YtzSRrHUPcawVKZWy0NEpLsApmDPvXr4s3JsCeyjBEk +gW46b0wv/pNzj9sjGYlEGDi2xUQVPLSzHKm1GErjdOgqSbt6HWTco+hsXLvxW09KrK3 1MnsVx2lacEWIBlfx2j22MfUKb5h3GSLlZafebdoRmhYGzb5HgHEOU77oS3Z4qWSzKaF ohYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lgKQXVCT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t13si10950413pgm.175.2018.11.04.06.01.34; Sun, 04 Nov 2018 06:01:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lgKQXVCT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731686AbeKDXOg (ORCPT + 99 others); Sun, 4 Nov 2018 18:14:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:48046 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731341AbeKDXIw (ORCPT ); Sun, 4 Nov 2018 18:08:52 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7B9102085B; Sun, 4 Nov 2018 13:53:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541339628; bh=M+nlvSSWJ6LODF+My80H6Ek0nsvcQgbQobsSHZ3QULs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lgKQXVCTjMeBx2Lw1T/9/PSYwSYOV1mH8nSJPSw2XMx4HOHPcJAMJjsy6MCKdADrn huEhMYY8R7wVxzZ8I+wJ0z/LFF1L4hzqctciXCZ8YgKJsvVOmKFFQO1nl+PHpNiLKw nqDtwUPjyKusavh1TKNHqOtnRJVKM1WqdWNBOt7o= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Joel Stanley , Michael Ellerman , Sasha Levin Subject: [PATCH AUTOSEL 4.14 22/30] powerpc/boot: Ensure _zimage_start is a weak symbol Date: Sun, 4 Nov 2018 08:53:17 -0500 Message-Id: <20181104135325.88524-22-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181104135325.88524-1-sashal@kernel.org> References: <20181104135325.88524-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joel Stanley [ Upstream commit ee9d21b3b3583712029a0db65a4b7c081d08d3b3 ] 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 Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- 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 dcf2f15e6797..32dfe6d083f3 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: -- 2.17.1