From patchwork Mon Apr 14 10:04:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Braun X-Patchwork-Id: 110369 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 C30723858401 for ; Mon, 14 Apr 2025 10:05:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C30723858401 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=sceen.net header.i=@sceen.net header.a=rsa-sha256 header.s=mail header.b=B/6c+gNC X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail.sceen.net (dalaran.sceen.net [IPv6:2001:41d0:1008:1a1d::1]) by sourceware.org (Postfix) with ESMTPS id 5F8A73858D3C for ; Mon, 14 Apr 2025 10:04:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5F8A73858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sceen.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sceen.net ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5F8A73858D3C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:41d0:1008:1a1d::1 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744625079; cv=none; b=wmowhm4jVt/VuJmtc0qm1drjw+9S2fq1tAisE6+OnWh0U3HJWdtj2WU0bOsz0s+6fp32fZQk0LoKKl26pnXVdnJGV3FIKqQBy2s0a1FOgxB25Gd9CqFafKOV/oOxMcYxP5gJnG0o3i+0w6SJtGNt9jIcvQYQ3WxPhITDnA5AjE0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744625079; c=relaxed/simple; bh=YfZL3qvnGIfS+ayWP0ApluKCfIYwouBx6K7GIeYY4gc=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=cu9tLg6hOyUf8GyMQ4XHDXuwZ9sX9cWMtzPEpaqcLZVKtSmJ3T9/cVIOEYcXSjjnKo/dQVYYliqOaItkj5oQ4Vrx6Kf+V9NfM/Rh/5gEuIzAvc7PpQK0fiVLr2xm9JJBDrDkL35SWm91BahfS9lVhW3ysL0CaAU4rJwkDd2M5C0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F8A73858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sceen.net; s=mail; t=1744625078; bh=YfZL3qvnGIfS+ayWP0ApluKCfIYwouBx6K7GIeYY4gc=; h=From:To:Subject:Date:From; b=B/6c+gNCSOUD6qs2gZDfdviQTpRNxz4VGeu39TCFqgtJJxNTaffT/CyyM9e39zdZX AJgrH1JI8FBlVNOCuaI3DRpDiBKROYIQqetqsYzmxrt9ORrRkekkPYCutgUvVtuwgP eSj4VK29v0iP84xqGW5Rlg1z4gcxziUvpnSDunDo= Received: by mail.sceen.net (Postfix, from userid 1000) id 25D3B40254; Mon, 14 Apr 2025 10:04:38 +0000 (UTC) From: Richard Braun To: binutils@sourceware.org Subject: [PATCH] c6x: Fix EHTYPE relocations Date: Mon, 14 Apr 2025 12:04:38 +0200 Message-Id: <20250414100438.2058167-1-rbraun@sceen.net> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 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~patchwork=sourceware.org@sourceware.org From: Richard Braun R_C6000_EHTYPE relocations are implemented as GOT-indirect relocations, but, as specified by the C6000 EABI (SPRAB89A), 13.5.1 Relocation Types, they are a special case of SBR (static base relocation). bfd/ * elf32-tic6x.c: Handle EHTYPE relocations as SBR relocations. gas/ * config/tc-tic6x.c (tic6x_fix_adjustable): Don't adjust EHTYPE relocations. Signed-off-by: Richard Braun --- bfd/elf32-tic6x.c | 8 ++++---- gas/config/tc-tic6x.c | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index afd8e0d2aff..7e29e24228d 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -1117,8 +1117,8 @@ static reloc_howto_type elf32_tic6x_howto_table_rel[] = complain_overflow_dont,/* complain_on_overflow */ bfd_elf_generic_reloc, /* special_function */ "R_C6000_EHTYPE", /* name */ - false, /* partial_inplace */ - 0, /* src_mask */ + true, /* partial_inplace */ + 0xffffffff, /* src_mask */ 0xffffffff, /* dst_mask */ false), /* pcrel_offset */ EMPTY_HOWTO (R_C6000_PCR_H16), @@ -2413,6 +2413,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd, case R_C6000_SBR_H16_B: case R_C6000_SBR_H16_H: case R_C6000_SBR_H16_W: + case R_C6000_EHTYPE: sbh = bfd_link_hash_lookup (info->hash, "__c6xabi_DSBT_BASE", false, false, true); if (sbh != NULL @@ -2442,7 +2443,6 @@ elf32_tic6x_relocate_section (bfd *output_bfd, case R_C6000_SBR_GOT_U15_W: case R_C6000_SBR_GOT_L16_W: case R_C6000_SBR_GOT_H16_W: - case R_C6000_EHTYPE: /* Relocation is to the entry for this symbol in the global offset table. */ if (htab->elf.sgot == NULL) @@ -2767,7 +2767,6 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_C6000_SBR_GOT_U15_W: case R_C6000_SBR_GOT_L16_W: case R_C6000_SBR_GOT_H16_W: - case R_C6000_EHTYPE: /* This symbol requires a global offset table entry. */ if (h != NULL) { @@ -2913,6 +2912,7 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_C6000_SBR_H16_B: case R_C6000_SBR_H16_H: case R_C6000_SBR_H16_W: + case R_C6000_EHTYPE: { /* These relocations implicitly reference __c6xabi_DSBT_BASE. Add an explicit reference so that the symbol will be diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c index 302043a2676..eb19309d5c9 100644 --- a/gas/config/tc-tic6x.c +++ b/gas/config/tc-tic6x.c @@ -2051,7 +2051,6 @@ tic6x_fix_adjustable (fixS *fixP) case BFD_RELOC_C6000_SBR_GOT_U15_W: case BFD_RELOC_C6000_SBR_GOT_H16_W: case BFD_RELOC_C6000_SBR_GOT_L16_W: - case BFD_RELOC_C6000_EHTYPE: return 0; case BFD_RELOC_C6000_PREL31: