Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7871312ybi; Thu, 6 Jun 2019 02:56:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgrP90npYDPaeb+ZNDY5vFnbo3MltVVBWJY2SiFM5bkF32b942D40vgN8oN/kstOTBV+gt X-Received: by 2002:a17:902:9689:: with SMTP id n9mr49722309plp.133.1559815002248; Thu, 06 Jun 2019 02:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559815002; cv=none; d=google.com; s=arc-20160816; b=kNi7e7g3Z5gs35+FjeQsYkqWDupa5ZPawXpg8YE8HJwHJso6PlsUaQZPamd8T/1/5W FIFiYctX55X2GZc2f3qTBpyWoEB7eHwzoNPM3zLCOHft8laiNToQKYsUN22/yhSy8p1V i73lNH1ZLRRB5nfDCx9pcMGAtFne0OIvURjHmuxpMxgY51jI1sx5T+cxtMRxbZ4wPv/O +OAmwE5BDrL2I6u/m1ESgkasIRpnmhbPwmzipwwVCaeR5inOk4GPjfx0ELRPcB8yTwhh DSjWVX1f2zCKpK0DEb4K6x8+uWHuB2GZ42iklBrKszWkXVCEDTG2YDN0q3jMhFrpo3fL 58vg== 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=8P8yzaRHEtc9JnJhJ2Vcca1eVVavzK9/2U+jP565fm0=; b=YrP6jZ/cYGPxciwIzyblCNbvYLfpIyq2B06mtUZQod34xt5nSQDgT+uW8bTboMAFg2 jdbsNko03WuhWUzg5HbaDCKYo4DGy5zb6NsMk0x2iADrIgB3RoRFwfu3fbsmgpiBZZnI ewQuS51KBwt/jNB4fMCKy4opEyB2La7IARKgnFQd1YZkUOOgu/yps9rXjomjhfrIwWnv w+UwlAzVq8G+U3DYfMY46ni7+NZtlR6z/1rc9pztz9pTqQhsjSuUaxjzthkdxHiw0xdQ 8CAuozfveUt+GBGqCyukAlVex5RaRykQ1Fip7Z/Ecj/lkX2eZlZOfzFkGqesGevFHawi 1fSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=soldPpgw; 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 d12si1475989pjw.16.2019.06.06.02.56.25; Thu, 06 Jun 2019 02:56:42 -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=soldPpgw; 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 S1728044AbfFFJyz (ORCPT + 99 others); Thu, 6 Jun 2019 05:54:55 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:56108 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727846AbfFFJyz (ORCPT ); Thu, 6 Jun 2019 05:54:55 -0400 Received: by mail-it1-f194.google.com with SMTP id i21so2182283ita.5 for ; Thu, 06 Jun 2019 02:54:54 -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=8P8yzaRHEtc9JnJhJ2Vcca1eVVavzK9/2U+jP565fm0=; b=soldPpgwSbwWi7a0R2nLws0VmYyEMoN2MS6nALAIJ2i8Ny6tl1OSqjSZ/ScD8YR4+z /MUIhRqMAswM8bnBZUwQUBXderhwnAMhb09fpeeviwpQMgB+M6FeSdkFanasIMI9cXXj siA7L6gR7LpSIdujqDGXl7vKvKNpYNnmLYP5Yv+jvOvFIDUCkFnauTX6Xnz014PIEKho 3c8DPdOBy9jEjvoTVGJUwcWaTONl21AbTcm3vmeAnpirAmfhkpAi7o/Qnmv43+uw+YQ+ QKaU8tZe/eoILactvgNvkdS5vQhGvuYXLv9XWakLeadWlEBbrIUkY4Ha78NZPOxXvSf3 CTYA== 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=8P8yzaRHEtc9JnJhJ2Vcca1eVVavzK9/2U+jP565fm0=; b=WSCZlkXsIR4rL5wli9b+s+L1AdPAeOqXrZCYQNHtMJJv5J7+TXuv5zs3/63fSMrhNr wndzko0KDwJTH4sfWXhFIpgRhqH3fLvKJT+kI5AmBh+vuZYL8ZiWZg9knn1lbAO6tgZH yqd0If2960VZzOZFbdf/sEmTtdQvLApzCAhOQaEotAxUNptlgM7UGiU9CqpR5DgJmpvp 9b+R/iYc5yjOt7j/tm0Pj8GnVIEAvvUS4OzW+J4PSTrDj2I34IBq9ewesnSYf5SDQHOq odJWoftsSIrv4CIEBUqYXZuoICfh7kh737GSV1muIGQU06dlAjVWPO0H5XRuMoIfMWpX G6aQ== X-Gm-Message-State: APjAAAWfh7cmL9/9/E/QvqDXZLPIIIsV14OOzQ/r8ogZHu0tnnsMF1e0 +zOuxqUrXZnVgBEXCVVD3m0i7uHH3fMVZEM7TN1PzQ== X-Received: by 2002:a02:b01c:: with SMTP id p28mr30692269jah.130.1559814891244; Thu, 06 Jun 2019 02:54:51 -0700 (PDT) MIME-Version: 1.0 References: <779905244.a0lJJiZRjM@devpool35> <1993275.kHlTELq40E@devpool35> <2433398.iiuBUrR0On@devpool35> In-Reply-To: <2433398.iiuBUrR0On@devpool35> From: Ard Biesheuvel Date: Thu, 6 Jun 2019 11:54:37 +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: Rolf Eike Beer Cc: Greg KH , 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 Thu, 6 Jun 2019 at 11:40, Rolf Eike Beer wrote: > > Ard Biesheuvel wrote: > > On Thu, 6 Jun 2019 at 09:50, Rolf Eike Beer wrote: > > > Am Donnerstag, 6. Juni 2019, 09:38:41 CEST schrieb Rolf Eike Beer: > > > > 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)? > > > > > > > > 5.1.7 with the same config as before and "make olddefconfig" builds for > > > > me. > > > > > > Just for the fun of it: both 4.19 and 4.19.48 also work. > > > Could you please check whether patch > > 60f38de7a8d4e816100ceafd1b382df52527bd50 applies cleanly, and whether > > it fixes the problem? Thanks. > > The part in drivers/firmware/efi/libstub/arm-stub.c needs to be applied by > hand, but afterwards things build fine. > Thanks. I'll send out a backport.