From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id 294E13858405 for ; Fri, 29 Apr 2022 23:02:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 294E13858405 Received: by mail-pj1-x102f.google.com with SMTP id j8-20020a17090a060800b001cd4fb60dccso8507495pjj.2 for ; Fri, 29 Apr 2022 16:02:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=6dILkE2qTmgzl2EFjKn/0RLCgWuQFj68gQwv8ZFGedU=; b=8FUNy0dk6/c7kHTK1WVclKEMuiA3W7ovGv8i6bdx2qi5GZ17Q+uXdYvo08zIjfVTnw kTfbTZXnr98OHDfQAufalONo0QrCxBEork9pguxy9TYnWU2Jld62ohvYKP6yJ9a/qFhU ZE4iNiweYLxD8C1AmBEEx0aVPHohXNk47g2t0TBiByscPqJGVsWkmDwkO2Mcgtvq22s2 AZOmzvN3M0KQ+Ri19/rA8Ug0Y1GgQNFiYPA1UkJqJP2EITE+HKTGHg7sp0NSyXCu4U12 ADCBtrvrD37SjK8gzP4tYoCguRwvvFy5CQUAEZThUjrQvIYe+X9AY5WqJpxM5l1Jt3hr 3ldw== X-Gm-Message-State: AOAM530O4m8PYVwNd3izwzfKJPw6Y/uGM55lEQ2oVKVMOIEOelnj2nk1 JsZrEH8fdTcDcjihdsbGrxOc5+Sb0zQ= X-Google-Smtp-Source: ABdhPJyefPPAnylmIyxIdOTBj0HkTSNfxKQGdrki+f9G95Zg8l2PMPn09g9PU2dblj9iYwa54q2TTg== X-Received: by 2002:a17:90b:3503:b0:1d1:c700:e484 with SMTP id ls3-20020a17090b350300b001d1c700e484mr1390546pjb.245.1651273320136; Fri, 29 Apr 2022 16:02:00 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id y8-20020aa78548000000b0050dc7628157sm205755pfn.49.2022.04.29.16.01.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 16:01:59 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 30AE1114007B; Sat, 30 Apr 2022 08:31:56 +0930 (ACST) Date: Sat, 30 Apr 2022 08:31:56 +0930 From: Alan Modra To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: Use __ehdr_start rather than _begin in _dl_start_final Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3031.4 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: Fri, 29 Apr 2022 23:02:02 -0000 On Thu, Apr 28, 2022 at 04:37:53PM +0930, Alan Modra wrote: > On Wed, Apr 27, 2022 at 03:54:27PM -0300, Adhemerval Zanella wrote: > > > > > > On 27/04/2022 09:35, Alan Modra via Libc-alpha wrote: > > > __ehdr_start is already used in rltld.c:dl_main, and can serve the > > > same purpose as _begin. Besides tidying the code, using linker > > > defined section relative symbols rather than "-defsym _begin=0" better > > > reflects the intent of _dl_start_final use of _begin, which is to > > > refer to the load address of ld.so rather than absolute address zero. > > > > > > The motive for this patch is to finally tidy ppc32 GNU ld treatment of > > > absolute symbols. On ppc32, the reference to _begin generates a GOT > > > entry. A GOT entry for an absolute symbol shouldn't be dynamically > > > relocated, so this usage in glibc of an absolute _begin will fail once > > > I fix ppc32 ld. Note that on many other targets, including ppc64, gcc > > > generates pc relative or got-pointer relative addressing for _begin. > > > ie. the compiler assumes _begin is *not* at an absolute address, and > > > generally linkers go along with that. > > > > Does it mean that once you fix it, newer binutils will start to fail > > to build older glibc releases for powerpc32? > > Not necessarily. I found these issues with absolute symbols in glibc > by inspecting object files. Possibly dl_rtld_map.l_map_start == 0 > causes no problem, I'll know when I have set up a test environment for > ppc32 that lets me build and run a ppc32 glibc. Just tst-dl_find_object regresses on a glibc ld.so that uses _begin. -- Alan Modra Australia Development Lab, IBM