From: Jan Beulich <jbeulich@suse.com>
To: Binutils <binutils@sourceware.org>
Cc: "H.J. Lu" <hjl.tools@gmail.com>
Subject: [PATCH 1/4] x86: re-order update_code_flag()
Date: Fri, 8 Sep 2023 14:53:43 +0200 [thread overview]
Message-ID: <eb70960e-bd5f-576d-3b23-01fe9b6f062c@suse.com> (raw)
In-Reply-To: <830bde4f-c60e-4ab4-2ca0-86381408254f@suse.com>
Do checks before updating state, and bail upon failure of either of the
checks. While moving the code, eliminate some redundancy.
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -2609,7 +2609,21 @@ add_prefix (unsigned int prefix)
static void
update_code_flag (int value, int check)
{
- PRINTF_LIKE ((*as_error));
+ PRINTF_LIKE ((*as_error)) = check ? as_fatal : as_bad;
+
+ if (value == CODE_64BIT && !cpu_arch_flags.bitfield.cpulm )
+ {
+ as_error (_("64bit mode not supported on `%s'."),
+ cpu_arch_name ? cpu_arch_name : default_arch);
+ return;
+ }
+
+ if (value == CODE_32BIT && !cpu_arch_flags.bitfield.cpui386)
+ {
+ as_error (_("32bit mode not supported on `%s'."),
+ cpu_arch_name ? cpu_arch_name : default_arch);
+ return;
+ }
flag_code = (enum flag_code) value;
if (flag_code == CODE_64BIT)
@@ -2622,24 +2636,7 @@ update_code_flag (int value, int check)
cpu_arch_flags.bitfield.cpu64 = 0;
cpu_arch_flags.bitfield.cpuno64 = 1;
}
- if (value == CODE_64BIT && !cpu_arch_flags.bitfield.cpulm )
- {
- if (check)
- as_error = as_fatal;
- else
- as_error = as_bad;
- (*as_error) (_("64bit mode not supported on `%s'."),
- cpu_arch_name ? cpu_arch_name : default_arch);
- }
- if (value == CODE_32BIT && !cpu_arch_flags.bitfield.cpui386)
- {
- if (check)
- as_error = as_fatal;
- else
- as_error = as_bad;
- (*as_error) (_("32bit mode not supported on `%s'."),
- cpu_arch_name ? cpu_arch_name : default_arch);
- }
+
stackop_size = '\0';
}
next prev parent reply other threads:[~2023-09-08 12:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 12:52 [PATCH 0/4] x86: Cpu64 / CpuNo64 adjustments Jan Beulich
2023-09-08 12:53 ` Jan Beulich [this message]
2023-09-08 12:54 ` [PATCH 2/4] x86: make code size vs CPU arch checking consistent Jan Beulich
2023-09-08 12:54 ` [PATCH 3/4] x86: don't play with cpu_arch_flags.cpu{,no}64 Jan Beulich
2023-09-08 12:55 ` [PATCH 4/4] x86: fold CpuLM and Cpu64 Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eb70960e-bd5f-576d-3b23-01fe9b6f062c@suse.com \
--to=jbeulich@suse.com \
--cc=binutils@sourceware.org \
--cc=hjl.tools@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).