From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id BD0A43858C52 for ; Tue, 27 Sep 2022 16:49:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BD0A43858C52 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=google.com Received: by mail-pl1-x629.google.com with SMTP id b21so9602005plz.7 for ; Tue, 27 Sep 2022 09:49:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date; bh=jTXlz6ekcnhNEgmn8rvzqfDVyNUx9yo2LEH3uMCvt/c=; b=jXuI6E10SBkfJ/4oTZzBxD+ixu6sWuIuFohrkUN+GxfJlV6dMXr+cpFnzm6ghBBH/+ KiF5x8hlGAHpjaHMgUDf8OXI8NL5NAWOtsQLS1TwA3UsKFJNXrcmKt0erg1oNMX421vw j8XtJGm28LOfP89MjEv/MzuCpPOv614wB7zP/XXTWtlyNFhuGRMJjZImhws6VEes25vW CbNf9C5gne92yYau/Jnl47jd5WJTvGvXXUkTbs7ThxpsTikpS/qEKGS1EnPoaaFy9tZP D/D/4kxwXeqqlxwLCw1wz7grO4bd8lmmQHHMLuwEqg7HFO0czjfeSniUOZ4Pe/FcFjnV DrQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=jTXlz6ekcnhNEgmn8rvzqfDVyNUx9yo2LEH3uMCvt/c=; b=IrEDNU+xBKx8/FdqL4Me+2aTg61GU7PcLoLnReUoqQmvS2qmX3aph7wb02mnMxTips suRAk3no04oJ3CWbPO5RNeMBpl5KsXQy/CrRsZE9A8n3byQHPonEjwUZz023FGBcgjd9 nDTzGf1LUjuU8w2FFDPRrWZQ5qbqNCDfXeci82hEGlQXNATy9/LwZMRrBoAZAhMJWeZQ qDdSrDNLi7eyMlhxgjhyC6vAGRk77hLiLO4RsR9/afNiCKeH4ArG/ZrwpGUyiGz1f9ms jI7sSnCZU0LLJD26M7FpYO/OF265pPr3ykLOpRq4BwMGfElz6U7WCC71TBueSQ/0TWDJ e+hQ== X-Gm-Message-State: ACrzQf1JIAwE4wJMcNbteHxN8l9koaUZnqxan0sV6XON43zJX+K11bl9 SGOngYC8xmcbPgkycRQZDb2CPg== X-Google-Smtp-Source: AMsMyM6+akL6X06Ovb1cmlUbrGNfTz0tyeyh2ZJpc1XvYEvERImIbzJvbSFKUX3ZkFdL0TdELaTW9w== X-Received: by 2002:a17:902:900a:b0:178:77c7:aa28 with SMTP id a10-20020a170902900a00b0017877c7aa28mr27563429plp.3.1664297379725; Tue, 27 Sep 2022 09:49:39 -0700 (PDT) Received: from google.com ([2620:15c:2ce:200:c701:5114:39fd:8fb5]) by smtp.gmail.com with ESMTPSA id w4-20020a634904000000b0042b291a89bfsm1724716pga.11.2022.09.27.09.49.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 09:49:38 -0700 (PDT) Date: Tue, 27 Sep 2022 09:49:33 -0700 From: Fangrui Song To: Xi Ruoyao Cc: WANG Xuerui , liuzhensong , binutils@sourceware.org, mengqinggang@loongson.cn Subject: Re: [PATCH v2] LoongArch: Set e_flags to 0x40 of ELF while using new relocations. Message-ID: <20220927164933.hqlzldtts3xsyf4m@google.com> References: <20220921011756.451005-1-liuzhensong@loongson.cn> <83e9a5ac-c509-066b-07f6-cb3ec4583e48@xen0n.name> <68121ec1509922e881246ebbfda15e1eadb9958a.camel@xry111.site> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <68121ec1509922e881246ebbfda15e1eadb9958a.camel@xry111.site> X-Spam-Status: No, score=-19.5 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2022-09-25, Xi Ruoyao wrote: >On Sun, 2022-09-25 at 16:28 +0800, WANG Xuerui wrote: >> > + >> > +         if (elf_elfheader (output_bfd)->e_ident[EI_CLASS] == ELFCLASS32) >> >             interpreter = "/lib32/ld.so.1"; >> > -         else if (EF_LOONGARCH_IS_LP64 (flags)) >> > +         else if (elf_elfheader (output_bfd)->e_ident[EI_CLASS] == ELFCLASS64) >> >             interpreter = "/lib64/ld.so.1"; >> >           else >> >             interpreter = "/lib/ld.so.1"; >> > + >> Wait what, are we still carrying the old-world defaults for the >> interpreter path here? I know it's harmless because in fact it gets >> overridden by gcc and glibc, but I'd suggest fixing it in a separate >> patch later for consistency. > >It seems not easy to make a "correct" default... /lib64/ld-linux- >loongarch-lp64d.so.1 will be incorrect for a musl-based target. Maybe >we can assume Glibc is used because we are the *GNU* linker anyway... > >/* snip */ For all other architectures, the default dynamic linker is just not useful. (ld.lld encodes no string at all.) Ideally this should be empty, but if an empty interpreter string uses a behavior similar to --no-dynamic-linker, use an arbitrary dummy string. >> I'd bikeshed a little and suggest "EF_LOONGARCH_OBJABI_foo" because >> it's actually "ELF object file ABI v1" and not "ELF ABI object v1". > >In the doc we say "the ABI version of an ELF object", IMO it's a little >misleading (can trick people to believe it could be used to distinguish >old and new world). From Wikipedia: > > In computer software, an application binary interface (ABI) is an > interface between two binary program modules. > >I'm not sure if the (non-dynamic) relocation types belongs to the concept >of ABI: the linker treats relocatable object files as an input (like how >"vim" treats a text file), instead of a program module. But I can't come >up with a better terminology for now... > >-- >Xi Ruoyao >School of Aerospace Science and Technology, Xidian University