From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0B35C433EF for ; Thu, 21 Oct 2021 20:18:59 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F318C60FC1 for ; Thu, 21 Oct 2021 20:18:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F318C60FC1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 05946834C1; Thu, 21 Oct 2021 22:18:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="nXCFNDFL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9F7E5834B9; Thu, 21 Oct 2021 22:18:46 +0200 (CEST) Received: from mail-ua1-x931.google.com (mail-ua1-x931.google.com [IPv6:2607:f8b0:4864:20::931]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1A06083281 for ; Thu, 21 Oct 2021 22:18:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-ua1-x931.google.com with SMTP id h19so3578591uax.5 for ; Thu, 21 Oct 2021 13:18:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mJcO1ThSWXYVbdhzozMoAzMJ9vqdlgiMatDzQGmd8MQ=; b=nXCFNDFLHEGEfbGiaQjLmcb0qQpZNKVGz+UFSGeQbZ3mNXJ83XDZ7q/cFBJUWPAPcG pyiH7CZ3vFti+pJ32orIo/V+mY30ffQ+JK8pizpQ7VZgFhZrYwfAn8owuSr1ccZRL+tZ G24EvzleXwtWuugFIorUnOE4+lcV2kbdQSznA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mJcO1ThSWXYVbdhzozMoAzMJ9vqdlgiMatDzQGmd8MQ=; b=JZQzZxMwV7kCS32rqdWhIas5fI/uwZ7xEqJ35m7yg4sm8rpGYdTPRRIRljWm/ADN6T vI816JXpcGVTutYnKloC3ZuCU8chFtgjmjPmuwe5UUJ4wVhlpr/LDfPy99Itomijb81D WRYcKAS7L2zbCIy/n/LllFvEjcI3E9cskqQSdcBjfpzOzfnCKEqExhQXPUqe0IAkCVfV 4lpcDp5LgHivph6FHuERHol/PQwr4O4zOR3JPJAVSOJKrsR69bB58b+ox8ree7Pof1Zc Rcawygtsgajw+JZ/D4uZE+pXYXFf0cw9/LZA3x6kMj0C72/Jji6j+03/X+0t19BUPckp rYqA== X-Gm-Message-State: AOAM531bcL9EYl1Twa+L/xM+46orSjLeROcld9aV3YwNSF4El/8lho8c KRawI3MdES2ciG8/JOcsjzjS686SS/qDCxnulr2feQ== X-Google-Smtp-Source: ABdhPJyzHuDYN+HzuFGygXhrxeZlId8tlyq31JD1Nd1I9JKVoffUGYpsgKS5eK0Q0girOgJZv8yHEvPgEmToCHRh0Rc= X-Received: by 2002:a67:e998:: with SMTP id b24mr9810933vso.58.1634847518580; Thu, 21 Oct 2021 13:18:38 -0700 (PDT) MIME-Version: 1.0 References: <20211020213134.7534-1-adelva@google.com> <20211020213134.7534-5-adelva@google.com> In-Reply-To: <20211020213134.7534-5-adelva@google.com> From: Simon Glass Date: Thu, 21 Oct 2021 14:18:27 -0600 Message-ID: Subject: Re: [PATCH] x86: Fix linking u-boot with ld.lld To: Alistair Delva Cc: U-Boot Mailing List , Nick Desaulniers , Bin Meng Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Wed, 20 Oct 2021 at 15:31, Alistair Delva wrote: > > When linking the final u-boot binary with LLD, the following link errors > are seen: > > ld.lld: error: can't create dynamic relocation R_386_32 against local > symbol in readonly segment; recompile object files with > -fPIC or pass '-Wl,-z,notext' to allow text relocations > in the output > >>> defined in arch/x86/cpu/start.o > >>> referenced by arch/x86/cpu/start.o:(.text.start+0x32) > [...] > >>> defined in arch/x86/cpu/start16.o > >>> referenced by arch/x86/cpu/start16.o:(.start16+0x1C) > > According to Nick Desaulniers: > > "This is a known difference between GNU and LLVM linkers; the GNU > linkers permit relocations in readonly segments (making them not read > only), LLVM does not (by default)." > > Since U-Boot apparently seems to use relocations in readonly segments, > change the global linker flags to permit them when linking with LLD by > specifying '-z notext'. > > Signed-off-by: Alistair Delva > Cc: Nick Desaulniers > Cc: Simon Glass > Cc: Bin Meng > --- > Makefile | 3 +++ > 1 file changed, 3 insertions(+) Reviewed-by: Simon Glass > > diff --git a/Makefile b/Makefile > index 6f2474baeb..3488b83e14 100644 > --- a/Makefile > +++ b/Makefile > @@ -997,6 +997,9 @@ LDFLAGS_u-boot += $(LDFLAGS_FINAL) > # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. > LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker) > > +# ld.lld support > +LDFLAGS_u-boot += -z notext > + > LDFLAGS_u-boot += --build-id=none > > ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),) > -- > 2.30.2 >