From patchwork Fri Mar 13 09:55:43 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 131665 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id CE8754B1A2BE for ; Fri, 13 Mar 2026 09:57:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CE8754B1A2BE Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=Fdu5TbkV X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 5D9074BA2E19 for ; Fri, 13 Mar 2026 09:55:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5D9074BA2E19 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5D9074BA2E19 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::334 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773395746; cv=none; b=bS/iaj8LY5WetLQBTNB1TeJbp+WRxIEqlTcE542HNGy7lBmV34C9ciiVQvCkQvBVVy56vbG2mLgdd8yLsVcXuNiS7JEv/IcjOpCnvluOVkbZcmmdoSvIEPdNZZET8FlNA4FGxYTvxU/EWqSk/L8O8pZalMNUC4M2JROQX7aNAbM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773395746; c=relaxed/simple; bh=kzgKtJ4ZvY4qH7T6jhE4JXBRCSnc5GVvoiKcICn0Wfw=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=giUV0dtvxNP0ixTg4NxQSRqkqRSBzVC1DdzbhbtCswNAd61m4ELCY6zMoWtv9b53HPU7PHjveipuc8XjUiclhx7HQ0tuiKl14w4d0WfNZo01j17VKvQlnvBiNuFLZARLjDsodWX/By9g0Fuwwt1/5RHHeqaPYvY7wI9i+veSANI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D9074BA2E19 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-485392de558so12408095e9.1 for ; Fri, 13 Mar 2026 02:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773395745; x=1774000545; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:cc:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=SOT1M8Qf+5DM08tTokDWK7qQ0E4u3VVyYhNwPfxbJSM=; b=Fdu5TbkV3o9BdfuKyD3xohz96Y+fIM2EBHb/nN5e9xFe05FUTa61pw8xuqJJcW8pTf TGpxx+NgvZd+jo6mQI3OtQMrvhLxdj++WMwd8DZCMzbhqlY992GbKBsFayFE48UdpCwu XT9hZotc3FfamToZjiLqgSlmo0Eb2261iMiGCY0BqReDzH4XA+FDriZKM5og/rHb3VGi +OBufxpNMBFyzJT+H7+xX6wlOzB1LPrnXhYzrBPafWFuinEHLGU1CFXDunYIMOKGftIt tmFSyOQTi+hBxsHpEc9b4G5VzA0S+2+R9O4EDEmzbD+qiwhLEQkM/FlGs1g59VUSoY60 c4nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773395745; x=1774000545; h=content-transfer-encoding:in-reply-to:autocrypt:cc:content-language :references:to:from:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:sub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9K7dtMREvsTTDJcRBegjK wuJTPiA7v4sGmoO7729vCojDw== X-Received: by 2002:a05:600c:3552:b0:485:3a59:99ca with SMTP id 5b1f17b1804b1-485566fab0bmr36952555e9.16.1773395745114; Fri, 13 Mar 2026 02:55:45 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439fe22e9ddsm13673483f8f.37.2026.03.13.02.55.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Mar 2026 02:55:44 -0700 (PDT) Message-ID: Date: Fri, 13 Mar 2026 10:55:43 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 5/8] bfd/s390+sh: don't abuse BFD_RELOC_32_GOT_PCREL From: Jan Beulich To: Binutils References: <76acf518-e951-4737-8444-6718df6ce778@suse.com> Content-Language: en-US Cc: Andreas Krebbel , Alexandre Oliva Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wj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Spam-Status: No, score=-3016.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on 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 Neither R_390_GOT32 nor R_SH_GOT32 are PC-relative relocations, so don't use a generic PC-relative enumerator for them. Doing so gets in the way of properly using that enumerator. --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -4286,6 +4286,7 @@ enum bfd_reloc_code_real BFD_RELOC_SH_RELATIVE64, BFD_RELOC_SH_GOT10BY4, BFD_RELOC_SH_GOT10BY8, + BFD_RELOC_SH_GOT32, BFD_RELOC_SH_GOTPLT10BY4, BFD_RELOC_SH_GOTPLT10BY8, BFD_RELOC_SH_GOTPLT32, @@ -5373,6 +5374,9 @@ enum bfd_reloc_code_real /* 12 bit GOT offset. */ BFD_RELOC_390_GOT12, + /* 32 bit GOT offset. */ + BFD_RELOC_390_GOT32, + /* 32 bit PC relative offset to GOT. */ BFD_RELOC_390_GOTPC, --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -199,7 +199,7 @@ elf_s390_reloc_type_lookup (bfd *abfd AT return &elf_howto_table[(int) R_390_PC32]; case BFD_RELOC_390_GOT12: return &elf_howto_table[(int) R_390_GOT12]; - case BFD_RELOC_32_GOT_PCREL: + case BFD_RELOC_390_GOT32: return &elf_howto_table[(int) R_390_GOT32]; case BFD_RELOC_32_PLT_PCREL: return &elf_howto_table[(int) R_390_PLT32]; --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -353,7 +353,7 @@ static const struct elf_reloc_map sh_rel { BFD_RELOC_SH_TLS_DTPMOD32, R_SH_TLS_DTPMOD32 }, { BFD_RELOC_SH_TLS_DTPOFF32, R_SH_TLS_DTPOFF32 }, { BFD_RELOC_SH_TLS_TPOFF32, R_SH_TLS_TPOFF32 }, - { BFD_RELOC_32_GOT_PCREL, R_SH_GOT32 }, + { BFD_RELOC_SH_GOT32, R_SH_GOT32 }, { BFD_RELOC_32_PLT_PCREL, R_SH_PLT32 }, { BFD_RELOC_COPY, R_SH_COPY }, { BFD_RELOC_GLOB_DAT, R_SH_GLOB_DAT }, --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -213,7 +213,7 @@ elf_s390_reloc_type_lookup (bfd *abfd, return &elf_howto_table[(int) R_390_PC32]; case BFD_RELOC_390_GOT12: return &elf_howto_table[(int) R_390_GOT12]; - case BFD_RELOC_32_GOT_PCREL: + case BFD_RELOC_390_GOT32: return &elf_howto_table[(int) R_390_GOT32]; case BFD_RELOC_32_PLT_PCREL: return &elf_howto_table[(int) R_390_PLT32]; --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -1791,6 +1791,7 @@ static const char *const bfd_reloc_code_ "BFD_RELOC_SH_RELATIVE64", "BFD_RELOC_SH_GOT10BY4", "BFD_RELOC_SH_GOT10BY8", + "BFD_RELOC_SH_GOT32", "BFD_RELOC_SH_GOTPLT10BY4", "BFD_RELOC_SH_GOTPLT10BY8", "BFD_RELOC_SH_GOTPLT32", @@ -2381,6 +2382,7 @@ static const char *const bfd_reloc_code_ "BFD_RELOC_RX_RELAX", "BFD_RELOC_390_12", "BFD_RELOC_390_GOT12", + "BFD_RELOC_390_GOT32", "BFD_RELOC_390_GOTPC", "BFD_RELOC_390_GOT16", "BFD_RELOC_390_PC12DBL", --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -3200,6 +3200,8 @@ ENUMX ENUMX BFD_RELOC_SH_GOT10BY8 ENUMX + BFD_RELOC_SH_GOT32 +ENUMX BFD_RELOC_SH_GOTPLT10BY4 ENUMX BFD_RELOC_SH_GOTPLT10BY8 @@ -4907,6 +4909,10 @@ ENUM ENUMDOC 12 bit GOT offset. ENUM + BFD_RELOC_390_GOT32 +ENUMDOC + 32 bit GOT offset. +ENUM BFD_RELOC_390_GOTPC ENUMDOC 32 bit PC relative offset to GOT. --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -1107,7 +1107,7 @@ s390_lit_suffix (char **str_p, expressio if (nbytes == 2) reloc = BFD_RELOC_390_GOT16; else if (nbytes == 4) - reloc = BFD_RELOC_32_GOT_PCREL; + reloc = BFD_RELOC_390_GOT32; else if (nbytes == 8) reloc = BFD_RELOC_390_GOT64; } @@ -1271,7 +1271,7 @@ s390_elf_cons (int nbytes /* 1=.byte, 2= static bfd_reloc_code_real_type tab4[] = { BFD_RELOC_UNUSED, /* ELF_SUFFIX_NONE */ - BFD_RELOC_32_GOT_PCREL, /* ELF_SUFFIX_GOT */ + BFD_RELOC_390_GOT32, /* ELF_SUFFIX_GOT */ BFD_RELOC_32_PLT_PCREL, /* ELF_SUFFIX_PLT */ BFD_RELOC_UNUSED, /* ELF_SUFFIX_GOTENT */ BFD_RELOC_32_GOTOFF, /* ELF_SUFFIX_GOTOFF */ @@ -2396,7 +2396,7 @@ tc_s390_fix_adjustable (fixS *fixP) || fixP->fx_r_type == BFD_RELOC_390_GOT12 || fixP->fx_r_type == BFD_RELOC_390_GOT20 || fixP->fx_r_type == BFD_RELOC_390_GOT16 - || fixP->fx_r_type == BFD_RELOC_32_GOT_PCREL + || fixP->fx_r_type == BFD_RELOC_390_GOT32 || fixP->fx_r_type == BFD_RELOC_390_GOT64 || fixP->fx_r_type == BFD_RELOC_390_GOTENT || fixP->fx_r_type == BFD_RELOC_390_GOTPLT12 @@ -2443,7 +2443,7 @@ tc_s390_force_relocation (struct fix *fi { case BFD_RELOC_390_GOT12: case BFD_RELOC_390_GOT20: - case BFD_RELOC_32_GOT_PCREL: + case BFD_RELOC_390_GOT32: case BFD_RELOC_32_GOTOFF: case BFD_RELOC_64_GOTOFF: case BFD_RELOC_390_PLTOFF16: @@ -2728,7 +2728,7 @@ md_apply_fix (fixS *fixP, valueT *valP, if (fixP->fx_done) md_number_to_chars (where, value, 4); break; - case BFD_RELOC_32_GOT_PCREL: + case BFD_RELOC_390_GOT32: case BFD_RELOC_390_PLTOFF32: case BFD_RELOC_32_PLT_PCREL: case BFD_RELOC_390_GOTPLT32: --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -340,7 +340,7 @@ sh_check_fixup (expressionS *main_exp, b case BFD_RELOC_SH_DISP20: switch (exp->X_md) { - case BFD_RELOC_32_GOT_PCREL: + case BFD_RELOC_SH_GOT32: *r_type_p = BFD_RELOC_SH_GOT20; break; @@ -3313,7 +3313,7 @@ bool sh_fix_adjustable (fixS *fixP) { if (fixP->fx_r_type == BFD_RELOC_32_PLT_PCREL - || fixP->fx_r_type == BFD_RELOC_32_GOT_PCREL + || fixP->fx_r_type == BFD_RELOC_SH_GOT32 || fixP->fx_r_type == BFD_RELOC_SH_GOT20 || fixP->fx_r_type == BFD_RELOC_SH_GOTPC || fixP->fx_r_type == BFD_RELOC_SH_GOTFUNCDESC @@ -3670,7 +3670,7 @@ md_apply_fix (fixS *fixP, valueT *valP, case BFD_RELOC_SH_TLS_IE_32: S_SET_THREAD_LOCAL (fixP->fx_addsy); /* Fallthrough */ - case BFD_RELOC_32_GOT_PCREL: + case BFD_RELOC_SH_GOT32: case BFD_RELOC_SH_GOT20: case BFD_RELOC_SH_GOTPLT32: case BFD_RELOC_SH_GOTFUNCDESC: @@ -3962,7 +3962,7 @@ sh_parse_name (char const *name, else if ((next_end = sh_end_of_match (next + 1, "GOTPLT"))) reloc_type = BFD_RELOC_SH_GOTPLT32; else if ((next_end = sh_end_of_match (next + 1, "GOT"))) - reloc_type = BFD_RELOC_32_GOT_PCREL; + reloc_type = BFD_RELOC_SH_GOT32; else if ((next_end = sh_end_of_match (next + 1, "PLT"))) reloc_type = BFD_RELOC_32_PLT_PCREL; else if ((next_end = sh_end_of_match (next + 1, "TLSGD"))) --- a/gas/config/tc-sh.h +++ b/gas/config/tc-sh.h @@ -202,7 +202,7 @@ extern bool sh_fix_adjustable (struct fi #define TC_FORCE_RELOCATION_LOCAL(FIX) \ (GENERIC_FORCE_RELOCATION_LOCAL (FIX) \ || (FIX)->fx_r_type == BFD_RELOC_32_PLT_PCREL \ - || (FIX)->fx_r_type == BFD_RELOC_32_GOT_PCREL \ + || (FIX)->fx_r_type == BFD_RELOC_SH_GOT32 \ || (FIX)->fx_r_type == BFD_RELOC_SH_GOTPC) #define TC_FORCE_RELOCATION_SUB_LOCAL(FIX, SEG) \