Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7130066ybi; Wed, 5 Jun 2019 11:44:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVqIUUL1MdbLazXtVwLBrEiwRCixyD42Yik0mjUfH2KG9LKVKWhth7+dQMT5U73q9t2t8T X-Received: by 2002:a17:90a:ff03:: with SMTP id ce3mr46046676pjb.81.1559760290194; Wed, 05 Jun 2019 11:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559760290; cv=none; d=google.com; s=arc-20160816; b=V1qGRvcD5uipZCGroAgbIu9ENXO4qvzVA1ubT4hGCVhTzqEFBX9hPBk38lMnw7uSd3 S47HqLPsnQxmbirfutj8+aokEOzV9doj5MSYJxXwa3Jdbz1DOUbhxUwxAEzXIx7tbskL uX6zj/X1KiWpMNRvpyZ2C0MhnVuC4MPkKNFOFPRkApgXunyavyCFnH3IjL08orgmYgOS dLy/iTe7r1wYRlRi0IDGUGhpqTeccGVtwnbXlOnSyBiGas2PXLqxAXAFhkcYJmkzvMzi 7rNph9XJRqmr4RLJd8kjzeESz+5dZO718e9LQkAG9bGeAiusDM9rEUfXRKACM+vjnirr Y0yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=tb3AsUPpK2GIv5fgvYVpcgDU5/gP5sotzobQUmB0Ib4=; b=hUPaJbecKrqwfAGzh3MPLFYnPDIj7ZN7dspsYCg6ZvN3g+/0Vm2VHAJcpsgb94fASh Z78T7Krl8fICfuwP99bIrc+QBg0UNAB8jHQzq+SCUOzMK3rrt5s7zUEa9/G0ez/q9INT eX/2FoOLYFLHsNOFu2knfiEuFrAK9htdaqyIQJgpxKD/nFB0mxfBJlZq/0zpycpWTJSU NQ5spbUVlQ9CxGCjtuLc7AsCCF/ki7Eg4E1QYIE/xxV2AywBoxAzMsp7xSYWdGp3LjSt iQ7p0WFSc80j6vEe6LEIrlo53L+H2KniUJoy0r1qPfFKWWQR7UguG9QKFV5K48oRy9Qg fwtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FFyb5FTw; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u13si2276262pjn.89.2019.06.05.11.44.33; Wed, 05 Jun 2019 11:44:50 -0700 (PDT) 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=@linaro.org header.s=google header.b=FFyb5FTw; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726716AbfFESms (ORCPT + 99 others); Wed, 5 Jun 2019 14:42:48 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:37526 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726535AbfFESms (ORCPT ); Wed, 5 Jun 2019 14:42:48 -0400 Received: by mail-it1-f193.google.com with SMTP id s16so5185347ita.2 for ; Wed, 05 Jun 2019 11:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tb3AsUPpK2GIv5fgvYVpcgDU5/gP5sotzobQUmB0Ib4=; b=FFyb5FTwdfq2lfjZ5UNKjnE3e/r2uFUyCmOfyJOpedhml6nw+BGdFwpyxfyHPD0f7/ rEO++unxGsKdphMqlpJPq2jyYUMAWpffYXZ2+0gW6fsNLVLp+GWNoKIx4Bvsv/j8a+hW CW8hPN8Yi1Yw8Zek7YkvFBYng6BFuOrxm5I0y57dm/M345vnLUtQtwD4f/O7qOk7IN/1 xGwZV922z7gBwDtBR+S0sTufgi3FxQ1oZZRNOq+Raf9ABT81ncZGmTDLtZcQayocqwLM WVMXajhLQmGEr8m6UvDIIw3OGpkM5Zfm7MzgV/uGk3uu95oIKBBZz06Mf4twZHzwCurG LYCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tb3AsUPpK2GIv5fgvYVpcgDU5/gP5sotzobQUmB0Ib4=; b=Fyz8ESBCoa6hC3LQ+BXG2kd3BZluHfDpncFIo2GOXT3XWqGg3q/vCEcqBDTs+6C6s8 REY/MtHjX2tqWMt/3gsF7OVEYgCg2LIKwNhfIop1WtJ39bfs69uifY8FI+0lE/6E5eje uUlEliqfs7p2xqLst5XoHPAkweadjx2fIk0Ns2NSaV7+pFcu8de2kU26odVxAfHyPDzc fA1XAFZMLcKhKf+GiaR947ACNir2DqBZTFPyCYV4Lse/1ExWZMSZ3Np/YU2ZPVOGC4Md 94VjLi0UzK6yTN4osVXpC+j+M8sOkHhBV+Tb3THkrWkE8dsuPiDWCMOK1tPzYlomhulK qu0Q== X-Gm-Message-State: APjAAAWTdvMiGGqxfQnTwtKnRhCbZiotD8MeqPIiT/0k+VBTavEPIr64 dxucZgHqsyZTH0UOyLhey7B99FiSrwu6StEPTHlc7Q== X-Received: by 2002:a24:740f:: with SMTP id o15mr12084363itc.76.1559760167133; Wed, 05 Jun 2019 11:42:47 -0700 (PDT) MIME-Version: 1.0 References: <779905244.a0lJJiZRjM@devpool35> <20190605162626.GA31164@kroah.com> In-Reply-To: <20190605162626.GA31164@kroah.com> From: Ard Biesheuvel Date: Wed, 5 Jun 2019 20:42:32 +0200 Message-ID: Subject: Re: Building arm64 EFI stub with -fpie breaks build of 4.9.x (undefined reference to `__efistub__GLOBAL_OFFSET_TABLE_') To: Greg KH Cc: Rolf Eike Beer , Nick Desaulniers , Linus Torvalds , Matt Fleming , Peter Zijlstra , Thomas Gleixner , linux-efi , Linux Kernel Developers List , stable Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 5 Jun 2019 at 18:26, Greg KH wrote: > > On Wed, Jun 05, 2019 at 05:19:40PM +0200, Rolf Eike Beer wrote: > > I decided to dig out a toy project which uses a DragonBoard 410c. This has > > been "running" with kernel 4.9, which I would keep this way for unrelated > > reasons. The vanilla 4.9 kernel wasn't bootable back then, but it was > > buildable, which was good enough. > > > > Upgrading the kernel to 4.9.180 caused the boot to suddenly fail: > > > > aarch64-unknown-linux-gnueabi-ld: ./drivers/firmware/efi/libstub/lib.a(arm64- > > stub.stub.o): in function `handle_kernel_image': > > /tmp/e2/build/linux-4.9.139/drivers/firmware/efi/libstub/arm64-stub.c:63: > > undefined reference to `__efistub__GLOBAL_OFFSET_TABLE_' > > aarch64-unknown-linux-gnueabi-ld: ./drivers/firmware/efi/libstub/lib.a(arm64- > > stub.stub.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol > > `__efistub__GLOBAL_OFFSET_TABLE_' which may bind externally can not be used > > when making a shared object; recompile with -fPIC > > /tmp/e2/build/linux-4.9.139/drivers/firmware/efi/libstub/arm64-stub.c:63: > > (.init.text+0xc): dangerous relocation: unsupported relocation > > /tmp/e2/build/linux-4.9.139/Makefile:1001: recipe for target 'vmlinux' failed > > -make[1]: *** [vmlinux] Error 1 > > > > This is caused by commit 27b5ebf61818749b3568354c64a8ec2d9cd5ecca from > > linux-4.9.y (which is 91ee5b21ee026c49e4e7483de69b55b8b47042be), reverting > > this commit fixes the build. > > > > This happens with vanilla binutils 2.32 and gcc 8.3.0 as well as 9.1.0. See > > the attached .config for reference. > > > > If you have questions or patches just ping me. > > Does Linus's latest tree also fail for you (or 5.1)? > > Nick, do we need to add another fix that is in mainline for this to work > properly? > For the record, this is an example of why I think backporting those clang enablement patches is a bad idea. We can't actually build those kernels with clang, can we? So what is the point? It would be helpful to get a relocation dump (objdump -r) of arm64-stub.o to figure out which symbol needs a 'hidden' annotation to prevent GCC from emitting it as a PIC reference requiring a GOT. Alternatively, we can just revert this patch from 4.9