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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 35522C77B7A for ; Tue, 16 May 2023 11:30:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1C6B8860EA; Tue, 16 May 2023 13:30:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ob/CPQRS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2A4F1860B4; Tue, 16 May 2023 04:09:07 +0200 (CEST) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (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 5E7A786073 for ; Tue, 16 May 2023 04:09:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=cfsworks@gmail.com Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-24e4f674356so12063158a91.3 for ; Mon, 15 May 2023 19:09:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684202941; x=1686794941; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6phMWApJMYMHZwaKaGTPBQDOait0iioCVjlQro+CnK4=; b=ob/CPQRSEPXH6E7Yozf7c1D5gugXDaHjMaJr1hpZlop3WfMyuk4niZ+Rv07olljcnc Tq8514+0SG1UH7hWxXUW58NW/JtinnLVloSgSDA3rR92MsmzRBAO5lkXDszkoWe53zA+ CPtJGWT+h5yGIoMOL7MhtVXV8bQFKN/Sahe93r/kJ31+N2SC0kseqFGhLEzO8K1FCVoZ r7bCEb+myhgP4TphGrtcVxomQfkDocTAYloAcvEOYNkyKZevim3f23MVNlctCWLLYC2i Z16zHeXsFKCoTvbYomLxxJfeneDSiEJMGohpleiWLilreULQyIZHlmwU+sIGjcBSI/aj 624Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684202941; x=1686794941; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6phMWApJMYMHZwaKaGTPBQDOait0iioCVjlQro+CnK4=; b=XVL929xCUIgXhSVzYu4f+AMtK1aWk3Iwcrnsc2p7hHl+LRGEpuEjYydwxuMVXoNVly V5A5RUxGbG3Njy/1rA69VP9bahb63+6fLKyn4ZMGVpR055F7CPKaNxD7P19lZgFscC2Q ry1iFFOXuSB7CbOiuCBS5V9xDOR1wfEenFDeh/xKRXV3MjGGOfxqn+D8Elf4aT6JWRXI Yo8G+QLt0uUa1FungzOtmcD4UdkYiZK9urqn8NwvZwIpQKsk7arx30xtbAQFCCj/olOB U73kk+78XAOg6KTlhUkyX7ioKo8BxpPTuBldDLB3uAtTRFg0DLq76tamh9b41UvBBaVo iwDw== X-Gm-Message-State: AC+VfDw9hfOtBqErPfOfHyCovwgE0CHuCECdo6seB7dUy+PqEhZPeRjV OwtCEzBUT348MpUCz+f/Kmk= X-Google-Smtp-Source: ACHHUZ7pLX75bhTGAU+tdurCO7Y8ZX8RacPMe2lYG132JuqVJwjClcxjJUwFh7UkEf/V6n9gJO3Zqg== X-Received: by 2002:a17:90a:9ec:b0:250:69cf:80ff with SMTP id 99-20020a17090a09ec00b0025069cf80ffmr29269562pjo.46.1684202941430; Mon, 15 May 2023 19:09:01 -0700 (PDT) Received: from [10.64.107.252] (static-198-54-134-172.cust.tzulo.com. [198.54.134.172]) by smtp.gmail.com with ESMTPSA id y90-20020a17090a53e300b00252a7b73486sm309013pjh.29.2023.05.15.19.09.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 May 2023 19:09:00 -0700 (PDT) Message-ID: <9eb1232a-fef8-3afd-5113-50ae2bcddfcc@gmail.com> Date: Mon, 15 May 2023 20:08:59 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH 3/3] clang: Link with --no-pie instead of --apply-dynamic-relocs Content-Language: en-US To: Tom Rini Cc: u-boot@lists.denx.de References: <20230512230135.133162-1-CFSworks@gmail.com> <20230512230135.133162-3-CFSworks@gmail.com> <20230514152845.GR2398826@bill-the-cat> From: Sam Edwards In-Reply-To: <20230514152845.GR2398826@bill-the-cat> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 16 May 2023 13:30:09 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean On 5/14/23 09:28, Tom Rini wrote: Hi Tom! > How extensively have you tested this change? I tested it in building for the arm/sunxi target. U-Boot does not build at all (on Clang+LLD) in its current state: ld.lld: error: section type mismatch for .gnu.version_r >>> :(.gnu.version_r): SHT_GNU_verneed >>> output section .gnu: SHT_GNU_versym However, I don't think I've reasoned correctly that --no-pie is the correct flag to pass, since I do see in arch/arm/config.mk: # needed for relocation LDFLAGS_u-boot += -pie ...and by passing --no-pie, I am just turning that right back off, getting a non-relocatable binary. So I should (and do) withdraw this patch, and will work to understand the situation better before retrying. It does seem that the present rule in the ARM target is to make a binary that assumes a .text base but includes some .rel.dyn relocations to make it optionally relocatable, so whatever flag we pass to LLD should preserve that behavior without bringing in unwanted sections (versym sections, .dynsym, .dynstr, ...) > We don't install ld.lld in > our container environment right now (but should..) and from some local > testing I forget if we need to pass further make logic in to have ld.lld > be used instead. To support both LTO and non-LTO cases, I pass: LTO_FINAL_LDFLAGS=-fuse-ld=lld LD=ld.lld Cheers, Sam