From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id 0EDC73858C50 for ; Mon, 22 Jan 2024 07:11:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0EDC73858C50 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=google.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0EDC73858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705907509; cv=none; b=YgXGwYS0C27eTe23/LHIEmg8jP81HngDZpF/9J2k70sqJ3tgQpltgXRkkyER2x4qDh/QIjsgVbkF0bbHo6wlwGrTffdWVq+phV6G6vNuZf+TP7mZDs4O0pXdTMuJ9Tzl6QxMrOsyyYsA8HOLcc1wpy2tecVeA8oarptACwcdV+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705907509; c=relaxed/simple; bh=Ik5jurYXtKS+byFBCiSLEaDwHosyGFhmAKoNRjcqot0=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=e0g1cIwnPLuloWA2TdVcWqdaTFn9ljWz5yShM90f96LUAHbQGlblUIjMW495ZWNUXkxJiUcRu5kL1S4zZBxmIz4N/2Swd1szkPaO9tErotLcl2gngGfidH47brflqOl/RBL++w+RZLdH713AxskgS9dDaXdUcV1YT9C9vXirkYc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40e865bccb4so58255e9.0 for ; Sun, 21 Jan 2024 23:11:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705907506; x=1706512306; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JD8kZJJgalsaPEXHYDJBFLfdvvCKMHR1JroYcVE0ZtQ=; b=JI7X6WbL0xei8pYb1sROY6p83pWKQrCozcrGfWusvdDTAJyBk+rWgvXQu6Z0DLy71D ZCv5Rs7X9E5s/ZxgXUuyLI88I83mbRyfu0mvsmoyeVUbdju9O42azeY3QZgAXmux37+3 qo4YmNdbcPN3sW+hNIww4OO//GSwTBJK044RnCb0rOjnON7DHsoADTqg/W1SeAELw2kz wF437t+D4ToiLA+o1cYy6AvQkBzznHKDb+vxPAR+EqQslxkAJE3xXEWlSQjhDj0957k7 SIyxldTK+iRv3EvtCPg2kql37SXlOCQ7MrJGXdAUyKwgh3DYJhE0DBXWt3EsfI1zYcmG ne/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705907506; x=1706512306; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JD8kZJJgalsaPEXHYDJBFLfdvvCKMHR1JroYcVE0ZtQ=; b=tHnnZTu5VTOZ0rioqnafKihKWGTfXJuUmpgNwa/e7gQB0/U+6qay+KxKuUnhm2CvAK cBT3ffUbkCHIjjXiA6B/nD/fVGo2noaVHHY8D9eT3Jw6av1SRdR/sl0CW/sNwi+ykR9r 6TzDIpP2h/J7WvlcYFuJIOn3XS/sNWk9w0wnRcwsarj/IDSV5K3P838tYVjhCq4E7SHh sXx3G3k3ybnVmMdgkcU3G2sQ1W8C7pOx/1wkkD6pF7jOe9qTCkkjkngZrnxd6jeZJooG E3eqrODEMo0kKDG/WGuFYbLXeWPWYqsDmq5mberx2EKyLMkPF8IQptgDVGDyHGctGmJ4 AXQg== X-Gm-Message-State: AOJu0YwTknNikDWyf83mEhxlSkPhw9RCyhzot9TygaO5p4C0cvWNUY1d vBVegyE71g2qAVNSkNKMMxOBF7Z2iCyPN/Av7LbtJfSiTbvvXYvxop5LQZccjl67 X-Google-Smtp-Source: AGHT+IGZaQh2LOKAOvJcVSdzstuEED5qeuFeg+eUhy9vGlR3ElOaLRv0dQpgKES+Jra6hwhnnwAAI8pAoKUmOKjD3Q0= X-Received: by 2002:a05:600c:35ce:b0:40e:a281:10f9 with SMTP id r14-20020a05600c35ce00b0040ea28110f9mr261520wmq.2.1705907505638; Sun, 21 Jan 2024 23:11:45 -0800 (PST) MIME-Version: 1.0 References: <20231228145802.74719-1-ishitatsuyuki@gmail.com> <6d4075f0f8831c30407bdb2c6a8a36c1de681cee.camel@xry111.site> In-Reply-To: <6d4075f0f8831c30407bdb2c6a8a36c1de681cee.camel@xry111.site> From: Fangrui Song Date: Sun, 21 Jan 2024 23:11:32 -0800 Message-ID: Subject: Re: [PATCH] LoongArch: Do not add DF_STATIC_TLS for TLS LE To: Xi Ruoyao Cc: Tatsuyuki Ishi , binutils@sourceware.org, Lulu Cai , chenglulu@loongson.cn, hejinyang@loongson.cn, i.swmail@xen0n.name, liuzhensong@loongson.cn, luweining@loongson.cn, mengqinggang , nickc@redhat.com, wanglei@loongson.cn, xuchenghua@loongson.cn Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-23.8 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,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,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 Sun, Jan 21, 2024 at 10:51=E2=80=AFPM Xi Ruoyao wro= te: > > On Sun, 2024-01-21 at 21:48 -0800, Fangrui Song wrote: > > On Sun, Jan 21, 2024 at 9:45=E2=80=AFPM Tatsuyuki Ishi wrote: > > > > > > > On Dec 28, 2023, at 23:58, Tatsuyuki Ishi = wrote: > > > > > > > > TLS LE is exclusively for executables, while DF_STATIC_TLS is for D= LLs. > > > > DF_STATIC_TLS should only be set for TLS IE (and when it's DLL), no= t LE. > > > > --- > > > > bfd/elfnn-loongarch.c | 2 -- > > > > 1 file changed, 2 deletions(-) > > > > > > > > diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c > > > > index bd448cda453..64c34e99261 100644 > > > > --- a/bfd/elfnn-loongarch.c > > > > +++ b/bfd/elfnn-loongarch.c > > > > @@ -862,8 +862,6 @@ loongarch_elf_check_relocs (bfd *abfd, struct b= fd_link_info *info, > > > > if (!bfd_link_executable (info)) > > > > return false; > > > > > > > > - info->flags |=3D DF_STATIC_TLS; > > > > - > > > > if (!loongarch_elf_record_tls_and_got_reference (abfd, info= , h, > > > > r_symndx, > > > > GOT_TLS_LE= )) > > > > -- > > > > 2.40.1 > > > > > > > > > > > > > > Any interest in reviewing / merging this and the other two patches se= nt together? > > > The DF_STATIC_TLS change is pretty short, the formatting patch is tri= vial. > > > As for the last patch introducing a comment change, I=E2=80=99m not s= ure what Mengqing=E2=80=99s stance is, but my intention for the comment cha= nge is to provide a better context for the reader rather than comparing to = a solution that is not currently implemented in the codebase. > > > > > > Tatsuyuki. > > > > I think this is correct and should be applied. > > Will this cause a breakage in practice? If so we need to apply it for 2.= 42 branch too. No. DF_STATIC_TLS is a not-so-useful dynamic tag. It helps a `readelf -d` reader to know whether the DSO uses initial-exec. For lld, I made a similar change in Nov 2021 (https://github.com/llvm/llvm-project/commit/6ca8fde226e907db13bc538e721af8= 724f0e92d0). lld before Dec 2022 did not set DF_STATIC_TLS for non-x86 architectures (AArch64 and PPC). I changed it to set DF_STATIC_TLS. For both changes nobody has noticed anything. --=20 =E5=AE=8B=E6=96=B9=E7=9D=BF