From patchwork Fri Mar 27 09:52:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 132359 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 678774B9DB71 for ; Fri, 27 Mar 2026 09:53:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 678774B9DB71 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=XrLLqDqg X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 69D374B9DB70 for ; Fri, 27 Mar 2026 09:53:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 69D374B9DB70 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 69D374B9DB70 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774605180; cv=none; b=Zpmty3TrqoQh7Roegz1EGSPr11ZMzVAKGYo0vHEG5gEXK+RqEggt2Hxdmea/hJb8Gq8QbT6n3unyf2tvTKC1HDeAUnFtIn+knNkGqqfdZqlKwhHivwvSeaDlNUB7FGuJpy7qKmt0UDPuXyUf+zM/b+jR0pmg4rXlqBrDwabs9bA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774605180; c=relaxed/simple; bh=qEEOeoHmjEhRErpK8aptCs5ffkp9a1PjYktnCntGeVQ=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=ir6Mc34iIsxGyw3pDowrnmfk9hlYs9wyESzo1tVgWj+vgsKcazsI5/Piy8fHl+SvpI7j00rqLxWAoFnP8ac/w4Vl3HthDaRlyWy2TzhlAtG7TEusy8C+8rW8iiPQRkRrH/+fas7jG0Psmc3+pkp0ei5tpLVztqC5VnLEepKxP44= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 69D374B9DB70 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-486ff3a0fc1so18784115e9.2 for ; Fri, 27 Mar 2026 02:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1774605179; x=1775209979; 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=2AuFS71B1Wnc8L0pinQIeFaa3YT/l6gANlioYBt3Zow=; b=XrLLqDqgB8Z7OmmZ/fevy0+ySFZFPtMjUfvBIOqAm/fLJafNxddVx8hyC/Utb+Ccc8 aSjzuKxC6zJJvoPDubrzdlNnIjmQiTRO7Fr0A/NPG08Uc+7FCG7r7cyyC2jMtD7lgFqT QR6ccR8ZeiMqDKovRKA9HRIeUHCKzE+XjITsI3jrq1wFZUL2ZhN6vAticO2US1HaEY+K sTFNBBssbJrdaYugxk/JYolPF0GIoO/YRCry9tGUvFcKGyJh9pew1DotuwECcjHY0m3J xk8FvjSm0BLm97NYetBnyDHx68qWOAPBUPet8wuP6yyyPseGejh/R1rB6YqOGC1TlC4G ZjoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774605179; x=1775209979; 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:subject:date:message-id :reply-to; bh=2AuFS71B1Wnc8L0pinQIeFaa3YT/l6gANlioYBt3Zow=; b=dpEzKQerbYjaz9V1/iuMwwXvOtZCJnO5LxjgG2DjKmM1dpGOveGLVThZVjA+5ZpeQz K3/JvbF/O7JOnEXiWUpTrPL6CD1x2AbaotXTmp84YGVsj6Z1Ru8luz9auPzGzJwPbSKr oguhbaeE0MecxXaJ01cjgQzD9IPO96ldU90pg8wH7ZEXv8RnQ0b2X8edOFkGrkhP2GUo SXUwvq3gddLp346X5wsxpo2W85ZrSAGjBeE1mAG4eS8tgihTwORZCl0LcD5zNPwGScqd jj/fjKjAaMq6nILpkVoWtB3BqI0g8JFeUXgaWV+M56F1I5cK9CJqZtIkT8X1H6ef6C5S veVQ== X-Gm-Message-State: AOJu0Yy1rtaQed86qGviRzZCU0ljY/tChb333G2on1RuaoT6u8Z42GAf tI078+7W2W+eGuizLdBlk/heVEndATUUE5e3fdUKCJnn0PVH2g2Z9e2ygxNYFl7lfWuTquDWOcq taVcchw== X-Gm-Gg: ATEYQzwcy542htWl7mXxVF0Z5vCuTroVI3unu5D+wrUi9iEr0gOU/PofumSvj8iRNFa E/Tn+jItEhi1vYzDAkSNIugHzN6I3xH1IlM/9QSm//xN0CKH9YcBLwrqeyPJorgEGI7gj7B0TIT YAmhc8dVt50+rLjwFEFEljqKiRRlnYjt/CWIfML9HQZocZbdcQBrhzW5OdwonYKbhJCi00hm8PT aPvWn9cbNeEp3FfAHGeTcPNEj1d203j3FQBoU52t9YcW5lr6MHvfalK6iBGwtOzRdUDvxMuKuGB xB9KgF0gNVT2yhlW5dbELDe+iORTOEvz6AzIEfVUDk076IE5D97kZRY2dmGBzYhGeWuo/1iHbZZ A7pfGPoo+5FrePgAz8OJIc9zUmlheTcI8j6NW+zXNu065FrabVm8EKBUH5FrKguXP7zoHXcNOAj eOK0fa0ZtEYVW43+bTp+E13zJNqGWVI04fi4jFVnUAx4EKC1ASptk7igmiu/l9kfXdzkibTbylM ArkPkYTMekMm8s= X-Received: by 2002:a05:600c:c113:b0:487:1114:d431 with SMTP id 5b1f17b1804b1-48727ec3c36mr22198905e9.18.1774605179195; Fri, 27 Mar 2026 02:52:59 -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 5b1f17b1804b1-48722d38a5fsm80636985e9.12.2026.03.27.02.52.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Mar 2026 02:52:58 -0700 (PDT) Message-ID: <38e100ce-872d-4cab-913c-1f3c14752a6e@suse.com> Date: Fri, 27 Mar 2026 10:52:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v2 2/6] bfd/s390+sh: don't abuse BFD_RELOC_32_GOT_PCREL From: Jan Beulich To: Binutils References: <2751d8ad-591b-4226-aeaa-a873270bce29@suse.com> Content-Language: en-US Cc: Andreas Krebbel , Jens Remus Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3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.com> X-Spam-Status: No, score=-3016.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED, 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. --- v2: Move BFD_RELOC_390_GOT32 down a little. --- 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, @@ -5379,6 +5380,9 @@ enum bfd_reloc_code_real /* 16 bit GOT offset. */ BFD_RELOC_390_GOT16, + /* 32 bit GOT offset. */ + BFD_RELOC_390_GOT32, + /* PC relative 12 bit shifted by 1. */ BFD_RELOC_390_PC12DBL, --- 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", @@ -2383,6 +2384,7 @@ static const char *const bfd_reloc_code_ "BFD_RELOC_390_GOT12", "BFD_RELOC_390_GOTPC", "BFD_RELOC_390_GOT16", + "BFD_RELOC_390_GOT32", "BFD_RELOC_390_PC12DBL", "BFD_RELOC_390_PLT12DBL", "BFD_RELOC_390_PC16DBL", --- 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 @@ -4915,6 +4917,10 @@ ENUM ENUMDOC 16 bit GOT offset. ENUM + BFD_RELOC_390_GOT32 +ENUMDOC + 32 bit GOT offset. +ENUM BFD_RELOC_390_PC12DBL ENUMDOC PC relative 12 bit shifted by 1. --- 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) \