From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 2EA3B38323F6 for ; Fri, 29 Sep 2023 19:49:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2EA3B38323F6 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=jrtc27.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jrtc27.com Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-31f7400cb74so13131787f8f.2 for ; Fri, 29 Sep 2023 12:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jrtc27.com; s=gmail.jrtc27.user; t=1696016961; x=1696621761; darn=sourceware.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=e2tpWBpm4YwpqbNISLsqLbAlk0YeaSls1M4tU7JD+FY=; b=h2ToyvZ2jJH7iJarvIdjgweGBkVlfOI0K8pHkTarWOJAb11QMmJzmHEn9IVEp4NZcH U4Exhl3HUiWNa+SZijrUpj3m2qvE96xa339axnxv8C25lAed+2W+ksdcFOvEYq2wLeVu EkJ+D+LKG9k0rNTB23JwTUwsIAUIXTFAG99WYY20SS38HrNl/JNvun+6hYFdeZlPlQDn HaC6cNGdL+dN4snBIRNINCmMFXrECYJfioR7ERaLRYezDouPQzee6m61ZNd1vPrsrKyv XnO2jZlsMTbLRuXqWqm4saIoWZB95r7qQxeNzl13wnq5AXNvWJuF1d4c5IO2rWLh5U1X zOfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696016961; x=1696621761; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=e2tpWBpm4YwpqbNISLsqLbAlk0YeaSls1M4tU7JD+FY=; b=uLLjUR0N350c09qeaxvXCzpWd+fIfx5iKhlYWL+s4710zcQh6Cm/Uu7+V4xQfV9zEz JHCgQGwEMWkGqS8oXM581DeEBoIsOWUqQV/oz5ezG+5gYRTmk8ubOJuz4ZKtK93MaJbz yTxifiDT6GDLjhLdTvM1IBoiwEVQeSBTFuTJ4sjRs53WCH+cZhRCNS7haRbKejUp+5UA sOLqur6cqBl3AcCjAG7UZyf23bSJAFt9WfUXSdNCZ0NaRCHaLJC6lR4swe2Xml4bK074 mjdCc6WzJUg7YKmgaS2HylAeRsfGVHjGhPCzaJV/h4bQv1EhRHwdyjluIPcQD5AWx2Uu UNyg== X-Gm-Message-State: AOJu0YzmEiEeCJJaOzk7rWClzFkyVqsKnqk+RIrSwEoIMc6TzT7QNRKB gTPkRO1fMx/H0ROewfNYpNOxpw== X-Google-Smtp-Source: AGHT+IHWxegepckrjY5o66sNRMMU2R6ziT/gjaCQ8PwXsefvzBp7xGGm0zAInLFs0qz5iY5tN4qxVw== X-Received: by 2002:a5d:6683:0:b0:317:6a7c:6e07 with SMTP id l3-20020a5d6683000000b003176a7c6e07mr4375719wru.32.1696016960720; Fri, 29 Sep 2023 12:49:20 -0700 (PDT) Received: from smtpclient.apple ([131.111.5.246]) by smtp.gmail.com with ESMTPSA id f8-20020a5d6648000000b00326b16c01e9sm121571wrw.1.2023.09.29.12.49.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Sep 2023 12:49:20 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) Subject: Re: [PATCH v8 3/6] riscv: Add __riscv_hwprobe pointer to ifunc calls From: Jessica Clarke In-Reply-To: <87v8bszs20.fsf@oldenburg.str.redhat.com> Date: Fri, 29 Sep 2023 20:49:09 +0100 Cc: Evan Green , libc-alpha@sourceware.org, slewis@rivosinc.com, Vineet Gupta , palmer@rivosinc.com Content-Transfer-Encoding: quoted-printable Message-Id: <80C0E219-6C20-49E5-89C4-899DEF6156D7@jrtc27.com> References: <20230901235224.3304592-1-evan@rivosinc.com> <20230901235224.3304592-4-evan@rivosinc.com> <87v8bszs20.fsf@oldenburg.str.redhat.com> To: Florian Weimer X-Mailer: Apple Mail (2.3731.600.7) X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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 29 Sep 2023, at 20:40, Florian Weimer wrote: >=20 > * Jessica Clarke: >=20 >> Being able to write portable IFUNC resolvers across Linux, BSDs and >> other similar OSes is valuable, and this would preclude that. In = FreeBSD >> there are no issues with calling functions from IFUNC resolvers; we = just >> process all non-IRELATIVE relocations before IRELATIVE ones. >=20 > Even across multiple objects? In glibc, we rely on relocation order = by > the link editor to put IRELATIVE last, so we don't have that = particular > problem for IRELATIVE, but we have it for regular symbol-based > relocations that happen to refer to IFUNC symbols because the = relocation > order my not reflect the symbol binding order. No, just within an object, but that=E2=80=99s fine so long as you = relocate objects in the order they appear in the link map. But you do need to take care with relocations that happen to refer to IFUNCs, as you say; they get deferred in FreeBSD too. This also means we=E2=80=99re not = dependent on the static linker=E2=80=99s relocation order for IRELATIVE. I believe those guarantees are sufficient for allowing an IFUNC resolver to call into libc functions like __riscv_hwprobe if in libc itself or in a library linked against libc. The only issue would be something like libgcc_s needing to do so, but that doesn=E2=80=99t seem = like a big deal, and can be worked around if you really need an IFUNC in libgcc_s. Jess