From patchwork Wed Apr 17 11:20:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Chestnykh X-Patchwork-Id: 1924593 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=QaJIKcwu; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=uclibc-ng.org (client-ip=2a00:1828:2000:679::23; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=patchwork.ozlabs.org) Received: from helium.openadk.org (helium.openadk.org [IPv6:2a00:1828:2000:679::23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VKJNY5SfLz1yPv for ; Wed, 17 Apr 2024 21:20:13 +1000 (AEST) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id AE3DB352827F; Wed, 17 Apr 2024 13:20:05 +0200 (CEST) Authentication-Results: helium.openadk.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=QaJIKcwu; dkim-atps=neutral Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) by helium.openadk.org (Postfix) with ESMTPS id 2E58F35206AC for ; Wed, 17 Apr 2024 13:20:02 +0200 (CEST) Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-51788cbec59so1873544e87.1 for ; Wed, 17 Apr 2024 04:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713352801; x=1713957601; darn=uclibc-ng.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xLeZ01x/WxvDPR0mnn9g4fhV9uLcdD7cKLpAxlDEiu8=; b=QaJIKcwujwxkaK4ozViuQ3dBrGfdk/KAdJ+Jx92ocGb9wvhNS4I78vzIywNtVY8MOn ZcRAFoOF9gb1H0irdbATCx2o2HxHbTlNumTrNaPIvwHUAd5pquCq47sO3MzbU2itOHzs wT3P5JsNclyas7d+QXCunlqzHzDBuLzAiDIWJpAChhX60PcYTZP1c3eWmxEajkcuWe4M h7fDwHMYh/FqouWDKHllfYKLa0XdrbuVMqidQCr+hzn6FK+7KWUFRt2tcVq7hadSRjVX t7BENBVZwK06vt9S1XAIL3aJwhAC+qQqOBrGzsPTUSw1uxxvWH7NP+j+B6oaoXJOn1QO JAmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713352801; x=1713957601; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xLeZ01x/WxvDPR0mnn9g4fhV9uLcdD7cKLpAxlDEiu8=; b=DjgR3bohVDT13nA7cQZZkT2A/V8OlZ3JSsDvO1hLi3q8KomCMOoGgXtoN4fDwQKgBe M0/z7EfO33uFObiK6ig7ddy0rqoEJ6WOoaXekmy1xfhda5hLOIPa6gz6ZGc4SHGQbnBt AJ+fDuVdSYgnFu4xI4GjBktB7Hc4lGmnricwMXI6154IBm4G6XCLN92iZp352/EGwFCp Now4njLFOhe+bTRr9LUnA+QeZrwRx6nIxNiWgARYD2wAL1qOPXoOSTqzS9dNxaDElTuc H//32zNbojyF6JiN1tHyUsHkgctEJ5zaXxmMikMbm5gxLOqg77dwxj9tx5carv0SlGgQ esww== X-Gm-Message-State: AOJu0YygUCp12O49MsbB+GvORX+1aQNkdcdixX5eTehO3y2694GjTQbN jSjwsXvfU+JXR67Av2RKavgs6XJohgOkimWAellRcRjjxuRhBcY6dgYizj4b X-Google-Smtp-Source: AGHT+IE9S9+qZxygChsdw+CJ0VK3DJ21ksLLA003akw//B7OPqc0fx0/tM6e/f8Q5urfDyPv76A45w== X-Received: by 2002:a2e:991a:0:b0:2d6:fe13:f9aa with SMTP id v26-20020a2e991a000000b002d6fe13f9aamr9736758lji.3.1713352800455; Wed, 17 Apr 2024 04:20:00 -0700 (PDT) Received: from localhost.localdomain ([2a00:1370:817a:d2b8:8191:7d98:f88f:25b3]) by smtp.gmail.com with ESMTPSA id z4-20020a2e8e84000000b002d8e42c1b5fsm1846259ljk.42.2024.04.17.04.19.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 04:20:00 -0700 (PDT) From: Dmitry Chestnykh To: devel@uclibc-ng.org Date: Wed, 17 Apr 2024 14:20:40 +0300 Message-ID: <20240417112040.1066963-1-dm.chestnykh@gmail.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Message-ID-Hash: BJ74CCLAQGAQF7JXMGNBQYBHESJCJUWV X-Message-ID-Hash: BJ74CCLAQGAQF7JXMGNBQYBHESJCJUWV X-MailFrom: dm.chestnykh@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Dmitry Chestnykh X-Mailman-Version: 3.3.3 Precedence: list Subject: [uclibc-ng-devel] [PATCH] aarch64: Apply relocations to use TLS GD access model. List-Id: uClibc-ng Development Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: In aarch64 when the general dynamic access model is used for tls data the linker emits two dynamic relocs (R_AARCH64_TLS_DTPMOD(64) and R_AARCH64_TLS_DTPREL(64)) that must be applied by ld.so during object loading. Signed-off-by: Dmitry Chestnykh --- ldso/ldso/aarch64/elfinterp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ldso/ldso/aarch64/elfinterp.c b/ldso/ldso/aarch64/elfinterp.c index 717a76980..9365569cc 100644 --- a/ldso/ldso/aarch64/elfinterp.c +++ b/ldso/ldso/aarch64/elfinterp.c @@ -238,6 +238,12 @@ _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, } } break; + case R_AARCH64_TLS_DTPMOD: + *reloc_addr = tls_tpnt->l_tls_modid; + break; + case R_AARCH64_TLS_DTPREL: + *reloc_addr = symbol_addr + rpnt->r_addend; + break; #endif default: return -1; /*call _dl_exit(1) */