Update HEAD with the stock binutils_2_15_20040523 file.

This commit is contained in:
obrien 2004-06-16 06:55:49 +00:00
parent 5bae048b01
commit 0aa70a0bbc
13 changed files with 12261 additions and 6293 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/* nm.c -- Describe symbol table of a rel file.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002
2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GNU Binutils.
@ -37,7 +37,7 @@
struct size_sym
{
const PTR minisym;
const void *minisym;
bfd_vma size;
};
@ -68,66 +68,69 @@ struct extended_symbol_info
#define SYM_SIZE(sym) \
(sym->elfinfo ? sym->elfinfo->internal_elf_sym.st_size: sym->ssize)
static void usage PARAMS ((FILE *, int));
static void set_print_radix PARAMS ((char *));
static void set_output_format PARAMS ((char *));
static void display_archive PARAMS ((bfd *));
static boolean display_file PARAMS ((char *));
static void display_rel_file PARAMS ((bfd *, bfd *));
static long filter_symbols PARAMS ((bfd *, boolean, PTR, long, unsigned int));
static long sort_symbols_by_size PARAMS ((bfd *, boolean, PTR, long, unsigned int, struct size_sym **));
static void print_symbols PARAMS ((bfd *, boolean, PTR, long, unsigned int, bfd *));
static void print_size_symbols PARAMS ((bfd *, boolean, struct size_sym *, long, bfd *));
static void print_symname PARAMS ((const char *, const char *, bfd *));
static void print_symbol PARAMS ((bfd *, asymbol *, bfd_vma ssize, bfd *));
static void print_symdef_entry PARAMS ((bfd *));
static void usage (FILE *, int);
static void set_print_radix (char *);
static void set_output_format (char *);
static void display_archive (bfd *);
static bfd_boolean display_file (char *);
static void display_rel_file (bfd *, bfd *);
static long filter_symbols (bfd *, bfd_boolean, void *, long, unsigned int);
static long sort_symbols_by_size
(bfd *, bfd_boolean, void *, long, unsigned int, struct size_sym **);
static void print_symbols
(bfd *, bfd_boolean, void *, long, unsigned int, bfd *);
static void print_size_symbols
(bfd *, bfd_boolean, struct size_sym *, long, bfd *);
static void print_symname (const char *, const char *, bfd *);
static void print_symbol (bfd *, asymbol *, bfd_vma ssize, bfd *);
static void print_symdef_entry (bfd *);
/* The sorting functions. */
static int numeric_forward PARAMS ((const PTR, const PTR));
static int numeric_reverse PARAMS ((const PTR, const PTR));
static int non_numeric_forward PARAMS ((const PTR, const PTR));
static int non_numeric_reverse PARAMS ((const PTR, const PTR));
static int size_forward1 PARAMS ((const PTR, const PTR));
static int size_forward2 PARAMS ((const PTR, const PTR));
static int numeric_forward (const void *, const void *);
static int numeric_reverse (const void *, const void *);
static int non_numeric_forward (const void *, const void *);
static int non_numeric_reverse (const void *, const void *);
static int size_forward1 (const void *, const void *);
static int size_forward2 (const void *, const void *);
/* The output formatting functions. */
static void print_object_filename_bsd PARAMS ((char *));
static void print_object_filename_sysv PARAMS ((char *));
static void print_object_filename_posix PARAMS ((char *));
static void print_archive_filename_bsd PARAMS ((char *));
static void print_archive_filename_sysv PARAMS ((char *));
static void print_archive_filename_posix PARAMS ((char *));
static void print_archive_member_bsd PARAMS ((char *, const char *));
static void print_archive_member_sysv PARAMS ((char *, const char *));
static void print_archive_member_posix PARAMS ((char *, const char *));
static void print_symbol_filename_bsd PARAMS ((bfd *, bfd *));
static void print_symbol_filename_sysv PARAMS ((bfd *, bfd *));
static void print_symbol_filename_posix PARAMS ((bfd *, bfd *));
static void print_value PARAMS ((bfd *, bfd_vma));
static void print_symbol_info_bsd PARAMS ((struct extended_symbol_info *, bfd *));
static void print_symbol_info_sysv PARAMS ((struct extended_symbol_info *, bfd *));
static void print_symbol_info_posix PARAMS ((struct extended_symbol_info *, bfd *));
static void get_relocs PARAMS ((bfd *, asection *, PTR));
static const char * get_symbol_type PARAMS ((unsigned int));
static void print_object_filename_bsd (char *);
static void print_object_filename_sysv (char *);
static void print_object_filename_posix (char *);
static void print_archive_filename_bsd (char *);
static void print_archive_filename_sysv (char *);
static void print_archive_filename_posix (char *);
static void print_archive_member_bsd (char *, const char *);
static void print_archive_member_sysv (char *, const char *);
static void print_archive_member_posix (char *, const char *);
static void print_symbol_filename_bsd (bfd *, bfd *);
static void print_symbol_filename_sysv (bfd *, bfd *);
static void print_symbol_filename_posix (bfd *, bfd *);
static void print_value (bfd *, bfd_vma);
static void print_symbol_info_bsd (struct extended_symbol_info *, bfd *);
static void print_symbol_info_sysv (struct extended_symbol_info *, bfd *);
static void print_symbol_info_posix (struct extended_symbol_info *, bfd *);
static void get_relocs (bfd *, asection *, void *);
static const char * get_symbol_type (unsigned int);
/* Support for different output formats. */
struct output_fns
{
/* Print the name of an object file given on the command line. */
void (*print_object_filename) PARAMS ((char *));
void (*print_object_filename) (char *);
/* Print the name of an archive file given on the command line. */
void (*print_archive_filename) PARAMS ((char *));
void (*print_archive_filename) (char *);
/* Print the name of an archive member file. */
void (*print_archive_member) PARAMS ((char *, const char *));
void (*print_archive_member) (char *, const char *);
/* Print the name of the file (and archive, if there is one)
containing a symbol. */
void (*print_symbol_filename) PARAMS ((bfd *, bfd *));
void (*print_symbol_filename) (bfd *, bfd *);
/* Print a line of information about a symbol. */
void (*print_symbol_info) PARAMS ((struct extended_symbol_info *, bfd *));
void (*print_symbol_info) (struct extended_symbol_info *, bfd *);
};
static struct output_fns formats[] =
@ -239,9 +242,7 @@ static struct option long_options[] =
/* Some error-reporting functions. */
static void
usage (stream, status)
FILE *stream;
int status;
usage (FILE *stream, int status)
{
fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
fprintf (stream, _(" List symbols in [file(s)] (a.out by default).\n"));
@ -251,7 +252,8 @@ usage (stream, status)
-B Same as --format=bsd\n\
-C, --demangle[=STYLE] Decode low-level symbol names into user-level names\n\
The STYLE, if specified, can be `auto' (the default),\n\
`gnu', 'lucid', 'arm', 'hp', 'edg' or 'gnu-new-abi'\n\
`gnu', `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n\
or `gnat'\n\
--no-demangle Do not demangle low-level symbol names\n\
-D, --dynamic Display dynamic symbols instead of normal symbols\n\
--defined-only Display only defined symbols\n\
@ -285,8 +287,7 @@ usage (stream, status)
/* Set the radix for the symbol value and size according to RADIX. */
static void
set_print_radix (radix)
char *radix;
set_print_radix (char *radix)
{
switch (*radix)
{
@ -316,8 +317,7 @@ set_print_radix (radix)
}
static void
set_output_format (f)
char *f;
set_output_format (char *f)
{
int i;
@ -341,12 +341,10 @@ set_output_format (f)
format = &formats[i];
}
int main PARAMS ((int, char **));
int main (int, char **);
int
main (argc, argv)
int argc;
char **argv;
main (int argc, char **argv)
{
int c;
int retval;
@ -446,7 +444,7 @@ main (argc, argv)
break;
case 'X':
/* Ignored for (partial) AIX compatibility. On AIX, the
argument has values 32, 64, or 32_64, and specfies that
argument has values 32, 64, or 32_64, and specifies that
only 32-bit, only 64-bit, or both kinds of objects should
be examined. The default is 32. So plain AIX nm on a
library archive with both kinds of objects will ignore
@ -471,6 +469,13 @@ main (argc, argv)
if (show_version)
print_version ("nm");
if (sort_by_size && undefined_only)
{
non_fatal (_("Using the --size-sort and --undefined-only options together"));
non_fatal (_("will produce no output, since undefined symbols have no size."));
return 0;
}
/* OK, all options now parsed. If no filename specified, do a.out. */
if (optind == argc)
return !display_file ("a.out");
@ -504,8 +509,7 @@ main (argc, argv)
}
static const char *
get_symbol_type (type)
unsigned int type;
get_symbol_type (unsigned int type)
{
static char buff [32];
@ -530,8 +534,7 @@ get_symbol_type (type)
}
static void
display_archive (file)
bfd *file;
display_archive (bfd *file)
{
bfd *arfile = NULL;
bfd *last_arfile = NULL;
@ -592,19 +595,21 @@ display_archive (file)
}
}
static boolean
display_file (filename)
char *filename;
static bfd_boolean
display_file (char *filename)
{
boolean retval = true;
bfd_boolean retval = TRUE;
bfd *file;
char **matching;
if (get_file_size (filename) < 1)
return FALSE;
file = bfd_openr (filename, target);
if (file == NULL)
{
bfd_nonfatal (filename);
return false;
return FALSE;
}
if (bfd_check_format (file, bfd_archive))
@ -628,10 +633,10 @@ display_file (filename)
list_matching_formats (matching);
free (matching);
}
retval = false;
retval = FALSE;
}
if (bfd_close (file) == false)
if (!bfd_close (file))
bfd_fatal (filename);
lineno_cache_bfd = NULL;
@ -643,7 +648,7 @@ display_file (filename)
/* These globals are used to pass information into the sorting
routines. */
static bfd *sort_bfd;
static boolean sort_dynamic;
static bfd_boolean sort_dynamic;
static asymbol *sort_x;
static asymbol *sort_y;
@ -655,9 +660,7 @@ static asymbol *sort_y;
specially -- i.e., their sizes are used as their "values". */
static int
numeric_forward (P_x, P_y)
const PTR P_x;
const PTR P_y;
numeric_forward (const void *P_x, const void *P_y)
{
asymbol *x, *y;
asection *xs, *ys;
@ -684,17 +687,13 @@ numeric_forward (P_x, P_y)
}
static int
numeric_reverse (x, y)
const PTR x;
const PTR y;
numeric_reverse (const void *x, const void *y)
{
return - numeric_forward (x, y);
}
static int
non_numeric_forward (P_x, P_y)
const PTR P_x;
const PTR P_y;
non_numeric_forward (const void *P_x, const void *P_y)
{
asymbol *x, *y;
const char *xn, *yn;
@ -727,14 +726,12 @@ non_numeric_forward (P_x, P_y)
}
static int
non_numeric_reverse (x, y)
const PTR x;
const PTR y;
non_numeric_reverse (const void *x, const void *y)
{
return - non_numeric_forward (x, y);
}
static int (*(sorters[2][2])) PARAMS ((const PTR, const PTR)) =
static int (*(sorters[2][2])) (const void *, const void *) =
{
{ non_numeric_forward, non_numeric_reverse },
{ numeric_forward, numeric_reverse }
@ -752,9 +749,7 @@ static int (*(sorters[2][2])) PARAMS ((const PTR, const PTR)) =
value. */
static int
size_forward1 (P_x, P_y)
const PTR P_x;
const PTR P_y;
size_forward1 (const void *P_x, const void *P_y)
{
asymbol *x, *y;
asection *xs, *ys;
@ -824,9 +819,7 @@ size_forward1 (P_x, P_y)
an array of size_sym structures into size order. */
static int
size_forward2 (P_x, P_y)
const PTR P_x;
const PTR P_y;
size_forward2 (const void *P_x, const void *P_y)
{
const struct size_sym *x = (const struct size_sym *) P_x;
const struct size_sym *y = (const struct size_sym *) P_y;
@ -845,13 +838,9 @@ size_forward2 (P_x, P_y)
size. */
static long
sort_symbols_by_size (abfd, dynamic, minisyms, symcount, size, symsizesp)
bfd *abfd;
boolean dynamic;
PTR minisyms;
long symcount;
unsigned int size;
struct size_sym **symsizesp;
sort_symbols_by_size (bfd *abfd, bfd_boolean dynamic, void *minisyms,
long symcount, unsigned int size,
struct size_sym **symsizesp)
{
struct size_sym *symsizes;
bfd_byte *from, *fromend;
@ -876,7 +865,7 @@ sort_symbols_by_size (abfd, dynamic, minisyms, symcount, size, symsizesp)
if (from < fromend)
{
sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const PTR) from,
sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const void *) from,
store_sym);
if (sym == NULL)
bfd_fatal (bfd_get_filename (abfd));
@ -893,7 +882,7 @@ sort_symbols_by_size (abfd, dynamic, minisyms, symcount, size, symsizesp)
{
next = bfd_minisymbol_to_symbol (abfd,
dynamic,
(const PTR) (from + size),
(const void *) (from + size),
store_next);
if (next == NULL)
bfd_fatal (bfd_get_filename (abfd));
@ -920,7 +909,7 @@ sort_symbols_by_size (abfd, dynamic, minisyms, symcount, size, symsizesp)
if (sz != 0)
{
symsizes->minisym = (const PTR) from;
symsizes->minisym = (const void *) from;
symsizes->size = sz;
++symsizes;
}
@ -935,7 +924,7 @@ sort_symbols_by_size (abfd, dynamic, minisyms, symcount, size, symsizesp)
symcount = symsizes - *symsizesp;
/* We must now sort again by size. */
qsort ((PTR) *symsizesp, symcount, sizeof (struct size_sym), size_forward2);
qsort ((void *) *symsizesp, symcount, sizeof (struct size_sym), size_forward2);
return symcount;
}
@ -943,12 +932,10 @@ sort_symbols_by_size (abfd, dynamic, minisyms, symcount, size, symsizesp)
/* If ARCHIVE_BFD is non-NULL, it is the archive containing ABFD. */
static void
display_rel_file (abfd, archive_bfd)
bfd *abfd;
bfd *archive_bfd;
display_rel_file (bfd *abfd, bfd *archive_bfd)
{
long symcount;
PTR minisyms;
void *minisyms;
unsigned int size;
struct size_sym *symsizes;
@ -1008,12 +995,8 @@ display_rel_file (abfd, archive_bfd)
Return the number of symbols to be printed. */
static long
filter_symbols (abfd, dynamic, minisyms, symcount, size)
bfd *abfd;
boolean dynamic;
PTR minisyms;
long symcount;
unsigned int size;
filter_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms,
long symcount, unsigned int size)
{
bfd_byte *from, *fromend, *to;
asymbol *store;
@ -1033,7 +1016,7 @@ filter_symbols (abfd, dynamic, minisyms, symcount, size)
PROGRESS (1);
sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const PTR) from, store);
sym = bfd_minisymbol_to_symbol (abfd, dynamic, (const void *) from, store);
if (sym == NULL)
bfd_fatal (bfd_get_filename (abfd));
@ -1079,10 +1062,7 @@ filter_symbols (abfd, dynamic, minisyms, symcount, size)
demangling it if requested. */
static void
print_symname (format, name, abfd)
const char *format;
const char *name;
bfd *abfd;
print_symname (const char *format, const char *name, bfd *abfd)
{
if (do_demangle && *name)
{
@ -1100,13 +1080,8 @@ print_symname (format, name, abfd)
containing ABFD. */
static void
print_symbols (abfd, dynamic, minisyms, symcount, size, archive_bfd)
bfd *abfd;
boolean dynamic;
PTR minisyms;
long symcount;
unsigned int size;
bfd *archive_bfd;
print_symbols (bfd *abfd, bfd_boolean dynamic, void *minisyms, long symcount,
unsigned int size, bfd *archive_bfd)
{
asymbol *store;
bfd_byte *from, *fromend;
@ -1132,12 +1107,9 @@ print_symbols (abfd, dynamic, minisyms, symcount, size, archive_bfd)
/* Print the symbols when sorting by size. */
static void
print_size_symbols (abfd, dynamic, symsizes, symcount, archive_bfd)
bfd *abfd;
boolean dynamic;
struct size_sym *symsizes;
long symcount;
bfd *archive_bfd;
print_size_symbols (bfd *abfd, bfd_boolean dynamic,
struct size_sym *symsizes, long symcount,
bfd *archive_bfd)
{
asymbol *store;
struct size_sym *from, *fromend;
@ -1170,35 +1142,23 @@ print_size_symbols (abfd, dynamic, symsizes, symcount, archive_bfd)
/* Print a single symbol. */
static void
print_symbol (abfd, sym, ssize, archive_bfd)
bfd *abfd;
asymbol *sym;
bfd_vma ssize;
bfd *archive_bfd;
print_symbol (bfd *abfd, asymbol *sym, bfd_vma ssize, bfd *archive_bfd)
{
symbol_info syminfo;
struct extended_symbol_info info;
PROGRESS (1);
(*format->print_symbol_filename) (archive_bfd, abfd);
if (undefined_only)
{
if (bfd_is_und_section (bfd_get_section (sym)))
print_symname ("%s", bfd_asymbol_name (sym), abfd);
}
bfd_get_symbol_info (abfd, sym, &syminfo);
info.sinfo = &syminfo;
info.ssize = ssize;
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
info.elfinfo = (elf_symbol_type *) sym;
else
{
symbol_info syminfo;
struct extended_symbol_info info;
bfd_get_symbol_info (abfd, sym, &syminfo);
info.sinfo = &syminfo;
info.ssize = ssize;
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
info.elfinfo = (elf_symbol_type *) sym;
else
info.elfinfo = NULL;
(*format->print_symbol_info) (&info, abfd);
}
info.elfinfo = NULL;
(*format->print_symbol_info) (&info, abfd);
if (line_numbers)
{
@ -1267,7 +1227,7 @@ print_symbol (abfd, sym, ssize, archive_bfd)
info.relocs = relocs;
info.relcount = relcount;
info.syms = syms;
bfd_map_over_sections (abfd, get_relocs, (PTR) &info);
bfd_map_over_sections (abfd, get_relocs, (void *) &info);
lineno_cache_rel_bfd = abfd;
}
@ -1324,16 +1284,14 @@ print_symbol (abfd, sym, ssize, archive_bfd)
/* Print the name of an object file given on the command line. */
static void
print_object_filename_bsd (filename)
char *filename;
print_object_filename_bsd (char *filename)
{
if (filename_per_file && !filename_per_symbol)
printf ("\n%s:\n", filename);
}
static void
print_object_filename_sysv (filename)
char *filename;
print_object_filename_sysv (char *filename)
{
if (undefined_only)
printf (_("\n\nUndefined symbols from %s:\n\n"), filename);
@ -1348,8 +1306,7 @@ Name Value Class Type Size
}
static void
print_object_filename_posix (filename)
char *filename;
print_object_filename_posix (char *filename)
{
if (filename_per_file && !filename_per_symbol)
printf ("%s:\n", filename);
@ -1358,40 +1315,34 @@ print_object_filename_posix (filename)
/* Print the name of an archive file given on the command line. */
static void
print_archive_filename_bsd (filename)
char *filename;
print_archive_filename_bsd (char *filename)
{
if (filename_per_file)
printf ("\n%s:\n", filename);
}
static void
print_archive_filename_sysv (filename)
char *filename ATTRIBUTE_UNUSED;
print_archive_filename_sysv (char *filename ATTRIBUTE_UNUSED)
{
}
static void
print_archive_filename_posix (filename)
char *filename ATTRIBUTE_UNUSED;
print_archive_filename_posix (char *filename ATTRIBUTE_UNUSED)
{
}
/* Print the name of an archive member file. */
static void
print_archive_member_bsd (archive, filename)
char *archive ATTRIBUTE_UNUSED;
const char *filename;
print_archive_member_bsd (char *archive ATTRIBUTE_UNUSED,
const char *filename)
{
if (!filename_per_symbol)
printf ("\n%s:\n", filename);
}
static void
print_archive_member_sysv (archive, filename)
char *archive;
const char *filename;
print_archive_member_sysv (char *archive, const char *filename)
{
if (undefined_only)
printf (_("\n\nUndefined symbols from %s[%s]:\n\n"), archive, filename);
@ -1406,9 +1357,7 @@ Name Value Class Type Size
}
static void
print_archive_member_posix (archive, filename)
char *archive;
const char *filename;
print_archive_member_posix (char *archive, const char *filename)
{
if (!filename_per_symbol)
printf ("%s[%s]:\n", archive, filename);
@ -1418,8 +1367,7 @@ print_archive_member_posix (archive, filename)
containing a symbol. */
static void
print_symbol_filename_bsd (archive_bfd, abfd)
bfd *archive_bfd, *abfd;
print_symbol_filename_bsd (bfd *archive_bfd, bfd *abfd)
{
if (filename_per_symbol)
{
@ -1430,8 +1378,7 @@ print_symbol_filename_bsd (archive_bfd, abfd)
}
static void
print_symbol_filename_sysv (archive_bfd, abfd)
bfd *archive_bfd, *abfd;
print_symbol_filename_sysv (bfd *archive_bfd, bfd *abfd)
{
if (filename_per_symbol)
{
@ -1442,8 +1389,7 @@ print_symbol_filename_sysv (archive_bfd, abfd)
}
static void
print_symbol_filename_posix (archive_bfd, abfd)
bfd *archive_bfd, *abfd;
print_symbol_filename_posix (bfd *archive_bfd, bfd *abfd)
{
if (filename_per_symbol)
{
@ -1458,9 +1404,7 @@ print_symbol_filename_posix (archive_bfd, abfd)
/* Print a symbol value. */
static void
print_value (abfd, val)
bfd *abfd ATTRIBUTE_UNUSED;
bfd_vma val;
print_value (bfd *abfd ATTRIBUTE_UNUSED, bfd_vma val)
{
#if ! defined (BFD64) || BFD_HOST_64BIT_LONG
printf (value_format, val);
@ -1490,9 +1434,7 @@ print_value (abfd, val)
/* Print a line of information about a symbol. */
static void
print_symbol_info_bsd (info, abfd)
struct extended_symbol_info *info;
bfd *abfd;
print_symbol_info_bsd (struct extended_symbol_info *info, bfd *abfd)
{
if (bfd_is_undefined_symclass (SYM_TYPE (info)))
{
@ -1502,11 +1444,18 @@ print_symbol_info_bsd (info, abfd)
}
else
{
print_value (abfd, SYM_VALUE (info));
/* Normally we print the value of the symbol. If we are printing the
size or sorting by size then we print its size, except for the
(weird) special case where both flags are defined, in which case we
print both values. This conforms to documented behaviour. */
if (sort_by_size && !print_size)
print_value (abfd, SYM_SIZE (info));
else
print_value (abfd, SYM_VALUE (info));
if (print_size && SYM_SIZE (info))
{
printf(" ");
printf (" ");
print_value (abfd, SYM_SIZE (info));
}
}
@ -1526,9 +1475,7 @@ print_symbol_info_bsd (info, abfd)
}
static void
print_symbol_info_sysv (info, abfd)
struct extended_symbol_info *info;
bfd *abfd;
print_symbol_info_sysv (struct extended_symbol_info *info, bfd *abfd)
{
print_symname ("%-20s|", SYM_NAME (info), abfd);
@ -1547,9 +1494,9 @@ print_symbol_info_sysv (info, abfd)
if (SYM_TYPE (info) == '-')
{
/* A stab. */
printf ("%18s| ", SYM_STAB_NAME (info)); /* (C) Type */
printf (desc_format, SYM_STAB_DESC (info)); /* Size */
printf ("| |"); /* Line, Section */
printf ("%18s| ", SYM_STAB_NAME (info)); /* (C) Type. */
printf (desc_format, SYM_STAB_DESC (info)); /* Size. */
printf ("| |"); /* Line, Section. */
}
else
{
@ -1578,9 +1525,7 @@ print_symbol_info_sysv (info, abfd)
}
static void
print_symbol_info_posix (info, abfd)
struct extended_symbol_info *info;
bfd *abfd;
print_symbol_info_posix (struct extended_symbol_info *info, bfd *abfd)
{
print_symname ("%s ", SYM_NAME (info), abfd);
printf ("%c ", SYM_TYPE (info));
@ -1597,12 +1542,11 @@ print_symbol_info_posix (info, abfd)
}
static void
print_symdef_entry (abfd)
bfd *abfd;
print_symdef_entry (bfd *abfd)
{
symindex idx = BFD_NO_MORE_SYMBOLS;
carsym *thesym;
boolean everprinted = false;
bfd_boolean everprinted = FALSE;
for (idx = bfd_get_next_mapent (abfd, idx, &thesym);
idx != BFD_NO_MORE_SYMBOLS;
@ -1612,7 +1556,7 @@ print_symdef_entry (abfd)
if (!everprinted)
{
printf (_("\nArchive index:\n"));
everprinted = true;
everprinted = TRUE;
}
elt = bfd_get_elt_at_index (abfd, idx);
if (elt == NULL)
@ -1629,10 +1573,7 @@ print_symdef_entry (abfd)
It is called via bfd_map_over_sections. */
static void
get_relocs (abfd, sec, dataarg)
bfd *abfd;
asection *sec;
PTR dataarg;
get_relocs (bfd *abfd, asection *sec, void *dataarg)
{
struct get_relocs_info *data = (struct get_relocs_info *) dataarg;

View File

@ -1,6 +1,6 @@
/* strings -- print the strings of printable characters in files
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002 Free Software Foundation, Inc.
2002, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -39,10 +39,11 @@
-o Like -to. (Some other implementations have -o like -to,
others like -td. We chose one arbitrarily.)
--encoding={s,b,l,B,L}
-e {s,b,l,B,L}
Select character encoding: single-byte, bigendian 16-bit,
littleendian 16-bit, bigendian 32-bit, littleendian 32-bit
--encoding={s,S,b,l,B,L}
-e {s,S,b,l,B,L}
Select character encoding: 7-bit-character, 8-bit-character,
bigendian 16-bit, littleendian 16-bit, bigendian 32-bit,
littleendian 32-bit.
--target=BFDNAME
Specify a non-default object file format.
@ -80,11 +81,14 @@
#endif
#if O_BINARY
#include <io.h>
#define SET_BINARY(f) do { if (!isatty(f)) setmode(f,O_BINARY); } while (0)
#define SET_BINARY(f) do { if (!isatty (f)) setmode (f,O_BINARY); } while (0)
#endif
#endif
#define isgraphic(c) (ISPRINT (c) || (c) == '\t')
#define STRING_ISGRAPHIC(c) \
( (c) >= 0 \
&& (c) <= 255 \
&& ((c) == '\t' || ISPRINT (c) || (encoding == 'S' && (c) > 127)))
#ifndef errno
extern int errno;
@ -95,10 +99,10 @@ extern int errno;
#ifdef HAVE_FOPEN64
typedef off64_t file_off;
#define file_open(s,m) fopen64(s,m)
#define file_open(s,m) fopen64(s, m)
#else
typedef off_t file_off;
#define file_open(s,m) fopen(s,m)
#define file_open(s,m) fopen(s, m)
#endif
/* Radix for printing addresses (must be 8, 10 or 16). */
@ -107,17 +111,17 @@ static int address_radix;
/* Minimum length of sequence of graphic chars to trigger output. */
static int string_min;
/* true means print address within file for each string. */
static boolean print_addresses;
/* TRUE means print address within file for each string. */
static bfd_boolean print_addresses;
/* true means print filename for each string. */
static boolean print_filenames;
/* TRUE means print filename for each string. */
static bfd_boolean print_filenames;
/* true means for object files scan only the data section. */
static boolean datasection_only;
/* TRUE means for object files scan only the data section. */
static bfd_boolean datasection_only;
/* true if we found an initialized data section in the current file. */
static boolean got_a_section;
/* TRUE if we found an initialized data section in the current file. */
static bfd_boolean got_a_section;
/* The BFD object file format. */
static char *target;
@ -139,27 +143,22 @@ static struct option long_options[] =
{NULL, 0, NULL, 0}
};
static void strings_a_section PARAMS ((bfd *, asection *, PTR));
static boolean strings_object_file PARAMS ((const char *));
static boolean strings_file PARAMS ((char *file));
static int integer_arg PARAMS ((char *s));
static void print_strings PARAMS ((const char *filename, FILE *stream,
file_off address, int stop_point,
int magiccount, char *magic));
static void usage PARAMS ((FILE *stream, int status));
static long get_char PARAMS ((FILE *stream, file_off *address,
int *magiccount, char **magic));
static void strings_a_section (bfd *, asection *, void *);
static bfd_boolean strings_object_file (const char *);
static bfd_boolean strings_file (char *file);
static int integer_arg (char *s);
static void print_strings (const char *, FILE *, file_off, int, int, char *);
static void usage (FILE *, int);
static long get_char (FILE *, file_off *, int *, char **);
int main PARAMS ((int, char **));
int main (int, char **);
int
main (argc, argv)
int argc;
char **argv;
main (int argc, char **argv)
{
int optc;
int exit_status = 0;
boolean files_given = false;
bfd_boolean files_given = FALSE;
#if defined (HAVE_SETLOCALE)
setlocale (LC_ALL, "");
@ -170,9 +169,9 @@ main (argc, argv)
program_name = argv[0];
xmalloc_set_program_name (program_name);
string_min = -1;
print_addresses = false;
print_filenames = false;
datasection_only = true;
print_addresses = FALSE;
print_filenames = FALSE;
datasection_only = TRUE;
target = NULL;
encoding = 's';
@ -182,11 +181,11 @@ main (argc, argv)
switch (optc)
{
case 'a':
datasection_only = false;
datasection_only = FALSE;
break;
case 'f':
print_filenames = true;
print_filenames = TRUE;
break;
case 'H':
@ -196,18 +195,16 @@ main (argc, argv)
case 'n':
string_min = integer_arg (optarg);
if (string_min < 1)
{
fatal (_("invalid number %s"), optarg);
}
fatal (_("invalid number %s"), optarg);
break;
case 'o':
print_addresses = true;
print_addresses = TRUE;
address_radix = 8;
break;
case 't':
print_addresses = true;
print_addresses = TRUE;
if (optarg[1] != '\0')
usage (stderr, 1);
switch (optarg[0])
@ -261,6 +258,7 @@ main (argc, argv)
switch (encoding)
{
case 'S':
case 's':
encoding_bytes = 1;
break;
@ -281,28 +279,28 @@ main (argc, argv)
if (optind >= argc)
{
datasection_only = false;
datasection_only = FALSE;
#ifdef SET_BINARY
SET_BINARY (fileno (stdin));
#endif
print_strings ("{standard input}", stdin, 0, 0, 0, (char *) NULL);
files_given = true;
files_given = TRUE;
}
else
{
for (; optind < argc; ++optind)
{
if (strcmp (argv[optind], "-") == 0)
datasection_only = false;
datasection_only = FALSE;
else
{
files_given = true;
exit_status |= (strings_file (argv[optind]) == false);
files_given = TRUE;
exit_status |= strings_file (argv[optind]) == FALSE;
}
}
}
if (files_given == false)
if (!files_given)
usage (stderr, 1);
return (exit_status);
@ -313,20 +311,18 @@ main (argc, argv)
set `got_a_section' and print the strings in it. */
static void
strings_a_section (abfd, sect, filearg)
bfd *abfd;
asection *sect;
PTR filearg;
strings_a_section (bfd *abfd, asection *sect, void *filearg)
{
const char *file = (const char *) filearg;
if ((sect->flags & DATA_FLAGS) == DATA_FLAGS)
{
bfd_size_type sz = bfd_get_section_size_before_reloc (sect);
PTR mem = xmalloc (sz);
void *mem = xmalloc (sz);
if (bfd_get_section_contents (abfd, sect, mem, (file_ptr) 0, sz))
{
got_a_section = true;
got_a_section = TRUE;
print_strings (file, (FILE *) NULL, sect->filepos, 0, sz, mem);
}
free (mem);
@ -336,48 +332,47 @@ strings_a_section (abfd, sect, filearg)
/* Scan all of the sections in FILE, and print the strings
in the initialized data section(s).
Return true if successful,
false if not (such as if FILE is not an object file). */
Return TRUE if successful,
FALSE if not (such as if FILE is not an object file). */
static boolean
strings_object_file (file)
const char *file;
static bfd_boolean
strings_object_file (const char *file)
{
bfd *abfd = bfd_openr (file, target);
if (abfd == NULL)
{
/* Treat the file as a non-object file. */
return false;
}
/* Treat the file as a non-object file. */
return FALSE;
/* This call is mainly for its side effect of reading in the sections.
We follow the traditional behavior of `strings' in that we don't
complain if we don't recognize a file to be an object file. */
if (bfd_check_format (abfd, bfd_object) == false)
if (!bfd_check_format (abfd, bfd_object))
{
bfd_close (abfd);
return false;
return FALSE;
}
got_a_section = false;
bfd_map_over_sections (abfd, strings_a_section, (PTR) file);
got_a_section = FALSE;
bfd_map_over_sections (abfd, strings_a_section, (void *) file);
if (!bfd_close (abfd))
{
bfd_nonfatal (file);
return false;
return FALSE;
}
return got_a_section;
}
/* Print the strings in FILE. Return true if ok, false if an error occurs. */
/* Print the strings in FILE. Return TRUE if ok, FALSE if an error occurs. */
static boolean
strings_file (file)
char *file;
static bfd_boolean
strings_file (char *file)
{
if (get_file_size (file) < 1)
return FALSE;
/* If we weren't told to scan the whole file,
try to open it as an object file and only look at
initialized data sections. If that fails, fall back to the
@ -391,7 +386,7 @@ strings_file (file)
{
fprintf (stderr, "%s: ", program_name);
perror (file);
return false;
return FALSE;
}
print_strings (file, stream, (file_off) 0, 0, 0, (char *) 0);
@ -400,11 +395,11 @@ strings_file (file)
{
fprintf (stderr, "%s: ", program_name);
perror (file);
return false;
return FALSE;
}
}
return true;
return TRUE;
}
/* Read the next character, return EOF if none available.
@ -418,11 +413,7 @@ strings_file (file)
MAGICCOUNT is how many characters are in it. */
static long
get_char (stream, address, magiccount, magic)
FILE *stream;
file_off *address;
int *magiccount;
char **magic;
get_char (FILE *stream, file_off *address, int *magiccount, char **magic)
{
int c, i;
long r = EOF;
@ -454,6 +445,7 @@ get_char (stream, address, magiccount, magic)
switch (encoding)
{
case 'S':
case 's':
r = buf[0];
break;
@ -492,13 +484,8 @@ get_char (stream, address, magiccount, magic)
Those characters come at address ADDRESS and the data in STREAM follow. */
static void
print_strings (filename, stream, address, stop_point, magiccount, magic)
const char *filename;
FILE *stream;
file_off address;
int stop_point;
int magiccount;
char *magic;
print_strings (const char *filename, FILE *stream, file_off address,
int stop_point, int magiccount, char *magic)
{
char *buf = (char *) xmalloc (sizeof (char) * (string_min + 1));
@ -518,7 +505,7 @@ print_strings (filename, stream, address, stop_point, magiccount, magic)
c = get_char (stream, &address, &magiccount, &magic);
if (c == EOF)
return;
if (c > 255 || c < 0 || !isgraphic (c))
if (! STRING_ISGRAPHIC (c))
/* Found a non-graphic. Try again starting with next char. */
goto tryline;
buf[i] = c;
@ -586,7 +573,7 @@ print_strings (filename, stream, address, stop_point, magiccount, magic)
c = get_char (stream, &address, &magiccount, &magic);
if (c == EOF)
break;
if (c > 255 || c < 0 || !isgraphic (c))
if (! STRING_ISGRAPHIC (c))
break;
putchar (c);
}
@ -599,8 +586,7 @@ print_strings (filename, stream, address, stop_point, magiccount, magic)
but allowing octal and hex numbers as in C. */
static int
integer_arg (s)
char *s;
integer_arg (char *s)
{
int value;
int radix = 10;
@ -636,16 +622,13 @@ integer_arg (s)
p--;
if (*p)
{
fatal (_("invalid integer argument %s"), s);
}
fatal (_("invalid integer argument %s"), s);
return value;
}
static void
usage (stream, status)
FILE *stream;
int status;
usage (FILE *stream, int status)
{
fprintf (stream, _("Usage: %s [option(s)] [file(s)]\n"), program_name);
fprintf (stream, _(" Display printable strings in [file(s)] (stdin by default)\n"));
@ -657,8 +640,8 @@ usage (stream, status)
-t --radix={o,x,d} Print the location of the string in base 8, 10 or 16\n\
-o An alias for --radix=o\n\
-T --target=<BFDNAME> Specify the binary file format\n\
-e --encoding={s,b,l,B,L} Select character size and endianness:\n\
s = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n\
-e --encoding={s,S,b,l,B,L} Select character size and endianness:\n\
s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit\n\
-h --help Display this information\n\
-v --version Print the program's version number\n"));
list_supported_targets (program_name, stream);

View File

@ -1,6 +1,6 @@
/* i386.c -- Assemble code for the Intel 80386
Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002
2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@ -23,6 +23,7 @@
/* Intel 80386 machine specific gas.
Written by Eliot Dresselhaus (eliot@mgm.mit.edu).
x86_64 support by Jan Hubicka (jh@suse.cz)
VIA PadLock support by Michal Ludvig (mludvig@suse.cz)
Bugs & suggestions are completely welcome. This is free software.
Please help us make it better. */
@ -30,6 +31,7 @@
#include "safe-ctype.h"
#include "subsegs.h"
#include "dwarf2dbg.h"
#include "dw2gencfi.h"
#include "opcode/i386.h"
#ifndef REGISTER_WARNINGS
@ -48,12 +50,6 @@
#define SCALE1_WHEN_NO_INDEX 1
#endif
#ifdef BFD_ASSEMBLER
#define RELOC_ENUM enum bfd_reloc_code_real
#else
#define RELOC_ENUM int
#endif
#ifndef DEFAULT_ARCH
#define DEFAULT_ARCH "i386"
#endif
@ -154,7 +150,7 @@ struct _i386_insn
#define Operand_PCrel 1
/* Relocation type for operand */
RELOC_ENUM reloc[MAX_OPERANDS];
enum bfd_reloc_code_real reloc[MAX_OPERANDS];
/* BASE_REG, INDEX_REG, and LOG2_SCALE_FACTOR are used to encode
the base index byte below. */
@ -207,7 +203,7 @@ const char comment_chars[] = "#/";
#NO_APP at the beginning of its output.
Also note that comments started like this one will always work if
'/' isn't otherwise defined. */
const char line_comment_chars[] = "";
const char line_comment_chars[] = "#";
#else
/* Putting '/' here makes it impossible to use the divide operator.
@ -215,7 +211,7 @@ const char line_comment_chars[] = "";
const char comment_chars[] = "#";
#define PREFIX_SEPARATOR '/'
const char line_comment_chars[] = "/";
const char line_comment_chars[] = "/#";
#endif
const char line_separator_chars[] = ";";
@ -244,7 +240,7 @@ static char digit_chars[256];
#define is_identifier_char(x) (identifier_chars[(unsigned char) x])
#define is_digit_char(x) (digit_chars[(unsigned char) x])
/* All non-digit non-letter charcters that may occur in an operand. */
/* All non-digit non-letter characters that may occur in an operand. */
static char operand_special_chars[] = "%$-+(,)*._~/<>|&^!:[@]";
/* md_assemble() always leaves the strings it's passed unaltered. To
@ -302,6 +298,9 @@ static int allow_naked_reg = 0;
frame as in 32 bit mode. */
static char stackop_size = '\0';
/* Non-zero to optimize code alignment. */
int optimize_align_code = 1;
/* Non-zero to quieten some warnings. */
static int quiet_warnings = 0;
@ -318,6 +317,12 @@ static unsigned int no_cond_jump_promotion = 0;
/* Pre-defined "_GLOBAL_OFFSET_TABLE_". */
symbolS *GOT_symbol;
/* The dwarf2 return column, adjusted for 32 or 64 bit. */
unsigned int x86_dwarf2_return_column;
/* The dwarf2 data alignment, adjusted for 32 or 64 bit. */
int x86_cie_data_alignment;
/* Interface to relax_segment.
There are 3 major relax states for 386 jump insns because the
different types of jumps add different sizes to frags when we're
@ -523,26 +528,45 @@ i386_align_code (fragP, count)
f32_15, f32_15, f32_15, f32_15, f32_15, f32_15, f32_15
};
/* ??? We can't use these fillers for x86_64, since they often kills the
upper halves. Solve later. */
if (flag_code == CODE_64BIT)
count = 1;
if (count <= 0 || count > 15)
return;
if (count > 0 && count <= 15)
/* The recommended way to pad 64bit code is to use NOPs preceded by
maximally four 0x66 prefixes. Balance the size of nops. */
if (flag_code == CODE_64BIT)
{
if (flag_code == CODE_16BIT)
int i;
int nnops = (count + 3) / 4;
int len = count / nnops;
int remains = count - nnops * len;
int pos = 0;
for (i = 0; i < remains; i++)
{
memcpy (fragP->fr_literal + fragP->fr_fix,
f16_patt[count - 1], count);
if (count > 8)
/* Adjust jump offset. */
fragP->fr_literal[fragP->fr_fix + 1] = count - 2;
memset (fragP->fr_literal + fragP->fr_fix + pos, 0x66, len);
fragP->fr_literal[fragP->fr_fix + pos + len] = 0x90;
pos += len + 1;
}
for (; i < nnops; i++)
{
memset (fragP->fr_literal + fragP->fr_fix + pos, 0x66, len - 1);
fragP->fr_literal[fragP->fr_fix + pos + len - 1] = 0x90;
pos += len;
}
else
memcpy (fragP->fr_literal + fragP->fr_fix,
f32_patt[count - 1], count);
fragP->fr_var = count;
}
else
if (flag_code == CODE_16BIT)
{
memcpy (fragP->fr_literal + fragP->fr_fix,
f16_patt[count - 1], count);
if (count > 8)
/* Adjust jump offset. */
fragP->fr_literal[fragP->fr_fix + 1] = count - 2;
}
else
memcpy (fragP->fr_literal + fragP->fr_fix,
f32_patt[count - 1], count);
fragP->fr_var = count;
}
static INLINE unsigned int
@ -776,15 +800,8 @@ set_intel_syntax (syntax_flag)
intel_syntax = syntax_flag;
if (ask_naked_reg == 0)
{
#ifdef BFD_ASSEMBLER
allow_naked_reg = (intel_syntax
&& (bfd_get_symbol_leading_char (stdoutput) != '\0'));
#else
/* Conservative default. */
allow_naked_reg = 0;
#endif
}
allow_naked_reg = (intel_syntax
&& (bfd_get_symbol_leading_char (stdoutput) != '\0'));
else
allow_naked_reg = (ask_naked_reg < 0);
}
@ -839,7 +856,6 @@ set_cpu_arch (dummy)
demand_empty_rest_of_line ();
}
#ifdef BFD_ASSEMBLER
unsigned long
i386_mach ()
{
@ -850,7 +866,6 @@ i386_mach ()
else
as_fatal (_("Unknown architecture"));
}
#endif
void
md_begin ()
@ -967,6 +982,17 @@ md_begin ()
record_alignment (bss_section, 2);
}
#endif
if (flag_code == CODE_64BIT)
{
x86_dwarf2_return_column = 16;
x86_cie_data_alignment = -8;
}
else
{
x86_dwarf2_return_column = 8;
x86_cie_data_alignment = -4;
}
}
void
@ -1132,7 +1158,6 @@ pt (t)
#endif /* DEBUG386 */
#ifdef BFD_ASSEMBLER
static bfd_reloc_code_real_type reloc
PARAMS ((int, int, int, bfd_reloc_code_real_type));
@ -1194,15 +1219,17 @@ tc_i386_fix_adjustable (fixP)
if (OUTPUT_FLAVOR != bfd_target_elf_flavour)
return 1;
/* Prevent all adjustments to global symbols, or else dynamic
linking will not work correctly. */
if (S_IS_EXTERNAL (fixP->fx_addsy)
|| S_IS_WEAK (fixP->fx_addsy)
/* Don't adjust pc-relative references to merge sections in 64-bit
mode. */
|| (use_rela_relocations
&& (S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE) != 0
&& fixP->fx_pcrel))
/* Don't adjust pc-relative references to merge sections in 64-bit
mode. */
if (use_rela_relocations
&& (S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE) != 0
&& fixP->fx_pcrel)
return 0;
/* The x86_64 GOTPCREL are represented as 32bit PCrel relocations
and changed later by validate_fix. */
if (GOT_symbol && fixP->fx_subsy == GOT_symbol
&& fixP->fx_r_type == BFD_RELOC_32_PCREL)
return 0;
/* adjust_reloc_syms doesn't know about the GOT. */
@ -1220,35 +1247,17 @@ tc_i386_fix_adjustable (fixP)
|| fixP->fx_r_type == BFD_RELOC_X86_64_PLT32
|| fixP->fx_r_type == BFD_RELOC_X86_64_GOT32
|| fixP->fx_r_type == BFD_RELOC_X86_64_GOTPCREL
|| fixP->fx_r_type == BFD_RELOC_X86_64_TLSGD
|| fixP->fx_r_type == BFD_RELOC_X86_64_TLSLD
|| fixP->fx_r_type == BFD_RELOC_X86_64_DTPOFF32
|| fixP->fx_r_type == BFD_RELOC_X86_64_GOTTPOFF
|| fixP->fx_r_type == BFD_RELOC_X86_64_TPOFF32
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
return 0;
#endif
return 1;
}
#else
#define reloc(SIZE,PCREL,SIGN,OTHER) 0
#define BFD_RELOC_8 0
#define BFD_RELOC_16 0
#define BFD_RELOC_32 0
#define BFD_RELOC_8_PCREL 0
#define BFD_RELOC_16_PCREL 0
#define BFD_RELOC_32_PCREL 0
#define BFD_RELOC_386_PLT32 0
#define BFD_RELOC_386_GOT32 0
#define BFD_RELOC_386_GOTOFF 0
#define BFD_RELOC_386_TLS_GD 0
#define BFD_RELOC_386_TLS_LDM 0
#define BFD_RELOC_386_TLS_LDO_32 0
#define BFD_RELOC_386_TLS_IE_32 0
#define BFD_RELOC_386_TLS_IE 0
#define BFD_RELOC_386_TLS_GOTIE 0
#define BFD_RELOC_386_TLS_LE_32 0
#define BFD_RELOC_386_TLS_LE 0
#define BFD_RELOC_X86_64_PLT32 0
#define BFD_RELOC_X86_64_GOT32 0
#define BFD_RELOC_X86_64_GOTPCREL 0
#endif
static int intel_float_operand PARAMS ((const char *mnemonic));
@ -1367,13 +1376,28 @@ md_assemble (line)
if (i.tm.opcode_modifier & ImmExt)
{
expressionS *exp;
if ((i.tm.cpu_flags & CpuPNI) && i.operands > 0)
{
/* These Intel Prescott New Instructions have the fixed
operands with an opcode suffix which is coded in the same
place as an 8-bit immediate field would be. Here we check
those operands and remove them afterwards. */
unsigned int x;
for (x = 0; x < i.operands; x++)
if (i.op[x].regs->reg_num != x)
as_bad (_("can't use register '%%%s' as operand %d in '%s'."),
i.op[x].regs->reg_name, x + 1, i.tm.name);
i.operands = 0;
}
/* These AMD 3DNow! and Intel Katmai New Instructions have an
opcode suffix which is coded in the same place as an 8-bit
immediate field would be. Here we fake an 8-bit immediate
operand from the opcode suffix stored in tm.extension_opcode. */
expressionS *exp;
assert (i.imm_operands == 0 && i.operands <= 2 && 2 < MAX_OPERANDS);
exp = &im_expressions[i.imm_operands++];
@ -1758,7 +1782,7 @@ swap_operands ()
{
union i386_op temp_op;
unsigned int temp_type;
RELOC_ENUM temp_reloc;
enum bfd_reloc_code_real temp_reloc;
int xchg1 = 0;
int xchg2 = 0;
@ -3100,7 +3124,6 @@ output_interseg_jump ()
md_number_to_chars (p + size, (valueT) i.op[0].imms->X_add_number, 2);
}
static void
output_insn ()
{
@ -3128,10 +3151,23 @@ output_insn ()
char *p;
unsigned char *q;
/* All opcodes on i386 have either 1 or 2 bytes. We may use third
byte for the SSE instructions to specify a prefix they require. */
if (i.tm.base_opcode & 0xff0000)
add_prefix ((i.tm.base_opcode >> 16) & 0xff);
/* All opcodes on i386 have either 1 or 2 bytes, PadLock instructions
have 3 bytes. We may use one more higher byte to specify a prefix
the instruction requires. */
if ((i.tm.cpu_flags & CpuPadLock) != 0
&& (i.tm.base_opcode & 0xff000000) != 0)
{
unsigned int prefix;
prefix = (i.tm.base_opcode >> 24) & 0xff;
if (prefix != REPE_PREFIX_OPCODE
|| i.prefix[LOCKREP_PREFIX] != REPE_PREFIX_OPCODE)
add_prefix (prefix);
}
else
if ((i.tm.cpu_flags & CpuPadLock) == 0
&& (i.tm.base_opcode & 0xff0000) != 0)
add_prefix ((i.tm.base_opcode >> 16) & 0xff);
/* The prefix bytes. */
for (q = i.prefix;
@ -3152,7 +3188,14 @@ output_insn ()
}
else
{
p = frag_more (2);
if ((i.tm.cpu_flags & CpuPadLock) != 0)
{
p = frag_more (3);
*p++ = (i.tm.base_opcode >> 16) & 0xff;
}
else
p = frag_more (2);
/* Put out high byte first: can't use md_number_to_chars! */
*p++ = (i.tm.base_opcode >> 8) & 0xff;
*p = i.tm.base_opcode & 0xff;
@ -3232,7 +3275,7 @@ output_disp (insn_start_frag, insn_start_off)
}
else
{
RELOC_ENUM reloc_type;
enum bfd_reloc_code_real reloc_type;
int size = 4;
int sign = 0;
int pcrel = (i.flags[n] & Operand_PCrel) != 0;
@ -3276,7 +3319,6 @@ output_disp (insn_start_frag, insn_start_off)
p = frag_more (size);
reloc_type = reloc (size, pcrel, sign, i.reloc[n]);
#ifdef BFD_ASSEMBLER
if (reloc_type == BFD_RELOC_32
&& GOT_symbol
&& GOT_symbol == i.op[n].disps->X_add_symbol
@ -3307,7 +3349,6 @@ output_disp (insn_start_frag, insn_start_off)
reloc_type = BFD_RELOC_386_GOTPC;
i.op[n].disps->X_add_number += add;
}
#endif
fix_new_exp (frag_now, p - frag_now->fr_literal, size,
i.op[n].disps, pcrel, reloc_type);
}
@ -3352,7 +3393,7 @@ output_imm (insn_start_frag, insn_start_off)
Need a 32-bit fixup (don't support 8bit
non-absolute imms). Try to support other
sizes ... */
RELOC_ENUM reloc_type;
enum bfd_reloc_code_real reloc_type;
int size = 4;
int sign = 0;
@ -3370,7 +3411,7 @@ output_imm (insn_start_frag, insn_start_off)
p = frag_more (size);
reloc_type = reloc (size, 0, sign, i.reloc[n]);
#ifdef BFD_ASSEMBLER
/* This is tough to explain. We end up with this one if we
* have operands that look like
* "_GLOBAL_OFFSET_TABLE_+[.-.L284]". The goal here is to
@ -3443,7 +3484,6 @@ output_imm (insn_start_frag, insn_start_off)
reloc_type = BFD_RELOC_386_GOTPC;
i.op[n].imms->X_add_number += add;
}
#endif
fix_new_exp (frag_now, p - frag_now->fr_literal, size,
i.op[n].imms, 0, reloc_type);
}
@ -3452,7 +3492,7 @@ output_imm (insn_start_frag, insn_start_off)
}
#ifndef LEX_AT
static char *lex_got PARAMS ((RELOC_ENUM *, int *));
static char *lex_got PARAMS ((enum bfd_reloc_code_real *, int *));
/* Parse operands of the form
<symbol>@GOTOFF+<nnn>
@ -3465,23 +3505,24 @@ static char *lex_got PARAMS ((RELOC_ENUM *, int *));
input line. Otherwise return NULL. */
static char *
lex_got (reloc, adjust)
RELOC_ENUM *reloc;
enum bfd_reloc_code_real *reloc;
int *adjust;
{
static const char * const mode_name[NUM_FLAG_CODE] = { "32", "16", "64" };
static const struct {
const char *str;
const RELOC_ENUM rel[NUM_FLAG_CODE];
const enum bfd_reloc_code_real rel[NUM_FLAG_CODE];
} gotrel[] = {
{ "PLT", { BFD_RELOC_386_PLT32, 0, BFD_RELOC_X86_64_PLT32 } },
{ "GOTOFF", { BFD_RELOC_386_GOTOFF, 0, 0 } },
{ "GOTPCREL", { 0, 0, BFD_RELOC_X86_64_GOTPCREL } },
{ "TLSGD", { BFD_RELOC_386_TLS_GD, 0, 0 } },
{ "TLSGD", { BFD_RELOC_386_TLS_GD, 0, BFD_RELOC_X86_64_TLSGD } },
{ "TLSLDM", { BFD_RELOC_386_TLS_LDM, 0, 0 } },
{ "GOTTPOFF", { BFD_RELOC_386_TLS_IE_32, 0, 0 } },
{ "TPOFF", { BFD_RELOC_386_TLS_LE_32, 0, 0 } },
{ "TLSLD", { 0, 0, BFD_RELOC_X86_64_TLSLD } },
{ "GOTTPOFF", { BFD_RELOC_386_TLS_IE_32, 0, BFD_RELOC_X86_64_GOTTPOFF } },
{ "TPOFF", { BFD_RELOC_386_TLS_LE_32, 0, BFD_RELOC_X86_64_TPOFF32 } },
{ "NTPOFF", { BFD_RELOC_386_TLS_LE, 0, 0 } },
{ "DTPOFF", { BFD_RELOC_386_TLS_LDO_32, 0, 0 } },
{ "DTPOFF", { BFD_RELOC_386_TLS_LDO_32, 0, BFD_RELOC_X86_64_DTPOFF32 } },
{ "GOTNTPOFF",{ BFD_RELOC_386_TLS_GOTIE, 0, 0 } },
{ "INDNTPOFF",{ BFD_RELOC_386_TLS_IE, 0, 0 } },
{ "GOT", { BFD_RELOC_386_GOT32, 0, BFD_RELOC_X86_64_GOT32 } }
@ -3548,7 +3589,7 @@ lex_got (reloc, adjust)
/* x86_cons_fix_new is called via the expression parsing code when a
reloc is needed. We use this hook to get the correct .got reloc. */
static RELOC_ENUM got_reloc = NO_RELOC;
static enum bfd_reloc_code_real got_reloc = NO_RELOC;
void
x86_cons_fix_new (frag, off, len, exp)
@ -3557,7 +3598,7 @@ x86_cons_fix_new (frag, off, len, exp)
unsigned int len;
expressionS *exp;
{
RELOC_ENUM r = reloc (len, 0, 0, got_reloc);
enum bfd_reloc_code_real r = reloc (len, 0, 0, got_reloc);
got_reloc = NO_RELOC;
fix_new_exp (frag, off, len, exp, 0, r);
}
@ -3663,25 +3704,15 @@ i386_immediate (imm_start)
exp->X_add_number = (exp->X_add_number ^ ((addressT) 1 << 31)) - ((addressT) 1 << 31);
}
#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
else if (1
#ifdef BFD_ASSEMBLER
&& OUTPUT_FLAVOR == bfd_target_aout_flavour
#endif
else if (OUTPUT_FLAVOR == bfd_target_aout_flavour
&& exp_seg != absolute_section
&& exp_seg != text_section
&& exp_seg != data_section
&& exp_seg != bss_section
&& exp_seg != undefined_section
#ifdef BFD_ASSEMBLER
&& !bfd_is_com_section (exp_seg)
#endif
)
&& !bfd_is_com_section (exp_seg))
{
#ifdef BFD_ASSEMBLER
as_bad (_("unimplemented segment %s in operand"), exp_seg->name);
#else
as_bad (_("unimplemented segment type %d in operand"), exp_seg);
#endif
return 0;
}
#endif
@ -3838,7 +3869,6 @@ i386_displacement (disp_start, disp_end)
free (gotfree_input_line);
#endif
#ifdef BFD_ASSEMBLER
/* We do this to make sure that the section symbol is in
the symbol table. We will ultimately change the relocation
to be relative to the beginning of the section. */
@ -3864,7 +3894,6 @@ i386_displacement (disp_start, disp_end)
else
i.reloc[this_operand] = BFD_RELOC_32;
}
#endif
if (exp->X_op == O_absent || exp->X_op == O_big)
{
@ -3879,24 +3908,15 @@ i386_displacement (disp_start, disp_end)
#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
if (exp->X_op != O_constant
#ifdef BFD_ASSEMBLER
&& OUTPUT_FLAVOR == bfd_target_aout_flavour
#endif
&& exp_seg != absolute_section
&& exp_seg != text_section
&& exp_seg != data_section
&& exp_seg != bss_section
&& exp_seg != undefined_section
#ifdef BFD_ASSEMBLER
&& !bfd_is_com_section (exp_seg)
#endif
)
&& !bfd_is_com_section (exp_seg))
{
#ifdef BFD_ASSEMBLER
as_bad (_("unimplemented segment %s in operand"), exp_seg->name);
#else
as_bad (_("unimplemented segment type %d in operand"), exp_seg);
#endif
return 0;
}
#endif
@ -4325,7 +4345,7 @@ md_estimate_size_before_relax (fragP, segment)
/* Symbol is undefined in this segment, or we need to keep a
reloc so that weak symbols can be overridden. */
int size = (fragP->fr_subtype & CODE16) ? 2 : 4;
RELOC_ENUM reloc_type;
enum bfd_reloc_code_real reloc_type;
unsigned char *opcode;
int old_fr_fix;
@ -4424,19 +4444,11 @@ md_estimate_size_before_relax (fragP, segment)
Out: Any fixSs and constants are set up.
Caller will turn frag into a ".space 0". */
#ifndef BFD_ASSEMBLER
void
md_convert_frag (headers, sec, fragP)
object_headers *headers ATTRIBUTE_UNUSED;
segT sec ATTRIBUTE_UNUSED;
fragS *fragP;
#else
void
md_convert_frag (abfd, sec, fragP)
bfd *abfd ATTRIBUTE_UNUSED;
segT sec ATTRIBUTE_UNUSED;
fragS *fragP;
#endif
{
unsigned char *opcode;
unsigned char *where_to_put_displacement = NULL;
@ -4575,7 +4587,7 @@ md_apply_fix3 (fixP, valP, seg)
char *p = fixP->fx_where + fixP->fx_frag->fr_literal;
valueT value = *valP;
#if defined (BFD_ASSEMBLER) && !defined (TE_Mach)
#if !defined (TE_Mach)
if (fixP->fx_pcrel)
{
switch (fixP->fx_r_type)
@ -4595,7 +4607,7 @@ md_apply_fix3 (fixP, valP, seg)
}
}
if (fixP->fx_pcrel
if (fixP->fx_addsy != NULL
&& (fixP->fx_r_type == BFD_RELOC_32_PCREL
|| fixP->fx_r_type == BFD_RELOC_16_PCREL
|| fixP->fx_r_type == BFD_RELOC_8_PCREL)
@ -4616,19 +4628,16 @@ md_apply_fix3 (fixP, valP, seg)
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
{
segT fseg = S_GET_SEGMENT (fixP->fx_addsy);
segT sym_seg = S_GET_SEGMENT (fixP->fx_addsy);
if ((fseg == seg
if ((sym_seg == seg
|| (symbol_section_p (fixP->fx_addsy)
&& fseg != absolute_section))
&& !S_IS_EXTERNAL (fixP->fx_addsy)
&& !S_IS_WEAK (fixP->fx_addsy)
&& S_IS_DEFINED (fixP->fx_addsy)
&& !S_IS_COMMON (fixP->fx_addsy))
&& sym_seg != absolute_section))
&& !generic_force_reloc (fixP))
{
/* Yes, we add the values in twice. This is because
bfd_perform_relocation subtracts them out again. I think
bfd_perform_relocation is broken, but I don't dare change
bfd_install_relocation subtracts them out again. I think
bfd_install_relocation is broken, but I don't dare change
it. FIXME. */
value += fixP->fx_where + fixP->fx_frag->fr_address;
}
@ -4643,7 +4652,7 @@ md_apply_fix3 (fixP, valP, seg)
}
/* Fix a few things - the dynamic linker expects certain values here,
and we must not dissappoint it. */
and we must not disappoint it. */
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
if (OUTPUT_FLAVOR == bfd_target_elf_flavour
&& fixP->fx_addsy)
@ -4656,12 +4665,25 @@ md_apply_fix3 (fixP, valP, seg)
value = -4;
break;
case BFD_RELOC_386_GOT32:
case BFD_RELOC_386_TLS_GD:
case BFD_RELOC_386_TLS_LDM:
case BFD_RELOC_386_TLS_IE_32:
case BFD_RELOC_386_TLS_IE:
case BFD_RELOC_386_TLS_GOTIE:
case BFD_RELOC_X86_64_TLSGD:
case BFD_RELOC_X86_64_TLSLD:
case BFD_RELOC_X86_64_GOTTPOFF:
value = 0; /* Fully resolved at runtime. No addend. */
/* Fallthrough */
case BFD_RELOC_386_TLS_LE:
case BFD_RELOC_386_TLS_LDO_32:
case BFD_RELOC_386_TLS_LE_32:
case BFD_RELOC_X86_64_DTPOFF32:
case BFD_RELOC_X86_64_TPOFF32:
S_SET_THREAD_LOCAL (fixP->fx_addsy);
break;
case BFD_RELOC_386_GOT32:
case BFD_RELOC_X86_64_GOT32:
value = 0; /* Fully resolved at runtime. No addend. */
break;
@ -4676,12 +4698,11 @@ md_apply_fix3 (fixP, valP, seg)
}
#endif /* defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) */
*valP = value;
#endif /* defined (BFD_ASSEMBLER) && !defined (TE_Mach) */
#endif /* !defined (TE_Mach) */
/* Are we finished with this relocation now? */
if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
#ifdef BFD_ASSEMBLER
else if (use_rela_relocations)
{
fixP->fx_no_overflow = 1;
@ -4689,7 +4710,7 @@ md_apply_fix3 (fixP, valP, seg)
fixP->fx_addnumber = value;
value = 0;
}
#endif
md_number_to_chars (p, value, fixP->fx_size);
}
@ -4835,9 +4856,9 @@ parse_register (reg_string, end_op)
}
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
const char *md_shortopts = "kVQ:sq";
const char *md_shortopts = "kVQ:sqn";
#else
const char *md_shortopts = "q";
const char *md_shortopts = "qn";
#endif
struct option md_longopts[] = {
@ -4858,6 +4879,10 @@ md_parse_option (c, arg)
{
switch (c)
{
case 'n':
optimize_align_code = 0;
break;
case 'q':
quiet_warnings = 1;
break;
@ -4919,15 +4944,16 @@ md_show_usage (stream)
-Q ignored\n\
-V print assembler version number\n\
-k ignored\n\
-n Do not optimize code alignment\n\
-q quieten some warnings\n\
-s ignored\n"));
#else
fprintf (stream, _("\
-n Do not optimize code alignment\n\
-q quieten some warnings\n"));
#endif
}
#ifdef BFD_ASSEMBLER
#if ((defined (OBJ_MAYBE_COFF) && defined (OBJ_MAYBE_AOUT)) \
|| defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF))
@ -5009,7 +5035,6 @@ void i386_elf_emit_arch_note ()
}
}
#endif
#endif /* BFD_ASSEMBLER */
symbolS *
md_undefined_symbol (name)
@ -5039,7 +5064,6 @@ md_section_align (segment, size)
segT segment ATTRIBUTE_UNUSED;
valueT size;
{
#ifdef BFD_ASSEMBLER
#if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
if (OUTPUT_FLAVOR == bfd_target_aout_flavour)
{
@ -5053,7 +5077,6 @@ md_section_align (segment, size)
align = bfd_get_section_alignment (stdoutput, segment);
size = ((size + (1 << align) - 1) & ((valueT) -1 << align));
}
#endif
#endif
return size;
@ -5085,8 +5108,6 @@ s_bss (ignore)
#endif
#ifdef BFD_ASSEMBLER
void
i386_validate_fix (fixp)
fixS *fixp;
@ -5136,6 +5157,11 @@ tc_gen_reloc (section, fixp)
case BFD_RELOC_386_TLS_LE_32:
case BFD_RELOC_386_TLS_LE:
case BFD_RELOC_X86_64_32S:
case BFD_RELOC_X86_64_TLSGD:
case BFD_RELOC_X86_64_TLSLD:
case BFD_RELOC_X86_64_DTPOFF32:
case BFD_RELOC_X86_64_GOTTPOFF:
case BFD_RELOC_X86_64_TPOFF32:
case BFD_RELOC_RVA:
case BFD_RELOC_VTABLE_ENTRY:
case BFD_RELOC_VTABLE_INHERIT:
@ -5213,6 +5239,9 @@ tc_gen_reloc (section, fixp)
case BFD_RELOC_X86_64_PLT32:
case BFD_RELOC_X86_64_GOT32:
case BFD_RELOC_X86_64_GOTPCREL:
case BFD_RELOC_X86_64_TLSGD:
case BFD_RELOC_X86_64_TLSLD:
case BFD_RELOC_X86_64_GOTTPOFF:
rel->addend = fixp->fx_offset - fixp->fx_size;
break;
default:
@ -5238,73 +5267,6 @@ tc_gen_reloc (section, fixp)
return rel;
}
#else /* !BFD_ASSEMBLER */
#if (defined(OBJ_AOUT) | defined(OBJ_BOUT))
void
tc_aout_fix_to_chars (where, fixP, segment_address_in_file)
char *where;
fixS *fixP;
relax_addressT segment_address_in_file;
{
/* In: length of relocation (or of address) in chars: 1, 2 or 4.
Out: GNU LD relocation length code: 0, 1, or 2. */
static const unsigned char nbytes_r_length[] = { 42, 0, 1, 42, 2 };
long r_symbolnum;
know (fixP->fx_addsy != NULL);
md_number_to_chars (where,
(valueT) (fixP->fx_frag->fr_address
+ fixP->fx_where - segment_address_in_file),
4);
r_symbolnum = (S_IS_DEFINED (fixP->fx_addsy)
? S_GET_TYPE (fixP->fx_addsy)
: fixP->fx_addsy->sy_number);
where[6] = (r_symbolnum >> 16) & 0x0ff;
where[5] = (r_symbolnum >> 8) & 0x0ff;
where[4] = r_symbolnum & 0x0ff;
where[7] = ((((!S_IS_DEFINED (fixP->fx_addsy)) << 3) & 0x08)
| ((nbytes_r_length[fixP->fx_size] << 1) & 0x06)
| (((fixP->fx_pcrel << 0) & 0x01) & 0x0f));
}
#endif /* OBJ_AOUT or OBJ_BOUT. */
#if defined (I386COFF)
short
tc_coff_fix2rtype (fixP)
fixS *fixP;
{
if (fixP->fx_r_type == R_IMAGEBASE)
return R_IMAGEBASE;
return (fixP->fx_pcrel ?
(fixP->fx_size == 1 ? R_PCRBYTE :
fixP->fx_size == 2 ? R_PCRWORD :
R_PCRLONG) :
(fixP->fx_size == 1 ? R_RELBYTE :
fixP->fx_size == 2 ? R_RELWORD :
R_DIR32));
}
int
tc_coff_sizemachdep (frag)
fragS *frag;
{
if (frag->fr_next)
return (frag->fr_next->fr_address - frag->fr_address);
else
return 0;
}
#endif /* I386COFF */
#endif /* !BFD_ASSEMBLER */
/* Parse operands using Intel syntax. This implements a recursive descent
parser based on the BNF grammar published in Appendix B of the MASM 6.1
@ -5535,8 +5497,9 @@ i386_intel_operand (operand_string, got_a_float)
/* Add the displacement expression. */
if (*s != '\0')
ret = i386_displacement (s, s + strlen (s))
&& i386_index_check (s);
ret = i386_displacement (s, s + strlen (s));
if (ret)
ret = i386_index_check (operand_string);
}
}
@ -6255,3 +6218,55 @@ intel_putback_token ()
prev_token.reg = NULL;
prev_token.str = NULL;
}
int
tc_x86_regname_to_dw2regnum (const char *regname)
{
unsigned int regnum;
unsigned int regnames_count;
char *regnames_32[] =
{
"eax", "ecx", "edx", "ebx",
"esp", "ebp", "esi", "edi",
"eip"
};
char *regnames_64[] =
{
"rax", "rbx", "rcx", "rdx",
"rdi", "rsi", "rbp", "rsp",
"r8", "r9", "r10", "r11",
"r12", "r13", "r14", "r15",
"rip"
};
char **regnames;
if (flag_code == CODE_64BIT)
{
regnames = regnames_64;
regnames_count = ARRAY_SIZE (regnames_64);
}
else
{
regnames = regnames_32;
regnames_count = ARRAY_SIZE (regnames_32);
}
for (regnum = 0; regnum < regnames_count; regnum++)
if (strcmp (regname, regnames[regnum]) == 0)
return regnum;
return -1;
}
void
tc_x86_frame_initial_instructions (void)
{
static unsigned int sp_regno;
if (!sp_regno)
sp_regno = tc_x86_regname_to_dw2regnum (flag_code == CODE_64BIT
? "rsp" : "esp");
cfi_add_CFA_def_cfa (sp_regno, -x86_cie_data_alignment);
cfi_add_CFA_offset (x86_dwarf2_return_column, x86_cie_data_alignment);
}

View File

@ -1,6 +1,6 @@
/* tc-i386.h -- Header file for tc-i386.c
Copyright 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001
2001, 2002, 2003, 2004
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@ -23,6 +23,10 @@
#ifndef TC_I386
#define TC_I386 1
#ifndef BFD_ASSEMBLER
#error So, do you know what you are doing?
#endif
#ifdef ANSI_PROTOTYPES
struct fix;
#endif
@ -33,45 +37,6 @@ struct fix;
#define TARGET_FORMAT "coff-i386-lynx"
#endif
#ifdef BFD_ASSEMBLER
/* This is used to determine relocation types in tc-i386.c. The first
parameter is the current relocation type, the second one is the desired
type. The idea is that if the original type is already some kind of PIC
relocation, we leave it alone, otherwise we give it the desired type */
#define tc_fix_adjustable(X) tc_i386_fix_adjustable(X)
extern int tc_i386_fix_adjustable PARAMS ((struct fix *));
#if (defined (OBJ_MAYBE_ELF) || defined (OBJ_ELF) || defined (OBJ_MAYBE_COFF) || defined (OBJ_COFF)) && !defined (TE_PE)
/* This arranges for gas/write.c to not apply a relocation if
tc_fix_adjustable() says it is not adjustable.
The "! symbol_used_in_reloc_p" test is there specifically to cover
the case of non-global symbols in linkonce sections. It's the
generally correct thing to do though; If a reloc is going to be
emitted against a symbol then we don't want to adjust the fixup by
applying the reloc during assembly. The reloc will be applied by
the linker during final link. */
#define TC_FIX_ADJUSTABLE(fixP) \
(! symbol_used_in_reloc_p ((fixP)->fx_addsy) && tc_fix_adjustable (fixP))
#endif
/* This expression evaluates to false if the relocation is for a local object
for which we still want to do the relocation at runtime. True if we
are willing to perform this relocation while building the .o file.
This is only used for pcrel relocations, so GOTOFF does not need to be
checked here. I am not sure if some of the others are ever used with
pcrel, but it is easier to be safe than sorry. */
#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
((FIX)->fx_r_type != BFD_RELOC_386_PLT32 \
&& (FIX)->fx_r_type != BFD_RELOC_386_GOT32 \
&& (FIX)->fx_r_type != BFD_RELOC_386_GOTPC \
&& ((FIX)->fx_addsy == NULL \
|| (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
&& ! S_IS_WEAK ((FIX)->fx_addsy) \
&& S_IS_DEFINED ((FIX)->fx_addsy) \
&& ! S_IS_COMMON ((FIX)->fx_addsy))))
#define TARGET_ARCH bfd_arch_i386
#define TARGET_MACH (i386_mach ())
extern unsigned long i386_mach PARAMS ((void));
@ -125,94 +90,8 @@ extern void i386_elf_emit_arch_note PARAMS ((void));
#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 0
#else /* ! BFD_ASSEMBLER */
/* COFF STUFF */
#define COFF_MAGIC I386MAGIC
#define BFD_ARCH bfd_arch_i386
#define COFF_FLAGS F_AR32WR
#define TC_COUNT_RELOC(x) ((x)->fx_addsy || (x)->fx_r_type==7)
#define TC_COFF_FIX2RTYPE(fixP) tc_coff_fix2rtype(fixP)
extern short tc_coff_fix2rtype PARAMS ((struct fix *));
#define TC_COFF_SIZEMACHDEP(frag) tc_coff_sizemachdep (frag)
extern int tc_coff_sizemachdep PARAMS ((fragS *frag));
#ifdef TE_GO32
/* DJGPP now expects some sections to be 2**4 aligned. */
#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) \
((strcmp (obj_segment_name (SEG), ".text") == 0 \
|| strcmp (obj_segment_name (SEG), ".data") == 0 \
|| strcmp (obj_segment_name (SEG), ".bss") == 0 \
|| strncmp (obj_segment_name (SEG), ".gnu.linkonce.t", 15) == 0 \
|| strncmp (obj_segment_name (SEG), ".gnu.linkonce.d", 15) == 0 \
|| strncmp (obj_segment_name (SEG), ".gnu.linkonce.r", 15) == 0) \
? 4 \
: 2)
#else
#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 2
#endif
#define TC_RVA_RELOC 7
/* Need this for PIC relocations */
#define NEED_FX_R_TYPE
#ifdef TE_386BSD
/* The BSDI linker apparently rejects objects with a machine type of
M_386 (100). */
#define AOUT_MACHTYPE 0
#else
#define AOUT_MACHTYPE 100
#endif
#undef REVERSE_SORT_RELOCS
#endif /* ! BFD_ASSEMBLER */
#ifndef LEX_AT
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) x86_cons (EXP, NBYTES)
extern void x86_cons PARAMS ((expressionS *, int));
#define TC_CONS_FIX_NEW(FRAG,OFF,LEN,EXP) x86_cons_fix_new(FRAG, OFF, LEN, EXP)
extern void x86_cons_fix_new
PARAMS ((fragS *, unsigned int, unsigned int, expressionS *));
#endif
#ifdef BFD_ASSEMBLER
#define TC_FORCE_RELOCATION(FIXP) \
((FIXP)->fx_r_type == BFD_RELOC_VTABLE_INHERIT \
|| (FIXP)->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
#else
/* For COFF. */
#define TC_FORCE_RELOCATION(FIXP) \
((FIXP)->fx_r_type == 7)
#endif
#ifdef BFD_ASSEMBLER
#define NO_RELOC BFD_RELOC_NONE
#else
#define NO_RELOC 0
#endif
#define tc_coff_symbol_emit_hook(a) ; /* not used */
#ifndef BFD_ASSEMBLER
#ifndef OBJ_AOUT
#ifndef TE_PE
#ifndef TE_GO32
/* Local labels starts with .L */
#define LOCAL_LABEL(name) (name[0] == '.' \
&& (name[1] == 'L' || name[1] == 'X' || name[1] == '.'))
#endif
#endif
#endif
#endif
#define LOCAL_LABELS_FB 1
#define tc_aout_pre_write_hook(x) {;} /* not used */
#define tc_crawl_symbol_chain(a) {;} /* not used */
#define tc_headers_hook(a) {;} /* not used */
extern const char extra_symbol_chars[];
#define tc_symbol_chars extra_symbol_chars
@ -314,13 +193,15 @@ typedef struct
#define CpuSSE 0x1000 /* Streaming SIMD extensions required */
#define CpuSSE2 0x2000 /* Streaming SIMD extensions 2 required */
#define Cpu3dnow 0x4000 /* 3dnow! support required */
#define CpuPNI 0x8000 /* Prescott New Instructions required */
#define CpuPadLock 0x10000 /* VIA PadLock required */
/* These flags are set by gas depending on the flag_code. */
#define Cpu64 0x4000000 /* 64bit support required */
#define CpuNo64 0x8000000 /* Not supported in the 64bit mode */
/* The default value for unknown CPUs - enable all features to avoid problems. */
#define CpuUnknownFlags (Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuSledgehammer|CpuMMX|CpuSSE|CpuSSE2|Cpu3dnow|CpuK6|CpuAthlon)
#define CpuUnknownFlags (Cpu086|Cpu186|Cpu286|Cpu386|Cpu486|Cpu586|Cpu686|CpuP4|CpuSledgehammer|CpuMMX|CpuSSE|CpuSSE2|CpuPNI|Cpu3dnow|CpuK6|CpuAthlon|CpuPadLock)
/* the bits in opcode_modifier are used to generate the final opcode from
the base_opcode. These bits also are used to detect alternate forms of
@ -518,21 +399,66 @@ arch_entry;
#define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
#endif
#ifdef BFD_ASSEMBLER
void i386_validate_fix PARAMS ((struct fix *));
#define TC_VALIDATE_FIX(FIXP,SEGTYPE,SKIP) i386_validate_fix(FIXP)
#ifndef LEX_AT
#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) x86_cons (EXP, NBYTES)
extern void x86_cons PARAMS ((expressionS *, int));
#define TC_CONS_FIX_NEW(FRAG,OFF,LEN,EXP) x86_cons_fix_new(FRAG, OFF, LEN, EXP)
extern void x86_cons_fix_new
PARAMS ((fragS *, unsigned int, unsigned int, expressionS *));
#endif
#endif /* TC_I386 */
#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
#define NO_RELOC BFD_RELOC_NONE
void i386_validate_fix PARAMS ((struct fix *));
#define TC_VALIDATE_FIX(FIX,SEGTYPE,SKIP) i386_validate_fix(FIX)
#define tc_fix_adjustable(X) tc_i386_fix_adjustable(X)
extern int tc_i386_fix_adjustable PARAMS ((struct fix *));
/* Values passed to md_apply_fix3 don't include the symbol value. */
#define MD_APPLY_SYM_VALUE(FIX) 0
/* ELF wants external syms kept, as does PE COFF. */
#if defined (TE_PE) && defined (STRICT_PE_FORMAT)
#define EXTERN_FORCE_RELOC \
(OUTPUT_FLAVOR == bfd_target_elf_flavour \
|| OUTPUT_FLAVOR == bfd_target_coff_flavour)
#else
#define EXTERN_FORCE_RELOC \
(OUTPUT_FLAVOR == bfd_target_elf_flavour)
#endif
/* This expression evaluates to true if the relocation is for a local
object for which we still want to do the relocation at runtime.
False if we are willing to perform this relocation while building
the .o file. GOTOFF does not need to be checked here because it is
not pcrel. I am not sure if some of the others are ever used with
pcrel, but it is easier to be safe than sorry. */
#define TC_FORCE_RELOCATION_LOCAL(FIX) \
(!(FIX)->fx_pcrel \
|| (FIX)->fx_plt \
|| (FIX)->fx_r_type == BFD_RELOC_386_PLT32 \
|| (FIX)->fx_r_type == BFD_RELOC_386_GOT32 \
|| (FIX)->fx_r_type == BFD_RELOC_386_GOTPC \
|| TC_FORCE_RELOCATION (FIX))
#define md_operand(x)
extern const struct relax_type md_relax_table[];
#define TC_GENERIC_RELAX_TABLE md_relax_table
extern int optimize_align_code;
#define md_do_align(n, fill, len, max, around) \
if ((n) && !need_pass_2 \
&& (!(fill) || ((char)*(fill) == (char)0x90 && (len) == 1)) \
if ((n) \
&& !need_pass_2 \
&& optimize_align_code \
&& (!(fill) \
|| ((char)*(fill) == (char)0x90 && (len) == 1)) \
&& subseg_text_p (now_seg)) \
{ \
frag_align_code ((n), (max)); \
@ -559,4 +485,19 @@ void i386_print_statistics PARAMS ((FILE *));
extern void sco_id PARAMS ((void));
#endif
#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
/* We want .cfi_* pseudo-ops for generating unwind info. */
#define TARGET_USE_CFIPOP 1
extern unsigned int x86_dwarf2_return_column;
#define DWARF2_DEFAULT_RETURN_COLUMN x86_dwarf2_return_column
extern int x86_cie_data_alignment;
#define DWARF2_CIE_DATA_ALIGNMENT x86_cie_data_alignment
#define tc_regname_to_dw2regnum tc_x86_regname_to_dw2regnum
extern int tc_x86_regname_to_dw2regnum PARAMS ((const char *regname));
#define tc_cfi_frame_initial_instructions tc_x86_frame_initial_instructions
extern void tc_x86_frame_initial_instructions PARAMS ((void));
#endif /* TC_I386 */

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,13 @@ dnl brackets, be sure changequote invocations surround it.
dnl
dnl
dnl v2.5 needed for --bindir et al
AC_PREREQ(2.13)
AC_PREREQ(2.57)
AC_INIT(as.h)
dnl Autoconf 2.57 will find the aux dir without this. However, unless
dnl we specify this explicitly, automake-1.7 will assume that ylwrap is in
dnl gas/ instead of gas/../.
AC_CONFIG_AUX_DIR(..)
AC_CANONICAL_SYSTEM
AC_ISC_POSIX
@ -70,10 +74,14 @@ AM_CONFIG_HEADER(config.h:config.in)
# If we are on a DOS filesystem, we must use gdb.ini rather than
# .gdbinit.
GDBINIT=".gdbinit"
case "${host}" in
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-windows*)
GDBINIT="gdb.ini"
AC_CONFIG_FILES(gdb.ini:gdbinit.in)
;;
*)
GDBINIT=".gdbinit"
AC_CONFIG_FILES(.gdbinit:gdbinit.in)
;;
esac
AC_SUBST(GDBINIT)
@ -114,14 +122,18 @@ changequote([,])dnl
arch=
endian=
case ${cpu} in
am33_2.0) cpu_type=mn10300 endian=little ;;
alpha*) cpu_type=alpha ;;
arm*b|xscale*b|strongarm*b) cpu_type=arm endian=big ;;
arm*|xscale*|strongarm*) cpu_type=arm endian=little ;;
c4x*) cpu_type=tic4x ;;
hppa*) cpu_type=hppa ;;
changequote(,)dnl
i[3456]86) cpu_type=i386 arch=i386;;
i[3-7]86) cpu_type=i386 arch=i386;;
x86_64) cpu_type=i386 arch=x86_64;;
ia64) cpu_type=ia64 ;;
ip2k) cpu_type=ip2k endian=big ;;
iq2000) cpu_type=iq2000 endian=big ;;
m6811|m6812|m68hc12) cpu_type=m68hc11 ;;
m680[012346]0) cpu_type=m68k ;;
changequote([,])dnl
@ -151,6 +163,9 @@ changequote([,])dnl
sparc86x*) cpu_type=sparc arch=sparc86x ;;
sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
v850*) cpu_type=v850 ;;
xtensa*) cpu_type=xtensa arch=xtensa ;;
m32r) cpu_type=m32r target_cpu=m32r endian=big ;;
m32rle) cpu_type=m32r target_cpu=m32r endian=little ;;
*) cpu_type=${cpu} ;;
esac
@ -167,348 +182,347 @@ changequote([,])dnl
# assign object format
case ${generic_target} in
a29k-*-coff) fmt=coff ;;
a29k-amd-udi) fmt=coff ;;
a29k-amd-ebmon) fmt=coff ;;
a29k-nyu-sym1) fmt=coff ;;
a29k-*-rtems*) fmt=coff ;;
a29k-*-vxworks*) fmt=coff ;;
a29k-*-coff) fmt=coff ;;
a29k-amd-udi) fmt=coff ;;
a29k-amd-ebmon) fmt=coff ;;
a29k-nyu-sym1) fmt=coff ;;
a29k-*-rtems*) fmt=coff ;;
a29k-*-vxworks*) fmt=coff ;;
alpha*-*-*vms*) fmt=evax ;;
alpha*-*-netware*) fmt=ecoff ;;
alpha*-*-osf*) fmt=ecoff ;;
alpha*-*-linuxecoff*) fmt=ecoff ;;
alpha*-*-linux-gnu*) fmt=elf em=linux ;;
alpha*-*-netbsd*) fmt=elf em=nbsd ;;
alpha*-*-openbsd*) fmt=elf em=obsd ;;
alpha*-*-*vms*) fmt=evax ;;
alpha*-*-netware*) fmt=ecoff ;;
alpha*-*-osf*) fmt=ecoff ;;
alpha*-*-linuxecoff*) fmt=ecoff ;;
alpha*-*-linux-gnu*) fmt=elf em=linux ;;
alpha*-*-netbsd*) fmt=elf em=nbsd ;;
alpha*-*-openbsd*) fmt=elf em=obsd ;;
arc-*-elf*) fmt=elf bfd_gas=yes ;;
# cpu_type for am33_2.0 is set to mn10300
mn10300-*-linux*) fmt=elf bfd_gas=yes em=linux ;;
arm-*-aout) fmt=aout ;;
arm-*-coff | thumb-*-coff) fmt=coff ;;
arm-*-rtems | thumb-*-rtems) fmt=elf ;;
arm-*-elf | thumb-*-elf) fmt=elf ;;
arc-*-elf*) fmt=elf ;;
arm-*-aout) fmt=aout ;;
arm-*-coff | thumb-*-coff) fmt=coff ;;
arm-*-rtems* | thumb-*-rtems*) fmt=elf ;;
arm-*-elf | thumb-*-elf) fmt=elf ;;
arm-*-kaos*) fmt=elf ;;
arm*-*-conix*) fmt=elf ;;
arm-*-linux*aout*) fmt=aout em=linux ;;
arm*-*-linux-gnu* | arm*-*-uclinux*)
fmt=elf em=linux ;;
arm-*-linux*aout*) fmt=aout em=linux ;;
arm*-*-linux-gnu*) fmt=elf em=linux ;;
arm*-*-uclinux*) fmt=elf em=linux ;;
arm-*-netbsdelf*) fmt=elf em=nbsd ;;
arm-*-netbsd* | arm-*-openbsd*) fmt=aout em=nbsd ;;
arm-*-oabi | thumb-*-oabi) fmt=elf ;;
arm-epoc-pe | thumb-epoc-pe) fmt=coff em=epoc-pe ;;
arm-*-wince) fmt=coff em=wince-pe ;;
arm-*-pe | thumb-*-pe) fmt=coff em=pe ;;
arm-*-riscix*) fmt=aout em=riscix ;;
arm-*-vxworks) fmt=coff ;;
arm-*-*n*bsd*) fmt=aout em=nbsd ;;
arm-**-nto*) fmt=elf ;;
arm-*-oabi | thumb-*-oabi) fmt=elf ;;
arm-epoc-pe | thumb-epoc-pe) fmt=coff em=epoc-pe ;;
arm-wince-pe | arm-*-wince) fmt=coff em=wince-pe ;;
arm-*-pe | thumb-*-pe) fmt=coff em=pe ;;
arm-*-riscix*) fmt=aout em=riscix ;;
avr-*-*) fmt=elf bfd_gas=yes ;;
avr-*-*) fmt=elf ;;
cris-*-*) fmt=multi bfd_gas=yes ;;
cris-*-linux-gnu*) fmt=multi bfd_gas=yes em=linux ;;
cris-*-*) fmt=multi bfd_gas=yes ;;
d10v-*-*) fmt=elf bfd_gas=yes ;;
d30v-*-*) fmt=elf bfd_gas=yes ;;
dlx-*-*) fmt=elf ;;
d10v-*-*) fmt=elf ;;
d30v-*-*) fmt=elf ;;
dlx-*-*) fmt=elf ;;
fr30-*-*) fmt=elf ;;
frv-*-*linux*) fmt=elf em=linux;;
frv-*-*) fmt=elf ;;
fr30-*-*) fmt=elf bfd_gas=yes ;;
frv-*-*) fmt=elf bfd_gas=yes ;;
hppa-*-linux*) case ${cpu} in
hppa*64*) fmt=elf em=hppalinux64;;
hppa*) fmt=elf em=linux;;
esac ;;
hppa-*-*elf*) fmt=elf em=hppa ;;
hppa-*-lites*) fmt=elf em=hppa ;;
hppa-*-netbsd*) fmt=elf em=nbsd ;;
hppa-*-openbsd*) fmt=elf em=hppa ;;
hppa-*-osf*) fmt=som em=hppa ;;
hppa-*-rtems*) fmt=elf em=hppa ;;
hppa-*-hpux11*) case ${cpu} in
hppa*64*) fmt=elf em=hppa64 ;;
hppa*) fmt=som em=hppa ;;
esac ;;
hppa-*-hpux*) fmt=som em=hppa ;;
hppa-*-mpeix*) fmt=som em=hppa ;;
hppa-*-bsd*) fmt=som em=hppa ;;
hppa-*-hiux*) fmt=som em=hppa ;;
hppa-*-linux-gnu*) case ${cpu} in
hppa*64*)
fmt=elf em=hppalinux64;;
hppa*)
fmt=elf em=linux;;
esac ;;
hppa-*-*elf*) fmt=elf em=hppa ;;
hppa-*-lites*) fmt=elf em=hppa ;;
hppa-*-netbsd*) fmt=elf em=nbsd ;;
hppa-*-openbsd*) fmt=elf em=hppa ;;
hppa-*-osf*) fmt=som em=hppa ;;
hppa-*-rtems*) fmt=elf em=hppa ;;
hppa-*-hpux11*) case ${cpu} in
hppa*64*)
fmt=elf em=hppa64 ;;
hppa*)
fmt=som em=hppa ;;
esac ;;
hppa-*-hpux*) fmt=som em=hppa ;;
hppa-*-mpeix*) fmt=som em=hppa ;;
hppa-*-bsd*) fmt=som em=hppa ;;
hppa-*-hiux*) fmt=som em=hppa ;;
h8300-*-rtems*) fmt=coff ;;
h8300-*-coff) fmt=coff ;;
h8300-*-elf) fmt=elf ;;
h8500-*-rtems*) fmt=coff ;;
h8500-*-coff) fmt=coff ;;
h8300-*-rtems*) fmt=coff ;;
h8300-*-coff) fmt=coff ;;
h8300-*-elf) fmt=elf ;;
h8500-*-rtems*) fmt=coff ;;
h8500-*-coff) fmt=coff ;;
i370-*-elf* | i370-*-linux*) fmt=elf ;;
i386-ibm-aix*) fmt=coff em=i386aix ;;
i386-sequent-bsd*) fmt=aout em=dynix bfd_gas=yes ;;
i386-*-beospe*) fmt=coff em=pe bfd_gas=yes ;;
i386-*-beoself* | i386-*-beos*) fmt=elf bfd_gas=yes ;;
i386-*-bsd*) fmt=aout em=386bsd ;;
i386-*-netbsd0.8) fmt=aout em=386bsd ;;
i386-*-netbsdpe*) fmt=coff em=pe bfd_gas=yes ;;
i386-*-netbsd*) em=nbsd bfd_gas=yes
case ${cpu} in
x86_64) fmt=elf ;;
*) case ${os} in
*elf*) fmt=elf ;;
*) fmt=aout ;;
esac
;;
esac
;;
i386-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;;
i386-*-linux*aout* | i386-*-linux*oldld) fmt=aout em=linux ;;
i386-*-linux*coff*) fmt=coff em=linux ;;
i386-*-linux-gnu*) fmt=elf em=linux bfd_gas=yes ;;
x86_64-*-linux-gnu*) fmt=elf em=linux bfd_gas=yes ;;
i386-*-lynxos*) fmt=coff em=lynx ;;
i370-*-elf* | i370-*-linux*) fmt=elf ;;
i386-ibm-aix*) fmt=coff em=i386aix ;;
i386-sequent-bsd*) fmt=aout em=dynix ;;
i386-*-beospe*) fmt=coff em=pe ;;
i386-*-beos*) fmt=elf ;;
i386-*-coff) fmt=coff ;;
i386-*-elf) fmt=elf ;;
i386-*-kaos*) fmt=elf ;;
i386-*-bsd*) fmt=aout em=386bsd ;;
i386-*-netbsd0.8) fmt=aout em=386bsd ;;
i386-*-netbsdpe*) fmt=coff em=pe ;;
i386-*-netbsd*-gnu* | \
i386-*-knetbsd*-gnu | \
i386-*-netbsdelf*) fmt=elf em=nbsd ;;
i386-*-*n*bsd*) case ${cpu} in
x86_64) fmt=elf em=nbsd ;;
*) fmt=aout em=nbsd ;;
esac ;;
i386-*-linux*aout*) fmt=aout em=linux ;;
i386-*-linux*oldld) fmt=aout em=linux ;;
i386-*-linux*coff*) fmt=coff em=linux ;;
i386-*-linux-gnu*) fmt=elf em=linux ;;
x86_64-*-linux-gnu*) fmt=elf em=linux ;;
i386-*-lynxos*) fmt=coff em=lynx ;;
changequote(,)dnl
i386-*-sysv[45]* | i386-*-solaris* | i386-*-elf)
fmt=elf bfd_gas=yes ;;
i386-*-freebsdaout* | i386-*-freebsd[12].* | i386-*-freebsd[12])
fmt=aout em=386bsd ;;
i386-*-sysv[45]*) fmt=elf ;;
i386-*-solaris*) fmt=elf ;;
i386-*-freebsdaout*) fmt=aout em=386bsd ;;
i386-*-freebsd[12].*) fmt=aout em=386bsd ;;
i386-*-freebsd[12]) fmt=aout em=386bsd ;;
changequote([,])dnl
i386-*-coff | i386-*-sysv* | i386-*-sco3.2v5*coff | i386-*-isc*)
fmt=coff ;;
i386-*-sco3.2v5*) fmt=elf
if test ${this_target} = $target; then
AC_DEFINE(SCO_ELF, 1,
[Define if defaulting to ELF on SCO 5.])
fi
;;
i386-*-sco3.2*) fmt=coff ;;
i386-*-vsta) fmt=aout ;;
i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
fmt=coff em=go32 bfd_gas=yes
AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?])
;;
i386-*-rtemself*) fmt=elf ;;
i386-*-rtemscoff*) fmt=coff ;;
i386-*-rtems*) fmt=elf ;;
i386-*-gnu*) fmt=elf ;;
i386-*-mach*)
fmt=aout em=mach bfd_gas=yes ;;
i386-*-msdos*) fmt=aout ;;
i386-*-moss*) fmt=elf ;;
i386-*-pe) fmt=coff em=pe bfd_gas=yes ;;
i386-*-cygwin*) fmt=coff em=pe bfd_gas=yes ;;
i386-*-interix*) fmt=coff em=interix bfd_gas=yes ;;
i386-*-mingw32*) fmt=coff em=pe bfd_gas=yes ;;
i386-*-nto-qnx*) fmt=elf ;;
i386-*-*nt*) fmt=coff em=pe bfd_gas=yes ;;
i386-*-vxworks*) fmt=aout ;;
i386-*-chaos) fmt=elf ;;
i860-stardent-sysv4* | i860-stardent-elf*)
fmt=elf bfd_gas=yes endian=little
AC_MSG_WARN(GAS support for ${generic_target} is preliminary and a work in progress) ;;
i960-*-bout) fmt=bout ;;
i960-*-coff) fmt=coff em=ic960 ;;
i960-*-rtems*) fmt=coff em=ic960 ;;
i960-*-nindy*) fmt=bout ;;
i960-*-vxworks4*) fmt=bout ;;
i960-*-vxworks5.0) fmt=bout ;;
i960-*-vxworks5.*) fmt=coff em=ic960 ;;
i960-*-vxworks*) fmt=bout ;;
i960-*-elf*) fmt=elf ;;
i386-*-freebsd* | i386-*-kfreebsd*-gnu)
fmt=elf em=freebsd ;;
i386-*-sysv*) fmt=coff ;;
i386-*-sco3.2v5*coff) fmt=coff ;;
i386-*-isc*) fmt=coff ;;
i386-*-sco3.2v5*) fmt=elf
if test ${this_target} = $target; then
AC_DEFINE(SCO_ELF, 1, [Define if defaulting to ELF on SCO 5.])
fi ;;
i386-*-sco3.2*) fmt=coff ;;
i386-*-vsta) fmt=aout ;;
i386-*-msdosdjgpp* \
| i386-*-go32* \
| i386-go32-rtems*) fmt=coff em=go32
AC_DEFINE(STRICTCOFF, 1, [Using strict COFF?]) ;;
i386-*-rtemself*) fmt=elf ;;
i386-*-rtemscoff*) fmt=coff ;;
i386-*-rtems*) fmt=elf ;;
i386-*-gnu*) fmt=elf ;;
i386-*-mach*) fmt=aout em=mach ;;
i386-*-msdos*) fmt=aout ;;
i386-*-moss*) fmt=elf ;;
i386-*-pe) fmt=coff em=pe ;;
i386-*-cygwin*) fmt=coff em=pe ;;
i386-*-interix*) fmt=coff em=interix ;;
i386-*-mingw32*) fmt=coff em=pe ;;
i386-*-nto-qnx*) fmt=elf ;;
i386-*-*nt*) fmt=coff em=pe ;;
i386-*-chaos) fmt=elf ;;
ia64-*-elf*) fmt=elf ;;
ia64-*-aix*) fmt=elf em=ia64aix ;;
ia64-*-linux-gnu*) fmt=elf em=linux ;;
ia64-*-hpux*) fmt=elf em=hpux ;;
ia64-*-netbsd*) fmt=elf em=nbsd ;;
i860-*-*) fmt=elf endian=little
AC_MSG_WARN(GAS support for ${generic_target} is preliminary and a work in progress) ;;
i960-*-bout) fmt=bout ;;
i960-*-coff) fmt=coff em=ic960 ;;
i960-*-rtems*) fmt=coff em=ic960 ;;
i960-*-nindy*) fmt=bout ;;
i960-*-vxworks5.0) fmt=bout ;;
i960-*-vxworks5.*) fmt=coff em=ic960 ;;
i960-*-vxworks*) fmt=bout ;;
i960-*-elf*) fmt=elf ;;
m32r-*-*) fmt=elf bfd_gas=yes ;;
ia64-*-elf*) fmt=elf ;;
ia64-*-aix*) fmt=elf em=ia64aix ;;
ia64-*-linux-gnu*) fmt=elf em=linux ;;
ia64-*-hpux*) fmt=elf em=hpux ;;
ia64-*-netbsd*) fmt=elf em=nbsd ;;
m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)fmt=elf bfd_gas=yes ;;
ip2k-*-*) fmt=elf ;;
m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
fmt=aout em=sun3 ;;
m68k-motorola-sysv*) fmt=coff em=delta ;;
m68k-bull-sysv3*) fmt=coff em=dpx2 ;;
m68k-apollo-*) fmt=coff em=apollo ;;
m68k-*-sysv4*) # must be before -sysv*
fmt=elf em=svr4 ;;
m68k-*-elf*) fmt=elf ;;
m68k-*-coff | m68k-*-sysv* | m68k-*-rtemscoff*)
fmt=coff ;;
m68k-*-rtems*) fmt=elf ;;
m68k-*-hpux*) fmt=hp300 em=hp300 ;;
m68k-*-linux*aout*) fmt=aout em=linux ;;
m68k-*-linux-gnu*) fmt=elf em=linux ;;
m68k-*-gnu*) fmt=elf ;;
m68k-*-lynxos*) fmt=coff em=lynx ;;
m68k-*-netbsdelf*) fmt=elf em=nbsd bfd_gas=yes ;;
m68k-*-netbsdaout* | m68k-*-netbsd*)
fmt=aout em=nbsd bfd_gas=yes ;;
m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
m68k-apple-aux*) fmt=coff em=aux ;;
m68k-*-psos*) fmt=elf em=psos;;
iq2000-*-elf) fmt=elf bfd_gas=yes ;;
m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
m88k-*-coff*) fmt=coff ;;
m32r-*-elf*) fmt=elf ;;
m32r-*-linux*) fmt=elf em=linux;;
mcore-*-elf) fmt=elf bfd_gas=yes ;;
mcore-*-pe) fmt=coff em=pe bfd_gas=yes ;;
m68hc11-*-* | m6811-*-*) fmt=elf ;;
m68hc12-*-* | m6812-*-*) fmt=elf ;;
m68k-*-vxworks*) fmt=aout em=sun3 ;;
m68k-ericsson-ose) fmt=aout em=sun3 ;;
m68k-*-sunos*) fmt=aout em=sun3 ;;
m68k-motorola-sysv*) fmt=coff em=delta ;;
m68k-bull-sysv3*) fmt=coff em=dpx2 ;;
m68k-apollo-*) fmt=coff em=apollo ;;
m68k-*-elf*) fmt=elf ;;
m68k-*-sysv4*) fmt=elf em=svr4 ;;
m68k-*-sysv*) fmt=coff ;;
m68k-*-coff | m68k-*-rtemscoff*) fmt=coff ;;
m68k-*-rtems*) fmt=elf ;;
m68k-*-hpux*) fmt=hp300 em=hp300 ;;
m68k-*-linux*aout*) fmt=aout em=linux ;;
m68k-*-linux-gnu*) fmt=elf em=linux ;;
m68k-*-uclinux*) fmt=elf ;;
m68k-*-gnu*) fmt=elf ;;
m68k-*-lynxos*) fmt=coff em=lynx ;;
m68k-*-netbsdelf*) fmt=elf em=nbsd ;;
m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
m68k-apple-aux*) fmt=coff em=aux ;;
m68k-*-psos*) fmt=elf em=psos;;
m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
m88k-*-coff*) fmt=coff ;;
mcore-*-elf) fmt=elf ;;
mcore-*-pe) fmt=coff em=pe bfd_gas=yes ;;
# don't change em like *-*-bsd does
mips-dec-openbsd*) fmt=elf endian=little ;;
mips-dec-bsd*) fmt=aout endian=little ;;
mips-sony-bsd*) fmt=ecoff ;;
mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
mips-*-ultrix*) fmt=ecoff endian=little ;;
mips-*-osf*) fmt=ecoff endian=little ;;
mips-*-ecoff*) fmt=ecoff ;;
mips-*-pe*) fmt=coff endian=little em=pe ;;
mips-*-irix6*) fmt=elf ;;
mips-*-irix5*) fmt=elf ;;
mips-*-irix*) fmt=ecoff ;;
mips-*-lnews*) fmt=ecoff em=lnews ;;
mips-*-riscos*) fmt=ecoff ;;
mips*-*-linux*) fmt=elf em=tmips ;;
mips-*-sysv4*MP* | mips-*-gnu*)
fmt=elf em=tmips ;;
mips-*-sysv*) fmt=ecoff ;;
mips-*-elf* | mips-*-rtems* | mips-*-netbsd* | mips-*-openbsd*)
fmt=elf ;;
mips-*-vxworks*) fmt=elf ;;
mmix-*-*) fmt=elf bfd_gas=yes ;;
mn10200-*-*) fmt=elf bfd_gas=yes ;;
mn10300-*-*) fmt=elf bfd_gas=yes ;;
openrisc-*-*) fmt=elf bfd_gas=yes ;;
or32-*-rtems*) fmt=coff ;;
or32-*-coff) fmt=coff ;;
or32-*-elf) fmt=elf ;;
pj*) fmt=elf ;;
ppc-*-pe | ppc-*-cygwin* | ppc-*-winnt*)
fmt=coff em=pe ;;
ppc-*-aix5*) fmt=coff em=aix5 ;;
ppc-*-aix*) fmt=coff ;;
ppc-*-beos*) fmt=coff ;;
ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
fmt=elf ;;
ppc-*-linux-gnu*) fmt=elf
case "$endian" in
big) ;;
*) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
esac
;;
ppc-*-solaris*) fmt=elf
if test ${this_target} = $target; then
AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
[Define if default target is PowerPC Solaris.])
fi
if test x${endian} = xbig; then
AC_MSG_ERROR(Solaris must be configured little endian)
fi
;;
ppc-*-rtems*) fmt=elf ;;
ppc-*-macos* | ppc-*-mpw*)
fmt=coff em=macos ;;
ppc-*-netware*) fmt=elf em=ppcnw ;;
ppc-*-vxworks*) fmt=elf ;;
ppc-*-windiss*) fmt=elf ;;
mips-dec-openbsd*) fmt=elf endian=little ;;
mips-sony-bsd*) fmt=ecoff ;;
mips-*-bsd*)
AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
mips-*-ultrix*) fmt=ecoff endian=little ;;
mips-*-osf*) fmt=ecoff endian=little ;;
mips-*-ecoff*) fmt=ecoff ;;
mips-*-pe*) fmt=coff endian=little em=pe ;;
mips-*-irix6*) fmt=elf em=irix ;;
mips-*-irix5*) fmt=elf em=irix ;;
mips-*-irix*) fmt=ecoff em=irix ;;
mips-*-lnews*) fmt=ecoff em=lnews ;;
mips-*-riscos*) fmt=ecoff ;;
mips*-*-linux*) fmt=elf em=tmips ;;
mips-*-sysv4*MP* | mips-*-gnu*) fmt=elf em=tmips ;;
mips-*-sysv*) fmt=ecoff ;;
mips-*-elf* | mips-*-rtems*) fmt=elf ;;
mips-*-netbsd*) fmt=elf ;;
mips-*-openbsd*) fmt=elf ;;
s390x-*-linux-gnu*) fmt=elf em=linux ;;
s390-*-linux-gnu*) fmt=elf em=linux ;;
mmix-*-*) fmt=elf ;;
mn10200-*-*) fmt=elf ;;
mn10300-*-*) fmt=elf ;;
msp430-*-*) fmt=elf ;;
openrisc-*-*) fmt=elf ;;
or32-*-rtems*) fmt=elf ;;
or32-*-coff) fmt=coff ;;
or32-*-elf) fmt=elf ;;
pj*) fmt=elf ;;
sh*-*-linux*) fmt=elf em=linux
case ${cpu} in
sh*eb)
endian=big ;;
sh*)
endian=little ;;
esac ;;
sh5*-*-netbsd*) fmt=elf em=nbsd ;;
sh64*-*-netbsd*) fmt=elf em=nbsd ;;
sh*-*-netbsdelf*) fmt=elf em=nbsd ;;
sh-*-elf*) fmt=elf ;;
sh-*-coff*) fmt=coff ;;
sh-*-pe*) fmt=coff em=pe bfd_gas=yes endian=little ;;
sh-*-rtemself*) fmt=elf ;;
sh-*-rtems*) fmt=coff ;;
ppc-*-pe | ppc-*-cygwin*) fmt=coff em=pe ;;
ppc-*-winnt*) fmt=coff em=pe ;;
changequote(,)dnl
ppc-*-aix5.[01]) fmt=coff em=aix5 ;;
changequote([,])dnl
ppc-*-aix5.*) fmt=coff em=aix5
AC_DEFINE(AIX_WEAK_SUPPORT, 1,
[Define if using AIX 5.2 value for C_WEAKEXT.])
;;
ppc-*-aix*) fmt=coff ;;
ppc-*-beos*) fmt=coff ;;
ppc-*-*n*bsd* | ppc-*-elf*) fmt=elf ;;
ppc-*-eabi* | ppc-*-sysv4*) fmt=elf ;;
ppc-*-linux-gnu*) fmt=elf em=linux
case "$endian" in
big) ;;
*) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
esac ;;
ppc-*-solaris*) fmt=elf
if test ${this_target} = $target; then
AC_DEFINE(TARGET_SOLARIS_COMMENT, 1,
[Define if default target is PowerPC Solaris.])
fi
if test x${endian} = xbig; then
AC_MSG_ERROR(Solaris must be configured little endian)
fi ;;
ppc-*-rtems*) fmt=elf ;;
ppc-*-macos* | ppc-*-mpw*) fmt=coff em=macos ;;
ppc-*-netware*) fmt=elf em=ppcnw ;;
ppc-**-nto*) fmt=elf ;;
ppc-*-kaos*) fmt=elf ;;
sh64-*-elf*) fmt=elf ;;
ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
ns32k-*-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
s390x-*-linux-gnu*) fmt=elf em=linux ;;
s390-*-linux-gnu*) fmt=elf em=linux ;;
sparc-*-rtemsaout*) fmt=aout ;;
sparc-*-rtemself*) fmt=elf ;;
sparc-*-rtems*) fmt=elf ;;
sparc-*-sunos4*) fmt=aout em=sun3 ;;
sparc-*-aout | sparc*-*-vxworks*)
fmt=aout em=sparcaout ;;
sparc-*-coff) fmt=coff ;;
sparc-*-linux*aout*) fmt=aout em=linux ;;
sparc-*-linux-gnu*) fmt=elf em=linux ;;
sparc-*-lynxos*) fmt=coff em=lynx ;;
sparc-fujitsu-none) fmt=aout ;;
sparc-*-elf | sparc-*-sysv4* | sparc-*-solaris*)
fmt=elf ;;
sparc-*-netbsd*) em=nbsd bfd_gas=yes
case ${cpu} in
sparc) case ${os} in
*elf*) fmt=elf ;;
*) fmt=aout ;;
esac ;;
sparc64) fmt=elf ;;
esac
;;
sparc-*-openbsd*) em=nbsd
case ${cpu} in
sparc) fmt=aout ;;
sparc64) fmt=elf ;;
esac
;;
sh*-*-linux*) fmt=elf em=linux
case ${cpu} in
sh*eb) endian=big ;;
*) endian=little ;;
esac ;;
sh5*-*-netbsd*) fmt=elf em=nbsd ;;
sh64*-*-netbsd*) fmt=elf em=nbsd ;;
sh*-*-netbsdelf*) fmt=elf em=nbsd ;;
sh-*-elf*) fmt=elf ;;
sh-*-coff*) fmt=coff ;;
sh-*-nto*) fmt=elf ;;
sh-*-pe*) fmt=coff em=pe bfd_gas=yes endian=little ;;
sh-*-rtemscoff*) fmt=coff ;;
sh-*-rtems*) fmt=elf ;;
sh-*-kaos*) fmt=elf ;;
shle*-*-kaos*) fmt=elf ;;
sh64-*-elf*) fmt=elf ;;
strongarm-*-coff) fmt=coff ;;
strongarm-*-elf) fmt=elf ;;
xscale-*-coff) fmt=coff ;;
xscale-*-elf) fmt=elf ;;
ns32k-pc532-mach*) fmt=aout em=pc532mach ;;
ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
ns32k-*-*n*bsd*) fmt=aout em=nbsd532 ;;
tic30-*-*aout*) fmt=aout bfd_gas=yes ;;
tic30-*-*coff*) fmt=coff bfd_gas=yes ;;
tic54x-*-* | c54x*-*-*)
fmt=coff bfd_gas=yes need_libm=yes;;
tic80-*-*) fmt=coff ;;
sparc-*-rtemsaout*) fmt=aout ;;
sparc-*-rtemself*) fmt=elf ;;
sparc-*-rtems*) fmt=elf ;;
sparc-*-sunos4*) fmt=aout em=sun3 ;;
sparc-*-aout | sparc*-*-vxworks*) fmt=aout em=sparcaout ;;
sparc-*-coff) fmt=coff ;;
sparc-*-linux*aout*) fmt=aout em=linux ;;
sparc-*-linux-gnu*) fmt=elf em=linux ;;
sparc-*-lynxos*) fmt=coff em=lynx ;;
sparc-fujitsu-none) fmt=aout ;;
sparc-*-elf) fmt=elf ;;
sparc-*-sysv4*) fmt=elf ;;
sparc-*-solaris*) fmt=elf ;;
sparc-*-netbsdelf*) fmt=elf em=nbsd ;;
sparc-*-*n*bsd*) case ${cpu} in
sparc64) fmt=elf em=nbsd ;;
*) fmt=aout em=nbsd ;;
esac ;;
strongarm-*-coff) fmt=coff ;;
strongarm-*-elf) fmt=elf ;;
strongarm-*-kaos*) fmt=elf ;;
xscale-*-coff) fmt=coff ;;
xscale-*-elf) fmt=elf ;;
v850-*-*) fmt=elf bfd_gas=yes ;;
v850e-*-*) fmt=elf bfd_gas=yes ;;
v850ea-*-*) fmt=elf bfd_gas=yes ;;
tic30-*-*aout*) fmt=aout bfd_gas=yes ;;
tic30-*-*coff*) fmt=coff bfd_gas=yes ;;
tic4x-*-* | c4x-*-*) fmt=coff bfd_gas=yes ;;
tic54x-*-* | c54x*-*-*) fmt=coff bfd_gas=yes need_libm=yes;;
tic80-*-*) fmt=coff ;;
vax-*-netbsdelf*) fmt=elf em=nbsd bfd_gas=yes ;;
vax-*-netbsdaout* | vax-*-netbsd*)
fmt=aout em=nbsd ;;
vax-*-bsd* | vax-*-ultrix*)
fmt=aout ;;
vax-*-vms) fmt=vms ;;
v850-*-*) fmt=elf ;;
v850e-*-*) fmt=elf ;;
v850ea-*-*) fmt=elf ;;
w65-*-*) fmt=coff ;;
vax-*-netbsdelf*) fmt=elf em=nbsd ;;
vax-*-netbsd*) fmt=aout em=nbsd ;;
vax-*-bsd* | vax-*-ultrix*) fmt=aout ;;
vax-*-linux-gnu*) fmt=elf em=linux bfd_gas=yes ;;
vax-*-vms) fmt=vms ;;
xstormy16-*-*) fmt=elf bfd_gas=yes ;;
w65-*-*) fmt=coff ;;
z8k-*-coff | z8k-*-sim)
fmt=coff ;;
xstormy16-*-*) fmt=elf ;;
*-*-aout | *-*-scout)
fmt=aout ;;
*-*-freebsd*) fmt=elf em=freebsd bfd_gas=yes ;;
*-*-nindy*)
fmt=bout ;;
*-*-bsd*)
fmt=aout em=sun3 ;;
*-*-generic) fmt=generic ;;
*-*-xray | *-*-hms) fmt=coff ;;
*-*-sim) fmt=coff ;;
*-*-elf | *-*-sysv4* | *-*-solaris*)
AC_MSG_WARN(GAS support for ${generic_target} is incomplete.)
fmt=elf dev=yes ;;
*-*-vxworks) fmt=aout ;;
*-*-netware) fmt=elf ;;
xtensa-*-*) fmt=elf ;;
z8k-*-coff | z8k-*-sim) fmt=coff ;;
*-*-aout | *-*-scout) fmt=aout ;;
*-*-freebsd* | *-*-kfreebsd*-gnu) fmt=elf em=freebsd ;;
*-*-nindy*) fmt=bout ;;
*-*-bsd*) fmt=aout em=sun3 ;;
*-*-generic) fmt=generic ;;
*-*-xray | *-*-hms) fmt=coff ;;
*-*-sim) fmt=coff ;;
*-*-elf | *-*-sysv4* | *-*-solaris*) fmt=elf dev=yes ;;
*-*-aros*) fmt=elf em=linux bfd_gas=yes ;;
*-*-vxworks | *-*-windiss) fmt=elf ;;
*-*-netware) fmt=elf ;;
esac
if test ${this_target} = $target ; then
@ -525,30 +539,97 @@ changequote([,])dnl
fi
case ${cpu_type}-${fmt} in
alpha*-*) bfd_gas=yes ;;
arm-*) bfd_gas=yes ;;
# not yet
# i386-aout) bfd_gas=preferred ;;
ia64*-*) bfd_gas=yes ;;
mips-*) bfd_gas=yes ;;
ns32k-*) bfd_gas=yes ;;
pdp11-*) bfd_gas=yes ;;
ppc-*) bfd_gas=yes ;;
sparc-*) bfd_gas=yes ;;
strongarm-*) bfd_gas=yes ;;
xscale-*) bfd_gas=yes ;;
*-elf) bfd_gas=yes ;;
*-ecoff) bfd_gas=yes ;;
*-som) bfd_gas=yes ;;
#enable bfd for coff and aout to allow testing if a bfd target is
#the primary target, but not for coff or aout as the primary target
i386-coff) if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
i386-aout) if test x${primary_bfd_gas} = xyes; then bfd_gas=yes; fi ;;
*) ;;
alpha*-* | arm-* | i386-* | ia64*-* | mips-* | ns32k-* \
| pdp11-* | ppc-* | sparc-* | strongarm-* | xscale-* \
| *-elf | *-ecoff | *-som)
bfd_gas=yes ;;
esac
# Other random stuff.
case ${cpu_type} in
mips)
# Set mips_cpu to the name of the default CPU.
case ${target_cpu} in
mips | mipsbe | mipseb | mipsle | mipsel | mips64 | mips64el)
mips_cpu=from-abi
;;
mipsisa32 | mipsisa32el)
mips_cpu=mips32
;;
mipsisa32r2 | mipsisa32r2el)
mips_cpu=mips32r2
;;
mipsisa64 | mipsisa64el)
mips_cpu=mips64
;;
mipsisa64r2 | mipsisa64r2el)
mips_cpu=mips64r2
;;
mipstx39 | mipstx39el)
mips_cpu=r3900
;;
mips64vr | mips64vrel)
mips_cpu=vr4100
;;
mipsisa32r2* | mipsisa64r2*)
changequote(,)dnl
mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..r2//' -e 's/el$//'`
changequote([,])dnl
;;
mips64* | mipsisa64* | mipsisa32*)
changequote(,)dnl
mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..//' -e 's/el$//'`
changequote([,])dnl
;;
*)
AC_ERROR($target_cpu isn't a supported MIPS CPU name)
;;
esac
# See whether it's appropriate to set E_MIPS_ABI_O32 for o32
# binaries. It's a GNU extension that some OSes don't understand.
# The value only matters on ELF targets.
case ${target} in
*-*-irix*)
use_e_mips_abi_o32=0
;;
*)
use_e_mips_abi_o32=1
;;
esac
# Decide whether to generate 32-bit or 64-bit code by default.
# Used to resolve -march=from-abi when an embedded ABI is selected.
case ${target} in
mips64*-*-* | mipsisa64*-*-*)
mips_default_64bit=1
;;
*)
mips_default_64bit=0
;;
esac
# Decide which ABI to target by default.
case ${target} in
mips64*-linux* | mips-sgi-irix6*)
mips_default_abi=N32_ABI
;;
mips*-linux*)
mips_default_abi=O32_ABI
;;
*)
mips_default_abi=NO_ABI
;;
esac
AC_DEFINE_UNQUOTED(MIPS_CPU_STRING_DEFAULT, "$mips_cpu",
[Default CPU for MIPS targets. ])
AC_DEFINE_UNQUOTED(USE_E_MIPS_ABI_O32, $use_e_mips_abi_o32,
[Allow use of E_MIPS_ABI_O32 on MIPS targets. ])
AC_DEFINE_UNQUOTED(MIPS_DEFAULT_64BIT, $mips_default_64bit,
[Generate 64-bit code by default on MIPS targets. ])
AC_DEFINE_UNQUOTED(MIPS_DEFAULT_ABI, $mips_default_abi,
[Choose a default ABI for MIPS targets. ])
;;
esac
# Do we need the opcodes library?
case ${cpu_type} in
vax | i386 | tic30)
@ -571,7 +652,7 @@ changequote([,])dnl
# Any other special object files needed ?
case ${cpu_type} in
fr30 | m32r | openrisc)
fr30 | ip2k | iq2000 | m32r | openrisc)
using_cgen=yes
;;
@ -612,6 +693,13 @@ changequote([,])dnl
using_cgen=yes
;;
xtensa)
echo ${extra_objects} | grep -s "xtensa-relax.o"
if test $? -ne 0 ; then
extra_objects="$extra_objects xtensa-relax.o"
fi
;;
*)
;;
esac
@ -868,6 +956,7 @@ esac
case "${need_bfd}" in
yes)
BFDLIB=../bfd/libbfd.la
BFDVER_H=../bfd/bfdver.h
ALL_OBJ_DEPS="$ALL_OBJ_DEPS"' ../bfd/bfd.h $(INCDIR)/symcat.h'
;;
esac
@ -875,6 +964,7 @@ esac
AC_SUBST(BFDLIB)
AC_SUBST(OPCODES_LIB)
AC_SUBST(BFDVER_H)
AC_SUBST(ALL_OBJ_DEPS)
AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${target_alias}", [Target alias.])
@ -974,7 +1064,8 @@ dnl the build directory which include the right .h file. Make sure
dnl the old symlinks don't exist, so that a reconfigure in an existing
dnl directory behaves reasonably.
AC_OUTPUT(Makefile doc/Makefile ${GDBINIT}:gdbinit.in po/Makefile.in:po/Make-in,
AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)
AC_CONFIG_COMMANDS([default],
[rm -f targ-cpu.c targ-cpu.h obj-format.h obj-format.c targ-env.h atof-targ.c itbl-cpu.h
echo '#include "tc-'"${target_cpu_type}"'.h"' > targ-cpu.h
echo '#include "obj-'"${obj_format}"'.h"' > obj-format.h
@ -989,3 +1080,5 @@ AC_OUTPUT(Makefile doc/Makefile ${GDBINIT}:gdbinit.in po/Makefile.in:po/Make-in,
cgen_cpu_prefix=${cgen_cpu_prefix}
obj_format=${obj_format}
te_file=${te_file}])
AC_OUTPUT

View File

@ -1,4 +1,4 @@
.\" Automatically generated by Pod::Man v1.3, Pod::Parser v1.13
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
.\"
.\" Standard preamble:
.\" ========================================================================
@ -21,7 +21,6 @@
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
@ -129,15 +128,14 @@
.\" ========================================================================
.\"
.IX Title "AS 1"
.TH AS 1 "2002-08-05" "binutils-2.12.91" "GNU Development Tools"
.UC
.TH AS 1 "2004-05-17" "binutils-2.15" "GNU Development Tools"
.SH "NAME"
\&\s-1AS\s0 \- the portable \s-1GNU\s0 assembler.
AS \- the portable GNU assembler.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\fR=\fIval\fR]
[\fB\-f\fR] [\fB\-\-gstabs\fR] [\fB\-\-gdwarf2\fR] [\fB\-\-help\fR] [\fB\-I\fR \fIdir\fR]
[\fB\-J\fR] [\fB\-K\fR] [\fB\-L\fR]
[\fB\-f\fR] [\fB\-\-gstabs\fR] [\fB\-\-gstabs+\fR] [\fB\-\-gdwarf2\fR] [\fB\-\-help\fR]
[\fB\-I\fR \fIdir\fR] [\fB\-J\fR] [\fB\-K\fR] [\fB\-L\fR]
[\fB\-\-listing\-lhs\-width\fR=\fI\s-1NUM\s0\fR] [\fB\-\-listing\-lhs\-width2\fR=\fI\s-1NUM\s0\fR]
[\fB\-\-listing\-rhs\-width\fR=\fI\s-1NUM\s0\fR] [\fB\-\-listing\-cont\-lines\fR=\fI\s-1NUM\s0\fR]
[\fB\-\-keep\-locals\fR] [\fB\-o\fR \fIobjfile\fR] [\fB\-R\fR] [\fB\-\-statistics\fR] [\fB\-v\fR]
@ -158,7 +156,8 @@ as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\f
\&\fITarget \s-1ARM\s0 options:\fR
[\fB\-mcpu\fR=\fIprocessor\fR[+\fIextension\fR...]]
[\fB\-march\fR=\fIarchitecture\fR[+\fIextension\fR...]]
[\fB\-mfpu\fR=\fIfloating-point-fromat\fR]
[\fB\-mfpu\fR=\fIfloating-point-format\fR]
[\fB\-mfloat\-abi\fR=\fIabi\fR]
[\fB\-mthumb\fR]
[\fB\-EB\fR|\fB\-EL\fR]
[\fB\-mapcs\-32\fR|\fB\-mapcs\-26\fR|\fB\-mapcs\-float\fR|
@ -177,13 +176,16 @@ as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\f
[\fB\-O\fR|\fB\-n\fR|\fB\-N\fR]
.PP
\&\fITarget i386 options:\fR
[\fB\-\-32\fR|\fB\-\-64\fR]
[\fB\-\-32\fR|\fB\-\-64\fR] [\fB\-n\fR]
.PP
\&\fITarget i960 options:\fR
[\fB\-ACA\fR|\fB\-ACA_A\fR|\fB\-ACB\fR|\fB\-ACC\fR|\fB\-AKA\fR|\fB\-AKB\fR|
\fB\-AKC\fR|\fB\-AMC\fR]
[\fB\-b\fR] [\fB\-no\-relax\fR]
.PP
\&\fITarget \s-1IP2K\s0 options:\fR
[\fB\-mip2022\fR|\fB\-mip2022ext\fR]
.PP
\&\fITarget M32R options:\fR
[\fB\-\-m32rx\fR|\fB\-\-[no\-]warn\-explicit\-parallel\-conflicts\fR|
\fB\-\-W[n]p\fR]
@ -192,7 +194,9 @@ as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\f
[\fB\-l\fR] [\fB\-m68000\fR|\fB\-m68010\fR|\fB\-m68020\fR|...]
.PP
\&\fITarget M68HC11 options:\fR
[\fB\-m68hc11\fR|\fB\-m68hc12\fR]
[\fB\-m68hc11\fR|\fB\-m68hc12\fR|\fB\-m68hcs12\fR]
[\fB\-mshort\fR|\fB\-mlong\fR]
[\fB\-mshort\-double\fR|\fB\-mlong\-double\fR]
[\fB\-\-force\-long\-branchs\fR] [\fB\-\-short\-branchs\fR]
[\fB\-\-strict\-direct\-mode\fR] [\fB\-\-print\-insn\-syntax\fR]
[\fB\-\-print\-opcodes\fR] [\fB\-\-generate\-example\fR]
@ -202,12 +206,13 @@ as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\f
[\fB\-mcpu=[210|340]\fR]
.PP
\&\fITarget \s-1MIPS\s0 options:\fR
[\fB\-nocpp\fR] [\fB\-EL\fR] [\fB\-EB\fR] [\fB\-n\fR] [\fB\-O\fR[\fIoptimization level\fR]]
[\fB\-nocpp\fR] [\fB\-EL\fR] [\fB\-EB\fR] [\fB\-O\fR[\fIoptimization level\fR]]
[\fB\-g\fR[\fIdebug level\fR]] [\fB\-G\fR \fInum\fR] [\fB\-KPIC\fR] [\fB\-call_shared\fR]
[\fB\-non_shared\fR] [\fB\-xgot\fR] [\fB\-\-membedded\-pic\fR]
[\fB\-mabi\fR=\fI\s-1ABI\s0\fR] [\fB\-32\fR] [\fB\-n32\fR] [\fB\-64\fR] [\fB\-mfp32\fR] [\fB\-mgp32\fR]
[\fB\-march\fR=\fI\s-1CPU\s0\fR] [\fB\-mtune\fR=\fI\s-1CPU\s0\fR] [\fB\-mips1\fR] [\fB\-mips2\fR]
[\fB\-mips3\fR] [\fB\-mips4\fR] [\fB\-mips5\fR] [\fB\-mips32\fR] [\fB\-mips64\fR]
[\fB\-mips3\fR] [\fB\-mips4\fR] [\fB\-mips5\fR] [\fB\-mips32\fR] [\fB\-mips32r2\fR]
[\fB\-mips64\fR] [\fB\-mips64r2\fR]
[\fB\-construct\-floats\fR] [\fB\-no\-construct\-floats\fR]
[\fB\-trap\fR] [\fB\-no\-break\fR] [\fB\-break\fR] [\fB\-no\-trap\fR]
[\fB\-mfix7000\fR] [\fB\-mno\-fix7000\fR]
@ -215,6 +220,7 @@ as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\f
[\fB\-mips3d\fR] [\fB\-no\-mips3d\fR]
[\fB\-mdmx\fR] [\fB\-no\-mdmx\fR]
[\fB\-mdebug\fR] [\fB\-no\-mdebug\fR]
[\fB\-mpdr\fR] [\fB\-mno\-pdr\fR]
.PP
\&\fITarget \s-1MMIX\s0 options:\fR
[\fB\-\-fixed\-special\-register\-names\fR] [\fB\-\-globalize\-symbols\fR]
@ -245,6 +251,15 @@ as [\fB\-a\fR[\fBcdhlns\fR][=\fIfile\fR]] [\fB\-D\fR] [\fB\-\-defsym\fR \fIsym\f
\fB\-Av8plus\fR|\fB\-Av8plusa\fR|\fB\-Av9\fR|\fB\-Av9a\fR]
[\fB\-xarch=v8plus\fR|\fB\-xarch=v8plusa\fR] [\fB\-bump\fR]
[\fB\-32\fR|\fB\-64\fR]
.PP
\&\fITarget \s-1TIC54X\s0 options:\fR
[\fB\-mcpu=54[123589]\fR|\fB\-mcpu=54[56]lp\fR] [\fB\-mfar\-mode\fR|\fB\-mf\fR]
[\fB\-merrors\-to\-file\fR \fI<filename>\fR|\fB\-me\fR \fI<filename>\fR]
.PP
\&\fITarget Xtensa options:\fR
[\fB\-\-[no\-]density\fR] [\fB\-\-[no\-]relax\fR] [\fB\-\-[no\-]generics\fR]
[\fB\-\-[no\-]text\-section\-literals\fR]
[\fB\-\-[no\-]target\-align\fR] [\fB\-\-[no\-]longcalls\fR]
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
\&\s-1GNU\s0 \fBas\fR is really a family of assemblers.
@ -255,8 +270,8 @@ including object file formats, most assembler directives (often called
\&\fIpseudo-ops\fR) and assembler syntax.
.PP
\&\fBas\fR is primarily intended to assemble the output of the
\&\s-1GNU\s0 C compiler for use by the linker
\&. Nevertheless, we've tried to make \fBas\fR
\&\s-1GNU\s0 C compiler \f(CW\*(C`gcc\*(C'\fR for use by the linker
\&\f(CW\*(C`ld\*(C'\fR. Nevertheless, we've tried to make \fBas\fR
assemble correctly everything that other assemblers for the same
machine would assemble.
Any exceptions are documented explicitly.
@ -290,7 +305,7 @@ runs \fBas\fR automatically. Warnings report an assumption made so
that \fBas\fR could keep assembling a flawed program; errors report a
grave problem that stops the assembly.
.PP
If you are invoking \fBas\fR via the \s-1GNU\s0 C compiler (version 2),
If you are invoking \fBas\fR via the \s-1GNU\s0 C compiler,
you can use the \fB\-Wa\fR option to pass arguments through to the assembler.
The assembler arguments must be separated from each other (and the \fB\-Wa\fR)
by commas. For example:
@ -298,8 +313,9 @@ by commas. For example:
.Vb 1
\& gcc -c -g -O -Wa,-alh,-L file.c
.Ve
.PP
This passes two options to the assembler: \fB\-alh\fR (emit a listing to
standard output with with high-level and assembly source) and \fB\-L\fR (retain
standard output with high-level and assembly source) and \fB\-L\fR (retain
local symbols in the symbol table).
.PP
Usually you do not need to use this \fB\-Wa\fR mechanism, since many compiler
@ -361,10 +377,17 @@ compiler output).
.IX Item "--gstabs"
Generate stabs debugging information for each assembler line. This
may help debugging assembler code, if the debugger can handle it.
.IP "\fB\-\-gstabs+\fR" 4
.IX Item "--gstabs+"
Generate stabs debugging information for each assembler line, with \s-1GNU\s0
extensions that probably only gdb can handle, and that could make other
debuggers crash or refuse to read your program. This
may help debugging assembler code. Currently the only \s-1GNU\s0 extension is
the location of the current working directory at assembling time.
.IP "\fB\-\-gdwarf2\fR" 4
.IX Item "--gdwarf2"
Generate \s-1DWARF2\s0 debugging information for each assembler line. This
may help debugging assembler code, if the debugger can handle it. Note \- this
may help debugging assembler code, if the debugger can handle it. Note\-\-\-this
option is only supported by some targets, not all of them.
.IP "\fB\-\-help\fR" 4
.IX Item "--help"
@ -380,7 +403,7 @@ Add directory \fIdir\fR to the search list for \f(CW\*(C`.include\*(C'\fR direct
Don't warn about signed overflow.
.IP "\fB\-K\fR" 4
.IX Item "-K"
This option is accepted but has no effect on the \s-1TARGET\s0 family.
Issue warnings when difference tables altered for long displacements.
.IP "\fB\-L\fR" 4
.IX Item "-L"
.PD 0
@ -475,6 +498,9 @@ Specify which \s-1ARM\s0 architecture variant is used by the target.
.IP "\fB\-mfpu=\fR\fIfloating-point-format\fR" 4
.IX Item "-mfpu=floating-point-format"
Select which Floating Point architecture is the target.
.IP "\fB\-mfloat\-abi=\fR\fIabi\fR" 4
.IX Item "-mfloat-abi=abi"
Select which floating point \s-1ABI\s0 is in use.
.IP "\fB\-mthumb\fR" 4
.IX Item "-mthumb"
Enable Thumb only instruction decoding.
@ -526,7 +552,17 @@ Do not alter compare-and-branch instructions for long displacements;
error if necessary.
.PP
The following options are available when as is configured for the
Mitsubishi M32R series.
Ubicom \s-1IP2K\s0 series.
.IP "\fB\-mip2022ext\fR" 4
.IX Item "-mip2022ext"
Specifies that the extended \s-1IP2022\s0 instructions are allowed.
.IP "\fB\-mip2022\fR" 4
.IX Item "-mip2022"
Restores the default behaviour, which restricts the permitted instructions to
just the basic \s-1IP2022\s0 ones.
.PP
The following options are available when as is configured for the
Renesas M32R (formerly Mitsubishi M32R) series.
.IP "\fB\-\-m32rx\fR" 4
.IX Item "--m32rx"
Specify which processor in the M32R family is the target. The default
@ -606,10 +642,22 @@ Generate ``little endian'' format output.
.PP
The following options are available when as is configured for the
Motorola 68HC11 or 68HC12 series.
.IP "\fB\-m68hc11 | \-m68hc12\fR" 4
.IX Item "-m68hc11 | -m68hc12"
.IP "\fB\-m68hc11 | \-m68hc12 | \-m68hcs12\fR" 4
.IX Item "-m68hc11 | -m68hc12 | -m68hcs12"
Specify what processor is the target. The default is
defined by the configuration option when building the assembler.
.IP "\fB\-mshort\fR" 4
.IX Item "-mshort"
Specify to use the 16\-bit integer \s-1ABI\s0.
.IP "\fB\-mlong\fR" 4
.IX Item "-mlong"
Specify to use the 32\-bit integer \s-1ABI\s0.
.IP "\fB\-mshort\-double\fR" 4
.IX Item "-mshort-double"
Specify to use the 32\-bit double \s-1ABI\s0.
.IP "\fB\-mlong\-double\fR" 4
.IX Item "-mlong-double"
Specify to use the 64\-bit double \s-1ABI\s0.
.IP "\fB\-\-force\-long\-branchs\fR" 4
.IX Item "--force-long-branchs"
Relative branches are turned into absolute ones. This concerns
@ -657,6 +705,20 @@ equivalent to \-Av8plus and \-Av8plusa, respectively.
.IX Item "-bump"
Warn when the assembler switches to another architecture.
.PP
The following options are available when as is configured for the 'c54x
architecture.
.IP "\fB\-mfar\-mode\fR" 4
.IX Item "-mfar-mode"
Enable extended addressing mode. All addresses and relocations will assume
extended addressing (usually 23 bits).
.IP "\fB\-mcpu=\fR\fI\s-1CPU_VERSION\s0\fR" 4
.IX Item "-mcpu=CPU_VERSION"
Sets the \s-1CPU\s0 version being compiled for.
.IP "\fB\-merrors\-to\-file\fR \fI\s-1FILENAME\s0\fR" 4
.IX Item "-merrors-to-file FILENAME"
Redirect error output to a file, for broken systems which don't support such
behaviour in the shell.
.PP
The following options are available when as is configured for
a \s-1MIPS\s0 processor.
.IP "\fB\-G\fR \fInum\fR" 4
@ -683,16 +745,23 @@ Generate ``little endian'' format output.
.IX Item "-mips5"
.IP "\fB\-mips32\fR" 4
.IX Item "-mips32"
.IP "\fB\-mips32r2\fR" 4
.IX Item "-mips32r2"
.IP "\fB\-mips64\fR" 4
.IX Item "-mips64"
.IP "\fB\-mips64r2\fR" 4
.IX Item "-mips64r2"
.PD
Generate code for a particular \s-1MIPS\s0 Instruction Set Architecture level.
\&\fB\-mips1\fR is an alias for \fB\-march=r3000\fR, \fB\-mips2\fR is an
alias for \fB\-march=r6000\fR, \fB\-mips3\fR is an alias for
\&\fB\-march=r4000\fR and \fB\-mips4\fR is an alias for \fB\-march=r8000\fR.
\&\fB\-mips5\fR, \fB\-mips32\fR, and \fB\-mips64\fR correspond to generic
\&\fB\s-1MIPS\s0 V\fR, \fB\s-1MIPS32\s0\fR, and \fB\s-1MIPS64\s0\fR \s-1ISA\s0 processors,
respectively.
\&\fB\-mips5\fR, \fB\-mips32\fR, \fB\-mips32r2\fR, \fB\-mips64\fR, and
\&\fB\-mips64r2\fR
correspond to generic
\&\fB\s-1MIPS\s0 V\fR, \fB\s-1MIPS32\s0\fR, \fB\s-1MIPS32\s0 Release 2\fR, \fB\s-1MIPS64\s0\fR,
and \fB\s-1MIPS64\s0 Release 2\fR
\&\s-1ISA\s0 processors, respectively.
.IP "\fB\-march=\fR\fI\s-1CPU\s0\fR" 4
.IX Item "-march=CPU"
Generate code for a particular \s-1MIPS\s0 cpu.
@ -715,6 +784,13 @@ of an mfhi or mflo instruction occurs in the following two instructions.
.PD
Cause stabs-style debugging output to go into an ECOFF-style .mdebug
section instead of the standard \s-1ELF\s0 .stabs sections.
.IP "\fB\-mpdr\fR" 4
.IX Item "-mpdr"
.PD 0
.IP "\fB\-mno\-pdr\fR" 4
.IX Item "-mno-pdr"
.PD
Control generation of \f(CW\*(C`.pdr\*(C'\fR sections.
.IP "\fB\-mgp32\fR" 4
.IX Item "-mgp32"
.PD 0
@ -844,6 +920,41 @@ Assemble for a big endian target.
Assemble for a little endian target.
.PP
See the info pages for documentation of the MMIX-specific options.
.PP
The following options are available when as is configured for
an Xtensa processor.
.IP "\fB\-\-density | \-\-no\-density\fR" 4
.IX Item "--density | --no-density"
Enable or disable use of instructions from the Xtensa code density
option. This is enabled by default when the Xtensa processor supports
the code density option.
.IP "\fB\-\-relax | \-\-no\-relax\fR" 4
.IX Item "--relax | --no-relax"
Enable or disable instruction relaxation. This is enabled by default.
Note: In the current implementation, these options also control whether
assembler optimizations are performed, making these options equivalent
to \fB\-\-generics\fR and \fB\-\-no\-generics\fR.
.IP "\fB\-\-generics | \-\-no\-generics\fR" 4
.IX Item "--generics | --no-generics"
Enable or disable all assembler transformations of Xtensa instructions.
The default is \fB\-\-generics\fR;
\&\fB\-\-no\-generics\fR should be used only in the rare cases when the
instructions must be exactly as specified in the assembly source.
.IP "\fB\-\-text\-section\-literals | \-\-no\-text\-section\-literals\fR" 4
.IX Item "--text-section-literals | --no-text-section-literals"
With \fB\-\-text\-section\-literals\fR, literal pools are interspersed
in the text section. The default is
\&\fB\-\-no\-text\-section\-literals\fR, which places literals in a
separate section in the output file.
.IP "\fB\-\-target\-align | \-\-no\-target\-align\fR" 4
.IX Item "--target-align | --no-target-align"
Enable or disable automatic alignment to reduce branch penalties at the
expense of some code density. The default is \fB\-\-target\-align\fR.
.IP "\fB\-\-longcalls | \-\-no\-longcalls\fR" 4
.IX Item "--longcalls | --no-longcalls"
Enable or disable transformation of call instructions to allow calls
across a greater range of addresses. The default is
\&\fB\-\-no\-longcalls\fR.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIgcc\fR\|(1), \fIld\fR\|(1), and the Info entries for \fIbinutils\fR and \fIld\fR.
@ -856,4 +967,4 @@ under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".
section entitled ``\s-1GNU\s0 Free Documentation License''.

View File

@ -7,12 +7,10 @@
# HDEFINES host specific compiler flags
# HOSTING_CRT0 crt0.o file used for bootstrapping
# HOSTING_LIBS libraries used for bootstrapping
# NATIVE_LIB_DIRS library directories to search on this host
HDEFINES=
HOSTING_CRT0=/lib/crt0.o
HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ]; then libgcc=../gcc/libgcc.a; else libgcc=\`${CC} -print-libgcc-file-name\`; fi; if [ -f ../gcc/libgcc_eh.a ]; then libgcc="$libgcc ../gcc/libgcc_eh.a"; else libgcc_eh=\`${CC} -print-file-name=libgcc_eh.a\`; if [ x"$libgcc_eh" != xlibgcc_eh.a ]; then libgcc="$libgcc $libgcc_eh"; fi; fi; echo $libgcc -lc $libgcc`'
NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ]; then libgcc=../gcc/libgcc.a; else libgcc=\`${CC} -print-libgcc-file-name\`; fi; if [ -f ../gcc/libgcc_eh.a ]; then libgcc="$libgcc ../gcc/libgcc_eh.a"; else libgcc_eh=\`${CC} -print-file-name=libgcc_eh.a\`; if [ x"$libgcc_eh" != xlibgcc_eh.a ]; then libgcc="$libgcc $libgcc_eh"; fi; fi; echo --start-group $libgcc -lc --end-group`'
#
# Generic configurations:
@ -20,13 +18,8 @@ NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
case "${host}" in
*-*-freebsd*)
NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
# Older versions of gcc do not use a specs file. In those cases,
# gcc -print-file-name=specs will simply print specs. We create a
# dummy specs files to handle this.
echo "-dynamic-linker `${CC} --print-prog-name=ld-elf.so.1`" > specs
HOSTING_CRT0='-dynamic-linker `${CC} --print-file-name=ld-elf.so.1` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.o`'
*-*-freebsd* | *-*-kfreebsd*-gnu)
HOSTING_CRT0='-dynamic-linker `[ -f \`${CC} --print-prog-name=ld-elf.so.1\` ] || echo /usr/libexec/``${CC} --print-prog-name=ld-elf.so.1` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `${CC} --print-file-name=crtbegin.o`'
HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
;;
@ -44,6 +37,36 @@ case "${host}" in
HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
;;
*-*-netbsd*)
# Different versions of NetBSD with the ELF object format use different
# sets of start/end files.
HOSTING_CRT0='-dynamic-linker /usr/libexec/ld.elf_so /usr/lib/crt0.o'
if [ -f `${CC} --print-file-name=crti.o` ]; then
# Support for GCC's crtstuff present.
HOSTING_CRT0="$HOSTING_CRT0 `${CC} --print-file-name=crti.o`"
if [ -f ../gcc/crtbegin.o ]; then
HOSTING_CRT0="$HOSTING_CRT0 ../gcc/crtbegin.o"
else
HOSTING_CRT0="$HOSTING_CRT0 `${CC} --print-file-name=crtbegin.o`"
fi
else
# Support for GCC's crtstuff not present.
HOSTING_CRT0="$HOSTING_CRT0 `${CC} --print-file-name=crtbegin.o`"
fi
if [ -f `${CC} --print-file-name=crtn.o` ]; then
# Support for GCC's crtstuff present.
if [ -f ../gcc/crtbegin.o ]; then
HOSTING_LIBS="$HOSTING_LIBS ../gcc/crtend.o"
else
HOSTING_LIBS="$HOSTING_LIBS `${CC} --print-file-name=crtend.o`"
fi
HOSTING_LIBS="$HOSTING_LIBS `${CC} --print-file-name=crtn.o`"
else
# Support for GCC's crtstuff not present.
HOSTING_LIBS="$HOSTING_LIBS `${CC} --print-file-name=crtend.o`"
fi
;;
esac
#
@ -56,48 +79,45 @@ case "${host}" in
# No further tweaking needed
;;
alpha*-*-netbsd*)
HOSTING_CRT0=/usr/lib/crt0.o
am33_2.0-*-linux*)
HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]\*,ld-linux,g"`
;;
arm*-*-linux-gnu*)
HOSTING_CRT0='-p '`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]*\*,ld-linux,g"`
HOSTING_CRT0='-p '`echo "$HOSTING_CRT0" | sed -e "s,ld\[^ \]\*,ld-linux,g"`
;;
hppa*64*-*-hpux11*)
NATIVE_LIB_DIRS=/usr/lib/pa20_64
HOSTING_CRT0=/usr/ccs/lib/pa20_64/crt0.o
# Even if CC is not gcc, the tests use gcc.
HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else if test "$GCC" = yes; then ${CC} --print-libgcc-file-name; else gcc --print-libgcc-file-name; fi fi` -lc /usr/lib/pa20_64/milli.a'
HOSTING_LIBS='--start-group `if [ -f ../gcc/libgcc.a ]; then echo ../gcc/libgcc.a; else if test "$GCC" = yes; then ${CC} --print-libgcc-file-name; else gcc --print-libgcc-file-name; fi fi` -lc --end-group /usr/lib/pa20_64/milli.a'
;;
i[3456]86-*-bsd* | i[34567]86-*-freebsd[12] | i[34567]86-*-freebsd[12]\.* | i[34567]86-*-freebsd*aout* | i[3456]86-*-netbsd*)
i[3-7]86-*-bsd* | i[3-7]86-*-freebsd[12] | i[3-7]86-*-freebsd[12]\.* | i[3-7]86-*-freebsd*aout*)
HOSTING_CRT0=/usr/lib/crt0.o
;;
i[3456]86-*-sysv4*)
i[3-7]86-*-sysv4*)
HOSTING_CRT0='/usr/ccs/lib/crt1.o /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /usr/ccs/lib/crtn.o'
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
i[3456]86-sequent-ptx* | i[3456]86-sequent-sysv*)
i[3-7]86-sequent-ptx* | i[3-7]86-sequent-sysv*)
HOSTING_CRT0='/lib/crt0.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`'
;;
i[3456]86-*-sysv*)
i[3-7]86-*-sysv*)
HOSTING_CRT0='/lib/crt1.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; fi`'
HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; fi` /lib/crtn.o'
;;
i[3456]86-*-solaris*)
i[3-7]86-*-solaris*)
HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
i[3456]86-*-sco* | i[3456]86-*-isc*)
i[3-7]86-*-sco* | i[3-7]86-*-isc*)
# In some configurations gcc does not use crtbegin.o and crtend.o.
# In that case gcc -print-file-name=crtbegin.o will simply print
# crtbegin.o. We create dummy crtbegin.o and crtend.o files to
@ -112,19 +132,18 @@ i[3456]86-*-sco* | i[3456]86-*-isc*)
HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` /lib/crtn.o'
;;
i[3456]86-*-lynxos*)
i[3-7]86-*-lynxos*)
HOSTING_CRT0=/lib/init1.o
HOSTING_LIBS="$HOSTING_LIBS"' -lm /lib/initn.o'
;;
i[3456]86-pc-interix*)
i[3-7]86-pc-interix*)
HOSTING_CRT0='$$INTERIX_ROOT/usr/lib/crt0.o'
NATIVE_LIB_DIRS='/usr/local/lib $$INTERIX_ROOT/usr/lib /lib /usr/lib'
HOSTING_LIBS='-L $$X/local_bin -L $$INTERIX_ROOT/usr/lib '"$HOSTING_LIBS"' -lcpsx -lc -lcpsx $$INTERIX_ROOT/usr/lib/psxdll.a $$INTERIX_ROOT/usr/lib/psxdll2.a'
;;
i[3456]86-*-cygwin*)
HOSTING_LIBS="$HOSTING_LIBS"' -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`'
i[3-7]86-*-cygwin*)
HOSTING_LIBS="$HOSTING_LIBS"' -lcygwin -L/usr/lib/w32api -luser32 -lkernel32 -ladvapi32 -lshell32 `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi`'
;;
ia64-*-linux-gnu*)
@ -134,11 +153,6 @@ ia64-*-linux-gnu*)
ia64-*-aix*)
HOSTING_CRT0='-dynamic-linker `egrep "libc.so" \`${CC} --print-file-name=specs\` | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/libc.so..\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`'
HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`'
NATIVE_LIB_DIRS='/usr/local/lib /usr/lib/ia64l64 /lib /usr/lib'
;;
mips*-dec-bsd*)
HOSTING_CRT0=/usr/lib/crt0.o
;;
mips*-sgi-irix4* | mips*-sgi-irix5*)
@ -184,6 +198,10 @@ m88*-motorola-sysv3)
HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi`'
;;
powerpc64*-*-linux-gnu*)
HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib64/ld64.so.1,"`
;;
powerpc*-*-linux-gnu*)
HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib/ld.so.1,"`
;;
@ -199,7 +217,6 @@ s390-*-linux-gnu*)
sparc*-*-solaris2*)
HOSTING_CRT0='`if [ -f ../gcc/crt1.o ]; then echo ../gcc/crt1.o; else ${CC} -print-file-name=crt1.o; fi` `if [ -f ../gcc/crti.o ]; then echo ../gcc/crti.o; else ${CC} -print-file-name=crti.o; fi` /usr/ccs/lib/values-Xa.o `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} -print-file-name=crtbegin.o; fi`'
HOSTING_LIBS="$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} -print-file-name=crtend.o; fi` `if [ -f ../gcc/crtn.o ]; then echo ../gcc/crtn.o; else ${CC} -print-file-name=crtn.o; fi`'
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
sparc-*-linux-gnu*)
@ -214,21 +231,17 @@ x86_64-*-linux-gnu*)
HOSTING_CRT0=`echo "$HOSTING_CRT0" | sed -e "s,\\\`egrep.*\"\\\`,/lib64/ld-linux-x86-64.so.2,"`
;;
*-*-freebsd*)
*-*-freebsd* | *-*-kfreebsd*-gnu)
;;
*-*-linux*)
;;
*-*-netbsd*)
# NetBSD typically does not use the GCC crtstuff, so ignore it.
HOSTING_CRT0='-dynamic-linker /usr/libexec/ld.elf_so /usr/lib/crt0.o /usr/lib/crtbegin.o'
HOSTING_LIBS='`if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` -lc `if [ -f ../gcc/libgcc.a ] ; then echo ../gcc/libgcc.a ; else ${CC} -print-libgcc-file-name; fi` /usr/lib/crtend.o'
;;
alpha*-*-*)
HOSTING_CRT0=/usr/ccs/lib/crt0.o
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
esac

View File

@ -9,11 +9,14 @@
# targ_extra_emuls additional linker emulations to provide
# targ_extra_libpath additional linker emulations using LIB_PATH
# targ_extra_ofiles additional objects needed by the emulation
# NATIVE_LIB_DIRS library directories to search on this host
# (if we are a native or sysrooted linker)
targ_extra_emuls=
targ_extra_ofiles=
case "${targ}" in
am33_2.0-*-linux*) targ_emul=elf32am33lin ;;
arm-epoc-pe) targ_emul=arm_epoc_pe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
arm-*-wince) targ_emul=armpe ;
@ -21,11 +24,12 @@ arm-*-wince) targ_emul=armpe ;
arm-*-pe) targ_emul=armpe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
arc-*-elf*) targ_emul=arcelf ;;
avr-*-*) targ_emul=avr85xx
targ_extra_emuls="avr1200 avr23xx avr44x4 avr4433 avrmega603 avrmega103 avrmega161 avr1 avr2 avr3 avr4 avr5" ;;
avr-*-*) targ_emul=avr2
targ_extra_emuls="avr1 avr3 avr4 avr5" ;;
cris-*-*aout*) targ_emul=crisaout
targ_extra_emuls="criself crislinux"
targ_extra_libpath=$targ_extra_emuls ;;
cris-*-linux-gnu*) targ_emul=crislinux ;;
cris-*-*) targ_emul=criself
targ_extra_emuls="crisaout crislinux"
targ_extra_libpath=$targ_extra_emuls ;;
@ -44,7 +48,7 @@ sparc*-*-aout) targ_emul=sparcaout ;;
sparc*-*-coff) targ_emul=coff_sparc ;;
sparc*-*-elf) targ_emul=elf32_sparc ;;
sparc*-*-sysv4*) targ_emul=elf32_sparc ;;
sparc64-*-freebsd* | sparcv9-*-freebsd*)
sparc64-*-freebsd* | sparcv9-*-freebsd* | sparc64-*-kfreebsd*-gnu | sparcv9-*-kfreebsd*-gnu)
targ_emul=elf64_sparc_fbsd
targ_extra_emuls="elf64_sparc elf32_sparc"
targ_extra_libpath=$targ_extra_emuls
@ -94,6 +98,7 @@ sparc*-wrs-vxworks*) targ_emul=sparcaout ;;
sparc*-*-rtemsaout*) targ_emul=sparcaout ;;
sparc*-*-rtemself*) targ_emul=elf32_sparc ;;
sparc*-*-rtems*) targ_emul=elf32_sparc ;;
i860-*-coff) targ_emul=coff_i860 ;;
i860-stardent-sysv4* | i860-stardent-elf*)
targ_emul=elf32_i860 ;;
i960-wrs-vxworks5.0*) targ_emul=gld960 ;;
@ -104,12 +109,16 @@ i960-intel-nindy) targ_emul=gld960 ;;
i960-*-rtems*) targ_emul=gld960coff ;;
i960-*-elf*) targ_emul=elf32_i960 ;;
ia64-*-elf*) targ_emul=elf64_ia64 ;;
ia64-*-freebsd*) targ_emul=elf64_ia64_fbsd
ia64-*-freebsd* | ia64-*-kfreebsd*-gnu)
targ_emul=elf64_ia64_fbsd
targ_extra_emuls="elf64_ia64" ;;
ia64-*-netbsd*) targ_emul=elf64_ia64 ;;
ia64-*-linux*) targ_emul=elf64_ia64 ;;
ia64-*-aix*) targ_emul=elf64_aix ;;
m32r-*-*) targ_emul=m32relf ;;
m32r*le-*-elf*) targ_emul=m32rlelf ;;
m32r*-*-elf*) targ_emul=m32relf ;;
m32r*le-*-linux-gnu*) targ_emul=m32rlelf_linux ;;
m32r*-*-linux-gnu*) targ_emul=m32relf_linux ;;
m68hc11-*-*|m6811-*-*) targ_emul=m68hc11elf
targ_extra_emuls="m68hc11elfb m68hc12elf m68hc12elfb" ;;
m68hc12-*-*|m6812-*-*) targ_emul=m68hc12elf
@ -120,30 +129,34 @@ m68*-ericsson-ose) targ_emul=sun3 ;;
m68*-apple-aux*) targ_emul=m68kaux ;;
*-tandem-none) targ_emul=st2000 ;;
i370-*-elf* | i370-*-linux-gnu*) targ_emul=elf32i370 ;;
i[3456]86-*-nto-qnx*) targ_emul=i386nto ;;
i[3456]86-*-vsta) targ_emul=vsta ;;
i[3456]86-go32-rtems*) targ_emul=i386go32 ;;
i[3456]86-*-go32) targ_emul=i386go32 ;;
i[3456]86-*-msdosdjgpp*) targ_emul=i386go32 ;;
i[3456]86-*-aix*) targ_emul=i386coff ;;
i[3456]86-*-sco*) targ_emul=i386coff ;;
i[3456]86-*-isc*) targ_emul=i386coff ;;
i[3456]86-*-lynxos*) targ_emul=i386lynx ;;
i[3456]86-*-coff) targ_emul=i386coff ;;
i[3456]86-*-rtemscoff*) targ_emul=i386coff ;;
i[3456]86-*-rtemself*) targ_emul=elf_i386 ;;
i[3456]86-*-rtems*) targ_emul=elf_i386 ;;
i[3456]86-*-bsd) targ_emul=i386bsd ;;
i[3456]86-*-bsd386) targ_emul=i386bsd ;;
i[3456]86-*-bsdi*) targ_emul=i386bsd ;;
i[3456]86-*-aout) targ_emul=i386aout ;;
i[3456]86-*-linux*aout*) targ_emul=i386linux
i[3-7]86-*-nto-qnx*) targ_emul=i386nto ;;
i[3-7]86-*-vsta) targ_emul=vsta ;;
i[3-7]86-go32-rtems*) targ_emul=i386go32 ;;
i[3-7]86-*-go32) targ_emul=i386go32 ;;
i[3-7]86-*-msdosdjgpp*) targ_emul=i386go32 ;;
i[3-7]86-*-aix*) targ_emul=i386coff ;;
i[3-7]86-*-sco*) targ_emul=i386coff ;;
i[3-7]86-*-isc*) targ_emul=i386coff ;;
i[3-7]86-*-lynxos*) targ_emul=i386lynx ;;
i[3-7]86-*-coff) targ_emul=i386coff ;;
i[3-7]86-*-rtemscoff*) targ_emul=i386coff ;;
i[3-7]86-*-rtemself*) targ_emul=elf_i386 ;;
i[3-7]86-*-rtems*) targ_emul=elf_i386 ;;
i[3-7]86-*-aros*) targ_emul=elf_i386 ;;
i[3-7]86-*-bsd) targ_emul=i386bsd ;;
i[3-7]86-*-bsd386) targ_emul=i386bsd ;;
i[3-7]86-*-bsdi*) targ_emul=i386bsd ;;
i[3-7]86-*-aout) targ_emul=i386aout ;;
i[3-7]86-*-linux*aout*) targ_emul=i386linux
targ_extra_emuls=elf_i386
tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'`
;;
i[3456]86-*-linux*oldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;;
i[3456]86-*-linux-gnu*) targ_emul=elf_i386
i[3-7]86-*-linux*oldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;;
i[3-7]86-*-linux-gnu*) targ_emul=elf_i386
targ_extra_emuls=i386linux
if test x${want64} = xtrue; then
targ_extra_emuls="$targ_extra_emuls elf_x86_64"
fi
tdir_i386linux=${targ_alias}aout
;;
x86_64-*-linux-gnu*) targ_emul=elf_x86_64
@ -152,21 +165,24 @@ x86_64-*-linux-gnu*) targ_emul=elf_x86_64
tdir_i386linux=`echo ${targ_alias}aout | sed -e 's/x86_64/i386/'`
tdir_elf_i386=`echo ${targ_alias} | sed -e 's/x86_64/i386/'`
;;
i[3456]86-*-sysv[45]*) targ_emul=elf_i386 ;;
i[3456]86-*-solaris2*) targ_emul=elf_i386_ldso
i[3-7]86-*-sysv[45]*) targ_emul=elf_i386 ;;
i[3-7]86-*-solaris2*) targ_emul=elf_i386_ldso
targ_extra_emuls="elf_i386"
;;
i[3456]86-*-unixware) targ_emul=elf_i386 ;;
i[3456]86-*-solaris*) targ_emul=elf_i386_ldso
i[3-7]86-*-unixware) targ_emul=elf_i386 ;;
i[3-7]86-*-solaris*) targ_emul=elf_i386_ldso
targ_extra_emuls="elf_i386"
;;
i[3456]86-*-netbsdelf*) targ_emul=elf_i386
i[3-7]86-*-netbsdelf* | \
i[3-7]86-*-netbsd*-gnu* | \
i[3-7]86-*-knetbsd*-gnu)
targ_emul=elf_i386
targ_extra_emuls=i386nbsd
;;
i[3456]86-*-netbsdpe*) targ_emul=i386pe
i[3-7]86-*-netbsdpe*) targ_emul=i386pe
targ_extra_ofiles="deffilep.o pe-dll.o"
;;
i[3456]86-*-netbsd*) targ_emul=i386nbsd
i[3-7]86-*-netbsd*) targ_emul=i386nbsd
targ_extra_emuls=elf_i386
;;
x86_64-*-netbsd*) targ_emul=elf_x86_64
@ -181,37 +197,41 @@ x86_64-*-netbsd*) targ_emul=elf_x86_64
;;
esac
;;
i[3456]86-*-netware) targ_emul=i386nw ;;
i[3456]86-*-elf*) targ_emul=elf_i386 ;;
i[3456]86-*-freebsdaout* | i[3456]86-*-freebsd[12].* | i[3456]86-*-freebsd[12])
i[3-7]86-*-netware) targ_emul=i386nw ;;
i[3-7]86-*-elf*) targ_emul=elf_i386 ;;
i[3-7]86-*-kaos*) targ_emul=elf_i386 ;;
i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | i[3-7]86-*-freebsd[12])
targ_emul=i386bsd ;;
i[3456]86-*-freebsd*) targ_emul=elf_i386_fbsd
i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
targ_emul=elf_i386_fbsd
targ_extra_emuls="elf_i386 i386bsd" ;;
x86_64-*-freebsd*) targ_emul=elf_x86_64_fbsd
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
targ_emul=elf_x86_64_fbsd
targ_extra_emuls="elf_i386_fbsd elf_x86_64 elf_i386"
tdir_elf_i386=`echo ${targ_alias} \
| sed -e 's/x86_64/i386/'`
;;
i[3456]86-*-sysv*) targ_emul=i386coff ;;
i[3456]86-*-ptx*) targ_emul=i386coff ;;
i[3456]86-*-mach*) targ_emul=i386mach ;;
i[3456]86-*-gnu*) targ_emul=elf_i386 ;;
i[3456]86-*-msdos*) targ_emul=i386msdos; targ_extra_emuls=i386aout ;;
i[3456]86-*-moss*) targ_emul=i386moss; targ_extra_emuls=i386msdos ;;
i[3456]86-*-winnt*) targ_emul=i386pe ;
i[3-7]86-*-sysv*) targ_emul=i386coff ;;
i[3-7]86-*-ptx*) targ_emul=i386coff ;;
i[3-7]86-*-mach*) targ_emul=i386mach ;;
i[3-7]86-*-gnu*) targ_emul=elf_i386 ;;
i[3-7]86-*-msdos*) targ_emul=i386msdos; targ_extra_emuls=i386aout ;;
i[3-7]86-*-moss*) targ_emul=i386moss; targ_extra_emuls=i386msdos ;;
i[3-7]86-*-winnt*) targ_emul=i386pe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
i[3456]86-*-pe) targ_emul=i386pe ;
i[3-7]86-*-pe) targ_emul=i386pe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
i[3456]86-*-cygwin*) targ_emul=i386pe ;
i[3-7]86-*-cygwin*) targ_emul=i386pe ;
targ_extra_ofiles="deffilep.o pe-dll.o"
test "$targ" != "$host" && LIB_PATH='${tooldir}/lib/w32api' ;;
i[3-7]86-*-mingw32*) targ_emul=i386pe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
i[3456]86-*-mingw32*) targ_emul=i386pe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
i[3456]86-*-interix*) targ_emul=i386pe_posix;
i[3-7]86-*-interix*) targ_emul=i386pe_posix;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
i[3456]86-*-beospe*) targ_emul=i386beos ;;
i[3456]86-*-beos*) targ_emul=elf_i386_be ;;
i[3456]86-*-vxworks*) targ_emul=i386aout ;;
i[3456]86-*-chaos) targ_emul=elf_i386_chaos ;;
i[3-7]86-*-beospe*) targ_emul=i386beos ;;
i[3-7]86-*-beos*) targ_emul=elf_i386_be ;;
i[3-7]86-*-vxworks*) targ_emul=elf_i386 ;;
i[3-7]86-*-chaos) targ_emul=elf_i386_chaos ;;
m8*-*-*) targ_emul=m88kbcs ;;
a29k-*-udi) targ_emul=sa29200 ;;
a29k-*-ebmon) targ_emul=ebmon29k ;;
@ -220,8 +240,8 @@ a29k-*-*) targ_emul=a29k ;;
arm-*-aout | armel-*-aout) targ_emul=armaoutl ;;
armeb-*-aout) targ_emul=armaoutb ;;
arm-*-coff) targ_emul=armcoff ;;
arm-*-vxworks) targ_emul=armcoff ;;
arm-*-freebsd*) targ_emul=armelf_fbsd
arm-*-freebsd* | arm-*-kfreebsd*-gnu)
targ_emul=armelf_fbsd
targ_extra_emuls="armelf" ;;
armeb-*-netbsdelf*) targ_emul=armelfb_nbsd;
targ_extra_emuls="armelf_nbsd armelf armnbsd" ;;
@ -229,17 +249,23 @@ arm-*-netbsdelf*) targ_emul=armelf_nbsd;
targ_extra_emuls="armelfb_nbsd armelf armnbsd" ;;
arm-*-netbsd*) targ_emul=armnbsd;
targ_extra_emuls="armelf armelf_nbsd armelfb_nbsd" ;;
arm-*-nto*) targ_emul=armnto ;;
arm-*-openbsd*) targ_emul=armnbsd ;;
arm-*-rtems*) targ_emul=armelf ;;
arm-*-elf) targ_emul=armelf ;;
armeb-*-elf) targ_emul=armelfb ;;
arm-*-elf | arm-*-vxworks)
targ_emul=armelf ;;
arm-*-kaos*) targ_emul=armelf ;;
arm9e-*-elf) targ_emul=armelf ;;
arm-*-oabi) targ_emul=armelf_oabi ;;
arm*b-*-linux-gnu*) targ_emul=armelfb_linux; targ_extra_emuls=armelfb ;;
arm*-*-linux-gnu*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
arm*-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
arm*-*-conix*) targ_emul=armelf ;;
thumb-*-linux-gnu* | thumb-*-uclinux*) targ_emul=armelf_linux; targ_extra_emuls=armelf ;;
strongarm-*-coff) targ_emul=armcoff ;;
strongarm-*-elf) targ_emul=armelf ;;
strongarm-*-kaos*) targ_emul=armelf ;;
thumb-*-coff) targ_emul=armcoff ;;
thumb-*-elf) targ_emul=armelf ;;
thumb-*-oabi) targ_emul=armelf_oabi ;;
@ -250,13 +276,13 @@ thumb-*-pe) targ_emul=armpe ;
xscale-*-coff) targ_emul=armcoff ;;
xscale-*-elf) targ_emul=armelf ;;
h8300-*-hms* | h8300-*-coff* | h8300-*-rtems*)
targ_emul=h8300; targ_extra_emuls="h8300h h8300s"
targ_emul=h8300; targ_extra_emuls="h8300h h8300s h8300hn h8300sn h8300sx h8300sxn"
;;
h8300-*-elf*)
targ_emul=h8300elf;
targ_extra_emuls="h8300helf h8300self"
targ_extra_emuls="h8300helf h8300self h8300hnelf h8300snelf h8300sxelf h8300sxnelf"
;;
h8500-*-hms* | h8500-*-coff*)
h8500-*-hms* | h8500-*-coff* | h8500-*-rtems*)
targ_emul=h8500
targ_extra_emuls="h8500s h8500b h8500m h8500c"
;;
@ -265,6 +291,13 @@ sh-*-linux*)
targ_extra_emuls=shelf_linux
targ_extra_libpath=shelf_linux
;;
sh64eb-*-linux*) targ_emul=shelf32_linux
targ_extra_emuls="shlelf32_linux"
;;
sh64-*-linux*) targ_emul=shlelf32_linux
targ_extra_emuls="shelf32_linux"
targ_extra_libpath=shelf32_linux
;;
sh*eb-*-linux*)
targ_emul=shelf_linux
;;
@ -287,7 +320,7 @@ sh64-*-netbsd*)
targ_emul=shelf64_nbsd
targ_extra_emuls="shlelf64_nbsd shelf32_nbsd shlelf32_nbsd shelf_nbsd shlelf_nbsd"
;;
sh*le-*-netbsdelf*)
sh*l*-*-netbsdelf*)
targ_emul=shlelf_nbsd
targ_extra_emuls=shelf_nbsd
;;
@ -295,17 +328,21 @@ sh*-*-netbsdelf*)
targ_emul=shelf_nbsd
targ_extra_emuls=shlelf_nbsd
;;
shle*-*-elf* | sh[1234]*le*-*-elf)
shle*-*-elf* | sh[1234]*le*-*-elf | shle*-*-kaos*)
targ_emul=shlelf
targ_extra_emuls="shelf shl sh"
;;
sh-*-elf* | sh[1234]*-*-elf | sh-*-rtemself*)
sh-*-rtemscoff*) targ_emul=sh; targ_extra_emuls=shl ;;
sh-*-elf* | sh[1234]*-*-elf | sh-*-rtems* | sh-*-kaos* | sh-*-vxworks)
targ_emul=shelf
targ_extra_emuls="shlelf sh shl"
;;
sh-*-nto*) targ_emul=shelf_nto
targ_extra_emuls=shlelf_nto
;;
sh-*-pe) targ_emul=shpe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
sh-*-*|sh-*-rtems*) targ_emul=sh; targ_extra_emuls=shl ;;
sh-*-*) targ_emul=sh; targ_extra_emuls=shl ;;
sh64le-*-elf*)
targ_emul=shlelf
targ_extra_emuls="shelf shlelf32 shelf32 shlelf64 shelf64"
@ -331,6 +368,7 @@ m68k-*-linux-gnu*) targ_emul=m68kelf
targ_extra_emuls=m68klinux
tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'`
;;
m68k-*-uclinux*) targ_emul=m68kelf ;;
m68*-*-gnu*) targ_emul=m68kelf ;;
m68*-*-lynxos*) targ_emul=m68klynx ;;
m68*-*-netbsd*4k*) targ_emul=m68k4knbsd
@ -357,6 +395,7 @@ vax-*-netbsdelf*) targ_emul=elf32vax
vax-*-netbsdaout* | vax-*-netbsd*)
targ_emul=vaxnbsd
targ_extra_emuls=elf32vax ;;
vax-*-linux-gnu*) targ_emul=elf32vax ;;
mips*-*-pe) targ_emul=mipspe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
mips*-dec-ultrix*) targ_emul=mipslit ;;
@ -364,11 +403,11 @@ mips*-dec-osf*) targ_emul=mipslit ;;
mips*-sgi-irix5*) targ_emul=elf32bsmip ;;
mips*-sgi-irix6*) targ_emul=elf32bmipn32
targ_extra_emuls="elf32bsmip elf64bmip"
targ_extra_libpath=$targ_extra_emuls
;;
mips*-sgi-irix*) targ_emul=mipsbig ;;
mips*el-*-ecoff*) targ_emul=mipsidtl ;;
mips*-*-ecoff*) targ_emul=mipsidt ;;
mips*-dec-bsd*) targ_emul=mipsbsd ;;
mips*el-*-netbsd*) targ_emul=elf32lmip
targ_extra_emuls="elf32bmip"
;;
@ -387,12 +426,20 @@ mips*-*-elf*) targ_emul=elf32ebmip ;;
mips*el-*-rtems*) targ_emul=elf32elmip ;;
mips*-*-rtems*) targ_emul=elf32ebmip ;;
mips*el-*-vxworks*) targ_emul=elf32elmip ;;
mips*-*-vxworks*) targ_emul=elf32ebmip ;;
mips*-*-vxworks*) targ_emul=elf32ebmip
targ_extra_emuls="elf32elmip" ;;
mips*-*-windiss) targ_emul=elf32mipswindiss ;;
mips64*el-*-linux-gnu*) targ_emul=elf32ltsmipn32
targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
;;
mips64*-*-linux-gnu*) targ_emul=elf32btsmipn32
targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
;;
mips*el-*-linux-gnu*) targ_emul=elf32ltsmip
targ_extra_emuls="elf32btsmip elf64ltsmip elf64btsmip"
targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
;;
mips*-*-linux-gnu*) targ_emul=elf32btsmip
targ_extra_emuls="elf32ltsmip elf64btsmip elf64ltsmip"
targ_extra_emuls="elf32ltsmip elf32btsmipn32 elf64btsmip elf32ltsmipn32 elf64ltsmip"
;;
mips*-*-lnews*) targ_emul=mipslnews ;;
mips*-*-sysv4*) targ_emul=elf32btsmip ;;
@ -401,7 +448,10 @@ mmix-*-*) targ_emul=mmo
;;
mn10200-*-*) targ_emul=mn10200 ;;
mn10300-*-*) targ_emul=mn10300 ;;
alpha*-*-freebsd*) targ_emul=elf64alpha_fbsd
msp430-*-*) targ_emul=msp430x110
targ_extra_emuls="msp430x112 msp430x1101 msp430x1111 msp430x1121 msp430x1122 msp430x1132 msp430x122 msp430x123 msp430x1222 msp430x1232 msp430x133 msp430x135 msp430x1331 msp430x1351 msp430x147 msp430x148 msp430x149 msp430x155 msp430x156 msp430x157 msp430x167 msp430x168 msp430x169 msp430x311 msp430x312 msp430x313 msp430x314 msp430x315 msp430x323 msp430x325 msp430x336 msp430x337 msp430x412 msp430x413 msp430xE423 msp430xE425 msp430xE427 msp430xW423 msp430xW425 msp430xW427 msp430x435 msp430x436 msp430x437 msp430x447 msp430x448 msp430x449" ;;
alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
targ_emul=elf64alpha_fbsd
targ_extra_emuls="elf64alpha alpha"
tdir_alpha=`echo ${targ_alias} | sed -e 's/freebsd/freebsdecoff/'`
;;
@ -422,11 +472,12 @@ ns32k-*-netbsd* | ns32k-pc532-lites*) targ_emul=ns32knbsd ;;
openrisc-*-*) targ_emul=elf32openrisc ;;
or32-*-coff) targ_emul=or32 ;;
or32-*-elf) targ_emul=or32elf ;;
or32-*-rtems) targ_emul=or32 ;;
or32-*-rtems*) targ_emul=or32elf ;;
pdp11-*-*) targ_emul=pdp11 ;;
pjl*-*-*) targ_emul=pjlelf ; targ_extra_emuls="elf_i386" ;;
pj*-*-*) targ_emul=pjelf ;;
powerpc-*-freebsd*) targ_emul=elf32ppc_fbsd;
powerpc-*-freebsd* | powerpc-*-kfreebsd*-gnu)
targ_emul=elf32ppc_fbsd;
targ_extra_emuls="elf32ppc elf32ppcsim";
targ_extra_libpath=elf32ppc;
tdir_elf32ppcsim=`echo ${targ_alias} | sed -e 's/ppc/ppcsim/'`
@ -435,13 +486,18 @@ powerpc*-*-linux*)
case "${targ}" in
*64*) targ_emul=elf64ppc
targ_extra_emuls="elf32ppclinux elf32ppc elf32ppcsim"
targ_extra_libpath=elf32ppclinux
targ_extra_libpath="elf32ppclinux elf32ppc"
tdir_elf32ppc=`echo "${targ_alias}" | sed -e 's/64//'`
tdir_elf32ppclinux=$tdir_elf32ppc
tdir_elf32ppcsim=$tdir_elf32ppc ;;
*) targ_emul=elf32ppclinux
targ_extra_emuls="elf32ppc elf32ppcsim"
targ_extra_libpath=elf32ppc ;;
targ_extra_libpath=elf32ppc
if test "${want64}" = "true"; then
targ_extra_emuls="$targ_extra_emuls elf64ppc"
targ_extra_libpath="$targ_extra_libpath elf64ppc"
fi
;;
esac ;;
powerpc*le-*-elf* | powerpc*le-*-eabi* | powerpc*le-*-solaris* \
| powerpc*le-*-sysv* | powerpc*le-*-vxworks*)
@ -454,7 +510,7 @@ powerpc*le-*-elf* | powerpc*le-*-eabi* | powerpc*le-*-solaris* \
targ_extra_emuls="elf32ppcsim" ;;
esac ;;
powerpc*-*-elf* | powerpc*-*-eabi* | powerpc*-*-sysv* \
| powerpc*-*-netbsd* | powerpc-*-openbsd* | powerpc*-*-vxworks*)
| powerpc*-*-netbsd* | powerpc-*-openbsd* | powerpc*-*-vxworks* | powerpc*-*-kaos*)
case "${targ}" in
*64*) targ_emul=elf64ppc
targ_extra_emuls="elf32ppc elf32ppclinux elf32ppcsim"
@ -464,6 +520,8 @@ powerpc*-*-elf* | powerpc*-*-eabi* | powerpc*-*-sysv* \
*) targ_emul=elf32ppc
targ_extra_emuls="elf32ppclinux elf32ppcsim" ;;
esac ;;
powerpc-*-nto*) targ_emul=elf32ppcnto ;;
powerpcle-*-nto*) targ_emul=elf32lppcnto ;;
powerpcle-*-rtems*) targ_emul=elf32leppc ;;
powerpc-*-rtems*) targ_emul=elf32ppc ;;
powerpc-*-macos*) targ_emul=ppcmacos ;;
@ -479,14 +537,18 @@ rs6000-*-aix5*) targ_emul=aix5rs6 ;;
rs6000-*-aix*) targ_emul=aixrs6 ;;
tic30-*-*aout*) targ_emul=tic30aout ;;
tic30-*-*coff*) targ_emul=tic30coff ;;
tic4x-*-* | c4x-*-*) targ_emul=tic4xcoff ; targ_extra_emuls="tic3xcoff tic3xcoff_onchip" ;;
tic54x-*-* | c54x*-*-*) targ_emul=tic54xcoff ;;
tic80-*-*) targ_emul=tic80coff ;;
v850-*-*) targ_emul=v850 ;;
v850e-*-*) targ_emul=v850 ;;
v850ea-*-*) targ_emul=v850 ;;
frv-*-*) targ_emul=elf32frv ;;
iq2000-*-elf) targ_emul=elf32iq2000 ; targ_extra_emuls="elf32iq10" ;;
frv-*-*linux*) targ_emul=elf32frvfd ;;
frv-*-*) targ_emul=elf32frv ; targ_extra_emuls="elf32frvfd" ;;
w65-*-*) targ_emul=w65 ;;
xstormy16-*-*) targ_emul=elf32xstormy16 ;;
xtensa-*-*) targ_emul=elf32xtensa;;
fr30-*-*) targ_emul=elf32fr30 ;;
mcore-*-pe) targ_emul=mcorepe ;
targ_extra_ofiles="deffilep.o pe-dll.o" ;;
@ -502,6 +564,7 @@ s390-*-linux*) targ_emul=elf_s390
tdir_elf64_s390=`echo ${targ_alias} | sed -e 's/s390/s390x/'`
fi ;;
*-*-ieee*) targ_emul=vanilla ;;
ip2k-*-elf) targ_emul=elf32ip2k ;;
*)
echo 2>&1 "*** ld does not support target ${targ}"
@ -509,3 +572,53 @@ s390-*-linux*) targ_emul=elf_s390
exit 1
esac
NATIVE_LIB_DIRS='/usr/local/lib /lib /usr/lib'
case "${target}" in
*-*-freebsd*)
NATIVE_LIB_DIRS='/lib /usr/lib /usr/local/lib'
;;
hppa*64*-*-hpux11*)
NATIVE_LIB_DIRS=/usr/lib/pa20_64
;;
i[3-7]86-*-sysv4*)
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
i[3-7]86-*-solaris*)
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
i[3-7]86-pc-interix*)
NATIVE_LIB_DIRS='/usr/local/lib $$INTERIX_ROOT/usr/lib /lib /usr/lib'
;;
ia64-*-aix*)
NATIVE_LIB_DIRS='/usr/local/lib /usr/lib/ia64l64 /lib /usr/lib'
;;
sparc*-*-solaris2*)
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
i[03-9x]86-*-cygwin*)
NATIVE_LIB_DIRS='/usr/lib /usr/lib/w32api'
;;
*-*-linux*)
;;
*-*-freebsd*)
;;
*-*-netbsd*)
;;
alpha*-*-*)
NATIVE_LIB_DIRS='/usr/local/lib /usr/ccs/lib /lib /usr/lib'
;;
esac

View File

@ -2,6 +2,7 @@ ENTRY=_start
SCRIPT_NAME=elf
ELFSIZE=64
TEMPLATE_NAME=elf32
EXTRA_EM_FILE=alphaelf
OUTPUT_FORMAT="elf64-alpha"
TEXT_START_ADDR="0x120000000"
MAXPAGESIZE=0x10000
@ -10,6 +11,7 @@ NONPAGED_TEXT_START_ADDR="0x120000000"
ARCH=alpha
MACHINE=
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
DATA_PLT=
# Note that the number is always big-endian, thus we have to
# reverse the digit string.
@ -17,54 +19,3 @@ NOP=0x0000fe2f1f04ff47 # unop; nop
OTHER_READONLY_SECTIONS="
.reginfo ${RELOCATING-0} : { *(.reginfo) }"
# This code gets inserted into the generic elf32.sc linker script
# and allows us to define our own command line switches.
PARSE_AND_LIST_PROLOGUE='
#define OPTION_TASO 300
/* Set the start address as in the Tru64 ld */
#define ALPHA_TEXT_START_32BIT 0x12000000
static int elf64alpha_32bit = 0;
struct ld_emulation_xfer_struct ld_elf64alpha_emulation;
static void gld_elf64alpha_finish PARAMS ((void));
'
PARSE_AND_LIST_LONGOPTS='
{"taso", no_argument, NULL, OPTION_TASO},
'
PARSE_AND_LIST_OPTIONS='
fprintf (file, _(" -taso\t\t\tLoad executable in the lower 31-bit addressable\n"));
fprintf (file, _("\t\t\t virtual address range\n"));
'
PARSE_AND_LIST_ARGS_CASES='
case EOF:
if (elf64alpha_32bit && !link_info.shared && !link_info.relocateable)
{
lang_section_start (".interp",
exp_binop ('\''+'\'',
exp_intop (ALPHA_TEXT_START_32BIT),
exp_nameop (SIZEOF_HEADERS, NULL)));
ld_elf64alpha_emulation.finish = gld_elf64alpha_finish;
}
return 0;
case OPTION_TASO:
elf64alpha_32bit = 1;
break;
'
PARSE_AND_LIST_EPILOGUE='
#include "elf/internal.h"
#include "elf/alpha.h"
#include "elf-bfd.h"
static void
gld_elf64alpha_finish()
{
elf_elfheader (output_bfd)->e_flags |= EF_ALPHA_32BIT;
}
'

View File

@ -1,4 +1,4 @@
.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
.\"
.\" Standard preamble:
.\" ========================================================================
@ -128,7 +128,7 @@
.\" ========================================================================
.\"
.IX Title "LD 1"
.TH LD 1 "2002-10-30" "binutils-2.13" "GNU Development Tools"
.TH LD 1 "2004-05-17" "binutils-2.15" "GNU Development Tools"
.SH "NAME"
ld \- Using LD, the GNU linker
.SH "SYNOPSIS"
@ -202,7 +202,7 @@ and the script command language. If \fIno\fR binary input files at all
are specified, the linker does not produce any output, and issues the
message \fBNo input files\fR.
.PP
If the linker can not recognize the format of an object file, it will
If the linker cannot recognize the format of an object file, it will
assume that it is a linker script. A script specified in this way
augments the main linker script used for the link (either the default
linker script or the one specified by using \fB\-T\fR). This feature
@ -219,7 +219,7 @@ option that requires them.
.PP
For options whose names are multiple letters, either one dash or two can
precede the option name; for example, \fB\-trace\-symbol\fR and
\&\fB\-\-trace\-symbol\fR are equivalent. Note \- there is one exception to
\&\fB\-\-trace\-symbol\fR are equivalent. Note\-\-\-there is one exception to
this rule. Multiple letter options that start with a lower case 'o' can
only be preceeded by two dashes. This is to reduce confusion with the
\&\fB\-o\fR option. So for example \fB\-omagic\fR sets the output file
@ -233,8 +233,8 @@ immediately following the option that requires them. For example,
Unique abbreviations of the names of multiple-letter options are
accepted.
.PP
Note \- if the linker is being invoked indirectly, via a compiler driver
(eg \fBgcc\fR) then all the linker command line options should be
Note\-\-\-if the linker is being invoked indirectly, via a compiler driver
(e.g. \fBgcc\fR) then all the linker command line options should be
prefixed by \fB\-Wl,\fR (or whatever is appropriate for the particular
compiler driver) like this:
.PP
@ -406,11 +406,13 @@ used to select a subset of the symbols provided by the object
.Sp
Some older linkers used the \fB\-F\fR option throughout a compilation
toolchain for specifying object-file format for both input and output
object files. The \s-1GNU\s0 linker uses other mechanisms for this
purpose: the \fB\-b\fR, \fB\-\-format\fR, \fB\-\-oformat\fR options, the
object files.
The \s-1GNU\s0 linker uses other mechanisms for this purpose: the
\&\fB\-b\fR, \fB\-\-format\fR, \fB\-\-oformat\fR options, the
\&\f(CW\*(C`TARGET\*(C'\fR command in linker scripts, and the \f(CW\*(C`GNUTARGET\*(C'\fR
environment variable. The \s-1GNU\s0 linker will ignore the \fB\-F\fR
option when not creating an \s-1ELF\s0 shared object.
environment variable.
The \s-1GNU\s0 linker will ignore the \fB\-F\fR option when not
creating an \s-1ELF\s0 shared object.
.IP "\fB\-fini\fR \fIname\fR" 4
.IX Item "-fini name"
When creating an \s-1ELF\s0 executable or shared object, call \s-1NAME\s0 when the
@ -497,6 +499,9 @@ on the command line are searched before the default directories. All
\&\fB\-L\fR options apply to all \fB\-l\fR options, regardless of the
order in which the options appear.
.Sp
If \fIsearchdir\fR begins with \f(CW\*(C`=\*(C'\fR, then the \f(CW\*(C`=\*(C'\fR will be replaced
by the \fIsysroot prefix\fR, a path specified when the linker is configured.
.Sp
The default set of paths searched (without being specified with
\&\fB\-L\fR) depends on which emulation mode \fBld\fR is using, and in
some cases also on how it was configured.
@ -523,11 +528,11 @@ configured.
Print a link map to the standard output. A link map provides
information about the link, including the following:
.RS 4
.IP "\(bu" 4
.IP "*" 4
Where object files and symbols are mapped into memory.
.IP "\(bu" 4
.IP "*" 4
How common symbols are allocated.
.IP "\(bu" 4
.IP "*" 4
All archive members included in the link, with a mention of the symbol
which caused the archive member to be brought in.
.RE
@ -548,8 +553,17 @@ Turn off page alignment of sections, and mark the output as
.IX Item "--omagic"
.PD
Set the text and data sections to be readable and writable. Also, do
not page-align the data segment. If the output format supports Unix
style magic numbers, mark the output as \f(CW\*(C`OMAGIC\*(C'\fR.
not page-align the data segment, and disable linking against shared
libraries. If the output format supports Unix style magic numbers,
mark the output as \f(CW\*(C`OMAGIC\*(C'\fR. Note: Although a writable text section
is allowed for PE-COFF targets, it does not conform to the format
specification published by Microsoft.
.IP "\fB\-\-no\-omagic\fR" 4
.IX Item "--no-omagic"
This option negates most of the effects of the \fB\-N\fR option. It
sets the text section to be read\-only, and forces the data segment to
be page\-aligned. Note \- this option does not enable linking against
shared libraries. Use \fB\-Bdynamic\fR for this.
.IP "\fB\-o\fR \fIoutput\fR" 4
.IX Item "-o output"
.PD 0
@ -579,8 +593,8 @@ This option is currently only supported on \s-1ELF\s0 platforms.
.IP "\fB\-r\fR" 4
.IX Item "-r"
.PD 0
.IP "\fB\-\-relocateable\fR" 4
.IX Item "--relocateable"
.IP "\fB\-\-relocatable\fR" 4
.IX Item "--relocatable"
.PD
Generate relocatable output\-\-\-i.e., generate an output file that can in
turn serve as input to \fBld\fR. This is often called \fIpartial
@ -719,29 +733,69 @@ Add \fIpath\fR to the default library search path. This option exists
for Solaris compatibility.
.IP "\fB\-z\fR \fIkeyword\fR" 4
.IX Item "-z keyword"
The recognized keywords are \f(CW\*(C`initfirst\*(C'\fR, \f(CW\*(C`interpose\*(C'\fR,
\&\f(CW\*(C`loadfltr\*(C'\fR, \f(CW\*(C`nodefaultlib\*(C'\fR, \f(CW\*(C`nodelete\*(C'\fR, \f(CW\*(C`nodlopen\*(C'\fR,
\&\f(CW\*(C`nodump\*(C'\fR, \f(CW\*(C`now\*(C'\fR, \f(CW\*(C`origin\*(C'\fR, \f(CW\*(C`combreloc\*(C'\fR, \f(CW\*(C`nocombreloc\*(C'\fR
and \f(CW\*(C`nocopyreloc\*(C'\fR.
The other keywords are
ignored for Solaris compatibility. \f(CW\*(C`initfirst\*(C'\fR marks the object
to be initialized first at runtime before any other objects.
\&\f(CW\*(C`interpose\*(C'\fR marks the object that its symbol table interposes
before all symbols but the primary executable. \f(CW\*(C`loadfltr\*(C'\fR marks
the object that its filtees be processed immediately at runtime.
\&\f(CW\*(C`nodefaultlib\*(C'\fR marks the object that the search for dependencies
of this object will ignore any default library search paths.
\&\f(CW\*(C`nodelete\*(C'\fR marks the object shouldn't be unloaded at runtime.
\&\f(CW\*(C`nodlopen\*(C'\fR marks the object not available to \f(CW\*(C`dlopen\*(C'\fR.
\&\f(CW\*(C`nodump\*(C'\fR marks the object can not be dumped by \f(CW\*(C`dldump\*(C'\fR.
\&\f(CW\*(C`now\*(C'\fR marks the object with the non-lazy runtime binding.
\&\f(CW\*(C`origin\*(C'\fR marks the object may contain \f(CW$ORIGIN\fR.
\&\f(CW\*(C`defs\*(C'\fR disallows undefined symbols.
\&\f(CW\*(C`muldefs\*(C'\fR allows multiple definitions.
\&\f(CW\*(C`combreloc\*(C'\fR combines multiple reloc sections and sorts them
to make dynamic symbol lookup caching possible.
\&\f(CW\*(C`nocombreloc\*(C'\fR disables multiple reloc sections combining.
\&\f(CW\*(C`nocopyreloc\*(C'\fR disables production of copy relocs.
The recognized keywords are:
.RS 4
.IP "\fBcombreloc\fR" 4
.IX Item "combreloc"
Combines multiple reloc sections and sorts them to make dynamic symbol
lookup caching possible.
.IP "\fBdefs\fR" 4
.IX Item "defs"
Disallows undefined symbols in object files. Undefined symbols in
shared libraries are still allowed.
.IP "\fBinitfirst\fR" 4
.IX Item "initfirst"
This option is only meaningful when building a shared object.
It marks the object so that its runtime initialization will occur
before the runtime initialization of any other objects brought into
the process at the same time. Similarly the runtime finalization of
the object will occur after the runtime finalization of any other
objects.
.IP "\fBinterpose\fR" 4
.IX Item "interpose"
Marks the object that its symbol table interposes before all symbols
but the primary executable.
.IP "\fBloadfltr\fR" 4
.IX Item "loadfltr"
Marks the object that its filters be processed immediately at
runtime.
.IP "\fBmuldefs\fR" 4
.IX Item "muldefs"
Allows multiple definitions.
.IP "\fBnocombreloc\fR" 4
.IX Item "nocombreloc"
Disables multiple reloc sections combining.
.IP "\fBnocopyreloc\fR" 4
.IX Item "nocopyreloc"
Disables production of copy relocs.
.IP "\fBnodefaultlib\fR" 4
.IX Item "nodefaultlib"
Marks the object that the search for dependencies of this object will
ignore any default library search paths.
.IP "\fBnodelete\fR" 4
.IX Item "nodelete"
Marks the object shouldn't be unloaded at runtime.
.IP "\fBnodlopen\fR" 4
.IX Item "nodlopen"
Marks the object not available to \f(CW\*(C`dlopen\*(C'\fR.
.IP "\fBnodump\fR" 4
.IX Item "nodump"
Marks the object can not be dumped by \f(CW\*(C`dldump\*(C'\fR.
.IP "\fBnow\fR" 4
.IX Item "now"
When generating an executable or shared library, mark it to tell the
dynamic linker to resolve all symbols when the program is started, or
when the shared library is linked to using dlopen, instead of
deferring function call resolution to the point when the function is
first called.
.IP "\fBorigin\fR" 4
.IX Item "origin"
Marks the object may contain \f(CW$ORIGIN\fR.
.RE
.RS 4
.Sp
Other keywords are ignored for Solaris compatibility.
.RE
.IP "\fB\-(\fR \fIarchives\fR \fB\-)\fR" 4
.IX Item "-( archives -)"
.PD 0
@ -763,6 +817,32 @@ resolved.
Using this option has a significant performance cost. It is best to use
it only when there are unavoidable circular references between two or
more archives.
.IP "\fB\-\-accept\-unknown\-input\-arch\fR" 4
.IX Item "--accept-unknown-input-arch"
.PD 0
.IP "\fB\-\-no\-accept\-unknown\-input\-arch\fR" 4
.IX Item "--no-accept-unknown-input-arch"
.PD
Tells the linker to accept input files whose architecture cannot be
recognised. The assumption is that the user knows what they are doing
and deliberately wants to link in these unknown input files. This was
the default behaviour of the linker, before release 2.14. The default
behaviour from release 2.14 onwards is to reject such input files, and
so the \fB\-\-accept\-unknown\-input\-arch\fR option has been added to
restore the old behaviour.
.IP "\fB\-\-as\-needed\fR" 4
.IX Item "--as-needed"
.PD 0
.IP "\fB\-\-no\-as\-needed\fR" 4
.IX Item "--no-as-needed"
.PD
This option affects \s-1ELF\s0 \s-1DT_NEEDED\s0 tags for dynamic libraries mentioned
on the command line after the \fB\-\-as\-needed\fR option. Normally,
the linker will add a \s-1DT_NEEDED\s0 tag for each dynamic library mentioned
on the command line, regardless of whether the library is actually
needed. \fB\-\-as\-needed\fR causes \s-1DT_NEEDED\s0 tags to only be emitted
for libraries that satisfy some reference from regular objects.
\&\fB\-\-no\-as\-needed\fR restores the default behaviour.
.IP "\fB\-assert\fR \fIkeyword\fR" 4
.IX Item "-assert keyword"
This option is ignored for SunOS compatibility.
@ -785,8 +865,8 @@ multiple times on the command line: it affects library searching for
Set the \f(CW\*(C`DF_1_GROUP\*(C'\fR flag in the \f(CW\*(C`DT_FLAGS_1\*(C'\fR entry in the dynamic
section. This causes the runtime linker to handle lookups in this
object and its dependencies to be performed only inside the group.
\&\fB\-\-no\-undefined\fR is implied. This option is only meaningful on \s-1ELF\s0
platforms which support shared libraries.
\&\fB\-\-unresolved\-symbols=report\-all\fR is implied. This option is
only meaningful on \s-1ELF\s0 platforms which support shared libraries.
.IP "\fB\-Bstatic\fR" 4
.IX Item "-Bstatic"
.PD 0
@ -801,7 +881,8 @@ Do not link against shared libraries. This is only meaningful on
platforms for which shared libraries are supported. The different
variants of this option are for compatibility with various systems. You
may use this option multiple times on the command line: it affects
library searching for \fB\-l\fR options which follow it.
library searching for \fB\-l\fR options which follow it. This
option also implies \fB\-\-unresolved\-symbols=report\-all\fR.
.IP "\fB\-Bsymbolic\fR" 4
.IX Item "-Bsymbolic"
When creating a shared library, bind references to global symbols to the
@ -934,9 +1015,11 @@ while linking a large executable.
.IP "\fB\-z defs\fR" 4
.IX Item "-z defs"
.PD
Normally when creating a non-symbolic shared library, undefined symbols
are allowed and left to be resolved by the runtime loader. These options
disallows such undefined symbols.
Report unresolved symbol references from regular object files. This
is done even if the linker is creating a non-symbolic shared library.
The switch \fB\-\-[no\-]allow\-shlib\-undefined\fR controls the
behaviour for reporting unresolved references found in shared
libraries being linked in.
.IP "\fB\-\-allow\-multiple\-definition\fR" 4
.IX Item "--allow-multiple-definition"
.PD 0
@ -948,16 +1031,25 @@ report a fatal error. These options allow multiple definitions and the
first definition will be used.
.IP "\fB\-\-allow\-shlib\-undefined\fR" 4
.IX Item "--allow-shlib-undefined"
Allow undefined symbols in shared objects even when \-\-no\-undefined is
set. The net result will be that undefined symbols in regular objects
will still trigger an error, but undefined symbols in shared objects
will be ignored. The implementation of no_undefined makes the
assumption that the runtime linker will choke on undefined symbols.
However there is at least one system (BeOS) where undefined symbols in
shared libraries is normal since the kernel patches them at load time to
select which function is most appropriate for the current architecture.
I.E. dynamically select an appropriate memset function. Apparently it
is also normal for \s-1HPPA\s0 shared libraries to have undefined symbols.
.PD 0
.IP "\fB\-\-no\-allow\-shlib\-undefined\fR" 4
.IX Item "--no-allow-shlib-undefined"
.PD
Allows (the default) or disallows undefined symbols in shared libraries.
This switch is similar to \fB\-\-no\-undefined\fR except that it
determines the behaviour when the undefined symbols are in a
shared library rather than a regular object file. It does not affect
how undefined symbols in regular object files are handled.
.Sp
The reason that \fB\-\-allow\-shlib\-undefined\fR is the default is that
the shared library being specified at link time may not be the same as
the one that is available at load time, so the symbols might actually be
resolvable at load time. Plus there are some systems, (eg BeOS) where
undefined symbols in shared libraries is normal. (The kernel patches
them at load time to select which function is most appropriate
for the current architecture. This is used for example to dynamically
select an appropriate memset function). Apparently it is also normal
for \s-1HPPA\s0 shared libraries to have undefined symbols.
.IP "\fB\-\-no\-undefined\-version\fR" 4
.IX Item "--no-undefined-version"
Normally when a symbol has an undefined version, the linker will ignore
@ -1000,6 +1092,18 @@ name of a particular format supported by the \s-1BFD\s0 libraries. (You can
list the available binary formats with \fBobjdump \-i\fR.) The script
command \f(CW\*(C`OUTPUT_FORMAT\*(C'\fR can also specify the output format, but
this option overrides it.
.IP "\fB\-pie\fR" 4
.IX Item "-pie"
.PD 0
.IP "\fB\-\-pic\-executable\fR" 4
.IX Item "--pic-executable"
.PD
Create a position independent executable. This is currently only supported on
\&\s-1ELF\s0 platforms. Position independent executables are similar to shared
libraries in that they are relocated by the dynamic linker to the virtual
address the \s-1OS\s0 chooses for them (which can vary between invocations). Like
normal dynamically linked executables they can be executed and symbols
defined in the executable cannot be overridden by shared libraries.
.IP "\fB\-qmagic\fR" 4
.IX Item "-qmagic"
This option is ignored for Linux compatibility.
@ -1186,11 +1290,40 @@ sign (``\fB=\fR''), and \fIorg\fR.
.IP "\fB\-Ttext\fR \fIorg\fR" 4
.IX Item "-Ttext org"
.PD
Use \fIorg\fR as the starting address for\-\-\-respectively\-\-\-the
\&\f(CW\*(C`bss\*(C'\fR, \f(CW\*(C`data\*(C'\fR, or the \f(CW\*(C`text\*(C'\fR segment of the output file.
\&\fIorg\fR must be a single hexadecimal integer;
for compatibility with other linkers, you may omit the leading
\&\fB0x\fR usually associated with hexadecimal values.
Same as \-\-section\-start, with \f(CW\*(C`.bss\*(C'\fR, \f(CW\*(C`.data\*(C'\fR or
\&\f(CW\*(C`.text\*(C'\fR as the \fIsectionname\fR.
.IP "\fB\-\-unresolved\-symbols=\fR\fImethod\fR" 4
.IX Item "--unresolved-symbols=method"
Determine how to handle unresolved symbols. There are four possible
values for \fBmethod\fR:
.RS 4
.IP "\fBignore-all\fR" 4
.IX Item "ignore-all"
Do not report any unresolved symbols.
.IP "\fBreport-all\fR" 4
.IX Item "report-all"
Report all unresolved symbols. This is the default.
.IP "\fBignore-in-object-files\fR" 4
.IX Item "ignore-in-object-files"
Report unresolved symbols that are contained in shared libraries, but
ignore them if they come from regular object files.
.IP "\fBignore-in-shared-libs\fR" 4
.IX Item "ignore-in-shared-libs"
Report unresolved symbols that come from regular object files, but
ignore them if they come from shared libraries. This can be useful
when creating a dynamic binary and it is known that all the shared
libraries that it should be referencing are included on the linker's
command line.
.RE
.RS 4
.Sp
The behaviour for shared libraries on their own can also be controlled
by the \fB\-\-[no\-]allow\-shlib\-undefined\fR option.
.Sp
Normally the linker will generate an error message for each reported
unresolved symbol but the option \fB\-\-warn\-unresolved\-symbols\fR
can change this to a warning.
.RE
.IP "\fB\-\-dll\-verbose\fR" 4
.IX Item "--dll-verbose"
.PD 0
@ -1204,15 +1337,15 @@ the linker script being used by the linker.
.IX Item "--version-script=version-scriptfile"
Specify the name of a version script to the linker. This is typically
used when creating shared libraries to specify additional information
about the version heirarchy for the library being created. This option
about the version hierarchy for the library being created. This option
is only meaningful on \s-1ELF\s0 platforms which support shared libraries.
.IP "\fB\-\-warn\-common\fR" 4
.IX Item "--warn-common"
Warn when a common symbol is combined with another common symbol or with
a symbol definition. Unix linkers allow this somewhat sloppy practice,
a symbol definition. Unix linkers allow this somewhat sloppy practise,
but linkers on some other operating systems do not. This option allows
you to find potential problems from combining global symbols.
Unfortunately, some C libraries use this practice, so you may get some
Unfortunately, some C libraries use this practise, so you may get some
warnings about symbols in the libraries as well as in your programs.
.Sp
There are three kinds of global symbols, illustrated here by C examples:
@ -1319,6 +1452,15 @@ alignment. Typically, the alignment will be set by an input section.
The address will only be changed if it not explicitly specified; that
is, if the \f(CW\*(C`SECTIONS\*(C'\fR command does not specify a start address for
the section.
.IP "\fB\-\-warn\-unresolved\-symbols\fR" 4
.IX Item "--warn-unresolved-symbols"
If the linker is going to report an unresolved symbol (see the option
\&\fB\-\-unresolved\-symbols\fR) it will normally generate an error.
This option makes it generate a warning instead.
.IP "\fB\-\-error\-unresolved\-symbols\fR" 4
.IX Item "--error-unresolved-symbols"
This restores the linker's default behaviour of generating errors when
it is reporting unresolved symbols.
.IP "\fB\-\-whole\-archive\fR" 4
.IX Item "--whole-archive"
For each archive mentioned on the command line after the
@ -1349,9 +1491,9 @@ Here is a trivial example:
.Sp
.Vb 6
\& void *
\& __wrap_malloc (int c)
\& __wrap_malloc (size_t c)
\& {
\& printf ("malloc called with %ld\en", c);
\& printf ("malloc called with %zu\en", c);
\& return __real_malloc (c);
\& }
.Ve
@ -1396,16 +1538,19 @@ values by either a space or an equals sign.
.IX Item "--add-stdcall-alias"
If given, symbols with a stdcall suffix (@\fInn\fR) will be exported
as-is and also with the suffix stripped.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-base\-file\fR \fIfile\fR" 4
.IX Item "--base-file file"
Use \fIfile\fR as the name of a file in which to save the base
addresses of all the relocations needed for generating DLLs with
\&\fIdlltool\fR.
[This is an i386 \s-1PE\s0 specific option]
.IP "\fB\-\-dll\fR" 4
.IX Item "--dll"
Create a \s-1DLL\s0 instead of a regular executable. You may also use
\&\fB\-shared\fR or specify a \f(CW\*(C`LIBRARY\*(C'\fR in a given \f(CW\*(C`.def\*(C'\fR
file.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-enable\-stdcall\-fixup\fR" 4
.IX Item "--enable-stdcall-fixup"
.PD 0
@ -1413,7 +1558,7 @@ file.
.IX Item "--disable-stdcall-fixup"
.PD
If the link finds a symbol that it cannot resolve, it will attempt to
do \*(L"fuzzy linking\*(R" by looking for another defined symbol that differs
do ``fuzzy linking'' by looking for another defined symbol that differs
only in the format of the symbol name (cdecl vs stdcall) and will
resolve that symbol by linking to the match. For example, the
undefined symbol \f(CW\*(C`_foo\*(C'\fR might be linked to the function
@ -1425,6 +1570,7 @@ to be usable. If you specify \fB\-\-enable\-stdcall\-fixup\fR, this
feature is fully enabled and warnings are not printed. If you specify
\&\fB\-\-disable\-stdcall\-fixup\fR, this feature is disabled and such
mismatches are considered to be errors.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-export\-all\-symbols\fR" 4
.IX Item "--export-all-symbols"
If given, all global symbols in the objects used to build a \s-1DLL\s0 will
@ -1449,10 +1595,12 @@ These cygwin-excludes are: \f(CW\*(C`_cygwin_dll_entry@12\*(C'\fR,
\&\f(CW\*(C`_fmode\*(C'\fR, \f(CW\*(C`_impure_ptr\*(C'\fR, \f(CW\*(C`cygwin_attach_dll\*(C'\fR,
\&\f(CW\*(C`cygwin_premain0\*(C'\fR, \f(CW\*(C`cygwin_premain1\*(C'\fR, \f(CW\*(C`cygwin_premain2\*(C'\fR,
\&\f(CW\*(C`cygwin_premain3\*(C'\fR, and \f(CW\*(C`environ\*(C'\fR.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-exclude\-symbols\fR \fIsymbol\fR\fB,\fR\fIsymbol\fR\fB,...\fR" 4
.IX Item "--exclude-symbols symbol,symbol,..."
Specifies a list of symbols which should not be automatically
exported. The symbol names may be delimited by commas or colons.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-exclude\-libs\fR \fIlib\fR\fB,\fR\fIlib\fR\fB,...\fR" 4
.IX Item "--exclude-libs lib,lib,..."
Specifies a list of archive libraries from which symbols should not be automatically
@ -1460,11 +1608,13 @@ exported. The library names may be delimited by commas or colons. Specifying
\&\f(CW\*(C`\-\-exclude\-libs ALL\*(C'\fR excludes symbols in all archive libraries from
automatic export. Symbols explicitly listed in a .def file are still exported,
regardless of this option.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-file\-alignment\fR" 4
.IX Item "--file-alignment"
Specify the file alignment. Sections in the file will always begin at
file offsets which are multiples of this number. This defaults to
512.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-heap\fR \fIreserve\fR" 4
.IX Item "--heap reserve"
.PD 0
@ -1474,6 +1624,7 @@ file offsets which are multiples of this number. This defaults to
Specify the amount of memory to reserve (and optionally commit) to be
used as heap for this program. The default is 1Mb reserved, 4K
committed.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-image\-base\fR \fIvalue\fR" 4
.IX Item "--image-base value"
Use \fIvalue\fR as the base address of your program or dll. This is
@ -1482,28 +1633,36 @@ is loaded. To reduce the need to relocate and improve performance of
your dlls, each should have a unique base address and not overlap any
other dlls. The default is 0x400000 for executables, and 0x10000000
for dlls.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-kill\-at\fR" 4
.IX Item "--kill-at"
If given, the stdcall suffixes (@\fInn\fR) will be stripped from
symbols before they are exported.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-major\-image\-version\fR \fIvalue\fR" 4
.IX Item "--major-image-version value"
Sets the major number of the \*(L"image version\*(R". Defaults to 1.
Sets the major number of the ``image version''. Defaults to 1.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-major\-os\-version\fR \fIvalue\fR" 4
.IX Item "--major-os-version value"
Sets the major number of the \*(L"os version\*(R". Defaults to 4.
Sets the major number of the ``os version''. Defaults to 4.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-major\-subsystem\-version\fR \fIvalue\fR" 4
.IX Item "--major-subsystem-version value"
Sets the major number of the \*(L"subsystem version\*(R". Defaults to 4.
Sets the major number of the ``subsystem version''. Defaults to 4.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-minor\-image\-version\fR \fIvalue\fR" 4
.IX Item "--minor-image-version value"
Sets the minor number of the \*(L"image version\*(R". Defaults to 0.
Sets the minor number of the ``image version''. Defaults to 0.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-minor\-os\-version\fR \fIvalue\fR" 4
.IX Item "--minor-os-version value"
Sets the minor number of the \*(L"os version\*(R". Defaults to 0.
Sets the minor number of the ``os version''. Defaults to 0.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-minor\-subsystem\-version\fR \fIvalue\fR" 4
.IX Item "--minor-subsystem-version value"
Sets the minor number of the \*(L"subsystem version\*(R". Defaults to 0.
Sets the minor number of the ``subsystem version''. Defaults to 0.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-output\-def\fR \fIfile\fR" 4
.IX Item "--output-def file"
The linker will create the file \fIfile\fR which will contain a \s-1DEF\s0
@ -1511,14 +1670,16 @@ file corresponding to the \s-1DLL\s0 the linker is generating. This \s-1DEF\s0
(which should be called \f(CW\*(C`*.def\*(C'\fR) may be used to create an import
library with \f(CW\*(C`dlltool\*(C'\fR or may be used as a reference to
automatically or implicitly exported symbols.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-out\-implib\fR \fIfile\fR" 4
.IX Item "--out-implib file"
The linker will create the file \fIfile\fR which will contain an
import lib corresponding to the \s-1DLL\s0 the linker is generating. This
import lib (which should be called \f(CW\*(C`*.dll.a\*(C'\fR or \f(CW\*(C`*.a\*(C'\fR
may be used to link clients against the generated \s-1DLL\s0; this behavior
may be used to link clients against the generated \s-1DLL\s0; this behaviour
makes it possible to skip a separate \f(CW\*(C`dlltool\*(C'\fR import library
creation step.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-enable\-auto\-image\-base\fR" 4
.IX Item "--enable-auto-image-base"
Automatically choose the image base for DLLs, unless one is specified
@ -1526,25 +1687,33 @@ using the \f(CW\*(C`\-\-image\-base\*(C'\fR argument. By using a hash generated
from the dllname to create unique image bases for each \s-1DLL\s0, in-memory
collisions and relocations which can delay program execution are
avoided.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-disable\-auto\-image\-base\fR" 4
.IX Item "--disable-auto-image-base"
Do not automatically generate a unique image base. If there is no
user-specified image base (\f(CW\*(C`\-\-image\-base\*(C'\fR) then use the platform
default.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-dll\-search\-prefix\fR \fIstring\fR" 4
.IX Item "--dll-search-prefix string"
When linking dynamically to a dll without an import library, i
When linking dynamically to a dll without an import library,
search for \f(CW\*(C`<string><basename>.dll\*(C'\fR in preference to
\&\f(CW\*(C`lib<basename>.dll\*(C'\fR. This behavior allows easy distinction
\&\f(CW\*(C`lib<basename>.dll\*(C'\fR. This behaviour allows easy distinction
between DLLs built for the various \*(L"subplatforms\*(R": native, cygwin,
uwin, pw, etc. For instance, cygwin DLLs typically use
\&\f(CW\*(C`\-\-dll\-search\-prefix=cyg\*(C'\fR.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-enable\-auto\-import\fR" 4
.IX Item "--enable-auto-import"
Do sophisticated linking of \f(CW\*(C`_symbol\*(C'\fR to \f(CW\*(C`_\|_imp_\|_symbol\*(C'\fR for
\&\s-1DATA\s0 imports from DLLs, and create the necessary thunking symbols when
building the DLLs with those \s-1DATA\s0 exports. This generally will 'just
work' \*(-- but sometimes you may see this message:
building the import libraries with those \s-1DATA\s0 exports. Note: Use of the
\&'auto\-import' extension will cause the text section of the image file
to be made writable. This does not conform to the PE-COFF format
specification published by Microsoft.
.Sp
Using 'auto\-import' generally will 'just work' \*(-- but sometimes you may
see this message:
.Sp
"variable '<var>' can't be auto\-imported. Please read the
documentation for ld's \f(CW\*(C`\-\-enable\-auto\-import\*(C'\fR for details."
@ -1562,7 +1731,11 @@ the warning, and exit.
There are several ways to address this difficulty, regardless of the
data type of the exported variable:
.Sp
One solution is to force one of the 'constants' to be a variable \*(--
One way is to use \-\-enable\-runtime\-pseudo\-reloc switch. This leaves the task
of adjusting references in your client code for runtime environment, so
this method works only when runtime environment supports this feature.
.Sp
A second solution is to force one of the 'constants' to be a variable \*(--
that is, unknown and un-optimizable at compile time. For arrays,
there are two possibilities: a) make the indexee (the array's address)
a variable, or b) make the 'constant' index a variable. Thus:
@ -1598,9 +1771,9 @@ or
\& { volatile long long * local_ll=&extern_ll; *local_ll }
.Ve
.Sp
A second method of dealing with this difficulty is to abandon
A third method of dealing with this difficulty is to abandon
\&'auto\-import' for the offending symbol and mark it with
\&\f(CW\*(C`_\|_declspec(dllimport)\*(C'\fR. However, in practice that
\&\f(CW\*(C`_\|_declspec(dllimport)\*(C'\fR. However, in practise that
requires using compile-time #defines to indicate whether you are
building a \s-1DLL\s0, building client code that will link to the \s-1DLL\s0, or
merely building/linking to a static library. In making the choice
@ -1652,21 +1825,37 @@ Solution 2:
\& }
.Ve
.Sp
A third way to avoid this problem is to re-code your
A fourth way to avoid this problem is to re-code your
library to use a functional interface rather than a data interface
for the offending variables (e.g. \fIset_foo()\fR and \fIget_foo()\fR accessor
functions).
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-disable\-auto\-import\fR" 4
.IX Item "--disable-auto-import"
Do not attempt to do sophisticalted linking of \f(CW\*(C`_symbol\*(C'\fR to
Do not attempt to do sophisticated linking of \f(CW\*(C`_symbol\*(C'\fR to
\&\f(CW\*(C`_\|_imp_\|_symbol\*(C'\fR for \s-1DATA\s0 imports from DLLs.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-enable\-runtime\-pseudo\-reloc\fR" 4
.IX Item "--enable-runtime-pseudo-reloc"
If your code contains expressions described in \-\-enable\-auto\-import section,
that is, \s-1DATA\s0 imports from \s-1DLL\s0 with non-zero offset, this switch will create
a vector of 'runtime pseudo relocations' which can be used by runtime
environment to adjust references to such data in your client code.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-disable\-runtime\-pseudo\-reloc\fR" 4
.IX Item "--disable-runtime-pseudo-reloc"
Do not create pseudo relocations for non-zero offset \s-1DATA\s0 imports from
DLLs. This is the default.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-enable\-extra\-pe\-debug\fR" 4
.IX Item "--enable-extra-pe-debug"
Show additional debug info related to auto-import symbol thunking.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-section\-alignment\fR" 4
.IX Item "--section-alignment"
Sets the section alignment. Sections in memory will always begin at
addresses which are a multiple of this number. Defaults to 0x1000.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-stack\fR \fIreserve\fR" 4
.IX Item "--stack reserve"
.PD 0
@ -1676,6 +1865,7 @@ addresses which are a multiple of this number. Defaults to 0x1000.
Specify the amount of memory to reserve (and optionally commit) to be
used as stack for this program. The default is 2Mb reserved, 4K
committed.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.IP "\fB\-\-subsystem\fR \fIwhich\fR" 4
.IX Item "--subsystem which"
.PD 0
@ -1688,10 +1878,12 @@ Specifies the subsystem under which your program will execute. The
legal values for \fIwhich\fR are \f(CW\*(C`native\*(C'\fR, \f(CW\*(C`windows\*(C'\fR,
\&\f(CW\*(C`console\*(C'\fR, and \f(CW\*(C`posix\*(C'\fR. You may optionally set the
subsystem version also.
[This option is specific to the i386 \s-1PE\s0 targeted port of the linker]
.SH "ENVIRONMENT"
.IX Header "ENVIRONMENT"
You can change the behavior of \fBld\fR with the environment variables
\&\f(CW\*(C`GNUTARGET\*(C'\fR, \f(CW\*(C`LDEMULATION\*(C'\fR, and \f(CW\*(C`COLLECT_NO_DEMANGLE\*(C'\fR.
You can change the behaviour of \fBld\fR with the environment variables
\&\f(CW\*(C`GNUTARGET\*(C'\fR,
\&\f(CW\*(C`LDEMULATION\*(C'\fR and \f(CW\*(C`COLLECT_NO_DEMANGLE\*(C'\fR.
.PP
\&\f(CW\*(C`GNUTARGET\*(C'\fR determines the input-file object format if you don't
use \fB\-b\fR (or its synonym \fB\-\-format\fR). Its value should be one
@ -1726,11 +1918,12 @@ the Info entries for \fIbinutils\fR and
\&\fIld\fR.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc.
Copyright (c) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001,
2002, 2003, 2004 Free Software Foundation, Inc.
.PP
Permission is granted to copy, distribute and/or modify this document
under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".
section entitled ``\s-1GNU\s0 Free Documentation License''.