Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18504242ybl; Fri, 3 Jan 2020 03:43:48 -0800 (PST) X-Google-Smtp-Source: APXvYqxuAG5SmI3fj3yqRh8auBllQg7RxK517rLgbr1ZMx+QLxZ58KeIFahbDaiq5UAqjYWjCdlh X-Received: by 2002:a05:6830:596:: with SMTP id c22mr97232778oth.188.1578051828186; Fri, 03 Jan 2020 03:43:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578051828; cv=none; d=google.com; s=arc-20160816; b=vwIJk2ni0ZfHCBHYj0g/7qMfLrTaelhkae0rNE6Q065t9/6HohTSQ/tRhcMLjVSkwl lHjQ0MamdKeQq/lmRnAmGEyUF+FUbOOaE1PcBXcjlXmh0MEPuIwgyE4VjUA+oeWHkKG3 azo9DLsT0ztQ5upQfy7OwIERVX3IHYl0CM84TDiaxKZ5NvAJqcw7VBEnPuKvW18pyLJ6 N/SwY6u3d2ls3Uax8GHVFwE896Mw7Q7CdiXS26VBO3n0Uhm5XBdMBV04mQ4VhY67NmWW SXwaxkUVbtQis96RgBGFocN68zTlGF5fSmetfRxL59cmqE7uT7j2jpEOLgEwmVT/stFn T2Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QvHx9VBFKdhfWd8WzxhJgh+vmQjsNCxrtt9E0W65hvw=; b=A0GhSns03N74k8pvSL1kIEUgRthiNKmuf3EiQRnWrUCw74rBH1+rpv/Xijjr7s96TU AzU8idPU87LB8AOUJo26IBNb1SWzBrUca3+DCdBKIrIVDFuhbctCe7R94s5RjxgLTKMH HP7Pu07K47OlOyPMZ9lvbUpGgx9D2t+83OIt63wzigBJ5HhScBHlw096HlAZMQe2MkE0 LdfHbdXCr3N4GT/Zr2UbU0UdXR/QJ7OTu+peSG86+OAq+342q5k2b3KwS7WmohwWgJqf X4X7+EC39KBmeD8Fo3dFh4pp5XDK5wFiyhXU5QpQ0wqDSgrj4Rzw4k4jwqvSsk7K6f5e ALWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WKzWMJ3s; 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 i20si23801277oie.119.2020.01.03.03.43.36; Fri, 03 Jan 2020 03:43:48 -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=WKzWMJ3s; 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 S1727704AbgACLkV (ORCPT + 99 others); Fri, 3 Jan 2020 06:40:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:39482 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727664AbgACLkU (ORCPT ); Fri, 3 Jan 2020 06:40:20 -0500 Received: from localhost.localdomain (amontpellier-657-1-18-247.w109-210.abo.wanadoo.fr [109.210.65.247]) (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 71BF2227BF; Fri, 3 Jan 2020 11:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578051620; bh=Q8weF/ruccANz+AO9p5Pr5ibKl+2BRCize4l+859iBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WKzWMJ3sXj5aMPCAFO9ldnSsZWwqlS6jfhWhT9E5IFN+Etoevmz9b/SaZj4HnXr6n 04JwbjqnQf+QVUjYoHnoEFU8UJB1AXAmsi/YNlNr6MFhF5oxw647weHxtxhce2AM5x YHmrwhM5NR1qylSYfAQE1TSQoKhS8pdiCyj34e10= From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , Ard Biesheuvel , linux-kernel@vger.kernel.org, Andy Lutomirski , Arvind Sankar , Matthew Garrett Subject: [PATCH 02/20] efi/libstub/x86: force 'hidden' visibility for extern declarations Date: Fri, 3 Jan 2020 12:39:35 +0100 Message-Id: <20200103113953.9571-3-ardb@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200103113953.9571-1-ardb@kernel.org> References: <20200103113953.9571-1-ardb@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit c3710de5065d ("efi/libstub/x86: Drop __efi_early() export and efi_config struct") introduced a reference from C code in eboot.c to the startup_32 symbol defined in the .S startup code. This results in a GOT based reference to startup_32, and since GOT entries carry absolute addresses, they need to be fixed up before they can be used. On modern toolchains (binutils 2.26 or later), this reference is relaxed into a R_386_GOTOFF relocation (or the analogous X86_64 one) which never uses the absolute address in the entry, and so we get away with not fixing up the GOT table before calling the EFI entry point. However, GCC 4.6 combined with a binutils of the era (2.24) will produce a true GOT indirected reference, resulting in a wrong value to be returned for the address of startup_32() if the boot code is not running at the address it was linked at. Fortunately, we can easily override this behavior, and force GCC to emit the GOTOFF relocations explicitly, by setting the visibility pragma 'hidden'. Signed-off-by: Ard Biesheuvel --- arch/x86/boot/compressed/eboot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index da04948d75ed..565ee4733579 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c @@ -6,6 +6,8 @@ * * ----------------------------------------------------------------------- */ +#pragma GCC visibility push(hidden) + #include #include -- 2.20.1