Search
lxdream.org :: lxdream :: r362:dc40e2064dc4
lxdream 0.9.1
released Jun 29
Download Now
changeset362:dc40e2064dc4
parent361:be3de4ecd954
child363:7d0bab24016c
authornkeynes
dateTue Aug 28 08:46:54 2007 +0000 (12 years ago)
Add the i386 disassembler from binutils (why write your own if you don't
have to) to use for translator validation
src/x86dasm/README
src/x86dasm/ansidecl.h
src/x86dasm/bfd.h
src/x86dasm/config.h
src/x86dasm/dis-asm.h
src/x86dasm/dis-buf.c
src/x86dasm/dis-init.c
src/x86dasm/i386-dis.c
src/x86dasm/opintl.h
src/x86dasm/symcat.h
src/x86dasm/sysdep.h
src/x86dasm/x86dasm.c
src/x86dasm/x86dasm.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/x86dasm/README Tue Aug 28 08:46:54 2007 +0000
1.3 @@ -0,0 +1,1 @@
1.4 +i386-dis extracted from binutils 2.16.1 and modified to play with lxdream.
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/src/x86dasm/ansidecl.h Tue Aug 28 08:46:54 2007 +0000
2.3 @@ -0,0 +1,346 @@
2.4 +/* ANSI and traditional C compatability macros
2.5 + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
2.6 + Free Software Foundation, Inc.
2.7 + This file is part of the GNU C Library.
2.8 +
2.9 +This program is free software; you can redistribute it and/or modify
2.10 +it under the terms of the GNU General Public License as published by
2.11 +the Free Software Foundation; either version 2 of the License, or
2.12 +(at your option) any later version.
2.13 +
2.14 +This program is distributed in the hope that it will be useful,
2.15 +but WITHOUT ANY WARRANTY; without even the implied warranty of
2.16 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.17 +GNU General Public License for more details.
2.18 +
2.19 +You should have received a copy of the GNU General Public License
2.20 +along with this program; if not, write to the Free Software
2.21 +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
2.22 +
2.23 +/* ANSI and traditional C compatibility macros
2.24 +
2.25 + ANSI C is assumed if __STDC__ is #defined.
2.26 +
2.27 + Macro ANSI C definition Traditional C definition
2.28 + ----- ---- - ---------- ----------- - ----------
2.29 + ANSI_PROTOTYPES 1 not defined
2.30 + PTR `void *' `char *'
2.31 + PTRCONST `void *const' `char *'
2.32 + LONG_DOUBLE `long double' `double'
2.33 + const not defined `'
2.34 + volatile not defined `'
2.35 + signed not defined `'
2.36 + VA_START(ap, var) va_start(ap, var) va_start(ap)
2.37 +
2.38 + Note that it is safe to write "void foo();" indicating a function
2.39 + with no return value, in all K+R compilers we have been able to test.
2.40 +
2.41 + For declaring functions with prototypes, we also provide these:
2.42 +
2.43 + PARAMS ((prototype))
2.44 + -- for functions which take a fixed number of arguments. Use this
2.45 + when declaring the function. When defining the function, write a
2.46 + K+R style argument list. For example:
2.47 +
2.48 + char *strcpy PARAMS ((char *dest, char *source));
2.49 + ...
2.50 + char *
2.51 + strcpy (dest, source)
2.52 + char *dest;
2.53 + char *source;
2.54 + { ... }
2.55 +
2.56 +
2.57 + VPARAMS ((prototype, ...))
2.58 + -- for functions which take a variable number of arguments. Use
2.59 + PARAMS to declare the function, VPARAMS to define it. For example:
2.60 +
2.61 + int printf PARAMS ((const char *format, ...));
2.62 + ...
2.63 + int
2.64 + printf VPARAMS ((const char *format, ...))
2.65 + {
2.66 + ...
2.67 + }
2.68 +
2.69 + For writing functions which take variable numbers of arguments, we
2.70 + also provide the VA_OPEN, VA_CLOSE, and VA_FIXEDARG macros. These
2.71 + hide the differences between K+R <varargs.h> and C89 <stdarg.h> more
2.72 + thoroughly than the simple VA_START() macro mentioned above.
2.73 +
2.74 + VA_OPEN and VA_CLOSE are used *instead of* va_start and va_end.
2.75 + Immediately after VA_OPEN, put a sequence of VA_FIXEDARG calls
2.76 + corresponding to the list of fixed arguments. Then use va_arg
2.77 + normally to get the variable arguments, or pass your va_list object
2.78 + around. You do not declare the va_list yourself; VA_OPEN does it
2.79 + for you.
2.80 +
2.81 + Here is a complete example:
2.82 +
2.83 + int
2.84 + printf VPARAMS ((const char *format, ...))
2.85 + {
2.86 + int result;
2.87 +
2.88 + VA_OPEN (ap, format);
2.89 + VA_FIXEDARG (ap, const char *, format);
2.90 +
2.91 + result = vfprintf (stdout, format, ap);
2.92 + VA_CLOSE (ap);
2.93 +
2.94 + return result;
2.95 + }
2.96 +
2.97 +
2.98 + You can declare variables either before or after the VA_OPEN,
2.99 + VA_FIXEDARG sequence. Also, VA_OPEN and VA_CLOSE are the beginning
2.100 + and end of a block. They must appear at the same nesting level,
2.101 + and any variables declared after VA_OPEN go out of scope at
2.102 + VA_CLOSE. Unfortunately, with a K+R compiler, that includes the
2.103 + argument list. You can have multiple instances of VA_OPEN/VA_CLOSE
2.104 + pairs in a single function in case you need to traverse the
2.105 + argument list more than once.
2.106 +
2.107 + For ease of writing code which uses GCC extensions but needs to be
2.108 + portable to other compilers, we provide the GCC_VERSION macro that
2.109 + simplifies testing __GNUC__ and __GNUC_MINOR__ together, and various
2.110 + wrappers around __attribute__. Also, __extension__ will be #defined
2.111 + to nothing if it doesn't work. See below.
2.112 +
2.113 + This header also defines a lot of obsolete macros:
2.114 + CONST, VOLATILE, SIGNED, PROTO, EXFUN, DEFUN, DEFUN_VOID,
2.115 + AND, DOTS, NOARGS. Don't use them. */
2.116 +
2.117 +#ifndef _ANSIDECL_H
2.118 +#define _ANSIDECL_H 1
2.119 +
2.120 +/* Every source file includes this file,
2.121 + so they will all get the switch for lint. */
2.122 +/* LINTLIBRARY */
2.123 +
2.124 +/* Using MACRO(x,y) in cpp #if conditionals does not work with some
2.125 + older preprocessors. Thus we can't define something like this:
2.126 +
2.127 +#define HAVE_GCC_VERSION(MAJOR, MINOR) \
2.128 + (__GNUC__ > (MAJOR) || (__GNUC__ == (MAJOR) && __GNUC_MINOR__ >= (MINOR)))
2.129 +
2.130 +and then test "#if HAVE_GCC_VERSION(2,7)".
2.131 +
2.132 +So instead we use the macro below and test it against specific values. */
2.133 +
2.134 +/* This macro simplifies testing whether we are using gcc, and if it
2.135 + is of a particular minimum version. (Both major & minor numbers are
2.136 + significant.) This macro will evaluate to 0 if we are not using
2.137 + gcc at all. */
2.138 +#ifndef GCC_VERSION
2.139 +#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
2.140 +#endif /* GCC_VERSION */
2.141 +
2.142 +#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(_WIN32) || (defined(__alpha) && defined(__cplusplus))
2.143 +/* All known AIX compilers implement these things (but don't always
2.144 + define __STDC__). The RISC/OS MIPS compiler defines these things
2.145 + in SVR4 mode, but does not define __STDC__. */
2.146 +/* eraxxon@alumni.rice.edu: The Compaq C++ compiler, unlike many other
2.147 + C++ compilers, does not define __STDC__, though it acts as if this
2.148 + was so. (Verified versions: 5.7, 6.2, 6.3, 6.5) */
2.149 +
2.150 +#define ANSI_PROTOTYPES 1
2.151 +#define PTR void *
2.152 +#define PTRCONST void *const
2.153 +#define LONG_DOUBLE long double
2.154 +
2.155 +/* PARAMS is often defined elsewhere (e.g. by libintl.h), so wrap it in
2.156 + a #ifndef. */
2.157 +#ifndef PARAMS
2.158 +#define PARAMS(ARGS) ARGS
2.159 +#endif
2.160 +
2.161 +#define VPARAMS(ARGS) ARGS
2.162 +#define VA_START(VA_LIST, VAR) va_start(VA_LIST, VAR)
2.163 +
2.164 +/* variadic function helper macros */
2.165 +/* "struct Qdmy" swallows the semicolon after VA_OPEN/VA_FIXEDARG's
2.166 + use without inhibiting further decls and without declaring an
2.167 + actual variable. */
2.168 +#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP, VAR); { struct Qdmy
2.169 +#define VA_CLOSE(AP) } va_end(AP); }
2.170 +#define VA_FIXEDARG(AP, T, N) struct Qdmy
2.171 +
2.172 +#undef const
2.173 +#undef volatile
2.174 +#undef signed
2.175 +
2.176 +/* inline requires special treatment; it's in C99, and GCC >=2.7 supports
2.177 + it too, but it's not in C89. */
2.178 +#undef inline
2.179 +#if __STDC_VERSION__ > 199901L
2.180 +/* it's a keyword */
2.181 +#else
2.182 +# if GCC_VERSION >= 2007
2.183 +# define inline __inline__ /* __inline__ prevents -pedantic warnings */
2.184 +# else
2.185 +# define inline /* nothing */
2.186 +# endif
2.187 +#endif
2.188 +
2.189 +/* These are obsolete. Do not use. */
2.190 +#ifndef IN_GCC
2.191 +#define CONST const
2.192 +#define VOLATILE volatile
2.193 +#define SIGNED signed
2.194 +
2.195 +#define PROTO(type, name, arglist) type name arglist
2.196 +#define EXFUN(name, proto) name proto
2.197 +#define DEFUN(name, arglist, args) name(args)
2.198 +#define DEFUN_VOID(name) name(void)
2.199 +#define AND ,
2.200 +#define DOTS , ...
2.201 +#define NOARGS void
2.202 +#endif /* ! IN_GCC */
2.203 +
2.204 +#else /* Not ANSI C. */
2.205 +
2.206 +#undef ANSI_PROTOTYPES
2.207 +#define PTR char *
2.208 +#define PTRCONST PTR
2.209 +#define LONG_DOUBLE double
2.210 +
2.211 +#define PARAMS(args) ()
2.212 +#define VPARAMS(args) (va_alist) va_dcl
2.213 +#define VA_START(va_list, var) va_start(va_list)
2.214 +
2.215 +#define VA_OPEN(AP, VAR) { va_list AP; va_start(AP); { struct Qdmy
2.216 +#define VA_CLOSE(AP) } va_end(AP); }
2.217 +#define VA_FIXEDARG(AP, TYPE, NAME) TYPE NAME = va_arg(AP, TYPE)
2.218 +
2.219 +/* some systems define these in header files for non-ansi mode */
2.220 +#undef const
2.221 +#undef volatile
2.222 +#undef signed
2.223 +#undef inline
2.224 +#define const
2.225 +#define volatile
2.226 +#define signed
2.227 +#define inline
2.228 +
2.229 +#ifndef IN_GCC
2.230 +#define CONST
2.231 +#define VOLATILE
2.232 +#define SIGNED
2.233 +
2.234 +#define PROTO(type, name, arglist) type name ()
2.235 +#define EXFUN(name, proto) name()
2.236 +#define DEFUN(name, arglist, args) name arglist args;
2.237 +#define DEFUN_VOID(name) name()
2.238 +#define AND ;
2.239 +#define DOTS
2.240 +#define NOARGS
2.241 +#endif /* ! IN_GCC */
2.242 +
2.243 +#endif /* ANSI C. */
2.244 +
2.245 +/* Define macros for some gcc attributes. This permits us to use the
2.246 + macros freely, and know that they will come into play for the
2.247 + version of gcc in which they are supported. */
2.248 +
2.249 +#if (GCC_VERSION < 2007)
2.250 +# define __attribute__(x)
2.251 +#endif
2.252 +
2.253 +/* Attribute __malloc__ on functions was valid as of gcc 2.96. */
2.254 +#ifndef ATTRIBUTE_MALLOC
2.255 +# if (GCC_VERSION >= 2096)
2.256 +# define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
2.257 +# else
2.258 +# define ATTRIBUTE_MALLOC
2.259 +# endif /* GNUC >= 2.96 */
2.260 +#endif /* ATTRIBUTE_MALLOC */
2.261 +
2.262 +/* Attributes on labels were valid as of gcc 2.93. */
2.263 +#ifndef ATTRIBUTE_UNUSED_LABEL
2.264 +# if (GCC_VERSION >= 2093)
2.265 +# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
2.266 +# else
2.267 +# define ATTRIBUTE_UNUSED_LABEL
2.268 +# endif /* GNUC >= 2.93 */
2.269 +#endif /* ATTRIBUTE_UNUSED_LABEL */
2.270 +
2.271 +#ifndef ATTRIBUTE_UNUSED
2.272 +#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
2.273 +#endif /* ATTRIBUTE_UNUSED */
2.274 +
2.275 +/* Before GCC 3.4, the C++ frontend couldn't parse attributes placed after the
2.276 + identifier name. */
2.277 +#if ! defined(__cplusplus) || (GCC_VERSION >= 3004)
2.278 +# define ARG_UNUSED(NAME) NAME ATTRIBUTE_UNUSED
2.279 +#else /* !__cplusplus || GNUC >= 3.4 */
2.280 +# define ARG_UNUSED(NAME) NAME
2.281 +#endif /* !__cplusplus || GNUC >= 3.4 */
2.282 +
2.283 +#ifndef ATTRIBUTE_NORETURN
2.284 +#define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
2.285 +#endif /* ATTRIBUTE_NORETURN */
2.286 +
2.287 +/* Attribute `nonnull' was valid as of gcc 3.3. */
2.288 +#ifndef ATTRIBUTE_NONNULL
2.289 +# if (GCC_VERSION >= 3003)
2.290 +# define ATTRIBUTE_NONNULL(m) __attribute__ ((__nonnull__ (m)))
2.291 +# else
2.292 +# define ATTRIBUTE_NONNULL(m)
2.293 +# endif /* GNUC >= 3.3 */
2.294 +#endif /* ATTRIBUTE_NONNULL */
2.295 +
2.296 +/* Attribute `pure' was valid as of gcc 3.0. */
2.297 +#ifndef ATTRIBUTE_PURE
2.298 +# if (GCC_VERSION >= 3000)
2.299 +# define ATTRIBUTE_PURE __attribute__ ((__pure__))
2.300 +# else
2.301 +# define ATTRIBUTE_PURE
2.302 +# endif /* GNUC >= 3.0 */
2.303 +#endif /* ATTRIBUTE_PURE */
2.304 +
2.305 +/* Use ATTRIBUTE_PRINTF when the format specifier must not be NULL.
2.306 + This was the case for the `printf' format attribute by itself
2.307 + before GCC 3.3, but as of 3.3 we need to add the `nonnull'
2.308 + attribute to retain this behavior. */
2.309 +#ifndef ATTRIBUTE_PRINTF
2.310 +#define ATTRIBUTE_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n))) ATTRIBUTE_NONNULL(m)
2.311 +#define ATTRIBUTE_PRINTF_1 ATTRIBUTE_PRINTF(1, 2)
2.312 +#define ATTRIBUTE_PRINTF_2 ATTRIBUTE_PRINTF(2, 3)
2.313 +#define ATTRIBUTE_PRINTF_3 ATTRIBUTE_PRINTF(3, 4)
2.314 +#define ATTRIBUTE_PRINTF_4 ATTRIBUTE_PRINTF(4, 5)
2.315 +#define ATTRIBUTE_PRINTF_5 ATTRIBUTE_PRINTF(5, 6)
2.316 +#endif /* ATTRIBUTE_PRINTF */
2.317 +
2.318 +/* Use ATTRIBUTE_NULL_PRINTF when the format specifier may be NULL. A
2.319 + NULL format specifier was allowed as of gcc 3.3. */
2.320 +#ifndef ATTRIBUTE_NULL_PRINTF
2.321 +# if (GCC_VERSION >= 3003)
2.322 +# define ATTRIBUTE_NULL_PRINTF(m, n) __attribute__ ((__format__ (__printf__, m, n)))
2.323 +# else
2.324 +# define ATTRIBUTE_NULL_PRINTF(m, n)
2.325 +# endif /* GNUC >= 3.3 */
2.326 +# define ATTRIBUTE_NULL_PRINTF_1 ATTRIBUTE_NULL_PRINTF(1, 2)
2.327 +# define ATTRIBUTE_NULL_PRINTF_2 ATTRIBUTE_NULL_PRINTF(2, 3)
2.328 +# define ATTRIBUTE_NULL_PRINTF_3 ATTRIBUTE_NULL_PRINTF(3, 4)
2.329 +# define ATTRIBUTE_NULL_PRINTF_4 ATTRIBUTE_NULL_PRINTF(4, 5)
2.330 +# define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6)
2.331 +#endif /* ATTRIBUTE_NULL_PRINTF */
2.332 +
2.333 +/* Attribute `sentinel' was valid as of gcc 3.5. */
2.334 +#ifndef ATTRIBUTE_SENTINEL
2.335 +# if (GCC_VERSION >= 3005)
2.336 +# define ATTRIBUTE_SENTINEL __attribute__ ((__sentinel__))
2.337 +# else
2.338 +# define ATTRIBUTE_SENTINEL
2.339 +# endif /* GNUC >= 3.5 */
2.340 +#endif /* ATTRIBUTE_SENTINEL */
2.341 +
2.342 +/* We use __extension__ in some places to suppress -pedantic warnings
2.343 + about GCC extensions. This feature didn't work properly before
2.344 + gcc 2.8. */
2.345 +#if GCC_VERSION < 2008
2.346 +#define __extension__
2.347 +#endif
2.348 +
2.349 +#endif /* ansidecl.h */
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/src/x86dasm/bfd.h Tue Aug 28 08:46:54 2007 +0000
3.3 @@ -0,0 +1,4714 @@
3.4 +/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically
3.5 + generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c",
3.6 + "bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c",
3.7 + "syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c",
3.8 + "linker.c" and "simple.c".
3.9 + Run "make headers" in your build bfd/ to regenerate. */
3.10 +
3.11 +/* Main header file for the bfd library -- portable access to object files.
3.12 +
3.13 + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3.14 + 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3.15 +
3.16 + Contributed by Cygnus Support.
3.17 +
3.18 + This file is part of BFD, the Binary File Descriptor library.
3.19 +
3.20 + This program is free software; you can redistribute it and/or modify
3.21 + it under the terms of the GNU General Public License as published by
3.22 + the Free Software Foundation; either version 2 of the License, or
3.23 + (at your option) any later version.
3.24 +
3.25 + This program is distributed in the hope that it will be useful,
3.26 + but WITHOUT ANY WARRANTY; without even the implied warranty of
3.27 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.28 + GNU General Public License for more details.
3.29 +
3.30 + You should have received a copy of the GNU General Public License
3.31 + along with this program; if not, write to the Free Software
3.32 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
3.33 +
3.34 +#ifndef __BFD_H_SEEN__
3.35 +#define __BFD_H_SEEN__
3.36 +
3.37 +#ifdef __cplusplus
3.38 +extern "C" {
3.39 +#endif
3.40 +
3.41 +#include "ansidecl.h"
3.42 +#include "symcat.h"
3.43 +#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
3.44 +#ifndef SABER
3.45 +/* This hack is to avoid a problem with some strict ANSI C preprocessors.
3.46 + The problem is, "32_" is not a valid preprocessing token, and we don't
3.47 + want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will
3.48 + cause the inner CONCAT2 macros to be evaluated first, producing
3.49 + still-valid pp-tokens. Then the final concatenation can be done. */
3.50 +#undef CONCAT4
3.51 +#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d))
3.52 +#endif
3.53 +#endif
3.54 +
3.55 +/* The word size used by BFD on the host. This may be 64 with a 32
3.56 + bit target if the host is 64 bit, or if other 64 bit targets have
3.57 + been selected with --enable-targets, or if --enable-64-bit-bfd. */
3.58 +#define BFD_ARCH_SIZE 64
3.59 +
3.60 +/* The word size of the default bfd target. */
3.61 +#define BFD_DEFAULT_TARGET_SIZE 32
3.62 +
3.63 +#define BFD_HOST_64BIT_LONG 0
3.64 +#define BFD_HOST_LONG_LONG 1
3.65 +#if 1
3.66 +#define BFD_HOST_64_BIT long long
3.67 +#define BFD_HOST_U_64_BIT unsigned long long
3.68 +typedef BFD_HOST_64_BIT bfd_int64_t;
3.69 +typedef BFD_HOST_U_64_BIT bfd_uint64_t;
3.70 +#endif
3.71 +
3.72 +#if BFD_ARCH_SIZE >= 64
3.73 +#define BFD64
3.74 +#endif
3.75 +
3.76 +#ifndef INLINE
3.77 +#if __GNUC__ >= 2
3.78 +#define INLINE __inline__
3.79 +#else
3.80 +#define INLINE
3.81 +#endif
3.82 +#endif
3.83 +
3.84 +/* Forward declaration. */
3.85 +typedef struct bfd bfd;
3.86 +
3.87 +/* Boolean type used in bfd. Too many systems define their own
3.88 + versions of "boolean" for us to safely typedef a "boolean" of
3.89 + our own. Using an enum for "bfd_boolean" has its own set of
3.90 + problems, with strange looking casts required to avoid warnings
3.91 + on some older compilers. Thus we just use an int.
3.92 +
3.93 + General rule: Functions which are bfd_boolean return TRUE on
3.94 + success and FALSE on failure (unless they're a predicate). */
3.95 +
3.96 +typedef int bfd_boolean;
3.97 +#undef FALSE
3.98 +#undef TRUE
3.99 +#define FALSE 0
3.100 +#define TRUE 1
3.101 +
3.102 +#ifdef BFD64
3.103 +
3.104 +#ifndef BFD_HOST_64_BIT
3.105 + #error No 64 bit integer type available
3.106 +#endif /* ! defined (BFD_HOST_64_BIT) */
3.107 +
3.108 +typedef BFD_HOST_U_64_BIT bfd_vma;
3.109 +typedef BFD_HOST_64_BIT bfd_signed_vma;
3.110 +typedef BFD_HOST_U_64_BIT bfd_size_type;
3.111 +typedef BFD_HOST_U_64_BIT symvalue;
3.112 +
3.113 +#ifndef fprintf_vma
3.114 +#if BFD_HOST_64BIT_LONG
3.115 +#define sprintf_vma(s,x) sprintf (s, "%016lx", x)
3.116 +#define fprintf_vma(f,x) fprintf (f, "%016lx", x)
3.117 +#else
3.118 +#define _bfd_int64_low(x) ((unsigned long) (((x) & 0xffffffff)))
3.119 +#define _bfd_int64_high(x) ((unsigned long) (((x) >> 32) & 0xffffffff))
3.120 +#define fprintf_vma(s,x) \
3.121 + fprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
3.122 +#define sprintf_vma(s,x) \
3.123 + sprintf ((s), "%08lx%08lx", _bfd_int64_high (x), _bfd_int64_low (x))
3.124 +#endif
3.125 +#endif
3.126 +
3.127 +#else /* not BFD64 */
3.128 +
3.129 +/* Represent a target address. Also used as a generic unsigned type
3.130 + which is guaranteed to be big enough to hold any arithmetic types
3.131 + we need to deal with. */
3.132 +typedef unsigned long bfd_vma;
3.133 +
3.134 +/* A generic signed type which is guaranteed to be big enough to hold any
3.135 + arithmetic types we need to deal with. Can be assumed to be compatible
3.136 + with bfd_vma in the same way that signed and unsigned ints are compatible
3.137 + (as parameters, in assignment, etc). */
3.138 +typedef long bfd_signed_vma;
3.139 +
3.140 +typedef unsigned long symvalue;
3.141 +typedef unsigned long bfd_size_type;
3.142 +
3.143 +/* Print a bfd_vma x on stream s. */
3.144 +#define fprintf_vma(s,x) fprintf (s, "%08lx", x)
3.145 +#define sprintf_vma(s,x) sprintf (s, "%08lx", x)
3.146 +
3.147 +#endif /* not BFD64 */
3.148 +
3.149 +#ifndef BFD_HOST_64_BIT
3.150 +/* Fall back on a 32 bit type. The idea is to make these types always
3.151 + available for function return types, but in the case that
3.152 + BFD_HOST_64_BIT is undefined such a function should abort or
3.153 + otherwise signal an error. */
3.154 +typedef bfd_signed_vma bfd_int64_t;
3.155 +typedef bfd_vma bfd_uint64_t;
3.156 +#endif
3.157 +
3.158 +/* An offset into a file. BFD always uses the largest possible offset
3.159 + based on the build time availability of fseek, fseeko, or fseeko64. */
3.160 +typedef BFD_HOST_64_BIT file_ptr;
3.161 +typedef unsigned BFD_HOST_64_BIT ufile_ptr;
3.162 +
3.163 +extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
3.164 +extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
3.165 +
3.166 +#define printf_vma(x) fprintf_vma(stdout,x)
3.167 +#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x)
3.168 +
3.169 +typedef unsigned int flagword; /* 32 bits of flags */
3.170 +typedef unsigned char bfd_byte;
3.171 +
3.172 +/* File formats. */
3.173 +
3.174 +typedef enum bfd_format
3.175 +{
3.176 + bfd_unknown = 0, /* File format is unknown. */
3.177 + bfd_object, /* Linker/assembler/compiler output. */
3.178 + bfd_archive, /* Object archive file. */
3.179 + bfd_core, /* Core dump. */
3.180 + bfd_type_end /* Marks the end; don't use it! */
3.181 +}
3.182 +bfd_format;
3.183 +
3.184 +/* Values that may appear in the flags field of a BFD. These also
3.185 + appear in the object_flags field of the bfd_target structure, where
3.186 + they indicate the set of flags used by that backend (not all flags
3.187 + are meaningful for all object file formats) (FIXME: at the moment,
3.188 + the object_flags values have mostly just been copied from backend
3.189 + to another, and are not necessarily correct). */
3.190 +
3.191 +/* No flags. */
3.192 +#define BFD_NO_FLAGS 0x00
3.193 +
3.194 +/* BFD contains relocation entries. */
3.195 +#define HAS_RELOC 0x01
3.196 +
3.197 +/* BFD is directly executable. */
3.198 +#define EXEC_P 0x02
3.199 +
3.200 +/* BFD has line number information (basically used for F_LNNO in a
3.201 + COFF header). */
3.202 +#define HAS_LINENO 0x04
3.203 +
3.204 +/* BFD has debugging information. */
3.205 +#define HAS_DEBUG 0x08
3.206 +
3.207 +/* BFD has symbols. */
3.208 +#define HAS_SYMS 0x10
3.209 +
3.210 +/* BFD has local symbols (basically used for F_LSYMS in a COFF
3.211 + header). */
3.212 +#define HAS_LOCALS 0x20
3.213 +
3.214 +/* BFD is a dynamic object. */
3.215 +#define DYNAMIC 0x40
3.216 +
3.217 +/* Text section is write protected (if D_PAGED is not set, this is
3.218 + like an a.out NMAGIC file) (the linker sets this by default, but
3.219 + clears it for -r or -N). */
3.220 +#define WP_TEXT 0x80
3.221 +
3.222 +/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the
3.223 + linker sets this by default, but clears it for -r or -n or -N). */
3.224 +#define D_PAGED 0x100
3.225 +
3.226 +/* BFD is relaxable (this means that bfd_relax_section may be able to
3.227 + do something) (sometimes bfd_relax_section can do something even if
3.228 + this is not set). */
3.229 +#define BFD_IS_RELAXABLE 0x200
3.230 +
3.231 +/* This may be set before writing out a BFD to request using a
3.232 + traditional format. For example, this is used to request that when
3.233 + writing out an a.out object the symbols not be hashed to eliminate
3.234 + duplicates. */
3.235 +#define BFD_TRADITIONAL_FORMAT 0x400
3.236 +
3.237 +/* This flag indicates that the BFD contents are actually cached in
3.238 + memory. If this is set, iostream points to a bfd_in_memory struct. */
3.239 +#define BFD_IN_MEMORY 0x800
3.240 +
3.241 +/* The sections in this BFD specify a memory page. */
3.242 +#define HAS_LOAD_PAGE 0x1000
3.243 +
3.244 +/* This BFD has been created by the linker and doesn't correspond
3.245 + to any input file. */
3.246 +#define BFD_LINKER_CREATED 0x2000
3.247 +
3.248 +/* Symbols and relocation. */
3.249 +
3.250 +/* A count of carsyms (canonical archive symbols). */
3.251 +typedef unsigned long symindex;
3.252 +
3.253 +/* How to perform a relocation. */
3.254 +typedef const struct reloc_howto_struct reloc_howto_type;
3.255 +
3.256 +#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
3.257 +
3.258 +/* General purpose part of a symbol X;
3.259 + target specific parts are in libcoff.h, libaout.h, etc. */
3.260 +
3.261 +#define bfd_get_section(x) ((x)->section)
3.262 +#define bfd_get_output_section(x) ((x)->section->output_section)
3.263 +#define bfd_set_section(x,y) ((x)->section) = (y)
3.264 +#define bfd_asymbol_base(x) ((x)->section->vma)
3.265 +#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
3.266 +#define bfd_asymbol_name(x) ((x)->name)
3.267 +/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
3.268 +#define bfd_asymbol_bfd(x) ((x)->the_bfd)
3.269 +#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
3.270 +
3.271 +/* A canonical archive symbol. */
3.272 +/* This is a type pun with struct ranlib on purpose! */
3.273 +typedef struct carsym
3.274 +{
3.275 + char *name;
3.276 + file_ptr file_offset; /* Look here to find the file. */
3.277 +}
3.278 +carsym; /* To make these you call a carsymogen. */
3.279 +
3.280 +/* Used in generating armaps (archive tables of contents).
3.281 + Perhaps just a forward definition would do? */
3.282 +struct orl /* Output ranlib. */
3.283 +{
3.284 + char **name; /* Symbol name. */
3.285 + union
3.286 + {
3.287 + file_ptr pos;
3.288 + bfd *abfd;
3.289 + } u; /* bfd* or file position. */
3.290 + int namidx; /* Index into string table. */
3.291 +};
3.292 +
3.293 +/* Linenumber stuff. */
3.294 +typedef struct lineno_cache_entry
3.295 +{
3.296 + unsigned int line_number; /* Linenumber from start of function. */
3.297 + union
3.298 + {
3.299 + struct bfd_symbol *sym; /* Function name. */
3.300 + bfd_vma offset; /* Offset into section. */
3.301 + } u;
3.302 +}
3.303 +alent;
3.304 +
3.305 +/* Object and core file sections. */
3.306 +
3.307 +#define align_power(addr, align) \
3.308 + (((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align)))
3.309 +
3.310 +typedef struct bfd_section *sec_ptr;
3.311 +
3.312 +#define bfd_get_section_name(bfd, ptr) ((ptr)->name + 0)
3.313 +#define bfd_get_section_vma(bfd, ptr) ((ptr)->vma + 0)
3.314 +#define bfd_get_section_lma(bfd, ptr) ((ptr)->lma + 0)
3.315 +#define bfd_get_section_alignment(bfd, ptr) ((ptr)->alignment_power + 0)
3.316 +#define bfd_section_name(bfd, ptr) ((ptr)->name)
3.317 +#define bfd_section_size(bfd, ptr) ((ptr)->size)
3.318 +#define bfd_get_section_size(ptr) ((ptr)->size)
3.319 +#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
3.320 +#define bfd_section_lma(bfd, ptr) ((ptr)->lma)
3.321 +#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
3.322 +#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
3.323 +#define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
3.324 +
3.325 +#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
3.326 +
3.327 +#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
3.328 +#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
3.329 +#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
3.330 +/* Find the address one past the end of SEC. */
3.331 +#define bfd_get_section_limit(bfd, sec) \
3.332 + (((sec)->rawsize ? (sec)->rawsize : (sec)->size) \
3.333 + / bfd_octets_per_byte (bfd))
3.334 +
3.335 +typedef struct stat stat_type;
3.336 +
3.337 +typedef enum bfd_print_symbol
3.338 +{
3.339 + bfd_print_symbol_name,
3.340 + bfd_print_symbol_more,
3.341 + bfd_print_symbol_all
3.342 +} bfd_print_symbol_type;
3.343 +
3.344 +/* Information about a symbol that nm needs. */
3.345 +
3.346 +typedef struct _symbol_info
3.347 +{
3.348 + symvalue value;
3.349 + char type;
3.350 + const char *name; /* Symbol name. */
3.351 + unsigned char stab_type; /* Stab type. */
3.352 + char stab_other; /* Stab other. */
3.353 + short stab_desc; /* Stab desc. */
3.354 + const char *stab_name; /* String for stab type. */
3.355 +} symbol_info;
3.356 +
3.357 +/* Get the name of a stabs type code. */
3.358 +
3.359 +extern const char *bfd_get_stab_name (int);
3.360 +
3.361 +/* Hash table routines. There is no way to free up a hash table. */
3.362 +
3.363 +/* An element in the hash table. Most uses will actually use a larger
3.364 + structure, and an instance of this will be the first field. */
3.365 +
3.366 +struct bfd_hash_entry
3.367 +{
3.368 + /* Next entry for this hash code. */
3.369 + struct bfd_hash_entry *next;
3.370 + /* String being hashed. */
3.371 + const char *string;
3.372 + /* Hash code. This is the full hash code, not the index into the
3.373 + table. */
3.374 + unsigned long hash;
3.375 +};
3.376 +
3.377 +/* A hash table. */
3.378 +
3.379 +struct bfd_hash_table
3.380 +{
3.381 + /* The hash array. */
3.382 + struct bfd_hash_entry **table;
3.383 + /* The number of slots in the hash table. */
3.384 + unsigned int size;
3.385 + /* A function used to create new elements in the hash table. The
3.386 + first entry is itself a pointer to an element. When this
3.387 + function is first invoked, this pointer will be NULL. However,
3.388 + having the pointer permits a hierarchy of method functions to be
3.389 + built each of which calls the function in the superclass. Thus
3.390 + each function should be written to allocate a new block of memory
3.391 + only if the argument is NULL. */
3.392 + struct bfd_hash_entry *(*newfunc)
3.393 + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
3.394 + /* An objalloc for this hash table. This is a struct objalloc *,
3.395 + but we use void * to avoid requiring the inclusion of objalloc.h. */
3.396 + void *memory;
3.397 +};
3.398 +
3.399 +/* Initialize a hash table. */
3.400 +extern bfd_boolean bfd_hash_table_init
3.401 + (struct bfd_hash_table *,
3.402 + struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
3.403 + struct bfd_hash_table *,
3.404 + const char *));
3.405 +
3.406 +/* Initialize a hash table specifying a size. */
3.407 +extern bfd_boolean bfd_hash_table_init_n
3.408 + (struct bfd_hash_table *,
3.409 + struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
3.410 + struct bfd_hash_table *,
3.411 + const char *),
3.412 + unsigned int size);
3.413 +
3.414 +/* Free up a hash table. */
3.415 +extern void bfd_hash_table_free
3.416 + (struct bfd_hash_table *);
3.417 +
3.418 +/* Look up a string in a hash table. If CREATE is TRUE, a new entry
3.419 + will be created for this string if one does not already exist. The
3.420 + COPY argument must be TRUE if this routine should copy the string
3.421 + into newly allocated memory when adding an entry. */
3.422 +extern struct bfd_hash_entry *bfd_hash_lookup
3.423 + (struct bfd_hash_table *, const char *, bfd_boolean create,
3.424 + bfd_boolean copy);
3.425 +
3.426 +/* Replace an entry in a hash table. */
3.427 +extern void bfd_hash_replace
3.428 + (struct bfd_hash_table *, struct bfd_hash_entry *old,
3.429 + struct bfd_hash_entry *nw);
3.430 +
3.431 +/* Base method for creating a hash table entry. */
3.432 +extern struct bfd_hash_entry *bfd_hash_newfunc
3.433 + (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
3.434 +
3.435 +/* Grab some space for a hash table entry. */
3.436 +extern void *bfd_hash_allocate
3.437 + (struct bfd_hash_table *, unsigned int);
3.438 +
3.439 +/* Traverse a hash table in a random order, calling a function on each
3.440 + element. If the function returns FALSE, the traversal stops. The
3.441 + INFO argument is passed to the function. */
3.442 +extern void bfd_hash_traverse
3.443 + (struct bfd_hash_table *,
3.444 + bfd_boolean (*) (struct bfd_hash_entry *, void *),
3.445 + void *info);
3.446 +
3.447 +/* Allows the default size of a hash table to be configured. New hash
3.448 + tables allocated using bfd_hash_table_init will be created with
3.449 + this size. */
3.450 +extern void bfd_hash_set_default_size (bfd_size_type);
3.451 +
3.452 +/* This structure is used to keep track of stabs in sections
3.453 + information while linking. */
3.454 +
3.455 +struct stab_info
3.456 +{
3.457 + /* A hash table used to hold stabs strings. */
3.458 + struct bfd_strtab_hash *strings;
3.459 + /* The header file hash table. */
3.460 + struct bfd_hash_table includes;
3.461 + /* The first .stabstr section. */
3.462 + struct bfd_section *stabstr;
3.463 +};
3.464 +
3.465 +#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table
3.466 +
3.467 +/* User program access to BFD facilities. */
3.468 +
3.469 +/* Direct I/O routines, for programs which know more about the object
3.470 + file than BFD does. Use higher level routines if possible. */
3.471 +
3.472 +extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *);
3.473 +extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *);
3.474 +extern int bfd_seek (bfd *, file_ptr, int);
3.475 +extern file_ptr bfd_tell (bfd *);
3.476 +extern int bfd_flush (bfd *);
3.477 +extern int bfd_stat (bfd *, struct stat *);
3.478 +
3.479 +/* Deprecated old routines. */
3.480 +#if __GNUC__
3.481 +#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
3.482 + (warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \
3.483 + bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
3.484 +#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
3.485 + (warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \
3.486 + bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
3.487 +#else
3.488 +#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \
3.489 + (warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \
3.490 + bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
3.491 +#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \
3.492 + (warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\
3.493 + bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD)))
3.494 +#endif
3.495 +extern void warn_deprecated (const char *, const char *, int, const char *);
3.496 +
3.497 +/* Cast from const char * to char * so that caller can assign to
3.498 + a char * without a warning. */
3.499 +#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
3.500 +#define bfd_get_cacheable(abfd) ((abfd)->cacheable)
3.501 +#define bfd_get_format(abfd) ((abfd)->format)
3.502 +#define bfd_get_target(abfd) ((abfd)->xvec->name)
3.503 +#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
3.504 +#define bfd_family_coff(abfd) \
3.505 + (bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
3.506 + bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
3.507 +#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
3.508 +#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
3.509 +#define bfd_header_big_endian(abfd) \
3.510 + ((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
3.511 +#define bfd_header_little_endian(abfd) \
3.512 + ((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
3.513 +#define bfd_get_file_flags(abfd) ((abfd)->flags)
3.514 +#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
3.515 +#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
3.516 +#define bfd_my_archive(abfd) ((abfd)->my_archive)
3.517 +#define bfd_has_map(abfd) ((abfd)->has_armap)
3.518 +
3.519 +#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
3.520 +#define bfd_usrdata(abfd) ((abfd)->usrdata)
3.521 +
3.522 +#define bfd_get_start_address(abfd) ((abfd)->start_address)
3.523 +#define bfd_get_symcount(abfd) ((abfd)->symcount)
3.524 +#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
3.525 +#define bfd_count_sections(abfd) ((abfd)->section_count)
3.526 +
3.527 +#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
3.528 +
3.529 +#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
3.530 +
3.531 +#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
3.532 +
3.533 +extern bfd_boolean bfd_cache_close
3.534 + (bfd *abfd);
3.535 +/* NB: This declaration should match the autogenerated one in libbfd.h. */
3.536 +
3.537 +extern bfd_boolean bfd_cache_close_all (void);
3.538 +
3.539 +extern bfd_boolean bfd_record_phdr
3.540 + (bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma,
3.541 + bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **);
3.542 +
3.543 +/* Byte swapping routines. */
3.544 +
3.545 +bfd_uint64_t bfd_getb64 (const void *);
3.546 +bfd_uint64_t bfd_getl64 (const void *);
3.547 +bfd_int64_t bfd_getb_signed_64 (const void *);
3.548 +bfd_int64_t bfd_getl_signed_64 (const void *);
3.549 +bfd_vma bfd_getb32 (const void *);
3.550 +bfd_vma bfd_getl32 (const void *);
3.551 +bfd_signed_vma bfd_getb_signed_32 (const void *);
3.552 +bfd_signed_vma bfd_getl_signed_32 (const void *);
3.553 +bfd_vma bfd_getb16 (const void *);
3.554 +bfd_vma bfd_getl16 (const void *);
3.555 +bfd_signed_vma bfd_getb_signed_16 (const void *);
3.556 +bfd_signed_vma bfd_getl_signed_16 (const void *);
3.557 +void bfd_putb64 (bfd_uint64_t, void *);
3.558 +void bfd_putl64 (bfd_uint64_t, void *);
3.559 +void bfd_putb32 (bfd_vma, void *);
3.560 +void bfd_putl32 (bfd_vma, void *);
3.561 +void bfd_putb16 (bfd_vma, void *);
3.562 +void bfd_putl16 (bfd_vma, void *);
3.563 +
3.564 +/* Byte swapping routines which take size and endiannes as arguments. */
3.565 +
3.566 +bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
3.567 +void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
3.568 +
3.569 +extern bfd_boolean bfd_section_already_linked_table_init (void);
3.570 +extern void bfd_section_already_linked_table_free (void);
3.571 +
3.572 +/* Externally visible ECOFF routines. */
3.573 +
3.574 +#if defined(__STDC__) || defined(ALMOST_STDC)
3.575 +struct ecoff_debug_info;
3.576 +struct ecoff_debug_swap;
3.577 +struct ecoff_extr;
3.578 +struct bfd_symbol;
3.579 +struct bfd_link_info;
3.580 +struct bfd_link_hash_entry;
3.581 +struct bfd_elf_version_tree;
3.582 +#endif
3.583 +extern bfd_vma bfd_ecoff_get_gp_value
3.584 + (bfd * abfd);
3.585 +extern bfd_boolean bfd_ecoff_set_gp_value
3.586 + (bfd *abfd, bfd_vma gp_value);
3.587 +extern bfd_boolean bfd_ecoff_set_regmasks
3.588 + (bfd *abfd, unsigned long gprmask, unsigned long fprmask,
3.589 + unsigned long *cprmask);
3.590 +extern void *bfd_ecoff_debug_init
3.591 + (bfd *output_bfd, struct ecoff_debug_info *output_debug,
3.592 + const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
3.593 +extern void bfd_ecoff_debug_free
3.594 + (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
3.595 + const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
3.596 +extern bfd_boolean bfd_ecoff_debug_accumulate
3.597 + (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
3.598 + const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
3.599 + struct ecoff_debug_info *input_debug,
3.600 + const struct ecoff_debug_swap *input_swap, struct bfd_link_info *);
3.601 +extern bfd_boolean bfd_ecoff_debug_accumulate_other
3.602 + (void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
3.603 + const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
3.604 + struct bfd_link_info *);
3.605 +extern bfd_boolean bfd_ecoff_debug_externals
3.606 + (bfd *abfd, struct ecoff_debug_info *debug,
3.607 + const struct ecoff_debug_swap *swap, bfd_boolean relocatable,
3.608 + bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *),
3.609 + void (*set_index) (struct bfd_symbol *, bfd_size_type));
3.610 +extern bfd_boolean bfd_ecoff_debug_one_external
3.611 + (bfd *abfd, struct ecoff_debug_info *debug,
3.612 + const struct ecoff_debug_swap *swap, const char *name,
3.613 + struct ecoff_extr *esym);
3.614 +extern bfd_size_type bfd_ecoff_debug_size
3.615 + (bfd *abfd, struct ecoff_debug_info *debug,
3.616 + const struct ecoff_debug_swap *swap);
3.617 +extern bfd_boolean bfd_ecoff_write_debug
3.618 + (bfd *abfd, struct ecoff_debug_info *debug,
3.619 + const struct ecoff_debug_swap *swap, file_ptr where);
3.620 +extern bfd_boolean bfd_ecoff_write_accumulated_debug
3.621 + (void *handle, bfd *abfd, struct ecoff_debug_info *debug,
3.622 + const struct ecoff_debug_swap *swap,
3.623 + struct bfd_link_info *info, file_ptr where);
3.624 +
3.625 +/* Externally visible ELF routines. */
3.626 +
3.627 +struct bfd_link_needed_list
3.628 +{
3.629 + struct bfd_link_needed_list *next;
3.630 + bfd *by;
3.631 + const char *name;
3.632 +};
3.633 +
3.634 +enum dynamic_lib_link_class {
3.635 + DYN_NORMAL = 0,
3.636 + DYN_AS_NEEDED = 1,
3.637 + DYN_DT_NEEDED = 2,
3.638 + DYN_NO_ADD_NEEDED = 4,
3.639 + DYN_NO_NEEDED = 8
3.640 +};
3.641 +
3.642 +extern bfd_boolean bfd_elf_record_link_assignment
3.643 + (bfd *, struct bfd_link_info *, const char *, bfd_boolean);
3.644 +extern struct bfd_link_needed_list *bfd_elf_get_needed_list
3.645 + (bfd *, struct bfd_link_info *);
3.646 +extern bfd_boolean bfd_elf_get_bfd_needed_list
3.647 + (bfd *, struct bfd_link_needed_list **);
3.648 +extern bfd_boolean bfd_elf_size_dynamic_sections
3.649 + (bfd *, const char *, const char *, const char *, const char * const *,
3.650 + struct bfd_link_info *, struct bfd_section **, struct bfd_elf_version_tree *);
3.651 +extern void bfd_elf_set_dt_needed_name
3.652 + (bfd *, const char *);
3.653 +extern const char *bfd_elf_get_dt_soname
3.654 + (bfd *);
3.655 +extern void bfd_elf_set_dyn_lib_class
3.656 + (bfd *, int);
3.657 +extern int bfd_elf_get_dyn_lib_class
3.658 + (bfd *);
3.659 +extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
3.660 + (bfd *, struct bfd_link_info *);
3.661 +extern bfd_boolean bfd_elf_discard_info
3.662 + (bfd *, struct bfd_link_info *);
3.663 +
3.664 +/* Return an upper bound on the number of bytes required to store a
3.665 + copy of ABFD's program header table entries. Return -1 if an error
3.666 + occurs; bfd_get_error will return an appropriate code. */
3.667 +extern long bfd_get_elf_phdr_upper_bound
3.668 + (bfd *abfd);
3.669 +
3.670 +/* Copy ABFD's program header table entries to *PHDRS. The entries
3.671 + will be stored as an array of Elf_Internal_Phdr structures, as
3.672 + defined in include/elf/internal.h. To find out how large the
3.673 + buffer needs to be, call bfd_get_elf_phdr_upper_bound.
3.674 +
3.675 + Return the number of program header table entries read, or -1 if an
3.676 + error occurs; bfd_get_error will return an appropriate code. */
3.677 +extern int bfd_get_elf_phdrs
3.678 + (bfd *abfd, void *phdrs);
3.679 +
3.680 +/* Create a new BFD as if by bfd_openr. Rather than opening a file,
3.681 + reconstruct an ELF file by reading the segments out of remote memory
3.682 + based on the ELF file header at EHDR_VMA and the ELF program headers it
3.683 + points to. If not null, *LOADBASEP is filled in with the difference
3.684 + between the VMAs from which the segments were read, and the VMAs the
3.685 + file headers (and hence BFD's idea of each section's VMA) put them at.
3.686 +
3.687 + The function TARGET_READ_MEMORY is called to copy LEN bytes from the
3.688 + remote memory at target address VMA into the local buffer at MYADDR; it
3.689 + should return zero on success or an `errno' code on failure. TEMPL must
3.690 + be a BFD for an ELF target with the word size and byte order found in
3.691 + the remote memory. */
3.692 +extern bfd *bfd_elf_bfd_from_remote_memory
3.693 + (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep,
3.694 + int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len));
3.695 +
3.696 +/* Return the arch_size field of an elf bfd, or -1 if not elf. */
3.697 +extern int bfd_get_arch_size
3.698 + (bfd *);
3.699 +
3.700 +/* Return TRUE if address "naturally" sign extends, or -1 if not elf. */
3.701 +extern int bfd_get_sign_extend_vma
3.702 + (bfd *);
3.703 +
3.704 +extern struct bfd_section *_bfd_elf_tls_setup
3.705 + (bfd *, struct bfd_link_info *);
3.706 +
3.707 +extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
3.708 + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
3.709 +
3.710 +/* SunOS shared library support routines for the linker. */
3.711 +
3.712 +extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
3.713 + (bfd *, struct bfd_link_info *);
3.714 +extern bfd_boolean bfd_sunos_record_link_assignment
3.715 + (bfd *, struct bfd_link_info *, const char *);
3.716 +extern bfd_boolean bfd_sunos_size_dynamic_sections
3.717 + (bfd *, struct bfd_link_info *, struct bfd_section **, struct bfd_section **, struct bfd_section **);
3.718 +
3.719 +/* Linux shared library support routines for the linker. */
3.720 +
3.721 +extern bfd_boolean bfd_i386linux_size_dynamic_sections
3.722 + (bfd *, struct bfd_link_info *);
3.723 +extern bfd_boolean bfd_m68klinux_size_dynamic_sections
3.724 + (bfd *, struct bfd_link_info *);
3.725 +extern bfd_boolean bfd_sparclinux_size_dynamic_sections
3.726 + (bfd *, struct bfd_link_info *);
3.727 +
3.728 +/* mmap hacks */
3.729 +
3.730 +struct _bfd_window_internal;
3.731 +typedef struct _bfd_window_internal bfd_window_internal;
3.732 +
3.733 +typedef struct _bfd_window
3.734 +{
3.735 + /* What the user asked for. */
3.736 + void *data;
3.737 + bfd_size_type size;
3.738 + /* The actual window used by BFD. Small user-requested read-only
3.739 + regions sharing a page may share a single window into the object
3.740 + file. Read-write versions shouldn't until I've fixed things to
3.741 + keep track of which portions have been claimed by the
3.742 + application; don't want to give the same region back when the
3.743 + application wants two writable copies! */
3.744 + struct _bfd_window_internal *i;
3.745 +}
3.746 +bfd_window;
3.747 +
3.748 +extern void bfd_init_window
3.749 + (bfd_window *);
3.750 +extern void bfd_free_window
3.751 + (bfd_window *);
3.752 +extern bfd_boolean bfd_get_file_window
3.753 + (bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean);
3.754 +
3.755 +/* XCOFF support routines for the linker. */
3.756 +
3.757 +extern bfd_boolean bfd_xcoff_link_record_set
3.758 + (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type);
3.759 +extern bfd_boolean bfd_xcoff_import_symbol
3.760 + (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma,
3.761 + const char *, const char *, const char *, unsigned int);
3.762 +extern bfd_boolean bfd_xcoff_export_symbol
3.763 + (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *);
3.764 +extern bfd_boolean bfd_xcoff_link_count_reloc
3.765 + (bfd *, struct bfd_link_info *, const char *);
3.766 +extern bfd_boolean bfd_xcoff_record_link_assignment
3.767 + (bfd *, struct bfd_link_info *, const char *);
3.768 +extern bfd_boolean bfd_xcoff_size_dynamic_sections
3.769 + (bfd *, struct bfd_link_info *, const char *, const char *,
3.770 + unsigned long, unsigned long, unsigned long, bfd_boolean,
3.771 + int, bfd_boolean, bfd_boolean, struct bfd_section **, bfd_boolean);
3.772 +extern bfd_boolean bfd_xcoff_link_generate_rtinit
3.773 + (bfd *, const char *, const char *, bfd_boolean);
3.774 +
3.775 +/* XCOFF support routines for ar. */
3.776 +extern bfd_boolean bfd_xcoff_ar_archive_set_magic
3.777 + (bfd *, char *);
3.778 +
3.779 +/* Externally visible COFF routines. */
3.780 +
3.781 +#if defined(__STDC__) || defined(ALMOST_STDC)
3.782 +struct internal_syment;
3.783 +union internal_auxent;
3.784 +#endif
3.785 +
3.786 +extern bfd_boolean bfd_coff_get_syment
3.787 + (bfd *, struct bfd_symbol *, struct internal_syment *);
3.788 +
3.789 +extern bfd_boolean bfd_coff_get_auxent
3.790 + (bfd *, struct bfd_symbol *, int, union internal_auxent *);
3.791 +
3.792 +extern bfd_boolean bfd_coff_set_symbol_class
3.793 + (bfd *, struct bfd_symbol *, unsigned int);
3.794 +
3.795 +extern bfd_boolean bfd_m68k_coff_create_embedded_relocs
3.796 + (bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **);
3.797 +
3.798 +/* ARM Interworking support. Called from linker. */
3.799 +extern bfd_boolean bfd_arm_allocate_interworking_sections
3.800 + (struct bfd_link_info *);
3.801 +
3.802 +extern bfd_boolean bfd_arm_process_before_allocation
3.803 + (bfd *, struct bfd_link_info *, int);
3.804 +
3.805 +extern bfd_boolean bfd_arm_get_bfd_for_interworking
3.806 + (bfd *, struct bfd_link_info *);
3.807 +
3.808 +/* PE ARM Interworking support. Called from linker. */
3.809 +extern bfd_boolean bfd_arm_pe_allocate_interworking_sections
3.810 + (struct bfd_link_info *);
3.811 +
3.812 +extern bfd_boolean bfd_arm_pe_process_before_allocation
3.813 + (bfd *, struct bfd_link_info *, int);
3.814 +
3.815 +extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking
3.816 + (bfd *, struct bfd_link_info *);
3.817 +
3.818 +/* ELF ARM Interworking support. Called from linker. */
3.819 +extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
3.820 + (struct bfd_link_info *);
3.821 +
3.822 +extern bfd_boolean bfd_elf32_arm_process_before_allocation
3.823 + (bfd *, struct bfd_link_info *, int);
3.824 +
3.825 +void bfd_elf32_arm_set_target_relocs
3.826 + (struct bfd_link_info *, int, char *, int);
3.827 +
3.828 +extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
3.829 + (bfd *, struct bfd_link_info *);
3.830 +
3.831 +extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
3.832 + (bfd *, struct bfd_link_info *);
3.833 +
3.834 +/* ARM Note section processing. */
3.835 +extern bfd_boolean bfd_arm_merge_machines
3.836 + (bfd *, bfd *);
3.837 +
3.838 +extern bfd_boolean bfd_arm_update_notes
3.839 + (bfd *, const char *);
3.840 +
3.841 +extern unsigned int bfd_arm_get_mach_from_notes
3.842 + (bfd *, const char *);
3.843 +
3.844 +/* TI COFF load page support. */
3.845 +extern void bfd_ticoff_set_section_load_page
3.846 + (struct bfd_section *, int);
3.847 +
3.848 +extern int bfd_ticoff_get_section_load_page
3.849 + (struct bfd_section *);
3.850 +
3.851 +/* H8/300 functions. */
3.852 +extern bfd_vma bfd_h8300_pad_address
3.853 + (bfd *, bfd_vma);
3.854 +
3.855 +/* IA64 Itanium code generation. Called from linker. */
3.856 +extern void bfd_elf32_ia64_after_parse
3.857 + (int);
3.858 +
3.859 +extern void bfd_elf64_ia64_after_parse
3.860 + (int);
3.861 +
3.862 +/* This structure is used for a comdat section, as in PE. A comdat
3.863 + section is associated with a particular symbol. When the linker
3.864 + sees a comdat section, it keeps only one of the sections with a
3.865 + given name and associated with a given symbol. */
3.866 +
3.867 +struct coff_comdat_info
3.868 +{
3.869 + /* The name of the symbol associated with a comdat section. */
3.870 + const char *name;
3.871 +
3.872 + /* The local symbol table index of the symbol associated with a
3.873 + comdat section. This is only meaningful to the object file format
3.874 + specific code; it is not an index into the list returned by
3.875 + bfd_canonicalize_symtab. */
3.876 + long symbol;
3.877 +};
3.878 +
3.879 +extern struct coff_comdat_info *bfd_coff_get_comdat_section
3.880 + (bfd *, struct bfd_section *);
3.881 +
3.882 +/* Extracted from init.c. */
3.883 +void bfd_init (void);
3.884 +
3.885 +/* Extracted from opncls.c. */
3.886 +bfd *bfd_openr (const char *filename, const char *target);
3.887 +
3.888 +bfd *bfd_fdopenr (const char *filename, const char *target, int fd);
3.889 +
3.890 +bfd *bfd_openstreamr (const char *, const char *, void *);
3.891 +
3.892 +bfd *bfd_openr_iovec (const char *filename, const char *target,
3.893 + void *(*open) (struct bfd *nbfd,
3.894 + void *open_closure),
3.895 + void *open_closure,
3.896 + file_ptr (*pread) (struct bfd *nbfd,
3.897 + void *stream,
3.898 + void *buf,
3.899 + file_ptr nbytes,
3.900 + file_ptr offset),
3.901 + int (*close) (struct bfd *nbfd,
3.902 + void *stream));
3.903 +
3.904 +bfd *bfd_openw (const char *filename, const char *target);
3.905 +
3.906 +bfd_boolean bfd_close (bfd *abfd);
3.907 +
3.908 +bfd_boolean bfd_close_all_done (bfd *);
3.909 +
3.910 +bfd *bfd_create (const char *filename, bfd *templ);
3.911 +
3.912 +bfd_boolean bfd_make_writable (bfd *abfd);
3.913 +
3.914 +bfd_boolean bfd_make_readable (bfd *abfd);
3.915 +
3.916 +unsigned long bfd_calc_gnu_debuglink_crc32
3.917 + (unsigned long crc, const unsigned char *buf, bfd_size_type len);
3.918 +
3.919 +char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir);
3.920 +
3.921 +struct bfd_section *bfd_create_gnu_debuglink_section
3.922 + (bfd *abfd, const char *filename);
3.923 +
3.924 +bfd_boolean bfd_fill_in_gnu_debuglink_section
3.925 + (bfd *abfd, struct bfd_section *sect, const char *filename);
3.926 +
3.927 +/* Extracted from libbfd.c. */
3.928 +
3.929 +/* Byte swapping macros for user section data. */
3.930 +
3.931 +#define bfd_put_8(abfd, val, ptr) \
3.932 + ((void) (*((unsigned char *) (ptr)) = (val) & 0xff))
3.933 +#define bfd_put_signed_8 \
3.934 + bfd_put_8
3.935 +#define bfd_get_8(abfd, ptr) \
3.936 + (*(unsigned char *) (ptr) & 0xff)
3.937 +#define bfd_get_signed_8(abfd, ptr) \
3.938 + (((*(unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80)
3.939 +
3.940 +#define bfd_put_16(abfd, val, ptr) \
3.941 + BFD_SEND (abfd, bfd_putx16, ((val),(ptr)))
3.942 +#define bfd_put_signed_16 \
3.943 + bfd_put_16
3.944 +#define bfd_get_16(abfd, ptr) \
3.945 + BFD_SEND (abfd, bfd_getx16, (ptr))
3.946 +#define bfd_get_signed_16(abfd, ptr) \
3.947 + BFD_SEND (abfd, bfd_getx_signed_16, (ptr))
3.948 +
3.949 +#define bfd_put_32(abfd, val, ptr) \
3.950 + BFD_SEND (abfd, bfd_putx32, ((val),(ptr)))
3.951 +#define bfd_put_signed_32 \
3.952 + bfd_put_32
3.953 +#define bfd_get_32(abfd, ptr) \
3.954 + BFD_SEND (abfd, bfd_getx32, (ptr))
3.955 +#define bfd_get_signed_32(abfd, ptr) \
3.956 + BFD_SEND (abfd, bfd_getx_signed_32, (ptr))
3.957 +
3.958 +#define bfd_put_64(abfd, val, ptr) \
3.959 + BFD_SEND (abfd, bfd_putx64, ((val), (ptr)))
3.960 +#define bfd_put_signed_64 \
3.961 + bfd_put_64
3.962 +#define bfd_get_64(abfd, ptr) \
3.963 + BFD_SEND (abfd, bfd_getx64, (ptr))
3.964 +#define bfd_get_signed_64(abfd, ptr) \
3.965 + BFD_SEND (abfd, bfd_getx_signed_64, (ptr))
3.966 +
3.967 +#define bfd_get(bits, abfd, ptr) \
3.968 + ((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \
3.969 + : (bits) == 16 ? bfd_get_16 (abfd, ptr) \
3.970 + : (bits) == 32 ? bfd_get_32 (abfd, ptr) \
3.971 + : (bits) == 64 ? bfd_get_64 (abfd, ptr) \
3.972 + : (abort (), (bfd_vma) - 1))
3.973 +
3.974 +#define bfd_put(bits, abfd, val, ptr) \
3.975 + ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
3.976 + : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
3.977 + : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
3.978 + : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
3.979 + : (abort (), (void) 0))
3.980 +
3.981 +
3.982 +/* Byte swapping macros for file header data. */
3.983 +
3.984 +#define bfd_h_put_8(abfd, val, ptr) \
3.985 + bfd_put_8 (abfd, val, ptr)
3.986 +#define bfd_h_put_signed_8(abfd, val, ptr) \
3.987 + bfd_put_8 (abfd, val, ptr)
3.988 +#define bfd_h_get_8(abfd, ptr) \
3.989 + bfd_get_8 (abfd, ptr)
3.990 +#define bfd_h_get_signed_8(abfd, ptr) \
3.991 + bfd_get_signed_8 (abfd, ptr)
3.992 +
3.993 +#define bfd_h_put_16(abfd, val, ptr) \
3.994 + BFD_SEND (abfd, bfd_h_putx16, (val, ptr))
3.995 +#define bfd_h_put_signed_16 \
3.996 + bfd_h_put_16
3.997 +#define bfd_h_get_16(abfd, ptr) \
3.998 + BFD_SEND (abfd, bfd_h_getx16, (ptr))
3.999 +#define bfd_h_get_signed_16(abfd, ptr) \
3.1000 + BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr))
3.1001 +
3.1002 +#define bfd_h_put_32(abfd, val, ptr) \
3.1003 + BFD_SEND (abfd, bfd_h_putx32, (val, ptr))
3.1004 +#define bfd_h_put_signed_32 \
3.1005 + bfd_h_put_32
3.1006 +#define bfd_h_get_32(abfd, ptr) \
3.1007 + BFD_SEND (abfd, bfd_h_getx32, (ptr))
3.1008 +#define bfd_h_get_signed_32(abfd, ptr) \
3.1009 + BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr))
3.1010 +
3.1011 +#define bfd_h_put_64(abfd, val, ptr) \
3.1012 + BFD_SEND (abfd, bfd_h_putx64, (val, ptr))
3.1013 +#define bfd_h_put_signed_64 \
3.1014 + bfd_h_put_64
3.1015 +#define bfd_h_get_64(abfd, ptr) \
3.1016 + BFD_SEND (abfd, bfd_h_getx64, (ptr))
3.1017 +#define bfd_h_get_signed_64(abfd, ptr) \
3.1018 + BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr))
3.1019 +
3.1020 +/* Aliases for the above, which should eventually go away. */
3.1021 +
3.1022 +#define H_PUT_64 bfd_h_put_64
3.1023 +#define H_PUT_32 bfd_h_put_32
3.1024 +#define H_PUT_16 bfd_h_put_16
3.1025 +#define H_PUT_8 bfd_h_put_8
3.1026 +#define H_PUT_S64 bfd_h_put_signed_64
3.1027 +#define H_PUT_S32 bfd_h_put_signed_32
3.1028 +#define H_PUT_S16 bfd_h_put_signed_16
3.1029 +#define H_PUT_S8 bfd_h_put_signed_8
3.1030 +#define H_GET_64 bfd_h_get_64
3.1031 +#define H_GET_32 bfd_h_get_32
3.1032 +#define H_GET_16 bfd_h_get_16
3.1033 +#define H_GET_8 bfd_h_get_8
3.1034 +#define H_GET_S64 bfd_h_get_signed_64
3.1035 +#define H_GET_S32 bfd_h_get_signed_32
3.1036 +#define H_GET_S16 bfd_h_get_signed_16
3.1037 +#define H_GET_S8 bfd_h_get_signed_8
3.1038 +
3.1039 +
3.1040 +/* Extracted from bfdio.c. */
3.1041 +long bfd_get_mtime (bfd *abfd);
3.1042 +
3.1043 +long bfd_get_size (bfd *abfd);
3.1044 +
3.1045 +/* Extracted from bfdwin.c. */
3.1046 +/* Extracted from section.c. */
3.1047 +typedef struct bfd_section
3.1048 +{
3.1049 + /* The name of the section; the name isn't a copy, the pointer is
3.1050 + the same as that passed to bfd_make_section. */
3.1051 + const char *name;
3.1052 +
3.1053 + /* A unique sequence number. */
3.1054 + int id;
3.1055 +
3.1056 + /* Which section in the bfd; 0..n-1 as sections are created in a bfd. */
3.1057 + int index;
3.1058 +
3.1059 + /* The next section in the list belonging to the BFD, or NULL. */
3.1060 + struct bfd_section *next;
3.1061 +
3.1062 + /* The field flags contains attributes of the section. Some
3.1063 + flags are read in from the object file, and some are
3.1064 + synthesized from other information. */
3.1065 + flagword flags;
3.1066 +
3.1067 +#define SEC_NO_FLAGS 0x000
3.1068 +
3.1069 + /* Tells the OS to allocate space for this section when loading.
3.1070 + This is clear for a section containing debug information only. */
3.1071 +#define SEC_ALLOC 0x001
3.1072 +
3.1073 + /* Tells the OS to load the section from the file when loading.
3.1074 + This is clear for a .bss section. */
3.1075 +#define SEC_LOAD 0x002
3.1076 +
3.1077 + /* The section contains data still to be relocated, so there is
3.1078 + some relocation information too. */
3.1079 +#define SEC_RELOC 0x004
3.1080 +
3.1081 + /* A signal to the OS that the section contains read only data. */
3.1082 +#define SEC_READONLY 0x008
3.1083 +
3.1084 + /* The section contains code only. */
3.1085 +#define SEC_CODE 0x010
3.1086 +
3.1087 + /* The section contains data only. */
3.1088 +#define SEC_DATA 0x020
3.1089 +
3.1090 + /* The section will reside in ROM. */
3.1091 +#define SEC_ROM 0x040
3.1092 +
3.1093 + /* The section contains constructor information. This section
3.1094 + type is used by the linker to create lists of constructors and
3.1095 + destructors used by <<g++>>. When a back end sees a symbol
3.1096 + which should be used in a constructor list, it creates a new
3.1097 + section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
3.1098 + the symbol to it, and builds a relocation. To build the lists
3.1099 + of constructors, all the linker has to do is catenate all the
3.1100 + sections called <<__CTOR_LIST__>> and relocate the data
3.1101 + contained within - exactly the operations it would peform on
3.1102 + standard data. */
3.1103 +#define SEC_CONSTRUCTOR 0x080
3.1104 +
3.1105 + /* The section has contents - a data section could be
3.1106 + <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
3.1107 + <<SEC_HAS_CONTENTS>> */
3.1108 +#define SEC_HAS_CONTENTS 0x100
3.1109 +
3.1110 + /* An instruction to the linker to not output the section
3.1111 + even if it has information which would normally be written. */
3.1112 +#define SEC_NEVER_LOAD 0x200
3.1113 +
3.1114 + /* The section contains thread local data. */
3.1115 +#define SEC_THREAD_LOCAL 0x400
3.1116 +
3.1117 + /* The section has GOT references. This flag is only for the
3.1118 + linker, and is currently only used by the elf32-hppa back end.
3.1119 + It will be set if global offset table references were detected
3.1120 + in this section, which indicate to the linker that the section
3.1121 + contains PIC code, and must be handled specially when doing a
3.1122 + static link. */
3.1123 +#define SEC_HAS_GOT_REF 0x800
3.1124 +
3.1125 + /* The section contains common symbols (symbols may be defined
3.1126 + multiple times, the value of a symbol is the amount of
3.1127 + space it requires, and the largest symbol value is the one
3.1128 + used). Most targets have exactly one of these (which we
3.1129 + translate to bfd_com_section_ptr), but ECOFF has two. */
3.1130 +#define SEC_IS_COMMON 0x1000
3.1131 +
3.1132 + /* The section contains only debugging information. For
3.1133 + example, this is set for ELF .debug and .stab sections.
3.1134 + strip tests this flag to see if a section can be
3.1135 + discarded. */
3.1136 +#define SEC_DEBUGGING 0x2000
3.1137 +
3.1138 + /* The contents of this section are held in memory pointed to
3.1139 + by the contents field. This is checked by bfd_get_section_contents,
3.1140 + and the data is retrieved from memory if appropriate. */
3.1141 +#define SEC_IN_MEMORY 0x4000
3.1142 +
3.1143 + /* The contents of this section are to be excluded by the
3.1144 + linker for executable and shared objects unless those
3.1145 + objects are to be further relocated. */
3.1146 +#define SEC_EXCLUDE 0x8000
3.1147 +
3.1148 + /* The contents of this section are to be sorted based on the sum of
3.1149 + the symbol and addend values specified by the associated relocation
3.1150 + entries. Entries without associated relocation entries will be
3.1151 + appended to the end of the section in an unspecified order. */
3.1152 +#define SEC_SORT_ENTRIES 0x10000
3.1153 +
3.1154 + /* When linking, duplicate sections of the same name should be
3.1155 + discarded, rather than being combined into a single section as
3.1156 + is usually done. This is similar to how common symbols are
3.1157 + handled. See SEC_LINK_DUPLICATES below. */
3.1158 +#define SEC_LINK_ONCE 0x20000
3.1159 +
3.1160 + /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
3.1161 + should handle duplicate sections. */
3.1162 +#define SEC_LINK_DUPLICATES 0x40000
3.1163 +
3.1164 + /* This value for SEC_LINK_DUPLICATES means that duplicate
3.1165 + sections with the same name should simply be discarded. */
3.1166 +#define SEC_LINK_DUPLICATES_DISCARD 0x0
3.1167 +
3.1168 + /* This value for SEC_LINK_DUPLICATES means that the linker
3.1169 + should warn if there are any duplicate sections, although
3.1170 + it should still only link one copy. */
3.1171 +#define SEC_LINK_DUPLICATES_ONE_ONLY 0x80000
3.1172 +
3.1173 + /* This value for SEC_LINK_DUPLICATES means that the linker
3.1174 + should warn if any duplicate sections are a different size. */
3.1175 +#define SEC_LINK_DUPLICATES_SAME_SIZE 0x100000
3.1176 +
3.1177 + /* This value for SEC_LINK_DUPLICATES means that the linker
3.1178 + should warn if any duplicate sections contain different
3.1179 + contents. */
3.1180 +#define SEC_LINK_DUPLICATES_SAME_CONTENTS \
3.1181 + (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE)
3.1182 +
3.1183 + /* This section was created by the linker as part of dynamic
3.1184 + relocation or other arcane processing. It is skipped when
3.1185 + going through the first-pass output, trusting that someone
3.1186 + else up the line will take care of it later. */
3.1187 +#define SEC_LINKER_CREATED 0x200000
3.1188 +
3.1189 + /* This section should not be subject to garbage collection. */
3.1190 +#define SEC_KEEP 0x400000
3.1191 +
3.1192 + /* This section contains "short" data, and should be placed
3.1193 + "near" the GP. */
3.1194 +#define SEC_SMALL_DATA 0x800000
3.1195 +
3.1196 + /* Attempt to merge identical entities in the section.
3.1197 + Entity size is given in the entsize field. */
3.1198 +#define SEC_MERGE 0x1000000
3.1199 +
3.1200 + /* If given with SEC_MERGE, entities to merge are zero terminated
3.1201 + strings where entsize specifies character size instead of fixed
3.1202 + size entries. */
3.1203 +#define SEC_STRINGS 0x2000000
3.1204 +
3.1205 + /* This section contains data about section groups. */
3.1206 +#define SEC_GROUP 0x4000000
3.1207 +
3.1208 + /* The section is a COFF shared library section. This flag is
3.1209 + only for the linker. If this type of section appears in
3.1210 + the input file, the linker must copy it to the output file
3.1211 + without changing the vma or size. FIXME: Although this
3.1212 + was originally intended to be general, it really is COFF
3.1213 + specific (and the flag was renamed to indicate this). It
3.1214 + might be cleaner to have some more general mechanism to
3.1215 + allow the back end to control what the linker does with
3.1216 + sections. */
3.1217 +#define SEC_COFF_SHARED_LIBRARY 0x10000000
3.1218 +
3.1219 + /* This section contains data which may be shared with other
3.1220 + executables or shared objects. This is for COFF only. */
3.1221 +#define SEC_COFF_SHARED 0x20000000
3.1222 +
3.1223 + /* When a section with this flag is being linked, then if the size of
3.1224 + the input section is less than a page, it should not cross a page
3.1225 + boundary. If the size of the input section is one page or more,
3.1226 + it should be aligned on a page boundary. This is for TI
3.1227 + TMS320C54X only. */
3.1228 +#define SEC_TIC54X_BLOCK 0x40000000
3.1229 +
3.1230 + /* Conditionally link this section; do not link if there are no
3.1231 + references found to any symbol in the section. This is for TI
3.1232 + TMS320C54X only. */
3.1233 +#define SEC_TIC54X_CLINK 0x80000000
3.1234 +
3.1235 + /* End of section flags. */
3.1236 +
3.1237 + /* Some internal packed boolean fields. */
3.1238 +
3.1239 + /* See the vma field. */
3.1240 + unsigned int user_set_vma : 1;
3.1241 +
3.1242 + /* A mark flag used by some of the linker backends. */
3.1243 + unsigned int linker_mark : 1;
3.1244 +
3.1245 + /* Another mark flag used by some of the linker backends. Set for
3.1246 + output sections that have an input section. */
3.1247 + unsigned int linker_has_input : 1;
3.1248 +
3.1249 + /* A mark flag used by some linker backends for garbage collection. */
3.1250 + unsigned int gc_mark : 1;
3.1251 +
3.1252 + /* The following flags are used by the ELF linker. */
3.1253 +
3.1254 + /* Mark sections which have been allocated to segments. */
3.1255 + unsigned int segment_mark : 1;
3.1256 +
3.1257 + /* Type of sec_info information. */
3.1258 + unsigned int sec_info_type:3;
3.1259 +#define ELF_INFO_TYPE_NONE 0
3.1260 +#define ELF_INFO_TYPE_STABS 1
3.1261 +#define ELF_INFO_TYPE_MERGE 2
3.1262 +#define ELF_INFO_TYPE_EH_FRAME 3
3.1263 +#define ELF_INFO_TYPE_JUST_SYMS 4
3.1264 +
3.1265 + /* Nonzero if this section uses RELA relocations, rather than REL. */
3.1266 + unsigned int use_rela_p:1;
3.1267 +
3.1268 + /* Bits used by various backends. The generic code doesn't touch
3.1269 + these fields. */
3.1270 +
3.1271 + /* Nonzero if this section has TLS related relocations. */
3.1272 + unsigned int has_tls_reloc:1;
3.1273 +
3.1274 + /* Nonzero if this section has a gp reloc. */
3.1275 + unsigned int has_gp_reloc:1;
3.1276 +
3.1277 + /* Nonzero if this section needs the relax finalize pass. */
3.1278 + unsigned int need_finalize_relax:1;
3.1279 +
3.1280 + /* Whether relocations have been processed. */
3.1281 + unsigned int reloc_done : 1;
3.1282 +
3.1283 + /* End of internal packed boolean fields. */
3.1284 +
3.1285 + /* The virtual memory address of the section - where it will be
3.1286 + at run time. The symbols are relocated against this. The
3.1287 + user_set_vma flag is maintained by bfd; if it's not set, the
3.1288 + backend can assign addresses (for example, in <<a.out>>, where
3.1289 + the default address for <<.data>> is dependent on the specific
3.1290 + target and various flags). */
3.1291 + bfd_vma vma;
3.1292 +
3.1293 + /* The load address of the section - where it would be in a
3.1294 + rom image; really only used for writing section header
3.1295 + information. */
3.1296 + bfd_vma lma;
3.1297 +
3.1298 + /* The size of the section in octets, as it will be output.
3.1299 + Contains a value even if the section has no contents (e.g., the
3.1300 + size of <<.bss>>). */
3.1301 + bfd_size_type size;
3.1302 +
3.1303 + /* For input sections, the original size on disk of the section, in
3.1304 + octets. This field is used by the linker relaxation code. It is
3.1305 + currently only set for sections where the linker relaxation scheme
3.1306 + doesn't cache altered section and reloc contents (stabs, eh_frame,
3.1307 + SEC_MERGE, some coff relaxing targets), and thus the original size
3.1308 + needs to be kept to read the section multiple times.
3.1309 + For output sections, rawsize holds the section size calculated on
3.1310 + a previous linker relaxation pass. */
3.1311 + bfd_size_type rawsize;
3.1312 +
3.1313 + /* If this section is going to be output, then this value is the
3.1314 + offset in *bytes* into the output section of the first byte in the
3.1315 + input section (byte ==> smallest addressable unit on the
3.1316 + target). In most cases, if this was going to start at the
3.1317 + 100th octet (8-bit quantity) in the output section, this value
3.1318 + would be 100. However, if the target byte size is 16 bits
3.1319 + (bfd_octets_per_byte is "2"), this value would be 50. */
3.1320 + bfd_vma output_offset;
3.1321 +
3.1322 + /* The output section through which to map on output. */
3.1323 + struct bfd_section *output_section;
3.1324 +
3.1325 + /* The alignment requirement of the section, as an exponent of 2 -
3.1326 + e.g., 3 aligns to 2^3 (or 8). */
3.1327 + unsigned int alignment_power;
3.1328 +
3.1329 + /* If an input section, a pointer to a vector of relocation
3.1330 + records for the data in this section. */
3.1331 + struct reloc_cache_entry *relocation;
3.1332 +
3.1333 + /* If an output section, a pointer to a vector of pointers to
3.1334 + relocation records for the data in this section. */
3.1335 + struct reloc_cache_entry **orelocation;
3.1336 +
3.1337 + /* The number of relocation records in one of the above. */
3.1338 + unsigned reloc_count;
3.1339 +
3.1340 + /* Information below is back end specific - and not always used
3.1341 + or updated. */
3.1342 +
3.1343 + /* File position of section data. */
3.1344 + file_ptr filepos;
3.1345 +
3.1346 + /* File position of relocation info. */
3.1347 + file_ptr rel_filepos;
3.1348 +
3.1349 + /* File position of line data. */
3.1350 + file_ptr line_filepos;
3.1351 +
3.1352 + /* Pointer to data for applications. */
3.1353 + void *userdata;
3.1354 +
3.1355 + /* If the SEC_IN_MEMORY flag is set, this points to the actual
3.1356 + contents. */
3.1357 + unsigned char *contents;
3.1358 +
3.1359 + /* Attached line number information. */
3.1360 + alent *lineno;
3.1361 +
3.1362 + /* Number of line number records. */
3.1363 + unsigned int lineno_count;
3.1364 +
3.1365 + /* Entity size for merging purposes. */
3.1366 + unsigned int entsize;
3.1367 +
3.1368 + /* Points to the kept section if this section is a link-once section,
3.1369 + and is discarded. */
3.1370 + struct bfd_section *kept_section;
3.1371 +
3.1372 + /* When a section is being output, this value changes as more
3.1373 + linenumbers are written out. */
3.1374 + file_ptr moving_line_filepos;
3.1375 +
3.1376 + /* What the section number is in the target world. */
3.1377 + int target_index;
3.1378 +
3.1379 + void *used_by_bfd;
3.1380 +
3.1381 + /* If this is a constructor section then here is a list of the
3.1382 + relocations created to relocate items within it. */
3.1383 + struct relent_chain *constructor_chain;
3.1384 +
3.1385 + /* The BFD which owns the section. */
3.1386 + bfd *owner;
3.1387 +
3.1388 + /* A symbol which points at this section only. */
3.1389 + struct bfd_symbol *symbol;
3.1390 + struct bfd_symbol **symbol_ptr_ptr;
3.1391 +
3.1392 + struct bfd_link_order *link_order_head;
3.1393 + struct bfd_link_order *link_order_tail;
3.1394 +} asection;
3.1395 +
3.1396 +/* These sections are global, and are managed by BFD. The application
3.1397 + and target back end are not permitted to change the values in
3.1398 + these sections. New code should use the section_ptr macros rather
3.1399 + than referring directly to the const sections. The const sections
3.1400 + may eventually vanish. */
3.1401 +#define BFD_ABS_SECTION_NAME "*ABS*"
3.1402 +#define BFD_UND_SECTION_NAME "*UND*"
3.1403 +#define BFD_COM_SECTION_NAME "*COM*"
3.1404 +#define BFD_IND_SECTION_NAME "*IND*"
3.1405 +
3.1406 +/* The absolute section. */
3.1407 +extern asection bfd_abs_section;
3.1408 +#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
3.1409 +#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
3.1410 +/* Pointer to the undefined section. */
3.1411 +extern asection bfd_und_section;
3.1412 +#define bfd_und_section_ptr ((asection *) &bfd_und_section)
3.1413 +#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
3.1414 +/* Pointer to the common section. */
3.1415 +extern asection bfd_com_section;
3.1416 +#define bfd_com_section_ptr ((asection *) &bfd_com_section)
3.1417 +/* Pointer to the indirect section. */
3.1418 +extern asection bfd_ind_section;
3.1419 +#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
3.1420 +#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
3.1421 +
3.1422 +#define bfd_is_const_section(SEC) \
3.1423 + ( ((SEC) == bfd_abs_section_ptr) \
3.1424 + || ((SEC) == bfd_und_section_ptr) \
3.1425 + || ((SEC) == bfd_com_section_ptr) \
3.1426 + || ((SEC) == bfd_ind_section_ptr))
3.1427 +
3.1428 +extern const struct bfd_symbol * const bfd_abs_symbol;
3.1429 +extern const struct bfd_symbol * const bfd_com_symbol;
3.1430 +extern const struct bfd_symbol * const bfd_und_symbol;
3.1431 +extern const struct bfd_symbol * const bfd_ind_symbol;
3.1432 +
3.1433 +/* Macros to handle insertion and deletion of a bfd's sections. These
3.1434 + only handle the list pointers, ie. do not adjust section_count,
3.1435 + target_index etc. */
3.1436 +#define bfd_section_list_remove(ABFD, PS) \
3.1437 + do \
3.1438 + { \
3.1439 + asection **_ps = PS; \
3.1440 + asection *_s = *_ps; \
3.1441 + *_ps = _s->next; \
3.1442 + if (_s->next == NULL) \
3.1443 + (ABFD)->section_tail = _ps; \
3.1444 + } \
3.1445 + while (0)
3.1446 +#define bfd_section_list_insert(ABFD, PS, S) \
3.1447 + do \
3.1448 + { \
3.1449 + asection **_ps = PS; \
3.1450 + asection *_s = S; \
3.1451 + _s->next = *_ps; \
3.1452 + *_ps = _s; \
3.1453 + if (_s->next == NULL) \
3.1454 + (ABFD)->section_tail = &_s->next; \
3.1455 + } \
3.1456 + while (0)
3.1457 +
3.1458 +void bfd_section_list_clear (bfd *);
3.1459 +
3.1460 +asection *bfd_get_section_by_name (bfd *abfd, const char *name);
3.1461 +
3.1462 +asection *bfd_get_section_by_name_if
3.1463 + (bfd *abfd,
3.1464 + const char *name,
3.1465 + bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
3.1466 + void *obj);
3.1467 +
3.1468 +char *bfd_get_unique_section_name
3.1469 + (bfd *abfd, const char *templat, int *count);
3.1470 +
3.1471 +asection *bfd_make_section_old_way (bfd *abfd, const char *name);
3.1472 +
3.1473 +asection *bfd_make_section_anyway (bfd *abfd, const char *name);
3.1474 +
3.1475 +asection *bfd_make_section (bfd *, const char *name);
3.1476 +
3.1477 +bfd_boolean bfd_set_section_flags
3.1478 + (bfd *abfd, asection *sec, flagword flags);
3.1479 +
3.1480 +void bfd_map_over_sections
3.1481 + (bfd *abfd,
3.1482 + void (*func) (bfd *abfd, asection *sect, void *obj),
3.1483 + void *obj);
3.1484 +
3.1485 +asection *bfd_sections_find_if
3.1486 + (bfd *abfd,
3.1487 + bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj),
3.1488 + void *obj);
3.1489 +
3.1490 +bfd_boolean bfd_set_section_size
3.1491 + (bfd *abfd, asection *sec, bfd_size_type val);
3.1492 +
3.1493 +bfd_boolean bfd_set_section_contents
3.1494 + (bfd *abfd, asection *section, const void *data,
3.1495 + file_ptr offset, bfd_size_type count);
3.1496 +
3.1497 +bfd_boolean bfd_get_section_contents
3.1498 + (bfd *abfd, asection *section, void *location, file_ptr offset,
3.1499 + bfd_size_type count);
3.1500 +
3.1501 +bfd_boolean bfd_malloc_and_get_section
3.1502 + (bfd *abfd, asection *section, bfd_byte **buf);
3.1503 +
3.1504 +bfd_boolean bfd_copy_private_section_data
3.1505 + (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
3.1506 +
3.1507 +#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
3.1508 + BFD_SEND (obfd, _bfd_copy_private_section_data, \
3.1509 + (ibfd, isection, obfd, osection))
3.1510 +void _bfd_strip_section_from_output
3.1511 + (struct bfd_link_info *info, asection *section);
3.1512 +
3.1513 +bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec);
3.1514 +
3.1515 +bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
3.1516 +
3.1517 +/* Extracted from archures.c. */
3.1518 +enum bfd_architecture
3.1519 +{
3.1520 + bfd_arch_unknown, /* File arch not known. */
3.1521 + bfd_arch_obscure, /* Arch known, not one of these. */
3.1522 + bfd_arch_m68k, /* Motorola 68xxx */
3.1523 +#define bfd_mach_m68000 1
3.1524 +#define bfd_mach_m68008 2
3.1525 +#define bfd_mach_m68010 3
3.1526 +#define bfd_mach_m68020 4
3.1527 +#define bfd_mach_m68030 5
3.1528 +#define bfd_mach_m68040 6
3.1529 +#define bfd_mach_m68060 7
3.1530 +#define bfd_mach_cpu32 8
3.1531 +#define bfd_mach_mcf5200 9
3.1532 +#define bfd_mach_mcf5206e 10
3.1533 +#define bfd_mach_mcf5307 11
3.1534 +#define bfd_mach_mcf5407 12
3.1535 +#define bfd_mach_mcf528x 13
3.1536 +#define bfd_mach_mcfv4e 14
3.1537 +#define bfd_mach_mcf521x 15
3.1538 +#define bfd_mach_mcf5249 16
3.1539 +#define bfd_mach_mcf547x 17
3.1540 +#define bfd_mach_mcf548x 18
3.1541 + bfd_arch_vax, /* DEC Vax */
3.1542 + bfd_arch_i960, /* Intel 960 */
3.1543 + /* The order of the following is important.
3.1544 + lower number indicates a machine type that
3.1545 + only accepts a subset of the instructions
3.1546 + available to machines with higher numbers.
3.1547 + The exception is the "ca", which is
3.1548 + incompatible with all other machines except
3.1549 + "core". */
3.1550 +
3.1551 +#define bfd_mach_i960_core 1
3.1552 +#define bfd_mach_i960_ka_sa 2
3.1553 +#define bfd_mach_i960_kb_sb 3
3.1554 +#define bfd_mach_i960_mc 4
3.1555 +#define bfd_mach_i960_xa 5
3.1556 +#define bfd_mach_i960_ca 6
3.1557 +#define bfd_mach_i960_jx 7
3.1558 +#define bfd_mach_i960_hx 8
3.1559 +
3.1560 + bfd_arch_or32, /* OpenRISC 32 */
3.1561 +
3.1562 + bfd_arch_a29k, /* AMD 29000 */
3.1563 + bfd_arch_sparc, /* SPARC */
3.1564 +#define bfd_mach_sparc 1
3.1565 +/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
3.1566 +#define bfd_mach_sparc_sparclet 2
3.1567 +#define bfd_mach_sparc_sparclite 3
3.1568 +#define bfd_mach_sparc_v8plus 4
3.1569 +#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */
3.1570 +#define bfd_mach_sparc_sparclite_le 6
3.1571 +#define bfd_mach_sparc_v9 7
3.1572 +#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */
3.1573 +#define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */
3.1574 +#define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */
3.1575 +/* Nonzero if MACH has the v9 instruction set. */
3.1576 +#define bfd_mach_sparc_v9_p(mach) \
3.1577 + ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \
3.1578 + && (mach) != bfd_mach_sparc_sparclite_le)
3.1579 +/* Nonzero if MACH is a 64 bit sparc architecture. */
3.1580 +#define bfd_mach_sparc_64bit_p(mach) \
3.1581 + ((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb)
3.1582 + bfd_arch_mips, /* MIPS Rxxxx */
3.1583 +#define bfd_mach_mips3000 3000
3.1584 +#define bfd_mach_mips3900 3900
3.1585 +#define bfd_mach_mips4000 4000
3.1586 +#define bfd_mach_mips4010 4010
3.1587 +#define bfd_mach_mips4100 4100
3.1588 +#define bfd_mach_mips4111 4111
3.1589 +#define bfd_mach_mips4120 4120
3.1590 +#define bfd_mach_mips4300 4300
3.1591 +#define bfd_mach_mips4400 4400
3.1592 +#define bfd_mach_mips4600 4600
3.1593 +#define bfd_mach_mips4650 4650
3.1594 +#define bfd_mach_mips5000 5000
3.1595 +#define bfd_mach_mips5400 5400
3.1596 +#define bfd_mach_mips5500 5500
3.1597 +#define bfd_mach_mips6000 6000
3.1598 +#define bfd_mach_mips7000 7000
3.1599 +#define bfd_mach_mips8000 8000
3.1600 +#define bfd_mach_mips9000 9000
3.1601 +#define bfd_mach_mips10000 10000
3.1602 +#define bfd_mach_mips12000 12000
3.1603 +#define bfd_mach_mips16 16
3.1604 +#define bfd_mach_mips5 5
3.1605 +#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
3.1606 +#define bfd_mach_mipsisa32 32
3.1607 +#define bfd_mach_mipsisa32r2 33
3.1608 +#define bfd_mach_mipsisa64 64
3.1609 +#define bfd_mach_mipsisa64r2 65
3.1610 + bfd_arch_i386, /* Intel 386 */
3.1611 +#define bfd_mach_i386_i386 1
3.1612 +#define bfd_mach_i386_i8086 2
3.1613 +#define bfd_mach_i386_i386_intel_syntax 3
3.1614 +#define bfd_mach_x86_64 64
3.1615 +#define bfd_mach_x86_64_intel_syntax 65
3.1616 + bfd_arch_we32k, /* AT&T WE32xxx */
3.1617 + bfd_arch_tahoe, /* CCI/Harris Tahoe */
3.1618 + bfd_arch_i860, /* Intel 860 */
3.1619 + bfd_arch_i370, /* IBM 360/370 Mainframes */
3.1620 + bfd_arch_romp, /* IBM ROMP PC/RT */
3.1621 + bfd_arch_alliant, /* Alliant */
3.1622 + bfd_arch_convex, /* Convex */
3.1623 + bfd_arch_m88k, /* Motorola 88xxx */
3.1624 + bfd_arch_m98k, /* Motorola 98xxx */
3.1625 + bfd_arch_pyramid, /* Pyramid Technology */
3.1626 + bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */
3.1627 +#define bfd_mach_h8300 1
3.1628 +#define bfd_mach_h8300h 2
3.1629 +#define bfd_mach_h8300s 3
3.1630 +#define bfd_mach_h8300hn 4
3.1631 +#define bfd_mach_h8300sn 5
3.1632 +#define bfd_mach_h8300sx 6
3.1633 +#define bfd_mach_h8300sxn 7
3.1634 + bfd_arch_pdp11, /* DEC PDP-11 */
3.1635 + bfd_arch_powerpc, /* PowerPC */
3.1636 +#define bfd_mach_ppc 32
3.1637 +#define bfd_mach_ppc64 64
3.1638 +#define bfd_mach_ppc_403 403
3.1639 +#define bfd_mach_ppc_403gc 4030
3.1640 +#define bfd_mach_ppc_505 505
3.1641 +#define bfd_mach_ppc_601 601
3.1642 +#define bfd_mach_ppc_602 602
3.1643 +#define bfd_mach_ppc_603 603
3.1644 +#define bfd_mach_ppc_ec603e 6031
3.1645 +#define bfd_mach_ppc_604 604
3.1646 +#define bfd_mach_ppc_620 620
3.1647 +#define bfd_mach_ppc_630 630
3.1648 +#define bfd_mach_ppc_750 750
3.1649 +#define bfd_mach_ppc_860 860
3.1650 +#define bfd_mach_ppc_a35 35
3.1651 +#define bfd_mach_ppc_rs64ii 642
3.1652 +#define bfd_mach_ppc_rs64iii 643
3.1653 +#define bfd_mach_ppc_7400 7400
3.1654 +#define bfd_mach_ppc_e500 500
3.1655 + bfd_arch_rs6000, /* IBM RS/6000 */
3.1656 +#define bfd_mach_rs6k 6000
3.1657 +#define bfd_mach_rs6k_rs1 6001
3.1658 +#define bfd_mach_rs6k_rsc 6003
3.1659 +#define bfd_mach_rs6k_rs2 6002
3.1660 + bfd_arch_hppa, /* HP PA RISC */
3.1661 +#define bfd_mach_hppa10 10
3.1662 +#define bfd_mach_hppa11 11
3.1663 +#define bfd_mach_hppa20 20
3.1664 +#define bfd_mach_hppa20w 25
3.1665 + bfd_arch_d10v, /* Mitsubishi D10V */
3.1666 +#define bfd_mach_d10v 1
3.1667 +#define bfd_mach_d10v_ts2 2
3.1668 +#define bfd_mach_d10v_ts3 3
3.1669 + bfd_arch_d30v, /* Mitsubishi D30V */
3.1670 + bfd_arch_dlx, /* DLX */
3.1671 + bfd_arch_m68hc11, /* Motorola 68HC11 */
3.1672 + bfd_arch_m68hc12, /* Motorola 68HC12 */
3.1673 +#define bfd_mach_m6812_default 0
3.1674 +#define bfd_mach_m6812 1
3.1675 +#define bfd_mach_m6812s 2
3.1676 + bfd_arch_z8k, /* Zilog Z8000 */
3.1677 +#define bfd_mach_z8001 1
3.1678 +#define bfd_mach_z8002 2
3.1679 + bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */
3.1680 + bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */
3.1681 +#define bfd_mach_sh 1
3.1682 +#define bfd_mach_sh2 0x20
3.1683 +#define bfd_mach_sh_dsp 0x2d
3.1684 +#define bfd_mach_sh2a 0x2a
3.1685 +#define bfd_mach_sh2a_nofpu 0x2b
3.1686 +#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1
3.1687 +#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2
3.1688 +#define bfd_mach_sh2a_or_sh4 0x2a3
3.1689 +#define bfd_mach_sh2a_or_sh3e 0x2a4
3.1690 +#define bfd_mach_sh2e 0x2e
3.1691 +#define bfd_mach_sh3 0x30
3.1692 +#define bfd_mach_sh3_nommu 0x31
3.1693 +#define bfd_mach_sh3_dsp 0x3d
3.1694 +#define bfd_mach_sh3e 0x3e
3.1695 +#define bfd_mach_sh4 0x40
3.1696 +#define bfd_mach_sh4_nofpu 0x41
3.1697 +#define bfd_mach_sh4_nommu_nofpu 0x42
3.1698 +#define bfd_mach_sh4a 0x4a
3.1699 +#define bfd_mach_sh4a_nofpu 0x4b
3.1700 +#define bfd_mach_sh4al_dsp 0x4d
3.1701 +#define bfd_mach_sh5 0x50
3.1702 + bfd_arch_alpha, /* Dec Alpha */
3.1703 +#define bfd_mach_alpha_ev4 0x10
3.1704 +#define bfd_mach_alpha_ev5 0x20
3.1705 +#define bfd_mach_alpha_ev6 0x30
3.1706 + bfd_arch_arm, /* Advanced Risc Machines ARM. */
3.1707 +#define bfd_mach_arm_unknown 0
3.1708 +#define bfd_mach_arm_2 1
3.1709 +#define bfd_mach_arm_2a 2
3.1710 +#define bfd_mach_arm_3 3
3.1711 +#define bfd_mach_arm_3M 4
3.1712 +#define bfd_mach_arm_4 5
3.1713 +#define bfd_mach_arm_4T 6
3.1714 +#define bfd_mach_arm_5 7
3.1715 +#define bfd_mach_arm_5T 8
3.1716 +#define bfd_mach_arm_5TE 9
3.1717 +#define bfd_mach_arm_XScale 10
3.1718 +#define bfd_mach_arm_ep9312 11
3.1719 +#define bfd_mach_arm_iWMMXt 12
3.1720 + bfd_arch_ns32k, /* National Semiconductors ns32000 */
3.1721 + bfd_arch_w65, /* WDC 65816 */
3.1722 + bfd_arch_tic30, /* Texas Instruments TMS320C30 */
3.1723 + bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */
3.1724 +#define bfd_mach_tic3x 30
3.1725 +#define bfd_mach_tic4x 40
3.1726 + bfd_arch_tic54x, /* Texas Instruments TMS320C54X */
3.1727 + bfd_arch_tic80, /* TI TMS320c80 (MVP) */
3.1728 + bfd_arch_v850, /* NEC V850 */
3.1729 +#define bfd_mach_v850 1
3.1730 +#define bfd_mach_v850e 'E'
3.1731 +#define bfd_mach_v850e1 '1'
3.1732 + bfd_arch_arc, /* ARC Cores */
3.1733 +#define bfd_mach_arc_5 5
3.1734 +#define bfd_mach_arc_6 6
3.1735 +#define bfd_mach_arc_7 7
3.1736 +#define bfd_mach_arc_8 8
3.1737 + bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */
3.1738 +#define bfd_mach_m32r 1 /* For backwards compatibility. */
3.1739 +#define bfd_mach_m32rx 'x'
3.1740 +#define bfd_mach_m32r2 '2'
3.1741 + bfd_arch_mn10200, /* Matsushita MN10200 */
3.1742 + bfd_arch_mn10300, /* Matsushita MN10300 */
3.1743 +#define bfd_mach_mn10300 300
3.1744 +#define bfd_mach_am33 330
3.1745 +#define bfd_mach_am33_2 332
3.1746 + bfd_arch_fr30,
3.1747 +#define bfd_mach_fr30 0x46523330
3.1748 + bfd_arch_frv,
3.1749 +#define bfd_mach_frv 1
3.1750 +#define bfd_mach_frvsimple 2
3.1751 +#define bfd_mach_fr300 300
3.1752 +#define bfd_mach_fr400 400
3.1753 +#define bfd_mach_fr450 450
3.1754 +#define bfd_mach_frvtomcat 499 /* fr500 prototype */
3.1755 +#define bfd_mach_fr500 500
3.1756 +#define bfd_mach_fr550 550
3.1757 + bfd_arch_mcore,
3.1758 + bfd_arch_ia64, /* HP/Intel ia64 */
3.1759 +#define bfd_mach_ia64_elf64 64
3.1760 +#define bfd_mach_ia64_elf32 32
3.1761 + bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */
3.1762 +#define bfd_mach_ip2022 1
3.1763 +#define bfd_mach_ip2022ext 2
3.1764 + bfd_arch_iq2000, /* Vitesse IQ2000. */
3.1765 +#define bfd_mach_iq2000 1
3.1766 +#define bfd_mach_iq10 2
3.1767 + bfd_arch_pj,
3.1768 + bfd_arch_avr, /* Atmel AVR microcontrollers. */
3.1769 +#define bfd_mach_avr1 1
3.1770 +#define bfd_mach_avr2 2
3.1771 +#define bfd_mach_avr3 3
3.1772 +#define bfd_mach_avr4 4
3.1773 +#define bfd_mach_avr5 5
3.1774 + bfd_arch_cr16c, /* National Semiconductor CompactRISC. */
3.1775 +#define bfd_mach_cr16c 1
3.1776 + bfd_arch_crx, /* National Semiconductor CRX. */
3.1777 +#define bfd_mach_crx 1
3.1778 + bfd_arch_cris, /* Axis CRIS */
3.1779 +#define bfd_mach_cris_v0_v10 255
3.1780 +#define bfd_mach_cris_v32 32
3.1781 +#define bfd_mach_cris_v10_v32 1032
3.1782 + bfd_arch_s390, /* IBM s390 */
3.1783 +#define bfd_mach_s390_31 31
3.1784 +#define bfd_mach_s390_64 64
3.1785 + bfd_arch_openrisc, /* OpenRISC */
3.1786 + bfd_arch_mmix, /* Donald Knuth's educational processor. */
3.1787 + bfd_arch_xstormy16,
3.1788 +#define bfd_mach_xstormy16 1
3.1789 + bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */
3.1790 +#define bfd_mach_msp11 11
3.1791 +#define bfd_mach_msp110 110
3.1792 +#define bfd_mach_msp12 12
3.1793 +#define bfd_mach_msp13 13
3.1794 +#define bfd_mach_msp14 14
3.1795 +#define bfd_mach_msp15 15
3.1796 +#define bfd_mach_msp16 16
3.1797 +#define bfd_mach_msp31 31
3.1798 +#define bfd_mach_msp32 32
3.1799 +#define bfd_mach_msp33 33
3.1800 +#define bfd_mach_msp41 41
3.1801 +#define bfd_mach_msp42 42
3.1802 +#define bfd_mach_msp43 43
3.1803 +#define bfd_mach_msp44 44
3.1804 + bfd_arch_xtensa, /* Tensilica's Xtensa cores. */
3.1805 +#define bfd_mach_xtensa 1
3.1806 + bfd_arch_maxq, /* Dallas MAXQ 10/20 */
3.1807 +#define bfd_mach_maxq10 10
3.1808 +#define bfd_mach_maxq20 20
3.1809 + bfd_arch_last
3.1810 + };
3.1811 +
3.1812 +typedef struct bfd_arch_info
3.1813 +{
3.1814 + int bits_per_word;
3.1815 + int bits_per_address;
3.1816 + int bits_per_byte;
3.1817 + enum bfd_architecture arch;
3.1818 + unsigned long mach;
3.1819 + const char *arch_name;
3.1820 + const char *printable_name;
3.1821 + unsigned int section_align_power;
3.1822 + /* TRUE if this is the default machine for the architecture.
3.1823 + The default arch should be the first entry for an arch so that
3.1824 + all the entries for that arch can be accessed via <<next>>. */
3.1825 + bfd_boolean the_default;
3.1826 + const struct bfd_arch_info * (*compatible)
3.1827 + (const struct bfd_arch_info *a, const struct bfd_arch_info *b);
3.1828 +
3.1829 + bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
3.1830 +
3.1831 + const struct bfd_arch_info *next;
3.1832 +}
3.1833 +bfd_arch_info_type;
3.1834 +
3.1835 +const char *bfd_printable_name (bfd *abfd);
3.1836 +
3.1837 +const bfd_arch_info_type *bfd_scan_arch (const char *string);
3.1838 +
3.1839 +const char **bfd_arch_list (void);
3.1840 +
3.1841 +const bfd_arch_info_type *bfd_arch_get_compatible
3.1842 + (const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
3.1843 +
3.1844 +void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg);
3.1845 +
3.1846 +enum bfd_architecture bfd_get_arch (bfd *abfd);
3.1847 +
3.1848 +unsigned long bfd_get_mach (bfd *abfd);
3.1849 +
3.1850 +unsigned int bfd_arch_bits_per_byte (bfd *abfd);
3.1851 +
3.1852 +unsigned int bfd_arch_bits_per_address (bfd *abfd);
3.1853 +
3.1854 +const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd);
3.1855 +
3.1856 +const bfd_arch_info_type *bfd_lookup_arch
3.1857 + (enum bfd_architecture arch, unsigned long machine);
3.1858 +
3.1859 +const char *bfd_printable_arch_mach
3.1860 + (enum bfd_architecture arch, unsigned long machine);
3.1861 +
3.1862 +unsigned int bfd_octets_per_byte (bfd *abfd);
3.1863 +
3.1864 +unsigned int bfd_arch_mach_octets_per_byte
3.1865 + (enum bfd_architecture arch, unsigned long machine);
3.1866 +
3.1867 +/* Extracted from reloc.c. */
3.1868 +typedef enum bfd_reloc_status
3.1869 +{
3.1870 + /* No errors detected. */
3.1871 + bfd_reloc_ok,
3.1872 +
3.1873 + /* The relocation was performed, but there was an overflow. */
3.1874 + bfd_reloc_overflow,
3.1875 +
3.1876 + /* The address to relocate was not within the section supplied. */
3.1877 + bfd_reloc_outofrange,
3.1878 +
3.1879 + /* Used by special functions. */
3.1880 + bfd_reloc_continue,
3.1881 +
3.1882 + /* Unsupported relocation size requested. */
3.1883 + bfd_reloc_notsupported,
3.1884 +
3.1885 + /* Unused. */
3.1886 + bfd_reloc_other,
3.1887 +
3.1888 + /* The symbol to relocate against was undefined. */
3.1889 + bfd_reloc_undefined,
3.1890 +
3.1891 + /* The relocation was performed, but may not be ok - presently
3.1892 + generated only when linking i960 coff files with i960 b.out
3.1893 + symbols. If this type is returned, the error_message argument
3.1894 + to bfd_perform_relocation will be set. */
3.1895 + bfd_reloc_dangerous
3.1896 + }
3.1897 + bfd_reloc_status_type;
3.1898 +
3.1899 +
3.1900 +typedef struct reloc_cache_entry
3.1901 +{
3.1902 + /* A pointer into the canonical table of pointers. */
3.1903 + struct bfd_symbol **sym_ptr_ptr;
3.1904 +
3.1905 + /* offset in section. */
3.1906 + bfd_size_type address;
3.1907 +
3.1908 + /* addend for relocation value. */
3.1909 + bfd_vma addend;
3.1910 +
3.1911 + /* Pointer to how to perform the required relocation. */
3.1912 + reloc_howto_type *howto;
3.1913 +
3.1914 +}
3.1915 +arelent;
3.1916 +
3.1917 +enum complain_overflow
3.1918 +{
3.1919 + /* Do not complain on overflow. */
3.1920 + complain_overflow_dont,
3.1921 +
3.1922 + /* Complain if the bitfield overflows, whether it is considered
3.1923 + as signed or unsigned. */
3.1924 + complain_overflow_bitfield,
3.1925 +
3.1926 + /* Complain if the value overflows when considered as signed
3.1927 + number. */
3.1928 + complain_overflow_signed,
3.1929 +
3.1930 + /* Complain if the value overflows when considered as an
3.1931 + unsigned number. */
3.1932 + complain_overflow_unsigned
3.1933 +};
3.1934 +
3.1935 +struct reloc_howto_struct
3.1936 +{
3.1937 + /* The type field has mainly a documentary use - the back end can
3.1938 + do what it wants with it, though normally the back end's
3.1939 + external idea of what a reloc number is stored
3.1940 + in this field. For example, a PC relative word relocation
3.1941 + in a coff environment has the type 023 - because that's
3.1942 + what the outside world calls a R_PCRWORD reloc. */
3.1943 + unsigned int type;
3.1944 +
3.1945 + /* The value the final relocation is shifted right by. This drops
3.1946 + unwanted data from the relocation. */
3.1947 + unsigned int rightshift;
3.1948 +
3.1949 + /* The size of the item to be relocated. This is *not* a
3.1950 + power-of-two measure. To get the number of bytes operated
3.1951 + on by a type of relocation, use bfd_get_reloc_size. */
3.1952 + int size;
3.1953 +
3.1954 + /* The number of bits in the item to be relocated. This is used
3.1955 + when doing overflow checking. */
3.1956 + unsigned int bitsize;
3.1957 +
3.1958 + /* Notes that the relocation is relative to the location in the
3.1959 + data section of the addend. The relocation function will
3.1960 + subtract from the relocation value the address of the location
3.1961 + being relocated. */
3.1962 + bfd_boolean pc_relative;
3.1963 +
3.1964 + /* The bit position of the reloc value in the destination.
3.1965 + The relocated value is left shifted by this amount. */
3.1966 + unsigned int bitpos;
3.1967 +
3.1968 + /* What type of overflow error should be checked for when
3.1969 + relocating. */
3.1970 + enum complain_overflow complain_on_overflow;
3.1971 +
3.1972 + /* If this field is non null, then the supplied function is
3.1973 + called rather than the normal function. This allows really
3.1974 + strange relocation methods to be accommodated (e.g., i960 callj
3.1975 + instructions). */
3.1976 + bfd_reloc_status_type (*special_function)
3.1977 + (bfd *, arelent *, struct bfd_symbol *, void *, asection *,
3.1978 + bfd *, char **);
3.1979 +
3.1980 + /* The textual name of the relocation type. */
3.1981 + char *name;
3.1982 +
3.1983 + /* Some formats record a relocation addend in the section contents
3.1984 + rather than with the relocation. For ELF formats this is the
3.1985 + distinction between USE_REL and USE_RELA (though the code checks
3.1986 + for USE_REL == 1/0). The value of this field is TRUE if the
3.1987 + addend is recorded with the section contents; when performing a
3.1988 + partial link (ld -r) the section contents (the data) will be
3.1989 + modified. The value of this field is FALSE if addends are
3.1990 + recorded with the relocation (in arelent.addend); when performing
3.1991 + a partial link the relocation will be modified.
3.1992 + All relocations for all ELF USE_RELA targets should set this field
3.1993 + to FALSE (values of TRUE should be looked on with suspicion).
3.1994 + However, the converse is not true: not all relocations of all ELF
3.1995 + USE_REL targets set this field to TRUE. Why this is so is peculiar
3.1996 + to each particular target. For relocs that aren't used in partial
3.1997 + links (e.g. GOT stuff) it doesn't matter what this is set to. */
3.1998 + bfd_boolean partial_inplace;
3.1999 +
3.2000 + /* src_mask selects the part of the instruction (or data) to be used
3.2001 + in the relocation sum. If the target relocations don't have an
3.2002 + addend in the reloc, eg. ELF USE_REL, src_mask will normally equal
3.2003 + dst_mask to extract the addend from the section contents. If
3.2004 + relocations do have an addend in the reloc, eg. ELF USE_RELA, this
3.2005 + field should be zero. Non-zero values for ELF USE_RELA targets are
3.2006 + bogus as in those cases the value in the dst_mask part of the
3.2007 + section contents should be treated as garbage. */
3.2008 + bfd_vma src_mask;
3.2009 +
3.2010 + /* dst_mask selects which parts of the instruction (or data) are
3.2011 + replaced with a relocated value. */
3.2012 + bfd_vma dst_mask;
3.2013 +
3.2014 + /* When some formats create PC relative instructions, they leave
3.2015 + the value of the pc of the place being relocated in the offset
3.2016 + slot of the instruction, so that a PC relative relocation can
3.2017 + be made just by adding in an ordinary offset (e.g., sun3 a.out).
3.2018 + Some formats leave the displacement part of an instruction
3.2019 + empty (e.g., m88k bcs); this flag signals the fact. */
3.2020 + bfd_boolean pcrel_offset;
3.2021 +};
3.2022 +
3.2023 +#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
3.2024 + { (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC }
3.2025 +#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \
3.2026 + HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \
3.2027 + NAME, FALSE, 0, 0, IN)
3.2028 +
3.2029 +#define EMPTY_HOWTO(C) \
3.2030 + HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \
3.2031 + NULL, FALSE, 0, 0, FALSE)
3.2032 +
3.2033 +#define HOWTO_PREPARE(relocation, symbol) \
3.2034 + { \
3.2035 + if (symbol != NULL) \
3.2036 + { \
3.2037 + if (bfd_is_com_section (symbol->section)) \
3.2038 + { \
3.2039 + relocation = 0; \
3.2040 + } \
3.2041 + else \
3.2042 + { \
3.2043 + relocation = symbol->value; \
3.2044 + } \
3.2045 + } \
3.2046 + }
3.2047 +
3.2048 +unsigned int bfd_get_reloc_size (reloc_howto_type *);
3.2049 +
3.2050 +typedef struct relent_chain
3.2051 +{
3.2052 + arelent relent;
3.2053 + struct relent_chain *next;
3.2054 +}
3.2055 +arelent_chain;
3.2056 +
3.2057 +bfd_reloc_status_type bfd_check_overflow
3.2058 + (enum complain_overflow how,
3.2059 + unsigned int bitsize,
3.2060 + unsigned int rightshift,
3.2061 + unsigned int addrsize,
3.2062 + bfd_vma relocation);
3.2063 +
3.2064 +bfd_reloc_status_type bfd_perform_relocation
3.2065 + (bfd *abfd,
3.2066 + arelent *reloc_entry,
3.2067 + void *data,
3.2068 + asection *input_section,
3.2069 + bfd *output_bfd,
3.2070 + char **error_message);
3.2071 +
3.2072 +bfd_reloc_status_type bfd_install_relocation
3.2073 + (bfd *abfd,
3.2074 + arelent *reloc_entry,
3.2075 + void *data, bfd_vma data_start,
3.2076 + asection *input_section,
3.2077 + char **error_message);
3.2078 +
3.2079 +enum bfd_reloc_code_real {
3.2080 + _dummy_first_bfd_reloc_code_real,
3.2081 +
3.2082 +
3.2083 +/* Basic absolute relocations of N bits. */
3.2084 + BFD_RELOC_64,
3.2085 + BFD_RELOC_32,
3.2086 + BFD_RELOC_26,
3.2087 + BFD_RELOC_24,
3.2088 + BFD_RELOC_16,
3.2089 + BFD_RELOC_14,
3.2090 + BFD_RELOC_8,
3.2091 +
3.2092 +/* PC-relative relocations. Sometimes these are relative to the address
3.2093 +of the relocation itself; sometimes they are relative to the start of
3.2094 +the section containing the relocation. It depends on the specific target.
3.2095 +
3.2096 +The 24-bit relocation is used in some Intel 960 configurations. */
3.2097 + BFD_RELOC_64_PCREL,
3.2098 + BFD_RELOC_32_PCREL,
3.2099 + BFD_RELOC_24_PCREL,
3.2100 + BFD_RELOC_16_PCREL,
3.2101 + BFD_RELOC_12_PCREL,
3.2102 + BFD_RELOC_8_PCREL,
3.2103 +
3.2104 +/* Section relative relocations. Some targets need this for DWARF2. */
3.2105 + BFD_RELOC_32_SECREL,
3.2106 +
3.2107 +/* For ELF. */
3.2108 + BFD_RELOC_32_GOT_PCREL,
3.2109 + BFD_RELOC_16_GOT_PCREL,
3.2110 + BFD_RELOC_8_GOT_PCREL,
3.2111 + BFD_RELOC_32_GOTOFF,
3.2112 + BFD_RELOC_16_GOTOFF,
3.2113 + BFD_RELOC_LO16_GOTOFF,
3.2114 + BFD_RELOC_HI16_GOTOFF,
3.2115 + BFD_RELOC_HI16_S_GOTOFF,
3.2116 + BFD_RELOC_8_GOTOFF,
3.2117 + BFD_RELOC_64_PLT_PCREL,
3.2118 + BFD_RELOC_32_PLT_PCREL,
3.2119 + BFD_RELOC_24_PLT_PCREL,
3.2120 + BFD_RELOC_16_PLT_PCREL,
3.2121 + BFD_RELOC_8_PLT_PCREL,
3.2122 + BFD_RELOC_64_PLTOFF,
3.2123 + BFD_RELOC_32_PLTOFF,
3.2124 + BFD_RELOC_16_PLTOFF,
3.2125 + BFD_RELOC_LO16_PLTOFF,
3.2126 + BFD_RELOC_HI16_PLTOFF,
3.2127 + BFD_RELOC_HI16_S_PLTOFF,
3.2128 + BFD_RELOC_8_PLTOFF,
3.2129 +
3.2130 +/* Relocations used by 68K ELF. */
3.2131 + BFD_RELOC_68K_GLOB_DAT,
3.2132 + BFD_RELOC_68K_JMP_SLOT,
3.2133 + BFD_RELOC_68K_RELATIVE,
3.2134 +
3.2135 +/* Linkage-table relative. */
3.2136 + BFD_RELOC_32_BASEREL,
3.2137 + BFD_RELOC_16_BASEREL,
3.2138 + BFD_RELOC_LO16_BASEREL,
3.2139 + BFD_RELOC_HI16_BASEREL,
3.2140 + BFD_RELOC_HI16_S_BASEREL,
3.2141 + BFD_RELOC_8_BASEREL,
3.2142 + BFD_RELOC_RVA,
3.2143 +
3.2144 +/* Absolute 8-bit relocation, but used to form an address like 0xFFnn. */
3.2145 + BFD_RELOC_8_FFnn,
3.2146 +
3.2147 +/* These PC-relative relocations are stored as word displacements --
3.2148 +i.e., byte displacements shifted right two bits. The 30-bit word
3.2149 +displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the
3.2150 +SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The
3.2151 +signed 16-bit displacement is used on the MIPS, and the 23-bit
3.2152 +displacement is used on the Alpha. */
3.2153 + BFD_RELOC_32_PCREL_S2,
3.2154 + BFD_RELOC_16_PCREL_S2,
3.2155 + BFD_RELOC_23_PCREL_S2,
3.2156 +
3.2157 +/* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of
3.2158 +the target word. These are used on the SPARC. */
3.2159 + BFD_RELOC_HI22,
3.2160 + BFD_RELOC_LO10,
3.2161 +
3.2162 +/* For systems that allocate a Global Pointer register, these are
3.2163 +displacements off that register. These relocation types are
3.2164 +handled specially, because the value the register will have is
3.2165 +decided relatively late. */
3.2166 + BFD_RELOC_GPREL16,
3.2167 + BFD_RELOC_GPREL32,
3.2168 +
3.2169 +/* Reloc types used for i960/b.out. */
3.2170 + BFD_RELOC_I960_CALLJ,
3.2171 +
3.2172 +/* SPARC ELF relocations. There is probably some overlap with other
3.2173 +relocation types already defined. */
3.2174 + BFD_RELOC_NONE,
3.2175 + BFD_RELOC_SPARC_WDISP22,
3.2176 + BFD_RELOC_SPARC22,
3.2177 + BFD_RELOC_SPARC13,
3.2178 + BFD_RELOC_SPARC_GOT10,
3.2179 + BFD_RELOC_SPARC_GOT13,
3.2180 + BFD_RELOC_SPARC_GOT22,
3.2181 + BFD_RELOC_SPARC_PC10,
3.2182 + BFD_RELOC_SPARC_PC22,
3.2183 + BFD_RELOC_SPARC_WPLT30,
3.2184 + BFD_RELOC_SPARC_COPY,
3.2185 + BFD_RELOC_SPARC_GLOB_DAT,
3.2186 + BFD_RELOC_SPARC_JMP_SLOT,
3.2187 + BFD_RELOC_SPARC_RELATIVE,
3.2188 + BFD_RELOC_SPARC_UA16,
3.2189 + BFD_RELOC_SPARC_UA32,
3.2190 + BFD_RELOC_SPARC_UA64,
3.2191 +
3.2192 +/* I think these are specific to SPARC a.out (e.g., Sun 4). */
3.2193 + BFD_RELOC_SPARC_BASE13,
3.2194 + BFD_RELOC_SPARC_BASE22,
3.2195 +
3.2196 +/* SPARC64 relocations */
3.2197 +#define BFD_RELOC_SPARC_64 BFD_RELOC_64
3.2198 + BFD_RELOC_SPARC_10,
3.2199 + BFD_RELOC_SPARC_11,
3.2200 + BFD_RELOC_SPARC_OLO10,
3.2201 + BFD_RELOC_SPARC_HH22,
3.2202 + BFD_RELOC_SPARC_HM10,
3.2203 + BFD_RELOC_SPARC_LM22,
3.2204 + BFD_RELOC_SPARC_PC_HH22,
3.2205 + BFD_RELOC_SPARC_PC_HM10,
3.2206 + BFD_RELOC_SPARC_PC_LM22,
3.2207 + BFD_RELOC_SPARC_WDISP16,
3.2208 + BFD_RELOC_SPARC_WDISP19,
3.2209 + BFD_RELOC_SPARC_7,
3.2210 + BFD_RELOC_SPARC_6,
3.2211 + BFD_RELOC_SPARC_5,
3.2212 +#define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL
3.2213 + BFD_RELOC_SPARC_PLT32,
3.2214 + BFD_RELOC_SPARC_PLT64,
3.2215 + BFD_RELOC_SPARC_HIX22,
3.2216 + BFD_RELOC_SPARC_LOX10,
3.2217 + BFD_RELOC_SPARC_H44,
3.2218 + BFD_RELOC_SPARC_M44,
3.2219 + BFD_RELOC_SPARC_L44,
3.2220 + BFD_RELOC_SPARC_REGISTER,
3.2221 +
3.2222 +/* SPARC little endian relocation */
3.2223 + BFD_RELOC_SPARC_REV32,
3.2224 +
3.2225 +/* SPARC TLS relocations */
3.2226 + BFD_RELOC_SPARC_TLS_GD_HI22,
3.2227 + BFD_RELOC_SPARC_TLS_GD_LO10,
3.2228 + BFD_RELOC_SPARC_TLS_GD_ADD,
3.2229 + BFD_RELOC_SPARC_TLS_GD_CALL,
3.2230 + BFD_RELOC_SPARC_TLS_LDM_HI22,
3.2231 + BFD_RELOC_SPARC_TLS_LDM_LO10,
3.2232 + BFD_RELOC_SPARC_TLS_LDM_ADD,
3.2233 + BFD_RELOC_SPARC_TLS_LDM_CALL,
3.2234 + BFD_RELOC_SPARC_TLS_LDO_HIX22,
3.2235 + BFD_RELOC_SPARC_TLS_LDO_LOX10,
3.2236 + BFD_RELOC_SPARC_TLS_LDO_ADD,
3.2237 + BFD_RELOC_SPARC_TLS_IE_HI22,
3.2238 + BFD_RELOC_SPARC_TLS_IE_LO10,
3.2239 + BFD_RELOC_SPARC_TLS_IE_LD,
3.2240 + BFD_RELOC_SPARC_TLS_IE_LDX,
3.2241 + BFD_RELOC_SPARC_TLS_IE_ADD,
3.2242 + BFD_RELOC_SPARC_TLS_LE_HIX22,
3.2243 + BFD_RELOC_SPARC_TLS_LE_LOX10,
3.2244 + BFD_RELOC_SPARC_TLS_DTPMOD32,
3.2245 + BFD_RELOC_SPARC_TLS_DTPMOD64,
3.2246 + BFD_RELOC_SPARC_TLS_DTPOFF32,
3.2247 + BFD_RELOC_SPARC_TLS_DTPOFF64,
3.2248 + BFD_RELOC_SPARC_TLS_TPOFF32,
3.2249 + BFD_RELOC_SPARC_TLS_TPOFF64,
3.2250 +
3.2251 +/* Alpha ECOFF and ELF relocations. Some of these treat the symbol or
3.2252 +"addend" in some special way.
3.2253 +For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
3.2254 +writing; when reading, it will be the absolute section symbol. The
3.2255 +addend is the displacement in bytes of the "lda" instruction from
3.2256 +the "ldah" instruction (which is at the address of this reloc). */
3.2257 + BFD_RELOC_ALPHA_GPDISP_HI16,
3.2258 +
3.2259 +/* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as
3.2260 +with GPDISP_HI16 relocs. The addend is ignored when writing the
3.2261 +relocations out, and is filled in with the file's GP value on
3.2262 +reading, for convenience. */
3.2263 + BFD_RELOC_ALPHA_GPDISP_LO16,
3.2264 +
3.2265 +/* The ELF GPDISP relocation is exactly the same as the GPDISP_HI16
3.2266 +relocation except that there is no accompanying GPDISP_LO16
3.2267 +relocation. */
3.2268 + BFD_RELOC_ALPHA_GPDISP,
3.2269 +
3.2270 +/* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference;
3.2271 +the assembler turns it into a LDQ instruction to load the address of
3.2272 +the symbol, and then fills in a register in the real instruction.
3.2273 +
3.2274 +The LITERAL reloc, at the LDQ instruction, refers to the .lita
3.2275 +section symbol. The addend is ignored when writing, but is filled
3.2276 +in with the file's GP value on reading, for convenience, as with the
3.2277 +GPDISP_LO16 reloc.
3.2278 +
3.2279 +The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16.
3.2280 +It should refer to the symbol to be referenced, as with 16_GOTOFF,
3.2281 +but it generates output not based on the position within the .got
3.2282 +section, but relative to the GP value chosen for the file during the
3.2283 +final link stage.
3.2284 +
3.2285 +The LITUSE reloc, on the instruction using the loaded address, gives
3.2286 +information to the linker that it might be able to use to optimize
3.2287 +away some literal section references. The symbol is ignored (read
3.2288 +as the absolute section symbol), and the "addend" indicates the type
3.2289 +of instruction using the register:
3.2290 +1 - "memory" fmt insn
3.2291 +2 - byte-manipulation (byte offset reg)
3.2292 +3 - jsr (target of branch) */
3.2293 + BFD_RELOC_ALPHA_LITERAL,
3.2294 + BFD_RELOC_ALPHA_ELF_LITERAL,
3.2295 + BFD_RELOC_ALPHA_LITUSE,
3.2296 +
3.2297 +/* The HINT relocation indicates a value that should be filled into the
3.2298 +"hint" field of a jmp/jsr/ret instruction, for possible branch-
3.2299 +prediction logic which may be provided on some processors. */
3.2300 + BFD_RELOC_ALPHA_HINT,
3.2301 +
3.2302 +/* The LINKAGE relocation outputs a linkage pair in the object file,
3.2303 +which is filled by the linker. */
3.2304 + BFD_RELOC_ALPHA_LINKAGE,
3.2305 +
3.2306 +/* The CODEADDR relocation outputs a STO_CA in the object file,
3.2307 +which is filled by the linker. */
3.2308 + BFD_RELOC_ALPHA_CODEADDR,
3.2309 +
3.2310 +/* The GPREL_HI/LO relocations together form a 32-bit offset from the
3.2311 +GP register. */
3.2312 + BFD_RELOC_ALPHA_GPREL_HI16,
3.2313 + BFD_RELOC_ALPHA_GPREL_LO16,
3.2314 +
3.2315 +/* Like BFD_RELOC_23_PCREL_S2, except that the source and target must
3.2316 +share a common GP, and the target address is adjusted for
3.2317 +STO_ALPHA_STD_GPLOAD. */
3.2318 + BFD_RELOC_ALPHA_BRSGP,
3.2319 +
3.2320 +/* Alpha thread-local storage relocations. */
3.2321 + BFD_RELOC_ALPHA_TLSGD,
3.2322 + BFD_RELOC_ALPHA_TLSLDM,
3.2323 + BFD_RELOC_ALPHA_DTPMOD64,
3.2324 + BFD_RELOC_ALPHA_GOTDTPREL16,
3.2325 + BFD_RELOC_ALPHA_DTPREL64,
3.2326 + BFD_RELOC_ALPHA_DTPREL_HI16,
3.2327 + BFD_RELOC_ALPHA_DTPREL_LO16,
3.2328 + BFD_RELOC_ALPHA_DTPREL16,
3.2329 + BFD_RELOC_ALPHA_GOTTPREL16,
3.2330 + BFD_RELOC_ALPHA_TPREL64,
3.2331 + BFD_RELOC_ALPHA_TPREL_HI16,
3.2332 + BFD_RELOC_ALPHA_TPREL_LO16,
3.2333 + BFD_RELOC_ALPHA_TPREL16,
3.2334 +
3.2335 +/* Bits 27..2 of the relocation address shifted right 2 bits;
3.2336 +simple reloc otherwise. */
3.2337 + BFD_RELOC_MIPS_JMP,
3.2338 +
3.2339 +/* The MIPS16 jump instruction. */
3.2340 + BFD_RELOC_MIPS16_JMP,
3.2341 +
3.2342 +/* MIPS16 GP relative reloc. */
3.2343 + BFD_RELOC_MIPS16_GPREL,
3.2344 +
3.2345 +/* High 16 bits of 32-bit value; simple reloc. */
3.2346 + BFD_RELOC_HI16,
3.2347 +
3.2348 +/* High 16 bits of 32-bit value but the low 16 bits will be sign
3.2349 +extended and added to form the final result. If the low 16
3.2350 +bits form a negative number, we need to add one to the high value
3.2351 +to compensate for the borrow when the low bits are added. */
3.2352 + BFD_RELOC_HI16_S,
3.2353 +
3.2354 +/* Low 16 bits. */
3.2355 + BFD_RELOC_LO16,
3.2356 +
3.2357 +/* MIPS16 high 16 bits of 32-bit value. */
3.2358 + BFD_RELOC_MIPS16_HI16,
3.2359 +
3.2360 +/* MIPS16 high 16 bits of 32-bit value but the low 16 bits will be sign
3.2361 +extended and added to form the final result. If the low 16
3.2362 +bits form a negative number, we need to add one to the high value
3.2363 +to compensate for the borrow when the low bits are added. */
3.2364 + BFD_RELOC_MIPS16_HI16_S,
3.2365 +
3.2366 +/* MIPS16 low 16 bits. */
3.2367 + BFD_RELOC_MIPS16_LO16,
3.2368 +
3.2369 +/* Relocation against a MIPS literal section. */
3.2370 + BFD_RELOC_MIPS_LITERAL,
3.2371 +
3.2372 +/* MIPS ELF relocations. */
3.2373 + BFD_RELOC_MIPS_GOT16,
3.2374 + BFD_RELOC_MIPS_CALL16,
3.2375 + BFD_RELOC_MIPS_GOT_HI16,
3.2376 + BFD_RELOC_MIPS_GOT_LO16,
3.2377 + BFD_RELOC_MIPS_CALL_HI16,
3.2378 + BFD_RELOC_MIPS_CALL_LO16,
3.2379 + BFD_RELOC_MIPS_SUB,
3.2380 + BFD_RELOC_MIPS_GOT_PAGE,
3.2381 + BFD_RELOC_MIPS_GOT_OFST,
3.2382 + BFD_RELOC_MIPS_GOT_DISP,
3.2383 + BFD_RELOC_MIPS_SHIFT5,
3.2384 + BFD_RELOC_MIPS_SHIFT6,
3.2385 + BFD_RELOC_MIPS_INSERT_A,
3.2386 + BFD_RELOC_MIPS_INSERT_B,
3.2387 + BFD_RELOC_MIPS_DELETE,
3.2388 + BFD_RELOC_MIPS_HIGHEST,
3.2389 + BFD_RELOC_MIPS_HIGHER,
3.2390 + BFD_RELOC_MIPS_SCN_DISP,
3.2391 + BFD_RELOC_MIPS_REL16,
3.2392 + BFD_RELOC_MIPS_RELGOT,
3.2393 + BFD_RELOC_MIPS_JALR,
3.2394 + BFD_RELOC_MIPS_TLS_DTPMOD32,
3.2395 + BFD_RELOC_MIPS_TLS_DTPREL32,
3.2396 + BFD_RELOC_MIPS_TLS_DTPMOD64,
3.2397 + BFD_RELOC_MIPS_TLS_DTPREL64,
3.2398 + BFD_RELOC_MIPS_TLS_GD,
3.2399 + BFD_RELOC_MIPS_TLS_LDM,
3.2400 + BFD_RELOC_MIPS_TLS_DTPREL_HI16,
3.2401 + BFD_RELOC_MIPS_TLS_DTPREL_LO16,
3.2402 + BFD_RELOC_MIPS_TLS_GOTTPREL,
3.2403 + BFD_RELOC_MIPS_TLS_TPREL32,
3.2404 + BFD_RELOC_MIPS_TLS_TPREL64,
3.2405 + BFD_RELOC_MIPS_TLS_TPREL_HI16,
3.2406 + BFD_RELOC_MIPS_TLS_TPREL_LO16,
3.2407 +
3.2408 +
3.2409 +/* Fujitsu Frv Relocations. */
3.2410 + BFD_RELOC_FRV_LABEL16,
3.2411 + BFD_RELOC_FRV_LABEL24,
3.2412 + BFD_RELOC_FRV_LO16,
3.2413 + BFD_RELOC_FRV_HI16,
3.2414 + BFD_RELOC_FRV_GPREL12,
3.2415 + BFD_RELOC_FRV_GPRELU12,
3.2416 + BFD_RELOC_FRV_GPREL32,
3.2417 + BFD_RELOC_FRV_GPRELHI,
3.2418 + BFD_RELOC_FRV_GPRELLO,
3.2419 + BFD_RELOC_FRV_GOT12,
3.2420 + BFD_RELOC_FRV_GOTHI,
3.2421 + BFD_RELOC_FRV_GOTLO,
3.2422 + BFD_RELOC_FRV_FUNCDESC,
3.2423 + BFD_RELOC_FRV_FUNCDESC_GOT12,
3.2424 + BFD_RELOC_FRV_FUNCDESC_GOTHI,
3.2425 + BFD_RELOC_FRV_FUNCDESC_GOTLO,
3.2426 + BFD_RELOC_FRV_FUNCDESC_VALUE,
3.2427 + BFD_RELOC_FRV_FUNCDESC_GOTOFF12,
3.2428 + BFD_RELOC_FRV_FUNCDESC_GOTOFFHI,
3.2429 + BFD_RELOC_FRV_FUNCDESC_GOTOFFLO,
3.2430 + BFD_RELOC_FRV_GOTOFF12,
3.2431 + BFD_RELOC_FRV_GOTOFFHI,
3.2432 + BFD_RELOC_FRV_GOTOFFLO,
3.2433 + BFD_RELOC_FRV_GETTLSOFF,
3.2434 + BFD_RELOC_FRV_TLSDESC_VALUE,
3.2435 + BFD_RELOC_FRV_GOTTLSDESC12,
3.2436 + BFD_RELOC_FRV_GOTTLSDESCHI,
3.2437 + BFD_RELOC_FRV_GOTTLSDESCLO,
3.2438 + BFD_RELOC_FRV_TLSMOFF12,
3.2439 + BFD_RELOC_FRV_TLSMOFFHI,
3.2440 + BFD_RELOC_FRV_TLSMOFFLO,
3.2441 + BFD_RELOC_FRV_GOTTLSOFF12,
3.2442 + BFD_RELOC_FRV_GOTTLSOFFHI,
3.2443 + BFD_RELOC_FRV_GOTTLSOFFLO,
3.2444 + BFD_RELOC_FRV_TLSOFF,
3.2445 + BFD_RELOC_FRV_TLSDESC_RELAX,
3.2446 + BFD_RELOC_FRV_GETTLSOFF_RELAX,
3.2447 + BFD_RELOC_FRV_TLSOFF_RELAX,
3.2448 + BFD_RELOC_FRV_TLSMOFF,
3.2449 +
3.2450 +
3.2451 +/* This is a 24bit GOT-relative reloc for the mn10300. */
3.2452 + BFD_RELOC_MN10300_GOTOFF24,
3.2453 +
3.2454 +/* This is a 32bit GOT-relative reloc for the mn10300, offset by two bytes
3.2455 +in the instruction. */
3.2456 + BFD_RELOC_MN10300_GOT32,
3.2457 +
3.2458 +/* This is a 24bit GOT-relative reloc for the mn10300, offset by two bytes
3.2459 +in the instruction. */
3.2460 + BFD_RELOC_MN10300_GOT24,
3.2461 +
3.2462 +/* This is a 16bit GOT-relative reloc for the mn10300, offset by two bytes
3.2463 +in the instruction. */
3.2464 + BFD_RELOC_MN10300_GOT16,
3.2465 +
3.2466 +/* Copy symbol at runtime. */
3.2467 + BFD_RELOC_MN10300_COPY,
3.2468 +
3.2469 +/* Create GOT entry. */
3.2470 + BFD_RELOC_MN10300_GLOB_DAT,
3.2471 +
3.2472 +/* Create PLT entry. */
3.2473 + BFD_RELOC_MN10300_JMP_SLOT,
3.2474 +
3.2475 +/* Adjust by program base. */
3.2476 + BFD_RELOC_MN10300_RELATIVE,
3.2477 +
3.2478 +
3.2479 +/* i386/elf relocations */
3.2480 + BFD_RELOC_386_GOT32,
3.2481 + BFD_RELOC_386_PLT32,
3.2482 + BFD_RELOC_386_COPY,
3.2483 + BFD_RELOC_386_GLOB_DAT,
3.2484 + BFD_RELOC_386_JUMP_SLOT,
3.2485 + BFD_RELOC_386_RELATIVE,
3.2486 + BFD_RELOC_386_GOTOFF,
3.2487 + BFD_RELOC_386_GOTPC,
3.2488 + BFD_RELOC_386_TLS_TPOFF,
3.2489 + BFD_RELOC_386_TLS_IE,
3.2490 + BFD_RELOC_386_TLS_GOTIE,
3.2491 + BFD_RELOC_386_TLS_LE,
3.2492 + BFD_RELOC_386_TLS_GD,
3.2493 + BFD_RELOC_386_TLS_LDM,
3.2494 + BFD_RELOC_386_TLS_LDO_32,
3.2495 + BFD_RELOC_386_TLS_IE_32,
3.2496 + BFD_RELOC_386_TLS_LE_32,
3.2497 + BFD_RELOC_386_TLS_DTPMOD32,
3.2498 + BFD_RELOC_386_TLS_DTPOFF32,
3.2499 + BFD_RELOC_386_TLS_TPOFF32,
3.2500 +
3.2501 +/* x86-64/elf relocations */
3.2502 + BFD_RELOC_X86_64_GOT32,
3.2503 + BFD_RELOC_X86_64_PLT32,
3.2504 + BFD_RELOC_X86_64_COPY,
3.2505 + BFD_RELOC_X86_64_GLOB_DAT,
3.2506 + BFD_RELOC_X86_64_JUMP_SLOT,
3.2507 + BFD_RELOC_X86_64_RELATIVE,
3.2508 + BFD_RELOC_X86_64_GOTPCREL,
3.2509 + BFD_RELOC_X86_64_32S,
3.2510 + BFD_RELOC_X86_64_DTPMOD64,
3.2511 + BFD_RELOC_X86_64_DTPOFF64,
3.2512 + BFD_RELOC_X86_64_TPOFF64,
3.2513 + BFD_RELOC_X86_64_TLSGD,
3.2514 + BFD_RELOC_X86_64_TLSLD,
3.2515 + BFD_RELOC_X86_64_DTPOFF32,
3.2516 + BFD_RELOC_X86_64_GOTTPOFF,
3.2517 + BFD_RELOC_X86_64_TPOFF32,
3.2518 +
3.2519 +/* ns32k relocations */
3.2520 + BFD_RELOC_NS32K_IMM_8,
3.2521 + BFD_RELOC_NS32K_IMM_16,
3.2522 + BFD_RELOC_NS32K_IMM_32,
3.2523 + BFD_RELOC_NS32K_IMM_8_PCREL,
3.2524 + BFD_RELOC_NS32K_IMM_16_PCREL,
3.2525 + BFD_RELOC_NS32K_IMM_32_PCREL,
3.2526 + BFD_RELOC_NS32K_DISP_8,
3.2527 + BFD_RELOC_NS32K_DISP_16,
3.2528 + BFD_RELOC_NS32K_DISP_32,
3.2529 + BFD_RELOC_NS32K_DISP_8_PCREL,
3.2530 + BFD_RELOC_NS32K_DISP_16_PCREL,
3.2531 + BFD_RELOC_NS32K_DISP_32_PCREL,
3.2532 +
3.2533 +/* PDP11 relocations */
3.2534 + BFD_RELOC_PDP11_DISP_8_PCREL,
3.2535 + BFD_RELOC_PDP11_DISP_6_PCREL,
3.2536 +
3.2537 +/* Picojava relocs. Not all of these appear in object files. */
3.2538 + BFD_RELOC_PJ_CODE_HI16,
3.2539 + BFD_RELOC_PJ_CODE_LO16,
3.2540 + BFD_RELOC_PJ_CODE_DIR16,
3.2541 + BFD_RELOC_PJ_CODE_DIR32,
3.2542 + BFD_RELOC_PJ_CODE_REL16,
3.2543 + BFD_RELOC_PJ_CODE_REL32,
3.2544 +
3.2545 +/* Power(rs6000) and PowerPC relocations. */
3.2546 + BFD_RELOC_PPC_B26,
3.2547 + BFD_RELOC_PPC_BA26,
3.2548 + BFD_RELOC_PPC_TOC16,
3.2549 + BFD_RELOC_PPC_B16,
3.2550 + BFD_RELOC_PPC_B16_BRTAKEN,
3.2551 + BFD_RELOC_PPC_B16_BRNTAKEN,
3.2552 + BFD_RELOC_PPC_BA16,
3.2553 + BFD_RELOC_PPC_BA16_BRTAKEN,
3.2554 + BFD_RELOC_PPC_BA16_BRNTAKEN,
3.2555 + BFD_RELOC_PPC_COPY,
3.2556 + BFD_RELOC_PPC_GLOB_DAT,
3.2557 + BFD_RELOC_PPC_JMP_SLOT,
3.2558 + BFD_RELOC_PPC_RELATIVE,
3.2559 + BFD_RELOC_PPC_LOCAL24PC,
3.2560 + BFD_RELOC_PPC_EMB_NADDR32,
3.2561 + BFD_RELOC_PPC_EMB_NADDR16,
3.2562 + BFD_RELOC_PPC_EMB_NADDR16_LO,
3.2563 + BFD_RELOC_PPC_EMB_NADDR16_HI,
3.2564 + BFD_RELOC_PPC_EMB_NADDR16_HA,
3.2565 + BFD_RELOC_PPC_EMB_SDAI16,
3.2566 + BFD_RELOC_PPC_EMB_SDA2I16,
3.2567 + BFD_RELOC_PPC_EMB_SDA2REL,
3.2568 + BFD_RELOC_PPC_EMB_SDA21,
3.2569 + BFD_RELOC_PPC_EMB_MRKREF,
3.2570 + BFD_RELOC_PPC_EMB_RELSEC16,
3.2571 + BFD_RELOC_PPC_EMB_RELST_LO,
3.2572 + BFD_RELOC_PPC_EMB_RELST_HI,
3.2573 + BFD_RELOC_PPC_EMB_RELST_HA,
3.2574 + BFD_RELOC_PPC_EMB_BIT_FLD,
3.2575 + BFD_RELOC_PPC_EMB_RELSDA,
3.2576 + BFD_RELOC_PPC64_HIGHER,
3.2577 + BFD_RELOC_PPC64_HIGHER_S,
3.2578 + BFD_RELOC_PPC64_HIGHEST,
3.2579 + BFD_RELOC_PPC64_HIGHEST_S,
3.2580 + BFD_RELOC_PPC64_TOC16_LO,
3.2581 + BFD_RELOC_PPC64_TOC16_HI,
3.2582 + BFD_RELOC_PPC64_TOC16_HA,
3.2583 + BFD_RELOC_PPC64_TOC,
3.2584 + BFD_RELOC_PPC64_PLTGOT16,
3.2585 + BFD_RELOC_PPC64_PLTGOT16_LO,
3.2586 + BFD_RELOC_PPC64_PLTGOT16_HI,
3.2587 + BFD_RELOC_PPC64_PLTGOT16_HA,
3.2588 + BFD_RELOC_PPC64_ADDR16_DS,
3.2589 + BFD_RELOC_PPC64_ADDR16_LO_DS,
3.2590 + BFD_RELOC_PPC64_GOT16_DS,
3.2591 + BFD_RELOC_PPC64_GOT16_LO_DS,
3.2592 + BFD_RELOC_PPC64_PLT16_LO_DS,
3.2593 + BFD_RELOC_PPC64_SECTOFF_DS,
3.2594 + BFD_RELOC_PPC64_SECTOFF_LO_DS,
3.2595 + BFD_RELOC_PPC64_TOC16_DS,
3.2596 + BFD_RELOC_PPC64_TOC16_LO_DS,
3.2597 + BFD_RELOC_PPC64_PLTGOT16_DS,
3.2598 + BFD_RELOC_PPC64_PLTGOT16_LO_DS,
3.2599 +
3.2600 +/* PowerPC and PowerPC64 thread-local storage relocations. */
3.2601 + BFD_RELOC_PPC_TLS,
3.2602 + BFD_RELOC_PPC_DTPMOD,
3.2603 + BFD_RELOC_PPC_TPREL16,
3.2604 + BFD_RELOC_PPC_TPREL16_LO,
3.2605 + BFD_RELOC_PPC_TPREL16_HI,
3.2606 + BFD_RELOC_PPC_TPREL16_HA,
3.2607 + BFD_RELOC_PPC_TPREL,
3.2608 + BFD_RELOC_PPC_DTPREL16,
3.2609 + BFD_RELOC_PPC_DTPREL16_LO,
3.2610 + BFD_RELOC_PPC_DTPREL16_HI,
3.2611 + BFD_RELOC_PPC_DTPREL16_HA,
3.2612 + BFD_RELOC_PPC_DTPREL,
3.2613 + BFD_RELOC_PPC_GOT_TLSGD16,
3.2614 + BFD_RELOC_PPC_GOT_TLSGD16_LO,
3.2615 + BFD_RELOC_PPC_GOT_TLSGD16_HI,
3.2616 + BFD_RELOC_PPC_GOT_TLSGD16_HA,
3.2617 + BFD_RELOC_PPC_GOT_TLSLD16,
3.2618 + BFD_RELOC_PPC_GOT_TLSLD16_LO,
3.2619 + BFD_RELOC_PPC_GOT_TLSLD16_HI,
3.2620 + BFD_RELOC_PPC_GOT_TLSLD16_HA,
3.2621 + BFD_RELOC_PPC_GOT_TPREL16,
3.2622 + BFD_RELOC_PPC_GOT_TPREL16_LO,
3.2623 + BFD_RELOC_PPC_GOT_TPREL16_HI,
3.2624 + BFD_RELOC_PPC_GOT_TPREL16_HA,
3.2625 + BFD_RELOC_PPC_GOT_DTPREL16,
3.2626 + BFD_RELOC_PPC_GOT_DTPREL16_LO,
3.2627 + BFD_RELOC_PPC_GOT_DTPREL16_HI,
3.2628 + BFD_RELOC_PPC_GOT_DTPREL16_HA,
3.2629 + BFD_RELOC_PPC64_TPREL16_DS,
3.2630 + BFD_RELOC_PPC64_TPREL16_LO_DS,
3.2631 + BFD_RELOC_PPC64_TPREL16_HIGHER,
3.2632 + BFD_RELOC_PPC64_TPREL16_HIGHERA,
3.2633 + BFD_RELOC_PPC64_TPREL16_HIGHEST,
3.2634 + BFD_RELOC_PPC64_TPREL16_HIGHESTA,
3.2635 + BFD_RELOC_PPC64_DTPREL16_DS,
3.2636 + BFD_RELOC_PPC64_DTPREL16_LO_DS,
3.2637 + BFD_RELOC_PPC64_DTPREL16_HIGHER,
3.2638 + BFD_RELOC_PPC64_DTPREL16_HIGHERA,
3.2639 + BFD_RELOC_PPC64_DTPREL16_HIGHEST,
3.2640 + BFD_RELOC_PPC64_DTPREL16_HIGHESTA,
3.2641 +
3.2642 +/* IBM 370/390 relocations */
3.2643 + BFD_RELOC_I370_D12,
3.2644 +
3.2645 +/* The type of reloc used to build a constructor table - at the moment
3.2646 +probably a 32 bit wide absolute relocation, but the target can choose.
3.2647 +It generally does map to one of the other relocation types. */
3.2648 + BFD_RELOC_CTOR,
3.2649 +
3.2650 +/* ARM 26 bit pc-relative branch. The lowest two bits must be zero and are
3.2651 +not stored in the instruction. */
3.2652 + BFD_RELOC_ARM_PCREL_BRANCH,
3.2653 +
3.2654 +/* ARM 26 bit pc-relative branch. The lowest bit must be zero and is
3.2655 +not stored in the instruction. The 2nd lowest bit comes from a 1 bit
3.2656 +field in the instruction. */
3.2657 + BFD_RELOC_ARM_PCREL_BLX,
3.2658 +
3.2659 +/* Thumb 22 bit pc-relative branch. The lowest bit must be zero and is
3.2660 +not stored in the instruction. The 2nd lowest bit comes from a 1 bit
3.2661 +field in the instruction. */
3.2662 + BFD_RELOC_THUMB_PCREL_BLX,
3.2663 +
3.2664 +/* These relocs are only used within the ARM assembler. They are not
3.2665 +(at present) written to any object files. */
3.2666 + BFD_RELOC_ARM_IMMEDIATE,
3.2667 + BFD_RELOC_ARM_ADRL_IMMEDIATE,
3.2668 + BFD_RELOC_ARM_OFFSET_IMM,
3.2669 + BFD_RELOC_ARM_SHIFT_IMM,
3.2670 + BFD_RELOC_ARM_SMI,
3.2671 + BFD_RELOC_ARM_SWI,
3.2672 + BFD_RELOC_ARM_MULTI,
3.2673 + BFD_RELOC_ARM_CP_OFF_IMM,
3.2674 + BFD_RELOC_ARM_CP_OFF_IMM_S2,
3.2675 + BFD_RELOC_ARM_ADR_IMM,
3.2676 + BFD_RELOC_ARM_LDR_IMM,
3.2677 + BFD_RELOC_ARM_LITERAL,
3.2678 + BFD_RELOC_ARM_IN_POOL,
3.2679 + BFD_RELOC_ARM_OFFSET_IMM8,
3.2680 + BFD_RELOC_ARM_HWLITERAL,
3.2681 + BFD_RELOC_ARM_THUMB_ADD,
3.2682 + BFD_RELOC_ARM_THUMB_IMM,
3.2683 + BFD_RELOC_ARM_THUMB_SHIFT,
3.2684 + BFD_RELOC_ARM_THUMB_OFFSET,
3.2685 + BFD_RELOC_ARM_GOT12,
3.2686 + BFD_RELOC_ARM_GOT32,
3.2687 + BFD_RELOC_ARM_JUMP_SLOT,
3.2688 + BFD_RELOC_ARM_COPY,
3.2689 + BFD_RELOC_ARM_GLOB_DAT,
3.2690 + BFD_RELOC_ARM_PLT32,
3.2691 + BFD_RELOC_ARM_RELATIVE,
3.2692 + BFD_RELOC_ARM_GOTOFF,
3.2693 + BFD_RELOC_ARM_GOTPC,
3.2694 +
3.2695 +/* Pc-relative or absolute relocation depending on target. Used for
3.2696 +entries in .init_array sections. */
3.2697 + BFD_RELOC_ARM_TARGET1,
3.2698 +
3.2699 +/* Read-only segment base relative address. */
3.2700 + BFD_RELOC_ARM_ROSEGREL32,
3.2701 +
3.2702 +/* Data segment base relative address. */
3.2703 + BFD_RELOC_ARM_SBREL32,
3.2704 +
3.2705 +/* This reloc is used for References to RTTI dta from exception handling
3.2706 +tables. The actual definition depends on the target. It may be a
3.2707 +pc-relative or some form of GOT-indirect relocation. */
3.2708 + BFD_RELOC_ARM_TARGET2,
3.2709 +
3.2710 +/* 31-bit PC relative address. */
3.2711 + BFD_RELOC_ARM_PREL31,
3.2712 +
3.2713 +/* Renesas / SuperH SH relocs. Not all of these appear in object files. */
3.2714 + BFD_RELOC_SH_PCDISP8BY2,
3.2715 + BFD_RELOC_SH_PCDISP12BY2,
3.2716 + BFD_RELOC_SH_IMM3,
3.2717 + BFD_RELOC_SH_IMM3U,
3.2718 + BFD_RELOC_SH_DISP12,
3.2719 + BFD_RELOC_SH_DISP12BY2,
3.2720 + BFD_RELOC_SH_DISP12BY4,
3.2721 + BFD_RELOC_SH_DISP12BY8,
3.2722 + BFD_RELOC_SH_DISP20,
3.2723 + BFD_RELOC_SH_DISP20BY8,
3.2724 + BFD_RELOC_SH_IMM4,
3.2725 + BFD_RELOC_SH_IMM4BY2,
3.2726 + BFD_RELOC_SH_IMM4BY4,
3.2727 + BFD_RELOC_SH_IMM8,
3.2728 + BFD_RELOC_SH_IMM8BY2,
3.2729 + BFD_RELOC_SH_IMM8BY4,
3.2730 + BFD_RELOC_SH_PCRELIMM8BY2,
3.2731 + BFD_RELOC_SH_PCRELIMM8BY4,
3.2732 + BFD_RELOC_SH_SWITCH16,
3.2733 + BFD_RELOC_SH_SWITCH32,
3.2734 + BFD_RELOC_SH_USES,
3.2735 + BFD_RELOC_SH_COUNT,
3.2736 + BFD_RELOC_SH_ALIGN,
3.2737 + BFD_RELOC_SH_CODE,
3.2738 + BFD_RELOC_SH_DATA,
3.2739 + BFD_RELOC_SH_LABEL,
3.2740 + BFD_RELOC_SH_LOOP_START,
3.2741 + BFD_RELOC_SH_LOOP_END,
3.2742 + BFD_RELOC_SH_COPY,
3.2743 + BFD_RELOC_SH_GLOB_DAT,
3.2744 + BFD_RELOC_SH_JMP_SLOT,
3.2745 + BFD_RELOC_SH_RELATIVE,
3.2746 + BFD_RELOC_SH_GOTPC,
3.2747 + BFD_RELOC_SH_GOT_LOW16,
3.2748 + BFD_RELOC_SH_GOT_MEDLOW16,
3.2749 + BFD_RELOC_SH_GOT_MEDHI16,
3.2750 + BFD_RELOC_SH_GOT_HI16,
3.2751 + BFD_RELOC_SH_GOTPLT_LOW16,
3.2752 + BFD_RELOC_SH_GOTPLT_MEDLOW16,
3.2753 + BFD_RELOC_SH_GOTPLT_MEDHI16,
3.2754 + BFD_RELOC_SH_GOTPLT_HI16,
3.2755 + BFD_RELOC_SH_PLT_LOW16,
3.2756 + BFD_RELOC_SH_PLT_MEDLOW16,
3.2757 + BFD_RELOC_SH_PLT_MEDHI16,
3.2758 + BFD_RELOC_SH_PLT_HI16,
3.2759 + BFD_RELOC_SH_GOTOFF_LOW16,
3.2760 + BFD_RELOC_SH_GOTOFF_MEDLOW16,
3.2761 + BFD_RELOC_SH_GOTOFF_MEDHI16,
3.2762 + BFD_RELOC_SH_GOTOFF_HI16,
3.2763 + BFD_RELOC_SH_GOTPC_LOW16,
3.2764 + BFD_RELOC_SH_GOTPC_MEDLOW16,
3.2765 + BFD_RELOC_SH_GOTPC_MEDHI16,
3.2766 + BFD_RELOC_SH_GOTPC_HI16,
3.2767 + BFD_RELOC_SH_COPY64,
3.2768 + BFD_RELOC_SH_GLOB_DAT64,
3.2769 + BFD_RELOC_SH_JMP_SLOT64,
3.2770 + BFD_RELOC_SH_RELATIVE64,
3.2771 + BFD_RELOC_SH_GOT10BY4,
3.2772 + BFD_RELOC_SH_GOT10BY8,
3.2773 + BFD_RELOC_SH_GOTPLT10BY4,
3.2774 + BFD_RELOC_SH_GOTPLT10BY8,
3.2775 + BFD_RELOC_SH_GOTPLT32,
3.2776 + BFD_RELOC_SH_SHMEDIA_CODE,
3.2777 + BFD_RELOC_SH_IMMU5,
3.2778 + BFD_RELOC_SH_IMMS6,
3.2779 + BFD_RELOC_SH_IMMS6BY32,
3.2780 + BFD_RELOC_SH_IMMU6,
3.2781 + BFD_RELOC_SH_IMMS10,
3.2782 + BFD_RELOC_SH_IMMS10BY2,
3.2783 + BFD_RELOC_SH_IMMS10BY4,
3.2784 + BFD_RELOC_SH_IMMS10BY8,
3.2785 + BFD_RELOC_SH_IMMS16,
3.2786 + BFD_RELOC_SH_IMMU16,
3.2787 + BFD_RELOC_SH_IMM_LOW16,
3.2788 + BFD_RELOC_SH_IMM_LOW16_PCREL,
3.2789 + BFD_RELOC_SH_IMM_MEDLOW16,
3.2790 + BFD_RELOC_SH_IMM_MEDLOW16_PCREL,
3.2791 + BFD_RELOC_SH_IMM_MEDHI16,
3.2792 + BFD_RELOC_SH_IMM_MEDHI16_PCREL,
3.2793 + BFD_RELOC_SH_IMM_HI16,
3.2794 + BFD_RELOC_SH_IMM_HI16_PCREL,
3.2795 + BFD_RELOC_SH_PT_16,
3.2796 + BFD_RELOC_SH_TLS_GD_32,
3.2797 + BFD_RELOC_SH_TLS_LD_32,
3.2798 + BFD_RELOC_SH_TLS_LDO_32,
3.2799 + BFD_RELOC_SH_TLS_IE_32,
3.2800 + BFD_RELOC_SH_TLS_LE_32,
3.2801 + BFD_RELOC_SH_TLS_DTPMOD32,
3.2802 + BFD_RELOC_SH_TLS_DTPOFF32,
3.2803 + BFD_RELOC_SH_TLS_TPOFF32,
3.2804 +
3.2805 +/* Thumb 23-, 12- and 9-bit pc-relative branches. The lowest bit must
3.2806 +be zero and is not stored in the instruction. */
3.2807 + BFD_RELOC_THUMB_PCREL_BRANCH9,
3.2808 + BFD_RELOC_THUMB_PCREL_BRANCH12,
3.2809 + BFD_RELOC_THUMB_PCREL_BRANCH23,
3.2810 +
3.2811 +/* ARC Cores relocs.
3.2812 +ARC 22 bit pc-relative branch. The lowest two bits must be zero and are
3.2813 +not stored in the instruction. The high 20 bits are installed in bits 26
3.2814 +through 7 of the instruction. */
3.2815 + BFD_RELOC_ARC_B22_PCREL,
3.2816 +
3.2817 +/* ARC 26 bit absolute branch. The lowest two bits must be zero and are not
3.2818 +stored in the instruction. The high 24 bits are installed in bits 23
3.2819 +through 0. */
3.2820 + BFD_RELOC_ARC_B26,
3.2821 +
3.2822 +/* Mitsubishi D10V relocs.
3.2823 +This is a 10-bit reloc with the right 2 bits
3.2824 +assumed to be 0. */
3.2825 + BFD_RELOC_D10V_10_PCREL_R,
3.2826 +
3.2827 +/* Mitsubishi D10V relocs.
3.2828 +This is a 10-bit reloc with the right 2 bits
3.2829 +assumed to be 0. This is the same as the previous reloc
3.2830 +except it is in the left container, i.e.,
3.2831 +shifted left 15 bits. */
3.2832 + BFD_RELOC_D10V_10_PCREL_L,
3.2833 +
3.2834 +/* This is an 18-bit reloc with the right 2 bits
3.2835 +assumed to be 0. */
3.2836 + BFD_RELOC_D10V_18,
3.2837 +
3.2838 +/* This is an 18-bit reloc with the right 2 bits
3.2839 +assumed to be 0. */
3.2840 + BFD_RELOC_D10V_18_PCREL,
3.2841 +
3.2842 +/* Mitsubishi D30V relocs.
3.2843 +This is a 6-bit absolute reloc. */
3.2844 + BFD_RELOC_D30V_6,
3.2845 +
3.2846 +/* This is a 6-bit pc-relative reloc with
3.2847 +the right 3 bits assumed to be 0. */
3.2848 + BFD_RELOC_D30V_9_PCREL,
3.2849 +
3.2850 +/* This is a 6-bit pc-relative reloc with
3.2851 +the right 3 bits assumed to be 0. Same
3.2852 +as the previous reloc but on the right side
3.2853 +of the container. */
3.2854 + BFD_RELOC_D30V_9_PCREL_R,
3.2855 +
3.2856 +/* This is a 12-bit absolute reloc with the
3.2857 +right 3 bitsassumed to be 0. */
3.2858 + BFD_RELOC_D30V_15,
3.2859 +
3.2860 +/* This is a 12-bit pc-relative reloc with
3.2861 +the right 3 bits assumed to be 0. */
3.2862 + BFD_RELOC_D30V_15_PCREL,
3.2863 +
3.2864 +/* This is a 12-bit pc-relative reloc with
3.2865 +the right 3 bits assumed to be 0. Same
3.2866 +as the previous reloc but on the right side
3.2867 +of the container. */
3.2868 + BFD_RELOC_D30V_15_PCREL_R,
3.2869 +
3.2870 +/* This is an 18-bit absolute reloc with
3.2871 +the right 3 bits assumed to be 0. */
3.2872 + BFD_RELOC_D30V_21,
3.2873 +
3.2874 +/* This is an 18-bit pc-relative reloc with
3.2875 +the right 3 bits assumed to be 0. */
3.2876 + BFD_RELOC_D30V_21_PCREL,
3.2877 +
3.2878 +/* This is an 18-bit pc-relative reloc with
3.2879 +the right 3 bits assumed to be 0. Same
3.2880 +as the previous reloc but on the right side
3.2881 +of the container. */
3.2882 + BFD_RELOC_D30V_21_PCREL_R,
3.2883 +
3.2884 +/* This is a 32-bit absolute reloc. */
3.2885 + BFD_RELOC_D30V_32,
3.2886 +
3.2887 +/* This is a 32-bit pc-relative reloc. */
3.2888 + BFD_RELOC_D30V_32_PCREL,
3.2889 +
3.2890 +/* DLX relocs */
3.2891 + BFD_RELOC_DLX_HI16_S,
3.2892 +
3.2893 +/* DLX relocs */
3.2894 + BFD_RELOC_DLX_LO16,
3.2895 +
3.2896 +/* DLX relocs */
3.2897 + BFD_RELOC_DLX_JMP26,
3.2898 +
3.2899 +/* Renesas M32R (formerly Mitsubishi M32R) relocs.
3.2900 +This is a 24 bit absolute address. */
3.2901 + BFD_RELOC_M32R_24,
3.2902 +
3.2903 +/* This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0. */
3.2904 + BFD_RELOC_M32R_10_PCREL,
3.2905 +
3.2906 +/* This is an 18-bit reloc with the right 2 bits assumed to be 0. */
3.2907 + BFD_RELOC_M32R_18_PCREL,
3.2908 +
3.2909 +/* This is a 26-bit reloc with the right 2 bits assumed to be 0. */
3.2910 + BFD_RELOC_M32R_26_PCREL,
3.2911 +
3.2912 +/* This is a 16-bit reloc containing the high 16 bits of an address
3.2913 +used when the lower 16 bits are treated as unsigned. */
3.2914 + BFD_RELOC_M32R_HI16_ULO,
3.2915 +
3.2916 +/* This is a 16-bit reloc containing the high 16 bits of an address
3.2917 +used when the lower 16 bits are treated as signed. */
3.2918 + BFD_RELOC_M32R_HI16_SLO,
3.2919 +
3.2920 +/* This is a 16-bit reloc containing the lower 16 bits of an address. */
3.2921 + BFD_RELOC_M32R_LO16,
3.2922 +
3.2923 +/* This is a 16-bit reloc containing the small data area offset for use in
3.2924 +add3, load, and store instructions. */
3.2925 + BFD_RELOC_M32R_SDA16,
3.2926 +
3.2927 +/* For PIC. */
3.2928 + BFD_RELOC_M32R_GOT24,
3.2929 + BFD_RELOC_M32R_26_PLTREL,
3.2930 + BFD_RELOC_M32R_COPY,
3.2931 + BFD_RELOC_M32R_GLOB_DAT,
3.2932 + BFD_RELOC_M32R_JMP_SLOT,
3.2933 + BFD_RELOC_M32R_RELATIVE,
3.2934 + BFD_RELOC_M32R_GOTOFF,
3.2935 + BFD_RELOC_M32R_GOTOFF_HI_ULO,
3.2936 + BFD_RELOC_M32R_GOTOFF_HI_SLO,
3.2937 + BFD_RELOC_M32R_GOTOFF_LO,
3.2938 + BFD_RELOC_M32R_GOTPC24,
3.2939 + BFD_RELOC_M32R_GOT16_HI_ULO,
3.2940 + BFD_RELOC_M32R_GOT16_HI_SLO,
3.2941 + BFD_RELOC_M32R_GOT16_LO,
3.2942 + BFD_RELOC_M32R_GOTPC_HI_ULO,
3.2943 + BFD_RELOC_M32R_GOTPC_HI_SLO,
3.2944 + BFD_RELOC_M32R_GOTPC_LO,
3.2945 +
3.2946 +/* This is a 9-bit reloc */
3.2947 + BFD_RELOC_V850_9_PCREL,
3.2948 +
3.2949 +/* This is a 22-bit reloc */
3.2950 + BFD_RELOC_V850_22_PCREL,
3.2951 +
3.2952 +/* This is a 16 bit offset from the short data area pointer. */
3.2953 + BFD_RELOC_V850_SDA_16_16_OFFSET,
3.2954 +
3.2955 +/* This is a 16 bit offset (of which only 15 bits are used) from the
3.2956 +short data area pointer. */
3.2957 + BFD_RELOC_V850_SDA_15_16_OFFSET,
3.2958 +
3.2959 +/* This is a 16 bit offset from the zero data area pointer. */
3.2960 + BFD_RELOC_V850_ZDA_16_16_OFFSET,
3.2961 +
3.2962 +/* This is a 16 bit offset (of which only 15 bits are used) from the
3.2963 +zero data area pointer. */
3.2964 + BFD_RELOC_V850_ZDA_15_16_OFFSET,
3.2965 +
3.2966 +/* This is an 8 bit offset (of which only 6 bits are used) from the
3.2967 +tiny data area pointer. */
3.2968 + BFD_RELOC_V850_TDA_6_8_OFFSET,
3.2969 +
3.2970 +/* This is an 8bit offset (of which only 7 bits are used) from the tiny
3.2971 +data area pointer. */
3.2972 + BFD_RELOC_V850_TDA_7_8_OFFSET,
3.2973 +
3.2974 +/* This is a 7 bit offset from the tiny data area pointer. */
3.2975 + BFD_RELOC_V850_TDA_7_7_OFFSET,
3.2976 +
3.2977 +/* This is a 16 bit offset from the tiny data area pointer. */
3.2978 + BFD_RELOC_V850_TDA_16_16_OFFSET,
3.2979 +
3.2980 +/* This is a 5 bit offset (of which only 4 bits are used) from the tiny
3.2981 +data area pointer. */
3.2982 + BFD_RELOC_V850_TDA_4_5_OFFSET,
3.2983 +
3.2984 +/* This is a 4 bit offset from the tiny data area pointer. */
3.2985 + BFD_RELOC_V850_TDA_4_4_OFFSET,
3.2986 +
3.2987 +/* This is a 16 bit offset from the short data area pointer, with the
3.2988 +bits placed non-contiguously in the instruction. */
3.2989 + BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET,
3.2990 +
3.2991 +/* This is a 16 bit offset from the zero data area pointer, with the
3.2992 +bits placed non-contiguously in the instruction. */
3.2993 + BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET,
3.2994 +
3.2995 +/* This is a 6 bit offset from the call table base pointer. */
3.2996 + BFD_RELOC_V850_CALLT_6_7_OFFSET,
3.2997 +
3.2998 +/* This is a 16 bit offset from the call table base pointer. */
3.2999 + BFD_RELOC_V850_CALLT_16_16_OFFSET,
3.3000 +
3.3001 +/* Used for relaxing indirect function calls. */
3.3002 + BFD_RELOC_V850_LONGCALL,
3.3003 +
3.3004 +/* Used for relaxing indirect jumps. */
3.3005 + BFD_RELOC_V850_LONGJUMP,
3.3006 +
3.3007 +/* Used to maintain alignment whilst relaxing. */
3.3008 + BFD_RELOC_V850_ALIGN,
3.3009 +
3.3010 +/* This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu
3.3011 +instructions. */
3.3012 + BFD_RELOC_V850_LO16_SPLIT_OFFSET,
3.3013 +
3.3014 +/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
3.3015 +instruction. */
3.3016 + BFD_RELOC_MN10300_32_PCREL,
3.3017 +
3.3018 +/* This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the
3.3019 +instruction. */
3.3020 + BFD_RELOC_MN10300_16_PCREL,
3.3021 +
3.3022 +/* This is a 8bit DP reloc for the tms320c30, where the most
3.3023 +significant 8 bits of a 24 bit word are placed into the least
3.3024 +significant 8 bits of the opcode. */
3.3025 + BFD_RELOC_TIC30_LDP,
3.3026 +
3.3027 +/* This is a 7bit reloc for the tms320c54x, where the least
3.3028 +significant 7 bits of a 16 bit word are placed into the least
3.3029 +significant 7 bits of the opcode. */
3.3030 + BFD_RELOC_TIC54X_PARTLS7,
3.3031 +
3.3032 +/* This is a 9bit DP reloc for the tms320c54x, where the most
3.3033 +significant 9 bits of a 16 bit word are placed into the least
3.3034 +significant 9 bits of the opcode. */
3.3035 + BFD_RELOC_TIC54X_PARTMS9,
3.3036 +
3.3037 +/* This is an extended address 23-bit reloc for the tms320c54x. */
3.3038 + BFD_RELOC_TIC54X_23,
3.3039 +
3.3040 +/* This is a 16-bit reloc for the tms320c54x, where the least
3.3041 +significant 16 bits of a 23-bit extended address are placed into
3.3042 +the opcode. */
3.3043 + BFD_RELOC_TIC54X_16_OF_23,
3.3044 +
3.3045 +/* This is a reloc for the tms320c54x, where the most
3.3046 +significant 7 bits of a 23-bit extended address are placed into
3.3047 +the opcode. */
3.3048 + BFD_RELOC_TIC54X_MS7_OF_23,
3.3049 +
3.3050 +/* This is a 48 bit reloc for the FR30 that stores 32 bits. */
3.3051 + BFD_RELOC_FR30_48,
3.3052 +
3.3053 +/* This is a 32 bit reloc for the FR30 that stores 20 bits split up into
3.3054 +two sections. */
3.3055 + BFD_RELOC_FR30_20,
3.3056 +
3.3057 +/* This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in
3.3058 +4 bits. */
3.3059 + BFD_RELOC_FR30_6_IN_4,
3.3060 +
3.3061 +/* This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset
3.3062 +into 8 bits. */
3.3063 + BFD_RELOC_FR30_8_IN_8,
3.3064 +
3.3065 +/* This is a 16 bit reloc for the FR30 that stores a 9 bit short offset
3.3066 +into 8 bits. */
3.3067 + BFD_RELOC_FR30_9_IN_8,
3.3068 +
3.3069 +/* This is a 16 bit reloc for the FR30 that stores a 10 bit word offset
3.3070 +into 8 bits. */
3.3071 + BFD_RELOC_FR30_10_IN_8,
3.3072 +
3.3073 +/* This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
3.3074 +short offset into 8 bits. */
3.3075 + BFD_RELOC_FR30_9_PCREL,
3.3076 +
3.3077 +/* This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
3.3078 +short offset into 11 bits. */
3.3079 + BFD_RELOC_FR30_12_PCREL,
3.3080 +
3.3081 +/* Motorola Mcore relocations. */
3.3082 + BFD_RELOC_MCORE_PCREL_IMM8BY4,
3.3083 + BFD_RELOC_MCORE_PCREL_IMM11BY2,
3.3084 + BFD_RELOC_MCORE_PCREL_IMM4BY2,
3.3085 + BFD_RELOC_MCORE_PCREL_32,
3.3086 + BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2,
3.3087 + BFD_RELOC_MCORE_RVA,
3.3088 +
3.3089 +/* These are relocations for the GETA instruction. */
3.3090 + BFD_RELOC_MMIX_GETA,
3.3091 + BFD_RELOC_MMIX_GETA_1,
3.3092 + BFD_RELOC_MMIX_GETA_2,
3.3093 + BFD_RELOC_MMIX_GETA_3,
3.3094 +
3.3095 +/* These are relocations for a conditional branch instruction. */
3.3096 + BFD_RELOC_MMIX_CBRANCH,
3.3097 + BFD_RELOC_MMIX_CBRANCH_J,
3.3098 + BFD_RELOC_MMIX_CBRANCH_1,
3.3099 + BFD_RELOC_MMIX_CBRANCH_2,
3.3100 + BFD_RELOC_MMIX_CBRANCH_3,
3.3101 +
3.3102 +/* These are relocations for the PUSHJ instruction. */
3.3103 + BFD_RELOC_MMIX_PUSHJ,
3.3104 + BFD_RELOC_MMIX_PUSHJ_1,
3.3105 + BFD_RELOC_MMIX_PUSHJ_2,
3.3106 + BFD_RELOC_MMIX_PUSHJ_3,
3.3107 + BFD_RELOC_MMIX_PUSHJ_STUBBABLE,
3.3108 +
3.3109 +/* These are relocations for the JMP instruction. */
3.3110 + BFD_RELOC_MMIX_JMP,
3.3111 + BFD_RELOC_MMIX_JMP_1,
3.3112 + BFD_RELOC_MMIX_JMP_2,
3.3113 + BFD_RELOC_MMIX_JMP_3,
3.3114 +
3.3115 +/* This is a relocation for a relative address as in a GETA instruction or
3.3116 +a branch. */
3.3117 + BFD_RELOC_MMIX_ADDR19,
3.3118 +
3.3119 +/* This is a relocation for a relative address as in a JMP instruction. */
3.3120 + BFD_RELOC_MMIX_ADDR27,
3.3121 +
3.3122 +/* This is a relocation for an instruction field that may be a general
3.3123 +register or a value 0..255. */
3.3124 + BFD_RELOC_MMIX_REG_OR_BYTE,
3.3125 +
3.3126 +/* This is a relocation for an instruction field that may be a general
3.3127 +register. */
3.3128 + BFD_RELOC_MMIX_REG,
3.3129 +
3.3130 +/* This is a relocation for two instruction fields holding a register and
3.3131 +an offset, the equivalent of the relocation. */
3.3132 + BFD_RELOC_MMIX_BASE_PLUS_OFFSET,
3.3133 +
3.3134 +/* This relocation is an assertion that the expression is not allocated as
3.3135 +a global register. It does not modify contents. */
3.3136 + BFD_RELOC_MMIX_LOCAL,
3.3137 +
3.3138 +/* This is a 16 bit reloc for the AVR that stores 8 bit pc relative
3.3139 +short offset into 7 bits. */
3.3140 + BFD_RELOC_AVR_7_PCREL,
3.3141 +
3.3142 +/* This is a 16 bit reloc for the AVR that stores 13 bit pc relative
3.3143 +short offset into 12 bits. */
3.3144 + BFD_RELOC_AVR_13_PCREL,
3.3145 +
3.3146 +/* This is a 16 bit reloc for the AVR that stores 17 bit value (usually
3.3147 +program memory address) into 16 bits. */
3.3148 + BFD_RELOC_AVR_16_PM,
3.3149 +
3.3150 +/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
3.3151 +data memory address) into 8 bit immediate value of LDI insn. */
3.3152 + BFD_RELOC_AVR_LO8_LDI,
3.3153 +
3.3154 +/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
3.3155 +of data memory address) into 8 bit immediate value of LDI insn. */
3.3156 + BFD_RELOC_AVR_HI8_LDI,
3.3157 +
3.3158 +/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
3.3159 +of program memory address) into 8 bit immediate value of LDI insn. */
3.3160 + BFD_RELOC_AVR_HH8_LDI,
3.3161 +
3.3162 +/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
3.3163 +(usually data memory address) into 8 bit immediate value of SUBI insn. */
3.3164 + BFD_RELOC_AVR_LO8_LDI_NEG,
3.3165 +
3.3166 +/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
3.3167 +(high 8 bit of data memory address) into 8 bit immediate value of
3.3168 +SUBI insn. */
3.3169 + BFD_RELOC_AVR_HI8_LDI_NEG,
3.3170 +
3.3171 +/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
3.3172 +(most high 8 bit of program memory address) into 8 bit immediate value
3.3173 +of LDI or SUBI insn. */
3.3174 + BFD_RELOC_AVR_HH8_LDI_NEG,
3.3175 +
3.3176 +/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
3.3177 +command address) into 8 bit immediate value of LDI insn. */
3.3178 + BFD_RELOC_AVR_LO8_LDI_PM,
3.3179 +
3.3180 +/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
3.3181 +of command address) into 8 bit immediate value of LDI insn. */
3.3182 + BFD_RELOC_AVR_HI8_LDI_PM,
3.3183 +
3.3184 +/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
3.3185 +of command address) into 8 bit immediate value of LDI insn. */
3.3186 + BFD_RELOC_AVR_HH8_LDI_PM,
3.3187 +
3.3188 +/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
3.3189 +(usually command address) into 8 bit immediate value of SUBI insn. */
3.3190 + BFD_RELOC_AVR_LO8_LDI_PM_NEG,
3.3191 +
3.3192 +/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
3.3193 +(high 8 bit of 16 bit command address) into 8 bit immediate value
3.3194 +of SUBI insn. */
3.3195 + BFD_RELOC_AVR_HI8_LDI_PM_NEG,
3.3196 +
3.3197 +/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
3.3198 +(high 6 bit of 22 bit command address) into 8 bit immediate
3.3199 +value of SUBI insn. */
3.3200 + BFD_RELOC_AVR_HH8_LDI_PM_NEG,
3.3201 +
3.3202 +/* This is a 32 bit reloc for the AVR that stores 23 bit value
3.3203 +into 22 bits. */
3.3204 + BFD_RELOC_AVR_CALL,
3.3205 +
3.3206 +/* This is a 16 bit reloc for the AVR that stores all needed bits
3.3207 +for absolute addressing with ldi with overflow check to linktime */
3.3208 + BFD_RELOC_AVR_LDI,
3.3209 +
3.3210 +/* This is a 6 bit reloc for the AVR that stores offset for ldd/std
3.3211 +instructions */
3.3212 + BFD_RELOC_AVR_6,
3.3213 +
3.3214 +/* This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw
3.3215 +instructions */
3.3216 + BFD_RELOC_AVR_6_ADIW,
3.3217 +
3.3218 +/* Direct 12 bit. */
3.3219 + BFD_RELOC_390_12,
3.3220 +
3.3221 +/* 12 bit GOT offset. */
3.3222 + BFD_RELOC_390_GOT12,
3.3223 +
3.3224 +/* 32 bit PC relative PLT address. */
3.3225 + BFD_RELOC_390_PLT32,
3.3226 +
3.3227 +/* Copy symbol at runtime. */
3.3228 + BFD_RELOC_390_COPY,
3.3229 +
3.3230 +/* Create GOT entry. */
3.3231 + BFD_RELOC_390_GLOB_DAT,
3.3232 +
3.3233 +/* Create PLT entry. */
3.3234 + BFD_RELOC_390_JMP_SLOT,
3.3235 +
3.3236 +/* Adjust by program base. */
3.3237 + BFD_RELOC_390_RELATIVE,
3.3238 +
3.3239 +/* 32 bit PC relative offset to GOT. */
3.3240 + BFD_RELOC_390_GOTPC,
3.3241 +
3.3242 +/* 16 bit GOT offset. */
3.3243 + BFD_RELOC_390_GOT16,
3.3244 +
3.3245 +/* PC relative 16 bit shifted by 1. */
3.3246 + BFD_RELOC_390_PC16DBL,
3.3247 +
3.3248 +/* 16 bit PC rel. PLT shifted by 1. */
3.3249 + BFD_RELOC_390_PLT16DBL,
3.3250 +
3.3251 +/* PC relative 32 bit shifted by 1. */
3.3252 + BFD_RELOC_390_PC32DBL,
3.3253 +
3.3254 +/* 32 bit PC rel. PLT shifted by 1. */
3.3255 + BFD_RELOC_390_PLT32DBL,
3.3256 +
3.3257 +/* 32 bit PC rel. GOT shifted by 1. */
3.3258 + BFD_RELOC_390_GOTPCDBL,
3.3259 +
3.3260 +/* 64 bit GOT offset. */
3.3261 + BFD_RELOC_390_GOT64,
3.3262 +
3.3263 +/* 64 bit PC relative PLT address. */
3.3264 + BFD_RELOC_390_PLT64,
3.3265 +
3.3266 +/* 32 bit rel. offset to GOT entry. */
3.3267 + BFD_RELOC_390_GOTENT,
3.3268 +
3.3269 +/* 64 bit offset to GOT. */
3.3270 + BFD_RELOC_390_GOTOFF64,
3.3271 +
3.3272 +/* 12-bit offset to symbol-entry within GOT, with PLT handling. */
3.3273 + BFD_RELOC_390_GOTPLT12,
3.3274 +
3.3275 +/* 16-bit offset to symbol-entry within GOT, with PLT handling. */
3.3276 + BFD_RELOC_390_GOTPLT16,
3.3277 +
3.3278 +/* 32-bit offset to symbol-entry within GOT, with PLT handling. */
3.3279 + BFD_RELOC_390_GOTPLT32,
3.3280 +
3.3281 +/* 64-bit offset to symbol-entry within GOT, with PLT handling. */
3.3282 + BFD_RELOC_390_GOTPLT64,
3.3283 +
3.3284 +/* 32-bit rel. offset to symbol-entry within GOT, with PLT handling. */
3.3285 + BFD_RELOC_390_GOTPLTENT,
3.3286 +
3.3287 +/* 16-bit rel. offset from the GOT to a PLT entry. */
3.3288 + BFD_RELOC_390_PLTOFF16,
3.3289 +
3.3290 +/* 32-bit rel. offset from the GOT to a PLT entry. */
3.3291 + BFD_RELOC_390_PLTOFF32,
3.3292 +
3.3293 +/* 64-bit rel. offset from the GOT to a PLT entry. */
3.3294 + BFD_RELOC_390_PLTOFF64,
3.3295 +
3.3296 +/* s390 tls relocations. */
3.3297 + BFD_RELOC_390_TLS_LOAD,
3.3298 + BFD_RELOC_390_TLS_GDCALL,
3.3299 + BFD_RELOC_390_TLS_LDCALL,
3.3300 + BFD_RELOC_390_TLS_GD32,
3.3301 + BFD_RELOC_390_TLS_GD64,
3.3302 + BFD_RELOC_390_TLS_GOTIE12,
3.3303 + BFD_RELOC_390_TLS_GOTIE32,
3.3304 + BFD_RELOC_390_TLS_GOTIE64,
3.3305 + BFD_RELOC_390_TLS_LDM32,
3.3306 + BFD_RELOC_390_TLS_LDM64,
3.3307 + BFD_RELOC_390_TLS_IE32,
3.3308 + BFD_RELOC_390_TLS_IE64,
3.3309 + BFD_RELOC_390_TLS_IEENT,
3.3310 + BFD_RELOC_390_TLS_LE32,
3.3311 + BFD_RELOC_390_TLS_LE64,
3.3312 + BFD_RELOC_390_TLS_LDO32,
3.3313 + BFD_RELOC_390_TLS_LDO64,
3.3314 + BFD_RELOC_390_TLS_DTPMOD,
3.3315 + BFD_RELOC_390_TLS_DTPOFF,
3.3316 + BFD_RELOC_390_TLS_TPOFF,
3.3317 +
3.3318 +/* Long displacement extension. */
3.3319 + BFD_RELOC_390_20,
3.3320 + BFD_RELOC_390_GOT20,
3.3321 + BFD_RELOC_390_GOTPLT20,
3.3322 + BFD_RELOC_390_TLS_GOTIE20,
3.3323 +
3.3324 +/* Scenix IP2K - 9-bit register number / data address */
3.3325 + BFD_RELOC_IP2K_FR9,
3.3326 +
3.3327 +/* Scenix IP2K - 4-bit register/data bank number */
3.3328 + BFD_RELOC_IP2K_BANK,
3.3329 +
3.3330 +/* Scenix IP2K - low 13 bits of instruction word address */
3.3331 + BFD_RELOC_IP2K_ADDR16CJP,
3.3332 +
3.3333 +/* Scenix IP2K - high 3 bits of instruction word address */
3.3334 + BFD_RELOC_IP2K_PAGE3,
3.3335 +
3.3336 +/* Scenix IP2K - ext/low/high 8 bits of data address */
3.3337 + BFD_RELOC_IP2K_LO8DATA,
3.3338 + BFD_RELOC_IP2K_HI8DATA,
3.3339 + BFD_RELOC_IP2K_EX8DATA,
3.3340 +
3.3341 +/* Scenix IP2K - low/high 8 bits of instruction word address */
3.3342 + BFD_RELOC_IP2K_LO8INSN,
3.3343 + BFD_RELOC_IP2K_HI8INSN,
3.3344 +
3.3345 +/* Scenix IP2K - even/odd PC modifier to modify snb pcl.0 */
3.3346 + BFD_RELOC_IP2K_PC_SKIP,
3.3347 +
3.3348 +/* Scenix IP2K - 16 bit word address in text section. */
3.3349 + BFD_RELOC_IP2K_TEXT,
3.3350 +
3.3351 +/* Scenix IP2K - 7-bit sp or dp offset */
3.3352 + BFD_RELOC_IP2K_FR_OFFSET,
3.3353 +
3.3354 +/* Scenix VPE4K coprocessor - data/insn-space addressing */
3.3355 + BFD_RELOC_VPE4KMATH_DATA,
3.3356 + BFD_RELOC_VPE4KMATH_INSN,
3.3357 +
3.3358 +/* These two relocations are used by the linker to determine which of
3.3359 +the entries in a C++ virtual function table are actually used. When
3.3360 +the --gc-sections option is given, the linker will zero out the entries
3.3361 +that are not used, so that the code for those functions need not be
3.3362 +included in the output.
3.3363 +
3.3364 +VTABLE_INHERIT is a zero-space relocation used to describe to the
3.3365 +linker the inheritance tree of a C++ virtual function table. The
3.3366 +relocation's symbol should be the parent class' vtable, and the
3.3367 +relocation should be located at the child vtable.
3.3368 +
3.3369 +VTABLE_ENTRY is a zero-space relocation that describes the use of a
3.3370 +virtual function table entry. The reloc's symbol should refer to the
3.3371 +table of the class mentioned in the code. Off of that base, an offset
3.3372 +describes the entry that is being used. For Rela hosts, this offset
3.3373 +is stored in the reloc's addend. For Rel hosts, we are forced to put
3.3374 +this offset in the reloc's section offset. */
3.3375 + BFD_RELOC_VTABLE_INHERIT,
3.3376 + BFD_RELOC_VTABLE_ENTRY,
3.3377 +
3.3378 +/* Intel IA64 Relocations. */
3.3379 + BFD_RELOC_IA64_IMM14,
3.3380 + BFD_RELOC_IA64_IMM22,
3.3381 + BFD_RELOC_IA64_IMM64,
3.3382 + BFD_RELOC_IA64_DIR32MSB,
3.3383 + BFD_RELOC_IA64_DIR32LSB,
3.3384 + BFD_RELOC_IA64_DIR64MSB,
3.3385 + BFD_RELOC_IA64_DIR64LSB,
3.3386 + BFD_RELOC_IA64_GPREL22,
3.3387 + BFD_RELOC_IA64_GPREL64I,
3.3388 + BFD_RELOC_IA64_GPREL32MSB,
3.3389 + BFD_RELOC_IA64_GPREL32LSB,
3.3390 + BFD_RELOC_IA64_GPREL64MSB,
3.3391 + BFD_RELOC_IA64_GPREL64LSB,
3.3392 + BFD_RELOC_IA64_LTOFF22,
3.3393 + BFD_RELOC_IA64_LTOFF64I,
3.3394 + BFD_RELOC_IA64_PLTOFF22,
3.3395 + BFD_RELOC_IA64_PLTOFF64I,
3.3396 + BFD_RELOC_IA64_PLTOFF64MSB,
3.3397 + BFD_RELOC_IA64_PLTOFF64LSB,
3.3398 + BFD_RELOC_IA64_FPTR64I,
3.3399 + BFD_RELOC_IA64_FPTR32MSB,
3.3400 + BFD_RELOC_IA64_FPTR32LSB,
3.3401 + BFD_RELOC_IA64_FPTR64MSB,
3.3402 + BFD_RELOC_IA64_FPTR64LSB,
3.3403 + BFD_RELOC_IA64_PCREL21B,
3.3404 + BFD_RELOC_IA64_PCREL21BI,
3.3405 + BFD_RELOC_IA64_PCREL21M,
3.3406 + BFD_RELOC_IA64_PCREL21F,
3.3407 + BFD_RELOC_IA64_PCREL22,
3.3408 + BFD_RELOC_IA64_PCREL60B,
3.3409 + BFD_RELOC_IA64_PCREL64I,
3.3410 + BFD_RELOC_IA64_PCREL32MSB,
3.3411 + BFD_RELOC_IA64_PCREL32LSB,
3.3412 + BFD_RELOC_IA64_PCREL64MSB,
3.3413 + BFD_RELOC_IA64_PCREL64LSB,
3.3414 + BFD_RELOC_IA64_LTOFF_FPTR22,
3.3415 + BFD_RELOC_IA64_LTOFF_FPTR64I,
3.3416 + BFD_RELOC_IA64_LTOFF_FPTR32MSB,
3.3417 + BFD_RELOC_IA64_LTOFF_FPTR32LSB,
3.3418 + BFD_RELOC_IA64_LTOFF_FPTR64MSB,
3.3419 + BFD_RELOC_IA64_LTOFF_FPTR64LSB,
3.3420 + BFD_RELOC_IA64_SEGREL32MSB,
3.3421 + BFD_RELOC_IA64_SEGREL32LSB,
3.3422 + BFD_RELOC_IA64_SEGREL64MSB,
3.3423 + BFD_RELOC_IA64_SEGREL64LSB,
3.3424 + BFD_RELOC_IA64_SECREL32MSB,
3.3425 + BFD_RELOC_IA64_SECREL32LSB,
3.3426 + BFD_RELOC_IA64_SECREL64MSB,
3.3427 + BFD_RELOC_IA64_SECREL64LSB,
3.3428 + BFD_RELOC_IA64_REL32MSB,
3.3429 + BFD_RELOC_IA64_REL32LSB,
3.3430 + BFD_RELOC_IA64_REL64MSB,
3.3431 + BFD_RELOC_IA64_REL64LSB,
3.3432 + BFD_RELOC_IA64_LTV32MSB,
3.3433 + BFD_RELOC_IA64_LTV32LSB,
3.3434 + BFD_RELOC_IA64_LTV64MSB,
3.3435 + BFD_RELOC_IA64_LTV64LSB,
3.3436 + BFD_RELOC_IA64_IPLTMSB,
3.3437 + BFD_RELOC_IA64_IPLTLSB,
3.3438 + BFD_RELOC_IA64_COPY,
3.3439 + BFD_RELOC_IA64_LTOFF22X,
3.3440 + BFD_RELOC_IA64_LDXMOV,
3.3441 + BFD_RELOC_IA64_TPREL14,
3.3442 + BFD_RELOC_IA64_TPREL22,
3.3443 + BFD_RELOC_IA64_TPREL64I,
3.3444 + BFD_RELOC_IA64_TPREL64MSB,
3.3445 + BFD_RELOC_IA64_TPREL64LSB,
3.3446 + BFD_RELOC_IA64_LTOFF_TPREL22,
3.3447 + BFD_RELOC_IA64_DTPMOD64MSB,
3.3448 + BFD_RELOC_IA64_DTPMOD64LSB,
3.3449 + BFD_RELOC_IA64_LTOFF_DTPMOD22,
3.3450 + BFD_RELOC_IA64_DTPREL14,
3.3451 + BFD_RELOC_IA64_DTPREL22,
3.3452 + BFD_RELOC_IA64_DTPREL64I,
3.3453 + BFD_RELOC_IA64_DTPREL32MSB,
3.3454 + BFD_RELOC_IA64_DTPREL32LSB,
3.3455 + BFD_RELOC_IA64_DTPREL64MSB,
3.3456 + BFD_RELOC_IA64_DTPREL64LSB,
3.3457 + BFD_RELOC_IA64_LTOFF_DTPREL22,
3.3458 +
3.3459 +/* Motorola 68HC11 reloc.
3.3460 +This is the 8 bit high part of an absolute address. */
3.3461 + BFD_RELOC_M68HC11_HI8,
3.3462 +
3.3463 +/* Motorola 68HC11 reloc.
3.3464 +This is the 8 bit low part of an absolute address. */
3.3465 + BFD_RELOC_M68HC11_LO8,
3.3466 +
3.3467 +/* Motorola 68HC11 reloc.
3.3468 +This is the 3 bit of a value. */
3.3469 + BFD_RELOC_M68HC11_3B,
3.3470 +
3.3471 +/* Motorola 68HC11 reloc.
3.3472 +This reloc marks the beginning of a jump/call instruction.
3.3473 +It is used for linker relaxation to correctly identify beginning
3.3474 +of instruction and change some branches to use PC-relative
3.3475 +addressing mode. */
3.3476 + BFD_RELOC_M68HC11_RL_JUMP,
3.3477 +
3.3478 +/* Motorola 68HC11 reloc.
3.3479 +This reloc marks a group of several instructions that gcc generates
3.3480 +and for which the linker relaxation pass can modify and/or remove
3.3481 +some of them. */
3.3482 + BFD_RELOC_M68HC11_RL_GROUP,
3.3483 +
3.3484 +/* Motorola 68HC11 reloc.
3.3485 +This is the 16-bit lower part of an address. It is used for 'call'
3.3486 +instruction to specify the symbol address without any special
3.3487 +transformation (due to memory bank window). */
3.3488 + BFD_RELOC_M68HC11_LO16,
3.3489 +
3.3490 +/* Motorola 68HC11 reloc.
3.3491 +This is a 8-bit reloc that specifies the page number of an address.
3.3492 +It is used by 'call' instruction to specify the page number of
3.3493 +the symbol. */
3.3494 + BFD_RELOC_M68HC11_PAGE,
3.3495 +
3.3496 +/* Motorola 68HC11 reloc.
3.3497 +This is a 24-bit reloc that represents the address with a 16-bit
3.3498 +value and a 8-bit page number. The symbol address is transformed
3.3499 +to follow the 16K memory bank of 68HC12 (seen as mapped in the window). */
3.3500 + BFD_RELOC_M68HC11_24,
3.3501 +
3.3502 +/* Motorola 68HC12 reloc.
3.3503 +This is the 5 bits of a value. */
3.3504 + BFD_RELOC_M68HC12_5B,
3.3505 +
3.3506 +/* NS CR16C Relocations. */
3.3507 + BFD_RELOC_16C_NUM08,
3.3508 + BFD_RELOC_16C_NUM08_C,
3.3509 + BFD_RELOC_16C_NUM16,
3.3510 + BFD_RELOC_16C_NUM16_C,
3.3511 + BFD_RELOC_16C_NUM32,
3.3512 + BFD_RELOC_16C_NUM32_C,
3.3513 + BFD_RELOC_16C_DISP04,
3.3514 + BFD_RELOC_16C_DISP04_C,
3.3515 + BFD_RELOC_16C_DISP08,
3.3516 + BFD_RELOC_16C_DISP08_C,
3.3517 + BFD_RELOC_16C_DISP16,
3.3518 + BFD_RELOC_16C_DISP16_C,
3.3519 + BFD_RELOC_16C_DISP24,
3.3520 + BFD_RELOC_16C_DISP24_C,
3.3521 + BFD_RELOC_16C_DISP24a,
3.3522 + BFD_RELOC_16C_DISP24a_C,
3.3523 + BFD_RELOC_16C_REG04,
3.3524 + BFD_RELOC_16C_REG04_C,
3.3525 + BFD_RELOC_16C_REG04a,
3.3526 + BFD_RELOC_16C_REG04a_C,
3.3527 + BFD_RELOC_16C_REG14,
3.3528 + BFD_RELOC_16C_REG14_C,
3.3529 + BFD_RELOC_16C_REG16,
3.3530 + BFD_RELOC_16C_REG16_C,
3.3531 + BFD_RELOC_16C_REG20,
3.3532 + BFD_RELOC_16C_REG20_C,
3.3533 + BFD_RELOC_16C_ABS20,
3.3534 + BFD_RELOC_16C_ABS20_C,
3.3535 + BFD_RELOC_16C_ABS24,
3.3536 + BFD_RELOC_16C_ABS24_C,
3.3537 + BFD_RELOC_16C_IMM04,
3.3538 + BFD_RELOC_16C_IMM04_C,
3.3539 + BFD_RELOC_16C_IMM16,
3.3540 + BFD_RELOC_16C_IMM16_C,
3.3541 + BFD_RELOC_16C_IMM20,
3.3542 + BFD_RELOC_16C_IMM20_C,
3.3543 + BFD_RELOC_16C_IMM24,
3.3544 + BFD_RELOC_16C_IMM24_C,
3.3545 + BFD_RELOC_16C_IMM32,
3.3546 + BFD_RELOC_16C_IMM32_C,
3.3547 +
3.3548 +/* NS CRX Relocations. */
3.3549 + BFD_RELOC_CRX_REL4,
3.3550 + BFD_RELOC_CRX_REL8,
3.3551 + BFD_RELOC_CRX_REL8_CMP,
3.3552 + BFD_RELOC_CRX_REL16,
3.3553 + BFD_RELOC_CRX_REL24,
3.3554 + BFD_RELOC_CRX_REL32,
3.3555 + BFD_RELOC_CRX_REGREL12,
3.3556 + BFD_RELOC_CRX_REGREL22,
3.3557 + BFD_RELOC_CRX_REGREL28,
3.3558 + BFD_RELOC_CRX_REGREL32,
3.3559 + BFD_RELOC_CRX_ABS16,
3.3560 + BFD_RELOC_CRX_ABS32,
3.3561 + BFD_RELOC_CRX_NUM8,
3.3562 + BFD_RELOC_CRX_NUM16,
3.3563 + BFD_RELOC_CRX_NUM32,
3.3564 + BFD_RELOC_CRX_IMM16,
3.3565 + BFD_RELOC_CRX_IMM32,
3.3566 + BFD_RELOC_CRX_SWITCH8,
3.3567 + BFD_RELOC_CRX_SWITCH16,
3.3568 + BFD_RELOC_CRX_SWITCH32,
3.3569 +
3.3570 +/* These relocs are only used within the CRIS assembler. They are not
3.3571 +(at present) written to any object files. */
3.3572 + BFD_RELOC_CRIS_BDISP8,
3.3573 + BFD_RELOC_CRIS_UNSIGNED_5,
3.3574 + BFD_RELOC_CRIS_SIGNED_6,
3.3575 + BFD_RELOC_CRIS_UNSIGNED_6,
3.3576 + BFD_RELOC_CRIS_SIGNED_8,
3.3577 + BFD_RELOC_CRIS_UNSIGNED_8,
3.3578 + BFD_RELOC_CRIS_SIGNED_16,
3.3579 + BFD_RELOC_CRIS_UNSIGNED_16,
3.3580 + BFD_RELOC_CRIS_LAPCQ_OFFSET,
3.3581 + BFD_RELOC_CRIS_UNSIGNED_4,
3.3582 +
3.3583 +/* Relocs used in ELF shared libraries for CRIS. */
3.3584 + BFD_RELOC_CRIS_COPY,
3.3585 + BFD_RELOC_CRIS_GLOB_DAT,
3.3586 + BFD_RELOC_CRIS_JUMP_SLOT,
3.3587 + BFD_RELOC_CRIS_RELATIVE,
3.3588 +
3.3589 +/* 32-bit offset to symbol-entry within GOT. */
3.3590 + BFD_RELOC_CRIS_32_GOT,
3.3591 +
3.3592 +/* 16-bit offset to symbol-entry within GOT. */
3.3593 + BFD_RELOC_CRIS_16_GOT,
3.3594 +
3.3595 +/* 32-bit offset to symbol-entry within GOT, with PLT handling. */
3.3596 + BFD_RELOC_CRIS_32_GOTPLT,
3.3597 +
3.3598 +/* 16-bit offset to symbol-entry within GOT, with PLT handling. */
3.3599 + BFD_RELOC_CRIS_16_GOTPLT,
3.3600 +
3.3601 +/* 32-bit offset to symbol, relative to GOT. */
3.3602 + BFD_RELOC_CRIS_32_GOTREL,
3.3603 +
3.3604 +/* 32-bit offset to symbol with PLT entry, relative to GOT. */
3.3605 + BFD_RELOC_CRIS_32_PLT_GOTREL,
3.3606 +
3.3607 +/* 32-bit offset to symbol with PLT entry, relative to this relocation. */
3.3608 + BFD_RELOC_CRIS_32_PLT_PCREL,
3.3609 +
3.3610 +/* Intel i860 Relocations. */
3.3611 + BFD_RELOC_860_COPY,
3.3612 + BFD_RELOC_860_GLOB_DAT,
3.3613 + BFD_RELOC_860_JUMP_SLOT,
3.3614 + BFD_RELOC_860_RELATIVE,
3.3615 + BFD_RELOC_860_PC26,
3.3616 + BFD_RELOC_860_PLT26,
3.3617 + BFD_RELOC_860_PC16,
3.3618 + BFD_RELOC_860_LOW0,
3.3619 + BFD_RELOC_860_SPLIT0,
3.3620 + BFD_RELOC_860_LOW1,
3.3621 + BFD_RELOC_860_SPLIT1,
3.3622 + BFD_RELOC_860_LOW2,
3.3623 + BFD_RELOC_860_SPLIT2,
3.3624 + BFD_RELOC_860_LOW3,
3.3625 + BFD_RELOC_860_LOGOT0,
3.3626 + BFD_RELOC_860_SPGOT0,
3.3627 + BFD_RELOC_860_LOGOT1,
3.3628 + BFD_RELOC_860_SPGOT1,
3.3629 + BFD_RELOC_860_LOGOTOFF0,
3.3630 + BFD_RELOC_860_SPGOTOFF0,
3.3631 + BFD_RELOC_860_LOGOTOFF1,
3.3632 + BFD_RELOC_860_SPGOTOFF1,
3.3633 + BFD_RELOC_860_LOGOTOFF2,
3.3634 + BFD_RELOC_860_LOGOTOFF3,
3.3635 + BFD_RELOC_860_LOPC,
3.3636 + BFD_RELOC_860_HIGHADJ,
3.3637 + BFD_RELOC_860_HAGOT,
3.3638 + BFD_RELOC_860_HAGOTOFF,
3.3639 + BFD_RELOC_860_HAPC,
3.3640 + BFD_RELOC_860_HIGH,
3.3641 + BFD_RELOC_860_HIGOT,
3.3642 + BFD_RELOC_860_HIGOTOFF,
3.3643 +
3.3644 +/* OpenRISC Relocations. */
3.3645 + BFD_RELOC_OPENRISC_ABS_26,
3.3646 + BFD_RELOC_OPENRISC_REL_26,
3.3647 +
3.3648 +/* H8 elf Relocations. */
3.3649 + BFD_RELOC_H8_DIR16A8,
3.3650 + BFD_RELOC_H8_DIR16R8,
3.3651 + BFD_RELOC_H8_DIR24A8,
3.3652 + BFD_RELOC_H8_DIR24R8,
3.3653 + BFD_RELOC_H8_DIR32A16,
3.3654 +
3.3655 +/* Sony Xstormy16 Relocations. */
3.3656 + BFD_RELOC_XSTORMY16_REL_12,
3.3657 + BFD_RELOC_XSTORMY16_12,
3.3658 + BFD_RELOC_XSTORMY16_24,
3.3659 + BFD_RELOC_XSTORMY16_FPTR16,
3.3660 +
3.3661 +/* Relocations used by VAX ELF. */
3.3662 + BFD_RELOC_VAX_GLOB_DAT,
3.3663 + BFD_RELOC_VAX_JMP_SLOT,
3.3664 + BFD_RELOC_VAX_RELATIVE,
3.3665 +
3.3666 +/* msp430 specific relocation codes */
3.3667 + BFD_RELOC_MSP430_10_PCREL,
3.3668 + BFD_RELOC_MSP430_16_PCREL,
3.3669 + BFD_RELOC_MSP430_16,
3.3670 + BFD_RELOC_MSP430_16_PCREL_BYTE,
3.3671 + BFD_RELOC_MSP430_16_BYTE,
3.3672 + BFD_RELOC_MSP430_2X_PCREL,
3.3673 + BFD_RELOC_MSP430_RL_PCREL,
3.3674 +
3.3675 +/* IQ2000 Relocations. */
3.3676 + BFD_RELOC_IQ2000_OFFSET_16,
3.3677 + BFD_RELOC_IQ2000_OFFSET_21,
3.3678 + BFD_RELOC_IQ2000_UHI16,
3.3679 +
3.3680 +/* Special Xtensa relocation used only by PLT entries in ELF shared
3.3681 +objects to indicate that the runtime linker should set the value
3.3682 +to one of its own internal functions or data structures. */
3.3683 + BFD_RELOC_XTENSA_RTLD,
3.3684 +
3.3685 +/* Xtensa relocations for ELF shared objects. */
3.3686 + BFD_RELOC_XTENSA_GLOB_DAT,
3.3687 + BFD_RELOC_XTENSA_JMP_SLOT,
3.3688 + BFD_RELOC_XTENSA_RELATIVE,
3.3689 +
3.3690 +/* Xtensa relocation used in ELF object files for symbols that may require
3.3691 +PLT entries. Otherwise, this is just a generic 32-bit relocation. */
3.3692 + BFD_RELOC_XTENSA_PLT,
3.3693 +
3.3694 +/* Xtensa relocations to mark the difference of two local symbols.
3.3695 +These are only needed to support linker relaxation and can be ignored
3.3696 +when not relaxing. The field is set to the value of the difference
3.3697 +assuming no relaxation. The relocation encodes the position of the
3.3698 +first symbol so the linker can determine whether to adjust the field
3.3699 +value. */
3.3700 + BFD_RELOC_XTENSA_DIFF8,
3.3701 + BFD_RELOC_XTENSA_DIFF16,
3.3702 + BFD_RELOC_XTENSA_DIFF32,
3.3703 +
3.3704 +/* Generic Xtensa relocations for instruction operands. Only the slot
3.3705 +number is encoded in the relocation. The relocation applies to the
3.3706 +last PC-relative immediate operand, or if there are no PC-relative
3.3707 +immediates, to the last immediate operand. */
3.3708 + BFD_RELOC_XTENSA_SLOT0_OP,
3.3709 + BFD_RELOC_XTENSA_SLOT1_OP,
3.3710 + BFD_RELOC_XTENSA_SLOT2_OP,
3.3711 + BFD_RELOC_XTENSA_SLOT3_OP,
3.3712 + BFD_RELOC_XTENSA_SLOT4_OP,
3.3713 + BFD_RELOC_XTENSA_SLOT5_OP,
3.3714 + BFD_RELOC_XTENSA_SLOT6_OP,
3.3715 + BFD_RELOC_XTENSA_SLOT7_OP,
3.3716 + BFD_RELOC_XTENSA_SLOT8_OP,
3.3717 + BFD_RELOC_XTENSA_SLOT9_OP,
3.3718 + BFD_RELOC_XTENSA_SLOT10_OP,
3.3719 + BFD_RELOC_XTENSA_SLOT11_OP,
3.3720 + BFD_RELOC_XTENSA_SLOT12_OP,
3.3721 + BFD_RELOC_XTENSA_SLOT13_OP,
3.3722 + BFD_RELOC_XTENSA_SLOT14_OP,
3.3723 +
3.3724 +/* Alternate Xtensa relocations. Only the slot is encoded in the
3.3725 +relocation. The meaning of these relocations is opcode-specific. */
3.3726 + BFD_RELOC_XTENSA_SLOT0_ALT,
3.3727 + BFD_RELOC_XTENSA_SLOT1_ALT,
3.3728 + BFD_RELOC_XTENSA_SLOT2_ALT,
3.3729 + BFD_RELOC_XTENSA_SLOT3_ALT,
3.3730 + BFD_RELOC_XTENSA_SLOT4_ALT,
3.3731 + BFD_RELOC_XTENSA_SLOT5_ALT,
3.3732 + BFD_RELOC_XTENSA_SLOT6_ALT,
3.3733 + BFD_RELOC_XTENSA_SLOT7_ALT,
3.3734 + BFD_RELOC_XTENSA_SLOT8_ALT,
3.3735 + BFD_RELOC_XTENSA_SLOT9_ALT,
3.3736 + BFD_RELOC_XTENSA_SLOT10_ALT,
3.3737 + BFD_RELOC_XTENSA_SLOT11_ALT,
3.3738 + BFD_RELOC_XTENSA_SLOT12_ALT,
3.3739 + BFD_RELOC_XTENSA_SLOT13_ALT,
3.3740 + BFD_RELOC_XTENSA_SLOT14_ALT,
3.3741 +
3.3742 +/* Xtensa relocations for backward compatibility. These have all been
3.3743 +replaced by BFD_RELOC_XTENSA_SLOT0_OP. */
3.3744 + BFD_RELOC_XTENSA_OP0,
3.3745 + BFD_RELOC_XTENSA_OP1,
3.3746 + BFD_RELOC_XTENSA_OP2,
3.3747 +
3.3748 +/* Xtensa relocation to mark that the assembler expanded the
3.3749 +instructions from an original target. The expansion size is
3.3750 +encoded in the reloc size. */
3.3751 + BFD_RELOC_XTENSA_ASM_EXPAND,
3.3752 +
3.3753 +/* Xtensa relocation to mark that the linker should simplify
3.3754 +assembler-expanded instructions. This is commonly used
3.3755 +internally by the linker after analysis of a
3.3756 +BFD_RELOC_XTENSA_ASM_EXPAND. */
3.3757 + BFD_RELOC_XTENSA_ASM_SIMPLIFY,
3.3758 + BFD_RELOC_UNUSED };
3.3759 +typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
3.3760 +reloc_howto_type *bfd_reloc_type_lookup
3.3761 + (bfd *abfd, bfd_reloc_code_real_type code);
3.3762 +
3.3763 +const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
3.3764 +
3.3765 +/* Extracted from syms.c. */
3.3766 +
3.3767 +typedef struct bfd_symbol
3.3768 +{
3.3769 + /* A pointer to the BFD which owns the symbol. This information
3.3770 + is necessary so that a back end can work out what additional
3.3771 + information (invisible to the application writer) is carried
3.3772 + with the symbol.
3.3773 +
3.3774 + This field is *almost* redundant, since you can use section->owner
3.3775 + instead, except that some symbols point to the global sections
3.3776 + bfd_{abs,com,und}_section. This could be fixed by making
3.3777 + these globals be per-bfd (or per-target-flavor). FIXME. */
3.3778 + struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */
3.3779 +
3.3780 + /* The text of the symbol. The name is left alone, and not copied; the
3.3781 + application may not alter it. */
3.3782 + const char *name;
3.3783 +
3.3784 + /* The value of the symbol. This really should be a union of a
3.3785 + numeric value with a pointer, since some flags indicate that
3.3786 + a pointer to another symbol is stored here. */
3.3787 + symvalue value;
3.3788 +
3.3789 + /* Attributes of a symbol. */
3.3790 +#define BSF_NO_FLAGS 0x00
3.3791 +
3.3792 + /* The symbol has local scope; <<static>> in <<C>>. The value
3.3793 + is the offset into the section of the data. */
3.3794 +#define BSF_LOCAL 0x01
3.3795 +
3.3796 + /* The symbol has global scope; initialized data in <<C>>. The
3.3797 + value is the offset into the section of the data. */
3.3798 +#define BSF_GLOBAL 0x02
3.3799 +
3.3800 + /* The symbol has global scope and is exported. The value is
3.3801 + the offset into the section of the data. */
3.3802 +#define BSF_EXPORT BSF_GLOBAL /* No real difference. */
3.3803 +
3.3804 + /* A normal C symbol would be one of:
3.3805 + <<BSF_LOCAL>>, <<BSF_FORT_COMM>>, <<BSF_UNDEFINED>> or
3.3806 + <<BSF_GLOBAL>>. */
3.3807 +
3.3808 + /* The symbol is a debugging record. The value has an arbitrary
3.3809 + meaning, unless BSF_DEBUGGING_RELOC is also set. */
3.3810 +#define BSF_DEBUGGING 0x08
3.3811 +
3.3812 + /* The symbol denotes a function entry point. Used in ELF,
3.3813 + perhaps others someday. */
3.3814 +#define BSF_FUNCTION 0x10
3.3815 +
3.3816 + /* Used by the linker. */
3.3817 +#define BSF_KEEP 0x20
3.3818 +#define BSF_KEEP_G 0x40
3.3819 +
3.3820 + /* A weak global symbol, overridable without warnings by
3.3821 + a regular global symbol of the same name. */
3.3822 +#define BSF_WEAK 0x80
3.3823 +
3.3824 + /* This symbol was created to point to a section, e.g. ELF's
3.3825 + STT_SECTION symbols. */
3.3826 +#define BSF_SECTION_SYM 0x100
3.3827 +
3.3828 + /* The symbol used to be a common symbol, but now it is
3.3829 + allocated. */
3.3830 +#define BSF_OLD_COMMON 0x200
3.3831 +
3.3832 + /* The default value for common data. */
3.3833 +#define BFD_FORT_COMM_DEFAULT_VALUE 0
3.3834 +
3.3835 + /* In some files the type of a symbol sometimes alters its
3.3836 + location in an output file - ie in coff a <<ISFCN>> symbol
3.3837 + which is also <<C_EXT>> symbol appears where it was
3.3838 + declared and not at the end of a section. This bit is set
3.3839 + by the target BFD part to convey this information. */
3.3840 +#define BSF_NOT_AT_END 0x400
3.3841 +
3.3842 + /* Signal that the symbol is the label of constructor section. */
3.3843 +#define BSF_CONSTRUCTOR 0x800
3.3844 +
3.3845 + /* Signal that the symbol is a warning symbol. The name is a
3.3846 + warning. The name of the next symbol is the one to warn about;
3.3847 + if a reference is made to a symbol with the same name as the next
3.3848 + symbol, a warning is issued by the linker. */
3.3849 +#define BSF_WARNING 0x1000
3.3850 +
3.3851 + /* Signal that the symbol is indirect. This symbol is an indirect
3.3852 + pointer to the symbol with the same name as the next symbol. */
3.3853 +#define BSF_INDIRECT 0x2000
3.3854 +
3.3855 + /* BSF_FILE marks symbols that contain a file name. This is used
3.3856 + for ELF STT_FILE symbols. */
3.3857 +#define BSF_FILE 0x4000
3.3858 +
3.3859 + /* Symbol is from dynamic linking information. */
3.3860 +#define BSF_DYNAMIC 0x8000
3.3861 +
3.3862 + /* The symbol denotes a data object. Used in ELF, and perhaps
3.3863 + others someday. */
3.3864 +#define BSF_OBJECT 0x10000
3.3865 +
3.3866 + /* This symbol is a debugging symbol. The value is the offset
3.3867 + into the section of the data. BSF_DEBUGGING should be set
3.3868 + as well. */
3.3869 +#define BSF_DEBUGGING_RELOC 0x20000
3.3870 +
3.3871 + /* This symbol is thread local. Used in ELF. */
3.3872 +#define BSF_THREAD_LOCAL 0x40000
3.3873 +
3.3874 + flagword flags;
3.3875 +
3.3876 + /* A pointer to the section to which this symbol is
3.3877 + relative. This will always be non NULL, there are special
3.3878 + sections for undefined and absolute symbols. */
3.3879 + struct bfd_section *section;
3.3880 +
3.3881 + /* Back end special data. */
3.3882 + union
3.3883 + {
3.3884 + void *p;
3.3885 + bfd_vma i;
3.3886 + }
3.3887 + udata;
3.3888 +}
3.3889 +asymbol;
3.3890 +
3.3891 +#define bfd_get_symtab_upper_bound(abfd) \
3.3892 + BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
3.3893 +
3.3894 +bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
3.3895 +
3.3896 +bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name);
3.3897 +
3.3898 +#define bfd_is_local_label_name(abfd, name) \
3.3899 + BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
3.3900 +
3.3901 +bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
3.3902 +
3.3903 +#define bfd_is_target_special_symbol(abfd, sym) \
3.3904 + BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
3.3905 +
3.3906 +#define bfd_canonicalize_symtab(abfd, location) \
3.3907 + BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
3.3908 +
3.3909 +bfd_boolean bfd_set_symtab
3.3910 + (bfd *abfd, asymbol **location, unsigned int count);
3.3911 +
3.3912 +void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
3.3913 +
3.3914 +#define bfd_make_empty_symbol(abfd) \
3.3915 + BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
3.3916 +
3.3917 +asymbol *_bfd_generic_make_empty_symbol (bfd *);
3.3918 +
3.3919 +#define bfd_make_debug_symbol(abfd,ptr,size) \
3.3920 + BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
3.3921 +
3.3922 +int bfd_decode_symclass (asymbol *symbol);
3.3923 +
3.3924 +bfd_boolean bfd_is_undefined_symclass (int symclass);
3.3925 +
3.3926 +void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
3.3927 +
3.3928 +bfd_boolean bfd_copy_private_symbol_data
3.3929 + (bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
3.3930 +
3.3931 +#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
3.3932 + BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
3.3933 + (ibfd, isymbol, obfd, osymbol))
3.3934 +
3.3935 +/* Extracted from bfd.c. */
3.3936 +struct bfd
3.3937 +{
3.3938 + /* A unique identifier of the BFD */
3.3939 + unsigned int id;
3.3940 +
3.3941 + /* The filename the application opened the BFD with. */
3.3942 + const char *filename;
3.3943 +
3.3944 + /* A pointer to the target jump table. */
3.3945 + const struct bfd_target *xvec;
3.3946 +
3.3947 + /* The IOSTREAM, and corresponding IO vector that provide access
3.3948 + to the file backing the BFD. */
3.3949 + void *iostream;
3.3950 + const struct bfd_iovec *iovec;
3.3951 +
3.3952 + /* Is the file descriptor being cached? That is, can it be closed as
3.3953 + needed, and re-opened when accessed later? */
3.3954 + bfd_boolean cacheable;
3.3955 +
3.3956 + /* Marks whether there was a default target specified when the
3.3957 + BFD was opened. This is used to select which matching algorithm
3.3958 + to use to choose the back end. */
3.3959 + bfd_boolean target_defaulted;
3.3960 +
3.3961 + /* The caching routines use these to maintain a
3.3962 + least-recently-used list of BFDs. */
3.3963 + struct bfd *lru_prev, *lru_next;
3.3964 +
3.3965 + /* When a file is closed by the caching routines, BFD retains
3.3966 + state information on the file here... */
3.3967 + ufile_ptr where;
3.3968 +
3.3969 + /* ... and here: (``once'' means at least once). */
3.3970 + bfd_boolean opened_once;
3.3971 +
3.3972 + /* Set if we have a locally maintained mtime value, rather than
3.3973 + getting it from the file each time. */
3.3974 + bfd_boolean mtime_set;
3.3975 +
3.3976 + /* File modified time, if mtime_set is TRUE. */
3.3977 + long mtime;
3.3978 +
3.3979 + /* Reserved for an unimplemented file locking extension. */
3.3980 + int ifd;
3.3981 +
3.3982 + /* The format which belongs to the BFD. (object, core, etc.) */
3.3983 + bfd_format format;
3.3984 +
3.3985 + /* The direction with which the BFD was opened. */
3.3986 + enum bfd_direction
3.3987 + {
3.3988 + no_direction = 0,
3.3989 + read_direction = 1,
3.3990 + write_direction = 2,
3.3991 + both_direction = 3
3.3992 + }
3.3993 + direction;
3.3994 +
3.3995 + /* Format_specific flags. */
3.3996 + flagword flags;
3.3997 +
3.3998 + /* Currently my_archive is tested before adding origin to
3.3999 + anything. I believe that this can become always an add of
3.4000 + origin, with origin set to 0 for non archive files. */
3.4001 + ufile_ptr origin;
3.4002 +
3.4003 + /* Remember when output has begun, to stop strange things
3.4004 + from happening. */
3.4005 + bfd_boolean output_has_begun;
3.4006 +
3.4007 + /* A hash table for section names. */
3.4008 + struct bfd_hash_table section_htab;
3.4009 +
3.4010 + /* Pointer to linked list of sections. */
3.4011 + struct bfd_section *sections;
3.4012 +
3.4013 + /* The place where we add to the section list. */
3.4014 + struct bfd_section **section_tail;
3.4015 +
3.4016 + /* The number of sections. */
3.4017 + unsigned int section_count;
3.4018 +
3.4019 + /* Stuff only useful for object files:
3.4020 + The start address. */
3.4021 + bfd_vma start_address;
3.4022 +
3.4023 + /* Used for input and output. */
3.4024 + unsigned int symcount;
3.4025 +
3.4026 + /* Symbol table for output BFD (with symcount entries). */
3.4027 + struct bfd_symbol **outsymbols;
3.4028 +
3.4029 + /* Used for slurped dynamic symbol tables. */
3.4030 + unsigned int dynsymcount;
3.4031 +
3.4032 + /* Pointer to structure which contains architecture information. */
3.4033 + const struct bfd_arch_info *arch_info;
3.4034 +
3.4035 + /* Flag set if symbols from this BFD should not be exported. */
3.4036 + bfd_boolean no_export;
3.4037 +
3.4038 + /* Stuff only useful for archives. */
3.4039 + void *arelt_data;
3.4040 + struct bfd *my_archive; /* The containing archive BFD. */
3.4041 + struct bfd *next; /* The next BFD in the archive. */
3.4042 + struct bfd *archive_head; /* The first BFD in the archive. */
3.4043 + bfd_boolean has_armap;
3.4044 +
3.4045 + /* A chain of BFD structures involved in a link. */
3.4046 + struct bfd *link_next;
3.4047 +
3.4048 + /* A field used by _bfd_generic_link_add_archive_symbols. This will
3.4049 + be used only for archive elements. */
3.4050 + int archive_pass;
3.4051 +
3.4052 + /* Used by the back end to hold private data. */
3.4053 + union
3.4054 + {
3.4055 + struct aout_data_struct *aout_data;
3.4056 + struct artdata *aout_ar_data;
3.4057 + struct _oasys_data *oasys_obj_data;
3.4058 + struct _oasys_ar_data *oasys_ar_data;
3.4059 + struct coff_tdata *coff_obj_data;
3.4060 + struct pe_tdata *pe_obj_data;
3.4061 + struct xcoff_tdata *xcoff_obj_data;
3.4062 + struct ecoff_tdata *ecoff_obj_data;
3.4063 + struct ieee_data_struct *ieee_data;
3.4064 + struct ieee_ar_data_struct *ieee_ar_data;
3.4065 + struct srec_data_struct *srec_data;
3.4066 + struct ihex_data_struct *ihex_data;
3.4067 + struct tekhex_data_struct *tekhex_data;
3.4068 + struct elf_obj_tdata *elf_obj_data;
3.4069 + struct nlm_obj_tdata *nlm_obj_data;
3.4070 + struct bout_data_struct *bout_data;
3.4071 + struct mmo_data_struct *mmo_data;
3.4072 + struct sun_core_struct *sun_core_data;
3.4073 + struct sco5_core_struct *sco5_core_data;
3.4074 + struct trad_core_struct *trad_core_data;
3.4075 + struct som_data_struct *som_data;
3.4076 + struct hpux_core_struct *hpux_core_data;
3.4077 + struct hppabsd_core_struct *hppabsd_core_data;
3.4078 + struct sgi_core_struct *sgi_core_data;
3.4079 + struct lynx_core_struct *lynx_core_data;
3.4080 + struct osf_core_struct *osf_core_data;
3.4081 + struct cisco_core_struct *cisco_core_data;
3.4082 + struct versados_data_struct *versados_data;
3.4083 + struct netbsd_core_struct *netbsd_core_data;
3.4084 + struct mach_o_data_struct *mach_o_data;
3.4085 + struct mach_o_fat_data_struct *mach_o_fat_data;
3.4086 + struct bfd_pef_data_struct *pef_data;
3.4087 + struct bfd_pef_xlib_data_struct *pef_xlib_data;
3.4088 + struct bfd_sym_data_struct *sym_data;
3.4089 + void *any;
3.4090 + }
3.4091 + tdata;
3.4092 +
3.4093 + /* Used by the application to hold private data. */
3.4094 + void *usrdata;
3.4095 +
3.4096 + /* Where all the allocated stuff under this BFD goes. This is a
3.4097 + struct objalloc *, but we use void * to avoid requiring the inclusion
3.4098 + of objalloc.h. */
3.4099 + void *memory;
3.4100 +};
3.4101 +
3.4102 +typedef enum bfd_error
3.4103 +{
3.4104 + bfd_error_no_error = 0,
3.4105 + bfd_error_system_call,
3.4106 + bfd_error_invalid_target,
3.4107 + bfd_error_wrong_format,
3.4108 + bfd_error_wrong_object_format,
3.4109 + bfd_error_invalid_operation,
3.4110 + bfd_error_no_memory,
3.4111 + bfd_error_no_symbols,
3.4112 + bfd_error_no_armap,
3.4113 + bfd_error_no_more_archived_files,
3.4114 + bfd_error_malformed_archive,
3.4115 + bfd_error_file_not_recognized,
3.4116 + bfd_error_file_ambiguously_recognized,
3.4117 + bfd_error_no_contents,
3.4118 + bfd_error_nonrepresentable_section,
3.4119 + bfd_error_no_debug_section,
3.4120 + bfd_error_bad_value,
3.4121 + bfd_error_file_truncated,
3.4122 + bfd_error_file_too_big,
3.4123 + bfd_error_invalid_error_code
3.4124 +}
3.4125 +bfd_error_type;
3.4126 +
3.4127 +bfd_error_type bfd_get_error (void);
3.4128 +
3.4129 +void bfd_set_error (bfd_error_type error_tag);
3.4130 +
3.4131 +const char *bfd_errmsg (bfd_error_type error_tag);
3.4132 +
3.4133 +void bfd_perror (const char *message);
3.4134 +
3.4135 +typedef void (*bfd_error_handler_type) (const char *, ...);
3.4136 +
3.4137 +bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type);
3.4138 +
3.4139 +void bfd_set_error_program_name (const char *);
3.4140 +
3.4141 +bfd_error_handler_type bfd_get_error_handler (void);
3.4142 +
3.4143 +long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect);
3.4144 +
3.4145 +long bfd_canonicalize_reloc
3.4146 + (bfd *abfd, asection *sec, arelent **loc, asymbol **syms);
3.4147 +
3.4148 +void bfd_set_reloc
3.4149 + (bfd *abfd, asection *sec, arelent **rel, unsigned int count);
3.4150 +
3.4151 +bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags);
3.4152 +
3.4153 +int bfd_get_arch_size (bfd *abfd);
3.4154 +
3.4155 +int bfd_get_sign_extend_vma (bfd *abfd);
3.4156 +
3.4157 +bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma);
3.4158 +
3.4159 +unsigned int bfd_get_gp_size (bfd *abfd);
3.4160 +
3.4161 +void bfd_set_gp_size (bfd *abfd, unsigned int i);
3.4162 +
3.4163 +bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
3.4164 +
3.4165 +bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
3.4166 +
3.4167 +#define bfd_copy_private_header_data(ibfd, obfd) \
3.4168 + BFD_SEND (obfd, _bfd_copy_private_header_data, \
3.4169 + (ibfd, obfd))
3.4170 +bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
3.4171 +
3.4172 +#define bfd_copy_private_bfd_data(ibfd, obfd) \
3.4173 + BFD_SEND (obfd, _bfd_copy_private_bfd_data, \
3.4174 + (ibfd, obfd))
3.4175 +bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd);
3.4176 +
3.4177 +#define bfd_merge_private_bfd_data(ibfd, obfd) \
3.4178 + BFD_SEND (obfd, _bfd_merge_private_bfd_data, \
3.4179 + (ibfd, obfd))
3.4180 +bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags);
3.4181 +
3.4182 +#define bfd_set_private_flags(abfd, flags) \
3.4183 + BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags))
3.4184 +#define bfd_sizeof_headers(abfd, reloc) \
3.4185 + BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc))
3.4186 +
3.4187 +#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \
3.4188 + BFD_SEND (abfd, _bfd_find_nearest_line, \
3.4189 + (abfd, sec, syms, off, file, func, line))
3.4190 +
3.4191 +#define bfd_debug_info_start(abfd) \
3.4192 + BFD_SEND (abfd, _bfd_debug_info_start, (abfd))
3.4193 +
3.4194 +#define bfd_debug_info_end(abfd) \
3.4195 + BFD_SEND (abfd, _bfd_debug_info_end, (abfd))
3.4196 +
3.4197 +#define bfd_debug_info_accumulate(abfd, section) \
3.4198 + BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section))
3.4199 +
3.4200 +#define bfd_stat_arch_elt(abfd, stat) \
3.4201 + BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat))
3.4202 +
3.4203 +#define bfd_update_armap_timestamp(abfd) \
3.4204 + BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd))
3.4205 +
3.4206 +#define bfd_set_arch_mach(abfd, arch, mach)\
3.4207 + BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach))
3.4208 +
3.4209 +#define bfd_relax_section(abfd, section, link_info, again) \
3.4210 + BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
3.4211 +
3.4212 +#define bfd_gc_sections(abfd, link_info) \
3.4213 + BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
3.4214 +
3.4215 +#define bfd_merge_sections(abfd, link_info) \
3.4216 + BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info))
3.4217 +
3.4218 +#define bfd_is_group_section(abfd, sec) \
3.4219 + BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
3.4220 +
3.4221 +#define bfd_discard_group(abfd, sec) \
3.4222 + BFD_SEND (abfd, _bfd_discard_group, (abfd, sec))
3.4223 +
3.4224 +#define bfd_link_hash_table_create(abfd) \
3.4225 + BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
3.4226 +
3.4227 +#define bfd_link_hash_table_free(abfd, hash) \
3.4228 + BFD_SEND (abfd, _bfd_link_hash_table_free, (hash))
3.4229 +
3.4230 +#define bfd_link_add_symbols(abfd, info) \
3.4231 + BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info))
3.4232 +
3.4233 +#define bfd_link_just_syms(abfd, sec, info) \
3.4234 + BFD_SEND (abfd, _bfd_link_just_syms, (sec, info))
3.4235 +
3.4236 +#define bfd_final_link(abfd, info) \
3.4237 + BFD_SEND (abfd, _bfd_final_link, (abfd, info))
3.4238 +
3.4239 +#define bfd_free_cached_info(abfd) \
3.4240 + BFD_SEND (abfd, _bfd_free_cached_info, (abfd))
3.4241 +
3.4242 +#define bfd_get_dynamic_symtab_upper_bound(abfd) \
3.4243 + BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd))
3.4244 +
3.4245 +#define bfd_print_private_bfd_data(abfd, file)\
3.4246 + BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file))
3.4247 +
3.4248 +#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \
3.4249 + BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols))
3.4250 +
3.4251 +#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \
3.4252 + BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \
3.4253 + dyncount, dynsyms, ret))
3.4254 +
3.4255 +#define bfd_get_dynamic_reloc_upper_bound(abfd) \
3.4256 + BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd))
3.4257 +
3.4258 +#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \
3.4259 + BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms))
3.4260 +
3.4261 +extern bfd_byte *bfd_get_relocated_section_contents
3.4262 + (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
3.4263 + bfd_boolean, asymbol **);
3.4264 +
3.4265 +bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative);
3.4266 +
3.4267 +struct bfd_preserve
3.4268 +{
3.4269 + void *marker;
3.4270 + void *tdata;
3.4271 + flagword flags;
3.4272 + const struct bfd_arch_info *arch_info;
3.4273 + struct bfd_section *sections;
3.4274 + struct bfd_section **section_tail;
3.4275 + unsigned int section_count;
3.4276 + struct bfd_hash_table section_htab;
3.4277 +};
3.4278 +
3.4279 +bfd_boolean bfd_preserve_save (bfd *, struct bfd_preserve *);
3.4280 +
3.4281 +void bfd_preserve_restore (bfd *, struct bfd_preserve *);
3.4282 +
3.4283 +void bfd_preserve_finish (bfd *, struct bfd_preserve *);
3.4284 +
3.4285 +/* Extracted from archive.c. */
3.4286 +symindex bfd_get_next_mapent
3.4287 + (bfd *abfd, symindex previous, carsym **sym);
3.4288 +
3.4289 +bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
3.4290 +
3.4291 +bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
3.4292 +
3.4293 +/* Extracted from corefile.c. */
3.4294 +const char *bfd_core_file_failing_command (bfd *abfd);
3.4295 +
3.4296 +int bfd_core_file_failing_signal (bfd *abfd);
3.4297 +
3.4298 +bfd_boolean core_file_matches_executable_p
3.4299 + (bfd *core_bfd, bfd *exec_bfd);
3.4300 +
3.4301 +/* Extracted from targets.c. */
3.4302 +#define BFD_SEND(bfd, message, arglist) \
3.4303 + ((*((bfd)->xvec->message)) arglist)
3.4304 +
3.4305 +#ifdef DEBUG_BFD_SEND
3.4306 +#undef BFD_SEND
3.4307 +#define BFD_SEND(bfd, message, arglist) \
3.4308 + (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
3.4309 + ((*((bfd)->xvec->message)) arglist) : \
3.4310 + (bfd_assert (__FILE__,__LINE__), NULL))
3.4311 +#endif
3.4312 +#define BFD_SEND_FMT(bfd, message, arglist) \
3.4313 + (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist)
3.4314 +
3.4315 +#ifdef DEBUG_BFD_SEND
3.4316 +#undef BFD_SEND_FMT
3.4317 +#define BFD_SEND_FMT(bfd, message, arglist) \
3.4318 + (((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \
3.4319 + (((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \
3.4320 + (bfd_assert (__FILE__,__LINE__), NULL))
3.4321 +#endif
3.4322 +
3.4323 +enum bfd_flavour
3.4324 +{
3.4325 + bfd_target_unknown_flavour,
3.4326 + bfd_target_aout_flavour,
3.4327 + bfd_target_coff_flavour,
3.4328 + bfd_target_ecoff_flavour,
3.4329 + bfd_target_xcoff_flavour,
3.4330 + bfd_target_elf_flavour,
3.4331 + bfd_target_ieee_flavour,
3.4332 + bfd_target_nlm_flavour,
3.4333 + bfd_target_oasys_flavour,
3.4334 + bfd_target_tekhex_flavour,
3.4335 + bfd_target_srec_flavour,
3.4336 + bfd_target_ihex_flavour,
3.4337 + bfd_target_som_flavour,
3.4338 + bfd_target_os9k_flavour,
3.4339 + bfd_target_versados_flavour,
3.4340 + bfd_target_msdos_flavour,
3.4341 + bfd_target_ovax_flavour,
3.4342 + bfd_target_evax_flavour,
3.4343 + bfd_target_mmo_flavour,
3.4344 + bfd_target_mach_o_flavour,
3.4345 + bfd_target_pef_flavour,
3.4346 + bfd_target_pef_xlib_flavour,
3.4347 + bfd_target_sym_flavour
3.4348 +};
3.4349 +
3.4350 +enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN };
3.4351 +
3.4352 +/* Forward declaration. */
3.4353 +typedef struct bfd_link_info _bfd_link_info;
3.4354 +
3.4355 +typedef struct bfd_target
3.4356 +{
3.4357 + /* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */
3.4358 + char *name;
3.4359 +
3.4360 + /* The "flavour" of a back end is a general indication about
3.4361 + the contents of a file. */
3.4362 + enum bfd_flavour flavour;
3.4363 +
3.4364 + /* The order of bytes within the data area of a file. */
3.4365 + enum bfd_endian byteorder;
3.4366 +
3.4367 + /* The order of bytes within the header parts of a file. */
3.4368 + enum bfd_endian header_byteorder;
3.4369 +
3.4370 + /* A mask of all the flags which an executable may have set -
3.4371 + from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>. */
3.4372 + flagword object_flags;
3.4373 +
3.4374 + /* A mask of all the flags which a section may have set - from
3.4375 + the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>. */
3.4376 + flagword section_flags;
3.4377 +
3.4378 + /* The character normally found at the front of a symbol.
3.4379 + (if any), perhaps `_'. */
3.4380 + char symbol_leading_char;
3.4381 +
3.4382 + /* The pad character for file names within an archive header. */
3.4383 + char ar_pad_char;
3.4384 +
3.4385 + /* The maximum number of characters in an archive header. */
3.4386 + unsigned short ar_max_namelen;
3.4387 +
3.4388 + /* Entries for byte swapping for data. These are different from the
3.4389 + other entry points, since they don't take a BFD as the first argument.
3.4390 + Certain other handlers could do the same. */
3.4391 + bfd_uint64_t (*bfd_getx64) (const void *);
3.4392 + bfd_int64_t (*bfd_getx_signed_64) (const void *);
3.4393 + void (*bfd_putx64) (bfd_uint64_t, void *);
3.4394 + bfd_vma (*bfd_getx32) (const void *);
3.4395 + bfd_signed_vma (*bfd_getx_signed_32) (const void *);
3.4396 + void (*bfd_putx32) (bfd_vma, void *);
3.4397 + bfd_vma (*bfd_getx16) (const void *);
3.4398 + bfd_signed_vma (*bfd_getx_signed_16) (const void *);
3.4399 + void (*bfd_putx16) (bfd_vma, void *);
3.4400 +
3.4401 + /* Byte swapping for the headers. */
3.4402 + bfd_uint64_t (*bfd_h_getx64) (const void *);
3.4403 + bfd_int64_t (*bfd_h_getx_signed_64) (const void *);
3.4404 + void (*bfd_h_putx64) (bfd_uint64_t, void *);
3.4405 + bfd_vma (*bfd_h_getx32) (const void *);
3.4406 + bfd_signed_vma (*bfd_h_getx_signed_32) (const void *);
3.4407 + void (*bfd_h_putx32) (bfd_vma, void *);
3.4408 + bfd_vma (*bfd_h_getx16) (const void *);
3.4409 + bfd_signed_vma (*bfd_h_getx_signed_16) (const void *);
3.4410 + void (*bfd_h_putx16) (bfd_vma, void *);
3.4411 +
3.4412 + /* Format dependent routines: these are vectors of entry points
3.4413 + within the target vector structure, one for each format to check. */
3.4414 +
3.4415 + /* Check the format of a file being read. Return a <<bfd_target *>> or zero. */
3.4416 + const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *);
3.4417 +
3.4418 + /* Set the format of a file being written. */
3.4419 + bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *);
3.4420 +
3.4421 + /* Write cached information into a file being written, at <<bfd_close>>. */
3.4422 + bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *);
3.4423 +
3.4424 +
3.4425 + /* Generic entry points. */
3.4426 +#define BFD_JUMP_TABLE_GENERIC(NAME) \
3.4427 + NAME##_close_and_cleanup, \
3.4428 + NAME##_bfd_free_cached_info, \
3.4429 + NAME##_new_section_hook, \
3.4430 + NAME##_get_section_contents, \
3.4431 + NAME##_get_section_contents_in_window
3.4432 +
3.4433 + /* Called when the BFD is being closed to do any necessary cleanup. */
3.4434 + bfd_boolean (*_close_and_cleanup) (bfd *);
3.4435 + /* Ask the BFD to free all cached information. */
3.4436 + bfd_boolean (*_bfd_free_cached_info) (bfd *);
3.4437 + /* Called when a new section is created. */
3.4438 + bfd_boolean (*_new_section_hook) (bfd *, sec_ptr);
3.4439 + /* Read the contents of a section. */
3.4440 + bfd_boolean (*_bfd_get_section_contents)
3.4441 + (bfd *, sec_ptr, void *, file_ptr, bfd_size_type);
3.4442 + bfd_boolean (*_bfd_get_section_contents_in_window)
3.4443 + (bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type);
3.4444 +
3.4445 + /* Entry points to copy private data. */
3.4446 +#define BFD_JUMP_TABLE_COPY(NAME) \
3.4447 + NAME##_bfd_copy_private_bfd_data, \
3.4448 + NAME##_bfd_merge_private_bfd_data, \
3.4449 + NAME##_bfd_copy_private_section_data, \
3.4450 + NAME##_bfd_copy_private_symbol_data, \
3.4451 + NAME##_bfd_copy_private_header_data, \
3.4452 + NAME##_bfd_set_private_flags, \
3.4453 + NAME##_bfd_print_private_bfd_data
3.4454 +
3.4455 + /* Called to copy BFD general private data from one object file
3.4456 + to another. */
3.4457 + bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
3.4458 + /* Called to merge BFD general private data from one object file
3.4459 + to a common output file when linking. */
3.4460 + bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
3.4461 + /* Called to copy BFD private section data from one object file
3.4462 + to another. */
3.4463 + bfd_boolean (*_bfd_copy_private_section_data)
3.4464 + (bfd *, sec_ptr, bfd *, sec_ptr);
3.4465 + /* Called to copy BFD private symbol data from one symbol
3.4466 + to another. */
3.4467 + bfd_boolean (*_bfd_copy_private_symbol_data)
3.4468 + (bfd *, asymbol *, bfd *, asymbol *);
3.4469 + /* Called to copy BFD private header data from one object file
3.4470 + to another. */
3.4471 + bfd_boolean (*_bfd_copy_private_header_data)
3.4472 + (bfd *, bfd *);
3.4473 + /* Called to set private backend flags. */
3.4474 + bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
3.4475 +
3.4476 + /* Called to print private BFD data. */
3.4477 + bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *);
3.4478 +
3.4479 + /* Core file entry points. */
3.4480 +#define BFD_JUMP_TABLE_CORE(NAME) \
3.4481 + NAME##_core_file_failing_command, \
3.4482 + NAME##_core_file_failing_signal, \
3.4483 + NAME##_core_file_matches_executable_p
3.4484 +
3.4485 + char * (*_core_file_failing_command) (bfd *);
3.4486 + int (*_core_file_failing_signal) (bfd *);
3.4487 + bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *);
3.4488 +
3.4489 + /* Archive entry points. */
3.4490 +#define BFD_JUMP_TABLE_ARCHIVE(NAME) \
3.4491 + NAME##_slurp_armap, \
3.4492 + NAME##_slurp_extended_name_table, \
3.4493 + NAME##_construct_extended_name_table, \
3.4494 + NAME##_truncate_arname, \
3.4495 + NAME##_write_armap, \
3.4496 + NAME##_read_ar_hdr, \
3.4497 + NAME##_openr_next_archived_file, \
3.4498 + NAME##_get_elt_at_index, \
3.4499 + NAME##_generic_stat_arch_elt, \
3.4500 + NAME##_update_armap_timestamp
3.4501 +
3.4502 + bfd_boolean (*_bfd_slurp_armap) (bfd *);
3.4503 + bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *);
3.4504 + bfd_boolean (*_bfd_construct_extended_name_table)
3.4505 + (bfd *, char **, bfd_size_type *, const char **);
3.4506 + void (*_bfd_truncate_arname) (bfd *, const char *, char *);
3.4507 + bfd_boolean (*write_armap)
3.4508 + (bfd *, unsigned int, struct orl *, unsigned int, int);
3.4509 + void * (*_bfd_read_ar_hdr_fn) (bfd *);
3.4510 + bfd * (*openr_next_archived_file) (bfd *, bfd *);
3.4511 +#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i))
3.4512 + bfd * (*_bfd_get_elt_at_index) (bfd *, symindex);
3.4513 + int (*_bfd_stat_arch_elt) (bfd *, struct stat *);
3.4514 + bfd_boolean (*_bfd_update_armap_timestamp) (bfd *);
3.4515 +
3.4516 + /* Entry points used for symbols. */
3.4517 +#define BFD_JUMP_TABLE_SYMBOLS(NAME) \
3.4518 + NAME##_get_symtab_upper_bound, \
3.4519 + NAME##_canonicalize_symtab, \
3.4520 + NAME##_make_empty_symbol, \
3.4521 + NAME##_print_symbol, \
3.4522 + NAME##_get_symbol_info, \
3.4523 + NAME##_bfd_is_local_label_name, \
3.4524 + NAME##_bfd_is_target_special_symbol, \
3.4525 + NAME##_get_lineno, \
3.4526 + NAME##_find_nearest_line, \
3.4527 + NAME##_bfd_make_debug_symbol, \
3.4528 + NAME##_read_minisymbols, \
3.4529 + NAME##_minisymbol_to_symbol
3.4530 +
3.4531 + long (*_bfd_get_symtab_upper_bound) (bfd *);
3.4532 + long (*_bfd_canonicalize_symtab)
3.4533 + (bfd *, struct bfd_symbol **);
3.4534 + struct bfd_symbol *
3.4535 + (*_bfd_make_empty_symbol) (bfd *);
3.4536 + void (*_bfd_print_symbol)
3.4537 + (bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type);
3.4538 +#define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e))
3.4539 + void (*_bfd_get_symbol_info)
3.4540 + (bfd *, struct bfd_symbol *, symbol_info *);
3.4541 +#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e))
3.4542 + bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *);
3.4543 + bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *);
3.4544 + alent * (*_get_lineno) (bfd *, struct bfd_symbol *);
3.4545 + bfd_boolean (*_bfd_find_nearest_line)
3.4546 + (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma,
3.4547 + const char **, const char **, unsigned int *);
3.4548 + /* Back-door to allow format-aware applications to create debug symbols
3.4549 + while using BFD for everything else. Currently used by the assembler
3.4550 + when creating COFF files. */
3.4551 + asymbol * (*_bfd_make_debug_symbol)
3.4552 + (bfd *, void *, unsigned long size);
3.4553 +#define bfd_read_minisymbols(b, d, m, s) \
3.4554 + BFD_SEND (b, _read_minisymbols, (b, d, m, s))
3.4555 + long (*_read_minisymbols)
3.4556 + (bfd *, bfd_boolean, void **, unsigned int *);
3.4557 +#define bfd_minisymbol_to_symbol(b, d, m, f) \
3.4558 + BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f))
3.4559 + asymbol * (*_minisymbol_to_symbol)
3.4560 + (bfd *, bfd_boolean, const void *, asymbol *);
3.4561 +
3.4562 + /* Routines for relocs. */
3.4563 +#define BFD_JUMP_TABLE_RELOCS(NAME) \
3.4564 + NAME##_get_reloc_upper_bound, \
3.4565 + NAME##_canonicalize_reloc, \
3.4566 + NAME##_bfd_reloc_type_lookup
3.4567 +
3.4568 + long (*_get_reloc_upper_bound) (bfd *, sec_ptr);
3.4569 + long (*_bfd_canonicalize_reloc)
3.4570 + (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
3.4571 + /* See documentation on reloc types. */
3.4572 + reloc_howto_type *
3.4573 + (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
3.4574 +
3.4575 + /* Routines used when writing an object file. */
3.4576 +#define BFD_JUMP_TABLE_WRITE(NAME) \
3.4577 + NAME##_set_arch_mach, \
3.4578 + NAME##_set_section_contents
3.4579 +
3.4580 + bfd_boolean (*_bfd_set_arch_mach)
3.4581 + (bfd *, enum bfd_architecture, unsigned long);
3.4582 + bfd_boolean (*_bfd_set_section_contents)
3.4583 + (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type);
3.4584 +
3.4585 + /* Routines used by the linker. */
3.4586 +#define BFD_JUMP_TABLE_LINK(NAME) \
3.4587 + NAME##_sizeof_headers, \
3.4588 + NAME##_bfd_get_relocated_section_contents, \
3.4589 + NAME##_bfd_relax_section, \
3.4590 + NAME##_bfd_link_hash_table_create, \
3.4591 + NAME##_bfd_link_hash_table_free, \
3.4592 + NAME##_bfd_link_add_symbols, \
3.4593 + NAME##_bfd_link_just_syms, \
3.4594 + NAME##_bfd_final_link, \
3.4595 + NAME##_bfd_link_split_section, \
3.4596 + NAME##_bfd_gc_sections, \
3.4597 + NAME##_bfd_merge_sections, \
3.4598 + NAME##_bfd_is_group_section, \
3.4599 + NAME##_bfd_discard_group, \
3.4600 + NAME##_section_already_linked \
3.4601 +
3.4602 + int (*_bfd_sizeof_headers) (bfd *, bfd_boolean);
3.4603 + bfd_byte * (*_bfd_get_relocated_section_contents)
3.4604 + (bfd *, struct bfd_link_info *, struct bfd_link_order *,
3.4605 + bfd_byte *, bfd_boolean, struct bfd_symbol **);
3.4606 +
3.4607 + bfd_boolean (*_bfd_relax_section)
3.4608 + (bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *);
3.4609 +
3.4610 + /* Create a hash table for the linker. Different backends store
3.4611 + different information in this table. */
3.4612 + struct bfd_link_hash_table *
3.4613 + (*_bfd_link_hash_table_create) (bfd *);
3.4614 +
3.4615 + /* Release the memory associated with the linker hash table. */
3.4616 + void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *);
3.4617 +
3.4618 + /* Add symbols from this object file into the hash table. */
3.4619 + bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *);
3.4620 +
3.4621 + /* Indicate that we are only retrieving symbol values from this section. */
3.4622 + void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *);
3.4623 +
3.4624 + /* Do a link based on the link_order structures attached to each
3.4625 + section of the BFD. */
3.4626 + bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *);
3.4627 +
3.4628 + /* Should this section be split up into smaller pieces during linking. */
3.4629 + bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
3.4630 +
3.4631 + /* Remove sections that are not referenced from the output. */
3.4632 + bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
3.4633 +
3.4634 + /* Attempt to merge SEC_MERGE sections. */
3.4635 + bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *);
3.4636 +
3.4637 + /* Is this section a member of a group? */
3.4638 + bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
3.4639 +
3.4640 + /* Discard members of a group. */
3.4641 + bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *);
3.4642 +
3.4643 + /* Check if SEC has been already linked during a reloceatable or
3.4644 + final link. */
3.4645 + void (*_section_already_linked) (bfd *, struct bfd_section *);
3.4646 +
3.4647 + /* Routines to handle dynamic symbols and relocs. */
3.4648 +#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
3.4649 + NAME##_get_dynamic_symtab_upper_bound, \
3.4650 + NAME##_canonicalize_dynamic_symtab, \
3.4651 + NAME##_get_synthetic_symtab, \
3.4652 + NAME##_get_dynamic_reloc_upper_bound, \
3.4653 + NAME##_canonicalize_dynamic_reloc
3.4654 +
3.4655 + /* Get the amount of memory required to hold the dynamic symbols. */
3.4656 + long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *);
3.4657 + /* Read in the dynamic symbols. */
3.4658 + long (*_bfd_canonicalize_dynamic_symtab)
3.4659 + (bfd *, struct bfd_symbol **);
3.4660 + /* Create synthetized symbols. */
3.4661 + long (*_bfd_get_synthetic_symtab)
3.4662 + (bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **,
3.4663 + struct bfd_symbol **);
3.4664 + /* Get the amount of memory required to hold the dynamic relocs. */
3.4665 + long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *);
3.4666 + /* Read in the dynamic relocs. */
3.4667 + long (*_bfd_canonicalize_dynamic_reloc)
3.4668 + (bfd *, arelent **, struct bfd_symbol **);
3.4669 +
3.4670 + /* Opposite endian version of this target. */
3.4671 + const struct bfd_target * alternative_target;
3.4672 +
3.4673 + /* Data for use by back-end routines, which isn't
3.4674 + generic enough to belong in this structure. */
3.4675 + const void *backend_data;
3.4676 +
3.4677 +} bfd_target;
3.4678 +
3.4679 +bfd_boolean bfd_set_default_target (const char *name);
3.4680 +
3.4681 +const bfd_target *bfd_find_target (const char *target_name, bfd *abfd);
3.4682 +
3.4683 +const char ** bfd_target_list (void);
3.4684 +
3.4685 +const bfd_target *bfd_search_for_target
3.4686 + (int (*search_func) (const bfd_target *, void *),
3.4687 + void *);
3.4688 +
3.4689 +/* Extracted from format.c. */
3.4690 +bfd_boolean bfd_check_format (bfd *abfd, bfd_format format);
3.4691 +
3.4692 +bfd_boolean bfd_check_format_matches
3.4693 + (bfd *abfd, bfd_format format, char ***matching);
3.4694 +
3.4695 +bfd_boolean bfd_set_format (bfd *abfd, bfd_format format);
3.4696 +
3.4697 +const char *bfd_format_string (bfd_format format);
3.4698 +
3.4699 +/* Extracted from linker.c. */
3.4700 +bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
3.4701 +
3.4702 +#define bfd_link_split_section(abfd, sec) \
3.4703 + BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
3.4704 +
3.4705 +void bfd_section_already_linked (bfd *abfd, asection *sec);
3.4706 +
3.4707 +#define bfd_section_already_linked(abfd, sec) \
3.4708 + BFD_SEND (abfd, _section_already_linked, (abfd, sec))
3.4709 +
3.4710 +/* Extracted from simple.c. */
3.4711 +bfd_byte *bfd_simple_get_relocated_section_contents
3.4712 + (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table);
3.4713 +
3.4714 +#ifdef __cplusplus
3.4715 +}
3.4716 +#endif
3.4717 +#endif
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/src/x86dasm/config.h Tue Aug 28 08:46:54 2007 +0000
4.3 @@ -0,0 +1,163 @@
4.4 +/* config.h. Generated by configure. */
4.5 +/* config.in. Generated from configure.in by autoheader. */
4.6 +
4.7 +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
4.8 + systems. This function is required for `alloca.c' support on those systems.
4.9 + */
4.10 +/* #undef CRAY_STACKSEG_END */
4.11 +
4.12 +/* Define to 1 if using `alloca.c'. */
4.13 +/* #undef C_ALLOCA */
4.14 +
4.15 +/* Define to 1 if NLS is requested */
4.16 +#define ENABLE_NLS 1
4.17 +
4.18 +/* Define to 1 if you have `alloca', as a function or macro. */
4.19 +#define HAVE_ALLOCA 1
4.20 +
4.21 +/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
4.22 + */
4.23 +#define HAVE_ALLOCA_H 1
4.24 +
4.25 +/* Define to 1 if you have the <argz.h> header file. */
4.26 +#define HAVE_ARGZ_H 1
4.27 +
4.28 +/* Define to 1 if you have the `dcgettext' function. */
4.29 +/* #undef HAVE_DCGETTEXT */
4.30 +
4.31 +/* Define to 1 if you have the `getcwd' function. */
4.32 +#define HAVE_GETCWD 1
4.33 +
4.34 +/* Define to 1 if you have the `getpagesize' function. */
4.35 +#define HAVE_GETPAGESIZE 1
4.36 +
4.37 +/* Define as 1 if you have gettext and don't want to use GNU gettext. */
4.38 +#define HAVE_GETTEXT 1
4.39 +
4.40 +/* Define to 1 if you have the <inttypes.h> header file. */
4.41 +#define HAVE_INTTYPES_H 1
4.42 +
4.43 +/* Define if your locale.h file contains LC_MESSAGES. */
4.44 +#define HAVE_LC_MESSAGES 1
4.45 +
4.46 +/* Define to 1 if you have the <limits.h> header file. */
4.47 +#define HAVE_LIMITS_H 1
4.48 +
4.49 +/* Define to 1 if you have the <locale.h> header file. */
4.50 +#define HAVE_LOCALE_H 1
4.51 +
4.52 +/* Define to 1 if you have the <malloc.h> header file. */
4.53 +#define HAVE_MALLOC_H 1
4.54 +
4.55 +/* Define to 1 if you have the <memory.h> header file. */
4.56 +#define HAVE_MEMORY_H 1
4.57 +
4.58 +/* Define to 1 if you have a working `mmap' system call. */
4.59 +#define HAVE_MMAP 1
4.60 +
4.61 +/* Define to 1 if you have the `munmap' function. */
4.62 +#define HAVE_MUNMAP 1
4.63 +
4.64 +/* Define to 1 if you have the <nl_types.h> header file. */
4.65 +#define HAVE_NL_TYPES_H 1
4.66 +
4.67 +/* Define to 1 if you have the `putenv' function. */
4.68 +#define HAVE_PUTENV 1
4.69 +
4.70 +/* Define to 1 if you have the `setenv' function. */
4.71 +#define HAVE_SETENV 1
4.72 +
4.73 +/* Define to 1 if you have the `setlocale' function. */
4.74 +#define HAVE_SETLOCALE 1
4.75 +
4.76 +/* Define to 1 if you have the <stdint.h> header file. */
4.77 +#define HAVE_STDINT_H 1
4.78 +
4.79 +/* Define to 1 if you have the <stdlib.h> header file. */
4.80 +#define HAVE_STDLIB_H 1
4.81 +
4.82 +/* Define if you have the stpcpy function */
4.83 +#define HAVE_STPCPY 1
4.84 +
4.85 +/* Define to 1 if you have the `strcasecmp' function. */
4.86 +#define HAVE_STRCASECMP 1
4.87 +
4.88 +/* Define to 1 if you have the `strchr' function. */
4.89 +#define HAVE_STRCHR 1
4.90 +
4.91 +/* Define to 1 if you have the <strings.h> header file. */
4.92 +#define HAVE_STRINGS_H 1
4.93 +
4.94 +/* Define to 1 if you have the <string.h> header file. */
4.95 +#define HAVE_STRING_H 1
4.96 +
4.97 +/* Define to 1 if you have the <sys/param.h> header file. */
4.98 +#define HAVE_SYS_PARAM_H 1
4.99 +
4.100 +/* Define to 1 if you have the <sys/stat.h> header file. */
4.101 +#define HAVE_SYS_STAT_H 1
4.102 +
4.103 +/* Define to 1 if you have the <sys/types.h> header file. */
4.104 +#define HAVE_SYS_TYPES_H 1
4.105 +
4.106 +/* Define to 1 if you have the <unistd.h> header file. */
4.107 +#define HAVE_UNISTD_H 1
4.108 +
4.109 +/* Define to 1 if you have the <values.h> header file. */
4.110 +#define HAVE_VALUES_H 1
4.111 +
4.112 +/* Define to 1 if you have the `__argz_count' function. */
4.113 +#define HAVE___ARGZ_COUNT 1
4.114 +
4.115 +/* Define to 1 if you have the `__argz_next' function. */
4.116 +#define HAVE___ARGZ_NEXT 1
4.117 +
4.118 +/* Define to 1 if you have the `__argz_stringify' function. */
4.119 +#define HAVE___ARGZ_STRINGIFY 1
4.120 +
4.121 +/* Name of package */
4.122 +#define PACKAGE "opcodes"
4.123 +
4.124 +/* Define to the address where bug reports for this package should be sent. */
4.125 +#define PACKAGE_BUGREPORT ""
4.126 +
4.127 +/* Define to the full name of this package. */
4.128 +#define PACKAGE_NAME ""
4.129 +
4.130 +/* Define to the full name and version of this package. */
4.131 +#define PACKAGE_STRING ""
4.132 +
4.133 +/* Define to the one symbol short name of this package. */
4.134 +#define PACKAGE_TARNAME ""
4.135 +
4.136 +/* Define to the version of this package. */
4.137 +#define PACKAGE_VERSION ""
4.138 +
4.139 +/* If using the C implementation of alloca, define if you know the
4.140 + direction of stack growth for your system; otherwise it will be
4.141 + automatically deduced at run-time.
4.142 + STACK_DIRECTION > 0 => grows toward higher addresses
4.143 + STACK_DIRECTION < 0 => grows toward lower addresses
4.144 + STACK_DIRECTION = 0 => direction of growth unknown */
4.145 +/* #undef STACK_DIRECTION */
4.146 +
4.147 +/* Define to 1 if you have the ANSI C header files. */
4.148 +#define STDC_HEADERS 1
4.149 +
4.150 +/* Version number of package */
4.151 +#define VERSION "2.16.1"
4.152 +
4.153 +/* Define to empty if `const' does not conform to ANSI C. */
4.154 +/* #undef const */
4.155 +
4.156 +/* Define to `__inline__' or `__inline' if that's what the C compiler
4.157 + calls it, or to nothing if 'inline' is not supported under any name. */
4.158 +#ifndef __cplusplus
4.159 +/* #undef inline */
4.160 +#endif
4.161 +
4.162 +/* Define to `long' if <sys/types.h> does not define. */
4.163 +/* #undef off_t */
4.164 +
4.165 +/* Define to `unsigned' if <sys/types.h> does not define. */
4.166 +/* #undef size_t */
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/src/x86dasm/dis-asm.h Tue Aug 28 08:46:54 2007 +0000
5.3 @@ -0,0 +1,333 @@
5.4 +/* Interface between the opcode library and its callers.
5.5 +
5.6 + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
5.7 + Free Software Foundation, Inc.
5.8 +
5.9 + This program is free software; you can redistribute it and/or modify
5.10 + it under the terms of the GNU General Public License as published by
5.11 + the Free Software Foundation; either version 2, or (at your option)
5.12 + any later version.
5.13 +
5.14 + This program is distributed in the hope that it will be useful,
5.15 + but WITHOUT ANY WARRANTY; without even the implied warranty of
5.16 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.17 + GNU General Public License for more details.
5.18 +
5.19 + You should have received a copy of the GNU General Public License
5.20 + along with this program; if not, write to the Free Software
5.21 + Foundation, Inc., 59 Temple Place - Suite 330,
5.22 + Boston, MA 02111-1307, USA.
5.23 +
5.24 + Written by Cygnus Support, 1993.
5.25 +
5.26 + The opcode library (libopcodes.a) provides instruction decoders for
5.27 + a large variety of instruction sets, callable with an identical
5.28 + interface, for making instruction-processing programs more independent
5.29 + of the instruction set being processed. */
5.30 +
5.31 +#ifndef DIS_ASM_H
5.32 +#define DIS_ASM_H
5.33 +
5.34 +#ifdef __cplusplus
5.35 +extern "C" {
5.36 +#endif
5.37 +
5.38 +#include <stdio.h>
5.39 +#include "bfd.h"
5.40 +
5.41 +typedef int (*fprintf_ftype) (void *, const char*, ...);
5.42 +
5.43 +enum dis_insn_type {
5.44 + dis_noninsn, /* Not a valid instruction */
5.45 + dis_nonbranch, /* Not a branch instruction */
5.46 + dis_branch, /* Unconditional branch */
5.47 + dis_condbranch, /* Conditional branch */
5.48 + dis_jsr, /* Jump to subroutine */
5.49 + dis_condjsr, /* Conditional jump to subroutine */
5.50 + dis_dref, /* Data reference instruction */
5.51 + dis_dref2 /* Two data references in instruction */
5.52 +};
5.53 +
5.54 +/* This struct is passed into the instruction decoding routine,
5.55 + and is passed back out into each callback. The various fields are used
5.56 + for conveying information from your main routine into your callbacks,
5.57 + for passing information into the instruction decoders (such as the
5.58 + addresses of the callback functions), or for passing information
5.59 + back from the instruction decoders to their callers.
5.60 +
5.61 + It must be initialized before it is first passed; this can be done
5.62 + by hand, or using one of the initialization macros below. */
5.63 +
5.64 +typedef struct disassemble_info {
5.65 + fprintf_ftype fprintf_func;
5.66 + void *stream;
5.67 + void *application_data;
5.68 +
5.69 + /* Target description. We could replace this with a pointer to the bfd,
5.70 + but that would require one. There currently isn't any such requirement
5.71 + so to avoid introducing one we record these explicitly. */
5.72 + /* The bfd_flavour. This can be bfd_target_unknown_flavour. */
5.73 + enum bfd_flavour flavour;
5.74 + /* The bfd_arch value. */
5.75 + enum bfd_architecture arch;
5.76 + /* The bfd_mach value. */
5.77 + unsigned long mach;
5.78 + /* Endianness (for bi-endian cpus). Mono-endian cpus can ignore this. */
5.79 + enum bfd_endian endian;
5.80 + /* An arch/mach-specific bitmask of selected instruction subsets, mainly
5.81 + for processors with run-time-switchable instruction sets. The default,
5.82 + zero, means that there is no constraint. CGEN-based opcodes ports
5.83 + may use ISA_foo masks. */
5.84 + unsigned long insn_sets;
5.85 +
5.86 + /* Some targets need information about the current section to accurately
5.87 + display insns. If this is NULL, the target disassembler function
5.88 + will have to make its best guess. */
5.89 + asection *section;
5.90 +
5.91 + /* An array of pointers to symbols either at the location being disassembled
5.92 + or at the start of the function being disassembled. The array is sorted
5.93 + so that the first symbol is intended to be the one used. The others are
5.94 + present for any misc. purposes. This is not set reliably, but if it is
5.95 + not NULL, it is correct. */
5.96 + asymbol **symbols;
5.97 + /* Number of symbols in array. */
5.98 + int num_symbols;
5.99 +
5.100 + /* For use by the disassembler.
5.101 + The top 16 bits are reserved for public use (and are documented here).
5.102 + The bottom 16 bits are for the internal use of the disassembler. */
5.103 + unsigned long flags;
5.104 +#define INSN_HAS_RELOC 0x80000000
5.105 + void *private_data;
5.106 +
5.107 + /* Function used to get bytes to disassemble. MEMADDR is the
5.108 + address of the stuff to be disassembled, MYADDR is the address to
5.109 + put the bytes in, and LENGTH is the number of bytes to read.
5.110 + INFO is a pointer to this struct.
5.111 + Returns an errno value or 0 for success. */
5.112 + int (*read_memory_func)
5.113 + (bfd_vma memaddr, bfd_byte *myaddr, unsigned int length,
5.114 + struct disassemble_info *info);
5.115 +
5.116 + /* Function which should be called if we get an error that we can't
5.117 + recover from. STATUS is the errno value from read_memory_func and
5.118 + MEMADDR is the address that we were trying to read. INFO is a
5.119 + pointer to this struct. */
5.120 + void (*memory_error_func)
5.121 + (int status, bfd_vma memaddr, struct disassemble_info *info);
5.122 +
5.123 + /* Function called to print ADDR. */
5.124 + void (*print_address_func)
5.125 + (bfd_vma addr, struct disassemble_info *info);
5.126 +
5.127 + /* Function called to determine if there is a symbol at the given ADDR.
5.128 + If there is, the function returns 1, otherwise it returns 0.
5.129 + This is used by ports which support an overlay manager where
5.130 + the overlay number is held in the top part of an address. In
5.131 + some circumstances we want to include the overlay number in the
5.132 + address, (normally because there is a symbol associated with
5.133 + that address), but sometimes we want to mask out the overlay bits. */
5.134 + int (* symbol_at_address_func)
5.135 + (bfd_vma addr, struct disassemble_info * info);
5.136 +
5.137 + /* Function called to check if a SYMBOL is can be displayed to the user.
5.138 + This is used by some ports that want to hide special symbols when
5.139 + displaying debugging outout. */
5.140 + bfd_boolean (* symbol_is_valid)
5.141 + (asymbol *, struct disassemble_info * info);
5.142 +
5.143 + /* These are for buffer_read_memory. */
5.144 + bfd_byte *buffer;
5.145 + bfd_vma buffer_vma;
5.146 + unsigned int buffer_length;
5.147 +
5.148 + /* This variable may be set by the instruction decoder. It suggests
5.149 + the number of bytes objdump should display on a single line. If
5.150 + the instruction decoder sets this, it should always set it to
5.151 + the same value in order to get reasonable looking output. */
5.152 + int bytes_per_line;
5.153 +
5.154 + /* The next two variables control the way objdump displays the raw data. */
5.155 + /* For example, if bytes_per_line is 8 and bytes_per_chunk is 4, the */
5.156 + /* output will look like this:
5.157 + 00: 00000000 00000000
5.158 + with the chunks displayed according to "display_endian". */
5.159 + int bytes_per_chunk;
5.160 + enum bfd_endian display_endian;
5.161 +
5.162 + /* Number of octets per incremented target address
5.163 + Normally one, but some DSPs have byte sizes of 16 or 32 bits. */
5.164 + unsigned int octets_per_byte;
5.165 +
5.166 + /* The number of zeroes we want to see at the end of a section before we
5.167 + start skipping them. */
5.168 + unsigned int skip_zeroes;
5.169 +
5.170 + /* The number of zeroes to skip at the end of a section. If the number
5.171 + of zeroes at the end is between SKIP_ZEROES_AT_END and SKIP_ZEROES,
5.172 + they will be disassembled. If there are fewer than
5.173 + SKIP_ZEROES_AT_END, they will be skipped. This is a heuristic
5.174 + attempt to avoid disassembling zeroes inserted by section
5.175 + alignment. */
5.176 + unsigned int skip_zeroes_at_end;
5.177 +
5.178 + /* Results from instruction decoders. Not all decoders yet support
5.179 + this information. This info is set each time an instruction is
5.180 + decoded, and is only valid for the last such instruction.
5.181 +
5.182 + To determine whether this decoder supports this information, set
5.183 + insn_info_valid to 0, decode an instruction, then check it. */
5.184 +
5.185 + char insn_info_valid; /* Branch info has been set. */
5.186 + char branch_delay_insns; /* How many sequential insn's will run before
5.187 + a branch takes effect. (0 = normal) */
5.188 + char data_size; /* Size of data reference in insn, in bytes */
5.189 + enum dis_insn_type insn_type; /* Type of instruction */
5.190 + bfd_vma target; /* Target address of branch or dref, if known;
5.191 + zero if unknown. */
5.192 + bfd_vma target2; /* Second target address for dref2 */
5.193 +
5.194 + /* Command line options specific to the target disassembler. */
5.195 + char * disassembler_options;
5.196 +
5.197 +} disassemble_info;
5.198 +
5.199 +
5.200 +/* Standard disassemblers. Disassemble one instruction at the given
5.201 + target address. Return number of octets processed. */
5.202 +typedef int (*disassembler_ftype) (bfd_vma, disassemble_info *);
5.203 +
5.204 +extern int print_insn_big_mips (bfd_vma, disassemble_info *);
5.205 +extern int print_insn_little_mips (bfd_vma, disassemble_info *);
5.206 +extern int print_insn_i386 (bfd_vma, disassemble_info *);
5.207 +extern int print_insn_i386_att (bfd_vma, disassemble_info *);
5.208 +extern int print_insn_i386_intel (bfd_vma, disassemble_info *);
5.209 +extern int print_insn_ia64 (bfd_vma, disassemble_info *);
5.210 +extern int print_insn_i370 (bfd_vma, disassemble_info *);
5.211 +extern int print_insn_m68hc11 (bfd_vma, disassemble_info *);
5.212 +extern int print_insn_m68hc12 (bfd_vma, disassemble_info *);
5.213 +extern int print_insn_m68k (bfd_vma, disassemble_info *);
5.214 +extern int print_insn_z8001 (bfd_vma, disassemble_info *);
5.215 +extern int print_insn_z8002 (bfd_vma, disassemble_info *);
5.216 +extern int print_insn_h8300 (bfd_vma, disassemble_info *);
5.217 +extern int print_insn_h8300h (bfd_vma, disassemble_info *);
5.218 +extern int print_insn_h8300s (bfd_vma, disassemble_info *);
5.219 +extern int print_insn_h8500 (bfd_vma, disassemble_info *);
5.220 +extern int print_insn_alpha (bfd_vma, disassemble_info *);
5.221 +extern int print_insn_big_arm (bfd_vma, disassemble_info *);
5.222 +extern int print_insn_little_arm (bfd_vma, disassemble_info *);
5.223 +extern int print_insn_sparc (bfd_vma, disassemble_info *);
5.224 +extern int print_insn_big_a29k (bfd_vma, disassemble_info *);
5.225 +extern int print_insn_little_a29k (bfd_vma, disassemble_info *);
5.226 +extern int print_insn_avr (bfd_vma, disassemble_info *);
5.227 +extern int print_insn_d10v (bfd_vma, disassemble_info *);
5.228 +extern int print_insn_d30v (bfd_vma, disassemble_info *);
5.229 +extern int print_insn_dlx (bfd_vma, disassemble_info *);
5.230 +extern int print_insn_fr30 (bfd_vma, disassemble_info *);
5.231 +extern int print_insn_hppa (bfd_vma, disassemble_info *);
5.232 +extern int print_insn_i860 (bfd_vma, disassemble_info *);
5.233 +extern int print_insn_i960 (bfd_vma, disassemble_info *);
5.234 +extern int print_insn_ip2k (bfd_vma, disassemble_info *);
5.235 +extern int print_insn_m32r (bfd_vma, disassemble_info *);
5.236 +extern int print_insn_m88k (bfd_vma, disassemble_info *);
5.237 +extern int print_insn_maxq_little (bfd_vma, disassemble_info *);
5.238 +extern int print_insn_maxq_big (bfd_vma, disassemble_info *);
5.239 +extern int print_insn_mcore (bfd_vma, disassemble_info *);
5.240 +extern int print_insn_mmix (bfd_vma, disassemble_info *);
5.241 +extern int print_insn_mn10200 (bfd_vma, disassemble_info *);
5.242 +extern int print_insn_mn10300 (bfd_vma, disassemble_info *);
5.243 +extern int print_insn_msp430 (bfd_vma, disassemble_info *);
5.244 +extern int print_insn_ns32k (bfd_vma, disassemble_info *);
5.245 +extern int print_insn_crx (bfd_vma, disassemble_info *);
5.246 +extern int print_insn_openrisc (bfd_vma, disassemble_info *);
5.247 +extern int print_insn_big_or32 (bfd_vma, disassemble_info *);
5.248 +extern int print_insn_little_or32 (bfd_vma, disassemble_info *);
5.249 +extern int print_insn_pdp11 (bfd_vma, disassemble_info *);
5.250 +extern int print_insn_pj (bfd_vma, disassemble_info *);
5.251 +extern int print_insn_big_powerpc (bfd_vma, disassemble_info *);
5.252 +extern int print_insn_little_powerpc (bfd_vma, disassemble_info *);
5.253 +extern int print_insn_rs6000 (bfd_vma, disassemble_info *);
5.254 +extern int print_insn_s390 (bfd_vma, disassemble_info *);
5.255 +extern int print_insn_sh (bfd_vma, disassemble_info *);
5.256 +extern int print_insn_tic30 (bfd_vma, disassemble_info *);
5.257 +extern int print_insn_tic4x (bfd_vma, disassemble_info *);
5.258 +extern int print_insn_tic54x (bfd_vma, disassemble_info *);
5.259 +extern int print_insn_tic80 (bfd_vma, disassemble_info *);
5.260 +extern int print_insn_v850 (bfd_vma, disassemble_info *);
5.261 +extern int print_insn_vax (bfd_vma, disassemble_info *);
5.262 +extern int print_insn_w65 (bfd_vma, disassemble_info *);
5.263 +extern int print_insn_xstormy16 (bfd_vma, disassemble_info *);
5.264 +extern int print_insn_xtensa (bfd_vma, disassemble_info *);
5.265 +extern int print_insn_sh64 (bfd_vma, disassemble_info *);
5.266 +extern int print_insn_sh64x_media (bfd_vma, disassemble_info *);
5.267 +extern int print_insn_frv (bfd_vma, disassemble_info *);
5.268 +extern int print_insn_iq2000 (bfd_vma, disassemble_info *);
5.269 +
5.270 +extern disassembler_ftype arc_get_disassembler (void *);
5.271 +extern disassembler_ftype cris_get_disassembler (bfd *);
5.272 +
5.273 +extern void print_mips_disassembler_options (FILE *);
5.274 +extern void print_ppc_disassembler_options (FILE *);
5.275 +extern void print_arm_disassembler_options (FILE *);
5.276 +extern void parse_arm_disassembler_option (char *);
5.277 +extern int get_arm_regname_num_options (void);
5.278 +extern int set_arm_regname_option (int);
5.279 +extern int get_arm_regnames (int, const char **, const char **, const char ***);
5.280 +extern bfd_boolean arm_symbol_is_valid (asymbol *, struct disassemble_info *);
5.281 +
5.282 +/* Fetch the disassembler for a given BFD, if that support is available. */
5.283 +extern disassembler_ftype disassembler (bfd *);
5.284 +
5.285 +/* Amend the disassemble_info structure as necessary for the target architecture.
5.286 + Should only be called after initialising the info->arch field. */
5.287 +extern void disassemble_init_for_target (struct disassemble_info * info);
5.288 +
5.289 +/* Document any target specific options available from the disassembler. */
5.290 +extern void disassembler_usage (FILE *);
5.291 +
5.292 +
5.293 +/* This block of definitions is for particular callers who read instructions
5.294 + into a buffer before calling the instruction decoder. */
5.295 +
5.296 +/* Here is a function which callers may wish to use for read_memory_func.
5.297 + It gets bytes from a buffer. */
5.298 +extern int buffer_read_memory
5.299 + (bfd_vma, bfd_byte *, unsigned int, struct disassemble_info *);
5.300 +
5.301 +/* This function goes with buffer_read_memory.
5.302 + It prints a message using info->fprintf_func and info->stream. */
5.303 +extern void perror_memory (int, bfd_vma, struct disassemble_info *);
5.304 +
5.305 +
5.306 +/* Just print the address in hex. This is included for completeness even
5.307 + though both GDB and objdump provide their own (to print symbolic
5.308 + addresses). */
5.309 +extern void generic_print_address
5.310 + (bfd_vma, struct disassemble_info *);
5.311 +
5.312 +/* Always true. */
5.313 +extern int generic_symbol_at_address
5.314 + (bfd_vma, struct disassemble_info *);
5.315 +
5.316 +/* Also always true. */
5.317 +extern bfd_boolean generic_symbol_is_valid
5.318 + (asymbol *, struct disassemble_info *);
5.319 +
5.320 +/* Method to initialize a disassemble_info struct. This should be
5.321 + called by all applications creating such a struct. */
5.322 +extern void init_disassemble_info (struct disassemble_info *info, void *stream,
5.323 + fprintf_ftype fprintf_func);
5.324 +
5.325 +/* For compatibility with existing code. */
5.326 +#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \
5.327 + init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC))
5.328 +#define INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC) \
5.329 + init_disassemble_info (&(INFO), (STREAM), (fprintf_ftype) (FPRINTF_FUNC))
5.330 +
5.331 +
5.332 +#ifdef __cplusplus
5.333 +}
5.334 +#endif
5.335 +
5.336 +#endif /* ! defined (DIS_ASM_H) */
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/src/x86dasm/dis-buf.c Tue Aug 28 08:46:54 2007 +0000
6.3 @@ -0,0 +1,132 @@
6.4 +/* Disassemble from a buffer, for GNU.
6.5 + Copyright 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2005
6.6 + Free Software Foundation, Inc.
6.7 +
6.8 +This program is free software; you can redistribute it and/or modify
6.9 +it under the terms of the GNU General Public License as published by
6.10 +the Free Software Foundation; either version 2 of the License, or
6.11 +(at your option) any later version.
6.12 +
6.13 +This program is distributed in the hope that it will be useful,
6.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of
6.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6.16 +GNU General Public License for more details.
6.17 +
6.18 +You should have received a copy of the GNU General Public License
6.19 +along with this program; if not, write to the Free Software
6.20 +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
6.21 +
6.22 +#include "sysdep.h"
6.23 +#include "dis-asm.h"
6.24 +#include <errno.h>
6.25 +#include "opintl.h"
6.26 +
6.27 +/* Get LENGTH bytes from info's buffer, at target address memaddr.
6.28 + Transfer them to myaddr. */
6.29 +int
6.30 +buffer_read_memory (memaddr, myaddr, length, info)
6.31 + bfd_vma memaddr;
6.32 + bfd_byte *myaddr;
6.33 + unsigned int length;
6.34 + struct disassemble_info *info;
6.35 +{
6.36 + unsigned int opb = info->octets_per_byte;
6.37 + unsigned int end_addr_offset = length / opb;
6.38 + unsigned int max_addr_offset = info->buffer_length / opb;
6.39 + unsigned int octets = (memaddr - info->buffer_vma) * opb;
6.40 +
6.41 + if (memaddr < info->buffer_vma
6.42 + || memaddr - info->buffer_vma + end_addr_offset > max_addr_offset)
6.43 + /* Out of bounds. Use EIO because GDB uses it. */
6.44 + return EIO;
6.45 + memcpy (myaddr, info->buffer + octets, length);
6.46 +
6.47 + return 0;
6.48 +}
6.49 +
6.50 +/* Print an error message. We can assume that this is in response to
6.51 + an error return from buffer_read_memory. */
6.52 +void
6.53 +perror_memory (status, memaddr, info)
6.54 + int status;
6.55 + bfd_vma memaddr;
6.56 + struct disassemble_info *info;
6.57 +{
6.58 + if (status != EIO)
6.59 + /* Can't happen. */
6.60 + info->fprintf_func (info->stream, _("Unknown error %d\n"), status);
6.61 + else
6.62 + {
6.63 + char buf[30];
6.64 +
6.65 + /* Actually, address between memaddr and memaddr + len was
6.66 + out of bounds. */
6.67 + sprintf_vma (buf, memaddr);
6.68 + info->fprintf_func (info->stream,
6.69 + _("Address 0x%s is out of bounds.\n"), buf);
6.70 + }
6.71 +}
6.72 +
6.73 +/* This could be in a separate file, to save miniscule amounts of space
6.74 + in statically linked executables. */
6.75 +
6.76 +/* Just print the address is hex. This is included for completeness even
6.77 + though both GDB and objdump provide their own (to print symbolic
6.78 + addresses). */
6.79 +
6.80 +void
6.81 +generic_print_address (addr, info)
6.82 + bfd_vma addr;
6.83 + struct disassemble_info *info;
6.84 +{
6.85 + char buf[30];
6.86 +
6.87 + sprintf_vma (buf, addr);
6.88 + (*info->fprintf_func) (info->stream, "0x%s", buf);
6.89 +}
6.90 +
6.91 +#if 0
6.92 +/* Just concatenate the address as hex. This is included for
6.93 + completeness even though both GDB and objdump provide their own (to
6.94 + print symbolic addresses). */
6.95 +
6.96 +void generic_strcat_address PARAMS ((bfd_vma, char *, int));
6.97 +
6.98 +void
6.99 +generic_strcat_address (addr, buf, len)
6.100 + bfd_vma addr;
6.101 + char *buf;
6.102 + int len;
6.103 +{
6.104 + if (buf != (char *)NULL && len > 0)
6.105 + {
6.106 + char tmpBuf[30];
6.107 +
6.108 + sprintf_vma (tmpBuf, addr);
6.109 + if ((strlen (buf) + strlen (tmpBuf)) <= (unsigned int) len)
6.110 + strcat (buf, tmpBuf);
6.111 + else
6.112 + strncat (buf, tmpBuf, (len - strlen(buf)));
6.113 + }
6.114 + return;
6.115 +}
6.116 +#endif
6.117 +
6.118 +/* Just return true. */
6.119 +
6.120 +int
6.121 +generic_symbol_at_address (addr, info)
6.122 + bfd_vma addr ATTRIBUTE_UNUSED;
6.123 + struct disassemble_info *info ATTRIBUTE_UNUSED;
6.124 +{
6.125 + return 1;
6.126 +}
6.127 +
6.128 +/* Just return TRUE. */
6.129 +
6.130 +bfd_boolean
6.131 +generic_symbol_is_valid (asymbol * sym ATTRIBUTE_UNUSED,
6.132 + struct disassemble_info *info ATTRIBUTE_UNUSED)
6.133 +{
6.134 + return TRUE;
6.135 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/src/x86dasm/dis-init.c Tue Aug 28 08:46:54 2007 +0000
7.3 @@ -0,0 +1,43 @@
7.4 +/* Initialize "struct disassemble_info".
7.5 +
7.6 + Copyright 2003 Free Software Foundation, Inc.
7.7 +
7.8 + This program is free software; you can redistribute it and/or
7.9 + modify it under the terms of the GNU General Public License as
7.10 + published by the Free Software Foundation; either version 2 of the
7.11 + License, or (at your option) any later version.
7.12 +
7.13 + This program is distributed in the hope that it will be useful, but
7.14 + WITHOUT ANY WARRANTY; without even the implied warranty of
7.15 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7.16 + General Public License for more details.
7.17 +
7.18 + You should have received a copy of the GNU General Public License
7.19 + along with this program; if not, write to the Free Software
7.20 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
7.21 + 02111-1307, USA. */
7.22 +
7.23 +#include "sysdep.h"
7.24 +#include "dis-asm.h"
7.25 +#include "bfd.h"
7.26 +
7.27 +void
7.28 +init_disassemble_info (struct disassemble_info *info, void *stream,
7.29 + fprintf_ftype fprintf_func)
7.30 +{
7.31 + memset (info, 0, sizeof (*info));
7.32 +
7.33 + info->flavour = bfd_target_unknown_flavour;
7.34 + info->arch = bfd_arch_unknown;
7.35 + info->endian = BFD_ENDIAN_UNKNOWN;
7.36 + info->octets_per_byte = 1;
7.37 + info->fprintf_func = fprintf_func;
7.38 + info->stream = stream;
7.39 + info->read_memory_func = buffer_read_memory;
7.40 + info->memory_error_func = perror_memory;
7.41 + info->print_address_func = generic_print_address;
7.42 + info->symbol_at_address_func = generic_symbol_at_address;
7.43 + info->symbol_is_valid = generic_symbol_is_valid;
7.44 + info->display_endian = BFD_ENDIAN_UNKNOWN;
7.45 +}
7.46 +
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/src/x86dasm/i386-dis.c Tue Aug 28 08:46:54 2007 +0000
8.3 @@ -0,0 +1,4436 @@
8.4 +/* Print i386 instructions for GDB, the GNU debugger.
8.5 + Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
8.6 + 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
8.7 +
8.8 + This file is part of GDB.
8.9 +
8.10 + This program is free software; you can redistribute it and/or modify
8.11 + it under the terms of the GNU General Public License as published by
8.12 + the Free Software Foundation; either version 2 of the License, or
8.13 + (at your option) any later version.
8.14 +
8.15 + This program is distributed in the hope that it will be useful,
8.16 + but WITHOUT ANY WARRANTY; without even the implied warranty of
8.17 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8.18 + GNU General Public License for more details.
8.19 +
8.20 + You should have received a copy of the GNU General Public License
8.21 + along with this program; if not, write to the Free Software
8.22 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
8.23 +
8.24 +/* 80386 instruction printer by Pace Willisson (pace@prep.ai.mit.edu)
8.25 + July 1988
8.26 + modified by John Hassey (hassey@dg-rtp.dg.com)
8.27 + x86-64 support added by Jan Hubicka (jh@suse.cz)
8.28 + VIA PadLock support by Michal Ludvig (mludvig@suse.cz). */
8.29 +
8.30 +/* The main tables describing the instructions is essentially a copy
8.31 + of the "Opcode Map" chapter (Appendix A) of the Intel 80386
8.32 + Programmers Manual. Usually, there is a capital letter, followed
8.33 + by a small letter. The capital letter tell the addressing mode,
8.34 + and the small letter tells about the operand size. Refer to
8.35 + the Intel manual for details. */
8.36 +
8.37 +#include "dis-asm.h"
8.38 +#include "sysdep.h"
8.39 +#include "opintl.h"
8.40 +
8.41 +#define MAXLEN 20
8.42 +
8.43 +#include <setjmp.h>
8.44 +
8.45 +#ifndef UNIXWARE_COMPAT
8.46 +/* Set non-zero for broken, compatible instructions. Set to zero for
8.47 + non-broken opcodes. */
8.48 +#define UNIXWARE_COMPAT 1
8.49 +#endif
8.50 +
8.51 +static int fetch_data (struct disassemble_info *, bfd_byte *);
8.52 +static void ckprefix (void);
8.53 +static const char *prefix_name (int, int);
8.54 +static int print_insn (bfd_vma, disassemble_info *);
8.55 +static void dofloat (int);
8.56 +static void OP_ST (int, int);
8.57 +static void OP_STi (int, int);
8.58 +static int putop (const char *, int);
8.59 +static void oappend (const char *);
8.60 +static void append_seg (void);
8.61 +static void OP_indirE (int, int);
8.62 +static void print_operand_value (char *, int, bfd_vma);
8.63 +static void OP_E (int, int);
8.64 +static void OP_G (int, int);
8.65 +static bfd_vma get64 (void);
8.66 +static bfd_signed_vma get32 (void);
8.67 +static bfd_signed_vma get32s (void);
8.68 +static int get16 (void);
8.69 +static void set_op (bfd_vma, int);
8.70 +static void OP_REG (int, int);
8.71 +static void OP_IMREG (int, int);
8.72 +static void OP_I (int, int);
8.73 +static void OP_I64 (int, int);
8.74 +static void OP_sI (int, int);
8.75 +static void OP_J (int, int);
8.76 +static void OP_SEG (int, int);
8.77 +static void OP_DIR (int, int);
8.78 +static void OP_OFF (int, int);
8.79 +static void OP_OFF64 (int, int);
8.80 +static void ptr_reg (int, int);
8.81 +static void OP_ESreg (int, int);
8.82 +static void OP_DSreg (int, int);
8.83 +static void OP_C (int, int);
8.84 +static void OP_D (int, int);
8.85 +static void OP_T (int, int);
8.86 +static void OP_Rd (int, int);
8.87 +static void OP_MMX (int, int);
8.88 +static void OP_XMM (int, int);
8.89 +static void OP_EM (int, int);
8.90 +static void OP_EX (int, int);
8.91 +static void OP_MS (int, int);
8.92 +static void OP_XS (int, int);
8.93 +static void OP_M (int, int);
8.94 +static void OP_0fae (int, int);
8.95 +static void OP_0f07 (int, int);
8.96 +static void NOP_Fixup (int, int);
8.97 +static void OP_3DNowSuffix (int, int);
8.98 +static void OP_SIMD_Suffix (int, int);
8.99 +static void SIMD_Fixup (int, int);
8.100 +static void PNI_Fixup (int, int);
8.101 +static void INVLPG_Fixup (int, int);
8.102 +static void BadOp (void);
8.103 +
8.104 +struct dis_private {
8.105 + /* Points to first byte not fetched. */
8.106 + bfd_byte *max_fetched;
8.107 + bfd_byte the_buffer[MAXLEN];
8.108 + bfd_vma insn_start;
8.109 + int orig_sizeflag;
8.110 + jmp_buf bailout;
8.111 +};
8.112 +
8.113 +/* The opcode for the fwait instruction, which we treat as a prefix
8.114 + when we can. */
8.115 +#define FWAIT_OPCODE (0x9b)
8.116 +
8.117 +/* Set to 1 for 64bit mode disassembly. */
8.118 +static int mode_64bit;
8.119 +
8.120 +/* Flags for the prefixes for the current instruction. See below. */
8.121 +static int prefixes;
8.122 +
8.123 +/* REX prefix the current instruction. See below. */
8.124 +static int rex;
8.125 +/* Bits of REX we've already used. */
8.126 +static int rex_used;
8.127 +#define REX_MODE64 8
8.128 +#define REX_EXTX 4
8.129 +#define REX_EXTY 2
8.130 +#define REX_EXTZ 1
8.131 +/* Mark parts used in the REX prefix. When we are testing for
8.132 + empty prefix (for 8bit register REX extension), just mask it
8.133 + out. Otherwise test for REX bit is excuse for existence of REX
8.134 + only in case value is nonzero. */
8.135 +#define USED_REX(value) \
8.136 + { \
8.137 + if (value) \
8.138 + rex_used |= (rex & value) ? (value) | 0x40 : 0; \
8.139 + else \
8.140 + rex_used |= 0x40; \
8.141 + }
8.142 +
8.143 +/* Flags for prefixes which we somehow handled when printing the
8.144 + current instruction. */
8.145 +static int used_prefixes;
8.146 +
8.147 +/* Flags stored in PREFIXES. */
8.148 +#define PREFIX_REPZ 1
8.149 +#define PREFIX_REPNZ 2
8.150 +#define PREFIX_LOCK 4
8.151 +#define PREFIX_CS 8
8.152 +#define PREFIX_SS 0x10
8.153 +#define PREFIX_DS 0x20
8.154 +#define PREFIX_ES 0x40
8.155 +#define PREFIX_FS 0x80
8.156 +#define PREFIX_GS 0x100
8.157 +#define PREFIX_DATA 0x200
8.158 +#define PREFIX_ADDR 0x400
8.159 +#define PREFIX_FWAIT 0x800
8.160 +
8.161 +/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
8.162 + to ADDR (exclusive) are valid. Returns 1 for success, longjmps
8.163 + on error. */
8.164 +#define FETCH_DATA(info, addr) \
8.165 + ((addr) <= ((struct dis_private *) (info->private_data))->max_fetched \
8.166 + ? 1 : fetch_data ((info), (addr)))
8.167 +
8.168 +static int
8.169 +fetch_data (struct disassemble_info *info, bfd_byte *addr)
8.170 +{
8.171 + int status;
8.172 + struct dis_private *priv = (struct dis_private *) info->private_data;
8.173 + bfd_vma start = priv->insn_start + (priv->max_fetched - priv->the_buffer);
8.174 +
8.175 + status = (*info->read_memory_func) (start,
8.176 + priv->max_fetched,
8.177 + addr - priv->max_fetched,
8.178 + info);
8.179 + if (status != 0)
8.180 + {
8.181 + /* If we did manage to read at least one byte, then
8.182 + print_insn_i386 will do something sensible. Otherwise, print
8.183 + an error. We do that here because this is where we know
8.184 + STATUS. */
8.185 + if (priv->max_fetched == priv->the_buffer)
8.186 + (*info->memory_error_func) (status, start, info);
8.187 + longjmp (priv->bailout, 1);
8.188 + }
8.189 + else
8.190 + priv->max_fetched = addr;
8.191 + return 1;
8.192 +}
8.193 +
8.194 +#define XX NULL, 0
8.195 +
8.196 +#define Eb OP_E, b_mode
8.197 +#define Ev OP_E, v_mode
8.198 +#define Ed OP_E, d_mode
8.199 +#define Eq OP_E, q_mode
8.200 +#define Edq OP_E, dq_mode
8.201 +#define Edqw OP_E, dqw_mode
8.202 +#define indirEv OP_indirE, v_mode
8.203 +#define indirEp OP_indirE, f_mode
8.204 +#define Ew OP_E, w_mode
8.205 +#define Ma OP_E, v_mode
8.206 +#define M OP_M, 0 /* lea, lgdt, etc. */
8.207 +#define Mp OP_M, f_mode /* 32 or 48 bit memory operand for LDS, LES etc */
8.208 +#define Gb OP_G, b_mode
8.209 +#define Gv OP_G, v_mode
8.210 +#define Gd OP_G, d_mode
8.211 +#define Gdq OP_G, dq_mode
8.212 +#define Gw OP_G, w_mode
8.213 +#define Rd OP_Rd, d_mode
8.214 +#define Rm OP_Rd, m_mode
8.215 +#define Ib OP_I, b_mode
8.216 +#define sIb OP_sI, b_mode /* sign extened byte */
8.217 +#define Iv OP_I, v_mode
8.218 +#define Iq OP_I, q_mode
8.219 +#define Iv64 OP_I64, v_mode
8.220 +#define Iw OP_I, w_mode
8.221 +#define I1 OP_I, const_1_mode
8.222 +#define Jb OP_J, b_mode
8.223 +#define Jv OP_J, v_mode
8.224 +#define Cm OP_C, m_mode
8.225 +#define Dm OP_D, m_mode
8.226 +#define Td OP_T, d_mode
8.227 +
8.228 +#define RMeAX OP_REG, eAX_reg
8.229 +#define RMeBX OP_REG, eBX_reg
8.230 +#define RMeCX OP_REG, eCX_reg
8.231 +#define RMeDX OP_REG, eDX_reg
8.232 +#define RMeSP OP_REG, eSP_reg
8.233 +#define RMeBP OP_REG, eBP_reg
8.234 +#define RMeSI OP_REG, eSI_reg
8.235 +#define RMeDI OP_REG, eDI_reg
8.236 +#define RMrAX OP_REG, rAX_reg
8.237 +#define RMrBX OP_REG, rBX_reg
8.238 +#define RMrCX OP_REG, rCX_reg
8.239 +#define RMrDX OP_REG, rDX_reg
8.240 +#define RMrSP OP_REG, rSP_reg
8.241 +#define RMrBP OP_REG, rBP_reg
8.242 +#define RMrSI OP_REG, rSI_reg
8.243 +#define RMrDI OP_REG, rDI_reg
8.244 +#define RMAL OP_REG, al_reg
8.245 +#define RMAL OP_REG, al_reg
8.246 +#define RMCL OP_REG, cl_reg
8.247 +#define RMDL OP_REG, dl_reg
8.248 +#define RMBL OP_REG, bl_reg
8.249 +#define RMAH OP_REG, ah_reg
8.250 +#define RMCH OP_REG, ch_reg
8.251 +#define RMDH OP_REG, dh_reg
8.252 +#define RMBH OP_REG, bh_reg
8.253 +#define RMAX OP_REG, ax_reg
8.254 +#define RMDX OP_REG, dx_reg
8.255 +
8.256 +#define eAX OP_IMREG, eAX_reg
8.257 +#define eBX OP_IMREG, eBX_reg
8.258 +#define eCX OP_IMREG, eCX_reg
8.259 +#define eDX OP_IMREG, eDX_reg
8.260 +#define eSP OP_IMREG, eSP_reg
8.261 +#define eBP OP_IMREG, eBP_reg
8.262 +#define eSI OP_IMREG, eSI_reg
8.263 +#define eDI OP_IMREG, eDI_reg
8.264 +#define AL OP_IMREG, al_reg
8.265 +#define AL OP_IMREG, al_reg
8.266 +#define CL OP_IMREG, cl_reg
8.267 +#define DL OP_IMREG, dl_reg
8.268 +#define BL OP_IMREG, bl_reg
8.269 +#define AH OP_IMREG, ah_reg
8.270 +#define CH OP_IMREG, ch_reg
8.271 +#define DH OP_IMREG, dh_reg
8.272 +#define BH OP_IMREG, bh_reg
8.273 +#define AX OP_IMREG, ax_reg
8.274 +#define DX OP_IMREG, dx_reg
8.275 +#define indirDX OP_IMREG, indir_dx_reg
8.276 +
8.277 +#define Sw OP_SEG, w_mode
8.278 +#define Ap OP_DIR, 0
8.279 +#define Ob OP_OFF, b_mode
8.280 +#define Ob64 OP_OFF64, b_mode
8.281 +#define Ov OP_OFF, v_mode
8.282 +#define Ov64 OP_OFF64, v_mode
8.283 +#define Xb OP_DSreg, eSI_reg
8.284 +#define Xv OP_DSreg, eSI_reg
8.285 +#define Yb OP_ESreg, eDI_reg
8.286 +#define Yv OP_ESreg, eDI_reg
8.287 +#define DSBX OP_DSreg, eBX_reg
8.288 +
8.289 +#define es OP_REG, es_reg
8.290 +#define ss OP_REG, ss_reg
8.291 +#define cs OP_REG, cs_reg
8.292 +#define ds OP_REG, ds_reg
8.293 +#define fs OP_REG, fs_reg
8.294 +#define gs OP_REG, gs_reg
8.295 +
8.296 +#define MX OP_MMX, 0
8.297 +#define XM OP_XMM, 0
8.298 +#define EM OP_EM, v_mode
8.299 +#define EX OP_EX, v_mode
8.300 +#define MS OP_MS, v_mode
8.301 +#define XS OP_XS, v_mode
8.302 +#define OPSUF OP_3DNowSuffix, 0
8.303 +#define OPSIMD OP_SIMD_Suffix, 0
8.304 +
8.305 +#define cond_jump_flag NULL, cond_jump_mode
8.306 +#define loop_jcxz_flag NULL, loop_jcxz_mode
8.307 +
8.308 +/* bits in sizeflag */
8.309 +#define SUFFIX_ALWAYS 4
8.310 +#define AFLAG 2
8.311 +#define DFLAG 1
8.312 +
8.313 +#define b_mode 1 /* byte operand */
8.314 +#define v_mode 2 /* operand size depends on prefixes */
8.315 +#define w_mode 3 /* word operand */
8.316 +#define d_mode 4 /* double word operand */
8.317 +#define q_mode 5 /* quad word operand */
8.318 +#define t_mode 6 /* ten-byte operand */
8.319 +#define x_mode 7 /* 16-byte XMM operand */
8.320 +#define m_mode 8 /* d_mode in 32bit, q_mode in 64bit mode. */
8.321 +#define cond_jump_mode 9
8.322 +#define loop_jcxz_mode 10
8.323 +#define dq_mode 11 /* operand size depends on REX prefixes. */
8.324 +#define dqw_mode 12 /* registers like dq_mode, memory like w_mode. */
8.325 +#define f_mode 13 /* 4- or 6-byte pointer operand */
8.326 +#define const_1_mode 14
8.327 +
8.328 +#define es_reg 100
8.329 +#define cs_reg 101
8.330 +#define ss_reg 102
8.331 +#define ds_reg 103
8.332 +#define fs_reg 104
8.333 +#define gs_reg 105
8.334 +
8.335 +#define eAX_reg 108
8.336 +#define eCX_reg 109
8.337 +#define eDX_reg 110
8.338 +#define eBX_reg 111
8.339 +#define eSP_reg 112
8.340 +#define eBP_reg 113
8.341 +#define eSI_reg 114
8.342 +#define eDI_reg 115
8.343 +
8.344 +#define al_reg 116
8.345 +#define cl_reg 117
8.346 +#define dl_reg 118
8.347 +#define bl_reg 119
8.348 +#define ah_reg 120
8.349 +#define ch_reg 121
8.350 +#define dh_reg 122
8.351 +#define bh_reg 123
8.352 +
8.353 +#define ax_reg 124
8.354 +#define cx_reg 125
8.355 +#define dx_reg 126
8.356 +#define bx_reg 127
8.357 +#define sp_reg 128
8.358 +#define bp_reg 129
8.359 +#define si_reg 130
8.360 +#define di_reg 131
8.361 +
8.362 +#define rAX_reg 132
8.363 +#define rCX_reg 133
8.364 +#define rDX_reg 134
8.365 +#define rBX_reg 135
8.366 +#define rSP_reg 136
8.367 +#define rBP_reg 137
8.368 +#define rSI_reg 138
8.369 +#define rDI_reg 139
8.370 +
8.371 +#define indir_dx_reg 150
8.372 +
8.373 +#define FLOATCODE 1
8.374 +#define USE_GROUPS 2
8.375 +#define USE_PREFIX_USER_TABLE 3
8.376 +#define X86_64_SPECIAL 4
8.377 +
8.378 +#define FLOAT NULL, NULL, FLOATCODE, NULL, 0, NULL, 0
8.379 +
8.380 +#define GRP1b NULL, NULL, USE_GROUPS, NULL, 0, NULL, 0
8.381 +#define GRP1S NULL, NULL, USE_GROUPS, NULL, 1, NULL, 0
8.382 +#define GRP1Ss NULL, NULL, USE_GROUPS, NULL, 2, NULL, 0
8.383 +#define GRP2b NULL, NULL, USE_GROUPS, NULL, 3, NULL, 0
8.384 +#define GRP2S NULL, NULL, USE_GROUPS, NULL, 4, NULL, 0
8.385 +#define GRP2b_one NULL, NULL, USE_GROUPS, NULL, 5, NULL, 0
8.386 +#define GRP2S_one NULL, NULL, USE_GROUPS, NULL, 6, NULL, 0
8.387 +#define GRP2b_cl NULL, NULL, USE_GROUPS, NULL, 7, NULL, 0
8.388 +#define GRP2S_cl NULL, NULL, USE_GROUPS, NULL, 8, NULL, 0
8.389 +#define GRP3b NULL, NULL, USE_GROUPS, NULL, 9, NULL, 0
8.390 +#define GRP3S NULL, NULL, USE_GROUPS, NULL, 10, NULL, 0
8.391 +#define GRP4 NULL, NULL, USE_GROUPS, NULL, 11, NULL, 0
8.392 +#define GRP5 NULL, NULL, USE_GROUPS, NULL, 12, NULL, 0
8.393 +#define GRP6 NULL, NULL, USE_GROUPS, NULL, 13, NULL, 0
8.394 +#define GRP7 NULL, NULL, USE_GROUPS, NULL, 14, NULL, 0
8.395 +#define GRP8 NULL, NULL, USE_GROUPS, NULL, 15, NULL, 0
8.396 +#define GRP9 NULL, NULL, USE_GROUPS, NULL, 16, NULL, 0
8.397 +#define GRP10 NULL, NULL, USE_GROUPS, NULL, 17, NULL, 0
8.398 +#define GRP11 NULL, NULL, USE_GROUPS, NULL, 18, NULL, 0
8.399 +#define GRP12 NULL, NULL, USE_GROUPS, NULL, 19, NULL, 0
8.400 +#define GRP13 NULL, NULL, USE_GROUPS, NULL, 20, NULL, 0
8.401 +#define GRP14 NULL, NULL, USE_GROUPS, NULL, 21, NULL, 0
8.402 +#define GRPAMD NULL, NULL, USE_GROUPS, NULL, 22, NULL, 0
8.403 +#define GRPPADLCK1 NULL, NULL, USE_GROUPS, NULL, 23, NULL, 0
8.404 +#define GRPPADLCK2 NULL, NULL, USE_GROUPS, NULL, 24, NULL, 0
8.405 +
8.406 +#define PREGRP0 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 0, NULL, 0
8.407 +#define PREGRP1 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 1, NULL, 0
8.408 +#define PREGRP2 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 2, NULL, 0
8.409 +#define PREGRP3 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 3, NULL, 0
8.410 +#define PREGRP4 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 4, NULL, 0
8.411 +#define PREGRP5 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 5, NULL, 0
8.412 +#define PREGRP6 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 6, NULL, 0
8.413 +#define PREGRP7 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 7, NULL, 0
8.414 +#define PREGRP8 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 8, NULL, 0
8.415 +#define PREGRP9 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 9, NULL, 0
8.416 +#define PREGRP10 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 10, NULL, 0
8.417 +#define PREGRP11 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 11, NULL, 0
8.418 +#define PREGRP12 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 12, NULL, 0
8.419 +#define PREGRP13 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 13, NULL, 0
8.420 +#define PREGRP14 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 14, NULL, 0
8.421 +#define PREGRP15 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 15, NULL, 0
8.422 +#define PREGRP16 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 16, NULL, 0
8.423 +#define PREGRP17 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 17, NULL, 0
8.424 +#define PREGRP18 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 18, NULL, 0
8.425 +#define PREGRP19 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 19, NULL, 0
8.426 +#define PREGRP20 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 20, NULL, 0
8.427 +#define PREGRP21 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 21, NULL, 0
8.428 +#define PREGRP22 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 22, NULL, 0
8.429 +#define PREGRP23 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 23, NULL, 0
8.430 +#define PREGRP24 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 24, NULL, 0
8.431 +#define PREGRP25 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 25, NULL, 0
8.432 +#define PREGRP26 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 26, NULL, 0
8.433 +#define PREGRP27 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 27, NULL, 0
8.434 +#define PREGRP28 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 28, NULL, 0
8.435 +#define PREGRP29 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 29, NULL, 0
8.436 +#define PREGRP30 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 30, NULL, 0
8.437 +#define PREGRP31 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 31, NULL, 0
8.438 +#define PREGRP32 NULL, NULL, USE_PREFIX_USER_TABLE, NULL, 32, NULL, 0
8.439 +
8.440 +#define X86_64_0 NULL, NULL, X86_64_SPECIAL, NULL, 0, NULL, 0
8.441 +
8.442 +typedef void (*op_rtn) (int bytemode, int sizeflag);
8.443 +
8.444 +struct dis386 {
8.445 + const char *name;
8.446 + op_rtn op1;
8.447 + int bytemode1;
8.448 + op_rtn op2;
8.449 + int bytemode2;
8.450 + op_rtn op3;
8.451 + int bytemode3;
8.452 +};
8.453 +
8.454 +/* Upper case letters in the instruction names here are macros.
8.455 + 'A' => print 'b' if no register operands or suffix_always is true
8.456 + 'B' => print 'b' if suffix_always is true
8.457 + 'C' => print 's' or 'l' ('w' or 'd' in Intel mode) depending on operand
8.458 + . size prefix
8.459 + 'E' => print 'e' if 32-bit form of jcxz
8.460 + 'F' => print 'w' or 'l' depending on address size prefix (loop insns)
8.461 + 'H' => print ",pt" or ",pn" branch hint
8.462 + 'I' => honor following macro letter even in Intel mode (implemented only
8.463 + . for some of the macro letters)
8.464 + 'J' => print 'l'
8.465 + 'L' => print 'l' if suffix_always is true
8.466 + 'N' => print 'n' if instruction has no wait "prefix"
8.467 + 'O' => print 'd', or 'o'
8.468 + 'P' => print 'w', 'l' or 'q' if instruction has an operand size prefix,
8.469 + . or suffix_always is true. print 'q' if rex prefix is present.
8.470 + 'Q' => print 'w', 'l' or 'q' if no register operands or suffix_always
8.471 + . is true
8.472 + 'R' => print 'w', 'l' or 'q' ("wd" or "dq" in intel mode)
8.473 + 'S' => print 'w', 'l' or 'q' if suffix_always is true
8.474 + 'T' => print 'q' in 64bit mode and behave as 'P' otherwise
8.475 + 'U' => print 'q' in 64bit mode and behave as 'Q' otherwise
8.476 + 'W' => print 'b' or 'w' ("w" or "de" in intel mode)
8.477 + 'X' => print 's', 'd' depending on data16 prefix (for XMM)
8.478 + 'Y' => 'q' if instruction has an REX 64bit overwrite prefix
8.479 +
8.480 + Many of the above letters print nothing in Intel mode. See "putop"
8.481 + for the details.
8.482 +
8.483 + Braces '{' and '}', and vertical bars '|', indicate alternative
8.484 + mnemonic strings for AT&T, Intel, X86_64 AT&T, and X86_64 Intel
8.485 + modes. In cases where there are only two alternatives, the X86_64
8.486 + instruction is reserved, and "(bad)" is printed.
8.487 +*/
8.488 +
8.489 +static const struct dis386 dis386[] = {
8.490 + /* 00 */
8.491 + { "addB", Eb, Gb, XX },
8.492 + { "addS", Ev, Gv, XX },
8.493 + { "addB", Gb, Eb, XX },
8.494 + { "addS", Gv, Ev, XX },
8.495 + { "addB", AL, Ib, XX },
8.496 + { "addS", eAX, Iv, XX },
8.497 + { "push{T|}", es, XX, XX },
8.498 + { "pop{T|}", es, XX, XX },
8.499 + /* 08 */
8.500 + { "orB", Eb, Gb, XX },
8.501 + { "orS", Ev, Gv, XX },
8.502 + { "orB", Gb, Eb, XX },
8.503 + { "orS", Gv, Ev, XX },
8.504 + { "orB", AL, Ib, XX },
8.505 + { "orS", eAX, Iv, XX },
8.506 + { "push{T|}", cs, XX, XX },
8.507 + { "(bad)", XX, XX, XX }, /* 0x0f extended opcode escape */
8.508 + /* 10 */
8.509 + { "adcB", Eb, Gb, XX },
8.510 + { "adcS", Ev, Gv, XX },
8.511 + { "adcB", Gb, Eb, XX },
8.512 + { "adcS", Gv, Ev, XX },
8.513 + { "adcB", AL, Ib, XX },
8.514 + { "adcS", eAX, Iv, XX },
8.515 + { "push{T|}", ss, XX, XX },
8.516 + { "popT|}", ss, XX, XX },
8.517 + /* 18 */
8.518 + { "sbbB", Eb, Gb, XX },
8.519 + { "sbbS", Ev, Gv, XX },
8.520 + { "sbbB", Gb, Eb, XX },
8.521 + { "sbbS", Gv, Ev, XX },
8.522 + { "sbbB", AL, Ib, XX },
8.523 + { "sbbS", eAX, Iv, XX },
8.524 + { "push{T|}", ds, XX, XX },
8.525 + { "pop{T|}", ds, XX, XX },
8.526 + /* 20 */
8.527 + { "andB", Eb, Gb, XX },
8.528 + { "andS", Ev, Gv, XX },
8.529 + { "andB", Gb, Eb, XX },
8.530 + { "andS", Gv, Ev, XX },
8.531 + { "andB", AL, Ib, XX },
8.532 + { "andS", eAX, Iv, XX },
8.533 + { "(bad)", XX, XX, XX }, /* SEG ES prefix */
8.534 + { "daa{|}", XX, XX, XX },
8.535 + /* 28 */
8.536 + { "subB", Eb, Gb, XX },
8.537 + { "subS", Ev, Gv, XX },
8.538 + { "subB", Gb, Eb, XX },
8.539 + { "subS", Gv, Ev, XX },
8.540 + { "subB", AL, Ib, XX },
8.541 + { "subS", eAX, Iv, XX },
8.542 + { "(bad)", XX, XX, XX }, /* SEG CS prefix */
8.543 + { "das{|}", XX, XX, XX },
8.544 + /* 30 */
8.545 + { "xorB", Eb, Gb, XX },
8.546 + { "xorS", Ev, Gv, XX },
8.547 + { "xorB", Gb, Eb, XX },
8.548 + { "xorS", Gv, Ev, XX },
8.549 + { "xorB", AL, Ib, XX },
8.550 + { "xorS", eAX, Iv, XX },
8.551 + { "(bad)", XX, XX, XX }, /* SEG SS prefix */
8.552 + { "aaa{|}", XX, XX, XX },
8.553 + /* 38 */
8.554 + { "cmpB", Eb, Gb, XX },
8.555 + { "cmpS", Ev, Gv, XX },
8.556 + { "cmpB", Gb, Eb, XX },
8.557 + { "cmpS", Gv, Ev, XX },
8.558 + { "cmpB", AL, Ib, XX },
8.559 + { "cmpS", eAX, Iv, XX },
8.560 + { "(bad)", XX, XX, XX }, /* SEG DS prefix */
8.561 + { "aas{|}", XX, XX, XX },
8.562 + /* 40 */
8.563 + { "inc{S|}", RMeAX, XX, XX },
8.564 + { "inc{S|}", RMeCX, XX, XX },
8.565 + { "inc{S|}", RMeDX, XX, XX },
8.566 + { "inc{S|}", RMeBX, XX, XX },
8.567 + { "inc{S|}", RMeSP, XX, XX },
8.568 + { "inc{S|}", RMeBP, XX, XX },
8.569 + { "inc{S|}", RMeSI, XX, XX },
8.570 + { "inc{S|}", RMeDI, XX, XX },
8.571 + /* 48 */
8.572 + { "dec{S|}", RMeAX, XX, XX },
8.573 + { "dec{S|}", RMeCX, XX, XX },
8.574 + { "dec{S|}", RMeDX, XX, XX },
8.575 + { "dec{S|}", RMeBX, XX, XX },
8.576 + { "dec{S|}", RMeSP, XX, XX },
8.577 + { "dec{S|}", RMeBP, XX, XX },
8.578 + { "dec{S|}", RMeSI, XX, XX },
8.579 + { "dec{S|}", RMeDI, XX, XX },
8.580 + /* 50 */
8.581 + { "pushS", RMrAX, XX, XX },
8.582 + { "pushS", RMrCX, XX, XX },
8.583 + { "pushS", RMrDX, XX, XX },
8.584 + { "pushS", RMrBX, XX, XX },
8.585 + { "pushS", RMrSP, XX, XX },
8.586 + { "pushS", RMrBP, XX, XX },
8.587 + { "pushS", RMrSI, XX, XX },
8.588 + { "pushS", RMrDI, XX, XX },
8.589 + /* 58 */
8.590 + { "popS", RMrAX, XX, XX },
8.591 + { "popS", RMrCX, XX, XX },
8.592 + { "popS", RMrDX, XX, XX },
8.593 + { "popS", RMrBX, XX, XX },
8.594 + { "popS", RMrSP, XX, XX },
8.595 + { "popS", RMrBP, XX, XX },
8.596 + { "popS", RMrSI, XX, XX },
8.597 + { "popS", RMrDI, XX, XX },
8.598 + /* 60 */
8.599 + { "pusha{P|}", XX, XX, XX },
8.600 + { "popa{P|}", XX, XX, XX },
8.601 + { "bound{S|}", Gv, Ma, XX },
8.602 + { X86_64_0 },
8.603 + { "(bad)", XX, XX, XX }, /* seg fs */
8.604 + { "(bad)", XX, XX, XX }, /* seg gs */
8.605 + { "(bad)", XX, XX, XX }, /* op size prefix */
8.606 + { "(bad)", XX, XX, XX }, /* adr size prefix */
8.607 + /* 68 */
8.608 + { "pushT", Iq, XX, XX },
8.609 + { "imulS", Gv, Ev, Iv },
8.610 + { "pushT", sIb, XX, XX },
8.611 + { "imulS", Gv, Ev, sIb },
8.612 + { "ins{b||b|}", Yb, indirDX, XX },
8.613 + { "ins{R||R|}", Yv, indirDX, XX },
8.614 + { "outs{b||b|}", indirDX, Xb, XX },
8.615 + { "outs{R||R|}", indirDX, Xv, XX },
8.616 + /* 70 */
8.617 + { "joH", Jb, XX, cond_jump_flag },
8.618 + { "jnoH", Jb, XX, cond_jump_flag },
8.619 + { "jbH", Jb, XX, cond_jump_flag },
8.620 + { "jaeH", Jb, XX, cond_jump_flag },
8.621 + { "jeH", Jb, XX, cond_jump_flag },
8.622 + { "jneH", Jb, XX, cond_jump_flag },
8.623 + { "jbeH", Jb, XX, cond_jump_flag },
8.624 + { "jaH", Jb, XX, cond_jump_flag },
8.625 + /* 78 */
8.626 + { "jsH", Jb, XX, cond_jump_flag },
8.627 + { "jnsH", Jb, XX, cond_jump_flag },
8.628 + { "jpH", Jb, XX, cond_jump_flag },
8.629 + { "jnpH", Jb, XX, cond_jump_flag },
8.630 + { "jlH", Jb, XX, cond_jump_flag },
8.631 + { "jgeH", Jb, XX, cond_jump_flag },
8.632 + { "jleH", Jb, XX, cond_jump_flag },
8.633 + { "jgH", Jb, XX, cond_jump_flag },
8.634 + /* 80 */
8.635 + { GRP1b },
8.636 + { GRP1S },
8.637 + { "(bad)", XX, XX, XX },
8.638 + { GRP1Ss },
8.639 + { "testB", Eb, Gb, XX },
8.640 + { "testS", Ev, Gv, XX },
8.641 + { "xchgB", Eb, Gb, XX },
8.642 + { "xchgS", Ev, Gv, XX },
8.643 + /* 88 */
8.644 + { "movB", Eb, Gb, XX },
8.645 + { "movS", Ev, Gv, XX },
8.646 + { "movB", Gb, Eb, XX },
8.647 + { "movS", Gv, Ev, XX },
8.648 + { "movQ", Ev, Sw, XX },
8.649 + { "leaS", Gv, M, XX },
8.650 + { "movQ", Sw, Ev, XX },
8.651 + { "popU", Ev, XX, XX },
8.652 + /* 90 */
8.653 + { "nop", NOP_Fixup, 0, XX, XX },
8.654 + { "xchgS", RMeCX, eAX, XX },
8.655 + { "xchgS", RMeDX, eAX, XX },
8.656 + { "xchgS", RMeBX, eAX, XX },
8.657 + { "xchgS", RMeSP, eAX, XX },
8.658 + { "xchgS", RMeBP, eAX, XX },
8.659 + { "xchgS", RMeSI, eAX, XX },
8.660 + { "xchgS", RMeDI, eAX, XX },
8.661 + /* 98 */
8.662 + { "cW{tR||tR|}", XX, XX, XX },
8.663 + { "cR{tO||tO|}", XX, XX, XX },
8.664 + { "Jcall{T|}", Ap, XX, XX },
8.665 + { "(bad)", XX, XX, XX }, /* fwait */
8.666 + { "pushfT", XX, XX, XX },
8.667 + { "popfT", XX, XX, XX },
8.668 + { "sahf{|}", XX, XX, XX },
8.669 + { "lahf{|}", XX, XX, XX },
8.670 + /* a0 */
8.671 + { "movB", AL, Ob64, XX },
8.672 + { "movS", eAX, Ov64, XX },
8.673 + { "movB", Ob64, AL, XX },
8.674 + { "movS", Ov64, eAX, XX },
8.675 + { "movs{b||b|}", Yb, Xb, XX },
8.676 + { "movs{R||R|}", Yv, Xv, XX },
8.677 + { "cmps{b||b|}", Xb, Yb, XX },
8.678 + { "cmps{R||R|}", Xv, Yv, XX },
8.679 + /* a8 */
8.680 + { "testB", AL, Ib, XX },
8.681 + { "testS", eAX, Iv, XX },
8.682 + { "stosB", Yb, AL, XX },
8.683 + { "stosS", Yv, eAX, XX },
8.684 + { "lodsB", AL, Xb, XX },
8.685 + { "lodsS", eAX, Xv, XX },
8.686 + { "scasB", AL, Yb, XX },
8.687 + { "scasS", eAX, Yv, XX },
8.688 + /* b0 */
8.689 + { "movB", RMAL, Ib, XX },
8.690 + { "movB", RMCL, Ib, XX },
8.691 + { "movB", RMDL, Ib, XX },
8.692 + { "movB", RMBL, Ib, XX },
8.693 + { "movB", RMAH, Ib, XX },
8.694 + { "movB", RMCH, Ib, XX },
8.695 + { "movB", RMDH, Ib, XX },
8.696 + { "movB", RMBH, Ib, XX },
8.697 + /* b8 */
8.698 + { "movS", RMeAX, Iv64, XX },
8.699 + { "movS", RMeCX, Iv64, XX },
8.700 + { "movS", RMeDX, Iv64, XX },
8.701 + { "movS", RMeBX, Iv64, XX },
8.702 + { "movS", RMeSP, Iv64, XX },
8.703 + { "movS", RMeBP, Iv64, XX },
8.704 + { "movS", RMeSI, Iv64, XX },
8.705 + { "movS", RMeDI, Iv64, XX },
8.706 + /* c0 */
8.707 + { GRP2b },
8.708 + { GRP2S },
8.709 + { "retT", Iw, XX, XX },
8.710 + { "retT", XX, XX, XX },
8.711 + { "les{S|}", Gv, Mp, XX },
8.712 + { "ldsS", Gv, Mp, XX },
8.713 + { "movA", Eb, Ib, XX },
8.714 + { "movQ", Ev, Iv, XX },
8.715 + /* c8 */
8.716 + { "enterT", Iw, Ib, XX },
8.717 + { "leaveT", XX, XX, XX },
8.718 + { "lretP", Iw, XX, XX },
8.719 + { "lretP", XX, XX, XX },
8.720 + { "int3", XX, XX, XX },
8.721 + { "int", Ib, XX, XX },
8.722 + { "into{|}", XX, XX, XX },
8.723 + { "iretP", XX, XX, XX },
8.724 + /* d0 */
8.725 + { GRP2b_one },
8.726 + { GRP2S_one },
8.727 + { GRP2b_cl },
8.728 + { GRP2S_cl },
8.729 + { "aam{|}", sIb, XX, XX },
8.730 + { "aad{|}", sIb, XX, XX },
8.731 + { "(bad)", XX, XX, XX },
8.732 + { "xlat", DSBX, XX, XX },
8.733 + /* d8 */
8.734 + { FLOAT },
8.735 + { FLOAT },
8.736 + { FLOAT },
8.737 + { FLOAT },
8.738 + { FLOAT },
8.739 + { FLOAT },
8.740 + { FLOAT },
8.741 + { FLOAT },
8.742 + /* e0 */
8.743 + { "loopneFH", Jb, XX, loop_jcxz_flag },
8.744 + { "loopeFH", Jb, XX, loop_jcxz_flag },
8.745 + { "loopFH", Jb, XX, loop_jcxz_flag },
8.746 + { "jEcxzH", Jb, XX, loop_jcxz_flag },
8.747 + { "inB", AL, Ib, XX },
8.748 + { "inS", eAX, Ib, XX },
8.749 + { "outB", Ib, AL, XX },
8.750 + { "outS", Ib, eAX, XX },
8.751 + /* e8 */
8.752 + { "callT", Jv, XX, XX },
8.753 + { "jmpT", Jv, XX, XX },
8.754 + { "Jjmp{T|}", Ap, XX, XX },
8.755 + { "jmp", Jb, XX, XX },
8.756 + { "inB", AL, indirDX, XX },
8.757 + { "inS", eAX, indirDX, XX },
8.758 + { "outB", indirDX, AL, XX },
8.759 + { "outS", indirDX, eAX, XX },
8.760 + /* f0 */
8.761 + { "(bad)", XX, XX, XX }, /* lock prefix */
8.762 + { "icebp", XX, XX, XX },
8.763 + { "(bad)", XX, XX, XX }, /* repne */
8.764 + { "(bad)", XX, XX, XX }, /* repz */
8.765 + { "hlt", XX, XX, XX },
8.766 + { "cmc", XX, XX, XX },
8.767 + { GRP3b },
8.768 + { GRP3S },
8.769 + /* f8 */
8.770 + { "clc", XX, XX, XX },
8.771 + { "stc", XX, XX, XX },
8.772 + { "cli", XX, XX, XX },
8.773 + { "sti", XX, XX, XX },
8.774 + { "cld", XX, XX, XX },
8.775 + { "std", XX, XX, XX },
8.776 + { GRP4 },
8.777 + { GRP5 },
8.778 +};
8.779 +
8.780 +static const struct dis386 dis386_twobyte[] = {
8.781 + /* 00 */
8.782 + { GRP6 },
8.783 + { GRP7 },
8.784 + { "larS", Gv, Ew, XX },
8.785 + { "lslS", Gv, Ew, XX },
8.786 + { "(bad)", XX, XX, XX },
8.787 + { "syscall", XX, XX, XX },
8.788 + { "clts", XX, XX, XX },
8.789 + { "sysretP", XX, XX, XX },
8.790 + /* 08 */
8.791 + { "invd", XX, XX, XX },
8.792 + { "wbinvd", XX, XX, XX },
8.793 + { "(bad)", XX, XX, XX },
8.794 + { "ud2a", XX, XX, XX },
8.795 + { "(bad)", XX, XX, XX },
8.796 + { GRPAMD },
8.797 + { "femms", XX, XX, XX },
8.798 + { "", MX, EM, OPSUF }, /* See OP_3DNowSuffix. */
8.799 + /* 10 */
8.800 + { PREGRP8 },
8.801 + { PREGRP9 },
8.802 + { PREGRP30 },
8.803 + { "movlpX", EX, XM, SIMD_Fixup, 'h' },
8.804 + { "unpcklpX", XM, EX, XX },
8.805 + { "unpckhpX", XM, EX, XX },
8.806 + { PREGRP31 },
8.807 + { "movhpX", EX, XM, SIMD_Fixup, 'l' },
8.808 + /* 18 */
8.809 + { GRP14 },
8.810 + { "(bad)", XX, XX, XX },
8.811 + { "(bad)", XX, XX, XX },
8.812 + { "(bad)", XX, XX, XX },
8.813 + { "(bad)", XX, XX, XX },
8.814 + { "(bad)", XX, XX, XX },
8.815 + { "(bad)", XX, XX, XX },
8.816 + { "(bad)", XX, XX, XX },
8.817 + /* 20 */
8.818 + { "movL", Rm, Cm, XX },
8.819 + { "movL", Rm, Dm, XX },
8.820 + { "movL", Cm, Rm, XX },
8.821 + { "movL", Dm, Rm, XX },
8.822 + { "movL", Rd, Td, XX },
8.823 + { "(bad)", XX, XX, XX },
8.824 + { "movL", Td, Rd, XX },
8.825 + { "(bad)", XX, XX, XX },
8.826 + /* 28 */
8.827 + { "movapX", XM, EX, XX },
8.828 + { "movapX", EX, XM, XX },
8.829 + { PREGRP2 },
8.830 + { "movntpX", Ev, XM, XX },
8.831 + { PREGRP4 },
8.832 + { PREGRP3 },
8.833 + { "ucomisX", XM,EX, XX },
8.834 + { "comisX", XM,EX, XX },
8.835 + /* 30 */
8.836 + { "wrmsr", XX, XX, XX },
8.837 + { "rdtsc", XX, XX, XX },
8.838 + { "rdmsr", XX, XX, XX },
8.839 + { "rdpmc", XX, XX, XX },
8.840 + { "sysenter", XX, XX, XX },
8.841 + { "sysexit", XX, XX, XX },
8.842 + { "(bad)", XX, XX, XX },
8.843 + { "(bad)", XX, XX, XX },
8.844 + /* 38 */
8.845 + { "(bad)", XX, XX, XX },
8.846 + { "(bad)", XX, XX, XX },
8.847 + { "(bad)", XX, XX, XX },
8.848 + { "(bad)", XX, XX, XX },
8.849 + { "(bad)", XX, XX, XX },
8.850 + { "(bad)", XX, XX, XX },
8.851 + { "(bad)", XX, XX, XX },
8.852 + { "(bad)", XX, XX, XX },
8.853 + /* 40 */
8.854 + { "cmovo", Gv, Ev, XX },
8.855 + { "cmovno", Gv, Ev, XX },
8.856 + { "cmovb", Gv, Ev, XX },
8.857 + { "cmovae", Gv, Ev, XX },
8.858 + { "cmove", Gv, Ev, XX },
8.859 + { "cmovne", Gv, Ev, XX },
8.860 + { "cmovbe", Gv, Ev, XX },
8.861 + { "cmova", Gv, Ev, XX },
8.862 + /* 48 */
8.863 + { "cmovs", Gv, Ev, XX },
8.864 + { "cmovns", Gv, Ev, XX },
8.865 + { "cmovp", Gv, Ev, XX },
8.866 + { "cmovnp", Gv, Ev, XX },
8.867 + { "cmovl", Gv, Ev, XX },
8.868 + { "cmovge", Gv, Ev, XX },
8.869 + { "cmovle", Gv, Ev, XX },
8.870 + { "cmovg", Gv, Ev, XX },
8.871 + /* 50 */
8.872 + { "movmskpX", Gdq, XS, XX },
8.873 + { PREGRP13 },
8.874 + { PREGRP12 },
8.875 + { PREGRP11 },
8.876 + { "andpX", XM, EX, XX },
8.877 + { "andnpX", XM, EX, XX },
8.878 + { "orpX", XM, EX, XX },
8.879 + { "xorpX", XM, EX, XX },
8.880 + /* 58 */
8.881 + { PREGRP0 },
8.882 + { PREGRP10 },
8.883 + { PREGRP17 },
8.884 + { PREGRP16 },
8.885 + { PREGRP14 },
8.886 + { PREGRP7 },
8.887 + { PREGRP5 },
8.888 + { PREGRP6 },
8.889 + /* 60 */
8.890 + { "punpcklbw", MX, EM, XX },
8.891 + { "punpcklwd", MX, EM, XX },
8.892 + { "punpckldq", MX, EM, XX },
8.893 + { "packsswb", MX, EM, XX },
8.894 + { "pcmpgtb", MX, EM, XX },
8.895 + { "pcmpgtw", MX, EM, XX },
8.896 + { "pcmpgtd", MX, EM, XX },
8.897 + { "packuswb", MX, EM, XX },
8.898 + /* 68 */
8.899 + { "punpckhbw", MX, EM, XX },
8.900 + { "punpckhwd", MX, EM, XX },
8.901 + { "punpckhdq", MX, EM, XX },
8.902 + { "packssdw", MX, EM, XX },
8.903 + { PREGRP26 },
8.904 + { PREGRP24 },
8.905 + { "movd", MX, Edq, XX },
8.906 + { PREGRP19 },
8.907 + /* 70 */
8.908 + { PREGRP22 },
8.909 + { GRP10 },
8.910 + { GRP11 },
8.911 + { GRP12 },
8.912 + { "pcmpeqb", MX, EM, XX },
8.913 + { "pcmpeqw", MX, EM, XX },
8.914 + { "pcmpeqd", MX, EM, XX },
8.915 + { "emms", XX, XX, XX },
8.916 + /* 78 */
8.917 + { "(bad)", XX, XX, XX },
8.918 + { "(bad)", XX, XX, XX },
8.919 + { "(bad)", XX, XX, XX },
8.920 + { "(bad)", XX, XX, XX },
8.921 + { PREGRP28 },
8.922 + { PREGRP29 },
8.923 + { PREGRP23 },
8.924 + { PREGRP20 },
8.925 + /* 80 */
8.926 + { "joH", Jv, XX, cond_jump_flag },
8.927 + { "jnoH", Jv, XX, cond_jump_flag },
8.928 + { "jbH", Jv, XX, cond_jump_flag },
8.929 + { "jaeH", Jv, XX, cond_jump_flag },
8.930 + { "jeH", Jv, XX, cond_jump_flag },
8.931 + { "jneH", Jv, XX, cond_jump_flag },
8.932 + { "jbeH", Jv, XX, cond_jump_flag },
8.933 + { "jaH", Jv, XX, cond_jump_flag },
8.934 + /* 88 */
8.935 + { "jsH", Jv, XX, cond_jump_flag },
8.936 + { "jnsH", Jv, XX, cond_jump_flag },
8.937 + { "jpH", Jv, XX, cond_jump_flag },
8.938 + { "jnpH", Jv, XX, cond_jump_flag },
8.939 + { "jlH", Jv, XX, cond_jump_flag },
8.940 + { "jgeH", Jv, XX, cond_jump_flag },
8.941 + { "jleH", Jv, XX, cond_jump_flag },
8.942 + { "jgH", Jv, XX, cond_jump_flag },
8.943 + /* 90 */
8.944 + { "seto", Eb, XX, XX },
8.945 + { "setno", Eb, XX, XX },
8.946 + { "setb", Eb, XX, XX },
8.947 + { "setae", Eb, XX, XX },
8.948 + { "sete", Eb, XX, XX },
8.949 + { "setne", Eb, XX, XX },
8.950 + { "setbe", Eb, XX, XX },
8.951 + { "seta", Eb, XX, XX },
8.952 + /* 98 */
8.953 + { "sets", Eb, XX, XX },
8.954 + { "setns", Eb, XX, XX },
8.955 + { "setp", Eb, XX, XX },
8.956 + { "setnp", Eb, XX, XX },
8.957 + { "setl", Eb, XX, XX },
8.958 + { "setge", Eb, XX, XX },
8.959 + { "setle", Eb, XX, XX },
8.960 + { "setg", Eb, XX, XX },
8.961 + /* a0 */
8.962 + { "pushT", fs, XX, XX },
8.963 + { "popT", fs, XX, XX },
8.964 + { "cpuid", XX, XX, XX },
8.965 + { "btS", Ev, Gv, XX },
8.966 + { "shldS", Ev, Gv, Ib },
8.967 + { "shldS", Ev, Gv, CL },
8.968 + { GRPPADLCK2 },
8.969 + { GRPPADLCK1 },
8.970 + /* a8 */
8.971 + { "pushT", gs, XX, XX },
8.972 + { "popT", gs, XX, XX },
8.973 + { "rsm", XX, XX, XX },
8.974 + { "btsS", Ev, Gv, XX },
8.975 + { "shrdS", Ev, Gv, Ib },
8.976 + { "shrdS", Ev, Gv, CL },
8.977 + { GRP13 },
8.978 + { "imulS", Gv, Ev, XX },
8.979 + /* b0 */
8.980 + { "cmpxchgB", Eb, Gb, XX },
8.981 + { "cmpxchgS", Ev, Gv, XX },
8.982 + { "lssS", Gv, Mp, XX },
8.983 + { "btrS", Ev, Gv, XX },
8.984 + { "lfsS", Gv, Mp, XX },
8.985 + { "lgsS", Gv, Mp, XX },
8.986 + { "movz{bR|x|bR|x}", Gv, Eb, XX },
8.987 + { "movz{wR|x|wR|x}", Gv, Ew, XX }, /* yes, there really is movzww ! */
8.988 + /* b8 */
8.989 + { "(bad)", XX, XX, XX },
8.990 + { "ud2b", XX, XX, XX },
8.991 + { GRP8 },
8.992 + { "btcS", Ev, Gv, XX },
8.993 + { "bsfS", Gv, Ev, XX },
8.994 + { "bsrS", Gv, Ev, XX },
8.995 + { "movs{bR|x|bR|x}", Gv, Eb, XX },
8.996 + { "movs{wR|x|wR|x}", Gv, Ew, XX }, /* yes, there really is movsww ! */
8.997 + /* c0 */
8.998 + { "xaddB", Eb, Gb, XX },
8.999 + { "xaddS", Ev, Gv, XX },
8.1000 + { PREGRP1 },
8.1001 + { "movntiS", Ev, Gv, XX },
8.1002 + { "pinsrw", MX, Edqw, Ib },
8.1003 + { "pextrw", Gdq, MS, Ib },
8.1004 + { "shufpX", XM, EX, Ib },
8.1005 + { GRP9 },
8.1006 + /* c8 */
8.1007 + { "bswap", RMeAX, XX, XX },
8.1008 + { "bswap", RMeCX, XX, XX },
8.1009 + { "bswap", RMeDX, XX, XX },
8.1010 + { "bswap", RMeBX, XX, XX },
8.1011 + { "bswap", RMeSP, XX, XX },
8.1012 + { "bswap", RMeBP, XX, XX },
8.1013 + { "bswap", RMeSI, XX, XX },
8.1014 + { "bswap", RMeDI, XX, XX },
8.1015 + /* d0 */
8.1016 + { PREGRP27 },
8.1017 + { "psrlw", MX, EM, XX },
8.1018 + { "psrld", MX, EM, XX },
8.1019 + { "psrlq", MX, EM, XX },
8.1020 + { "paddq", MX, EM, XX },
8.1021 + { "pmullw", MX, EM, XX },
8.1022 + { PREGRP21 },
8.1023 + { "pmovmskb", Gdq, MS, XX },
8.1024 + /* d8 */
8.1025 + { "psubusb", MX, EM, XX },
8.1026 + { "psubusw", MX, EM, XX },
8.1027 + { "pminub", MX, EM, XX },
8.1028 + { "pand", MX, EM, XX },
8.1029 + { "paddusb", MX, EM, XX },
8.1030 + { "paddusw", MX, EM, XX },
8.1031 + { "pmaxub", MX, EM, XX },
8.1032 + { "pandn", MX, EM, XX },
8.1033 + /* e0 */
8.1034 + { "pavgb", MX, EM, XX },
8.1035 + { "psraw", MX, EM, XX },
8.1036 + { "psrad", MX, EM, XX },
8.1037 + { "pavgw", MX, EM, XX },
8.1038 + { "pmulhuw", MX, EM, XX },
8.1039 + { "pmulhw", MX, EM, XX },
8.1040 + { PREGRP15 },
8.1041 + { PREGRP25 },
8.1042 + /* e8 */
8.1043 + { "psubsb", MX, EM, XX },
8.1044 + { "psubsw", MX, EM, XX },
8.1045 + { "pminsw", MX, EM, XX },
8.1046 + { "por", MX, EM, XX },
8.1047 + { "paddsb", MX, EM, XX },
8.1048 + { "paddsw", MX, EM, XX },
8.1049 + { "pmaxsw", MX, EM, XX },
8.1050 + { "pxor", MX, EM, XX },
8.1051 + /* f0 */
8.1052 + { PREGRP32 },
8.1053 + { "psllw", MX, EM, XX },
8.1054 + { "pslld", MX, EM, XX },
8.1055 + { "psllq", MX, EM, XX },
8.1056 + { "pmuludq", MX, EM, XX },
8.1057 + { "pmaddwd", MX, EM, XX },
8.1058 + { "psadbw", MX, EM, XX },
8.1059 + { PREGRP18 },
8.1060 + /* f8 */
8.1061 + { "psubb", MX, EM, XX },
8.1062 + { "psubw", MX, EM, XX },
8.1063 + { "psubd", MX, EM, XX },
8.1064 + { "psubq", MX, EM, XX },
8.1065 + { "paddb", MX, EM, XX },
8.1066 + { "paddw", MX, EM, XX },
8.1067 + { "paddd", MX, EM, XX },
8.1068 + { "(bad)", XX, XX, XX }
8.1069 +};
8.1070 +
8.1071 +static const unsigned char onebyte_has_modrm[256] = {
8.1072 + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
8.1073 + /* ------------------------------- */
8.1074 + /* 00 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 00 */
8.1075 + /* 10 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 10 */
8.1076 + /* 20 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 20 */
8.1077 + /* 30 */ 1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0, /* 30 */
8.1078 + /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 40 */
8.1079 + /* 50 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 50 */
8.1080 + /* 60 */ 0,0,1,1,0,0,0,0,0,1,0,1,0,0,0,0, /* 60 */
8.1081 + /* 70 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 70 */
8.1082 + /* 80 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 80 */
8.1083 + /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 90 */
8.1084 + /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* a0 */
8.1085 + /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* b0 */
8.1086 + /* c0 */ 1,1,0,0,1,1,1,1,0,0,0,0,0,0,0,0, /* c0 */
8.1087 + /* d0 */ 1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* d0 */
8.1088 + /* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* e0 */
8.1089 + /* f0 */ 0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1 /* f0 */
8.1090 + /* ------------------------------- */
8.1091 + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
8.1092 +};
8.1093 +
8.1094 +static const unsigned char twobyte_has_modrm[256] = {
8.1095 + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
8.1096 + /* ------------------------------- */
8.1097 + /* 00 */ 1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1, /* 0f */
8.1098 + /* 10 */ 1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0, /* 1f */
8.1099 + /* 20 */ 1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1, /* 2f */
8.1100 + /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
8.1101 + /* 40 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 4f */
8.1102 + /* 50 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 5f */
8.1103 + /* 60 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 6f */
8.1104 + /* 70 */ 1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1, /* 7f */
8.1105 + /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
8.1106 + /* 90 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* 9f */
8.1107 + /* a0 */ 0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1, /* af */
8.1108 + /* b0 */ 1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1, /* bf */
8.1109 + /* c0 */ 1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, /* cf */
8.1110 + /* d0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* df */
8.1111 + /* e0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, /* ef */
8.1112 + /* f0 */ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 /* ff */
8.1113 + /* ------------------------------- */
8.1114 + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
8.1115 +};
8.1116 +
8.1117 +static const unsigned char twobyte_uses_SSE_prefix[256] = {
8.1118 + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
8.1119 + /* ------------------------------- */
8.1120 + /* 00 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0f */
8.1121 + /* 10 */ 1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0, /* 1f */
8.1122 + /* 20 */ 0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0, /* 2f */
8.1123 + /* 30 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 3f */
8.1124 + /* 40 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 4f */
8.1125 + /* 50 */ 0,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1, /* 5f */
8.1126 + /* 60 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1, /* 6f */
8.1127 + /* 70 */ 1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1, /* 7f */
8.1128 + /* 80 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 8f */
8.1129 + /* 90 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 9f */
8.1130 + /* a0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* af */
8.1131 + /* b0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* bf */
8.1132 + /* c0 */ 0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
8.1133 + /* d0 */ 1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* df */
8.1134 + /* e0 */ 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0, /* ef */
8.1135 + /* f0 */ 1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0 /* ff */
8.1136 + /* ------------------------------- */
8.1137 + /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
8.1138 +};
8.1139 +
8.1140 +static char obuf[100];
8.1141 +static char *obufp;
8.1142 +static char scratchbuf[100];
8.1143 +static unsigned char *start_codep;
8.1144 +static unsigned char *insn_codep;
8.1145 +static unsigned char *codep;
8.1146 +static disassemble_info *the_info;
8.1147 +static int mod;
8.1148 +static int rm;
8.1149 +static int reg;
8.1150 +static unsigned char need_modrm;
8.1151 +
8.1152 +/* If we are accessing mod/rm/reg without need_modrm set, then the
8.1153 + values are stale. Hitting this abort likely indicates that you
8.1154 + need to update onebyte_has_modrm or twobyte_has_modrm. */
8.1155 +#define MODRM_CHECK if (!need_modrm) abort ()
8.1156 +
8.1157 +static const char **names64;
8.1158 +static const char **names32;
8.1159 +static const char **names16;
8.1160 +static const char **names8;
8.1161 +static const char **names8rex;
8.1162 +static const char **names_seg;
8.1163 +static const char **index16;
8.1164 +
8.1165 +static const char *intel_names64[] = {
8.1166 + "rax", "rcx", "rdx", "rbx", "rsp", "rbp", "rsi", "rdi",
8.1167 + "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
8.1168 +};
8.1169 +static const char *intel_names32[] = {
8.1170 + "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
8.1171 + "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
8.1172 +};
8.1173 +static const char *intel_names16[] = {
8.1174 + "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
8.1175 + "r8w", "r9w", "r10w", "r11w", "r12w", "r13w", "r14w", "r15w"
8.1176 +};
8.1177 +static const char *intel_names8[] = {
8.1178 + "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
8.1179 +};
8.1180 +static const char *intel_names8rex[] = {
8.1181 + "al", "cl", "dl", "bl", "spl", "bpl", "sil", "dil",
8.1182 + "r8b", "r9b", "r10b", "r11b", "r12b", "r13b", "r14b", "r15b"
8.1183 +};
8.1184 +static const char *intel_names_seg[] = {
8.1185 + "es", "cs", "ss", "ds", "fs", "gs", "?", "?",
8.1186 +};
8.1187 +static const char *intel_index16[] = {
8.1188 + "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx"
8.1189 +};
8.1190 +
8.1191 +static const char *att_names64[] = {
8.1192 + "%rax", "%rcx", "%rdx", "%rbx", "%rsp", "%rbp", "%rsi", "%rdi",
8.1193 + "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15"
8.1194 +};
8.1195 +static const char *att_names32[] = {
8.1196 + "%eax", "%ecx", "%edx", "%ebx", "%esp", "%ebp", "%esi", "%edi",
8.1197 + "%r8d", "%r9d", "%r10d", "%r11d", "%r12d", "%r13d", "%r14d", "%r15d"
8.1198 +};
8.1199 +static const char *att_names16[] = {
8.1200 + "%ax", "%cx", "%dx", "%bx", "%sp", "%bp", "%si", "%di",
8.1201 + "%r8w", "%r9w", "%r10w", "%r11w", "%r12w", "%r13w", "%r14w", "%r15w"
8.1202 +};
8.1203 +static const char *att_names8[] = {
8.1204 + "%al", "%cl", "%dl", "%bl", "%ah", "%ch", "%dh", "%bh",
8.1205 +};
8.1206 +static const char *att_names8rex[] = {
8.1207 + "%al", "%cl", "%dl", "%bl", "%spl", "%bpl", "%sil", "%dil",
8.1208 + "%r8b", "%r9b", "%r10b", "%r11b", "%r12b", "%r13b", "%r14b", "%r15b"
8.1209 +};
8.1210 +static const char *att_names_seg[] = {
8.1211 + "%es", "%cs", "%ss", "%ds", "%fs", "%gs", "%?", "%?",
8.1212 +};
8.1213 +static const char *att_index16[] = {
8.1214 + "%bx,%si", "%bx,%di", "%bp,%si", "%bp,%di", "%si", "%di", "%bp", "%bx"
8.1215 +};
8.1216 +
8.1217 +static const struct dis386 grps[][8] = {
8.1218 + /* GRP1b */
8.1219 + {
8.1220 + { "addA", Eb, Ib, XX },
8.1221 + { "orA", Eb, Ib, XX },
8.1222 + { "adcA", Eb, Ib, XX },
8.1223 + { "sbbA", Eb, Ib, XX },
8.1224 + { "andA", Eb, Ib, XX },
8.1225 + { "subA", Eb, Ib, XX },
8.1226 + { "xorA", Eb, Ib, XX },
8.1227 + { "cmpA", Eb, Ib, XX }
8.1228 + },
8.1229 + /* GRP1S */
8.1230 + {
8.1231 + { "addQ", Ev, Iv, XX },
8.1232 + { "orQ", Ev, Iv, XX },
8.1233 + { "adcQ", Ev, Iv, XX },
8.1234 + { "sbbQ", Ev, Iv, XX },
8.1235 + { "andQ", Ev, Iv, XX },
8.1236 + { "subQ", Ev, Iv, XX },
8.1237 + { "xorQ", Ev, Iv, XX },
8.1238 + { "cmpQ", Ev, Iv, XX }
8.1239 + },
8.1240 + /* GRP1Ss */
8.1241 + {
8.1242 + { "addQ", Ev, sIb, XX },
8.1243 + { "orQ", Ev, sIb, XX },
8.1244 + { "adcQ", Ev, sIb, XX },
8.1245 + { "sbbQ", Ev, sIb, XX },
8.1246 + { "andQ", Ev, sIb, XX },
8.1247 + { "subQ", Ev, sIb, XX },
8.1248 + { "xorQ", Ev, sIb, XX },
8.1249 + { "cmpQ", Ev, sIb, XX }
8.1250 + },
8.1251 + /* GRP2b */
8.1252 + {
8.1253 + { "rolA", Eb, Ib, XX },
8.1254 + { "rorA", Eb, Ib, XX },
8.1255 + { "rclA", Eb, Ib, XX },
8.1256 + { "rcrA", Eb, Ib, XX },
8.1257 + { "shlA", Eb, Ib, XX },
8.1258 + { "shrA", Eb, Ib, XX },
8.1259 + { "(bad)", XX, XX, XX },
8.1260 + { "sarA", Eb, Ib, XX },
8.1261 + },
8.1262 + /* GRP2S */
8.1263 + {
8.1264 + { "rolQ", Ev, Ib, XX },
8.1265 + { "rorQ", Ev, Ib, XX },
8.1266 + { "rclQ", Ev, Ib, XX },
8.1267 + { "rcrQ", Ev, Ib, XX },
8.1268 + { "shlQ", Ev, Ib, XX },
8.1269 + { "shrQ", Ev, Ib, XX },
8.1270 + { "(bad)", XX, XX, XX },
8.1271 + { "sarQ", Ev, Ib, XX },
8.1272 + },
8.1273 + /* GRP2b_one */
8.1274 + {
8.1275 + { "rolA", Eb, I1, XX },
8.1276 + { "rorA", Eb, I1, XX },
8.1277 + { "rclA", Eb, I1, XX },
8.1278 + { "rcrA", Eb, I1, XX },
8.1279 + { "shlA", Eb, I1, XX },
8.1280 + { "shrA", Eb, I1, XX },
8.1281 + { "(bad)", XX, XX, XX },
8.1282 + { "sarA", Eb, I1, XX },
8.1283 + },
8.1284 + /* GRP2S_one */
8.1285 + {
8.1286 + { "rolQ", Ev, I1, XX },
8.1287 + { "rorQ", Ev, I1, XX },
8.1288 + { "rclQ", Ev, I1, XX },
8.1289 + { "rcrQ", Ev, I1, XX },
8.1290 + { "shlQ", Ev, I1, XX },
8.1291 + { "shrQ", Ev, I1, XX },
8.1292 + { "(bad)", XX, XX, XX},
8.1293 + { "sarQ", Ev, I1, XX },
8.1294 + },
8.1295 + /* GRP2b_cl */
8.1296 + {
8.1297 + { "rolA", Eb, CL, XX },
8.1298 + { "rorA", Eb, CL, XX },
8.1299 + { "rclA", Eb, CL, XX },
8.1300 + { "rcrA", Eb, CL, XX },
8.1301 + { "shlA", Eb, CL, XX },
8.1302 + { "shrA", Eb, CL, XX },
8.1303 + { "(bad)", XX, XX, XX },
8.1304 + { "sarA", Eb, CL, XX },
8.1305 + },
8.1306 + /* GRP2S_cl */
8.1307 + {
8.1308 + { "rolQ", Ev, CL, XX },
8.1309 + { "rorQ", Ev, CL, XX },
8.1310 + { "rclQ", Ev, CL, XX },
8.1311 + { "rcrQ", Ev, CL, XX },
8.1312 + { "shlQ", Ev, CL, XX },
8.1313 + { "shrQ", Ev, CL, XX },
8.1314 + { "(bad)", XX, XX, XX },
8.1315 + { "sarQ", Ev, CL, XX }
8.1316 + },
8.1317 + /* GRP3b */
8.1318 + {
8.1319 + { "testA", Eb, Ib, XX },
8.1320 + { "(bad)", Eb, XX, XX },
8.1321 + { "notA", Eb, XX, XX },
8.1322 + { "negA", Eb, XX, XX },
8.1323 + { "mulA", Eb, XX, XX }, /* Don't print the implicit %al register, */
8.1324 + { "imulA", Eb, XX, XX }, /* to distinguish these opcodes from other */
8.1325 + { "divA", Eb, XX, XX }, /* mul/imul opcodes. Do the same for div */
8.1326 + { "idivA", Eb, XX, XX } /* and idiv for consistency. */
8.1327 + },
8.1328 + /* GRP3S */
8.1329 + {
8.1330 + { "testQ", Ev, Iv, XX },
8.1331 + { "(bad)", XX, XX, XX },
8.1332 + { "notQ", Ev, XX, XX },
8.1333 + { "negQ", Ev, XX, XX },
8.1334 + { "mulQ", Ev, XX, XX }, /* Don't print the implicit register. */
8.1335 + { "imulQ", Ev, XX, XX },
8.1336 + { "divQ", Ev, XX, XX },
8.1337 + { "idivQ", Ev, XX, XX },
8.1338 + },
8.1339 + /* GRP4 */
8.1340 + {
8.1341 + { "incA", Eb, XX, XX },
8.1342 + { "decA", Eb, XX, XX },
8.1343 + { "(bad)", XX, XX, XX },
8.1344 + { "(bad)", XX, XX, XX },
8.1345 + { "(bad)", XX, XX, XX },
8.1346 + { "(bad)", XX, XX, XX },
8.1347 + { "(bad)", XX, XX, XX },
8.1348 + { "(bad)", XX, XX, XX },
8.1349 + },
8.1350 + /* GRP5 */
8.1351 + {
8.1352 + { "incQ", Ev, XX, XX },
8.1353 + { "decQ", Ev, XX, XX },
8.1354 + { "callT", indirEv, XX, XX },
8.1355 + { "JcallT", indirEp, XX, XX },
8.1356 + { "jmpT", indirEv, XX, XX },
8.1357 + { "JjmpT", indirEp, XX, XX },
8.1358 + { "pushU", Ev, XX, XX },
8.1359 + { "(bad)", XX, XX, XX },
8.1360 + },
8.1361 + /* GRP6 */
8.1362 + {
8.1363 + { "sldtQ", Ev, XX, XX },
8.1364 + { "strQ", Ev, XX, XX },
8.1365 + { "lldt", Ew, XX, XX },
8.1366 + { "ltr", Ew, XX, XX },
8.1367 + { "verr", Ew, XX, XX },
8.1368 + { "verw", Ew, XX, XX },
8.1369 + { "(bad)", XX, XX, XX },
8.1370 + { "(bad)", XX, XX, XX }
8.1371 + },
8.1372 + /* GRP7 */
8.1373 + {
8.1374 + { "sgdtIQ", M, XX, XX },
8.1375 + { "sidtIQ", PNI_Fixup, 0, XX, XX },
8.1376 + { "lgdt{Q|Q||}", M, XX, XX },
8.1377 + { "lidt{Q|Q||}", M, XX, XX },
8.1378 + { "smswQ", Ev, XX, XX },
8.1379 + { "(bad)", XX, XX, XX },
8.1380 + { "lmsw", Ew, XX, XX },
8.1381 + { "invlpg", INVLPG_Fixup, w_mode, XX, XX },
8.1382 + },
8.1383 + /* GRP8 */
8.1384 + {
8.1385 + { "(bad)", XX, XX, XX },
8.1386 + { "(bad)", XX, XX, XX },
8.1387 + { "(bad)", XX, XX, XX },
8.1388 + { "(bad)", XX, XX, XX },
8.1389 + { "btQ", Ev, Ib, XX },
8.1390 + { "btsQ", Ev, Ib, XX },
8.1391 + { "btrQ", Ev, Ib, XX },
8.1392 + { "btcQ", Ev, Ib, XX },
8.1393 + },
8.1394 + /* GRP9 */
8.1395 + {
8.1396 + { "(bad)", XX, XX, XX },
8.1397 + { "cmpxchg8b", Eq, XX, XX },
8.1398 + { "(bad)", XX, XX, XX },
8.1399 + { "(bad)", XX, XX, XX },
8.1400 + { "(bad)", XX, XX, XX },
8.1401 + { "(bad)", XX, XX, XX },
8.1402 + { "(bad)", XX, XX, XX },
8.1403 + { "(bad)", XX, XX, XX },
8.1404 + },
8.1405 + /* GRP10 */
8.1406 + {
8.1407 + { "(bad)", XX, XX, XX },
8.1408 + { "(bad)", XX, XX, XX },
8.1409 + { "psrlw", MS, Ib, XX },
8.1410 + { "(bad)", XX, XX, XX },
8.1411 + { "psraw", MS, Ib, XX },
8.1412 + { "(bad)", XX, XX, XX },
8.1413 + { "psllw", MS, Ib, XX },
8.1414 + { "(bad)", XX, XX, XX },
8.1415 + },
8.1416 + /* GRP11 */
8.1417 + {
8.1418 + { "(bad)", XX, XX, XX },
8.1419 + { "(bad)", XX, XX, XX },
8.1420 + { "psrld", MS, Ib, XX },
8.1421 + { "(bad)", XX, XX, XX },
8.1422 + { "psrad", MS, Ib, XX },
8.1423 + { "(bad)", XX, XX, XX },
8.1424 + { "pslld", MS, Ib, XX },
8.1425 + { "(bad)", XX, XX, XX },
8.1426 + },
8.1427 + /* GRP12 */
8.1428 + {
8.1429 + { "(bad)", XX, XX, XX },
8.1430 + { "(bad)", XX, XX, XX },
8.1431 + { "psrlq", MS, Ib, XX },
8.1432 + { "psrldq", MS, Ib, XX },
8.1433 + { "(bad)", XX, XX, XX },
8.1434 + { "(bad)", XX, XX, XX },
8.1435 + { "psllq", MS, Ib, XX },
8.1436 + { "pslldq", MS, Ib, XX },
8.1437 + },
8.1438 + /* GRP13 */
8.1439 + {
8.1440 + { "fxsave", Ev, XX, XX },
8.1441 + { "fxrstor", Ev, XX, XX },
8.1442 + { "ldmxcsr", Ev, XX, XX },
8.1443 + { "stmxcsr", Ev, XX, XX },
8.1444 + { "(bad)", XX, XX, XX },
8.1445 + { "lfence", OP_0fae, 0, XX, XX },
8.1446 + { "mfence", OP_0fae, 0, XX, XX },
8.1447 + { "clflush", OP_0fae, 0, XX, XX },
8.1448 + },
8.1449 + /* GRP14 */
8.1450 + {
8.1451 + { "prefetchnta", Ev, XX, XX },
8.1452 + { "prefetcht0", Ev, XX, XX },
8.1453 + { "prefetcht1", Ev, XX, XX },
8.1454 + { "prefetcht2", Ev, XX, XX },
8.1455 + { "(bad)", XX, XX, XX },
8.1456 + { "(bad)", XX, XX, XX },
8.1457 + { "(bad)", XX, XX, XX },
8.1458 + { "(bad)", XX, XX, XX },
8.1459 + },
8.1460 + /* GRPAMD */
8.1461 + {
8.1462 + { "prefetch", Eb, XX, XX },
8.1463 + { "prefetchw", Eb, XX, XX },
8.1464 + { "(bad)", XX, XX, XX },
8.1465 + { "(bad)", XX, XX, XX },
8.1466 + { "(bad)", XX, XX, XX },
8.1467 + { "(bad)", XX, XX, XX },
8.1468 + { "(bad)", XX, XX, XX },
8.1469 + { "(bad)", XX, XX, XX },
8.1470 + },
8.1471 + /* GRPPADLCK1 */
8.1472 + {
8.1473 + { "xstorerng", OP_0f07, 0, XX, XX },
8.1474 + { "xcryptecb", OP_0f07, 0, XX, XX },
8.1475 + { "xcryptcbc", OP_0f07, 0, XX, XX },
8.1476 + { "(bad)", OP_0f07, 0, XX, XX },
8.1477 + { "xcryptcfb", OP_0f07, 0, XX, XX },
8.1478 + { "xcryptofb", OP_0f07, 0, XX, XX },
8.1479 + { "(bad)", OP_0f07, 0, XX, XX },
8.1480 + { "(bad)", OP_0f07, 0, XX, XX },
8.1481 + },
8.1482 + /* GRPPADLCK2 */
8.1483 + {
8.1484 + { "montmul", OP_0f07, 0, XX, XX },
8.1485 + { "xsha1", OP_0f07, 0, XX, XX },
8.1486 + { "xsha256", OP_0f07, 0, XX, XX },
8.1487 + { "(bad)", OP_0f07, 0, XX, XX },
8.1488 + { "(bad)", OP_0f07, 0, XX, XX },
8.1489 + { "(bad)", OP_0f07, 0, XX, XX },
8.1490 + { "(bad)", OP_0f07, 0, XX, XX },
8.1491 + { "(bad)", OP_0f07, 0, XX, XX },
8.1492 + }
8.1493 +};
8.1494 +
8.1495 +static const struct dis386 prefix_user_table[][4] = {
8.1496 + /* PREGRP0 */
8.1497 + {
8.1498 + { "addps", XM, EX, XX },
8.1499 + { "addss", XM, EX, XX },
8.1500 + { "addpd", XM, EX, XX },
8.1501 + { "addsd", XM, EX, XX },
8.1502 + },
8.1503 + /* PREGRP1 */
8.1504 + {
8.1505 + { "", XM, EX, OPSIMD }, /* See OP_SIMD_SUFFIX. */
8.1506 + { "", XM, EX, OPSIMD },
8.1507 + { "", XM, EX, OPSIMD },
8.1508 + { "", XM, EX, OPSIMD },
8.1509 + },
8.1510 + /* PREGRP2 */
8.1511 + {
8.1512 + { "cvtpi2ps", XM, EM, XX },
8.1513 + { "cvtsi2ssY", XM, Ev, XX },
8.1514 + { "cvtpi2pd", XM, EM, XX },
8.1515 + { "cvtsi2sdY", XM, Ev, XX },
8.1516 + },
8.1517 + /* PREGRP3 */
8.1518 + {
8.1519 + { "cvtps2pi", MX, EX, XX },
8.1520 + { "cvtss2siY", Gv, EX, XX },
8.1521 + { "cvtpd2pi", MX, EX, XX },
8.1522 + { "cvtsd2siY", Gv, EX, XX },
8.1523 + },
8.1524 + /* PREGRP4 */
8.1525 + {
8.1526 + { "cvttps2pi", MX, EX, XX },
8.1527 + { "cvttss2siY", Gv, EX, XX },
8.1528 + { "cvttpd2pi", MX, EX, XX },
8.1529 + { "cvttsd2siY", Gv, EX, XX },
8.1530 + },
8.1531 + /* PREGRP5 */
8.1532 + {
8.1533 + { "divps", XM, EX, XX },
8.1534 + { "divss", XM, EX, XX },
8.1535 + { "divpd", XM, EX, XX },
8.1536 + { "divsd", XM, EX, XX },
8.1537 + },
8.1538 + /* PREGRP6 */
8.1539 + {
8.1540 + { "maxps", XM, EX, XX },
8.1541 + { "maxss", XM, EX, XX },
8.1542 + { "maxpd", XM, EX, XX },
8.1543 + { "maxsd", XM, EX, XX },
8.1544 + },
8.1545 + /* PREGRP7 */
8.1546 + {
8.1547 + { "minps", XM, EX, XX },
8.1548 + { "minss", XM, EX, XX },
8.1549 + { "minpd", XM, EX, XX },
8.1550 + { "minsd", XM, EX, XX },
8.1551 + },
8.1552 + /* PREGRP8 */
8.1553 + {
8.1554 + { "movups", XM, EX, XX },
8.1555 + { "movss", XM, EX, XX },
8.1556 + { "movupd", XM, EX, XX },
8.1557 + { "movsd", XM, EX, XX },
8.1558 + },
8.1559 + /* PREGRP9 */
8.1560 + {
8.1561 + { "movups", EX, XM, XX },
8.1562 + { "movss", EX, XM, XX },
8.1563 + { "movupd", EX, XM, XX },
8.1564 + { "movsd", EX, XM, XX },
8.1565 + },
8.1566 + /* PREGRP10 */
8.1567 + {
8.1568 + { "mulps", XM, EX, XX },
8.1569 + { "mulss", XM, EX, XX },
8.1570 + { "mulpd", XM, EX, XX },
8.1571 + { "mulsd", XM, EX, XX },
8.1572 + },
8.1573 + /* PREGRP11 */
8.1574 + {
8.1575 + { "rcpps", XM, EX, XX },
8.1576 + { "rcpss", XM, EX, XX },
8.1577 + { "(bad)", XM, EX, XX },
8.1578 + { "(bad)", XM, EX, XX },
8.1579 + },
8.1580 + /* PREGRP12 */
8.1581 + {
8.1582 + { "rsqrtps", XM, EX, XX },
8.1583 + { "rsqrtss", XM, EX, XX },
8.1584 + { "(bad)", XM, EX, XX },
8.1585 + { "(bad)", XM, EX, XX },
8.1586 + },
8.1587 + /* PREGRP13 */
8.1588 + {
8.1589 + { "sqrtps", XM, EX, XX },
8.1590 + { "sqrtss", XM, EX, XX },
8.1591 + { "sqrtpd", XM, EX, XX },
8.1592 + { "sqrtsd", XM, EX, XX },
8.1593 + },
8.1594 + /* PREGRP14 */
8.1595 + {
8.1596 + { "subps", XM, EX, XX },
8.1597 + { "subss", XM, EX, XX },
8.1598 + { "subpd", XM, EX, XX },
8.1599 + { "subsd", XM, EX, XX },
8.1600 + },
8.1601 + /* PREGRP15 */
8.1602 + {
8.1603 + { "(bad)", XM, EX, XX },
8.1604 + { "cvtdq2pd", XM, EX, XX },
8.1605 + { "cvttpd2dq", XM, EX, XX },
8.1606 + { "cvtpd2dq", XM, EX, XX },
8.1607 + },
8.1608 + /* PREGRP16 */
8.1609 + {
8.1610 + { "cvtdq2ps", XM, EX, XX },
8.1611 + { "cvttps2dq",XM, EX, XX },
8.1612 + { "cvtps2dq",XM, EX, XX },
8.1613 + { "(bad)", XM, EX, XX },
8.1614 + },
8.1615 + /* PREGRP17 */
8.1616 + {
8.1617 + { "cvtps2pd", XM, EX, XX },
8.1618 + { "cvtss2sd", XM, EX, XX },
8.1619 + { "cvtpd2ps", XM, EX, XX },
8.1620 + { "cvtsd2ss", XM, EX, XX },
8.1621 + },
8.1622 + /* PREGRP18 */
8.1623 + {
8.1624 + { "maskmovq", MX, MS, XX },
8.1625 + { "(bad)", XM, EX, XX },
8.1626 + { "maskmovdqu", XM, EX, XX },
8.1627 + { "(bad)", XM, EX, XX },
8.1628 + },
8.1629 + /* PREGRP19 */
8.1630 + {
8.1631 + { "movq", MX, EM, XX },
8.1632 + { "movdqu", XM, EX, XX },
8.1633 + { "movdqa", XM, EX, XX },
8.1634 + { "(bad)", XM, EX, XX },
8.1635 + },
8.1636 + /* PREGRP20 */
8.1637 + {
8.1638 + { "movq", EM, MX, XX },
8.1639 + { "movdqu", EX, XM, XX },
8.1640 + { "movdqa", EX, XM, XX },
8.1641 + { "(bad)", EX, XM, XX },
8.1642 + },
8.1643 + /* PREGRP21 */
8.1644 + {
8.1645 + { "(bad)", EX, XM, XX },
8.1646 + { "movq2dq", XM, MS, XX },
8.1647 + { "movq", EX, XM, XX },
8.1648 + { "movdq2q", MX, XS, XX },
8.1649 + },
8.1650 + /* PREGRP22 */
8.1651 + {
8.1652 + { "pshufw", MX, EM, Ib },
8.1653 + { "pshufhw", XM, EX, Ib },
8.1654 + { "pshufd", XM, EX, Ib },
8.1655 + { "pshuflw", XM, EX, Ib },
8.1656 + },
8.1657 + /* PREGRP23 */
8.1658 + {
8.1659 + { "movd", Edq, MX, XX },
8.1660 + { "movq", XM, EX, XX },
8.1661 + { "movd", Edq, XM, XX },
8.1662 + { "(bad)", Ed, XM, XX },
8.1663 + },
8.1664 + /* PREGRP24 */
8.1665 + {
8.1666 + { "(bad)", MX, EX, XX },
8.1667 + { "(bad)", XM, EX, XX },
8.1668 + { "punpckhqdq", XM, EX, XX },
8.1669 + { "(bad)", XM, EX, XX },
8.1670 + },
8.1671 + /* PREGRP25 */
8.1672 + {
8.1673 + { "movntq", EM, MX, XX },
8.1674 + { "(bad)", EM, XM, XX },
8.1675 + { "movntdq", EM, XM, XX },
8.1676 + { "(bad)", EM, XM, XX },
8.1677 + },
8.1678 + /* PREGRP26 */
8.1679 + {
8.1680 + { "(bad)", MX, EX, XX },
8.1681 + { "(bad)", XM, EX, XX },
8.1682 + { "punpcklqdq", XM, EX, XX },
8.1683 + { "(bad)", XM, EX, XX },
8.1684 + },
8.1685 + /* PREGRP27 */
8.1686 + {
8.1687 + { "(bad)", MX, EX, XX },
8.1688 + { "(bad)", XM, EX, XX },
8.1689 + { "addsubpd", XM, EX, XX },
8.1690 + { "addsubps", XM, EX, XX },
8.1691 + },
8.1692 + /* PREGRP28 */
8.1693 + {
8.1694 + { "(bad)", MX, EX, XX },
8.1695 + { "(bad)", XM, EX, XX },
8.1696 + { "haddpd", XM, EX, XX },
8.1697 + { "haddps", XM, EX, XX },
8.1698 + },
8.1699 + /* PREGRP29 */
8.1700 + {
8.1701 + { "(bad)", MX, EX, XX },
8.1702 + { "(bad)", XM, EX, XX },
8.1703 + { "hsubpd", XM, EX, XX },
8.1704 + { "hsubps", XM, EX, XX },
8.1705 + },
8.1706 + /* PREGRP30 */
8.1707 + {
8.1708 + { "movlpX", XM, EX, SIMD_Fixup, 'h' }, /* really only 2 operands */
8.1709 + { "movsldup", XM, EX, XX },
8.1710 + { "movlpd", XM, EX, XX },
8.1711 + { "movddup", XM, EX, XX },
8.1712 + },
8.1713 + /* PREGRP31 */
8.1714 + {
8.1715 + { "movhpX", XM, EX, SIMD_Fixup, 'l' },
8.1716 + { "movshdup", XM, EX, XX },
8.1717 + { "movhpd", XM, EX, XX },
8.1718 + { "(bad)", XM, EX, XX },
8.1719 + },
8.1720 + /* PREGRP32 */
8.1721 + {
8.1722 + { "(bad)", XM, EX, XX },
8.1723 + { "(bad)", XM, EX, XX },
8.1724 + { "(bad)", XM, EX, XX },
8.1725 + { "lddqu", XM, M, XX },
8.1726 + },
8.1727 +};
8.1728 +
8.1729 +static const struct dis386 x86_64_table[][2] = {
8.1730 + {
8.1731 + { "arpl", Ew, Gw, XX },
8.1732 + { "movs{||lq|xd}", Gv, Ed, XX },
8.1733 + },
8.1734 +};
8.1735 +
8.1736 +#define INTERNAL_DISASSEMBLER_ERROR _("<internal disassembler error>")
8.1737 +
8.1738 +static void
8.1739 +ckprefix (void)
8.1740 +{
8.1741 + int newrex;
8.1742 + rex = 0;
8.1743 + prefixes = 0;
8.1744 + used_prefixes = 0;
8.1745 + rex_used = 0;
8.1746 + while (1)
8.1747 + {
8.1748 + FETCH_DATA (the_info, codep + 1);
8.1749 + newrex = 0;
8.1750 + switch (*codep)
8.1751 + {
8.1752 + /* REX prefixes family. */
8.1753 + case 0x40:
8.1754 + case 0x41:
8.1755 + case 0x42:
8.1756 + case 0x43:
8.1757 + case 0x44:
8.1758 + case 0x45:
8.1759 + case 0x46:
8.1760 + case 0x47:
8.1761 + case 0x48:
8.1762 + case 0x49:
8.1763 + case 0x4a:
8.1764 + case 0x4b:
8.1765 + case 0x4c:
8.1766 + case 0x4d:
8.1767 + case 0x4e:
8.1768 + case 0x4f:
8.1769 + if (mode_64bit)
8.1770 + newrex = *codep;
8.1771 + else
8.1772 + return;
8.1773 + break;
8.1774 + case 0xf3:
8.1775 + prefixes |= PREFIX_REPZ;
8.1776 + break;
8.1777 + case 0xf2:
8.1778 + prefixes |= PREFIX_REPNZ;
8.1779 + break;
8.1780 + case 0xf0:
8.1781 + prefixes |= PREFIX_LOCK;
8.1782 + break;
8.1783 + case 0x2e:
8.1784 + prefixes |= PREFIX_CS;
8.1785 + break;
8.1786 + case 0x36:
8.1787 + prefixes |= PREFIX_SS;
8.1788 + break;
8.1789 + case 0x3e:
8.1790 + prefixes |= PREFIX_DS;
8.1791 + break;
8.1792 + case 0x26:
8.1793 + prefixes |= PREFIX_ES;
8.1794 + break;
8.1795 + case 0x64:
8.1796 + prefixes |= PREFIX_FS;
8.1797 + break;
8.1798 + case 0x65:
8.1799 + prefixes |= PREFIX_GS;
8.1800 + break;
8.1801 + case 0x66:
8.1802 + prefixes |= PREFIX_DATA;
8.1803 + break;
8.1804 + case 0x67:
8.1805 + prefixes |= PREFIX_ADDR;
8.1806 + break;
8.1807 + case FWAIT_OPCODE:
8.1808 + /* fwait is really an instruction. If there are prefixes
8.1809 + before the fwait, they belong to the fwait, *not* to the
8.1810 + following instruction. */
8.1811 + if (prefixes)
8.1812 + {
8.1813 + prefixes |= PREFIX_FWAIT;
8.1814 + codep++;
8.1815 + return;
8.1816 + }
8.1817 + prefixes = PREFIX_FWAIT;
8.1818 + break;
8.1819 + default:
8.1820 + return;
8.1821 + }
8.1822 + /* Rex is ignored when followed by another prefix. */
8.1823 + if (rex)
8.1824 + {
8.1825 + oappend (prefix_name (rex, 0));
8.1826 + oappend (" ");
8.1827 + }
8.1828 + rex = newrex;
8.1829 + codep++;
8.1830 + }
8.1831 +}
8.1832 +
8.1833 +/* Return the name of the prefix byte PREF, or NULL if PREF is not a
8.1834 + prefix byte. */
8.1835 +
8.1836 +static const char *
8.1837 +prefix_name (int pref, int sizeflag)
8.1838 +{
8.1839 + switch (pref)
8.1840 + {
8.1841 + /* REX prefixes family. */
8.1842 + case 0x40:
8.1843 + return "rex";
8.1844 + case 0x41:
8.1845 + return "rexZ";
8.1846 + case 0x42:
8.1847 + return "rexY";
8.1848 + case 0x43:
8.1849 + return "rexYZ";
8.1850 + case 0x44:
8.1851 + return "rexX";
8.1852 + case 0x45:
8.1853 + return "rexXZ";
8.1854 + case 0x46:
8.1855 + return "rexXY";
8.1856 + case 0x47:
8.1857 + return "rexXYZ";
8.1858 + case 0x48:
8.1859 + return "rex64";
8.1860 + case 0x49:
8.1861 + return "rex64Z";
8.1862 + case 0x4a:
8.1863 + return "rex64Y";
8.1864 + case 0x4b:
8.1865 + return "rex64YZ";
8.1866 + case 0x4c:
8.1867 + return "rex64X";
8.1868 + case 0x4d:
8.1869 + return "rex64XZ";
8.1870 + case 0x4e:
8.1871 + return "rex64XY";
8.1872 + case 0x4f:
8.1873 + return "rex64XYZ";
8.1874 + case 0xf3:
8.1875 + return "repz";
8.1876 + case 0xf2:
8.1877 + return "repnz";
8.1878 + case 0xf0:
8.1879 + return "lock";
8.1880 + case 0x2e:
8.1881 + return "cs";
8.1882 + case 0x36:
8.1883 + return "ss";
8.1884 + case 0x3e:
8.1885 + return "ds";
8.1886 + case 0x26:
8.1887 + return "es";
8.1888 + case 0x64:
8.1889 + return "fs";
8.1890 + case 0x65:
8.1891 + return "gs";
8.1892 + case 0x66:
8.1893 + return (sizeflag & DFLAG) ? "data16" : "data32";
8.1894 + case 0x67:
8.1895 + if (mode_64bit)
8.1896 + return (sizeflag & AFLAG) ? "addr32" : "addr64";
8.1897 + else
8.1898 + return ((sizeflag & AFLAG) && !mode_64bit) ? "addr16" : "addr32";
8.1899 + case FWAIT_OPCODE:
8.1900 + return "fwait";
8.1901 + default:
8.1902 + return NULL;
8.1903 + }
8.1904 +}
8.1905 +
8.1906 +static char op1out[100], op2out[100], op3out[100];
8.1907 +static int op_ad, op_index[3];
8.1908 +static int two_source_ops;
8.1909 +static bfd_vma op_address[3];
8.1910 +static bfd_vma op_riprel[3];
8.1911 +static bfd_vma start_pc;
8.1912 +
8.1913 +/*
8.1914 + * On the 386's of 1988, the maximum length of an instruction is 15 bytes.
8.1915 + * (see topic "Redundant prefixes" in the "Differences from 8086"
8.1916 + * section of the "Virtual 8086 Mode" chapter.)
8.1917 + * 'pc' should be the address of this instruction, it will
8.1918 + * be used to print the target address if this is a relative jump or call
8.1919 + * The function returns the length of this instruction in bytes.
8.1920 + */
8.1921 +
8.1922 +static char intel_syntax;
8.1923 +static char open_char;
8.1924 +static char close_char;
8.1925 +static char separator_char;
8.1926 +static char scale_char;
8.1927 +
8.1928 +/* Here for backwards compatibility. When gdb stops using
8.1929 + print_insn_i386_att and print_insn_i386_intel these functions can
8.1930 + disappear, and print_insn_i386 be merged into print_insn. */
8.1931 +int
8.1932 +print_insn_i386_att (bfd_vma pc, disassemble_info *info)
8.1933 +{
8.1934 + intel_syntax = 0;
8.1935 +
8.1936 + return print_insn (pc, info);
8.1937 +}
8.1938 +
8.1939 +int
8.1940 +print_insn_i386_intel (bfd_vma pc, disassemble_info *info)
8.1941 +{
8.1942 + intel_syntax = 1;
8.1943 +
8.1944 + return print_insn (pc, info);
8.1945 +}
8.1946 +
8.1947 +int
8.1948 +print_insn_i386 (bfd_vma pc, disassemble_info *info)
8.1949 +{
8.1950 + intel_syntax = -1;
8.1951 +
8.1952 + return print_insn (pc, info);
8.1953 +}
8.1954 +
8.1955 +static int
8.1956 +print_insn (bfd_vma pc, disassemble_info *info)
8.1957 +{
8.1958 + const struct dis386 *dp;
8.1959 + int i;
8.1960 + char *first, *second, *third;
8.1961 + int needcomma;
8.1962 + unsigned char uses_SSE_prefix, uses_LOCK_prefix;
8.1963 + int sizeflag;
8.1964 + const char *p;
8.1965 + struct dis_private priv;
8.1966 +
8.1967 + mode_64bit = (info->mach == bfd_mach_x86_64_intel_syntax
8.1968 + || info->mach == bfd_mach_x86_64);
8.1969 +
8.1970 + if (intel_syntax == (char) -1)
8.1971 + intel_syntax = (info->mach == bfd_mach_i386_i386_intel_syntax
8.1972 + || info->mach == bfd_mach_x86_64_intel_syntax);
8.1973 +
8.1974 + if (info->mach == bfd_mach_i386_i386
8.1975 + || info->mach == bfd_mach_x86_64
8.1976 + || info->mach == bfd_mach_i386_i386_intel_syntax
8.1977 + || info->mach == bfd_mach_x86_64_intel_syntax)
8.1978 + priv.orig_sizeflag = AFLAG | DFLAG;
8.1979 + else if (info->mach == bfd_mach_i386_i8086)
8.1980 + priv.orig_sizeflag = 0;
8.1981 + else
8.1982 + abort ();
8.1983 +
8.1984 + for (p = info->disassembler_options; p != NULL; )
8.1985 + {
8.1986 + if (strncmp (p, "x86-64", 6) == 0)
8.1987 + {
8.1988 + mode_64bit = 1;
8.1989 + priv.orig_sizeflag = AFLAG | DFLAG;
8.1990 + }
8.1991 + else if (strncmp (p, "i386", 4) == 0)
8.1992 + {
8.1993 + mode_64bit = 0;
8.1994 + priv.orig_sizeflag = AFLAG | DFLAG;
8.1995 + }
8.1996 + else if (strncmp (p, "i8086", 5) == 0)
8.1997 + {
8.1998 + mode_64bit = 0;
8.1999 + priv.orig_sizeflag = 0;
8.2000 + }
8.2001 + else if (strncmp (p, "intel", 5) == 0)
8.2002 + {
8.2003 + intel_syntax = 1;
8.2004 + }
8.2005 + else if (strncmp (p, "att", 3) == 0)
8.2006 + {
8.2007 + intel_syntax = 0;
8.2008 + }
8.2009 + else if (strncmp (p, "addr", 4) == 0)
8.2010 + {
8.2011 + if (p[4] == '1' && p[5] == '6')
8.2012 + priv.orig_sizeflag &= ~AFLAG;
8.2013 + else if (p[4] == '3' && p[5] == '2')
8.2014 + priv.orig_sizeflag |= AFLAG;
8.2015 + }
8.2016 + else if (strncmp (p, "data", 4) == 0)
8.2017 + {
8.2018 + if (p[4] == '1' && p[5] == '6')
8.2019 + priv.orig_sizeflag &= ~DFLAG;
8.2020 + else if (p[4] == '3' && p[5] == '2')
8.2021 + priv.orig_sizeflag |= DFLAG;
8.2022 + }
8.2023 + else if (strncmp (p, "suffix", 6) == 0)
8.2024 + priv.orig_sizeflag |= SUFFIX_ALWAYS;
8.2025 +
8.2026 + p = strchr (p, ',');
8.2027 + if (p != NULL)
8.2028 + p++;
8.2029 + }
8.2030 +
8.2031 + if (intel_syntax)
8.2032 + {
8.2033 + names64 = intel_names64;
8.2034 + names32 = intel_names32;
8.2035 + names16 = intel_names16;
8.2036 + names8 = intel_names8;
8.2037 + names8rex = intel_names8rex;
8.2038 + names_seg = intel_names_seg;
8.2039 + index16 = intel_index16;
8.2040 + open_char = '[';
8.2041 + close_char = ']';
8.2042 + separator_char = '+';
8.2043 + scale_char = '*';
8.2044 + }
8.2045 + else
8.2046 + {
8.2047 + names64 = att_names64;
8.2048 + names32 = att_names32;
8.2049 + names16 = att_names16;
8.2050 + names8 = att_names8;
8.2051 + names8rex = att_names8rex;
8.2052 + names_seg = att_names_seg;
8.2053 + index16 = att_index16;
8.2054 + open_char = '(';
8.2055 + close_char = ')';
8.2056 + separator_char = ',';
8.2057 + scale_char = ',';
8.2058 + }
8.2059 +
8.2060 + /* The output looks better if we put 7 bytes on a line, since that
8.2061 + puts most long word instructions on a single line. */
8.2062 + info->bytes_per_line = 7;
8.2063 +
8.2064 + info->private_data = &priv;
8.2065 + priv.max_fetched = priv.the_buffer;
8.2066 + priv.insn_start = pc;
8.2067 +
8.2068 + obuf[0] = 0;
8.2069 + op1out[0] = 0;
8.2070 + op2out[0] = 0;
8.2071 + op3out[0] = 0;
8.2072 +
8.2073 + op_index[0] = op_index[1] = op_index[2] = -1;
8.2074 +
8.2075 + the_info = info;
8.2076 + start_pc = pc;
8.2077 + start_codep = priv.the_buffer;
8.2078 + codep = priv.the_buffer;
8.2079 +
8.2080 + if (setjmp (priv.bailout) != 0)
8.2081 + {
8.2082 + const char *name;
8.2083 +
8.2084 + /* Getting here means we tried for data but didn't get it. That
8.2085 + means we have an incomplete instruction of some sort. Just
8.2086 + print the first byte as a prefix or a .byte pseudo-op. */
8.2087 + if (codep > priv.the_buffer)
8.2088 + {
8.2089 + name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
8.2090 + if (name != NULL)
8.2091 + (*info->fprintf_func) (info->stream, "%s", name);
8.2092 + else
8.2093 + {
8.2094 + /* Just print the first byte as a .byte instruction. */
8.2095 + (*info->fprintf_func) (info->stream, ".byte 0x%x",
8.2096 + (unsigned int) priv.the_buffer[0]);
8.2097 + }
8.2098 +
8.2099 + return 1;
8.2100 + }
8.2101 +
8.2102 + return -1;
8.2103 + }
8.2104 +
8.2105 + obufp = obuf;
8.2106 + ckprefix ();
8.2107 +
8.2108 + insn_codep = codep;
8.2109 + sizeflag = priv.orig_sizeflag;
8.2110 +
8.2111 + FETCH_DATA (info, codep + 1);
8.2112 + two_source_ops = (*codep == 0x62) || (*codep == 0xc8);
8.2113 +
8.2114 + if ((prefixes & PREFIX_FWAIT)
8.2115 + && ((*codep < 0xd8) || (*codep > 0xdf)))
8.2116 + {
8.2117 + const char *name;
8.2118 +
8.2119 + /* fwait not followed by floating point instruction. Print the
8.2120 + first prefix, which is probably fwait itself. */
8.2121 + name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
8.2122 + if (name == NULL)
8.2123 + name = INTERNAL_DISASSEMBLER_ERROR;
8.2124 + (*info->fprintf_func) (info->stream, "%s", name);
8.2125 + return 1;
8.2126 + }
8.2127 +
8.2128 + if (*codep == 0x0f)
8.2129 + {
8.2130 + FETCH_DATA (info, codep + 2);
8.2131 + dp = &dis386_twobyte[*++codep];
8.2132 + need_modrm = twobyte_has_modrm[*codep];
8.2133 + uses_SSE_prefix = twobyte_uses_SSE_prefix[*codep];
8.2134 + uses_LOCK_prefix = (*codep & ~0x02) == 0x20;
8.2135 + }
8.2136 + else
8.2137 + {
8.2138 + dp = &dis386[*codep];
8.2139 + need_modrm = onebyte_has_modrm[*codep];
8.2140 + uses_SSE_prefix = 0;
8.2141 + uses_LOCK_prefix = 0;
8.2142 + }
8.2143 + codep++;
8.2144 +
8.2145 + if (!uses_SSE_prefix && (prefixes & PREFIX_REPZ))
8.2146 + {
8.2147 + oappend ("repz ");
8.2148 + used_prefixes |= PREFIX_REPZ;
8.2149 + }
8.2150 + if (!uses_SSE_prefix && (prefixes & PREFIX_REPNZ))
8.2151 + {
8.2152 + oappend ("repnz ");
8.2153 + used_prefixes |= PREFIX_REPNZ;
8.2154 + }
8.2155 + if (!uses_LOCK_prefix && (prefixes & PREFIX_LOCK))
8.2156 + {
8.2157 + oappend ("lock ");
8.2158 + used_prefixes |= PREFIX_LOCK;
8.2159 + }
8.2160 +
8.2161 + if (prefixes & PREFIX_ADDR)
8.2162 + {
8.2163 + sizeflag ^= AFLAG;
8.2164 + if (dp->bytemode3 != loop_jcxz_mode || intel_syntax)
8.2165 + {
8.2166 + if ((sizeflag & AFLAG) || mode_64bit)
8.2167 + oappend ("addr32 ");
8.2168 + else
8.2169 + oappend ("addr16 ");
8.2170 + used_prefixes |= PREFIX_ADDR;
8.2171 + }
8.2172 + }
8.2173 +
8.2174 + if (!uses_SSE_prefix && (prefixes & PREFIX_DATA))
8.2175 + {
8.2176 + sizeflag ^= DFLAG;
8.2177 + if (dp->bytemode3 == cond_jump_mode
8.2178 + && dp->bytemode1 == v_mode
8.2179 + && !intel_syntax)
8.2180 + {
8.2181 + if (sizeflag & DFLAG)
8.2182 + oappend ("data32 ");
8.2183 + else
8.2184 + oappend ("data16 ");
8.2185 + used_prefixes |= PREFIX_DATA;
8.2186 + }
8.2187 + }
8.2188 +
8.2189 + if (need_modrm)
8.2190 + {
8.2191 + FETCH_DATA (info, codep + 1);
8.2192 + mod = (*codep >> 6) & 3;
8.2193 + reg = (*codep >> 3) & 7;
8.2194 + rm = *codep & 7;
8.2195 + }
8.2196 +
8.2197 + if (dp->name == NULL && dp->bytemode1 == FLOATCODE)
8.2198 + {
8.2199 + dofloat (sizeflag);
8.2200 + }
8.2201 + else
8.2202 + {
8.2203 + int index;
8.2204 + if (dp->name == NULL)
8.2205 + {
8.2206 + switch (dp->bytemode1)
8.2207 + {
8.2208 + case USE_GROUPS:
8.2209 + dp = &grps[dp->bytemode2][reg];
8.2210 + break;
8.2211 +
8.2212 + case USE_PREFIX_USER_TABLE:
8.2213 + index = 0;
8.2214 + used_prefixes |= (prefixes & PREFIX_REPZ);
8.2215 + if (prefixes & PREFIX_REPZ)
8.2216 + index = 1;
8.2217 + else
8.2218 + {
8.2219 + used_prefixes |= (prefixes & PREFIX_DATA);
8.2220 + if (prefixes & PREFIX_DATA)
8.2221 + index = 2;
8.2222 + else
8.2223 + {
8.2224 + used_prefixes |= (prefixes & PREFIX_REPNZ);
8.2225 + if (prefixes & PREFIX_REPNZ)
8.2226 + index = 3;
8.2227 + }
8.2228 + }
8.2229 + dp = &prefix_user_table[dp->bytemode2][index];
8.2230 + break;
8.2231 +
8.2232 + case X86_64_SPECIAL:
8.2233 + dp = &x86_64_table[dp->bytemode2][mode_64bit];
8.2234 + break;
8.2235 +
8.2236 + default:
8.2237 + oappend (INTERNAL_DISASSEMBLER_ERROR);
8.2238 + break;
8.2239 + }
8.2240 + }
8.2241 +
8.2242 + if (putop (dp->name, sizeflag) == 0)
8.2243 + {
8.2244 + obufp = op1out;
8.2245 + op_ad = 2;
8.2246 + if (dp->op1)
8.2247 + (*dp->op1) (dp->bytemode1, sizeflag);
8.2248 +
8.2249 + obufp = op2out;
8.2250 + op_ad = 1;
8.2251 + if (dp->op2)
8.2252 + (*dp->op2) (dp->bytemode2, sizeflag);
8.2253 +
8.2254 + obufp = op3out;
8.2255 + op_ad = 0;
8.2256 + if (dp->op3)
8.2257 + (*dp->op3) (dp->bytemode3, sizeflag);
8.2258 + }
8.2259 + }
8.2260 +
8.2261 + /* See if any prefixes were not used. If so, print the first one
8.2262 + separately. If we don't do this, we'll wind up printing an
8.2263 + instruction stream which does not precisely correspond to the
8.2264 + bytes we are disassembling. */
8.2265 + if ((prefixes & ~used_prefixes) != 0)
8.2266 + {
8.2267 + const char *name;
8.2268 +
8.2269 + name = prefix_name (priv.the_buffer[0], priv.orig_sizeflag);
8.2270 + if (name == NULL)
8.2271 + name = INTERNAL_DISASSEMBLER_ERROR;
8.2272 + (*info->fprintf_func) (info->stream, "%s", name);
8.2273 + return 1;
8.2274 + }
8.2275 + if (rex & ~rex_used)
8.2276 + {
8.2277 + const char *name;
8.2278 + name = prefix_name (rex | 0x40, priv.orig_sizeflag);
8.2279 + if (name == NULL)
8.2280 + name = INTERNAL_DISASSEMBLER_ERROR;
8.2281 + (*info->fprintf_func) (info->stream, "%s ", name);
8.2282 + }
8.2283 +
8.2284 + obufp = obuf + strlen (obuf);
8.2285 + for (i = strlen (obuf); i < 6; i++)
8.2286 + oappend (" ");
8.2287 + oappend (" ");
8.2288 + (*info->fprintf_func) (info->stream, "%s", obuf);
8.2289 +
8.2290 + /* The enter and bound instructions are printed with operands in the same
8.2291 + order as the intel book; everything else is printed in reverse order. */
8.2292 + if (intel_syntax || two_source_ops)
8.2293 + {
8.2294 + first = op1out;
8.2295 + second = op2out;
8.2296 + third = op3out;
8.2297 + op_ad = op_index[0];
8.2298 + op_index[0] = op_index[2];
8.2299 + op_index[2] = op_ad;
8.2300 + }
8.2301 + else
8.2302 + {
8.2303 + first = op3out;
8.2304 + second = op2out;
8.2305 + third = op1out;
8.2306 + }
8.2307 + needcomma = 0;
8.2308 + if (*first)
8.2309 + {
8.2310 + if (op_index[0] != -1 && !op_riprel[0])
8.2311 + (*info->print_address_func) ((bfd_vma) op_address[op_index[0]], info);
8.2312 + else
8.2313 + (*info->fprintf_func) (info->stream, "%s", first);
8.2314 + needcomma = 1;
8.2315 + }
8.2316 + if (*second)
8.2317 + {
8.2318 + if (needcomma)
8.2319 + (*info->fprintf_func) (info->stream, ",");
8.2320 + if (op_index[1] != -1 && !op_riprel[1])
8.2321 + (*info->print_address_func) ((bfd_vma) op_address[op_index[1]], info);
8.2322 + else
8.2323 + (*info->fprintf_func) (info->stream, "%s", second);
8.2324 + needcomma = 1;
8.2325 + }
8.2326 + if (*third)
8.2327 + {
8.2328 + if (needcomma)
8.2329 + (*info->fprintf_func) (info->stream, ",");
8.2330 + if (op_index[2] != -1 && !op_riprel[2])
8.2331 + (*info->print_address_func) ((bfd_vma) op_address[op_index[2]], info);
8.2332 + else
8.2333 + (*info->fprintf_func) (info->stream, "%s", third);
8.2334 + }
8.2335 + for (i = 0; i < 3; i++)
8.2336 + if (op_index[i] != -1 && op_riprel[i])
8.2337 + {
8.2338 + (*info->fprintf_func) (info->stream, " # ");
8.2339 + (*info->print_address_func) ((bfd_vma) (start_pc + codep - start_codep
8.2340 + + op_address[op_index[i]]), info);
8.2341 + }
8.2342 + return codep - priv.the_buffer;
8.2343 +}
8.2344 +
8.2345 +static const char *float_mem[] = {
8.2346 + /* d8 */
8.2347 + "fadd{s||s|}",
8.2348 + "fmul{s||s|}",
8.2349 + "fcom{s||s|}",
8.2350 + "fcomp{s||s|}",
8.2351 + "fsub{s||s|}",
8.2352 + "fsubr{s||s|}",
8.2353 + "fdiv{s||s|}",
8.2354 + "fdivr{s||s|}",
8.2355 + /* d9 */
8.2356 + "fld{s||s|}",
8.2357 + "(bad)",
8.2358 + "fst{s||s|}",
8.2359 + "fstp{s||s|}",
8.2360 + "fldenvIC",
8.2361 + "fldcw",
8.2362 + "fNstenvIC",
8.2363 + "fNstcw",
8.2364 + /* da */
8.2365 + "fiadd{l||l|}",
8.2366 + "fimul{l||l|}",
8.2367 + "ficom{l||l|}",
8.2368 + "ficomp{l||l|}",
8.2369 + "fisub{l||l|}",
8.2370 + "fisubr{l||l|}",
8.2371 + "fidiv{l||l|}",
8.2372 + "fidivr{l||l|}",
8.2373 + /* db */
8.2374 + "fild{l||l|}",
8.2375 + "fisttp{l||l|}",
8.2376 + "fist{l||l|}",
8.2377 + "fistp{l||l|}",
8.2378 + "(bad)",
8.2379 + "fld{t||t|}",
8.2380 + "(bad)",
8.2381 + "fstp{t||t|}",
8.2382 + /* dc */
8.2383 + "fadd{l||l|}",
8.2384 + "fmul{l||l|}",
8.2385 + "fcom{l||l|}",
8.2386 +