fsf address update, but not in COPYING files
This commit is contained in:
parent
c71a604ae1
commit
943fbd5bd5
|
@ -16,7 +16,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
|
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* THIS MODULE IS NOT FINISHED. IT PROBABLY DOESN'T EVEN COMPILE. */
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_IS_BIG_ENDIAN_P
|
||||
#define PAGE_SIZE 4096
|
||||
|
|
62
bfd/aoutx.h
62
bfd/aoutx.h
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/*
|
||||
SECTION
|
||||
|
@ -705,8 +705,10 @@ NAME(aout,machine_type) (arch, machine, unknown)
|
|||
case 0:
|
||||
case 2000:
|
||||
case 3000: arch_flags = M_MIPS1; break;
|
||||
case 4000:
|
||||
case 4000: /* mips3 */
|
||||
case 4400:
|
||||
case 8000: /* mips4 */
|
||||
/* real mips2: */
|
||||
case 6000: arch_flags = M_MIPS2; break;
|
||||
default: arch_flags = M_UNKNOWN; break;
|
||||
}
|
||||
|
@ -1542,37 +1544,43 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
|
|||
struct external_nlist *sym_pointer;
|
||||
{
|
||||
bfd_vma value = cache_ptr->value;
|
||||
asection *sec;
|
||||
bfd_vma off;
|
||||
|
||||
/* Mask out any existing type bits in case copying from one section
|
||||
to another. */
|
||||
sym_pointer->e_type[0] &= ~N_TYPE;
|
||||
|
||||
if (bfd_is_abs_section (bfd_get_section (cache_ptr)))
|
||||
sym_pointer->e_type[0] |= N_ABS;
|
||||
else if (bfd_get_section (cache_ptr) == obj_textsec (abfd)
|
||||
|| (bfd_get_section (cache_ptr)->output_section
|
||||
== obj_textsec (abfd)))
|
||||
sym_pointer->e_type[0] |= N_TEXT;
|
||||
else if (bfd_get_section (cache_ptr) == obj_datasec (abfd)
|
||||
|| (bfd_get_section (cache_ptr)->output_section
|
||||
== obj_datasec (abfd)))
|
||||
sym_pointer->e_type[0] |= N_DATA;
|
||||
else if (bfd_get_section (cache_ptr) == obj_bsssec (abfd)
|
||||
|| (bfd_get_section (cache_ptr)->output_section
|
||||
== obj_bsssec (abfd)))
|
||||
sym_pointer->e_type[0] |= N_BSS;
|
||||
else if (bfd_get_section (cache_ptr) == NULL)
|
||||
sec = bfd_get_section (cache_ptr);
|
||||
off = 0;
|
||||
|
||||
if (sec == NULL)
|
||||
{
|
||||
/* Protect the bfd_is_com_section call. This case occurs, e.g.,
|
||||
for the *DEBUG* section of a COFF file. */
|
||||
/* This case occurs, e.g., for the *DEBUG* section of a COFF
|
||||
file. */
|
||||
bfd_set_error (bfd_error_nonrepresentable_section);
|
||||
return false;
|
||||
}
|
||||
else if (bfd_is_und_section (bfd_get_section (cache_ptr)))
|
||||
|
||||
if (sec->output_section != NULL)
|
||||
{
|
||||
off = sec->output_offset;
|
||||
sec = sec->output_section;
|
||||
}
|
||||
|
||||
if (bfd_is_abs_section (sec))
|
||||
sym_pointer->e_type[0] |= N_ABS;
|
||||
else if (sec == obj_textsec (abfd))
|
||||
sym_pointer->e_type[0] |= N_TEXT;
|
||||
else if (sec == obj_datasec (abfd))
|
||||
sym_pointer->e_type[0] |= N_DATA;
|
||||
else if (sec == obj_bsssec (abfd))
|
||||
sym_pointer->e_type[0] |= N_BSS;
|
||||
else if (bfd_is_und_section (sec))
|
||||
sym_pointer->e_type[0] = N_UNDF | N_EXT;
|
||||
else if (bfd_is_ind_section (bfd_get_section (cache_ptr)))
|
||||
else if (bfd_is_ind_section (sec))
|
||||
sym_pointer->e_type[0] = N_INDR;
|
||||
else if (bfd_is_com_section (bfd_get_section (cache_ptr)))
|
||||
else if (bfd_is_com_section (sec))
|
||||
sym_pointer->e_type[0] = N_UNDF | N_EXT;
|
||||
else
|
||||
{
|
||||
|
@ -1581,11 +1589,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
|
|||
}
|
||||
|
||||
/* Turn the symbol from section relative to absolute again */
|
||||
if (cache_ptr->section->output_section != NULL)
|
||||
value += (cache_ptr->section->output_section->vma
|
||||
+ cache_ptr->section->output_offset);
|
||||
else
|
||||
value += cache_ptr->section->vma;
|
||||
value += sec->vma + off;
|
||||
|
||||
if ((cache_ptr->flags & BSF_WARNING) != 0)
|
||||
sym_pointer->e_type[0] = N_WARNING;
|
||||
|
@ -4465,6 +4469,10 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
|
|||
+ input_section->output_offset
|
||||
- input_section->vma);
|
||||
|
||||
#ifdef MY_relocatable_reloc
|
||||
MY_relocatable_reloc (howto, output_bfd, rel, relocation, r_addr);
|
||||
#endif
|
||||
|
||||
if (relocation == 0)
|
||||
r = bfd_reloc_ok;
|
||||
else
|
||||
|
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_SYM m68klynx_coff_vec
|
||||
#define TARGET_NAME "coff-m68k-lynx"
|
||||
|
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define A29K 1
|
||||
|
||||
|
|
|
@ -0,0 +1,570 @@
|
|||
/* BFD back-end for Intel arm COFF files.
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "obstack.h"
|
||||
|
||||
#include "coff/arm.h"
|
||||
|
||||
#include "coff/internal.h"
|
||||
|
||||
#ifdef COFF_WITH_PE
|
||||
#include "coff/pe.h"
|
||||
#endif
|
||||
|
||||
#include "libcoff.h"
|
||||
|
||||
static bfd_reloc_status_type
|
||||
aoutarm_fix_pcrel_26_done PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||
asection *, bfd *, char **));
|
||||
|
||||
static bfd_reloc_status_type
|
||||
aoutarm_fix_pcrel_26 PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||
asection *, bfd *, char **));
|
||||
|
||||
|
||||
static bfd_reloc_status_type coff_arm_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
|
||||
static bfd_reloc_status_type
|
||||
coff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
symvalue diff;
|
||||
|
||||
if (output_bfd == (bfd *) NULL)
|
||||
return bfd_reloc_continue;
|
||||
|
||||
if (bfd_is_com_section (symbol->section))
|
||||
{
|
||||
/* We are relocating a common symbol. The current value in the
|
||||
object file is ORIG + OFFSET, where ORIG is the value of the
|
||||
common symbol as seen by the object file when it was compiled
|
||||
(this may be zero if the symbol was undefined) and OFFSET is
|
||||
the offset into the common symbol (normally zero, but may be
|
||||
non-zero when referring to a field in a common structure).
|
||||
ORIG is the negative of reloc_entry->addend, which is set by
|
||||
the CALC_ADDEND macro below. We want to replace the value in
|
||||
the object file with NEW + OFFSET, where NEW is the value of
|
||||
the common symbol which we are going to put in the final
|
||||
object file. NEW is symbol->value. */
|
||||
diff = symbol->value + reloc_entry->addend;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* For some reason bfd_perform_relocation always effectively
|
||||
ignores the addend for a COFF target when producing
|
||||
relocateable output. This seems to be always wrong for 386
|
||||
COFF, so we handle the addend here instead. */
|
||||
diff = reloc_entry->addend;
|
||||
}
|
||||
|
||||
#define DOIT(x) \
|
||||
x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
|
||||
|
||||
if (diff != 0)
|
||||
{
|
||||
reloc_howto_type *howto = reloc_entry->howto;
|
||||
unsigned char *addr = (unsigned char *) data + reloc_entry->address;
|
||||
|
||||
switch (howto->size)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
char x = bfd_get_8 (abfd, addr);
|
||||
DOIT (x);
|
||||
bfd_put_8 (abfd, x, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
short x = bfd_get_16 (abfd, addr);
|
||||
DOIT (x);
|
||||
bfd_put_16 (abfd, x, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
long x = bfd_get_32 (abfd, addr);
|
||||
DOIT (x);
|
||||
bfd_put_32 (abfd, x, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Now let bfd_perform_relocation finish everything up. */
|
||||
return bfd_reloc_continue;
|
||||
}
|
||||
|
||||
static reloc_howto_type aoutarm_std_reloc_howto[] =
|
||||
{
|
||||
/* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */
|
||||
HOWTO(0, /* type */
|
||||
0, /* rs */
|
||||
0, /* size */
|
||||
8, /* bsz */
|
||||
false, /* pcrel */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* ovf */
|
||||
coff_arm_reloc, /* sf */
|
||||
"8", /*name */
|
||||
true, /* partial */
|
||||
0x000000ff, /*read mask */
|
||||
0x000000ff, /* setmask */
|
||||
PCRELOFFSET /* pcdone */),
|
||||
HOWTO(1,
|
||||
0,
|
||||
1,
|
||||
16,
|
||||
false,
|
||||
0,
|
||||
complain_overflow_bitfield,
|
||||
coff_arm_reloc,
|
||||
"16",
|
||||
true,
|
||||
0x0000ffff,
|
||||
0x0000ffff,
|
||||
PCRELOFFSET),
|
||||
HOWTO( 2,
|
||||
0,
|
||||
2,
|
||||
32,
|
||||
false,
|
||||
0,
|
||||
complain_overflow_bitfield,
|
||||
coff_arm_reloc,
|
||||
"32",
|
||||
true,
|
||||
0xffffffff,
|
||||
0xffffffff,
|
||||
PCRELOFFSET),
|
||||
HOWTO( 3,
|
||||
2,
|
||||
3,
|
||||
26,
|
||||
true,
|
||||
0,
|
||||
complain_overflow_signed,
|
||||
aoutarm_fix_pcrel_26 ,
|
||||
"ARM26",
|
||||
true,
|
||||
0x00ffffff,
|
||||
0x00ffffff,
|
||||
PCRELOFFSET),
|
||||
HOWTO( 4,
|
||||
0,
|
||||
0,
|
||||
8,
|
||||
true,
|
||||
0,
|
||||
complain_overflow_signed,
|
||||
coff_arm_reloc,
|
||||
"DISP8",
|
||||
true,
|
||||
0x000000ff,
|
||||
0x000000ff,
|
||||
true),
|
||||
HOWTO( 5,
|
||||
0,
|
||||
1,
|
||||
16,
|
||||
true,
|
||||
0,
|
||||
complain_overflow_signed,
|
||||
coff_arm_reloc,
|
||||
"DISP16",
|
||||
true,
|
||||
0x0000ffff,
|
||||
0x0000ffff,
|
||||
true),
|
||||
HOWTO( 6,
|
||||
0,
|
||||
2,
|
||||
32,
|
||||
true,
|
||||
0,
|
||||
complain_overflow_signed,
|
||||
coff_arm_reloc,
|
||||
"DISP32",
|
||||
true,
|
||||
0xffffffff,
|
||||
0xffffffff,
|
||||
true),
|
||||
HOWTO( 7,
|
||||
2,
|
||||
3,
|
||||
26,
|
||||
false,
|
||||
0,
|
||||
complain_overflow_signed,
|
||||
aoutarm_fix_pcrel_26_done,
|
||||
"ARM26D",
|
||||
true,
|
||||
0x00ffffff,
|
||||
0x00ffffff,
|
||||
false),
|
||||
{-1},
|
||||
HOWTO( 9,
|
||||
0,
|
||||
-1,
|
||||
16,
|
||||
false,
|
||||
0,
|
||||
complain_overflow_bitfield,
|
||||
coff_arm_reloc,
|
||||
"NEG16",
|
||||
true,
|
||||
0x0000ffff,
|
||||
0x0000ffff,
|
||||
false),
|
||||
HOWTO( 10,
|
||||
0,
|
||||
-2,
|
||||
32,
|
||||
false,
|
||||
0,
|
||||
complain_overflow_bitfield,
|
||||
coff_arm_reloc,
|
||||
"NEG32",
|
||||
true,
|
||||
0xffffffff,
|
||||
0xffffffff,
|
||||
false)
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
(cache_ptr)->howto = aoutarm_std_reloc_howto + (dst)->r_type;
|
||||
|
||||
static bfd_reloc_status_type
|
||||
aoutarm_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section,
|
||||
output_bfd, error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
/* This is dead simple at present. */
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
static bfd_reloc_status_type
|
||||
aoutarm_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
|
||||
output_bfd, error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
bfd_vma relocation;
|
||||
bfd_size_type addr = reloc_entry->address;
|
||||
long target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
|
||||
bfd_reloc_status_type flag = bfd_reloc_ok;
|
||||
|
||||
/* If this is an undefined symbol, return error */
|
||||
if (symbol->section == &bfd_und_section
|
||||
&& (symbol->flags & BSF_WEAK) == 0)
|
||||
return output_bfd ? bfd_reloc_continue : bfd_reloc_undefined;
|
||||
|
||||
/* If the sections are different, and we are doing a partial relocation,
|
||||
just ignore it for now. */
|
||||
if (symbol->section->name != input_section->name
|
||||
&& output_bfd != (bfd *)NULL)
|
||||
return bfd_reloc_continue;
|
||||
|
||||
relocation = (target & 0x00ffffff) << 2;
|
||||
relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend */
|
||||
relocation += symbol->value;
|
||||
relocation += symbol->section->output_section->vma;
|
||||
relocation += symbol->section->output_offset;
|
||||
relocation += reloc_entry->addend;
|
||||
relocation -= input_section->output_section->vma;
|
||||
relocation -= input_section->output_offset;
|
||||
relocation -= addr;
|
||||
if (relocation & 3)
|
||||
return bfd_reloc_overflow;
|
||||
|
||||
/* Check for overflow */
|
||||
if (relocation & 0x02000000)
|
||||
{
|
||||
if ((relocation & ~0x03ffffff) != ~0x03ffffff)
|
||||
flag = bfd_reloc_overflow;
|
||||
}
|
||||
else if (relocation & ~0x03ffffff)
|
||||
flag = bfd_reloc_overflow;
|
||||
|
||||
target &= ~0x00ffffff;
|
||||
target |= (relocation >> 2) & 0x00ffffff;
|
||||
bfd_put_32 (abfd, target, (bfd_byte *) data + addr);
|
||||
|
||||
/* Now the ARM magic... Change the reloc type so that it is marked as done.
|
||||
Strictly this is only necessary if we are doing a partial relocation. */
|
||||
reloc_entry->howto = &aoutarm_std_reloc_howto[7];
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
static CONST struct reloc_howto_struct *
|
||||
arm_reloc_type_lookup(abfd,code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
#define ASTD(i,j) case i: return &aoutarm_std_reloc_howto[j]
|
||||
if (code == BFD_RELOC_CTOR)
|
||||
switch (bfd_get_arch_info (abfd)->bits_per_address)
|
||||
{
|
||||
case 32:
|
||||
code = BFD_RELOC_32;
|
||||
break;
|
||||
default: return (CONST struct reloc_howto_struct *) 0;
|
||||
}
|
||||
|
||||
switch (code)
|
||||
{
|
||||
ASTD (BFD_RELOC_16, 1);
|
||||
ASTD (BFD_RELOC_32, 2);
|
||||
ASTD (BFD_RELOC_ARM_PCREL_BRANCH, 3);
|
||||
ASTD (BFD_RELOC_8_PCREL, 4);
|
||||
ASTD (BFD_RELOC_16_PCREL, 5);
|
||||
ASTD (BFD_RELOC_32_PCREL, 6);
|
||||
default: return (CONST struct reloc_howto_struct *) 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define coff_bfd_reloc_type_lookup arm_reloc_type_lookup
|
||||
|
||||
static reloc_howto_type *coff_arm_rtype_to_howto
|
||||
PARAMS ((bfd *, asection *, struct internal_reloc *,
|
||||
struct coff_link_hash_entry *, struct internal_syment *,
|
||||
|
||||
bfd_vma *));
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
|
||||
/* The page size is a guess based on ELF. */
|
||||
#define COFF_PAGE_SIZE 0x1000
|
||||
|
||||
/* For some reason when using arm COFF the value stored in the .text
|
||||
section for a reference to a common symbol is the value itself plus
|
||||
any desired offset. Ian Taylor, Cygnus Support. */
|
||||
|
||||
/* If we are producing relocateable output, we need to do some
|
||||
adjustments to the object file that are not done by the
|
||||
bfd_perform_relocation function. This function is called by every
|
||||
reloc type to make any required adjustments. */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
aacoff_arm_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
symvalue diff;
|
||||
|
||||
if (output_bfd == (bfd *) NULL)
|
||||
return bfd_reloc_continue;
|
||||
|
||||
if (bfd_is_com_section (symbol->section))
|
||||
{
|
||||
/* We are relocating a common symbol. The current value in the
|
||||
object file is ORIG + OFFSET, where ORIG is the value of the
|
||||
common symbol as seen by the object file when it was compiled
|
||||
(this may be zero if the symbol was undefined) and OFFSET is
|
||||
the offset into the common symbol (normally zero, but may be
|
||||
non-zero when referring to a field in a common structure).
|
||||
ORIG is the negative of reloc_entry->addend, which is set by
|
||||
the CALC_ADDEND macro below. We want to replace the value in
|
||||
the object file with NEW + OFFSET, where NEW is the value of
|
||||
the common symbol which we are going to put in the final
|
||||
object file. NEW is symbol->value. */
|
||||
diff = symbol->value + reloc_entry->addend;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* For some reason bfd_perform_relocation always effectively
|
||||
ignores the addend for a COFF target when producing
|
||||
relocateable output. This seems to be always wrong for arm
|
||||
COFF, so we handle the addend here instead. */
|
||||
diff = reloc_entry->addend;
|
||||
}
|
||||
|
||||
#define DOIT(x) \
|
||||
x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask))
|
||||
|
||||
if (diff != 0)
|
||||
{
|
||||
reloc_howto_type *howto = reloc_entry->howto;
|
||||
unsigned char *addr = (unsigned char *) data + reloc_entry->address;
|
||||
|
||||
switch (howto->size)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
char x = bfd_get_8 (abfd, addr);
|
||||
DOIT (x);
|
||||
bfd_put_8 (abfd, x, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
short x = bfd_get_16 (abfd, addr);
|
||||
DOIT (x);
|
||||
bfd_put_16 (abfd, x, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
long x = bfd_get_32 (abfd, addr);
|
||||
DOIT (x);
|
||||
bfd_put_32 (abfd, x, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Now let bfd_perform_relocation finish everything up. */
|
||||
return bfd_reloc_continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Turn a howto into a reloc nunmber */
|
||||
|
||||
#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
|
||||
#define BADMAG(x) ARMBADMAG(x)
|
||||
#define ARM 1 /* Customize coffcode.h */
|
||||
|
||||
|
||||
/* On SCO Unix 3.2.2 the native assembler generates two .data
|
||||
sections. We handle that by renaming the second one to .data2. It
|
||||
does no harm to do this for any arm COFF target. */
|
||||
#define TWO_DATA_SECS
|
||||
|
||||
/* For arm COFF a STYP_NOLOAD | STYP_BSS section is part of a shared
|
||||
library. On some other COFF targets STYP_BSS is normally
|
||||
STYP_NOLOAD. */
|
||||
#define BSS_NOLOAD_IS_SHARED_LIBRARY
|
||||
|
||||
|
||||
/* We use the special COFF backend linker. */
|
||||
#define coff_relocate_section _bfd_coff_generic_relocate_section
|
||||
|
||||
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
static const bfd_target *
|
||||
i3coff_object_p(a)
|
||||
bfd *a;
|
||||
{
|
||||
return coff_object_p(a);
|
||||
}
|
||||
|
||||
const bfd_target
|
||||
#ifdef TARGET_SYM
|
||||
TARGET_SYM =
|
||||
#else
|
||||
armcoff_vec =
|
||||
#endif
|
||||
{
|
||||
#ifdef TARGET_NAME
|
||||
TARGET_NAME,
|
||||
#else
|
||||
"coff-arm", /* name */
|
||||
#endif
|
||||
bfd_target_coff_flavour,
|
||||
false, /* data byte order is little */
|
||||
false, /* header byte order is little */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
|
||||
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||
#ifdef TARGET_UNDERSCORE
|
||||
TARGET_UNDERSCORE, /* leading underscore */
|
||||
#else
|
||||
0, /* leading underscore */
|
||||
#endif
|
||||
'/', /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
|
||||
2, /* minimum alignment power */
|
||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
|
||||
|
||||
/* Note that we allow an object file to be treated as a core file as well. */
|
||||
{_bfd_dummy_target, i3coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, i3coff_object_p},
|
||||
{bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (coff),
|
||||
BFD_JUMP_TABLE_COPY (coff),
|
||||
BFD_JUMP_TABLE_CORE (_bfd_nocore),
|
||||
BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
|
||||
BFD_JUMP_TABLE_SYMBOLS (coff),
|
||||
BFD_JUMP_TABLE_RELOCS (coff),
|
||||
BFD_JUMP_TABLE_WRITE (coff),
|
||||
BFD_JUMP_TABLE_LINK (coff),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
COFF_SWAP_TABLE,
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
/* BFD back-end for Intel 960 COFF files.
|
||||
Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define I960 1
|
||||
#define BADMAG(x) I960BADMAG(x)
|
||||
|
@ -34,6 +34,12 @@ static bfd_reloc_status_type optcall_callback
|
|||
static bfd_reloc_status_type coff_i960_relocate
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
||||
|
||||
/* The i960 does not support an MMU, so COFF_PAGE_SIZE can be
|
||||
arbitrarily small. */
|
||||
#define COFF_PAGE_SIZE 1
|
||||
|
||||
#define COFF_LONG_FILENAMES
|
||||
|
||||
#define CALLS 0x66003800 /* Template for 'calls' instruction */
|
||||
|
@ -42,12 +48,12 @@ static bfd_reloc_status_type coff_i960_relocate
|
|||
|
||||
static bfd_reloc_status_type
|
||||
optcall_callback (abfd, reloc_entry, symbol_in, data,
|
||||
ignore_input_section, ignore_bfd, error_message)
|
||||
input_section, ignore_bfd, error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol_in;
|
||||
PTR data;
|
||||
asection *ignore_input_section;
|
||||
asection *input_section;
|
||||
bfd *ignore_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
|
@ -57,6 +63,13 @@ optcall_callback (abfd, reloc_entry, symbol_in, data,
|
|||
bfd_reloc_status_type result;
|
||||
coff_symbol_type *cs = coffsymbol(symbol_in);
|
||||
|
||||
/* Don't do anything with symbols which aren't tied up yet,
|
||||
except move the reloc. */
|
||||
if (bfd_is_und_section (cs->symbol.section)) {
|
||||
reloc_entry->address += input_section->output_offset;
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
/* So the target symbol has to be of coff type, and the symbol
|
||||
has to have the correct native information within it */
|
||||
if ((bfd_asymbol_flavour(&cs->symbol) != bfd_target_coff_flavour)
|
||||
|
@ -126,8 +139,7 @@ coff_i960_relocate (abfd, reloc_entry, symbol, data, input_section,
|
|||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
{
|
||||
const char *sec_name;
|
||||
asymbol **syms, **sym_end;
|
||||
asection *osec;
|
||||
|
||||
if (output_bfd == NULL)
|
||||
{
|
||||
|
@ -141,25 +153,42 @@ coff_i960_relocate (abfd, reloc_entry, symbol, data, input_section,
|
|||
return bfd_reloc_continue;
|
||||
}
|
||||
|
||||
/* Convert the reloc to use the section symbol. FIXME: This method
|
||||
is ridiculous. */
|
||||
sec_name = bfd_get_section_name (output_bfd,
|
||||
bfd_get_section (symbol)->output_section);
|
||||
syms = bfd_get_outsymbols (output_bfd);
|
||||
sym_end = syms + bfd_get_symcount (output_bfd);
|
||||
for (; syms < sym_end; syms++)
|
||||
if (bfd_is_com_section (bfd_get_section (symbol)))
|
||||
{
|
||||
if (bfd_asymbol_name (*syms) != NULL
|
||||
&& strcmp (bfd_asymbol_name (*syms), sec_name) == 0
|
||||
&& (*syms)->value == 0)
|
||||
{
|
||||
reloc_entry->sym_ptr_ptr = syms;
|
||||
break;
|
||||
}
|
||||
/* I don't really know what the right action is for a common
|
||||
symbol. */
|
||||
return bfd_reloc_continue;
|
||||
}
|
||||
|
||||
if (syms >= sym_end)
|
||||
abort ();
|
||||
/* Convert the reloc to use the section symbol. FIXME: This method
|
||||
is ridiculous. Fortunately, we don't use the used_by_bfd field
|
||||
in COFF. */
|
||||
osec = bfd_get_section (symbol)->output_section;
|
||||
if (osec->used_by_bfd != NULL)
|
||||
reloc_entry->sym_ptr_ptr = (asymbol **) osec->used_by_bfd;
|
||||
else
|
||||
{
|
||||
const char *sec_name;
|
||||
asymbol **syms, **sym_end;
|
||||
|
||||
sec_name = bfd_get_section_name (output_bfd, osec);
|
||||
syms = bfd_get_outsymbols (output_bfd);
|
||||
sym_end = syms + bfd_get_symcount (output_bfd);
|
||||
for (; syms < sym_end; syms++)
|
||||
{
|
||||
if (bfd_asymbol_name (*syms) != NULL
|
||||
&& (*syms)->value == 0
|
||||
&& strcmp (!(*syms)->section->output_section->name, sec_name))
|
||||
{
|
||||
osec->used_by_bfd = (PTR) syms;
|
||||
reloc_entry->sym_ptr_ptr = syms;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (syms >= sym_end)
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* Let bfd_perform_relocation do its thing, which will include
|
||||
stuffing the symbol addend into the object file. */
|
||||
|
@ -177,7 +206,7 @@ static reloc_howto_type howto_optcall =
|
|||
HOWTO (R_OPTCALL, 0,2,24,true,0, complain_overflow_signed,
|
||||
optcall_callback, "optcall", true, 0x00ffffff, 0x00ffffff, 0);
|
||||
|
||||
static const reloc_howto_type *
|
||||
static reloc_howto_type *
|
||||
coff_i960_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
|
@ -207,7 +236,7 @@ coff_i960_reloc_type_lookup (abfd, code)
|
|||
case 27: howto_ptr = &howto_optcall; break; \
|
||||
default: howto_ptr = 0; break; \
|
||||
} \
|
||||
cache_ptr->howto = howto_ptr; \
|
||||
(cache_ptr)->howto = howto_ptr; \
|
||||
}
|
||||
|
||||
#include "coffcode.h"
|
||||
|
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file contains the COFF backend linker code. */
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/*
|
||||
SECTION
|
||||
|
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
|
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
|
|
@ -17,7 +17,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
|
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
|
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
|
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
|
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
/* ELF linker code. */
|
||||
|
||||
static boolean elf_link_add_object_symbols
|
||||
|
|
|
@ -13,7 +13,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* BFD back-end for linux flavored i386 a.out binaries.
|
||||
Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define PAGE_SIZE 4096
|
||||
#define ZMAGIC_DISK_BLOCK_SIZE 1024
|
||||
|
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _LIBELF_H_
|
||||
#define _LIBELF_H_ 1
|
||||
|
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
|
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define BYTES_IN_WORD 4
|
||||
#define N_SHARED_LIB(x) 0
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
DebugOptions =
|
||||
# -d DEBUG_BFD_SEND
|
||||
|
|
10
bfd/sunos.c
10
bfd/sunos.c
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGETNAME "a.out-sunos-big"
|
||||
#define MY(OP) CAT(sunos_big_,OP)
|
||||
|
@ -486,7 +486,8 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
|
|||
p = (struct reloc_ext_external *) info->dynrel;
|
||||
pend = p + info->dynrel_count;
|
||||
for (; p < pend; p++, to++)
|
||||
NAME(aout,swap_ext_reloc_in) (abfd, p, to, syms);
|
||||
NAME(aout,swap_ext_reloc_in) (abfd, p, to, syms,
|
||||
info->dynsym_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -496,7 +497,8 @@ sunos_canonicalize_dynamic_reloc (abfd, storage, syms)
|
|||
p = (struct reloc_std_external *) info->dynrel;
|
||||
pend = p + info->dynrel_count;
|
||||
for (; p < pend; p++, to++)
|
||||
NAME(aout,swap_std_reloc_in) (abfd, p, to, syms);
|
||||
NAME(aout,swap_std_reloc_in) (abfd, p, to, syms,
|
||||
info->dynsym_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -876,7 +878,7 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string,
|
|||
&& h->root.root.u.def.section->owner != NULL
|
||||
&& (h->root.root.u.def.section->owner->flags & DYNAMIC) != 0)
|
||||
|| (h->root.root.type == bfd_link_hash_common
|
||||
&& ((h->root.root.u.c.section->owner->flags & DYNAMIC)
|
||||
&& ((h->root.root.u.c.p->section->owner->flags & DYNAMIC)
|
||||
!= 0)))
|
||||
{
|
||||
/* The existing definition is from a dynamic object. We
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author may be reached (Email) at the address mike@ai.mit.edu,
|
||||
or (US mail) as Mike Haertel c/o Free Software Foundation. */
|
||||
|
@ -40,7 +40,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the GNU C Library; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* ANSI and traditional C compatibility macros
|
||||
|
||||
|
@ -238,7 +238,7 @@ extern PTR EXFUN(memset, (PTR, int, size_t));
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author may be reached (Email) at the address mike@@ai.mit.edu,
|
||||
or (US mail) as Mike Haertel c/o Free Software Foundation. */
|
||||
|
@ -401,7 +401,7 @@ extern struct mstats EXFUN(mstats, (NOARGS));
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author may be reached (Email) at the address mike@ai.mit.edu,
|
||||
or (US mail) as Mike Haertel c/o Free Software Foundation. */
|
||||
|
@ -600,7 +600,7 @@ DEFUN(free, (ptr), PTR ptr)
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author may be reached (Email) at the address mike@ai.mit.edu,
|
||||
or (US mail) as Mike Haertel c/o Free Software Foundation. */
|
||||
|
@ -900,7 +900,7 @@ DEFUN(malloc, (size), size_t size)
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author may be reached (Email) at the address mike@ai.mit.edu,
|
||||
or (US mail) as Mike Haertel c/o Free Software Foundation. */
|
||||
|
@ -1039,7 +1039,7 @@ DEFUN(realloc, (ptr, size), PTR ptr AND size_t size)
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author may be reached (Email) at the address mike@ai.mit.edu,
|
||||
or (US mail) as Mike Haertel c/o Free Software Foundation. */
|
||||
|
@ -1083,7 +1083,7 @@ DEFUN(__default_morecore, (size), ptrdiff_t size)
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
The author may be reached (Email) at the address mike@ai.mit.edu,
|
||||
or (US mail) as Mike Haertel c/o Free Software Foundation. */
|
||||
|
|
|
@ -29,7 +29,7 @@ o = :
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# srcdir = :
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Written by Steve Chamberlain (sac@cygnus.com)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-dejagnu@prep.ai.mit.edu
|
||||
|
@ -20,7 +20,7 @@
|
|||
# This file was written by Rob Savoye <rob@cygnus.com>
|
||||
# and rewritten by Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
if [istarget hppa*-*-*] then {
|
||||
if ![istarget hppa*-*-*] then {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,12 @@ if {![binutils_assemble $AS $srcdir$subdir/addendbug.s tmpdir/addendbug.o]} then
|
|||
|
||||
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r tmpdir/addendbug.o"]
|
||||
|
||||
set want "00000000 R_DP_RELATIVE\[ \]+is_idchar\\+0xffffffe0.*"
|
||||
if [istarget hppa*-*-*elf*] then {
|
||||
set want "00000000 R_PARISC_DPREL21L\[ \]+is_idchar\\+0xffffffe0.*"
|
||||
} else {
|
||||
set want "00000000 R_DP_RELATIVE\[ \]+is_idchar\\+0xffffffe0.*"
|
||||
}
|
||||
|
||||
|
||||
if [regexp $want $got] then {
|
||||
pass "addendbug test"
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
# Copyright (C) 1993, 1994 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-dejagnu@prep.ai.mit.edu
|
||||
|
||||
# This file was written by Rob Savoye <rob@cygnus.com>
|
||||
# and rewritten by Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
if {[which $NM] == 0} then {
|
||||
perror "$NM does not exist"
|
||||
return
|
||||
}
|
||||
|
||||
send_user "Version [binutil_version $NM]"
|
||||
|
||||
|
||||
if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then {
|
||||
return
|
||||
}
|
||||
|
||||
# Test nm with no arguments.
|
||||
|
||||
# This test does not work correctly on ECOFF targets, because ECOFF
|
||||
# stores most symbols twice, which messes up the nm output.
|
||||
setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
|
||||
setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
|
||||
setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*"
|
||||
|
||||
set got [binutils_run $NM "$NMFLAGS tmpdir/bintest.o"]
|
||||
|
||||
if [info exists vars] then { unset vars }
|
||||
while {[regexp "(\[a-zA-Z\]) (\[a-z\]*_symbol)(.*)" $got all type symbol rest]} {
|
||||
set vars($symbol) $type
|
||||
set got $rest
|
||||
}
|
||||
|
||||
if {![info exists vars(text_symbol)] \
|
||||
|| $vars(text_symbol) != "t" \
|
||||
|| ![info exists vars(data_symbol)] \
|
||||
|| $vars(data_symbol) != "d" \
|
||||
|| ![info exists vars(common_symbol)] \
|
||||
|| $vars(common_symbol) != "C" \
|
||||
|| ![info exists vars(external_symbol)] \
|
||||
|| $vars(external_symbol) != "U"} then {
|
||||
fail "nm (no arguments)"
|
||||
} else {
|
||||
pass "nm (no arguments)"
|
||||
}
|
||||
|
||||
# Test nm -g
|
||||
|
||||
set got [binutils_run $NM "$NMFLAGS -g tmpdir/bintest.o"]
|
||||
|
||||
if [info exists vars] then { unset vars }
|
||||
while {[regexp "(\[a-z\]*_symbol)(.*)" $got all symbol rest]} {
|
||||
set vars($symbol) 1
|
||||
set got $rest
|
||||
}
|
||||
|
||||
if {[info exists vars(text_symbol)] \
|
||||
|| [info exists vars(data_symbol)] \
|
||||
|| ![info exists vars(common_symbol)] \
|
||||
|| ![info exists vars(external_symbol)]} then {
|
||||
fail "nm -g"
|
||||
} else {
|
||||
pass "nm -g"
|
||||
}
|
||||
|
||||
# Test nm -P
|
||||
|
||||
# This test does not work correctly on ECOFF targets, because ECOFF
|
||||
# stores most symbols twice, which messes up the nm output.
|
||||
setup_xfail "alpha*-*-osf*" "alpha*-*-netware*"
|
||||
setup_xfail "mips*-*-ultrix*" "mips*-*-ecoff*" "mips*-*-irix4*"
|
||||
setup_xfail "mips*-*-riscos*" "mips*-*-sysv3*"
|
||||
|
||||
set got [binutils_run $NM "$NMFLAGS -P tmpdir/bintest.o"]
|
||||
|
||||
set want "common_symbol C \[0\]*4.*data_symbol d \[0-9a-fA-F\]*.*external_symbol U.*text_symbol t \[0-9a-fA-F\]*"
|
||||
|
||||
if [regexp $want $got] then {
|
||||
pass "nm -P"
|
||||
} else {
|
||||
fail "nm -P"
|
||||
}
|
||||
|
||||
# There are certainly other tests that could be run.
|
|
@ -12,7 +12,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-dejagnu@prep.ai.mit.edu
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-dejagnu@prep.ai.mit.edu
|
||||
|
@ -32,6 +32,9 @@ send_user "Version [binutil_version $OBJDUMP]"
|
|||
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -i"]
|
||||
|
||||
set cpus_expected "(a29k|alliant|alpha|arm|convex|h8|hppa|i386|i860|i960|m68k|m88k|mips|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|vax|we32k|z8k)"
|
||||
# start-sanitize-arc
|
||||
set cpus_expected "(a29k|alliant|alpha|arc|arm|convex|h8|hppa|i386|i860|i960|m68k|m88k|mips|ns32k|powerpc|pyramid|romp|rs6000|sh|sparc|tahoe|vax|we32k|z8k)"
|
||||
# end-sanitize-arc
|
||||
|
||||
set want "BFD header file version.*srec.*header .* endian, data .* endian.*$cpus_expected"
|
||||
|
||||
|
@ -43,6 +46,7 @@ if [regexp $want $got] then {
|
|||
|
||||
# The remaining tests require a test file.
|
||||
|
||||
|
||||
if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then {
|
||||
return
|
||||
}
|
||||
|
@ -63,15 +67,16 @@ if ![regexp $want $got] then {
|
|||
|
||||
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h tmpdir/bintest.o"]
|
||||
|
||||
set want "tmpdir/bintest.o:\[ \]*file format.*SECTION\[ ]*\[0-9\]+\[ \]*\\\[\[^\]\]*(text|TEXT)\[^\]\]*\\\]\[ :\]*size\[ \]*(\[0-9a-fA-F\]+)\[ \]*.*SECTION\[ \]*\[0-9\]+\[ \]*\\\[\[^\]\]*(data|DATA)\[^\]\]*\\\]\[ :\]*size\[ \]*(\[0-9a-fA-F\]+)\[ \]*"
|
||||
set want "tmpdir/bintest.o:\[ \]*file format.*SECTION\[ ]*\[0-9\]+\[ \]*\\\[\[^\]\]*(text|TEXT|CODE)\[^\]\]*\\\]\[ :\]*size\[ \]*(\[0-9a-fA-F\]+)\[ \]*.*SECTION\[ \]*\[0-9\]+\[ \]*\\\[\[^\]\]*(data|DATA)\[^\]\]*\\\]\[ :\]*size\[ \]*(\[0-9a-fA-F\]+)\[ \]*"
|
||||
|
||||
if ![regexp $want $got all text_name text_size data_name data_size] then {
|
||||
fail "objdump -h"
|
||||
} else {
|
||||
verbose "text size is $text_size"
|
||||
verbose "data size is $data_size"
|
||||
if {$text_size < 8 || $data_size < 4} then {
|
||||
fail "objdump -h (sizes too small)"
|
||||
if {[expr "0x$text_size"] < 8 || [expr "0x$data_size"] < 4} then {
|
||||
send_log "sizes too small\n"
|
||||
fail "objdump -h"
|
||||
} else {
|
||||
pass "objdump -h"
|
||||
}
|
||||
|
@ -100,7 +105,7 @@ if {![info exists vars(text_symbol)] \
|
|||
|
||||
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -r tmpdir/bintest.o"]
|
||||
|
||||
set want "tmpdir/bintest.o:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT)\[^\]\]*\\\].*external_symbol"
|
||||
set want "tmpdir/bintest.o:\[ \]*file format.*RELOCATION RECORDS FOR \\\[\[^\]\]*(text|TEXT|CODE)\[^\]\]*\\\].*external_symbol"
|
||||
|
||||
if [regexp $want $got] then {
|
||||
pass "objdump -r"
|
||||
|
@ -112,7 +117,7 @@ if [regexp $want $got] then {
|
|||
|
||||
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -s tmpdir/bintest.o"]
|
||||
|
||||
set want "tmpdir/bintest.o:\[ \]*file format.*Contents.*(text|TEXT)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000001|01000000).*Contents.*(data|DATA)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000002|02000000)"
|
||||
set want "tmpdir/bintest.o:\[ \]*file format.*Contents.*(text|TEXT|CODE)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000001|01000000).*Contents.*(data|DATA)\[^0-9\]*\[ \]*\[0-9a-fA-F\]*\[ \]*(00000002|02000000)"
|
||||
|
||||
if [regexp $want $got] then {
|
||||
pass "objdump -s"
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
# Copyright (C) 1993, 1994 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-dejagnu@prep.ai.mit.edu
|
||||
|
||||
# This file was written by Rob Savoye <rob@cygnus.com>
|
||||
# and rewritten by Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
if {[which $SIZE] == 0} then {
|
||||
perror "$SIZE does not exist"
|
||||
return
|
||||
}
|
||||
|
||||
send_user "Version [binutil_version $SIZE]"
|
||||
|
||||
|
||||
if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then {
|
||||
return
|
||||
}
|
||||
|
||||
set dec "\[0-9\]+"
|
||||
set hex "\[0-9a-fA-F\]+"
|
||||
|
||||
# Test size with no arguments
|
||||
|
||||
set got [binutils_run $SIZE "$SIZEFLAGS tmpdir/bintest.o"]
|
||||
|
||||
set want "($dec)\[ \]+($dec)\[ \]+($dec)\[ \]+($dec)\[ \]+($hex)\[ \]+tmpdir/bintest.o"
|
||||
|
||||
if ![regexp $want $got all text data bss dtot hextot] then {
|
||||
fail "size (no arguments)"
|
||||
} else {
|
||||
if {$text < 8 || $data < 4} then {
|
||||
fail "size (no arguments)"
|
||||
} else {
|
||||
pass "size (no arguments)"
|
||||
}
|
||||
}
|
||||
|
||||
# Test size -A
|
||||
|
||||
set got [binutils_run $SIZE "$SIZEFLAGS -A tmpdir/bintest.o"]
|
||||
|
||||
set want "tmpdir/bintest.o.*(text|TEXT)\[^\n\r\]*\[ \]($dec)\[ \]+$dec.*(data|DATA)\[^\n\r\]*\[ \]($dec)\[ \]+$dec"
|
||||
|
||||
if ![regexp $want $got all textname textsize dataname datasize] then {
|
||||
fail "size -A"
|
||||
} else {
|
||||
verbose "text size: $textsize"
|
||||
verbose "data size: $datasize"
|
||||
if {$textsize < 8 || $datasize < 4} then {
|
||||
fail "size -A"
|
||||
} else {
|
||||
pass "size -A"
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1993, 1994 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
|
||||
|
@ -12,7 +12,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-dejagnu@prep.ai.mit.edu
|
||||
|
@ -20,32 +20,62 @@
|
|||
# This file was written by Rob Savoye. (rob@cygnus.com)
|
||||
|
||||
load_lib util-defs.exp
|
||||
load_lib utils-lib.exp
|
||||
|
||||
global NM
|
||||
if ![info exists NM] then {
|
||||
set NM [findfile $base_dir/../nm]
|
||||
if ![info exists AS] then {
|
||||
set AS [findfile $base_dir/../gas/as.new $base_dir/../gas/as.new [transform as]]
|
||||
}
|
||||
if ![info exists ASFLAGS] then {
|
||||
set ASFLAGS ""
|
||||
}
|
||||
|
||||
if ![info exists NM] then {
|
||||
set NM [findfile $base_dir/nm.new $base_dir/nm.new [transform nm]]
|
||||
}
|
||||
global NMFLAGS
|
||||
if ![info exists NMFLAGS] then {
|
||||
set NMFLAGS ""
|
||||
}
|
||||
global SIZE
|
||||
|
||||
if ![info exists SIZE] then {
|
||||
set SIZE [findfile $base_dir/../size]
|
||||
set SIZE [findfile $base_dir/size]
|
||||
}
|
||||
global SIZEFLAGS
|
||||
if ![info exists SIZEFLAGS] then {
|
||||
set SIZEFLAGS ""
|
||||
}
|
||||
global OBJDUMP
|
||||
|
||||
if ![info exists OBJDUMP] then {
|
||||
set OBJDUMP [findfile $base_dir/../objdump]
|
||||
set OBJDUMP [findfile $base_dir/objdump]
|
||||
}
|
||||
global OBJDUMPFLAGS
|
||||
if ![info exists OBJDUMPFLAGS] then {
|
||||
set OBJDUMPFLAGS ""
|
||||
}
|
||||
|
||||
if ![info exists OBJCOPY] then {
|
||||
set OBJCOPY [findfile $base_dir/objcopy]
|
||||
}
|
||||
if ![info exists OBJCOPYFLAGS] then {
|
||||
set OBJCOPYFLAGS ""
|
||||
}
|
||||
|
||||
if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status}
|
||||
|
||||
#
|
||||
# binutils_run
|
||||
# run a program, returning the output
|
||||
# sets binutils_run_failed if the program does not exist
|
||||
#
|
||||
proc binutils_run { prog progargs } {
|
||||
default_binutils_run $prog $progargs
|
||||
}
|
||||
|
||||
#
|
||||
# binutils_assemble
|
||||
# assemble a file
|
||||
#
|
||||
proc binutils_assemble { as source object } {
|
||||
default_binutils_assemble $as $source $object
|
||||
}
|
||||
|
||||
#
|
||||
# add some basic error trapping. These mostly catch programming error's
|
||||
# within the tests themselves
|
||||
|
@ -54,6 +84,3 @@ expect_before {
|
|||
buffer_full { perror "internal buffer is full." }
|
||||
"can't open '*'" { perror "Can't open test file." }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
# Copyright (C) 1993, 1994 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
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-dejagnu@prep.ai.mit.edu
|
||||
|
||||
# This file was written by Rob Savoye <rob@cygnus.com>
|
||||
# and extended by Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
proc binutil_version { prog } {
|
||||
if {[which $prog] == 0} then {
|
||||
perror "$prog can't be run, file not found."
|
||||
return ""
|
||||
}
|
||||
catch "exec $prog --version" tmp
|
||||
# Should find a way to discard constant parts, keep whatever's
|
||||
# left, so the version string could be almost anything at all...
|
||||
regexp "version (cygnus-|)\[-0-9.a-zA-Z-\]+" $tmp version
|
||||
if ![info exists version] then {
|
||||
return "[which $prog] (no version number)\n"
|
||||
}
|
||||
set tmp $version
|
||||
return "[which $prog] $version\n"
|
||||
}
|
||||
|
||||
#
|
||||
# default_binutils_run
|
||||
# run a program, returning the output
|
||||
# sets binutils_run_failed if the program does not exist
|
||||
#
|
||||
proc default_binutils_run { prog progargs } {
|
||||
global binutils_run_failed
|
||||
|
||||
set binutils_run_failed 0
|
||||
|
||||
if {[which $prog] == 0} then {
|
||||
perror "$prog does not exist"
|
||||
set binutils_run_failed 1
|
||||
return ""
|
||||
}
|
||||
|
||||
send_log "$prog $progargs\n"
|
||||
verbose "$prog $progargs"
|
||||
|
||||
# This used to be
|
||||
# catch "exec $prog $progargs" exec_output
|
||||
# but that would evaluate $progargs twice, which would fail if
|
||||
# any arguments started with `$'. This is a dismal hack to avoid
|
||||
# this problem. I tried using
|
||||
# catch { exec $prog $progargs } exec_output
|
||||
# but that failed because $progargs was not split into words by
|
||||
# exec. I don't know if this operation can be done correctly. No
|
||||
# matter how hard I try, I can not convince myself that TCL is a
|
||||
# language.
|
||||
regsub -all "\\$" $progargs "\\$" progq
|
||||
catch "exec $prog $progq" exec_output
|
||||
if {![string match "" $exec_output]} then {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output"
|
||||
}
|
||||
return $exec_output
|
||||
}
|
||||
|
||||
#
|
||||
# default_binutils_assemble
|
||||
# assemble a file
|
||||
#
|
||||
proc default_binutils_assemble { as source object } {
|
||||
global ASFLAGS
|
||||
global srcdir
|
||||
|
||||
if {[which $as] == 0} then {
|
||||
perror "$as does not exist"
|
||||
return 0
|
||||
}
|
||||
|
||||
if ![info exists ASFLAGS] { set ASFLAGS "" }
|
||||
|
||||
# The HPPA assembler syntax is a little different than most, to make
|
||||
# the test source file assemble we need to run it through sed.
|
||||
#
|
||||
# This is a hack in that it won't scale well if other targets need
|
||||
# similar transformations to assemble. We'll generalize the hack
|
||||
# if/when other targets need similar handling.
|
||||
if [istarget "hppa*-*-*" ] then {
|
||||
send_log "sed -f $srcdir/config/hppa.sed < $source | $as $ASFLAGS -o $object\n"
|
||||
verbose "sed -f $srcdir/config/hppa.sed < $source | $as $ASFLAGS -o $object"
|
||||
catch "exec sed -f $srcdir/config/hppa.sed < $source | $as $ASFLAGS -o $object" exec_output
|
||||
} else {
|
||||
send_log "$as $ASFLAGS -o $object $source\n"
|
||||
verbose "$as $ASFLAGS -o $object $source"
|
||||
catch "exec $as $ASFLAGS -o $object $source" exec_output
|
||||
}
|
||||
|
||||
if [string match "" $exec_output] then {
|
||||
return 1
|
||||
} else {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output"
|
||||
perror "$source: assembly failed"
|
||||
return 0
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef BFDLINK_H
|
||||
#define BFDLINK_H
|
||||
|
|
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
struct a29k_opcode {
|
||||
/* Name of the instruction. */
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
srcdir = .
|
||||
|
@ -196,7 +196,7 @@ LIBIBERTY = ../libiberty/libiberty.a
|
|||
|
||||
ALL_EMULATIONS = ea29k.o ealpha.o earmaoutl.o earmoutb.o \
|
||||
ecoff_sparc.o eebmon29k.o \
|
||||
eelf32_sparc.o eelf32bmip.o eelf32lmip.o eelf32ppc.o eelf32ppcle.o \
|
||||
eelf32_sparc.o eelf32bmip.o eelf32lmip.o eelf32ppc.o eelf32lppc.o \
|
||||
eelf64_sparc.o eelf_i386.o egld960.o ego32.o eh8300.o \
|
||||
eh8300h.o eh8500.o eh8500b.o eh8500c.o eh8500m.o eh8500s.o \
|
||||
ehp300bsd.o ehp3hpux.o ehppaelf.o ei386aout.o ei386bsd.o \
|
||||
|
@ -319,6 +319,12 @@ ei386go32.c: $(srcdir)/emulparams/i386go32.sh \
|
|||
ei386mach.c: $(srcdir)/emulparams/i386mach.sh \
|
||||
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
|
||||
${GENSCRIPTS} i386mach
|
||||
ei386moss.c: $(srcdir)/emulparams/i386moss.sh \
|
||||
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
|
||||
${GENSCRIPTS} i386moss
|
||||
ei386msdos.c: $(srcdir)/emulparams/i386msdos.sh \
|
||||
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/i386msdos.sc ${GEN_DEPENDS}
|
||||
${GENSCRIPTS} i386msdos
|
||||
eebmon29k.c: $(srcdir)/emulparams/ebmon29k.sh \
|
||||
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/ebmon29k.sc ${GEN_DEPENDS}
|
||||
${GENSCRIPTS} ebmon29k
|
||||
|
@ -427,9 +433,9 @@ esparclynx.c: $(srcdir)/emulparams/sparclynx.sh \
|
|||
eelf32ppc.c: $(srcdir)/emulparams/elf32ppc.sh \
|
||||
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
|
||||
${GENSCRIPTS} elf32ppc
|
||||
eelf32ppcle.c: $(srcdir)/emulparams/elf32ppcle.sh \
|
||||
eelf32lppc.c: $(srcdir)/emulparams/elf32lppc.sh \
|
||||
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
|
||||
${GENSCRIPTS} elf32ppcle
|
||||
${GENSCRIPTS} elf32lppc
|
||||
eriscix.c: $(srcdir)/emulparams/riscix.sh \
|
||||
$(srcdir)/emultempl/generic.em $(srcdir)/scripttempl/aout.sc ${GEN_DEPENDS}
|
||||
${GENSCRIPTS} riscix
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GLD; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Look in this environment name for the linker to pretend to be */
|
||||
#define EMULATION_ENVIRON "LDEMULATION"
|
||||
|
|
|
@ -31,7 +31,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_IS_armpe
|
||||
|
||||
|
@ -227,4 +227,4 @@ struct ld_emulation_xfer_struct ld_armpe_emulation =
|
|||
"armpe",
|
||||
"pei-arm"
|
||||
};
|
||||
EOF
|
||||
EOF
|
||||
|
|
|
@ -22,7 +22,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_IS_${EMULATION_NAME}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_IS_i386pe
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_IS_${EMULATION_NAME}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_IS_${EMULATION_NAME}
|
||||
|
||||
|
@ -100,6 +100,7 @@ gld${EMULATION_NAME}_find_so (inp)
|
|||
char *alc;
|
||||
int max_maj, max_min;
|
||||
char *found;
|
||||
boolean found_static;
|
||||
struct stat st;
|
||||
|
||||
if (! inp->search_dirs_flag
|
||||
|
@ -115,6 +116,7 @@ gld${EMULATION_NAME}_find_so (inp)
|
|||
len = strlen (filename);
|
||||
else
|
||||
{
|
||||
force_maj = atoi (dot + 1);
|
||||
len = dot - filename;
|
||||
alc = (char *) alloca (len + 1);
|
||||
strncpy (alc, filename, len);
|
||||
|
@ -123,6 +125,7 @@ gld${EMULATION_NAME}_find_so (inp)
|
|||
}
|
||||
|
||||
found = NULL;
|
||||
found_static = false;
|
||||
max_maj = max_min = 0;
|
||||
for (search = search_head; search != NULL; search = search->next)
|
||||
{
|
||||
|
@ -138,8 +141,17 @@ gld${EMULATION_NAME}_find_so (inp)
|
|||
int found_maj, found_min;
|
||||
|
||||
if (strncmp (entry->d_name, "lib", 3) != 0
|
||||
|| strncmp (entry->d_name + 3, inp->filename, len) != 0
|
||||
|| strncmp (entry->d_name + 3 + len, ".so", 3) != 0)
|
||||
|| strncmp (entry->d_name + 3, inp->filename, len) != 0)
|
||||
continue;
|
||||
|
||||
if (dot == NULL
|
||||
&& strncmp (entry->d_name + 3 + len, ".a", 2) == 0)
|
||||
{
|
||||
found_static = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strncmp (entry->d_name + 3 + len, ".so", 3) != 0)
|
||||
continue;
|
||||
|
||||
/* We've found a .so file. Work out the major and minor
|
||||
|
@ -176,7 +188,7 @@ gld${EMULATION_NAME}_find_so (inp)
|
|||
|
||||
closedir (dir);
|
||||
|
||||
if (found != NULL)
|
||||
if (found != NULL || found_static)
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -359,7 +371,7 @@ gld${EMULATION_NAME}_before_allocation ()
|
|||
if (sdyn != NULL)
|
||||
h->u.def.section = sdyn;
|
||||
else
|
||||
h->u.def.section = &bfd_abs_section;
|
||||
h->u.def.section = bfd_abs_section_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -555,6 +567,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
|||
syslib_default,
|
||||
hll_default,
|
||||
after_parse_default,
|
||||
after_open_default,
|
||||
after_allocation_default,
|
||||
set_output_arch_default,
|
||||
ldemul_default_target,
|
||||
|
@ -562,7 +575,8 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
|||
gld${EMULATION_NAME}_get_script,
|
||||
"${EMULATION_NAME}",
|
||||
"${OUTPUT_FORMAT}",
|
||||
0, /* finish */
|
||||
gld${EMULATION_NAME}_create_output_section_statements
|
||||
NULL, /* finish */
|
||||
gld${EMULATION_NAME}_create_output_section_statements,
|
||||
NULL /* open_dynamic_library */
|
||||
};
|
||||
EOF
|
||||
|
|
16
ld/ld.h
16
ld/ld.h
|
@ -16,7 +16,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GLD; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef LD_H
|
||||
#define LD_H
|
||||
|
@ -58,6 +58,17 @@ typedef struct
|
|||
|
||||
/* Runtime library search path from the -rpath argument. */
|
||||
char *rpath;
|
||||
|
||||
/* Big or little endian as set on command line. */
|
||||
enum { ENDIAN_UNSET = 0, ENDIAN_BIG, ENDIAN_LITTLE } endian;
|
||||
|
||||
/* If true, export all symbols in the dynamic symbol table of an ELF
|
||||
executable. */
|
||||
boolean export_dynamic;
|
||||
|
||||
/* If true, build MIPS embedded PIC relocation tables in the output
|
||||
file. */
|
||||
boolean embedded_relocs;
|
||||
} args_type;
|
||||
|
||||
extern args_type command_line;
|
||||
|
@ -92,6 +103,9 @@ typedef struct
|
|||
FILE *map_file;
|
||||
|
||||
boolean stats;
|
||||
|
||||
int split_by_reloc;
|
||||
boolean split_by_file;
|
||||
} ld_config_type;
|
||||
|
||||
extern ld_config_type config;
|
||||
|
|
188
ld/ldfile.c
188
ld/ldfile.c
|
@ -14,7 +14,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GLD; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/*
|
||||
ldfile.c
|
||||
|
@ -33,29 +33,27 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "ldmain.h"
|
||||
#include "ldgram.h"
|
||||
#include "ldlex.h"
|
||||
#include "ldemul.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
char *ldfile_input_filename;
|
||||
const char *ldfile_input_filename;
|
||||
boolean ldfile_assumed_script = false;
|
||||
const char *ldfile_output_machine_name = "";
|
||||
unsigned long ldfile_output_machine;
|
||||
enum bfd_architecture ldfile_output_architecture;
|
||||
search_dirs_type *search_head;
|
||||
|
||||
/* start-sanitize-mpw */
|
||||
#ifndef MPW
|
||||
/* end-sanitize-mpw */
|
||||
#ifdef VMS
|
||||
char *slash = "";
|
||||
#else
|
||||
char *slash = "/";
|
||||
#endif
|
||||
/* start-sanitize-mpw */
|
||||
#else /* MPW */
|
||||
/* The MPW path char is a colon. */
|
||||
char *slash = ":";
|
||||
#endif /* MPW */
|
||||
/* end-sanitize-mpw */
|
||||
|
||||
/* LOCAL */
|
||||
|
||||
|
@ -70,11 +68,9 @@ typedef struct search_arch
|
|||
static search_arch_type *search_arch_head;
|
||||
static search_arch_type **search_arch_tail_ptr = &search_arch_head;
|
||||
|
||||
static bfd *cached_bfd_openr PARAMS ((const char *attempt,
|
||||
lang_input_statement_type *entry));
|
||||
static bfd *open_a PARAMS ((char *arch, lang_input_statement_type *entry,
|
||||
char *lib, char *suffix));
|
||||
static FILE *try_open PARAMS ((char *name, char *exten));
|
||||
static boolean try_open_bfd PARAMS ((const char *attempt,
|
||||
lang_input_statement_type *entry));
|
||||
static FILE *try_open PARAMS ((const char *name, const char *exten));
|
||||
|
||||
void
|
||||
ldfile_add_library_path (name, cmdline)
|
||||
|
@ -91,85 +87,93 @@ ldfile_add_library_path (name, cmdline)
|
|||
search_tail_ptr = &new->next;
|
||||
}
|
||||
|
||||
/* Try to open a BFD for a lang_input_statement. */
|
||||
|
||||
static bfd *
|
||||
cached_bfd_openr(attempt,entry)
|
||||
static boolean
|
||||
try_open_bfd (attempt, entry)
|
||||
const char *attempt;
|
||||
lang_input_statement_type *entry;
|
||||
lang_input_statement_type *entry;
|
||||
{
|
||||
entry->the_bfd = bfd_openr(attempt, entry->target);
|
||||
if (trace_file_tries == true ) {
|
||||
entry->the_bfd = bfd_openr (attempt, entry->target);
|
||||
|
||||
if (trace_file_tries)
|
||||
info_msg ("attempt to open %s %s\n", attempt,
|
||||
(entry->the_bfd == (bfd *)NULL) ? "failed" : "succeeded" );
|
||||
}
|
||||
return entry->the_bfd;
|
||||
entry->the_bfd == NULL ? "failed" : "succeeded");
|
||||
|
||||
if (entry->the_bfd != NULL)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static bfd *
|
||||
open_a(arch, entry, lib, suffix)
|
||||
char *arch;
|
||||
/* Search for and open the file specified by ENTRY. If it is an
|
||||
archive, use ARCH, LIB and SUFFIX to modify the file name. */
|
||||
|
||||
boolean
|
||||
ldfile_open_file_search (arch, entry, lib, suffix)
|
||||
const char *arch;
|
||||
lang_input_statement_type *entry;
|
||||
char *lib;
|
||||
char *suffix;
|
||||
const char *lib;
|
||||
const char *suffix;
|
||||
{
|
||||
bfd*desc;
|
||||
search_dirs_type *search ;
|
||||
search_dirs_type *search;
|
||||
|
||||
/* If this is not an archive, try to open it in the current
|
||||
directory first. */
|
||||
if (! entry->is_archive)
|
||||
{
|
||||
desc = cached_bfd_openr (entry->filename, entry);
|
||||
if (desc != NULL)
|
||||
return desc;
|
||||
if (try_open_bfd (entry->filename, entry))
|
||||
return true;
|
||||
}
|
||||
|
||||
for (search = search_head;
|
||||
search != (search_dirs_type *)NULL;
|
||||
search = search->next)
|
||||
{
|
||||
char buffer[1000];
|
||||
char *string;
|
||||
if (entry->is_archive == true) {
|
||||
sprintf(buffer,
|
||||
"%s%s%s%s%s%s",
|
||||
search->name,
|
||||
slash,
|
||||
lib,
|
||||
entry->filename, arch, suffix);
|
||||
}
|
||||
else {
|
||||
if (entry->filename[0] == '/' || entry->filename[0] == '.') {
|
||||
strcpy(buffer, entry->filename);
|
||||
} else {
|
||||
sprintf(buffer,"%s%s%s",search->name, slash, entry->filename);
|
||||
}
|
||||
}
|
||||
string = buystring(buffer);
|
||||
desc = cached_bfd_openr (string, entry);
|
||||
if (desc)
|
||||
|
||||
string = (char *) xmalloc (strlen (search->name)
|
||||
+ strlen (slash)
|
||||
+ strlen (lib)
|
||||
+ strlen (entry->filename)
|
||||
+ strlen (arch)
|
||||
+ strlen (suffix)
|
||||
+ 1);
|
||||
|
||||
if (entry->is_archive)
|
||||
sprintf (string, "%s%s%s%s%s%s", search->name, slash,
|
||||
lib, entry->filename, arch, suffix);
|
||||
else if (entry->filename[0] == '/' || entry->filename[0] == '.')
|
||||
strcpy (string, entry->filename);
|
||||
else
|
||||
sprintf (string, "%s%s%s", search->name, slash, entry->filename);
|
||||
|
||||
if (try_open_bfd (string, entry))
|
||||
{
|
||||
entry->filename = string;
|
||||
entry->the_bfd = desc;
|
||||
return desc;
|
||||
return true;
|
||||
}
|
||||
free(string);
|
||||
|
||||
free (string);
|
||||
}
|
||||
return (bfd *)NULL;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Open the input file specified by 'entry', and return a descriptor.
|
||||
The open file is remembered; if the same file is opened twice in a row,
|
||||
a new open is not actually done. */
|
||||
/* Open the input file specified by ENTRY. */
|
||||
|
||||
void
|
||||
ldfile_open_file (entry)
|
||||
lang_input_statement_type *entry;
|
||||
{
|
||||
ASSERT (entry->the_bfd == NULL);
|
||||
if (entry->the_bfd != NULL)
|
||||
return;
|
||||
|
||||
if (! entry->search_dirs_flag)
|
||||
entry->the_bfd = cached_bfd_openr (entry->filename, entry);
|
||||
{
|
||||
if (try_open_bfd (entry->filename, entry))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
search_arch_type *arch;
|
||||
|
@ -181,55 +185,58 @@ ldfile_open_file (entry)
|
|||
{
|
||||
if (config.dynamic_link)
|
||||
{
|
||||
/* FIXME: Perhaps we will sometimes want something other
|
||||
than .so. */
|
||||
if (open_a (arch->name, entry, "lib", ".so") != (bfd *) NULL)
|
||||
if (ldemul_open_dynamic_archive (arch->name, entry))
|
||||
return;
|
||||
}
|
||||
if (open_a (arch->name, entry, "lib", ".a") != (bfd *) NULL)
|
||||
if (ldfile_open_file_search (arch->name, entry, "lib", ".a"))
|
||||
return;
|
||||
#ifdef VMS
|
||||
if (open_a (arch->name, entry, ":lib", ".a") != (bfd *) NULL)
|
||||
if (ldfile_open_file_search (arch->name, entry, ":lib", ".a"))
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (entry->the_bfd == NULL)
|
||||
einfo("%F%P: cannot open %s: %E\n", entry->local_sym_name);
|
||||
einfo("%F%P: cannot open %s: %E\n", entry->local_sym_name);
|
||||
}
|
||||
|
||||
/* Try to open NAME; if that fails, try NAME with EXTEN appended to it. */
|
||||
|
||||
static FILE *
|
||||
try_open(name, exten)
|
||||
char *name;
|
||||
char *exten;
|
||||
try_open (name, exten)
|
||||
const char *name;
|
||||
const char *exten;
|
||||
{
|
||||
FILE *result;
|
||||
char buff[1000];
|
||||
|
||||
result = fopen(name, "r");
|
||||
if (trace_file_tries == true) {
|
||||
if (result == (FILE *)NULL) {
|
||||
info_msg ("cannot find ");
|
||||
result = fopen (name, "r");
|
||||
if (trace_file_tries)
|
||||
{
|
||||
if (result == NULL)
|
||||
info_msg ("cannot find script file ");
|
||||
else
|
||||
info_msg ("opened script file ");
|
||||
info_msg ("%s\n",name);
|
||||
}
|
||||
info_msg ("%s\n",name);
|
||||
}
|
||||
if (result != (FILE *)NULL) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (*exten) {
|
||||
sprintf(buff, "%s%s", name, exten);
|
||||
result = fopen(buff, "r");
|
||||
if (trace_file_tries == true) {
|
||||
if (result == (FILE *)NULL) {
|
||||
info_msg ("cannot find ");
|
||||
}
|
||||
info_msg ("%s\n", buff);
|
||||
if (result != NULL)
|
||||
return result;
|
||||
|
||||
if (*exten)
|
||||
{
|
||||
sprintf (buff, "%s%s", name, exten);
|
||||
result = fopen (buff, "r");
|
||||
if (trace_file_tries)
|
||||
{
|
||||
if (result == NULL)
|
||||
info_msg ("cannot find script file ");
|
||||
else
|
||||
info_msg ("opened script file ");
|
||||
info_msg ("%s\n", buff);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -237,9 +244,9 @@ try_open(name, exten)
|
|||
specified with -L, without and with EXTEND apppended. */
|
||||
|
||||
FILE *
|
||||
ldfile_find_command_file(name, extend)
|
||||
char *name;
|
||||
char *extend;
|
||||
ldfile_find_command_file (name, extend)
|
||||
const char *name;
|
||||
const char *extend;
|
||||
{
|
||||
search_dirs_type *search;
|
||||
FILE *result;
|
||||
|
@ -261,8 +268,8 @@ char *extend;
|
|||
}
|
||||
|
||||
void
|
||||
ldfile_open_command_file(name)
|
||||
char *name;
|
||||
ldfile_open_command_file (name)
|
||||
const char *name;
|
||||
{
|
||||
FILE *ldlex_input_stack;
|
||||
ldlex_input_stack = ldfile_find_command_file(name, "");
|
||||
|
@ -274,6 +281,7 @@ char *name;
|
|||
lex_push_file(ldlex_input_stack, name);
|
||||
|
||||
ldfile_input_filename = name;
|
||||
lineno = 1;
|
||||
had_script = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GLD; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
@ -1872,6 +1872,7 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax)
|
|||
}
|
||||
dot += size;
|
||||
output_section_statement->bfd_section->_raw_size += size;
|
||||
output_section_statement->bfd_section->flags |= SEC_HAS_CONTENTS;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2781,7 +2782,7 @@ lang_add_entry (name, cmdline)
|
|||
entry_symbol = name;
|
||||
from_cmdline = cmdline;
|
||||
}
|
||||
#ifdef 0 /* WINDOWS_NT */
|
||||
#if 0
|
||||
/* don't do this yet. It seems to work (the executables run), but the
|
||||
image created is very different from what I was getting before indicating
|
||||
that something else is being pulled in. When everything else is working,
|
||||
|
|
39
ld/ldlang.h
39
ld/ldlang.h
|
@ -1,5 +1,5 @@
|
|||
/* ldlang.h - linker command language support
|
||||
Copyright 1991, 1992, 1993 Free Software Foundation, Inc.
|
||||
Copyright 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GLD, the Gnu Linker.
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GLD; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef LDLANG_H
|
||||
#define LDLANG_H
|
||||
|
@ -68,7 +68,8 @@ typedef struct lang_statement_header_struct
|
|||
lang_target_statement_enum,
|
||||
lang_output_statement_enum,
|
||||
lang_padding_statement_enum,
|
||||
|
||||
lang_group_statement_enum,
|
||||
|
||||
lang_afile_asection_pair_statement_enum,
|
||||
lang_constructors_statement_enum
|
||||
} type;
|
||||
|
@ -159,7 +160,7 @@ typedef struct
|
|||
bfd_reloc_code_real_type reloc;
|
||||
|
||||
/* Reloc howto structure. */
|
||||
const reloc_howto_type *howto;
|
||||
reloc_howto_type *howto;
|
||||
|
||||
/* Section to generate reloc against. Exactly one of section and
|
||||
name must be NULL. */
|
||||
|
@ -270,6 +271,17 @@ typedef struct
|
|||
fill_type fill;
|
||||
} lang_padding_statement_type;
|
||||
|
||||
/* A group statement collects a set of libraries together. The
|
||||
libraries are searched multiple times, until no new undefined
|
||||
symbols are found. The effect is to search a group of libraries as
|
||||
though they were a single library. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
lang_statement_header_type header;
|
||||
lang_statement_list_type children;
|
||||
} lang_group_statement_type;
|
||||
|
||||
typedef union lang_statement_union
|
||||
{
|
||||
lang_statement_header_type header;
|
||||
|
@ -289,6 +301,7 @@ typedef union lang_statement_union
|
|||
lang_object_symbols_statement_type object_symbols_statement;
|
||||
lang_fill_statement_type fill_statement;
|
||||
lang_padding_statement_type padding_statement;
|
||||
lang_group_statement_type group_statement;
|
||||
} lang_statement_union_type;
|
||||
|
||||
extern lang_output_section_statement_type *abs_output_section;
|
||||
|
@ -331,8 +344,15 @@ extern void lang_abs_symbol_at_beginning_of PARAMS ((const char *,
|
|||
extern void lang_statement_append PARAMS ((struct statement_list *,
|
||||
union lang_statement_union *,
|
||||
union lang_statement_union **));
|
||||
extern void lang_for_each_input_file
|
||||
PARAMS ((void (*dothis) (lang_input_statement_type *)));
|
||||
extern void lang_for_each_file
|
||||
PARAMS ((void (*dothis) (lang_input_statement_type *)));
|
||||
extern bfd_vma lang_do_assignments
|
||||
PARAMS ((lang_statement_union_type * s,
|
||||
lang_output_section_statement_type *output_section_statement,
|
||||
fill_type fill,
|
||||
bfd_vma dot));
|
||||
|
||||
#define LANG_FOR_EACH_INPUT_STATEMENT(statement) \
|
||||
extern lang_statement_list_type file_chain; \
|
||||
|
@ -352,11 +372,12 @@ extern void lang_add_keepsyms_file PARAMS ((const char *filename));
|
|||
extern lang_output_section_statement_type *
|
||||
lang_output_section_statement_lookup PARAMS ((const char * const name));
|
||||
extern void ldlang_add_undef PARAMS ((const char *const name));
|
||||
extern void lang_add_output_format PARAMS ((const char *, int from_script));
|
||||
extern void lang_add_output_format PARAMS ((const char *, const char *,
|
||||
const char *, int from_script));
|
||||
extern void lang_list_init PARAMS ((lang_statement_list_type*));
|
||||
extern void lang_add_data PARAMS ((int type, union etree_union *));
|
||||
extern void lang_add_reloc
|
||||
PARAMS ((bfd_reloc_code_real_type reloc, const reloc_howto_type *howto,
|
||||
PARAMS ((bfd_reloc_code_real_type reloc, reloc_howto_type *howto,
|
||||
asection *section, const char *name, union etree_union *addend));
|
||||
extern void lang_for_each_statement
|
||||
PARAMS ((void (*func) (lang_statement_union_type *)));
|
||||
|
@ -366,5 +387,11 @@ extern bfd_vma lang_size_sections
|
|||
lang_output_section_statement_type *output_section_statement,
|
||||
lang_statement_union_type **prev, fill_type fill,
|
||||
bfd_vma dot, boolean relax));
|
||||
extern void lang_enter_group PARAMS ((void));
|
||||
extern void lang_leave_group PARAMS ((void));
|
||||
extern void wild_doit
|
||||
PARAMS ((lang_statement_list_type *ptr, asection *section,
|
||||
lang_output_section_statement_type *output,
|
||||
lang_input_statement_type *file));
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GLD; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
#include "bfd.h"
|
||||
|
|
|
@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GLD; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
|
|
@ -18,7 +18,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_IS_mipsidt
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define TARGET_IS_sh
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ o = :
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
# srcdir = :
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#
|
||||
# Written by Jeffrey Wheat (cassidy@cygnus.com)
|
||||
#
|
||||
|
@ -30,6 +30,10 @@ if ![info exists nm] then {
|
|||
set nm [findfile $base_dir/../binutils/nm.new $base_dir/../binutils/nm.new [transform nm]]
|
||||
}
|
||||
|
||||
if ![info exists objdump] then {
|
||||
set objdump [findfile $base_dir/../binutils/objdump]
|
||||
}
|
||||
|
||||
if ![file isdirectory tmpdir] {catch "exec mkdir tmpdir" status}
|
||||
|
||||
# load the utility procedures
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
# Expect script for LD Bootstrap Tests
|
||||
# Copyright (C) 1993,1994,1995 Free Software Foundation
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#
|
||||
# Written by Jeffrey Wheat (cassidy@cygnus.com)
|
||||
# Rewritten by Ian Lance Taylor (ian@cygnus.com)
|
||||
#
|
||||
|
||||
# Make sure that ld can bootstrap itself.
|
||||
|
||||
# This test can only be run if ld generates native executables.
|
||||
if ![isnative] {
|
||||
return
|
||||
}
|
||||
|
||||
# Bootstrap ld. First link the object files together using -r, in
|
||||
# order to test -r. Then link the result into an executable, ld1, to
|
||||
# really test -r. Use ld1 to link a fresh ld, ld2. Use ld2 to link a
|
||||
# new ld, ld3. ld2 and ld3 should be identical.
|
||||
|
||||
foreach flags {"" "--static" "--traditional-format" "--no-keep-memory"} {
|
||||
if {"$flags" != ""} {
|
||||
set testname "bootstrap with $flags"
|
||||
} else {
|
||||
set testname "bootstrap"
|
||||
}
|
||||
|
||||
# This test can only be run if we have the ld build directory,
|
||||
# since we need the object files.
|
||||
if {$ld != "$objdir/ld.new"} {
|
||||
untested $testname
|
||||
continue
|
||||
}
|
||||
|
||||
if ![ld_relocate $ld tmpdir/ld-partial.o "$flags $OFILES"] {
|
||||
fail $testname
|
||||
continue
|
||||
}
|
||||
|
||||
if ![ld_link $ld tmpdir/ld1 "$flags tmpdir/ld-partial.o $BFDLIB $LIBIBERTY"] {
|
||||
fail $testname
|
||||
continue
|
||||
}
|
||||
|
||||
if ![ld_link tmpdir/ld1 tmpdir/ld2 "$flags $OFILES $BFDLIB $LIBIBERTY"] {
|
||||
fail $testname
|
||||
continue
|
||||
}
|
||||
|
||||
if ![ld_link tmpdir/ld2 tmpdir/ld3 "$flags $OFILES $BFDLIB $LIBIBERTY"] {
|
||||
fail $testname
|
||||
continue
|
||||
}
|
||||
|
||||
send_log "cmp tmpdir/ld2 tmpdir/ld3\n"
|
||||
verbose "cmp tmpdir/ld2 tmpdir/ld3"
|
||||
catch "exec cmp tmpdir/ld2 tmpdir/ld3" exec_output
|
||||
set exec_output [prune_system_crud $host_triplet $exec_output]
|
||||
|
||||
if [string match "" $exec_output] then {
|
||||
pass $testname
|
||||
} else {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output" 1
|
||||
|
||||
fail $testname
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
# Expect script for LD cdtest Tests
|
||||
# Copyright (C) 1993,1994,1995 Free Software Foundation
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#
|
||||
# Written by Jeffrey Wheat (cassidy@cygnus.com)
|
||||
# Rewritten by Ian Lance Taylor (ian@cygnus.com)
|
||||
#
|
||||
|
||||
# Make sure that constructors are handled correctly.
|
||||
|
||||
set test1 "cdtest"
|
||||
set test2 "cdtest with -Ur"
|
||||
|
||||
# This test requires running the executable generated by ld.
|
||||
if ![isnative] {
|
||||
return
|
||||
}
|
||||
|
||||
if { ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
|
||||
|| ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
|
||||
|| ![ld_compile "$CXX $CXXFLAGS -fgnu-linker" $srcdir$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
|
||||
unresolved $test1
|
||||
unresolved $test2
|
||||
return
|
||||
}
|
||||
|
||||
if ![ld_link $ld tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] {
|
||||
fail $test1
|
||||
} else {
|
||||
send_log "tmpdir/cdtest >tmpdir/cdtest.out\n"
|
||||
verbose "tmpdir/cdtest >tmpdir/cdtest.out"
|
||||
catch "exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output
|
||||
if ![string match "" $exec_output] then {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output" 1
|
||||
fail $test1
|
||||
} else {
|
||||
send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n"
|
||||
verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat"
|
||||
catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output
|
||||
set exec_output [prune_system_crud $host_triplet $exec_output]
|
||||
|
||||
if [string match "" $exec_output] then {
|
||||
pass $test1
|
||||
} else {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output" 1
|
||||
fail $test1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] {
|
||||
fail $test2
|
||||
} else {
|
||||
if ![ld_link $ld tmpdir/cdtest tmpdir/cdtest.o] {
|
||||
fail $test2
|
||||
} else {
|
||||
send_log "tmpdir/cdtest >tmpdir/cdtest.out\n"
|
||||
verbose "tmpdir/cdtest >tmpdir/cdtest.out"
|
||||
catch "exec tmpdir/cdtest >tmpdir/cdtest.out" exec_output
|
||||
if ![string match "" $exec_output] then {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output" 1
|
||||
fail $test2
|
||||
} else {
|
||||
send_log "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat\n"
|
||||
verbose "diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat"
|
||||
catch "exec diff tmpdir/cdtest.out $srcdir$subdir/cdtest.dat" exec_output
|
||||
set exec_output [prune_system_crud $host_triplet $exec_output]
|
||||
|
||||
if [string match "" $exec_output] then {
|
||||
pass $test2
|
||||
} else {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output" 1
|
||||
fail $test2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#
|
||||
# Written by Ian Lance Taylor (ian@cygnus.com)
|
||||
#
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Expect script for ld-shared tests
|
||||
# Copyright (C) 1994 Free Software Foundation
|
||||
# Copyright (C) 1994,1995 Free Software Foundation
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -13,7 +13,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#
|
||||
# Written by Ian Lance Taylor (ian@cygnus.com)
|
||||
#
|
||||
|
@ -41,57 +41,55 @@ if { ![istarget i386-*-sysv4*] \
|
|||
return
|
||||
}
|
||||
|
||||
# Compile the main program.
|
||||
if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/main.c tmpdir/main.o] {
|
||||
return
|
||||
}
|
||||
# The test procedure.
|
||||
proc shared_test { progname testname main sh1 sh2 } {
|
||||
global ld
|
||||
global srcdir
|
||||
global subdir
|
||||
global exec_output
|
||||
global host_triplet
|
||||
|
||||
# The shared library is composed of two files. First compile them
|
||||
# without using -fpic. That should work on an ELF system, although it
|
||||
# will be less efficient because the dynamic linker will need to do
|
||||
# more relocation work. However, note that not using -fpic will cause
|
||||
# some of the tests to return different results.
|
||||
if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh1.c tmpdir/sh1.o] {
|
||||
return
|
||||
}
|
||||
if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh2.c tmpdir/sh2.o] {
|
||||
return
|
||||
}
|
||||
|
||||
# Build the shared library.
|
||||
if ![ld_simple_link $ld tmpdir/shnonpic.so {-shared tmpdir/sh1.o tmpdir/sh2.o}] {
|
||||
fail "shared (non PIC)"
|
||||
} else {
|
||||
# Link against the shared library. Use -rpath so that the dynamic
|
||||
# linker can locate the shared library at runtime.
|
||||
if ![ld_link $ld tmpdir/shnonpic {-rpath tmpdir tmpdir/main.o tmpdir/shnonpic.so}] {
|
||||
fail "shared (non PIC)"
|
||||
} else {
|
||||
# Run the resulting program
|
||||
send_log "tmpdir/shnonpic >tmpdir/shnonpic.out\n"
|
||||
verbose "tmpdir/shnonpic >tmpdir/shnonpic.out"
|
||||
catch "exec tmpdir/shnonpic >tmpdir/shnonpic.out" exec_output
|
||||
if ![string match "" $exec_output] then {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output"
|
||||
fail "shared (non PIC)"
|
||||
} else {
|
||||
send_log "diff tmpdir/shnonpic.out $srcdir$subdir/shared.dat\n"
|
||||
verbose "diff tmpdir/shnonpic.out $srcdir$subdir/shared.dat"
|
||||
catch "exec diff tmpdir/shnonpic.out $srcdir$subdir/shared.dat" exec_output
|
||||
if [string match "" $exec_output] then {
|
||||
pass "shared (non PIC)"
|
||||
} else {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output"
|
||||
fail "shared (non PIC)"
|
||||
}
|
||||
}
|
||||
# Build the shared library.
|
||||
if {![ld_simple_link $ld tmpdir/$progname.so "-shared tmpdir/$sh1 tmpdir/$sh2"]} {
|
||||
fail "$testname"
|
||||
return
|
||||
}
|
||||
|
||||
# Link against the shared library. Use -rpath so that the
|
||||
# dynamic linker can locate the shared library at runtime.
|
||||
if ![ld_link $ld tmpdir/$progname "-rpath tmpdir tmpdir/$main tmpdir/$progname.so"] {
|
||||
fail "$testname"
|
||||
return
|
||||
}
|
||||
|
||||
# Run the resulting program
|
||||
send_log "tmpdir/$progname >tmpdir/$progname.out\n"
|
||||
verbose "tmpdir/$progname >tmpdir/$progname.out"
|
||||
catch "exec tmpdir/$progname >tmpdir/$progname.out" exec_output
|
||||
if ![string match "" $exec_output] then {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output"
|
||||
fail "$testname"
|
||||
return
|
||||
}
|
||||
|
||||
send_log "diff tmpdir/$progname.out $srcdir$subdir/shared.dat\n"
|
||||
verbose "diff tmpdir/$progname.out $srcdir$subdir/shared.dat"
|
||||
catch "exec diff tmpdir/$progname.out $srcdir$subdir/shared.dat" exec_output
|
||||
set exec_output [prune_system_crud $host_triplet $exec_output]
|
||||
|
||||
if {![string match "" $exec_output]} then {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output"
|
||||
fail "$testname"
|
||||
return
|
||||
}
|
||||
|
||||
pass "$testname"
|
||||
}
|
||||
|
||||
# Now compile the code using -fpic. Unfortunately, the gcc argument
|
||||
# is -fpic and the cc argument is -KPIC. We have to try both.
|
||||
# Unfortunately, the gcc argument is -fpic and the cc argument is
|
||||
# -KPIC. We have to try both.
|
||||
|
||||
set picflag "-fpic"
|
||||
send_log "$CC $picflag\n"
|
||||
|
@ -106,41 +104,48 @@ if { [string match "*illegal option*" $exec_output] \
|
|||
}
|
||||
verbose "Using $picflag to compile PIC code"
|
||||
|
||||
if ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh1.c tmpdir/sh1.o] {
|
||||
return
|
||||
}
|
||||
if ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh2.c tmpdir/sh2.o] {
|
||||
return
|
||||
}
|
||||
|
||||
# Build the shared library.
|
||||
if ![ld_simple_link $ld tmpdir/shpic.so {-shared tmpdir/sh1.o tmpdir/sh2.o}] {
|
||||
fail "shared"
|
||||
# Compile the main program.
|
||||
if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/main.c tmpdir/mainnp.o] {
|
||||
unresolved "shared (non PIC)"
|
||||
unresolved "shared"
|
||||
} else {
|
||||
# Link against the shared library. Use -rpath so that the dynamic
|
||||
# linker can locate the shared library at runtime.
|
||||
if ![ld_link $ld tmpdir/shpic {-rpath tmpdir tmpdir/main.o tmpdir/shpic.so}] {
|
||||
fail "shared"
|
||||
# The shared library is composed of two files. First compile them
|
||||
# without using -fpic. That should work on an ELF system,
|
||||
# although it will be less efficient because the dynamic linker
|
||||
# will need to do more relocation work. However, note that not
|
||||
# using -fpic will cause some of the tests to return different
|
||||
# results.
|
||||
if { ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh1.c tmpdir/sh1np.o]
|
||||
|| ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh2.c tmpdir/sh2np.o] } {
|
||||
unresolved "shared (non PIC)"
|
||||
} else {
|
||||
# Run the resulting program
|
||||
send_log "tmpdir/shpic >tmpdir/shpic.out\n"
|
||||
verbose "tmpdir/shpic >tmpdir/shpic.out"
|
||||
catch "exec tmpdir/shpic >tmpdir/shpic.out" exec_output
|
||||
if ![string match "" $exec_output] then {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output"
|
||||
fail "shared"
|
||||
} else {
|
||||
send_log "diff tmpdir/shpic.out $srcdir$subdir/shared.dat\n"
|
||||
verbose "diff tmpdir/shpic.out $srcdir$subdir/shared.dat"
|
||||
catch "exec diff tmpdir/shpic.out $srcdir$subdir/shared.dat" exec_output
|
||||
if [string match "" $exec_output] then {
|
||||
pass "shared"
|
||||
} else {
|
||||
send_log "$exec_output\n"
|
||||
verbose "$exec_output"
|
||||
fail "shared"
|
||||
}
|
||||
}
|
||||
shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o
|
||||
}
|
||||
|
||||
# Now compile the code using -fpic.
|
||||
|
||||
if { ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh1.c tmpdir/sh1p.o]
|
||||
|| ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh2.c tmpdir/sh2p.o] } {
|
||||
unresolved "shared"
|
||||
} else {
|
||||
shared_test shp "shared" mainnp.o sh1p.o sh2p.o
|
||||
}
|
||||
}
|
||||
|
||||
# Now do the same tests again, but this time compile main.c PIC.
|
||||
if ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/main.c tmpdir/mainp.o] {
|
||||
unresolved "shared (PIC main, non PIC so)"
|
||||
unresolved "shared (PIC main)"
|
||||
} else {
|
||||
if { [file exists tmpdir/sh1np.o ] && [ file exists tmpdir/sh2np.o ] } {
|
||||
shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o
|
||||
} else {
|
||||
unresolved "shared (PIC main, non PIC so)"
|
||||
}
|
||||
|
||||
if { [file exists tmpdir/sh1p.o ] && [ file exists tmpdir/sh2p.o ] } {
|
||||
shared_test shmpp "shared (PIC main)" mainp.o sh1p.o sh2p.o
|
||||
} else {
|
||||
unresolved "shared (PIC main)"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#
|
||||
# Written by Steve Chamberlain (sac@cygnus.com)
|
||||
#
|
||||
|
|
|
@ -16,7 +16,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "dis-asm.h"
|
||||
#include "opcode/a29k.h"
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* Contributed by sac@cygnus.com. */
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
|
||||
struct arm_opcode {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
s = "{srcdir}"
|
||||
o = :
|
||||
|
|
|
@ -13,7 +13,7 @@ GNU General Public License for more details.
|
|||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#define STATIC_TABLE
|
||||
|
|
Loading…
Reference in New Issue