From patchwork Thu Jun 8 16:44:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 70795 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EE5ED385696B for ; Thu, 8 Jun 2023 16:45:33 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id 240EF3858C62 for ; Thu, 8 Jun 2023 16:45:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 240EF3858C62 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6513e7e5d44so588062b3a.0 for ; Thu, 08 Jun 2023 09:45:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1686242718; x=1688834718; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:from:to:cc:subject:date:message-id:reply-to; bh=MhlUHSjCott1id8KJIogub4pfDonQ0xqE0dvrfHZFP4=; b=nvS8SAJbfMffTwUGkbzlh03oI9NpVO6NNjirSOTPkDNESTzjPfCt/Q9JnsSVazVZEb X3CsiGbvuYbKmb7BhDHOLyTgHZlL7BJsgUiFo0NGODq145PqFTrbO9zPrZTYujp388lE HkLlJ+38lOsKeRpf66FEubJTTtzT/S8YxpCEQrprr/aDifk1og577JPvkb/PokpAgsxg BKMnCIOuvz/mt+MQt+jVIvyPEck8G3sMD0W+3SOManD8sAZ97ONjv2uZr223SOJODC9S /J/YYZ1aBkvyMFcMjqq1uHIefAV/rDRUmo86IjTtaMxdALg2Lz+UBhaq7vVzwYXE1JjV KhpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686242718; x=1688834718; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MhlUHSjCott1id8KJIogub4pfDonQ0xqE0dvrfHZFP4=; b=KpdGn6fLOhaO9QbC6E8aDDkJRiCriXUM04J5nQ8/k3vDko273bJUpRNbUwF4wwkZXT 5m59U1kCcHMmZTdgU0N5CK3MbhzqBiFK39/JDFyW0wgiziTyB44SwjkIqfb55FJUgCy5 8/kAlqf2t4QXRKw4QL+k165GhEIZbB4ONcXVdCgzddZZl2veipzlOQYf5oV5XceUI3Jq gGUctPrTboYRsWWD5osvUFnsu54BRPv+/ht2QrBa8HE+qlu3w6JP/gHy58i1scP43hX/ 203GrdafHXMb7VmGiP1phpZeWZLeahE48FOlLTQ6PgEn+1bLV6asuf4DyQB8/nf2N0oy QJTA== X-Gm-Message-State: AC+VfDxg62sAp/i2LAfKGiksvxDQuIwifsFsAu6CVimEBs4NwrZTsPoq 72GhPdw/n9MwtwbYIjHZhUcMsQ06SQP/YlJmySc= X-Google-Smtp-Source: ACHHUZ6HLQsPCrWh9emADnwWR1GhDmxvw5IC52HVpKUFzpyrugIHtMllY/Aam+xLYo4S4rGDFJDZBg== X-Received: by 2002:a05:6a20:c183:b0:10c:41a6:ac1b with SMTP id bg3-20020a056a20c18300b0010c41a6ac1bmr4391790pzb.38.1686242717871; Thu, 08 Jun 2023 09:45:17 -0700 (PDT) Received: from localhost ([135.180.227.0]) by smtp.gmail.com with ESMTPSA id 76-20020a63054f000000b00520f316ebe3sm1424794pgf.62.2023.06.08.09.45.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jun 2023 09:45:15 -0700 (PDT) Subject: [PATCH] RISC-V: Stop referencing __global_pointer$ under PIC Date: Thu, 8 Jun 2023 09:44:37 -0700 Message-Id: <20230608164437.5575-1-palmer@rivosinc.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Cc: Jeff Law , Palmer Dabbelt From: Palmer Dabbelt To: libc-alpha@sourceware.org X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" This has some cascading fallout related to PC-relative references to SHN_ABS that Jim reported in [1]. I have a workaround for that issue in binutils [2], but GP isn't useful in PIC so we might as well just stop referencing it at all. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=24678 Link: https://inbox.sourceware.org/binutils/20230608155214.32435-1-palmer@rivosinc.com/T/#u Signed-off-by: Palmer Dabbelt --- I haven't tested thiis or the binutils patch. There's a handful of coupled issues here that might take a bit to untangle, but this came up in the RISC-V LLVM sync this morning so I figured it would be best to send something along. --- sysdeps/riscv/start.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sysdeps/riscv/start.S b/sysdeps/riscv/start.S index 6dfe65273f..5eaa8ccf2d 100644 --- a/sysdeps/riscv/start.S +++ b/sysdeps/riscv/start.S @@ -71,7 +71,9 @@ END (ENTRY_POINT) load_gp: .option push .option norelax +#if !(defined(__PIC__) || defined(__pic__) || defined(PIC) || defined(pic)) lla gp, __global_pointer$ +#endif .option pop ret