From patchwork Tue Apr 2 01:07:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 87904 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 40399385841B for ; Tue, 2 Apr 2024 01:08:12 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by sourceware.org (Postfix) with ESMTPS id 012A03858426 for ; Tue, 2 Apr 2024 01:07:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 012A03858426 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 012A03858426 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::532 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712020060; cv=none; b=kGzR7aGzjkLTFPjFKt2dYTajUn5XtLU43FekonzY0Hxr8AQTIjhgRmXTPcRLNNtKgbhxX4xOQGWti4+sNoKiSpA1jUenCkQJcP9wW1L/NyZ6q0XxaDPoiWXQs4FumY4t0IPSqbdDX1Ts5vkSfS5ole/NOaqHTOE05ehvInqSuis= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712020060; c=relaxed/simple; bh=71u+BSo8lN7mKlY3/FjGDnvgleY7wbMaCrrCoWWSxbk=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=BEJUcXyeWZY2qNj5gRvPIXa/rYeLkf2JC9kWsYSAmniPm2Phr4zADT5u1qAbLivq7XprEs9Pw22ZSVopYD+4efxFJtXmGVAtTYKSzpvQT9/d8+uqgsMngDw6EDyQCOlX8TR3uP221iqLaNUof+u38G1iYXIyGuEynvUBy1rf5Ig= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-5e8470c1cb7so2730251a12.2 for ; Mon, 01 Apr 2024 18:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712020058; x=1712624858; darn=sourceware.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=4U6pEyMkjMPvoJAU/iLl3LRWwLMNJtal/vNvyYMB88Y=; b=Vqf3QKERDuwB+fVemB5WnQdhxYlIVDB9hDdpgBEE8ZQeL69IKV62z/VZ7qQv4Qr0tm 8vK0MP2eKaKx+eKxBKeOcJPceXHSsJ9lt0hQ2Pb6yGzKaIZSQe7UBFqpBaPp34UonwUR PjZDFbReC8btV/GWSsypT6gujKANeIzTftWy4e4+lJzgnC3jefssYkfZQJuY/aR6uwOq 9znGyVSTCgFN3aWCfhgL7njlWModo9ujQJme7muHOnVLspbyactBJNqIfvm3t3UzBhXK 8ePjuUCA8Q8WativCa1tVX7vKQ8WIh0T+DOlrA0TO/fSnQsYCSGuWbhXsClCs7VqGH18 I2aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712020058; x=1712624858; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4U6pEyMkjMPvoJAU/iLl3LRWwLMNJtal/vNvyYMB88Y=; b=HV2A0JmQuXLZ561TM26u6GaIqpsEU6R8vrW14wHlv8uq2OULCkcCNhD6aLN8fsgxkF ur5XQEg87Dk900oI5TKXpNQJyDgPG/s5estuXOmW/JAzw1IEXrqQahumSWu2ZE8HnNzf J3b34Y+kdzlWA0onkwlZCRaNTkfIuEn0hblE2oGD1GJv4Vgi9JGdo2aQgHozkuW3SCcG FjDxaIo5qngIfs8KFCh8qpV9zuWIZLoSrlGcZfFtvRGTSpPGA5okJbiaB2RJxT/vBr3P VpvPjJcE74qE0u7mcmPCF5xmSSosjkOzQNQuhz5z2yrqQCjDw2dN4v/6U0fuX47KV09S XC4w== X-Gm-Message-State: AOJu0Yw4zLCACeDzsfBKx9JWsIEGL1/xFKXtyAT0bXCr31CeVIPGmu/e O8u4mgvLZWhJPidq/EJhlNrDkIG/3d7sknQESFOY6WPhsb/FzyHT X-Google-Smtp-Source: AGHT+IFwsabmUFeGxM+59kO47QM0pxCir5Izl+UhtuiXcAZAFORW7W+Mpcs9X9blStAnSaYshYmGkw== X-Received: by 2002:a17:90a:d251:b0:2a0:4a33:c3a6 with SMTP id o17-20020a17090ad25100b002a04a33c3a6mr8212353pjw.44.1712020057751; Mon, 01 Apr 2024 18:07:37 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id v12-20020a17090abb8c00b0029c13f9bd7fsm10415959pjr.34.2024.04.01.18.07.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 18:07:37 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 570231141590; Tue, 2 Apr 2024 11:37:35 +1030 (ACDT) Date: Tue, 2 Apr 2024 11:37:35 +1030 From: Alan Modra To: binutils@sourceware.org Cc: Chenghua Xu , "Maciej W. Rozycki" Subject: R_MIP16_GOT16 and R_MICROMIPS_GOT16 Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3033.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, 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 In rela howtos these relocations should not be using _bfd_mips_elf_got16_reloc. That special function is for extracting addends from section contents, and only for that (ie. it doesn't subtract gp). Make these rela howtos like the corresponding R_MIPS_GOT16 rela howto. * elf64-mips.c (mips16_elf64_howto_table_rela ): Use _bfd_mips_elf_generic_reloc. (micromips_elf64_howto_table_rela ): Likewise. * elfn32-mips.c (elf_mips16_howto_table_rela ): Likewise. (elf_micromips_howto_table_rela ): Likewise. OK? diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index b4509fb13f2..e83230cef97 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -1931,7 +1931,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_got16_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS16_GOT16", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -2675,7 +2675,7 @@ static reloc_howto_type micromips_elf64_howto_table_rela[] = false, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_got16_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MICROMIPS_GOT16", /* name */ false, /* partial_inplace */ 0, /* src_mask */ diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c index 3e9153cde14..432805aeeb2 100644 --- a/bfd/elfn32-mips.c +++ b/bfd/elfn32-mips.c @@ -1911,7 +1911,7 @@ static reloc_howto_type elf_mips16_howto_table_rela[] = false, /* pc_relative */ 0, /* bitpos */ complain_overflow_dont, /* complain_on_overflow */ - _bfd_mips_elf_got16_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MIPS16_GOT16", /* name */ false, /* partial_inplace */ 0, /* src_mask */ @@ -2655,7 +2655,7 @@ static reloc_howto_type elf_micromips_howto_table_rela[] = false, /* pc_relative */ 0, /* bitpos */ complain_overflow_signed, /* complain_on_overflow */ - _bfd_mips_elf_got16_reloc, /* special_function */ + _bfd_mips_elf_generic_reloc, /* special_function */ "R_MICROMIPS_GOT16", /* name */ false, /* partial_inplace */ 0, /* src_mask */