Message ID | 547f08ff-9d6f-4b3a-8011-a713f88c17f2@suse.com |
---|---|
State | New |
Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> 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 DAD20385840B for <patchwork@sourceware.org>; Mon, 3 Feb 2025 11:42:23 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by sourceware.org (Postfix) with ESMTPS id 1F9FE3858C5F for <binutils@sourceware.org>; Mon, 3 Feb 2025 11:41:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1F9FE3858C5F 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 1F9FE3858C5F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::532 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738582901; cv=none; b=n3C8rN+Gj/coyNgsLdR1o+EQLsECIq1pQJG4Ey8vN/ogQlSjNxbDB1eLvKv0QoMByRGDcrfX6vN9m+bTkp2mcfFXtecRuhsgHHtuigP+k5sDyTnxJS/bZuB33K3BZWl5C/HLBq9vnVfX9rSJmY3tz5Blk8ThpN0TDYhEUFRNjmo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1738582901; c=relaxed/simple; bh=lyMpAbMu20W5L4DvkNKy5Al2APtb18ktM8rJj/5DIHM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=iwMmSwpB7zmWQEH4Ki+2eGREtpI/oVgcv9qO9AmPC425sBaMU3+sKkWmh+LKoQ+Ze445L9GoqTGNyCCCc5sVmVXfW72C1IP5e7h2VNLdJD5yLDlalqU+5nmHoJGpOpCgCfzrCMwr0y2nJTwBKM9lRvzdLms2CCjhPvlnxOiwZeg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5dca468c5e4so1924364a12.1 for <binutils@sourceware.org>; Mon, 03 Feb 2025 03:41:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1738582897; x=1739187697; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=kuRnnoSMlLSanBm0xUSJd12M0EEw9b+N6TN8AyIEFU4=; b=br4gQgKDqTB2kX4kcstKyvxK+hOmT2m2aKEXcRM0aUByVCD6KTFW+NqAhE5IVnDzwJ ER+OXNJgg8Xk8StTWBN5D2Cd9NtZQ+1luKEjku35eUVJCHemjzMc6A5s2dtcmtTmiERP 0DUbjM75VgkAV1cFdSRuxDa0NyTvV39c+Lq3o1ZaviVzKEFeokMD3hxQbiqj6ajY3T46 wx859nXKJbF5+bj6kBoNuMzKGoCz3WNA/XsqRgcMoHnjcGJfiXnSDFYyJ0JGoF6aI+M0 ANZ8S4Mf5luI6pvv54PFOCt3Yt+iGaFMa+4rs4P47yg1MUb61XhTJ8vfEQinXS1w9NYQ meJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738582897; x=1739187697; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kuRnnoSMlLSanBm0xUSJd12M0EEw9b+N6TN8AyIEFU4=; b=CkIj3KDN9JhsrrPHHSdeIgUirGNCb8l6WwMFHUvyE8SbY4/Xiimln+1+sIUb5+Pq74 JpKxsvbcZ+H7JBPAXVTyT/njj3JlUb94yxhz1eLR0TsQ/HH4a8ZFmMLR3nga4AgITUlD 03WWqEkaweh8dra+sRtInWFNWTG47bZ3jGkgaSqVwI0cb0zz9NVA1Wf26a+1fLAP35n1 DrERwK/OxGSTa6I846dtH4fQMmihwTNvtF0+MV0sJeM3+mUodGOQvf8ZaT2VAui71Dc/ LNS6bl1TOldlYTjJa06eWj3eR+08i8Zw67zDCuLsEqEV87Of7pXDz510zu+FjStRhJBh RuGA== X-Gm-Message-State: AOJu0YzREeyqWg7pqGxJn2Owed0xPHUIccX+jy5di4/4+u2yiL0M4tjB A021k8g4BU4Ox1txjTohzztws66HBuGe7t1o18Q2vr16afDaj+Bk2OTDK+L2vw9K16Xz3CrQUPg = X-Gm-Gg: ASbGncvTG5K7K6E9bST4C3XBiSXGOfo3EwQ4CF8McWRiz3y/rXCNJB+KqZ13gUi2zo3 nmtRse7z4KTHeS6Wz59Ux1oBgOMG620OcqwqGzqdg7rIgaiGRQxeUmJkr44a9eGO2bYisgx0pAr aziZphvtjfZz3dwAGFp7fcPanUgdtaI9SoB+FwC9NpKVq+je6EjmO6COQYmdOtaFpYFuOby7lTL R3Nq+EBCkUZhOYWbSCnelgO5eCq0ybF/FAO8uSpX0wPbFtuv30+ZdahbBfDaDOASw3HFZ8GbTSZ mQVFIYcXi02Z/KRoxdt9jua4s5upMWq/L/UgQnoYJMiWGSyNms36TXd5lLv9Z7Dr1aBcr27AWC4 0 X-Google-Smtp-Source: AGHT+IE9GLS6D5j70H9gE0PWcfIDKApHdGDRULto3tqaxMUeBURfGznKa/SakYHaQNd3Ak6if0pgLA== X-Received: by 2002:a17:907:7b89:b0:ab6:c4e0:2d18 with SMTP id a640c23a62f3a-ab6cfcc9f9amr2241760766b.16.1738582896803; Mon, 03 Feb 2025 03:41:36 -0800 (PST) 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 a640c23a62f3a-ab6e47cf29fsm740946966b.38.2025.02.03.03.41.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Feb 2025 03:41:36 -0800 (PST) Message-ID: <547f08ff-9d6f-4b3a-8011-a713f88c17f2@suse.com> Date: Mon, 3 Feb 2025 12:41:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 4/5] x86-64: further tighten convert-load-reloc checking From: Jan Beulich <jbeulich@suse.com> To: Binutils <binutils@sourceware.org> Cc: "H.J. Lu" <hjl.tools@gmail.com> References: <5bc20aeb-77a8-49c5-9aa1-3548ae39d462@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <5bc20aeb-77a8-49c5-9aa1-3548ae39d462@suse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3022.0 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 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 <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
Series |
x86: further GOT{,PCREL} related adjustments
|
|
Checks
Context | Check | Description |
---|---|---|
linaro-tcwg-bot/tcwg_binutils_build--master-arm | success | Build passed |
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 | success | Build passed |
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 | success | Test passed |
linaro-tcwg-bot/tcwg_binutils_check--master-arm | success | Test passed |
Commit Message
Jan Beulich
Feb. 3, 2025, 11:41 a.m. UTC
REX2.M affects what insn we're actually dealing with, so we better check this to avoid transforming (future) insns we must not touch.
Comments
On Mon, Feb 3, 2025 at 7:41 PM Jan Beulich <jbeulich@suse.com> wrote: > > REX2.M affects what insn we're actually dealing with, so we better check > this to avoid transforming (future) insns we must not touch. > > --- a/bfd/elf64-x86-64.c > +++ b/bfd/elf64-x86-64.c > @@ -2282,14 +2282,14 @@ elf_x86_64_convert_load_reloc (bfd *abfd > if (to_reloc_pc32) > return true; > > - if (opcode == 0x85) > + if (opcode == 0x85 && !(rex2 & (REX2_M << 4))) > { > /* Convert "test %reg, foo@GOTPCREL(%rip)" to > "test $foo, %reg". */ > modrm = 0xc0 | (modrm & 0x38) >> 3; > opcode = 0xf7; > } > - else if ((opcode | 0x38) == 0x3b) > + else if ((opcode | 0x38) == 0x3b && !(rex2 & (REX2_M << 4))) > { > /* Convert "binop foo@GOTPCREL(%rip), %reg" to > "binop $foo, %reg". */ > Please add a testcase to show it makes a difference. Thanks.
On 03.02.2025 23:41, H.J. Lu wrote: > On Mon, Feb 3, 2025 at 7:41 PM Jan Beulich <jbeulich@suse.com> wrote: >> >> REX2.M affects what insn we're actually dealing with, so we better check >> this to avoid transforming (future) insns we must not touch. >> >> --- a/bfd/elf64-x86-64.c >> +++ b/bfd/elf64-x86-64.c >> @@ -2282,14 +2282,14 @@ elf_x86_64_convert_load_reloc (bfd *abfd >> if (to_reloc_pc32) >> return true; >> >> - if (opcode == 0x85) >> + if (opcode == 0x85 && !(rex2 & (REX2_M << 4))) >> { >> /* Convert "test %reg, foo@GOTPCREL(%rip)" to >> "test $foo, %reg". */ >> modrm = 0xc0 | (modrm & 0x38) >> 3; >> opcode = 0xf7; >> } >> - else if ((opcode | 0x38) == 0x3b) >> + else if ((opcode | 0x38) == 0x3b && !(rex2 & (REX2_M << 4))) >> { >> /* Convert "binop foo@GOTPCREL(%rip), %reg" to >> "binop $foo, %reg". */ >> > > Please add a testcase to show it makes a difference. Hmm, not sure how such a testcase would look like. At least some of the involved opcodes have no meaning (yet) with REX2. But maybe I can construct something. Still I view it as unreasonable that such obvious omissions in earlier changes can't be corrected without investing a lot of time in trying to make up a situation where things would fail. Once again: Proof of _no failure_ should have been added when these optimizations were introduced. And that proof should have been extended when APX support was added. What you're effectively doing is to ask me to cover for earlier omissions. Jan
On Tue, Feb 4, 2025 at 6:04 PM Jan Beulich <jbeulich@suse.com> wrote: > > On 03.02.2025 23:41, H.J. Lu wrote: > > On Mon, Feb 3, 2025 at 7:41 PM Jan Beulich <jbeulich@suse.com> wrote: > >> > >> REX2.M affects what insn we're actually dealing with, so we better check > >> this to avoid transforming (future) insns we must not touch. > >> > >> --- a/bfd/elf64-x86-64.c > >> +++ b/bfd/elf64-x86-64.c > >> @@ -2282,14 +2282,14 @@ elf_x86_64_convert_load_reloc (bfd *abfd > >> if (to_reloc_pc32) > >> return true; > >> > >> - if (opcode == 0x85) > >> + if (opcode == 0x85 && !(rex2 & (REX2_M << 4))) > >> { > >> /* Convert "test %reg, foo@GOTPCREL(%rip)" to > >> "test $foo, %reg". */ > >> modrm = 0xc0 | (modrm & 0x38) >> 3; > >> opcode = 0xf7; > >> } > >> - else if ((opcode | 0x38) == 0x3b) > >> + else if ((opcode | 0x38) == 0x3b && !(rex2 & (REX2_M << 4))) > >> { > >> /* Convert "binop foo@GOTPCREL(%rip), %reg" to > >> "binop $foo, %reg". */ > >> > > > > Please add a testcase to show it makes a difference. > > Hmm, not sure how such a testcase would look like. At least some of > the involved opcodes have no meaning (yet) with REX2. But maybe I > can construct something. Still I view it as unreasonable that such > obvious omissions in earlier changes can't be corrected without > investing a lot of time in trying to make up a situation where > things would fail. Once again: Proof of _no failure_ should have > been added when these optimizations were introduced. And that proof > should have been extended when APX support was added. What you're > effectively doing is to ask me to cover for earlier omissions. > > Jan Again. No test, no issue, no change.
On 04.02.2025 11:10, H.J. Lu wrote: > On Tue, Feb 4, 2025 at 6:04 PM Jan Beulich <jbeulich@suse.com> wrote: >> >> On 03.02.2025 23:41, H.J. Lu wrote: >>> On Mon, Feb 3, 2025 at 7:41 PM Jan Beulich <jbeulich@suse.com> wrote: >>>> >>>> REX2.M affects what insn we're actually dealing with, so we better check >>>> this to avoid transforming (future) insns we must not touch. >>>> >>>> --- a/bfd/elf64-x86-64.c >>>> +++ b/bfd/elf64-x86-64.c >>>> @@ -2282,14 +2282,14 @@ elf_x86_64_convert_load_reloc (bfd *abfd >>>> if (to_reloc_pc32) >>>> return true; >>>> >>>> - if (opcode == 0x85) >>>> + if (opcode == 0x85 && !(rex2 & (REX2_M << 4))) >>>> { >>>> /* Convert "test %reg, foo@GOTPCREL(%rip)" to >>>> "test $foo, %reg". */ >>>> modrm = 0xc0 | (modrm & 0x38) >> 3; >>>> opcode = 0xf7; >>>> } >>>> - else if ((opcode | 0x38) == 0x3b) >>>> + else if ((opcode | 0x38) == 0x3b && !(rex2 & (REX2_M << 4))) >>>> { >>>> /* Convert "binop foo@GOTPCREL(%rip), %reg" to >>>> "binop $foo, %reg". */ >>>> >>> >>> Please add a testcase to show it makes a difference. >> >> Hmm, not sure how such a testcase would look like. At least some of >> the involved opcodes have no meaning (yet) with REX2. But maybe I >> can construct something. Still I view it as unreasonable that such >> obvious omissions in earlier changes can't be corrected without >> investing a lot of time in trying to make up a situation where >> things would fail. Once again: Proof of _no failure_ should have >> been added when these optimizations were introduced. And that proof >> should have been extended when APX support was added. What you're >> effectively doing is to ask me to cover for earlier omissions. > > Again. No test, no issue, no change. Again - please adjust your attitude. Jan
--- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2282,14 +2282,14 @@ elf_x86_64_convert_load_reloc (bfd *abfd if (to_reloc_pc32) return true; - if (opcode == 0x85) + if (opcode == 0x85 && !(rex2 & (REX2_M << 4))) { /* Convert "test %reg, foo@GOTPCREL(%rip)" to "test $foo, %reg". */ modrm = 0xc0 | (modrm & 0x38) >> 3; opcode = 0xf7; } - else if ((opcode | 0x38) == 0x3b) + else if ((opcode | 0x38) == 0x3b && !(rex2 & (REX2_M << 4))) { /* Convert "binop foo@GOTPCREL(%rip), %reg" to "binop $foo, %reg". */