public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH 2/2] x86: break gas dependency on libopcodes
Date: Thu, 17 Nov 2022 08:48:32 -0800	[thread overview]
Message-ID: <CAMe9rOr9w9A+uMDp1RRs=Gm6Pr_VsyQZaxnxWHWCiooZVtUvWg@mail.gmail.com> (raw)
In-Reply-To: <d9b5137b-3bc0-8496-4533-03402ac00628@suse.com>

On Thu, Nov 17, 2022 at 5:29 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> The only item gas still consumes from libopcodes is i386_seg_prefixes[],
> which again is used by gas alone. Move it into the assembler, allowing
> to remove the linking in of libopcodes.
>
> To compensate, tie table generation in opcodes/ to the building of
> i386-dis.o, despite the file not really depending on the generated data.
> ---
> RFC: Is there a better way to specify extra dependencies, such that
>      table generation and compilation of i386-dis.c could be kept
>      separate (and hence processable in parallel)?
>
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -445,6 +445,16 @@ struct _i386_insn
>
>  typedef struct _i386_insn i386_insn;
>
> +/* To be indexed by segment register number.  */
> +static const unsigned char i386_seg_prefixes[] = {
> +  ES_PREFIX_OPCODE,
> +  CS_PREFIX_OPCODE,
> +  SS_PREFIX_OPCODE,
> +  DS_PREFIX_OPCODE,
> +  FS_PREFIX_OPCODE,
> +  GS_PREFIX_OPCODE
> +};
> +
>  /* Link RC type with corresponding string, that'll be looked for in
>     asm.  */
>  struct RC_name
> --- a/gas/configure
> +++ b/gas/configure
> @@ -12263,7 +12263,7 @@ _ACEOF
>
>      # Do we need the opcodes library?
>      case ${cpu_type} in
> -      vax | tic30)
> +      vax | tic30 | i386)
>         ;;
>
>        *)
> --- a/gas/configure.ac
> +++ b/gas/configure.ac
> @@ -420,7 +420,7 @@ changequote([,])dnl
>
>      # Do we need the opcodes library?
>      case ${cpu_type} in
> -      vax | tic30)
> +      vax | tic30 | i386)
>         ;;

This change isn't needed to move i386_seg_prefixes to gas.

>        *)
> --- a/opcodes/Makefile.am
> +++ b/opcodes/Makefile.am
> @@ -162,7 +162,6 @@ TARGET32_LIBOPCODES_CFILES = \
>         h8300-dis.c \
>         hppa-dis.c \
>         i386-dis.c \
> -       i386-opc.c \
>         ip2k-asm.c \
>         ip2k-desc.c \
>         ip2k-dis.c \
> @@ -564,7 +563,7 @@ $(srcdir)/i386%tbl.h $(srcdir)/i386%init
>
>  # While not really dependencies, specify i386-{init,tbl}.h here as well to
>  # make sure they are re-generated as necessary.
> -i386-opc.lo: $(srcdir)/i386-tbl.h $(srcdir)/i386-init.h
> +i386-dis.lo: $(srcdir)/i386-tbl.h $(srcdir)/i386-init.h
>
>  ia64-gen$(EXEEXT_FOR_BUILD): ia64-gen.o $(BUILD_LIB_DEPS)
>         $(AM_V_CCLD)$(LINK_FOR_BUILD) ia64-gen.o $(BUILD_LIBS)
> --- a/opcodes/Makefile.in
> +++ b/opcodes/Makefile.in
> @@ -554,7 +554,6 @@ TARGET32_LIBOPCODES_CFILES = \
>         h8300-dis.c \
>         hppa-dis.c \
>         i386-dis.c \
> -       i386-opc.c \
>         ip2k-asm.c \
>         ip2k-desc.c \
>         ip2k-dis.c \
> @@ -947,7 +946,6 @@ distclean-compile:
>  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h8300-dis.Plo@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hppa-dis.Plo@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386-dis.Plo@am__quote@
> -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386-opc.Plo@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64-dis.Plo@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64-opc.Plo@am__quote@
>  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ip2k-asm.Plo@am__quote@
> @@ -1539,7 +1537,7 @@ $(srcdir)/i386%tbl.h $(srcdir)/i386%init
>
>  # While not really dependencies, specify i386-{init,tbl}.h here as well to
>  # make sure they are re-generated as necessary.
> -i386-opc.lo: $(srcdir)/i386-tbl.h $(srcdir)/i386-init.h
> +i386-dis.lo: $(srcdir)/i386-tbl.h $(srcdir)/i386-init.h
>
>  ia64-gen$(EXEEXT_FOR_BUILD): ia64-gen.o $(BUILD_LIB_DEPS)
>         $(AM_V_CCLD)$(LINK_FOR_BUILD) ia64-gen.o $(BUILD_LIBS)
> --- a/opcodes/i386-opc.c
> +++ /dev/null
> @@ -1,33 +0,0 @@
> -/* Intel 80386 opcode table
> -   Copyright (C) 2007-2022 Free Software Foundation, Inc.
> -
> -   This file is part of the GNU opcodes library.
> -
> -   This library is free software; you can redistribute it and/or modify
> -   it under the terms of the GNU General Public License as published by
> -   the Free Software Foundation; either version 3, or (at your option)
> -   any later version.
> -
> -   It is distributed in the hope that it will be useful, but WITHOUT
> -   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
> -   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
> -   License for more details.
> -
> -   You should have received a copy of the GNU General Public License
> -   along with this program; if not, write to the Free Software
> -   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
> -   MA 02110-1301, USA.  */
> -
> -#include "sysdep.h"
> -#include "libiberty.h"
> -#include "i386-opc.h"
> -
> -/* To be indexed by segment register number.  */
> -const unsigned char i386_seg_prefixes[] = {
> -  ES_PREFIX_OPCODE,
> -  CS_PREFIX_OPCODE,
> -  SS_PREFIX_OPCODE,
> -  DS_PREFIX_OPCODE,
> -  FS_PREFIX_OPCODE,
> -  GS_PREFIX_OPCODE
> -};
> --- a/opcodes/i386-opc.h
> +++ b/opcodes/i386-opc.h
> @@ -1003,5 +1003,3 @@ typedef struct
>  #define Dw2Inval (-1)
>  }
>  reg_entry;
> -
> -extern const unsigned char i386_seg_prefixes[6];
>


-- 
H.J.

  reply	other threads:[~2022-11-17 16:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17 13:27 [PATCH 0/2] " Jan Beulich
2022-11-17 13:29 ` [PATCH 1/2] x86: instantiate i386_{op,reg}tab[] in gas instead of in libopcodes Jan Beulich
2022-11-17 13:29 ` [PATCH 2/2] x86: break gas dependency on libopcodes Jan Beulich
2022-11-17 16:48   ` H.J. Lu [this message]
2022-11-17 16:53     ` Jan Beulich
2022-11-17 16:55       ` H.J. Lu
2022-11-17 16:59         ` Jan Beulich
2022-11-17 17:01           ` H.J. Lu
2022-11-17 17:07             ` H.J. Lu
2022-11-18  6:53             ` 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='CAMe9rOr9w9A+uMDp1RRs=Gm6Pr_VsyQZaxnxWHWCiooZVtUvWg@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=jbeulich@suse.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).