From patchwork Mon Dec 11 03:33:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nelson Chu X-Patchwork-Id: 176450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6813374vqy; Sun, 10 Dec 2023 19:33:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0rMhYRUjtU6UZG/IOba8Q23wCDHILs4r4OjXlO6inl8CX1kK5cWEnyqS/adCXS8dtszwV X-Received: by 2002:a05:6214:2521:b0:67a:a721:d76d with SMTP id gg1-20020a056214252100b0067aa721d76dmr6983104qvb.83.1702265630276; Sun, 10 Dec 2023 19:33:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702265630; cv=pass; d=google.com; s=arc-20160816; b=JHQ+4+MxG6HtuptXyYEAW5A0SVX9a7vNC4dBWpisQUsvYIuI0MWzIsWlVdWlk8ug7y KvcAPigoJ7HqOx3FCsM6WX5Zd8nv28fVpZ62FiDiZn2ziO3DB2365RUFtTvrxqkXWctN u21TBfDl2rEj7kY11S/s8n4eiY2RxWpCcdJlCENKtcYyvr2aMQGmF8PXEzLcMcwt0PzY NAW/Au11T4VGKT55llWoF/atwr/XO72nXLq/m2bzIQvUbppXMFnI4Hi43UEu2KbzBTqA 5Z5SVeObsD+NnB+05fuDvqXDWpSO2FYxwGnWvoGdc4zsc6MMcPr/KGXoFl3heV6E0qOO BSWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:arc-filter :dmarc-filter:delivered-to; bh=/NyvKc/W3HD8fbAL3axX+A6UQCJrew/o5Rk/UPnNX+w=; fh=nbZjN6HISRwmy7XzsOIKfZEDzQG2j4KsA2dPJ7hdT0w=; b=m+r0qX2fnfwQ/jZ9OD7/xebanQg5J2aXvMJ1jzNqVapFZd5rqNTfPLVGEOhP9fAfuT yURY+30bkUIJLt7DIZXX4zmCnQK06ja5YeYWFKEcNFPZ10LW31yQOXLD37GV7lS6TWtI bNnifLrAnNtBzOzZXS+eG7W86Oja06vwprKrzYdfqH7JpdGBAHDRQLi6YYn5eqS48dYD AAmFiuppYA5oUZ8DWNYJ4D87CTgayHPBvFmvPYOK/aJKEwni8W1r3s5H/dLGGLIz92Hu myZ8vNsgc970URtZEwq6yHpLbQzAJRycBUpEAciCeh0x6tI5/hPqKH29RS0ROXSynldL 8Q7A== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g16-20020a0cf850000000b0067ac496e487si7357113qvo.481.2023.12.10.19.33.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 19:33:50 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0B5B33857BBE for ; Mon, 11 Dec 2023 03:33:50 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from NelsondeMBP.localdomain (114-25-74-237.dynamic-ip.hinet.net [114.25.74.237]) by sourceware.org (Postfix) with ESMTP id 1113B3858037 for ; Mon, 11 Dec 2023 03:33:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1113B3858037 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=none smtp.mailfrom=NelsondeMBP.localdomain ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1113B3858037 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=114.25.74.237 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702265626; cv=none; b=ErRfga36ebOr4rdz5uMh8+nSmKBXFWjYKNkRHg3+fuJ2NjG36iCqgZHAG2MpuKtBGrfJdgm3LvVgAqdNaIQeb6aopGzxxLaxyWPXBZ0mzaOyR99bzJWEw3jzBFxIhoU7XGANezcuk+41VBYhxn22jH3Q+Fw1hJ4aFxbY32uy9IM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702265626; c=relaxed/simple; bh=Ze4I9PXumenanhzQbwa/G7RnUEFLMwZc4jZW/lCxqcQ=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=R2C82UWtsodysVa8ToYzTOoRIpk+m1BZQbOhJC3mejvzBK6dgX4Tn89+yd9WnDUzN1hA2/Wfsm8VmjwFvIhEXbsjIX6dYh/6GH//201fQteoCO1JJ6lN8SkZCRJ/hyqxW+a04N3NQCxhQld++ozLTCFcsvXhMwAbr1eN227wf3s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by NelsondeMBP.localdomain (Postfix, from userid 501) id 1E2FB14BE28C; Mon, 11 Dec 2023 11:33:41 +0800 (CST) From: Nelson Chu To: binutils@sourceware.org Cc: Nelson Chu Subject: [committed] RISC-V/gas: Clarify the definition of `relaxable' in md_apply_fix Date: Mon, 11 Dec 2023 11:33:39 +0800 Message-Id: <20231211033339.19303-1-nelson@rivosinc.com> X-Mailer: git-send-email 2.39.3 (Apple Git-145) MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KHOP_HELO_FCRDNS, NO_DNS_FOR_FROM, RCVD_IN_PBL, RCVD_IN_SORBS_DUL, RDNS_DYNAMIC, SPF_HELO_NONE, SPF_NONE, 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: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784954885770800158 X-GMAIL-MSGID: 1784954885770800158 The `relaxable' in md_apply_fix means if the relocation can be relaxed or not in link-time generally. We can use `.option relax/norelax' to enable/disable relaxations for some specific areas, so the value of `riscv_opts.relax' will be changed dynamically. The `fixP->fx_tcbit' records the correct value of `riscv_opts.relax' for every relocation. Therefore, set `relaxable' to `riscv_opts.relax' will cause unexpected behavior for the following case, .option norelax lla a1, foo1 .option relax lla a2, foo2 .option norelax lla a3, foo3 For the current assembler, the final value of `riscv_opts.relax' is false, so the second `lla a2, foo2' won't have R_RISCV_RELAX relocation, but should have. gas/ * config/tc-riscv.c (md_apply_fix): Set the value of `relaxable' to `riscv_opts.relax' is wrong. It should be `true' generally. --- gas/config/tc-riscv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 9365b876ed5..d3b6543413e 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -4283,7 +4283,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) case BFD_RELOC_RISCV_PCREL_HI20: case BFD_RELOC_RISCV_PCREL_LO12_S: case BFD_RELOC_RISCV_PCREL_LO12_I: - relaxable = riscv_opts.relax; + relaxable = true; break; case BFD_RELOC_RISCV_ALIGN: