1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Resolve conflicts from import of binutils-2.9.1.

Submitted by:	Doug Rabson <dfr>
This commit is contained in:
John Polstra 1998-09-06 23:00:35 +00:00
parent 914f9af1ba
commit 0a225ac59d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38891
9 changed files with 2459 additions and 1304 deletions

View File

@ -1,5 +1,5 @@
/* ELF executable support for BFD.
Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright 1993, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -305,6 +305,18 @@ bfd_elf_string_from_elf_section (abfd, shindex, strindex)
&& bfd_elf_get_str_section (abfd, shindex) == NULL)
return NULL;
if (strindex >= hdr->sh_size)
{
(*_bfd_error_handler)
("%s: invalid string offset %u >= %lu for section `%s'",
bfd_get_filename (abfd), strindex, (unsigned long) hdr->sh_size,
((shindex == elf_elfheader(abfd)->e_shstrndx
&& strindex == hdr->sh_name)
? ".shstrtab"
: elf_string_from_elf_strtab (abfd, hdr->sh_name)));
return "";
}
return ((char *) hdr->contents) + strindex;
}
@ -389,7 +401,7 @@ _bfd_elf_make_section_from_shdr (abfd, hdr, name)
&& phdr->p_vaddr <= hdr->sh_addr
&& phdr->p_vaddr + phdr->p_memsz >= hdr->sh_addr + hdr->sh_size
&& ((flags & SEC_LOAD) == 0
|| (phdr->p_offset <= hdr->sh_offset
|| (phdr->p_offset <= (bfd_vma) hdr->sh_offset
&& (phdr->p_offset + phdr->p_filesz
>= hdr->sh_offset + hdr->sh_size))))
{
@ -929,6 +941,91 @@ bfd_elf_get_dt_soname (abfd)
return elf_dt_name (abfd);
return NULL;
}
/* Get the list of DT_NEEDED entries from a BFD. This is a hook for
the ELF linker emulation code. */
boolean
bfd_elf_get_bfd_needed_list (abfd, pneeded)
bfd *abfd;
struct bfd_link_needed_list **pneeded;
{
asection *s;
bfd_byte *dynbuf = NULL;
int elfsec;
unsigned long link;
bfd_byte *extdyn, *extdynend;
size_t extdynsize;
void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
*pneeded = NULL;
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour
|| bfd_get_format (abfd) != bfd_object)
return true;
s = bfd_get_section_by_name (abfd, ".dynamic");
if (s == NULL || s->_raw_size == 0)
return true;
dynbuf = (bfd_byte *) bfd_malloc (s->_raw_size);
if (dynbuf == NULL)
goto error_return;
if (! bfd_get_section_contents (abfd, s, (PTR) dynbuf, (file_ptr) 0,
s->_raw_size))
goto error_return;
elfsec = _bfd_elf_section_from_bfd_section (abfd, s);
if (elfsec == -1)
goto error_return;
link = elf_elfsections (abfd)[elfsec]->sh_link;
extdynsize = get_elf_backend_data (abfd)->s->sizeof_dyn;
swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in;
extdyn = dynbuf;
extdynend = extdyn + s->_raw_size;
for (; extdyn < extdynend; extdyn += extdynsize)
{
Elf_Internal_Dyn dyn;
(*swap_dyn_in) (abfd, (PTR) extdyn, &dyn);
if (dyn.d_tag == DT_NULL)
break;
if (dyn.d_tag == DT_NEEDED)
{
const char *string;
struct bfd_link_needed_list *l;
string = bfd_elf_string_from_elf_section (abfd, link,
dyn.d_un.d_val);
if (string == NULL)
goto error_return;
l = (struct bfd_link_needed_list *) bfd_alloc (abfd, sizeof *l);
if (l == NULL)
goto error_return;
l->by = abfd;
l->name = string;
l->next = *pneeded;
*pneeded = l;
}
}
free (dynbuf);
return true;
error_return:
if (dynbuf != NULL)
free (dynbuf);
return false;
}
/* Allocate an ELF string table--force the first byte to be zero. */
@ -2106,12 +2203,19 @@ map_sections_to_segments (abfd)
new_segment = true;
}
else if (BFD_ALIGN (last_hdr->lma + last_hdr->_raw_size, maxpagesize)
< hdr->lma)
< BFD_ALIGN (hdr->lma, maxpagesize))
{
/* If putting this section in this segment would force us to
skip a page in the segment, then we need a new segment. */
new_segment = true;
}
else if ((last_hdr->flags & SEC_LOAD) == 0
&& (hdr->flags & SEC_LOAD) != 0)
{
/* We don't want to put a loadable section after a
nonloadable section in the same segment. */
new_segment = true;
}
else if ((abfd->flags & D_PAGED) == 0)
{
/* If the file is not demand paged, which means that we
@ -2119,13 +2223,6 @@ map_sections_to_segments (abfd)
file, then there is no other reason for a new segment. */
new_segment = false;
}
else if ((last_hdr->flags & SEC_LOAD) == 0
&& (hdr->flags & SEC_LOAD) != 0)
{
/* We don't want to put a loadable section after a
nonloadable section in the same segment. */
new_segment = true;
}
else if (! writable
&& (hdr->flags & SEC_READONLY) == 0
&& (BFD_ALIGN (last_hdr->lma + last_hdr->_raw_size, maxpagesize)
@ -2264,10 +2361,12 @@ elf_sort_sections (arg1, arg2)
#define TOEND(x) (((x)->flags & SEC_LOAD) == 0)
if (TOEND (sec1))
if (TOEND (sec2))
return sec1->target_index - sec2->target_index;
else
return 1;
{
if (TOEND (sec2))
return sec1->target_index - sec2->target_index;
else
return 1;
}
if (TOEND (sec2))
return -1;
@ -2419,6 +2518,15 @@ assign_file_positions_for_segments (abfd)
if (m->count > 0)
{
BFD_ASSERT (p->p_type == PT_LOAD);
if (p->p_vaddr < (bfd_vma) off)
{
_bfd_error_handler ("%s: Not enough room for program headers, try linking with -N",
bfd_get_filename (abfd));
bfd_set_error (bfd_error_bad_value);
return false;
}
p->p_vaddr -= off;
if (! m->p_paddr_valid)
p->p_paddr -= off;
@ -2491,29 +2599,42 @@ assign_file_positions_for_segments (abfd)
{
bfd_vma adjust;
/* The section VMA must equal the file position modulo
the page size. */
if ((flags & SEC_ALLOC) != 0)
if ((flags & SEC_LOAD) != 0)
adjust = sec->lma - (p->p_paddr + p->p_memsz);
else if ((flags & SEC_ALLOC) != 0)
{
/* The section VMA must equal the file position
modulo the page size. FIXME: I'm not sure if
this adjustment is really necessary. We used to
not have the SEC_LOAD case just above, and then
this was necessary, but now I'm not sure. */
if ((abfd->flags & D_PAGED) != 0)
adjust = (sec->vma - voff) % bed->maxpagesize;
else
adjust = (sec->vma - voff) % align;
if (adjust != 0)
{
if (i == 0)
abort ();
p->p_memsz += adjust;
off += adjust;
voff += adjust;
if ((flags & SEC_LOAD) != 0)
p->p_filesz += adjust;
}
}
else
adjust = 0;
if (adjust != 0)
{
if (i == 0)
abort ();
p->p_memsz += adjust;
off += adjust;
voff += adjust;
if ((flags & SEC_LOAD) != 0)
p->p_filesz += adjust;
}
sec->filepos = off;
if ((flags & SEC_LOAD) != 0)
/* We check SEC_HAS_CONTENTS here because if NOLOAD is
used in a linker script we may have a section with
SEC_LOAD clear but which is supposed to have
contents. */
if ((flags & SEC_LOAD) != 0
|| (flags & SEC_HAS_CONTENTS) != 0)
off += sec->_raw_size;
if ((flags & SEC_ALLOC) != 0)
voff += sec->_raw_size;
@ -2853,6 +2974,16 @@ prep_headers (abfd)
case bfd_arch_d10v:
i_ehdrp->e_machine = EM_CYGNUS_D10V;
break;
case bfd_arch_v850:
switch (bfd_get_mach (abfd))
{
default:
case 0: i_ehdrp->e_machine = EM_CYGNUS_V850; break;
}
break;
case bfd_arch_arc:
i_ehdrp->e_machine = EM_CYGNUS_ARC;
break;
case bfd_arch_m32r:
i_ehdrp->e_machine = EM_CYGNUS_M32R;
break;
@ -3107,6 +3238,7 @@ copy_private_bfd_data (ibfd, obfd)
Elf_Internal_Ehdr *iehdr;
struct elf_segment_map *mfirst;
struct elf_segment_map **pm;
struct elf_segment_map *m;
Elf_Internal_Phdr *p;
unsigned int i, c;
@ -3127,7 +3259,6 @@ copy_private_bfd_data (ibfd, obfd)
{
unsigned int csecs;
asection *s;
struct elf_segment_map *m;
unsigned int isec;
csecs = 0;
@ -3197,6 +3328,19 @@ copy_private_bfd_data (ibfd, obfd)
pm = &m->next;
}
/* The Solaris linker creates program headers in which all the
p_paddr fields are zero. When we try to objcopy or strip such a
file, we get confused. Check for this case, and if we find it
reset the p_paddr_valid fields. */
for (m = mfirst; m != NULL; m = m->next)
if (m->p_paddr != 0)
break;
if (m == NULL)
{
for (m = mfirst; m != NULL; m = m->next)
m->p_paddr_valid = 0;
}
elf_tdata (obfd)->segment_map = mfirst;
return true;
@ -3228,10 +3372,12 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
{
asection *s;
/* Only set up the segments when all the sections have been set
up. */
for (s = ibfd->sections; s != NULL; s = s->next)
if (s->output_section == NULL)
/* Only set up the segments if there are no more SEC_ALLOC
sections. FIXME: This won't do the right thing if objcopy is
used to remove the last SEC_ALLOC section, since objcopy
won't call this routine in that case. */
for (s = isec->next; s != NULL; s = s->next)
if ((s->flags & SEC_ALLOC) != 0)
break;
if (s == NULL)
{
@ -3972,6 +4118,11 @@ _bfd_elf_find_nearest_line (abfd,
bfd_vma low_func;
asymbol **p;
if (_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
filename_ptr, functionname_ptr,
line_ptr))
return true;
if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
&found, filename_ptr,
functionname_ptr, line_ptr,
@ -4179,3 +4330,16 @@ _bfd_elf_validate_reloc (abfd, areloc)
bfd_set_error (bfd_error_bad_value);
return false;
}
boolean
_bfd_elf_close_and_cleanup (abfd)
bfd *abfd;
{
if (bfd_get_format (abfd) == bfd_object)
{
if (elf_shstrtab (abfd) != NULL)
_bfd_stringtab_free (elf_shstrtab (abfd));
}
return _bfd_generic_close_and_cleanup (abfd);
}

View File

@ -1,5 +1,5 @@
/* Intel 80386/80486-specific support for 32-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright 1993-1997, 1998 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -969,8 +969,8 @@ elf_i386_size_dynamic_sections (output_bfd, info)
s->output_section);
target = bfd_get_section_by_name (output_bfd, outname + 4);
if (target != NULL
&& (target->flags & SEC_ALLOC) != 0
&& (target->flags & SEC_READONLY) != 0)
&& (target->flags & SEC_READONLY) != 0
&& (target->flags & SEC_ALLOC) != 0)
reltext = true;
}
@ -1181,15 +1181,16 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
|| (r_type == R_386_GOT32
&& elf_hash_table (info)->dynamic_sections_created
&& (! info->shared
|| ! info->symbolic
|| (! info->symbolic && h->dynindx != -1)
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))
|| (info->shared
&& (! info->symbolic
&& ((! info->symbolic && h->dynindx != -1)
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0)
&& (r_type == R_386_32
|| r_type == R_386_PC32)))
|| r_type == R_386_PC32)
&& (input_section->flags & SEC_ALLOC) != 0))
{
/* In these cases, we don't need the relocation
value. We check specially because in some
@ -1243,15 +1244,16 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
if (! elf_hash_table (info)->dynamic_sections_created
|| (info->shared
&& info->symbolic
&& (info->symbolic || h->dynindx == -1)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
{
/* This is actually a static link, or it is a
-Bsymbolic link and the symbol is defined
locally. We must initialize this entry in the
global offset table. Since the offset must
always be a multiple of 4, we use the least
significant bit to record whether we have
locally, or the symbol was forced to be local
because of a version file. We must initialize
this entry in the global offset table. Since the
offset must always be a multiple of 4, we use the
least significant bit to record whether we have
initialized it already.
When doing a dynamic link, we create a .rel.got
@ -1380,6 +1382,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->shared
&& (r_type != R_386_PC32
|| (h != NULL
&& h->dynindx != -1
&& (! info->symbolic
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
@ -1440,7 +1443,10 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
else if (r_type == R_386_PC32)
{
BFD_ASSERT (h != NULL && h->dynindx != -1);
relocate = false;
if ((input_section->flags & SEC_ALLOC) != 0)
relocate = false;
else
relocate = true;
outrel.r_info = ELF32_R_INFO (h->dynindx, R_386_PC32);
}
else
@ -1458,7 +1464,10 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
BFD_ASSERT (h->dynindx != -1);
relocate = false;
if ((input_section->flags & SEC_ALLOC) != 0)
relocate = false;
else
relocate = true;
outrel.r_info = ELF32_R_INFO (h->dynindx, R_386_32);
}
}
@ -1625,8 +1634,6 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
/* This symbol has an entry in the global offset table. Set it
up. */
BFD_ASSERT (h->dynindx != -1);
sgot = bfd_get_section_by_name (dynobj, ".got");
srel = bfd_get_section_by_name (dynobj, ".rel.got");
BFD_ASSERT (sgot != NULL && srel != NULL);
@ -1636,11 +1643,12 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
+ (h->got_offset &~ 1));
/* If this is a -Bsymbolic link, and the symbol is defined
locally, we just want to emit a RELATIVE reloc. The entry in
the global offset table will already have been initialized in
the relocate_section function. */
locally, we just want to emit a RELATIVE reloc. Likewise if
the symbol was forced to be local because of a version file.
The entry in the global offset table will already have been
initialized in the relocate_section function. */
if (info->shared
&& info->symbolic
&& (info->symbolic || h->dynindx == -1)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
rel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
else

View File

@ -1,5 +1,5 @@
/* nm.c -- Describe symbol table of a rel file.
Copyright 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
Copyright 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
This file is part of GNU Binutils.
@ -247,9 +247,11 @@ static int print_radix = 16;
static char other_format[] = "%02x";
static char desc_format[] = "%04x";
/* IMPORT */
extern char *program_name;
extern char *target;
static char *target = NULL;
/* Used to cache the line numbers for a BFD. */
static bfd *lineno_cache_bfd;
static bfd *lineno_cache_rel_bfd;
static struct option long_options[] =
{
@ -297,7 +299,7 @@ Usage: %s [-aABCDglnopPrsuvV] [-t radix] [--radix=radix] [--target=bfdname]\n\
program_name);
list_supported_targets (program_name, stream);
if (status == 0)
fprintf (stream, "Report bugs to bug-gnu-utils@prep.ai.mit.edu\n");
fprintf (stream, "Report bugs to bug-gnu-utils@gnu.org\n");
exit (status);
}
@ -530,12 +532,20 @@ display_archive (file)
}
if (last_arfile != NULL)
bfd_close (last_arfile);
{
bfd_close (last_arfile);
lineno_cache_bfd = NULL;
lineno_cache_rel_bfd = NULL;
}
last_arfile = arfile;
}
if (last_arfile != NULL)
bfd_close (last_arfile);
{
bfd_close (last_arfile);
lineno_cache_bfd = NULL;
lineno_cache_rel_bfd = NULL;
}
}
static boolean
@ -576,6 +586,9 @@ display_file (filename)
if (bfd_close (file) == false)
bfd_fatal (filename);
lineno_cache_bfd = NULL;
lineno_cache_rel_bfd = NULL;
return retval;
}
@ -779,7 +792,7 @@ sort_symbols_by_size (abfd, dynamic, minisyms, symcount, size, symsizesp)
{
struct size_sym *symsizes;
bfd_byte *from, *fromend;
asymbol *sym;
asymbol *sym = NULL;
asymbol *store_sym, *store_next;
qsort (minisyms, symcount, size, size_forward1);
@ -1124,7 +1137,6 @@ print_symbol (abfd, sym, archive_bfd)
if (line_numbers)
{
static bfd *cache_bfd;
static asymbol **syms;
static long symcount;
const char *filename, *functionname;
@ -1133,7 +1145,7 @@ print_symbol (abfd, sym, archive_bfd)
/* We need to get the canonical symbols in order to call
bfd_find_nearest_line. This is inefficient, but, then, you
don't have to use --line-numbers. */
if (abfd != cache_bfd && syms != NULL)
if (abfd != lineno_cache_bfd && syms != NULL)
{
free (syms);
syms = NULL;
@ -1149,24 +1161,22 @@ print_symbol (abfd, sym, archive_bfd)
symcount = bfd_canonicalize_symtab (abfd, syms);
if (symcount < 0)
bfd_fatal (bfd_get_filename (abfd));
cache_bfd = abfd;
lineno_cache_bfd = abfd;
}
if (bfd_is_und_section (bfd_get_section (sym)))
{
static bfd *cache_rel_bfd;
static asection **secs;
static arelent ***relocs;
static long *relcount;
unsigned int seccount, i;
static unsigned int seccount;
unsigned int i;
const char *symname;
/* For an undefined symbol, we try to find a reloc for the
symbol, and print the line number of the reloc. */
seccount = bfd_count_sections (abfd);
if (abfd != cache_rel_bfd && relocs != NULL)
if (abfd != lineno_cache_rel_bfd && relocs != NULL)
{
for (i = 0; i < seccount; i++)
if (relocs[i] != NULL)
@ -1183,6 +1193,8 @@ print_symbol (abfd, sym, archive_bfd)
{
struct get_relocs_info info;
seccount = bfd_count_sections (abfd);
secs = (asection **) xmalloc (seccount * sizeof *secs);
relocs = (arelent ***) xmalloc (seccount * sizeof *relocs);
relcount = (long *) xmalloc (seccount * sizeof *relcount);
@ -1192,13 +1204,13 @@ print_symbol (abfd, sym, archive_bfd)
info.relcount = relcount;
info.syms = syms;
bfd_map_over_sections (abfd, get_relocs, (PTR) &info);
cache_rel_bfd = abfd;
lineno_cache_rel_bfd = abfd;
}
symname = bfd_asymbol_name (sym);
for (i = 0; i < seccount; i++)
{
unsigned int j;
long j;
for (j = 0; j < relcount[i]; j++)
{

View File

@ -1,5 +1,6 @@
/* i386.c -- Assemble code for the Intel 80386
Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation.
Copyright (C) 1989, 91, 92, 93, 94, 95, 96, 97, 1998
Free Software Foundation.
This file is part of GAS, the GNU Assembler.
@ -105,7 +106,7 @@ struct _i386_insn
unsigned char prefix[MAX_PREFIXES];
unsigned int prefixes;
/* RM and IB are the modrm byte and the base index byte where the
/* RM and BI are the modrm byte and the base index byte where the
addressing modes of this insn are encoded. */
modrm_byte rm;
@ -302,18 +303,18 @@ i386_align_code (fragP, count)
{0xeb,0x0d,0x90,0x90,0x90,0x90,0x90, /* jmp .+15; lotsa nops */
0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90};
static const char f16_4[] =
{0x8d,0xb6,0x00,0x00}; /* lea 0w(%si),%si */
{0x8d,0xb4,0x00,0x00}; /* lea 0w(%si),%si */
static const char f16_5[] =
{0x90, /* nop */
0x8d,0xb6,0x00,0x00}; /* lea 0w(%si),%si */
0x8d,0xb4,0x00,0x00}; /* lea 0w(%si),%si */
static const char f16_6[] =
{0x89,0xf6, /* mov %si,%si */
0x8d,0xbd,0x00,0x00}; /* lea 0w(%di),%di */
static const char f16_7[] =
{0x8d,0x76,0x00, /* lea 0(%si),%si */
{0x8d,0x74,0x00, /* lea 0(%si),%si */
0x8d,0xbd,0x00,0x00}; /* lea 0w(%di),%di */
static const char f16_8[] =
{0x8d,0xb6,0x00,0x00, /* lea 0w(%si),%si */
{0x8d,0xb4,0x00,0x00, /* lea 0w(%si),%si */
0x8d,0xbd,0x00,0x00}; /* lea 0w(%di),%di */
static const char *const f32_patt[] = {
f32_1, f32_2, f32_3, f32_4, f32_5, f32_6, f32_7, f32_8,
@ -433,7 +434,7 @@ const pseudo_typeS md_pseudo_table[] =
#ifndef I386COFF
{"bss", s_bss, 0},
#endif
#ifndef OBJ_AOUT
#if !defined(OBJ_AOUT) && !defined(USE_ALIGN_PTWO)
{"align", s_align_bytes, 0},
#else
{"align", s_align_ptwo, 0},
@ -802,7 +803,7 @@ int
tc_i386_fix_adjustable(fixP)
fixS * fixP;
{
#ifndef OBJ_AOUT
#ifdef OBJ_ELF
/* Prevent all adjustments to global symbols. */
if (S_IS_EXTERN (fixP->fx_addsy))
return 0;
@ -833,8 +834,8 @@ void
md_assemble (line)
char *line;
{
/* Holds template once we've found it. */
template *t;
/* Points to template once we've found it. */
const template *t;
/* Count the size of the instruction generated. */
int insn_size = 0;
@ -844,6 +845,11 @@ md_assemble (line)
int j;
/* Wait prefix needs to come before any other prefixes, so handle it
specially. wait_prefix will hold the opcode modifier flag FWait
if a wait prefix is given. */
int wait_prefix = 0;
/* Initialize globals. */
memset (&i, '\0', sizeof (i));
for (j = 0; j < MAX_OPERANDS; j++)
@ -852,7 +858,7 @@ md_assemble (line)
memset (im_expressions, '\0', sizeof (im_expressions));
save_stack_p = save_stack; /* reset stack pointer */
/* Fist parse an opcode & call i386_operand for the operands.
/* First parse an opcode & call i386_operand for the operands.
We assume that the scrubber has arranged it so that line[0] is the valid
start of a (possibly prefixed) opcode. */
{
@ -904,14 +910,27 @@ md_assemble (line)
as_bad ("same prefix used twice; you don't really want this!");
return;
}
if (i.prefixes == MAX_PREFIXES)
if (prefix->prefix_code == FWAIT_OPCODE)
{
as_bad ("too many opcode prefixes");
return;
if (wait_prefix != 0)
{
as_bad ("same prefix used twice; you don't really want this!");
return;
}
wait_prefix = FWait;
}
else
{
if (i.prefixes == MAX_PREFIXES)
{
as_bad ("too many opcode prefixes");
return;
}
i.prefix[i.prefixes++] = prefix->prefix_code;
if (prefix->prefix_code == REPE
|| prefix->prefix_code == REPNE)
expecting_string_instruction = 1;
}
i.prefix[i.prefixes++] = prefix->prefix_code;
if (prefix->prefix_code == REPE || prefix->prefix_code == REPNE)
expecting_string_instruction = 1;
/* skip past PREFIX_SEPERATOR and reset token_start */
token_start = ++l;
}
@ -1131,8 +1150,8 @@ md_assemble (line)
if (!MATCH (overlap0, i.types[0]) ||
!MATCH (overlap1, i.types[1]) ||
!CONSISTENT_REGISTER_MATCH (overlap0, overlap1,
t->operand_types[0],
t->operand_types[1]))
t->operand_types[1],
t->operand_types[0]))
{
/* does not match either direction */
continue;
@ -1165,20 +1184,26 @@ md_assemble (line)
return;
}
/* Copy the template we found (we may change it!). */
/* Copy the template we found. */
i.tm = *t;
t = &i.tm; /* alter new copy of template */
i.tm.opcode_modifier |= wait_prefix;
if (found_reverse_match)
{
i.tm.operand_types[0] = t->operand_types[1];
i.tm.operand_types[1] = t->operand_types[0];
}
/* If the matched instruction specifies an explicit opcode suffix,
use it - and make sure none has already been specified. */
if (t->opcode_modifier & (Data16|Data32))
if (i.tm.opcode_modifier & (Data16|Data32))
{
if (i.suffix)
{
as_bad ("extraneous opcode suffix given");
return;
}
if (t->opcode_modifier & Data16)
if (i.tm.opcode_modifier & Data16)
i.suffix = WORD_OPCODE_SUFFIX;
else
i.suffix = DWORD_OPCODE_SUFFIX;
@ -1275,19 +1300,11 @@ md_assemble (line)
if (overlap0 & Imm1)
i.imm_operands = 0; /* kludge for shift insns */
if (found_reverse_match)
{
unsigned int save;
save = t->operand_types[0];
t->operand_types[0] = t->operand_types[1];
t->operand_types[1] = save;
}
/* Finalize opcode. First, we change the opcode based on the operand
size given by i.suffix: we never have to change things for byte insns,
or when no opcode suffix is need to size the operands. */
if (!i.suffix && (t->opcode_modifier & W))
if (!i.suffix && (i.tm.opcode_modifier & W))
{
as_bad ("no opcode suffix given and no register operands; can't size instruction");
return;
@ -1296,15 +1313,15 @@ md_assemble (line)
if (i.suffix && i.suffix != BYTE_OPCODE_SUFFIX)
{
/* Select between byte and word/dword operations. */
if (t->opcode_modifier & W)
t->base_opcode |= W;
if (i.tm.opcode_modifier & W)
i.tm.base_opcode |= W;
/* Now select between word & dword operations via the
operand size prefix. */
if ((i.suffix == WORD_OPCODE_SUFFIX) ^ flag_16bit_code)
{
if (i.prefixes == MAX_PREFIXES)
{
as_bad ("%d prefixes given and 'w' opcode suffix gives too many prefixes",
as_bad ("%d prefixes given and data size prefix gives too many prefixes",
MAX_PREFIXES);
return;
}
@ -1331,12 +1348,12 @@ md_assemble (line)
if (found_reverse_match)
{
t->base_opcode |= found_reverse_match;
i.tm.base_opcode |= found_reverse_match;
}
/* The imul $imm, %reg instruction is converted into
imul $imm, %reg, %reg. */
if (t->opcode_modifier & imulKludge)
if (i.tm.opcode_modifier & imulKludge)
{
/* Pretend we saw the 3 operand case. */
i.regs[2] = i.regs[1];
@ -1344,7 +1361,7 @@ md_assemble (line)
}
/* The clr %reg instruction is converted into xor %reg, %reg. */
if (t->opcode_modifier & iclrKludge)
if (i.tm.opcode_modifier & iclrKludge)
{
i.regs[1] = i.regs[0];
i.reg_operands = 2;
@ -1355,7 +1372,7 @@ md_assemble (line)
instructions, if the source operand is a register, we must reverse
the i.rm.reg and i.rm.regmem fields. We accomplish this by faking
that the two register operands were given in the reverse order. */
if ((t->opcode_modifier & ReverseRegRegmem) && i.reg_operands == 2)
if ((i.tm.opcode_modifier & ReverseRegRegmem) && i.reg_operands == 2)
{
unsigned int first_reg_operand = (i.types[0] & Reg) ? 0 : 1;
unsigned int second_reg_operand = first_reg_operand + 1;
@ -1364,40 +1381,40 @@ md_assemble (line)
i.regs[second_reg_operand] = tmp;
}
if (t->opcode_modifier & ShortForm)
if (i.tm.opcode_modifier & ShortForm)
{
/* The register or float register operand is in operand 0 or 1. */
unsigned int op = (i.types[0] & (Reg | FloatReg)) ? 0 : 1;
/* Register goes in low 3 bits of opcode. */
t->base_opcode |= i.regs[op]->reg_num;
i.tm.base_opcode |= i.regs[op]->reg_num;
}
else if (t->opcode_modifier & ShortFormW)
else if (i.tm.opcode_modifier & ShortFormW)
{
/* Short form with 0x8 width bit. Register is always dest. operand */
t->base_opcode |= i.regs[1]->reg_num;
i.tm.base_opcode |= i.regs[1]->reg_num;
if (i.suffix == WORD_OPCODE_SUFFIX ||
i.suffix == DWORD_OPCODE_SUFFIX)
t->base_opcode |= 0x8;
i.tm.base_opcode |= 0x8;
}
else if (t->opcode_modifier & Seg2ShortForm)
else if (i.tm.opcode_modifier & Seg2ShortForm)
{
if (t->base_opcode == POP_SEG_SHORT && i.regs[0]->reg_num == 1)
if (i.tm.base_opcode == POP_SEG_SHORT && i.regs[0]->reg_num == 1)
{
as_bad ("you can't 'pop cs' on the 386.");
return;
}
t->base_opcode |= (i.regs[0]->reg_num << 3);
i.tm.base_opcode |= (i.regs[0]->reg_num << 3);
}
else if (t->opcode_modifier & Seg3ShortForm)
else if (i.tm.opcode_modifier & Seg3ShortForm)
{
/* 'push %fs' is 0x0fa0; 'pop %fs' is 0x0fa1.
'push %gs' is 0x0fa8; 'pop %fs' is 0x0fa9.
So, only if i.regs[0]->reg_num == 5 (%gs) do we need
to change the opcode. */
if (i.regs[0]->reg_num == 5)
t->base_opcode |= 0x08;
i.tm.base_opcode |= 0x08;
}
else if ((t->base_opcode & ~DW) == MOV_AX_DISP32)
else if ((i.tm.base_opcode & ~DW) == MOV_AX_DISP32)
{
/* This is a special non-modrm instruction
that addresses memory with a 32-bit displacement mode anyway,
@ -1405,12 +1422,12 @@ md_assemble (line)
uses_mem_addrmode = 1;
default_seg = &ds;
}
else if (t->opcode_modifier & Modrm)
else if (i.tm.opcode_modifier & Modrm)
{
/* The opcode is completed (modulo t->extension_opcode which must
be put into the modrm byte.
Now, we make the modrm & index base bytes based on all the info
we've collected. */
/* The opcode is completed (modulo i.tm.extension_opcode which
must be put into the modrm byte).
Now, we make the modrm & index base bytes based on all the
info we've collected. */
/* i.reg_operands MUST be the number of real register operands;
implicit registers do not count. */
@ -1562,10 +1579,10 @@ md_assemble (line)
}
/* Fill in i.rm.reg or i.rm.regmem field with register
operand (if any) based on
t->extension_opcode. Again, we must be careful to
make sure that segment/control/debug/test/MMX
registers are coded into the i.rm.reg field. */
operand (if any) based on i.tm.extension_opcode.
Again, we must be careful to make sure that
segment/control/debug/test/MMX registers are coded
into the i.rm.reg field. */
if (i.reg_operands)
{
unsigned int op =
@ -1580,7 +1597,7 @@ md_assemble (line)
: 2));
/* If there is an extension opcode to put here, the
register number must be put into the regmem field. */
if (t->extension_opcode != None)
if (i.tm.extension_opcode != None)
i.rm.regmem = i.regs[op]->reg_num;
else
i.rm.reg = i.regs[op]->reg_num;
@ -1593,8 +1610,8 @@ md_assemble (line)
}
/* Fill in i.rm.reg field with extension opcode (if any). */
if (t->extension_opcode != None)
i.rm.reg = t->extension_opcode;
if (i.tm.extension_opcode != None)
i.rm.reg = i.tm.extension_opcode;
}
if (i.rm.mode != 3)
@ -1635,9 +1652,9 @@ md_assemble (line)
}
/* Handle conversion of 'int $3' --> special int3 insn. */
if (t->base_opcode == INT_OPCODE && i.imms[0]->X_add_number == 3)
if (i.tm.base_opcode == INT_OPCODE && i.imms[0]->X_add_number == 3)
{
t->base_opcode = INT3_OPCODE;
i.tm.base_opcode = INT3_OPCODE;
i.imm_operands = 0;
}
@ -1646,7 +1663,7 @@ md_assemble (line)
register char *p;
/* Output jumps. */
if (t->opcode_modifier & Jump)
if (i.tm.opcode_modifier & Jump)
{
unsigned long n = i.disps[0]->X_add_number;
@ -1656,7 +1673,7 @@ md_assemble (line)
{
p = frag_more (2);
insn_size += 2;
p[0] = t->base_opcode;
p[0] = i.tm.base_opcode;
p[1] = n;
}
else
@ -1673,7 +1690,7 @@ md_assemble (line)
return;
}
if (t->base_opcode == JUMP_PC_RELATIVE)
if (i.tm.base_opcode == JUMP_PC_RELATIVE)
{ /* pace */
/* unconditional jump */
p = frag_more (1 + jmp_size);
@ -1687,7 +1704,7 @@ md_assemble (line)
p = frag_more (2 + jmp_size);
insn_size += 2 + jmp_size;
p[0] = TWO_BYTE_OPCODE_ESCAPE;
p[1] = t->base_opcode + 0x10;
p[1] = i.tm.base_opcode + 0x10;
md_number_to_chars (&p[2], (valueT) n, jmp_size);
}
}
@ -1706,7 +1723,7 @@ md_assemble (line)
frag_grow (7);
p = frag_more (1);
insn_size += 1;
p[0] = t->base_opcode;
p[0] = i.tm.base_opcode;
frag_var (rs_machine_dependent,
6, /* 2 opcode/prefix + 4 displacement */
1,
@ -1717,9 +1734,9 @@ md_assemble (line)
(offsetT) n, p);
}
}
else if (t->opcode_modifier & (JumpByte | JumpDword))
else if (i.tm.opcode_modifier & (JumpByte | JumpDword))
{
int size = (t->opcode_modifier & JumpByte) ? 1 : 4;
int size = (i.tm.opcode_modifier & JumpByte) ? 1 : 4;
unsigned long n = i.disps[0]->X_add_number;
unsigned char *q;
@ -1728,7 +1745,29 @@ md_assemble (line)
{
if (*q == WORD_PREFIX_OPCODE)
{
FRAG_APPEND_1_CHAR (WORD_PREFIX_OPCODE);
/* The jcxz/jecxz instructions are marked with Data16
and Data32, which means that they may get
WORD_PREFIX_OPCODE added to the list of prefixes.
However, the are correctly distinguished using
ADDR_PREFIX_OPCODE. Here we look for
WORD_PREFIX_OPCODE, and actually emit
ADDR_PREFIX_OPCODE. This is a hack, but, then, so
is the instruction itself.
If an explicit suffix is used for the loop
instruction, that actually controls whether we use
cx vs. ecx. This is also controlled by
ADDR_PREFIX_OPCODE.
I don't know if there is any valid case in which we
want to emit WORD_PREFIX_OPCODE, but I am keeping
the old behaviour for safety. */
if (IS_JUMP_ON_CX_ZERO (i.tm.base_opcode)
|| IS_LOOP_ECX_TIMES (i.tm.base_opcode))
FRAG_APPEND_1_CHAR (ADDR_PREFIX_OPCODE);
else
FRAG_APPEND_1_CHAR (WORD_PREFIX_OPCODE);
insn_size += 1;
break;
}
@ -1740,9 +1779,9 @@ md_assemble (line)
insn_size += 1;
}
if (fits_in_unsigned_byte (t->base_opcode))
if (fits_in_unsigned_byte (i.tm.base_opcode))
{
FRAG_APPEND_1_CHAR (t->base_opcode);
FRAG_APPEND_1_CHAR (i.tm.base_opcode);
insn_size += 1;
}
else
@ -1750,8 +1789,8 @@ md_assemble (line)
p = frag_more (2); /* opcode can be at most two bytes */
insn_size += 2;
/* put out high byte first: can't use md_number_to_chars! */
*p++ = (t->base_opcode >> 8) & 0xff;
*p = t->base_opcode & 0xff;
*p++ = (i.tm.base_opcode >> 8) & 0xff;
*p = i.tm.base_opcode & 0xff;
}
p = frag_more (size);
@ -1772,7 +1811,7 @@ md_assemble (line)
}
}
else if (t->opcode_modifier & JumpInterSegment)
else if (i.tm.opcode_modifier & JumpInterSegment)
{
if (flag_16bit_code)
{
@ -1782,7 +1821,7 @@ md_assemble (line)
p = frag_more (1 + 2 + 4); /* 1 opcode; 2 segment; 4 offset */
insn_size += 1 + 2 + 4;
p[0] = t->base_opcode;
p[0] = i.tm.base_opcode;
if (i.imms[1]->X_op == O_constant)
md_number_to_chars (p + 1, (valueT) i.imms[1]->X_add_number, 4);
else
@ -1797,7 +1836,16 @@ md_assemble (line)
/* Output normal instructions here. */
unsigned char *q;
/* First the prefix bytes. */
/* Hack for fwait. It must come before any prefixes, as it
really is an instruction rather than a prefix. */
if ((i.tm.opcode_modifier & FWait) != 0)
{
p = frag_more (1);
insn_size += 1;
md_number_to_chars (p, (valueT) FWAIT_OPCODE, 1);
}
/* The prefix bytes. */
for (q = i.prefix; q < i.prefix + i.prefixes; q++)
{
p = frag_more (1);
@ -1806,39 +1854,39 @@ md_assemble (line)
}
/* Now the opcode; be careful about word order here! */
if (fits_in_unsigned_byte (t->base_opcode))
if (fits_in_unsigned_byte (i.tm.base_opcode))
{
FRAG_APPEND_1_CHAR (t->base_opcode);
FRAG_APPEND_1_CHAR (i.tm.base_opcode);
insn_size += 1;
}
else if (fits_in_unsigned_word (t->base_opcode))
else if (fits_in_unsigned_word (i.tm.base_opcode))
{
p = frag_more (2);
insn_size += 2;
/* put out high byte first: can't use md_number_to_chars! */
*p++ = (t->base_opcode >> 8) & 0xff;
*p = t->base_opcode & 0xff;
*p++ = (i.tm.base_opcode >> 8) & 0xff;
*p = i.tm.base_opcode & 0xff;
}
else
{ /* opcode is either 3 or 4 bytes */
if (t->base_opcode & 0xff000000)
if (i.tm.base_opcode & 0xff000000)
{
p = frag_more (4);
insn_size += 4;
*p++ = (t->base_opcode >> 24) & 0xff;
*p++ = (i.tm.base_opcode >> 24) & 0xff;
}
else
{
p = frag_more (3);
insn_size += 3;
}
*p++ = (t->base_opcode >> 16) & 0xff;
*p++ = (t->base_opcode >> 8) & 0xff;
*p = (t->base_opcode) & 0xff;
*p++ = (i.tm.base_opcode >> 16) & 0xff;
*p++ = (i.tm.base_opcode >> 8) & 0xff;
*p = (i.tm.base_opcode) & 0xff;
}
/* Now the modrm byte and base index byte (if present). */
if (t->opcode_modifier & Modrm)
if (i.tm.opcode_modifier & Modrm)
{
p = frag_more (1);
insn_size += 1;
@ -2090,6 +2138,16 @@ i386_operand (operand_string)
input_line_pointer = ++op_string; /* must advance op_string! */
SKIP_WHITESPACE ();
exp_seg = expression (exp);
if (*input_line_pointer != '\0')
{
/* This should be as_bad, but some versions of gcc, up to
about 2.8 and egcs 1.01, generate a bogus @GOTOFF(%ebx)
in certain cases. Oddly, the code in question turns out
to work correctly anyhow, so we make this just a warning
until those versions of gcc are obsolete. */
as_warn ("warning: unrecognized characters `%s' in expression",
input_line_pointer);
}
input_line_pointer = save_input_line_pointer;
if (exp->X_op == O_absent)
@ -2159,7 +2217,7 @@ i386_operand (operand_string)
i.mem_operands++;
/* Determine type of memory operand from opcode_suffix;
no opcode suffix implies general memory references. */
no opcode suffix implies general memory references. */
switch (i.suffix)
{
case BYTE_OPCODE_SUFFIX:
@ -2330,6 +2388,7 @@ i386_operand (operand_string)
save_input_line_pointer = input_line_pointer;
input_line_pointer = displacement_string_start;
END_STRING_AND_SAVE (displacement_string_end);
#ifndef LEX_AT
{
/*
@ -2339,36 +2398,49 @@ i386_operand (operand_string)
* into a temporary buffer...
*/
register char *cp;
if ((cp = strchr (input_line_pointer,'@')) != NULL) {
char tmpbuf[BUFSIZ];
if(!GOT_symbol)
GOT_symbol = symbol_find_or_make(GLOBAL_OFFSET_TABLE_NAME);
if (strncmp(cp+1, "PLT", 3) == 0) {
i.disp_reloc[this_operand] = BFD_RELOC_386_PLT32;
*cp = '\0';
strcpy(tmpbuf, input_line_pointer);
strcat(tmpbuf, cp+1+3);
*cp = '@';
} else if (strncmp(cp+1, "GOTOFF", 6) == 0) {
i.disp_reloc[this_operand] = BFD_RELOC_386_GOTOFF;
*cp = '\0';
strcpy(tmpbuf, input_line_pointer);
strcat(tmpbuf, cp+1+6);
*cp = '@';
} else if (strncmp(cp+1, "GOT", 3) == 0) {
i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32;
*cp = '\0';
strcpy(tmpbuf, input_line_pointer);
strcat(tmpbuf, cp+1+3);
*cp = '@';
} else
as_bad("Bad reloc specifier '%s' in expression", cp+1);
input_line_pointer = tmpbuf;
}
cp = strchr (input_line_pointer, '@');
if (cp != NULL)
{
char *tmpbuf;
if (GOT_symbol == NULL)
GOT_symbol = symbol_find_or_make (GLOBAL_OFFSET_TABLE_NAME);
tmpbuf = (char *) alloca ((cp - input_line_pointer) + 20);
if (strncmp (cp + 1, "PLT", 3) == 0)
{
i.disp_reloc[this_operand] = BFD_RELOC_386_PLT32;
*cp = '\0';
strcpy (tmpbuf, input_line_pointer);
strcat (tmpbuf, cp + 1 + 3);
*cp = '@';
}
else if (strncmp (cp + 1, "GOTOFF", 6) == 0)
{
i.disp_reloc[this_operand] = BFD_RELOC_386_GOTOFF;
*cp = '\0';
strcpy (tmpbuf, input_line_pointer);
strcat (tmpbuf, cp + 1 + 6);
*cp = '@';
}
else if (strncmp (cp + 1, "GOT", 3) == 0)
{
i.disp_reloc[this_operand] = BFD_RELOC_386_GOT32;
*cp = '\0';
strcpy (tmpbuf, input_line_pointer);
strcat (tmpbuf, cp + 1 + 3);
*cp = '@';
}
else
as_bad ("Bad reloc specifier '%s' in expression", cp + 1);
input_line_pointer = tmpbuf;
}
}
#endif
exp_seg = expression (exp);
#ifdef BFD_ASSEMBLER
@ -2683,6 +2755,9 @@ md_apply_fix3 (fixP, valp, seg)
register char *p = fixP->fx_where + fixP->fx_frag->fr_literal;
valueT value = *valp;
if (fixP->fx_r_type == BFD_RELOC_32 && fixP->fx_pcrel)
fixP->fx_r_type = BFD_RELOC_32_PCREL;
#if defined (BFD_ASSEMBLER) && !defined (TE_Mach)
/*
* This is a hack. There should be a better way to
@ -2691,7 +2766,8 @@ md_apply_fix3 (fixP, valp, seg)
if (fixP->fx_r_type == BFD_RELOC_32_PCREL && fixP->fx_addsy)
{
#ifndef OBJ_AOUT
if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
if (OUTPUT_FLAVOR == bfd_target_elf_flavour
|| OUTPUT_FLAVOR == bfd_target_coff_flavour)
value += fixP->fx_where + fixP->fx_frag->fr_address;
#endif
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
@ -2705,6 +2781,12 @@ md_apply_fix3 (fixP, valp, seg)
it. FIXME. */
value += fixP->fx_where + fixP->fx_frag->fr_address;
}
#endif
#if defined (OBJ_COFF) && defined (TE_PE)
/* For some reason, the PE format does not store a section
address offset for a PC relative symbol. */
if (S_GET_SEGMENT (fixP->fx_addsy) != seg)
value += md_pcrel_from (fixP);
#endif
}
@ -3055,6 +3137,7 @@ tc_gen_reloc (section, fixp)
case BFD_RELOC_386_GOT32:
case BFD_RELOC_386_GOTOFF:
case BFD_RELOC_386_GOTPC:
case BFD_RELOC_RVA:
code = fixp->fx_r_type;
break;
default:

View File

@ -1,5 +1,5 @@
/* tc-i386.h -- Header file for tc-i386.c
Copyright (C) 1989, 92, 93, 94, 95, 96, 1997 Free Software Foundation.
Copyright (C) 1989, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation.
This file is part of GAS, the GNU Assembler.
@ -300,6 +300,7 @@ typedef struct
#define Data16 0x20000 /* needs data prefix if in 32-bit mode */
#define Data32 0x40000 /* needs data prefix if in 16-bit mode */
#define iclrKludge 0x80000 /* used to convert clr to xor */
#define FWait 0x100000 /* instruction needs FWAIT */
/* (opcode_modifier & COMES_IN_ALL_SIZES) is true if the
instuction comes in byte, word, and dword sizes and is encoded into
@ -401,10 +402,18 @@ extern const struct relax_type md_relax_table[];
extern int flag_16bit_code;
#ifdef BFD_ASSEMBLER
#define md_maybe_text() \
((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0)
#else
#define md_maybe_text() \
(now_seg != data_section && now_seg != bss_section)
#endif
#define md_do_align(n, fill, len, max, around) \
if ((n) && !need_pass_2 \
&& (!(fill) || ((char)*(fill) == (char)0x90 && (len) == 1)) \
&& now_seg != data_section && now_seg != bss_section) \
&& md_maybe_text ()) \
{ \
char *p; \
p = frag_var (rs_align_code, 15, 1, (relax_substateT) max, \
@ -434,4 +443,6 @@ void i386_print_statistics PARAMS ((FILE *));
extern void sco_id PARAMS ((void));
#endif
#define DIFF_EXPR_OK /* foo-. gets turned into PC relative relocs */
/* end of tc-i386.h */

File diff suppressed because it is too large Load Diff

View File

@ -4,9 +4,16 @@ dnl And be careful when changing it! If you must add tests with square
dnl brackets, be sure changequote invocations surround it.
dnl
dnl
AC_PREREQ(2.5)dnl v2.5 needed for --bindir et al
AC_INIT(as.h)dnl
dnl
dnl v2.5 needed for --bindir et al
AC_PREREQ(2.5)
AC_INIT(as.h)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(gas, 2.9.1)
AM_PROG_LIBTOOL
user_bfd_gas=
AC_ARG_ENABLE(bfd-assembler,
[ --enable-bfd-assembler use BFD back end for writing object files],
@ -23,17 +30,6 @@ AC_ARG_ENABLE(targets,
no) enable_targets= ;;
*) enable_targets=$enableval ;;
esac])dnl
AC_ARG_ENABLE(shared,
[ --enable-shared build shared BFD library],
[case "${enableval}" in
yes) shared=true shared_bfd=true shared_opcodes=true ;;
no) shared=false ;;
*bfd*opcodes*) shared=true shared_bfd=true shared_opcodes=true ;;
*opcodes*bfd*) shared=true shared_bfd=true shared_opcodes=true ;;
*bfd*) shared=true shared_bfd=true ;;
*opcodes*) shared=true shared_opcodes=true ;;
*) shared=false ;;
esac])dnl
AC_ARG_ENABLE(commonbfdlib,
[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
[case "${enableval}" in
@ -42,13 +38,8 @@ AC_ARG_ENABLE(commonbfdlib,
*) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;;
esac])dnl
# Generate a header file -- gets more post-processing by Makefile later.
AC_CONFIG_HEADER(conf)
dnl For recursion to work right, this must be an absolute pathname.
AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
# Generate a header file
AM_CONFIG_HEADER(config.h:config.in)
te_file=generic
@ -75,9 +66,13 @@ changequote(,)dnl
changequote([,])dnl
# check for architecture variants
arch=
endian=
case ${cpu} in
alpha*) cpu_type=alpha ;;
armeb) cpu_type=arm endian=big ;;
arm*) cpu_type=arm endian=little ;;
thumb*) cpu_type=arm endian=little ;;
hppa*) cpu_type=hppa ;;
changequote(,)dnl
i[456]86) cpu_type=i386 ;;
@ -91,18 +86,25 @@ changequote([,])dnl
powerpcle*) cpu_type=ppc endian=little ;;
powerpc*) cpu_type=ppc endian=big ;;
rs6000*) cpu_type=ppc ;;
sparc64) cpu_type=sparc want_sparc_v9=true ;;
sparc*) cpu_type=sparc ;;
sparclite*) cpu_type=sparc arch=sparclite ;;
sparclet*) cpu_type=sparc arch=sparclet ;;
sparc64*) cpu_type=sparc arch=v9-64 ;;
sparc*) cpu_type=sparc arch=sparclite ;; # ??? See tc-sparc.c.
v850*) cpu_type=v850 ;;
*) cpu_type=${cpu} ;;
esac
if test ${this_target} = $target ; then
target_cpu_type=${cpu_type}
if test x${endian} = xbig; then
AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 1)
elif test x${endian} = xlittle; then
AC_DEFINE(TARGET_BYTES_BIG_ENDIAN, 0)
fi
elif test ${target_cpu_type} != ${cpu_type} ; then
continue
fi
targ=${cpu_type}
generic_target=${cpu_type}-$vendor-$os
dev=no
bfd_gas=no
@ -110,30 +112,27 @@ changequote([,])dnl
# assign object format
case ${generic_target} in
a29k-*-coff) fmt=coff targ=ebmon29k ;;
a29k-amd-udi) fmt=coff targ=ebmon29k ;;
a29k-amd-ebmon) fmt=coff targ=ebmon29k ;;
a29k-nyu-sym1) fmt=coff targ=ebmon29k ;;
a29k-*-coff) fmt=coff ;;
a29k-amd-udi) fmt=coff ;;
a29k-amd-ebmon) fmt=coff ;;
a29k-nyu-sym1) fmt=coff ;;
a29k-*-vxworks*) fmt=coff ;;
alpha-*-*vms*) fmt=evax ;;
alpha-*-netware*) fmt=ecoff ;;
alpha-*-openbsd*) fmt=ecoff ;;
alpha-*-osf*) fmt=ecoff ;;
alpha-*-linuxecoff*) fmt=ecoff ;;
alpha-*-linux*) fmt=elf em=linux ;;
alpha*-*-*vms*) fmt=evax ;;
alpha*-*-netware*) fmt=ecoff ;;
alpha*-*-openbsd*) fmt=ecoff ;;
alpha*-*-osf*) fmt=ecoff ;;
alpha*-*-linuxecoff*) fmt=ecoff ;;
alpha*-*-linux-gnu*) fmt=elf em=linux ;;
alpha*-*-netbsd*) fmt=elf em=nbsd ;;
arc-*-elf*) fmt=elf bfd_gas=yes ;;
arm-*-riscix*) fmt=aout targ=arm-lit em=riscix ;;
arm-*-aout) fmt=aout
case "$endian" in
big) targ=arm-big ;;
*) targ=arm-lit ;;
esac
;;
arm-*-coff) fmt=coff ;;
arm-*-riscix*) fmt=aout em=riscix ;;
arm-*-aout) fmt=aout ;;
arm-*-coff | thumb-*-coff) fmt=coff ;;
arm-*-riscix*) fmt=aout ;;
arm-*-pe) fmt=coff targ=armcoff em=pe ;;
arm-*-pe | thumb-*-pe) fmt=coff em=pe ;;
d10v-*-*) fmt=elf bfd_gas=yes ;;
@ -147,142 +146,122 @@ changequote([,])dnl
h8300-*-coff) fmt=coff ;;
i386-ibm-aix*) fmt=coff targ=i386coff
em=i386aix ;;
i386-ibm-aix*) fmt=coff em=i386aix ;;
i386-sequent-bsd*) fmt=aout em=dynix bfd_gas=yes ;;
i386-*-bsd*) fmt=aout em=386bsd ;;
i386-*-netbsd0.8) fmt=aout em=386bsd ;;
i386-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes;;
i386-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes;;
i386-*-linux*aout* | i386-*-linuxoldld) fmt=aout em=linux ;;
i386-*-linux*coff*) fmt=coff em=linux
targ=i386coff ;;
i386-*-linux*) fmt=elf em=linux ;;
i386-*-lynxos*) fmt=coff targ=i386coff
em=lynx ;;
i386-*-linux*coff*) fmt=coff em=linux ;;
i386-*-linux-gnu*) fmt=elf em=linux ;;
i386-*-lynxos*) fmt=coff em=lynx ;;
i386-*-sysv4* | i386-*-solaris* | i386-*-elf)
fmt=elf ;;
i386-*-freebsdelf*) fmt=elf em=freebsd ;;
i386-*-freebsdelf*) fmt=elf em=freebsd;;
i386-*-freebsd*) fmt=aout em=freebsd bfd_gas=yes ;;
i386-*-sco*elf*) fmt=elf targ=sco5 ;;
i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*)
fmt=coff targ=i386coff ;;
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)
fi
;;
i386-*-sco3.2*) fmt=coff ;;
i386-*-vsta) fmt=aout ;;
i386-*-go32) fmt=coff targ=i386coff ;;
i386-*-rtems*) fmt=coff targ=i386coff ;;
i386-*-msdosdjgpp* | i386-*-go32* | i386-go32-rtems*)
fmt=coff em=go32;;
i386-*-rtems*) fmt=coff ;;
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 targ=i386coff em=pe ;;
i386-*-cygwin32) fmt=coff targ=i386coff em=pe ;;
i386-*-*nt) fmt=coff targ=i386coff em=pe ;;
i386-*-pe) fmt=coff em=pe ;;
i386-*-cygwin32*) fmt=coff em=pe bfd_gas=yes ;;
i386-*-mingw32*) fmt=coff em=pe bfd_gas=yes ;;
i386-*-*nt*) fmt=coff em=pe ;;
i960-*-bout) fmt=bout ;;
i960-*-coff) fmt=coff em=ic960 targ=ic960coff ;;
i960-*-rtems*) fmt=coff em=ic960 targ=ic960coff ;;
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 targ=ic960coff ;;
i960-*-vxworks5.*) fmt=coff em=ic960 ;;
i960-*-vxworks*) fmt=bout ;;
m32r-*-*) fmt=elf bfd_gas=yes ;;
m68k-*-vxworks* | m68k-ericsson-ose | m68k-*-sunos*)
fmt=aout em=sun3 ;;
m68k-motorola-sysv*) fmt=coff targ=m68kcoff em=delta ;;
m68k-bull-sysv3*) fmt=coff targ=m68kcoff em=dpx2 ;;
m68k-apollo-*) fmt=coff targ=apollo em=apollo ;;
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-*-rtems*)
fmt=coff targ=m68kcoff ;;
fmt=coff ;;
m68k-*-hpux*) fmt=hp300 em=hp300 ;;
m68k-*-linux*aout*) fmt=aout em=linux ;;
m68k-*-linux*) fmt=elf em=linux ;;
m68k-*-lynxos*) fmt=coff targ=m68kcoff
em=lynx ;;
m68k-*-linux-gnu*) fmt=elf em=linux ;;
m68k-*-lynxos*) fmt=coff em=lynx ;;
m68k-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
m68k-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
m68k-apple-aux*) fmt=coff targ=m68kcoff em=aux ;;
m68k-apple-aux*) fmt=coff em=aux ;;
m68k-*-psos*) fmt=elf em=psos;;
m88k-motorola-sysv3*) fmt=coff targ=m88kcoff em=delt88 ;;
m88k-*-coff*) fmt=coff targ=m88kcoff ;;
m88k-motorola-sysv3*) fmt=coff em=delt88 ;;
m88k-*-coff*) fmt=coff ;;
# don't change em like *-*-bsd does
mips-dec-netbsd*) fmt=elf targ=mips-lit endian=little ;;
mips-dec-openbsd*) fmt=elf targ=mips-lit endian=little ;;
mips-dec-bsd*) fmt=aout targ=mips-lit ;;
mips-sony-bsd*) fmt=ecoff targ=mips-big ;;
mips-dec-netbsd*) fmt=elf endian=little ;;
mips-dec-openbsd*) fmt=elf endian=little ;;
mips-dec-bsd*) fmt=aout ;;
mips-sony-bsd*) fmt=ecoff ;;
mips-*-bsd*) AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
mips-*-ultrix*) fmt=ecoff targ=mips-lit endian=little ;;
mips-*-osf*) fmt=ecoff targ=mips-lit endian=little ;;
mips-*-ecoff*) fmt=ecoff
case "$endian" in
big) targ=mips-big ;;
*) targ=mips-lit ;;
esac
;;
mips-*-ecoff*) fmt=ecoff targ=mips-big ;;
mips-*-irix6*) fmt=elf targ=mips-big ;;
mips-*-irix5*) fmt=elf targ=mips-big ;;
mips-*-irix*) fmt=ecoff targ=mips-big ;;
mips-*-lnews*) fmt=ecoff targ=mips-lit em=lnews ;;
mips-*-riscos*) fmt=ecoff targ=mips-big ;;
mips-*-sysv*) fmt=ecoff targ=mips-big ;;
mips-*-elf* | mips-*-rtems* | mips-*-linux* | mips-*-gnu* | mips-*-openbsd*)
fmt=elf
case "$endian" in
big) targ=mips-big ;;
*) targ=mips-lit ;;
esac
;;
mips-*-ultrix*) fmt=ecoff endian=little ;;
mips-*-osf*) fmt=ecoff endian=little ;;
mips-*-ecoff*) fmt=ecoff ;;
mips-*-ecoff*) fmt=ecoff ;;
mips-*-irix6*) fmt=elf ;;
mips-*-irix5*) fmt=elf ;;
mips-*-irix*) fmt=ecoff ;;
mips-*-lnews*) fmt=ecoff em=lnews ;;
mips-*-riscos*) fmt=ecoff ;;
mips-*-sysv*) fmt=ecoff ;;
mips-*-elf* | mips-*-rtems* | mips-*-linux-gnu* | mips-*-gnu* | mips-*-openbsd*)
fmt=elf ;;
mn10200-*-*) fmt=elf bfd_gas=yes ;;
mn10300-*-*) fmt=elf bfd_gas=yes ;;
ppc-*-pe | ppc-*-cygwin32 | ppc-*-winnt*)
fmt=coff em=pe
case "$endian" in
big) targ=ppc-big ;;
*) targ=ppc-lit ;;
esac
;;
fmt=coff em=pe ;;
ppc-*-aix*) fmt=coff ;;
ppc-*-beos*) fmt=coff ;;
ppc-*-*bsd* | ppc-*-elf* | ppc-*-eabi* | ppc-*-sysv4*)
fmt=elf
fmt=elf ;;
ppc-*-linux-gnu*) fmt=elf
case "$endian" in
big) targ=ppc-big ;;
*) targ=ppc-lit ;;
esac
;;
ppc-*-linux*) fmt=elf
case "$endian" in
big) targ=ppc-big ;;
*) AC_MSG_ERROR(Linux must be configured big endian) ;;
big) ;;
*) AC_MSG_ERROR(GNU/Linux must be configured big endian) ;;
esac
;;
ppc-*-solaris*) fmt=elf
case "$endian" in
big) AC_MSG_ERROR(Solaris must be configured little endian) ;;
*) targ=ppc-sol ;;
esac
;;
ppc-*-rtems*)
fmt=elf
case "$endian" in
big) targ=ppc-big ;;
*) targ=ppc-lit ;;
esac
if test ${this_target} = $target; then
AC_DEFINE(TARGET_SOLARIS_COMMENT)
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 ;;
sh-*-elf*) fmt=elf ;;
sh-*-coff*) fmt=coff ;;
sh-*-rtems*) fmt=coff ;;
ns32k-pc532-mach* | ns32k-pc532-ux*) fmt=aout em=pc532mach ;;
ns32k-pc532-netbsd* | ns32k-pc532-lites*) fmt=aout em=nbsd532 ;;
@ -294,7 +273,7 @@ changequote([,])dnl
fmt=aout em=sparcaout ;;
sparc-*-coff) fmt=coff ;;
sparc-*-linux*aout*) fmt=aout em=linux ;;
sparc-*-linux*) fmt=elf 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*)
@ -302,6 +281,12 @@ changequote([,])dnl
sparc-*-netbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
sparc-*-openbsd*) fmt=aout em=nbsd bfd_gas=yes ;;
tic30-*-*aout*) fmt=aout bfd_gas=yes ;;
tic30-*-*coff*) fmt=coff bfd_gas=yes ;;
v850-*-*) fmt=elf bfd_gas=yes ;;
vax-*-bsd* | vax-*-ultrix*)
fmt=aout ;;
vax-*-vms) fmt=vms ;;
@ -328,7 +313,7 @@ changequote([,])dnl
esac
case ${cpu_type}-${fmt} in
alpha-*) bfd_gas=yes ;;
alpha*-*) bfd_gas=yes ;;
arm-*) bfd_gas=yes ;;
# not yet
# i386-aout) bfd_gas=preferred ;;
@ -346,10 +331,16 @@ changequote([,])dnl
# do we need the opcodes library?
case ${cpu_type} in
vax | i386)
vax | i386 | tic30)
;;
*)
need_opcodes=yes
case "${enable_shared}" in
yes) shared_opcodes=true ;;
*opcodes*) shared_opcodes=true ;;
*) shared_opcodes=false ;;
esac
if test "${shared_opcodes}" = "true"; then
# A shared libopcodes must be linked against libbfd.
need_bfd=yes
@ -357,12 +348,6 @@ changequote([,])dnl
;;
esac
test -n "$want_sparc_v9" && AC_DEFINE(SPARC_V9)
case ${cpu}-${vendor}-${os} in
sparc64-*-elf*) AC_DEFINE(SPARC_ARCH64) ;;
esac
case ${cpu_type} in
m32r)
case ${extra_objects} in
@ -397,6 +382,12 @@ changequote([,])dnl
fi
;;
sparc)
if test $this_target = $target ; then
AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}")
fi
;;
*)
;;
esac
@ -406,7 +397,6 @@ changequote([,])dnl
if test $this_target = $target ; then
primary_bfd_gas=$bfd_gas
obj_format=$fmt
gas_target=$targ
te_file=$em
if test $bfd_gas = no ; then
@ -422,7 +412,7 @@ changequote([,])dnl
case ${generic_target}-${fmt} in
mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
mips-*-linux*-*) case "$endian" in
mips-*-linux-gnu*-*) case "$endian" in
big) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;;
*) emulation="mipslelf mipsbelf mipself mipslecoff mipsbecoff mipsecoff" ;;
esac ;;
@ -469,14 +459,6 @@ if test ! -r ${srcdir}/config/obj-${obj_format}.c; then
AC_MSG_ERROR(GAS does not have support for object file format ${obj_format})
fi
# and target makefile frag
target_frag=${srcdir}/config/${gas_target}.mt
if test ! -r ${target_frag}; then
target_frag=/dev/null # ick! but subst_file can't be conditionalized
fi
AC_SUBST_FILE(target_frag)
case ${user_bfd_gas}-${primary_bfd_gas} in
yes-yes | no-no)
# We didn't override user's choice.
@ -599,74 +581,18 @@ esac
# do we need the opcodes library?
case "${need_opcodes}" in
yes)
OPCODES_DEP=../opcodes/libopcodes.a
OPCODES_LIB='-L../opcodes -lopcodes'
# We need to handle some special cases for shared libraries.
case "${host}" in
*-*-sunos*)
# On SunOS, we must link against the name we are going to install,
# not -lbfd, since SunOS does not support SONAME.
if test "${shared_opcodes}" = "true"; then
OPCODES_LIB='-L../opcodes -l`echo opcodes | sed '"'"'$(program_transform_name)'"'"'`'
fi
;;
alpha*-*-osf*)
# On Alpha OSF/1, the native linker searches all the -L
# directories for any LIB.so files, and only then searches for any
# LIB.a files. That means that if there is an installed
# libbfd.so, but this build is not done with --enable-shared, the
# link will wind up being against the install libbfd.so rather
# than the newly built libbfd. To avoid this, we must explicitly
# link against libbfd.a when --enable-shared is not used.
if test "${shared_opcodes}" != "true"; then
OPCODES_LIB='../opcodes/libopcodes.a'
fi
;;
esac
OPCODES_LIB=../opcodes/libopcodes.la
;;
esac
case "${need_bfd}" in
yes)
BFDDEP=../bfd/libbfd.a
BFDLIB='-L../bfd -lbfd'
BFDLIB=../bfd/libbfd.la
ALL_OBJ_DEPS="$ALL_OBJ_DEPS ../bfd/bfd.h"
# We need to handle some special cases for shared libraries
case "${host}" in
*-*-sunos*)
# On SunOS, we must link against the name we are going to install,
# not -lbfd, since SunOS does not support SONAME.
if test "${shared_bfd}" = "true"; then
BFDLIB='-L../bfd -l`echo bfd | sed '"'"'$(program_transform_name)'"'"'`'
fi
;;
alpha*-*-osf*)
# On Alpha OSF/1, the native linker searches all the -L
# directories for any LIB.so files, and only then searches for any
# LIB.a files. That means that if there is an installed
# libbfd.so, but this build is not done with --enable-shared, the
# link will wind up being against the install libbfd.so rather
# than the newly built libbfd. To avoid this, we must explicitly
# link against libbfd.a when --enable-shared is not used.
if test "${shared_bfd}" != "true"; then
BFDLIB='../bfd/libbfd.a'
fi
;;
esac
if test "${commonbfdlib}" = "true"; then
# when a shared libbfd is built with --enable-commonbfdlib,
# all of libopcodes is available in libbfd.so
OPCODES_LIB=
fi
;;
esac
AC_SUBST(BFDDEP)
AC_SUBST(BFDLIB)
AC_SUBST(OPCODES_DEP)
AC_SUBST(OPCODES_LIB)
AC_SUBST(ALL_OBJ_DEPS)
@ -678,7 +604,14 @@ AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}")
AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}")
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_YACC
AC_PROG_LEX
AC_DECL_YYTEXT
AM_MAINTAINER_MODE
AM_CYGWIN32
AM_EXEEXT
AC_CHECK_HEADERS(string.h stdlib.h memory.h strings.h unistd.h stdarg.h varargs.h errno.h sys/types.h)
@ -743,58 +676,6 @@ GAS_CHECK_DECL_NEEDED(errno, f, int f, [
#endif
])
HLDFLAGS=
HLDENV=
RPATH_ENVVAR=LD_LIBRARY_PATH
# If we have shared libraries, try to set rpath reasonably.
if test "${shared}" = "true"; then
case "${host}" in
*-*-hpux*)
HLDFLAGS='-Wl,+s,+b,$(libdir)'
RPATH_ENVVAR=SHLIB_PATH
;;
*-*-irix5* | *-*-irix6*)
HLDFLAGS='-Wl,-rpath,$(libdir)'
;;
*-*-linux*aout*)
;;
*-*-linux*)
HLDFLAGS='-Wl,-rpath,$(libdir)'
;;
*-*-solaris*)
HLDFLAGS='-R $(libdir)'
;;
*-*-sysv4*)
HLDENV='if test -z "$${LD_RUN_PATH}"; then LD_RUN_PATH=$(libdir); else LD_RUN_PATH=$${LD_RUN_PATH}:$(libdir); fi; export LD_RUN_PATH;'
;;
esac
fi
# On SunOS, if the linker supports the -rpath option, use it to
# prevent ../bfd and ../opcodes from being included in the run time
# search path.
case "${host}" in
*-*-sunos*)
echo 'main () { }' > conftest.c
${CC} -o conftest -Wl,-rpath= conftest.c >/dev/null 2>conftest.t
if grep 'unrecognized' conftest.t >/dev/null 2>&1; then
:
elif grep 'No such file' conftest.t >/dev/null 2>&1; then
:
elif grep 'do not mix' conftest.t >/dev/null 2>&1; then
:
elif test "${shared}" = "true"; then
HLDFLAGS='-Wl,-rpath=$(libdir)'
else
HLDFLAGS='-Wl,-rpath='
fi
rm -f conftest.t conftest.c conftest
;;
esac
AC_SUBST(HLDFLAGS)
AC_SUBST(HLDENV)
AC_SUBST(RPATH_ENVVAR)
dnl This must come last.
dnl We used to make symlinks to files in the source directory, but now

File diff suppressed because it is too large Load Diff

View File

@ -12,10 +12,12 @@ targ_extra_emuls=
case "${targ}" in
arm-*-pe) targ_emul=armpe ;;
arc-*-elf*) targ_emul=arcelf ;;
d10v-*-*) targ_emul=d10velf ;;
sparc64-*-aout*) targ_emul=sparcaout ;;
sparc64-*-elf*) targ_emul=elf64_sparc ;;
sparc-sun-sunos4*) targ_emul=sun4 ;;
sparclite*-*-elf) targ_emul=elf32_sparc ;;
sparclite*-*-coff) targ_emul=coff_sparc ;;
sparclite*-fujitsu-*) targ_emul=sparcaout ;;
sparc*-*-aout) targ_emul=sparcaout ;;
@ -27,7 +29,13 @@ sparc*-*-linux*aout*) targ_emul=sparclinux
tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/aout//'`
tdir_sun4=sparc-sun-sunos4
;;
sparc*-*-linux*) targ_emul=elf32_sparc
sparc64-*-linux-gnu*) targ_emul=elf64_sparc
targ_extra_emuls="elf32_sparc sparclinux sun4"
tdir_elf32_sparc=`echo ${targ_alias} | sed -e 's/64//'`
tdir_sparclinux=${tdir_elf32_sparc}aout
tdir_sun4=sparc-sun-sunos4
;;
sparc*-*-linux-gnu*) targ_emul=elf32_sparc
targ_extra_emuls="sparclinux sun4"
tdir_sparclinux=${targ_alias}aout
tdir_sun4=sparc-sun-sunos4
@ -52,6 +60,7 @@ m68*-apple-aux*) targ_emul=m68kaux ;;
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 ;;
@ -67,7 +76,7 @@ i[3456]86-*-linux*aout*) targ_emul=i386linux
tdir_elf_i386=`echo ${targ_alias} | sed -e 's/aout//'`
;;
i[3456]86-*-linuxoldld) targ_emul=i386linux; targ_extra_emuls=elf_i386 ;;
i[3456]86-*-linux*) targ_emul=elf_i386
i[3456]86-*-linux-gnu*) targ_emul=elf_i386
targ_extra_emuls=i386linux
tdir_i386linux=${targ_alias}aout
;;
@ -81,12 +90,13 @@ i[3456]86-*-freebsd*) targ_emul=i386freebsd ;;
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; targ_extra_emuls=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[3456]86-*-winnt*) targ_emul=i386pe ;;
i[3456]86-*-pe) targ_emul=i386pe ;;
i[3456]86-*-cygwin32) targ_emul=i386pe ;;
i[3456]86-*-cygwin32*) targ_emul=i386pe ;;
i[3456]86-*-mingw32*) targ_emul=i386pe ;;
m8*-*-*) targ_emul=m88kbcs ;;
a29k-*-udi) targ_emul=sa29200 ;;
a29k-*-ebmon) targ_emul=ebmon29k ;;
@ -95,6 +105,8 @@ a29k-*-*) targ_emul=a29k ;;
arm-*-aout | armel-*-aout) targ_emul=armaoutl ;;
armeb-*-aout) targ_emul=armaoutb ;;
arm-*-coff) targ_emul=armcoff ;;
thumb-*-coff) targ_emul=armcoff ;;
thumb-*-pe) targ_emul=armpe ;;
h8300-*-hms) targ_emul=h8300; targ_extra_emuls="h8300h h8300s"
;;
h8500-*-hms) targ_emul=h8500
@ -103,7 +115,7 @@ h8500-*-hms) targ_emul=h8500
sh-*-elf*) targ_emul=shelf
targ_extra_emuls="shlelf sh shl"
;;
sh-*-*) targ_emul=sh; targ_extra_emuls=shl ;;
sh-*-*|sh-*-rtems*) targ_emul=sh; targ_extra_emuls=shl ;;
m68k-sony-*) targ_emul=news ;;
m68k-hp-bsd*) targ_emul=hp300bsd ;;
m68*-motorola-sysv*) targ_emul=delta68 ;;
@ -115,7 +127,7 @@ m68k-*-linux*aout*) targ_emul=m68klinux
targ_extra_emuls=m68kelf
tdir_m68kelf=`echo ${targ_alias} | sed -e 's/aout//'`
;;
m68k-*-linux*) targ_emul=m68kelf
m68k-*-linux-gnu*) targ_emul=m68kelf
targ_extra_emuls=m68klinux
tdir_m68klinux=`echo ${targ_alias} | sed -e 's/linux/linuxaout/'`
;;
@ -130,7 +142,7 @@ hppa*-*-rtems*) targ_emul=hppaelf ;;
vax-dec-ultrix* | vax-dec-bsd*) targ_emul=vax ;;
mips*-dec-ultrix*) targ_emul=mipslit ;;
mips*-dec-osf*) targ_emul=mipslit ;;
mips*-sgi-irix[56]*) targ_emul=elf32bmip ;;
mips*-sgi-irix[56]*) targ_emul=elf32bsmip ;;
mips*-sgi-irix*) targ_emul=mipsbig ;;
mips*el-*-ecoff*) targ_emul=mipsidtl ;;
mips*-*-ecoff*) targ_emul=mipsidt ;;
@ -146,29 +158,31 @@ mips*vr5000-*-elf*) targ_emul=elf32b4300 ;;
mips*el-*-elf*) targ_emul=elf32elmip ;;
mips*-*-elf*) targ_emul=elf32ebmip ;;
mips*-*-rtems*) targ_emul=elf32ebmip ;;
mips*el-*-linux*) targ_emul=elf32lmip
targ_extra_emuls="elf32bmip mipslit mipsbig"
mips*el-*-linux-gnu*) targ_emul=elf32lsmip
targ_extra_emuls="elf32bsmip mipslit mipsbig"
;;
mips*-*-linux*) targ_emul=elf32bmip
targ_extra_emuls="elf32lmip mipsbig mipslit"
mips*-*-linux-gnu*) targ_emul=elf32bsmip
targ_extra_emuls="elf32lsmip mipsbig mipslit"
;;
mips*-*-lnews*) targ_emul=mipslnews ;;
mn10200-*-*) targ_emul=mn10200 ;;
mn10300-*-*) targ_emul=mn10300 ;;
alpha-*-freebsd*) targ_emul=elf64alpha ;;
alpha-*-linuxecoff*) targ_emul=alpha targ_extra_emuls=elf64alpha
alpha*-*-freebsd*) targ_emul=elf64alpha ;;
alpha*-*-linuxecoff*) targ_emul=alpha targ_extra_emuls=elf64alpha
tdir_elf64alpha=`echo ${targ_alias} | sed -e 's/ecoff//'`
;;
alpha-*-linux*) targ_emul=elf64alpha targ_extra_emuls=alpha
alpha*-*-linux-gnu*) targ_emul=elf64alpha targ_extra_emuls=alpha
tdir_alpha=`echo ${targ_alias} | sed -e 's/linux/linuxecoff/'`
;;
alpha-*-osf*) targ_emul=alpha ;;
alpha-*-gnu*) targ_emul=elf64alpha ;;
alpha-*-netware*) targ_emul=alpha ;;
alpha*-*-osf*) targ_emul=alpha ;;
alpha*-*-gnu*) targ_emul=elf64alpha ;;
alpha*-*-netware*) targ_emul=alpha ;;
alpha*-*-netbsd*) targ_emul=elf64alpha ;;
z8k-*-coff) targ_emul=z8002; targ_extra_emuls=z8001 ;;
ns32k-pc532-mach* | ns32k-pc532-ux*) targ_emul=pc532macha ;;
ns32k-pc532-netbsd* | ns32k-pc532-lites*) targ_emul=ns32knbsd ;;
powerpc-*-elf* | powerpc-*-eabi* | powerpc-*-linux* | powerpc-*-sysv*)
powerpc-*-elf* | powerpc-*-eabi* | powerpc-*-linux-gnu* | powerpc-*-sysv* \
| powerpc-*-netbsd*)
targ_emul=elf32ppc ;;
powerpcle-*-elf* | powerpcle-*-eabi* | powerpcle-*-solaris* | powerpcle-*-sysv*) targ_emul=elf32lppc ;;
powerpc-*-rtems*) targ_emul=elf32ppc ;;
@ -180,6 +194,9 @@ powerpcle-*-cygwin32) targ_emul=ppcpe ;;
powerpc-*-aix*) targ_emul=aixppc ;;
powerpc-*-beos*) targ_emul=aixppc ;;
rs6000-*-aix*) targ_emul=aixrs6 ;;
tic30-*-*aout*) targ_emul=tic30aout ;;
tic30-*-*coff*) targ_emul=tic30coff ;;
v850-*-*) targ_emul=v850 ;;
w65-*-*) targ_emul=w65 ;;
*-*-aout) targ_emul=${target_cpu}-${target_vendor} ;;
*-*-coff) targ_emul=${target_cpu}-${target_vendor} ;;