From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id 246B43858C60 for ; Thu, 7 Oct 2021 16:23:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 246B43858C60 Received: by mail-pg1-x535.google.com with SMTP id m21so250793pgu.13 for ; Thu, 07 Oct 2021 09:23:02 -0700 (PDT) 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=1UDlKRI3sAI5AE194i4pkxg+HwYPS4LI2OI+m/RGc20=; b=7S38n3lkIDyFCZ84/7W/2utHtLuv6eVlwqYbjx5gWN1AdoReFLIdC7sa2ct1FEVC2R n7jhFvx8VUA8rbLUw/Hv7ZdbBwnNCDKOSI2GiCA4QGkx3xzYpO40tXhCHwJ6F/fX497D NessISCCxZ1UMhhhw8HrFxvJFJiC/2U7Bv5iyZ8/gUPuD4ViLE/R1McsZfEHQ2J5E/0N 5kqxtPS5GVVc081SYghMLMBTMfpPWoIUZSFEFSTMpXkaALfwjHsKy65I0Iha70jL2GGJ GM7OBukdn88j2BPQIP1quj87M0l6krH2r+ZXr/m4cPenmePIVMjai/pgfvRHSgwQ6/ou 1d5w== X-Gm-Message-State: AOAM530a8KRT3aoqVjF3NvIKTedZS8UNNHeByzwKLLZ04+eGwapYl6+H RVVHF8CfFjPD3u6cZisI1H8jWENTxPZhiWP6yt5QtyKB X-Google-Smtp-Source: ABdhPJztmFoVhel4Uq0nnG2o/1T1JeC5OJDe4fL/cl12voKeq6cIUVOvQSM+1lY5ieMTG0s5Pb05qsDjg7lD/hLkDYQ= X-Received: by 2002:a63:8f0e:: with SMTP id n14mr454584pgd.75.1633623781915; Thu, 07 Oct 2021 09:23:01 -0700 (PDT) MIME-Version: 1.0 References: <20210907174417.sctsswphsyae4mpc@google.com> <20211005094554.2f28d6bd@ktm> <20211006075721.qnv6qabroytcsido@google.com> <20211006110321.5f1a9610@ktm> <20211006134344.63395242@ktm> <20211006125517.GE2700@arm.com> <20211007111926.30db4c4f@ktm> <20211007120038.1445bbd3@ktm> <44bac775-3127-7bc7-c4ea-fa282ed277d3@linaro.org> <20211007155730.GG2700@arm.com> In-Reply-To: <20211007155730.GG2700@arm.com> From: "H.J. Lu" Date: Thu, 7 Oct 2021 09:22:26 -0700 Message-ID: Subject: Re: [PATCH] dl: Use "adr" assembler command to get proper load address To: Szabolcs Nagy Cc: Adhemerval Zanella , Florian Weimer , libc-alpha , Andreas Schwab , Joseph Myers Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3024.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Oct 2021 16:23:04 -0000 On Thu, Oct 7, 2021 at 8:57 AM Szabolcs Nagy wrote: > > The 10/07/2021 07:29, H.J. Lu via Libc-alpha wrote: > > On Thu, Oct 7, 2021 at 7:18 AM Adhemerval Zanella via Libc-alpha > > wrote: > > > On 07/10/2021 07:00, Lukasz Majewski wrote: > > > > On Thu, 7 Oct 2021 11:19:26 +0200 > > > > Lukasz Majewski wrote: > > > > And indeed it is the case. Yocto/OE by default perform prelinking (use > > > > prelink program) to speedup start time of dynamic program. > > > > > > > > The prelink [1] itself assigns some virtual addresses to all required > > > > shared objects (in our case for /sbin/init), so no clashes are > > > > encountered. > > > > > > > > And using prelink is a _default_ behaviour in Yocto/OE poky distro. > > > > > > Does it work without prelink? Also, does it fail with prelink in real > > > hardware? > > > > > > It indeed might be a prelink issue in fact. > > > > This will fail everywhere if prelink is used. > > i thought the point of prelinking is that the vaddr in > the elf image is the runtime address so you don't have > to process relative relocs or adjust pointers in the > dynamic array with += l_addr at all (and then l_addr > does not have to be correct, ld.so would still work). > > but here ld.so is loaded to some random offset on top > of the static prelink offset. is this expected? > does it make sense to prelink ld.so this way? ld.so is loaded by the kernel. It makes no sense to prelink ld.so. -- H.J.