From patchwork Fri Dec 8 07:00:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 175618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5284685vqy; Thu, 7 Dec 2023 23:00:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMDDA9eDvGVo3N98utMrlIzLVhqd57+V1KgdDA43ReuzQjwbwaB+OYrOxdKE/c1bAzmXEv X-Received: by 2002:a05:620a:4506:b0:77f:1a1:3004 with SMTP id t6-20020a05620a450600b0077f01a13004mr3079772qkp.25.1702018812654; Thu, 07 Dec 2023 23:00:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702018812; cv=pass; d=google.com; s=arc-20160816; b=gNyzLzWDdMQ/Uh6DaaEQabE/L3YqQPS/u6KV4yMqFeMj1jFZLj3yqzxpAi5I6UHiYp 4+gQblsjfYxQVQogrHvHEPOK+bapYGZ2Vi+CwTE+QT12Q9P2Gl2D0gWGbYuPjLHpDFmG +8LFF2X0TCr0PqK5/zyr7RbTV4rUbAtWf4c3FmF2M5UECAvOHaDeCJiU8WSkj2UcmfN0 meYH34vUItYxO0a6VJu56EcMLCnN12XoNIKD3XJ8of58qLdqDCs7hizEpPEIX1rSvuAo DtSWuacKSM/OLn+rKxsObPviGr5RCectWW5jYMnzanUBNSCJHrWsmIwTKpoaSz0Pfb2G au1Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :in-reply-to:autocrypt:references:cc:to:from:content-language :subject:user-agent:mime-version:date:message-id:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=D8F+nbpjIDwVYIU7SMswb4IWfv8CxGll2c3BiIpZJSs=; fh=8WW8/k0o0G2vlJiZAQKLzwZ5FShsw2CjyMds4OH6804=; b=bBX1u/9pb6N+uMTuDSt6s3vUEee0SUk/8BImw/vpMB/SMZ7dByzRM/pAEY/C/xRjsM WVzSHGkwUr5iAlzTVkuQQl70QcEubHx9cUhaprDgAzjvdPwoCWEBIp9EhP3Lm4BYEvAQ 3Z/L+6eJ0jBQatQ6E2z+ZIda3XrOP+qHR3ZxgA0Q9Gm2B0X9f91HQinFi+YuhwqeOzV4 OodZe7wIJ14P+GUuk5ueOVaGb6KpPxqXGGX1/KjAPnN1ZY0YQ9JIP4SfbZluETKpaod4 5MTysWKeC3SqPrCcSRXvO/FVKhLvstWvCuRa05Hlu11nN3sHYS3KoJGGgUhK4kCDohs/ ODPA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=YvjvXL4S; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id bq15-20020a05620a468f00b0077f01ec7b93si1512452qkb.560.2023.12.07.23.00.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 23:00:12 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=YvjvXL4S; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6B670385828B for ; Fri, 8 Dec 2023 07:00:12 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id 3115D3858CDB for ; Fri, 8 Dec 2023 07:00:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3115D3858CDB 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 3115D3858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::430 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702018807; cv=none; b=QC5Bkl1jWvWFQ9mhZa4wiebJsi862kjkDQLcZYKZB8kFlbqXhE9/dakdTkrV6UHl+Au924nT2VeD5Q2gxWv+TX0QLphiQd4rUdrRj2VnBmAJKkwumoIqjXHippfeeJ70oT20kJfCT2HrAoHv0BsRADE0k2B7VXtIhuCrmZHek8M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702018807; c=relaxed/simple; bh=sYtqCmH5KW/8IIns8rt06bchVWCAXn7SSLmMBOu+c7A=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=s5sXU/SPNfETlnA30rX79fekobu8jJtnsII2puR7sHeAwjebUyEc/vuDlzx4gBKaS7Aww7S5omyEICab6awRD7l8O2g7agnol38i5/WGw0pUtCqA9F/W31jbybgvAl8PFJYhJZT20cLZ96Dch8p+Dxt9dtrktne79FVaSfYyj28= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-33330a5617fso1855518f8f.2 for ; Thu, 07 Dec 2023 23:00:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1702018805; x=1702623605; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=D8F+nbpjIDwVYIU7SMswb4IWfv8CxGll2c3BiIpZJSs=; b=YvjvXL4SKH7oCeK73TtEAYS4ekat0yxMjPgX4VvKFTIHTfaVL4FXpzeGLxuBJBtQqX EdxtCHOgzLONUqwB6jeQulX/fpx1Tzl+rbjvAWPmf1xCj4l0MVCFa7xORJacCSbLUgGi VGO6OxcO8d6A+rGWG8GuwRrAwMNJzHYEphQLydgWWDVi0x3hV016dB46h2nzFY6HcHje 46aFshrnYhR/O9UiJfzRxjbJBbEVdSCArAWzad9Ya/Wa9aflONwj4UK2rToLolAMbUF7 JhODrJpNuWID3GJVp/ZdI7C5qixFvDhmX3wRGABvauKO4BRUqOiLIVtA3W1hdi3KTEGd Ab8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702018805; x=1702623605; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=D8F+nbpjIDwVYIU7SMswb4IWfv8CxGll2c3BiIpZJSs=; b=GrSqoFDDkJbNvDq+Wq2aSvxVcfBC1B9kprvktZLzq8YTy3kGj+G9D3RjlFoKzf29m2 BCMhjXUm10Djn32/Tikmgkn9fouck2zBT/sZPoNJEw3FDS+Z7IiS5ZDJfTYyoCiHyeHl h7ZeyE1oGxTEsFarF3TzkyVuaue9CEkZnkI8F87Bd6i0b/jmr0UNFMCWtCL46bbL3PG3 PxPK9TEU06O0KLhsXUa7/1ypx10niGTL9HyYuw9NT8dXXnzozik4g3MqdqxRk0eiVs6G ScG/tKck6ukc8v5ZMqn82aCjeqGM5NuzKRSVmQi73E01fdHnCgZSeGHg1xBF2BtHjVdC qQMQ== X-Gm-Message-State: AOJu0YxZPnvqdmLXyubeG4MUJhMnlBE5HvR+eCWY9ID2WQPDqDPCb3WZ J7+tYPjQ1w9ZiE0he14BcZkYqUcqjqFRc+CTU8MU X-Received: by 2002:a5d:61d1:0:b0:333:11c:1c79 with SMTP id q17-20020a5d61d1000000b00333011c1c79mr2627052wrv.71.1702018805023; Thu, 07 Dec 2023 23:00:05 -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 w13-20020a5d404d000000b003333f9200d8sm1320385wrp.84.2023.12.07.23.00.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Dec 2023 23:00:04 -0800 (PST) Message-ID: Date: Fri, 8 Dec 2023 08:00:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/3] x86: don't needlessly override .bss Content-Language: en-US From: Jan Beulich To: Binutils Cc: "H.J. Lu" References: <9853a641-73fc-4d47-83aa-1402464d2920@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSR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kkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <9853a641-73fc-4d47-83aa-1402464d2920@suse.com> X-Spam-Status: No, score=-3026.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784696078362314837 X-GMAIL-MSGID: 1784696078362314837 ELF, COFF, and Mach-O all have custom handlers for .bss. Don't override those; install a handler only for a.out. --- v2: New. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -181,7 +181,7 @@ static const reg_entry *build_modrm_byte static void output_insn (const struct last_insn *); static void output_imm (fragS *, offsetT); static void output_disp (fragS *, offsetT); -#ifndef I386COFF +#ifdef OBJ_AOUT static void s_bss (int); #endif #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) @@ -1201,9 +1201,10 @@ const pseudo_typeS md_pseudo_table[] = {"align", s_align_ptwo, 0}, #endif {"arch", set_cpu_arch, 0}, -#ifndef I386COFF +#ifdef OBJ_AOUT {"bss", s_bss, 0}, -#else +#endif +#ifdef I386COFF {"lcomm", pe_lcomm, 1}, #endif {"ffloat", float_cons, 'f'}, @@ -15475,17 +15476,13 @@ md_pcrel_from (fixS *fixP) return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address; } -#ifndef I386COFF +#ifdef OBJ_AOUT static void s_bss (int ignore ATTRIBUTE_UNUSED) { int temp; -#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) - if (IS_ELF) - obj_elf_section_change_hook (); -#endif temp = get_absolute_expression (); subseg_set (bss_section, (subsegT) temp); demand_empty_rest_of_line (); From patchwork Fri Dec 8 07:01:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 175625 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5285272vqy; Thu, 7 Dec 2023 23:01:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IG41Xj8ILp2sU6QoDBeUJf7vP5VhlnFOHXSVUANE4w6LqNVdpRI0LF2cqjp+zStPDuLtOBR X-Received: by 2002:a05:620a:8bc7:b0:77d:858a:59d4 with SMTP id qy7-20020a05620a8bc700b0077d858a59d4mr2387037qkn.76.1702018871609; Thu, 07 Dec 2023 23:01:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702018871; cv=pass; d=google.com; s=arc-20160816; b=k/rlPbOfpmFEcZzIPLpYOaz7V9h5lWrm07vtG3rEUvkFtibkAoKX/c4Pn85wXjru3Q d1XKseyo9cdyJNnEsUpuSoDy4tiVycn7nfEl0kH0ofqQnZAo3hEfXAyXJQfY9vGHV78I HuXojVr0GnQlgtL8V5sXVxO5TyYPBFZnlyhwLZTbeUBUH0OsMW0JpcDnr25cXfDxLvAy Pm8AzzU7r6E7kWCVCHNHcZSiBBCOBUmZ07tlRHWhlHi2TAwm+SHzsiQGaTaWQMtL0Ucv OLXZmXiIbAqWRptDulXgRqZBhTPdcHQjuNglRnP9HJW09zhAptXbocnPkIu4FBdc2e8r PdBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :in-reply-to:autocrypt:references:cc:to:from:content-language :subject:user-agent:mime-version:date:message-id:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=4BdgSN6Q+dFt/fmKvpVaTFIZWZv+UzVVCGfpqCTC6ow=; fh=N+eXygmSRUxdc8YE6GPijdbTbFeWQ6MQWucBFkCyAS8=; b=x+JJcEOmWlj7pKThtrbXS3iAM17XTX477Wdv3jeROeHAqwXG2BG95v3tTk2NfrZg6k pJG+EkzwowSnU0DDgj5I6gGh7inIlXxAVxfIAX4lgmoQTn8L99MJWOnjtcVtJDGzZAYt CauoxtglR6I1Eet6KXu9xkGymbscvjqNq4B+gJ1MP2pqd7vqxfDhb66ea0m+emkRwNES edp7tEvSFfom0ZDZwy3KJRXh+8iAQSmoetx1Rqc6mBWWSYA2o+e/g3FsiJBkGSMej/H6 V8aio29MKMAc+J3MgOVf9qEFWE1hxx31M612zJxxz28YPIbcy0I56fpyJj3ninRWskKV RUnw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=Ek4ZAsHd; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b15-20020a05620a088f00b0077d7cf1f472si1449827qka.373.2023.12.07.23.01.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 23:01:11 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=Ek4ZAsHd; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5EB51385829B for ; Fri, 8 Dec 2023 07:01:11 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 467043858C62 for ; Fri, 8 Dec 2023 07:01:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 467043858C62 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 467043858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702018866; cv=none; b=u5hhnAfgXa8ezS2J+gMZZYjbl5GLhAYB9s2oc09dF1CuL44HdcfxLn3LXf+jfhj/ZUR4W8YB9DlUjO48sqT+jkVDYq4ljz3nBS3uEq60GHjqshvx2NP5Ugpl4A40p+3DApFBTWOdW8vrk4nYsAIfKxHgJaN0Em6kt7m7rN2r89g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702018866; c=relaxed/simple; bh=Jfze8PNE7zSEiUk9xFBALjdAPXexa52WZsyzx73u4LU=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=WARyuOV5USFPpefFNDm2fiI62t25zEPC88zOqL30RBDHxSTUgJhnOqdmeWrMyzHyaoyPPsDahkzjaxqx+y8naF6BMIU9HdNWUqUN74fD/XkJmMJ3yfszE2xD9FMXIufWvNA20zoWW+IEuh9XsB9gSHZ91eRWevPrRv2dwd4/V8s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3332e351670so1645089f8f.0 for ; Thu, 07 Dec 2023 23:01:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1702018863; x=1702623663; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=4BdgSN6Q+dFt/fmKvpVaTFIZWZv+UzVVCGfpqCTC6ow=; b=Ek4ZAsHdBUDP1VUYojXDJbiZ8MEjc3v5YIymg89e58qbhIFGm/MKpFrNc9p/qJqoIf OAVaIozZYp/X8i04UYwSu0tIae1ttRb7FzqSNfJKaFVZ4JDdo4Tn98ybfNqcxk9wwdlo 3Uoo4kL9POhZ1FQZlzh5K2i/cvPLtzoel630eCaSGitvGIq8Nu0la2v/swrwSfKg9aOm awUT/Sv2NQh8/OeZYTc2UZKgM7oZXTs6QhFbVxgzpYlOybz5vYc84RCQVyTpV/ZEzL+c Fg0Q8vcw9Khl9OxVjh7Y8Hx8FoQ5SKgymDrf7EHRfCYfyWUI6V4EWanValKIDPsuJOvB 3K4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702018863; x=1702623663; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4BdgSN6Q+dFt/fmKvpVaTFIZWZv+UzVVCGfpqCTC6ow=; b=ioyguBDudzS2c8xnF2Zf2DXsLpVb8w7bdrM1c77y2Gy4TKWwnybPEZXOl0m8wbdGBU jWc80UgXC1d3KDmKaZQM2wOP3K8BB5PpCI0Ew2bFizcl7XmLLpQxqG0sFw5IUcTDw1Tn QAubDJrybF7OHYBuuNRhhrKG/vUq+jyhJqrPnwb92zGQyhLViybLmxkXrM9hxk66J08S 3BNLMzVSSB2+Fd/ewROYaHiHK6ejrEQ7xqfXnuQwCVA7yGcd9ZY8sJKtcdYZWy8DXGH1 CWbZLWfJJmIwOEWlw0ofPF0g7i7ZFZiUye0JpdkKR4Z8dPNy2LqZEyVv+xbs2HpVbp+6 X0vw== X-Gm-Message-State: AOJu0YxX0dJpzXxtdXefRd7ziyE5i7BBt91U0gxM9ps8rhmjnt8Xu2dq 5fMZMYwof9XjkXKCL9Pk55/n0b7sL4zi7gh//q3y X-Received: by 2002:a5d:4d85:0:b0:333:3117:c43e with SMTP id b5-20020a5d4d85000000b003333117c43emr1143230wru.207.1702018862915; Thu, 07 Dec 2023 23:01:02 -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 w13-20020a5d404d000000b003333f9200d8sm1320385wrp.84.2023.12.07.23.01.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Dec 2023 23:01:02 -0800 (PST) Message-ID: <00ae907a-8fe1-44b1-9e1f-2c20d33a31a5@suse.com> Date: Fri, 8 Dec 2023 08:01:02 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/3] ELF: reliably invoke md_elf_section_change_hook() Content-Language: en-US From: Jan Beulich To: Binutils Cc: "H.J. Lu" , Alan Modra , Nick Clifton References: <9853a641-73fc-4d47-83aa-1402464d2920@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4B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WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <9853a641-73fc-4d47-83aa-1402464d2920@suse.com> X-Spam-Status: No, score=-3026.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784696140007272926 X-GMAIL-MSGID: 1784696140007272926 ... after any (sub)section change. While certain existing target hooks only look at now_seg, for a few others it looks as if failing to do so could have caused anomalies if sub-sections were used. In any event a subsequent x86 change is going to require the sub-section to be properly in place at the time the hook is invoked. This primarily means for obj_elf_section() to pass the new subsection into obj_elf_change_section(), for it to be set right away (ahead of invoking the hook). While adding the new function parameter, take the opportunity and change two adjacent boolean ones to "bool". Also adjust obj_elf_ident() to invoke the hook after all section changes. (Note that obj_elf_version(), which also changes sections and then changes them back, has no hook invocation at all so far, so none are added. Presumably there is a reason for this difference in behavior.) --- Considering that no caller outside of obj-elf.c cares about the existing "push" and the new "new_subsection" arguments, an alternative might be to drop the "push" one in a prereq patch, thus eliminating the need for this one to touch various targets. Thoughts anyone? --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -546,8 +546,9 @@ obj_elf_change_section (const char *name bfd_vma attr, int entsize, struct elf_section_match *match_p, - int linkonce, - int push) + bool linkonce, + bool push, + subsegT new_subsection) { asection *old_sec; segT sec; @@ -585,10 +586,10 @@ obj_elf_change_section (const char *name if (old_sec) { sec = old_sec; - subseg_set (sec, 0); + subseg_set (sec, new_subsection); } else - sec = subseg_force_new (name, 0); + sec = subseg_force_new (name, new_subsection); bed = get_elf_backend_data (stdoutput); ssect = (*bed->get_sec_type_attr) (stdoutput, sec); @@ -1103,8 +1104,8 @@ obj_elf_section (int push) bfd_vma attr; bfd_vma gnu_attr; int entsize; - int linkonce; - subsegT new_subsection = -1; + bool linkonce; + subsegT new_subsection = 0; struct elf_section_match match; unsigned long linked_to_section_index = -1UL; @@ -1489,7 +1490,7 @@ obj_elf_section (int push) } obj_elf_change_section (name, type, attr, entsize, &match, linkonce, - push); + push, new_subsection); if (linked_to_section_index != -1UL) { @@ -1497,9 +1498,6 @@ obj_elf_section (int push) elf_section_data (now_seg)->this_hdr.sh_link = linked_to_section_index; /* FIXME: Should we perform some sanity checking on the section index ? */ } - - if (push && new_subsection != -1) - subseg_set (now_seg, new_subsection); } /* Change to the .bss section. */ @@ -2519,9 +2517,17 @@ obj_elf_ident (int ignore ATTRIBUTE_UNUS *p = 0; } else - subseg_set (comment_section, 0); + { + subseg_set (comment_section, 0); +#ifdef md_elf_section_change_hook + md_elf_section_change_hook (); +#endif + } stringer (8 + 1); subseg_set (old_section, old_subsection); +#ifdef md_elf_section_change_hook + md_elf_section_change_hook (); +#endif } #ifdef INIT_STAB_SECTION --- a/gas/config/obj-elf.h +++ b/gas/config/obj-elf.h @@ -198,7 +198,7 @@ extern void obj_elf_data (int); extern void obj_elf_text (int); extern void obj_elf_change_section (const char *, unsigned int, bfd_vma, int, struct elf_section_match *, - int, int); + bool, bool, subsegT); extern void obj_elf_vtable_inherit (int); extern void obj_elf_vtable_entry (int); extern struct fix * obj_elf_get_vtable_inherit (void); --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -27775,7 +27775,7 @@ start_unwind_section (const segT text_se } obj_elf_change_section (sec_name, type, flags, 0, &match, - linkonce, 0); + linkonce, false, 0); /* Set the section link for index tables. */ if (idx) --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -1139,7 +1139,7 @@ obj_elf_vms_common (int ignore ATTRIBUTE obj_elf_change_section (sec_name, SHT_NOBITS, SHF_ALLOC | SHF_WRITE | SHF_IA_64_VMS_OVERLAID | SHF_IA_64_VMS_GLOBAL, - 0, NULL, 1, 0); + 0, NULL, true, false, 0); S_SET_VALUE (symbolP, 0); S_SET_SIZE (symbolP, size); --- a/gas/config/tc-microblaze.c +++ b/gas/config/tc-microblaze.c @@ -150,7 +150,7 @@ microblaze_s_data (int ignore ATTRIBUTE_ { #ifdef OBJ_ELF obj_elf_change_section (".data", SHT_PROGBITS, SHF_ALLOC+SHF_WRITE, - 0, 0, 0, 0); + 0, 0, false, false, 0); #else s_data (ignore); #endif @@ -163,7 +163,7 @@ microblaze_s_sdata (int ignore ATTRIBUTE { #ifdef OBJ_ELF obj_elf_change_section (".sdata", SHT_PROGBITS, SHF_ALLOC+SHF_WRITE, - 0, 0, 0, 0); + 0, 0, false, false, 0); #else s_data (ignore); #endif @@ -282,7 +282,7 @@ microblaze_s_rdata (int localvar) { /* rodata. */ obj_elf_change_section (".rodata", SHT_PROGBITS, SHF_ALLOC, - 0, 0, 0, 0); + 0, 0, false, false, 0); if (rodata_segment == 0) rodata_segment = subseg_new (".rodata", 0); } @@ -290,7 +290,7 @@ microblaze_s_rdata (int localvar) { /* 1 .sdata2. */ obj_elf_change_section (".sdata2", SHT_PROGBITS, SHF_ALLOC, - 0, 0, 0, 0); + 0, 0, false, false, 0); } #else s_data (ignore); @@ -303,12 +303,12 @@ microblaze_s_bss (int localvar) #ifdef OBJ_ELF if (localvar == 0) /* bss. */ obj_elf_change_section (".bss", SHT_NOBITS, SHF_ALLOC+SHF_WRITE, - 0, 0, 0, 0); + 0, 0, false, false, 0); else if (localvar == 1) { /* sbss. */ obj_elf_change_section (".sbss", SHT_NOBITS, SHF_ALLOC+SHF_WRITE, - 0, 0, 0, 0); + 0, 0, false, false, 0); if (sbss_segment == 0) sbss_segment = subseg_new (".sbss", 0); } --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -16435,7 +16435,7 @@ s_change_section (int ignore ATTRIBUTE_U section_type = SHT_PROGBITS; obj_elf_change_section (section_name, section_type, section_flag, - section_entry_size, 0, 0, 0); + section_entry_size, 0, false, false, 0); } void --- a/gas/config/tc-msp430.c +++ b/gas/config/tc-msp430.c @@ -622,7 +622,7 @@ msp430_profiler (int dummy ATTRIBUTE_UNU subseg = now_subseg; /* Now go to .profiler section. */ - obj_elf_change_section (".profiler", SHT_PROGBITS, 0, 0, 0, 0, 0); + obj_elf_change_section (".profiler", SHT_PROGBITS, 0, 0, 0, false, false, 0); /* Save flags. */ emit_expr (& exp, 2); --- a/gas/config/tc-rx.c +++ b/gas/config/tc-rx.c @@ -488,7 +488,7 @@ parse_rx_section (char * name) else type = SHT_NOBITS; - obj_elf_change_section (name, type, attr, 0, NULL, false, false); + obj_elf_change_section (name, type, attr, 0, NULL, false, false, 0); } else /* Try not to redefine a section, especially B_1. */ { @@ -503,7 +503,7 @@ parse_rx_section (char * name) | ((flags & SEC_STRINGS) ? SHF_STRINGS : 0) | ((flags & SEC_THREAD_LOCAL) ? SHF_TLS : 0); - obj_elf_change_section (name, type, attr, 0, NULL, false, false); + obj_elf_change_section (name, type, attr, 0, NULL, false, false, 0); } bfd_set_section_alignment (now_seg, align); --- a/gas/config/tc-tic6x.c +++ b/gas/config/tc-tic6x.c @@ -4662,7 +4662,7 @@ tic6x_start_unwind_section (const segT t } obj_elf_change_section (sec_name, type, flags, 0, &match, - linkonce, 0); + linkonce, false, 0); /* Set the section link for index tables. */ if (idx) From patchwork Fri Dec 8 07:01:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 175633 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp5285592vqy; Thu, 7 Dec 2023 23:01:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGS2NA8qTZiJ3tOvQX5hOlYBNZgZRF60CuXpS7jFe0Y8kN6u1K3cfVRJJ7YdyPNZ7V26MMK X-Received: by 2002:a05:622a:1050:b0:425:4043:1d7e with SMTP id f16-20020a05622a105000b0042540431d7emr4263450qte.81.1702018902203; Thu, 07 Dec 2023 23:01:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702018902; cv=pass; d=google.com; s=arc-20160816; b=x6r2g/0Zft+M4kyuTQW9nztzvOiGfcIF43ge6hLcVNokOwYt2Zr5vzWB9cEkGCO1Ib 7OKHjJp4DWzht37aMTH5CRkgLMMEZhEDz0qYhtqU1rOecYIR6xMXo92TCPQZQAXdeL+1 50teRngT4N/vX9pLnUEiKeDAlnKF5IfJgjwKa4oteQNQPZdj/PvvkjSzGxL/ovsVG+9r NJEGNv5zW2RTpQOGUO6CSGR+w63f8ZneFEj/bN+u6JmskWVRgZptfbp1zl/AOhAxf4yZ 2T4G8l6JvkReDaeZ+sc74Hr5lXIrwtnrQD3oAJWUKieAgapNTvk1BPFCvE5oySkLhGWN imCQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :in-reply-to:autocrypt:references:cc:to:from:content-language :subject:user-agent:mime-version:date:message-id:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=9mEMcMc4MzHxZZFPrA4O742B7xGCp+7sU94WvgFFgOg=; fh=8WW8/k0o0G2vlJiZAQKLzwZ5FShsw2CjyMds4OH6804=; b=izAoXGzS2o+OISWqq9lmBh6Ci8SfkOjuPeluR6Dr6a4Qkf7qL+FcdamQ33sVZy6ISh LOdU6bA8rIeUycw5oV8hXxG7ZTjSp+nLPuiPGgOuZ6XqGlVN9WLKd6F9uS73wzm8J5F2 x4MKJ2Z8kKuPFCAviOtBBD4je9rFzakA7gvDhmTRcIA6BcaBrLlU4N+fFrru8UMCRAHI NPKk8OroS+4+bTdUD6pXKbih3Im4ttNKGLKr491Ta6TsRHJaAFvtP6Xpe5E27isLS6Cd PF60E+rILM5WcAPOybZtoBaPE1BE8TQjbexHCx3psaK28uW4Lz51GJvYc2yxUAV5tltb 1lfA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=E1YLsfYa; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ay13-20020a05622a228d00b00423aca6388bsi1692944qtb.786.2023.12.07.23.01.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 23:01:42 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=E1YLsfYa; arc=pass (i=1); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0FE3F3857B94 for ; Fri, 8 Dec 2023 07:01:41 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 859023857C7C for ; Fri, 8 Dec 2023 07:01:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 859023857C7C 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 859023857C7C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::431 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702018896; cv=none; b=ViFc8HrRZngDwK9fde/4nWUhrh5ftUnbNp2BQLXQN/M75UeI5NCH3mfCD+IBa5Rq5xC9hesbUBchEt48UYmaODxFgA0HU238n4MFTtqfgyx2UyLa1L19a/6fJvxinYjIxvh9u0xM04e6J83zLheJl/4dkJot2v8P4jd9wAf8NpM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702018896; c=relaxed/simple; bh=5BxyDWz3RgODbE2iUeOi+0i9GZIOAZlss5oMN6+C+3A=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:From:To; b=bFGHGrFHBWRxdIzP80Ykcrur+taa8q51B1ucpYwefZ54lLozjBq6Y5SJDBrpjf+Ik0NBTm4SxpYunRZ5oc98nhHO3BdKAFGl6rdQ1F3VubEVb5mbnxH3UTjH2jTmXeGnryzj07Ct2YT6CbakaUMIo28hjXLq3D8OtEZGmtSZXKA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3333a3a599fso1504674f8f.0 for ; Thu, 07 Dec 2023 23:01:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1702018893; x=1702623693; darn=sourceware.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=9mEMcMc4MzHxZZFPrA4O742B7xGCp+7sU94WvgFFgOg=; b=E1YLsfYaicUDDYJhxCwiATHc4c2s2u7SzNNlnekx7wO1XwV3QVUiM11k0tc7bvyDz+ XIAO9Yr6LrrGOuWcn/AtHqa2fDwZxNY9J12JYXgi1jTAamtFAHAfIBGNcoOzEy7BWF7+ DVmPYpdhPPnrLbxHbhTgIdQlS9gJ6DafsgSpg0I6aD2OgqY1h3UCu5H2OWxARifKyjbc 7jrzKXJgad3elOz+sEoyTOkb3lvczaMTMkVgFUuJXCLLe7B9uhoxDmOzAwKauNHvn4RE BPVGky+w3CT7pjeI2oui/XKT2rWujNaMtXP+kET5dqEAjRh+Wrkz53RFI8493IUq/C0U P18Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702018893; x=1702623693; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9mEMcMc4MzHxZZFPrA4O742B7xGCp+7sU94WvgFFgOg=; b=Lmh2T6uKdf7zmA337PbxErLWY5P0rSd3WeZce77r6ILMRaadWhH6JinfwCALj2OJSc 7vYDn5U5LLugzoAeoH2QiC9i6Tzeb5Lfon65D1TlfDcBVx1+dT2MfoG4GMlA3wjtNJQ9 9810DUu9T9KqGgmCv5J2V8F40XDeO3RY+Sjaqr4LGgZnMLZOhwIZuoShGULTRwfE9FdP 1ixvrlMq1s4ec7H+1MDCc6tVLSfOiVck2By+OZMvW1LkTsu/lDLLfjcAWUwnC55wzT+U 7hIjDpg/fjG7iHGNpCvRP5PiIkpJzA392cVECXh2GZmZrw6bmFgdC9C/jwLDFs9lr6bx c+/g== X-Gm-Message-State: AOJu0YzM9Yq0bdrch0cVP9HJlA/W49GovCo1T2aJcumVY6+IcleGMcjc hcisAzu9PJ4/w8WmPjBg6vsJmkZTNxfRI0oYxvtr X-Received: by 2002:a5d:42cc:0:b0:333:3c90:fe16 with SMTP id t12-20020a5d42cc000000b003333c90fe16mr218521wrr.32.1702018893265; Thu, 07 Dec 2023 23:01:33 -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 w13-20020a5d404d000000b003333f9200d8sm1320385wrp.84.2023.12.07.23.01.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Dec 2023 23:01:33 -0800 (PST) Message-ID: <8bee4d1a-9d7d-4fb0-980c-f40c404fa542@suse.com> Date: Fri, 8 Dec 2023 08:01:32 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 3/3] x86: last-insn recording should be per-subsection Content-Language: en-US From: Jan Beulich To: Binutils Cc: "H.J. Lu" References: <9853a641-73fc-4d47-83aa-1402464d2920@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+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+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <9853a641-73fc-4d47-83aa-1402464d2920@suse.com> X-Spam-Status: No, score=-3026.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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+ouuuleilei=gmail.com@sourceware.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784696172424281365 X-GMAIL-MSGID: 1784696172424281365 Otherwise intermediate subsection switches result in inconsistent behavior. Leverage ELF's section change hook to switch state as necessary, limiting overhead to the bare minimum when subsections aren't used. --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -15920,6 +15920,39 @@ i386_elf_section_type (const char *str, return -1; } +void +i386_elf_section_change_hook (void) +{ + struct i386_segment_info *info = &seg_info(now_seg)->tc_segment_info_data; + struct i386_segment_info *curr, *prev; + + if (info->subseg == now_subseg) + return; + + /* Find the (or make a) list entry to save state into. */ + for (prev = info; (curr = prev->next) != NULL; prev = curr) + if (curr->subseg == info->subseg) + break; + if (!curr) + { + curr = XNEW (struct i386_segment_info); + curr->subseg = info->subseg; + curr->next = NULL; + prev->next = curr; + } + curr->last_insn = info->last_insn; + + /* Find the list entry to load state from. */ + for (curr = info->next; curr; curr = curr->next) + if (curr->subseg == now_subseg) + break; + if (curr) + info->last_insn = curr->last_insn; + else + memset (&info->last_insn, 0, sizeof (info->last_insn)); + info->subseg = now_subseg; +} + #ifdef TE_SOLARIS void i386_solaris_fix_up_eh_frame (segT sec) --- a/gas/config/tc-i386.h +++ b/gas/config/tc-i386.h @@ -294,6 +294,8 @@ struct i386_segment_info { last_insn_prefix } kind; } last_insn; + subsegT subseg; + struct i386_segment_info *next; }; #define TC_SEGMENT_INFO_TYPE struct i386_segment_info @@ -395,6 +397,9 @@ extern void tc_x86_frame_initial_instruc #define md_elf_section_type(str,len) i386_elf_section_type (str, len) extern int i386_elf_section_type (const char *, size_t); +#define md_elf_section_change_hook i386_elf_section_change_hook +extern void i386_elf_section_change_hook (void); + #ifdef TE_SOLARIS #define md_fix_up_eh_frame(sec) i386_solaris_fix_up_eh_frame (sec) extern void i386_solaris_fix_up_eh_frame (segT); --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -745,6 +745,8 @@ if [gas_32_check] then { run_dump_test "nop-6" run_dump_test "unique" + run_dump_test "lfence-subsect" + run_dump_test "property-1" if {[istarget "*-*-linux*"]} then { --- /dev/null +++ b/gas/testsuite/gas/i386/lfence-subsect.d @@ -0,0 +1,18 @@ +#as: -mlfence-before-indirect-branch=all +#warning_output: lfence-section.e +#objdump: -dw +#name: -mlfence-before-indirect-branch=all w/ subsection switches + +.*: +file format .* + +Disassembly of section .text: + +0+ <_start>: + +[a-f0-9]+: f3 ff d0 repz call \*%eax + +[a-f0-9]+: f3 c3 repz ret + +[a-f0-9]+: cc int3 + +[a-f0-9]+: cc int3 + +[a-f0-9]+: cc int3 + +0+8 : +#pass --- /dev/null +++ b/gas/testsuite/gas/i386/lfence-subsect.s @@ -0,0 +1,19 @@ + .text +_start: + rep + + .subsection 2 +aux1: + nop + + .previous + call *%eax + rep + + .pushsection .text, 2 +aux2: + nop + + .popsection + ret + .p2align 2, 0xcc