From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 011413858D1E for ; Fri, 2 Sep 2022 20:38:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 011413858D1E 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-x434.google.com with SMTP id c66so2983710pfc.10 for ; Fri, 02 Sep 2022 13:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=M2btXCMrZTnfhzMcKDO0T2KHPoXZomB5sDGmV7yAJXE=; b=KfdsPezR1oKaq3Zqb3nToJdEs1nF8IlsF0RNpuKksR6tWIed/ll59/S9b2wFx56B3q jUPdcNtiNo1vcZgvOv2SdLMGr6JkuqwWs47UV+wjsfsI5UtOVhfprSeqha+IsvMFHiBG iuwJd6YAFD9755wNejNsp/exLrDXCmVNNiel/ZPVriIiPbSnsdm+VF6uKc4d6pLJVT4l +f/VlgSKyj7hhFJIKeO15F6IXUYuoKR6jBlfGA32K4alD+XPkJi3CiOAKJeo9/lClIur SkN72/OIL0lGq9KJWM0y+vVXRDO5bzwO3/kq08cQKYiqYKckZwtWSkyeqc6wHVgTbR1+ MwKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=M2btXCMrZTnfhzMcKDO0T2KHPoXZomB5sDGmV7yAJXE=; b=UbP123fxMypkrvrVoMi5xIJWtaroZsdvuRH7et4eumK+S2WUltK2ADyMbOL6kvdfPn FmARgQHH3hScYle9P2/6z1V3RNI0qlILCnYjcI75M19NNlHbZl9q4I3vIeJpbsqnLFnz YfaK3ienIFDIzbh23ExC2iR75ZS+NyNaA61mdz9kHWg4HW9AAsfWwUfo3CvFZfpVWG1E ydSugbNXaLs0A/Rid5a1j4L72BMlzWKrQWj06q4PuoWKuFP6s4RsZHy2SDaVq3hYnoI4 JqyKuTjlnSzCeKPGA6lYhJ37eTfRvdVM69EDq0tJjyy5NraLBFWSjqCdYGcmNdldADCM WPxw== X-Gm-Message-State: ACgBeo3uidpU4HrC9LqMCa5qCyasMnN8369iodnG4W5hHUF5Fuw/iyqr GAMg7fFC/WdDszX7ziFpI8VX8w== X-Google-Smtp-Source: AA6agR7U0vyxzN3LeFNuu4JoM0TGgkydCeQyxjsbpidt/bTaDrmpnvqWvsmyRPHuoKsNfltR3AmsQg== X-Received: by 2002:a63:170d:0:b0:415:f76d:45e1 with SMTP id x13-20020a63170d000000b00415f76d45e1mr32003557pgl.171.1662151121893; Fri, 02 Sep 2022 13:38:41 -0700 (PDT) Received: from [192.168.50.116] (c-24-4-73-83.hsd1.ca.comcast.net. [24.4.73.83]) by smtp.gmail.com with ESMTPSA id z14-20020a1709027e8e00b001746f8be9b0sm2021799pla.124.2022.09.02.13.38.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Sep 2022 13:38:41 -0700 (PDT) Message-ID: <51ff4d6d-16be-579a-3a84-3f383c8d038e@rivosinc.com> Date: Fri, 2 Sep 2022 13:38:40 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 2/2] RISC-V: remove CM_PIC as it doesn't do much Content-Language: en-US From: Vineet Gupta To: Palmer Dabbelt Cc: collison@rivosinc.com, gnu-toolchain@rivosinc.com, Kito Cheng , philipp.tomsich@vrull.eu, gcc-patches@gcc.gnu.org References: <376353ac-6bfc-05c9-cb32-85e87eec177d@rivosinc.com> In-Reply-To: <376353ac-6bfc-05c9-cb32-85e87eec177d@rivosinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,KAM_STOCKGEN,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no 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 8/31/22 13:39, Vineet Gupta wrote: > > > On 8/31/22 07:57, Palmer Dabbelt wrote: >>>    if (flag_pic) >>> -    riscv_cmodel = CM_PIC; >>> +    riscv_cmodel = CM_MEDANY; >>> >>>    /* We get better code with explicit relocs for CM_MEDLOW, but >>>       worse code for the others (for now).  Pick the best default.  */ >> >> I'm fine either way on this one: having CM_PIC gone makes it a bit >> more likely to confuse CM_MEDANY with PIC, but flag_pic is overriding >> riscv_cmodel anyway so this isn't really used and deleting code is >> always a plus. > > Indeed this was the most contentious part of removing CM_PIC, but it > seems this is the way fwd. I'll add Kito's comment from [1] in code to > make it more explicit. > > [1]https://github.com/riscv-non-isa/riscv-c-api-doc/pull/11#issuecomment-686385585 I think I'll punt on this one, in the short-term. The reason being it affects USE_LOAD_ADDRESS_MACRO. #define USE_LOAD_ADDRESS_MACRO(sym) \ (!TARGET_EXPLICIT_RELOCS && \ ((flag_pic \ && ((SYMBOL_REF_P (sym) && SYMBOL_REF_LOCAL_P (sym)) \ || ((GET_CODE (sym) == CONST) \ && SYMBOL_REF_P (XEXP (XEXP (sym, 0),0)) \ && SYMBOL_REF_LOCAL_P (XEXP (XEXP (sym, 0),0))))) \ || riscv_cmodel == CM_MEDANY)) With the patch, PIC implies CM_MEDANY and thus will change codegen for pic non-local symbols to also use the load address macro. I think we want to go in the opposite direction, i.e. wean away from the asm macros and have gcc codegen natively. It seems there are bugs in that area so once we flush them out (after creating a few as I don't know of any existing documented ones) this will get cleaned out. Thx -Vineet