Import current binutils

This commit is contained in:
christos 2016-10-26 17:02:27 +00:00
parent 97f7037690
commit 8450a7c426
3850 changed files with 854942 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
/* BFD COFF interfaces used outside of BFD.
Copyright (C) 1990-2015 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#include "coff/internal.h"
#include "libcoff.h"
/* Return the COFF syment for a symbol. */
bfd_boolean
bfd_coff_get_syment (bfd *abfd,
asymbol *symbol,
struct internal_syment *psyment)
{
coff_symbol_type *csym;
csym = coff_symbol_from (symbol);
if (csym == NULL || csym->native == NULL
|| ! csym->native->is_sym)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
}
*psyment = csym->native->u.syment;
if (csym->native->fix_value)
psyment->n_value = psyment->n_value -
(bfd_hostptr_t) obj_raw_syments (abfd);
/* FIXME: We should handle fix_line here. */
return TRUE;
}
/* Return the COFF auxent for a symbol. */
bfd_boolean
bfd_coff_get_auxent (bfd *abfd,
asymbol *symbol,
int indx,
union internal_auxent *pauxent)
{
coff_symbol_type *csym;
combined_entry_type *ent;
csym = coff_symbol_from (symbol);
if (csym == NULL
|| csym->native == NULL
|| ! csym->native->is_sym
|| indx >= csym->native->u.syment.n_numaux)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
}
ent = csym->native + indx + 1;
BFD_ASSERT (! ent->is_sym);
*pauxent = ent->u.auxent;
if (ent->fix_tag)
pauxent->x_sym.x_tagndx.l =
((combined_entry_type *) pauxent->x_sym.x_tagndx.p
- obj_raw_syments (abfd));
if (ent->fix_end)
pauxent->x_sym.x_fcnary.x_fcn.x_endndx.l =
((combined_entry_type *) pauxent->x_sym.x_fcnary.x_fcn.x_endndx.p
- obj_raw_syments (abfd));
if (ent->fix_scnlen)
pauxent->x_csect.x_scnlen.l =
((combined_entry_type *) pauxent->x_csect.x_scnlen.p
- obj_raw_syments (abfd));
return TRUE;
}

View File

@ -0,0 +1,86 @@
/* BFD COFF interfaces used outside of BFD.
Copyright (C) 1990-2015 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
/* This structure is used for a comdat section, as in PE. A comdat
section is associated with a particular symbol. When the linker
sees a comdat section, it keeps only one of the sections with a
given name and associated with a given symbol. */
struct coff_comdat_info
{
/* The name of the symbol associated with a comdat section. */
const char *name;
/* The local symbol table index of the symbol associated with a
comdat section. This is only meaningful to the object file format
specific code; it is not an index into the list returned by
bfd_canonicalize_symtab. */
long symbol;
};
/* The used_by_bfd field of a section may be set to a pointer to this
structure. */
struct coff_section_tdata
{
/* The relocs, swapped into COFF internal form. This may be NULL. */
struct internal_reloc *relocs;
/* If this is TRUE, the relocs entry may not be freed. */
bfd_boolean keep_relocs;
/* The section contents. This may be NULL. */
bfd_byte *contents;
/* If this is TRUE, the contents entry may not be freed. */
bfd_boolean keep_contents;
/* Information cached by coff_find_nearest_line. */
bfd_vma offset;
unsigned int i;
const char *function;
/* Optional information about a COMDAT entry; NULL if not COMDAT. */
struct coff_comdat_info *comdat;
int line_base;
/* A pointer used for .stab linking optimizations. */
void * stab_info;
/* Available for individual backends. */
void * tdata;
};
/* An accessor macro for the coff_section_tdata structure. */
#define coff_section_data(abfd, sec) \
((struct coff_section_tdata *) (sec)->used_by_bfd)
#define bfd_coff_get_comdat_section(abfd, sec) \
((bfd_get_flavour (abfd) == bfd_target_coff_flavour \
&& coff_section_data (abfd, sec) != NULL) \
? coff_section_data (abfd, sec)->comdat : NULL)
#define coff_symbol_from(symbol) \
((bfd_family_coff (bfd_asymbol_bfd (symbol)) \
&& bfd_asymbol_bfd (symbol)->tdata.coff_obj_data) \
? (coff_symbol_type *) (symbol) : NULL)
struct internal_syment;
union internal_auxent;
extern bfd_boolean bfd_coff_get_syment
(bfd *, struct bfd_symbol *, struct internal_syment *);
extern bfd_boolean bfd_coff_get_auxent
(bfd *, struct bfd_symbol *, int, union internal_auxent *);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
/* BFD support for the ft32 processor.
Copyright (C) 2013-2015 Free Software Foundation, Inc.
Written by FTDI (support@ftdichip.com)
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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_ft32_arch =
{
32, /* 32 bits in a word. */
32, /* 32 bits in an address. */
8, /* 8 bits in a byte. */
bfd_arch_ft32, /* enum bfd_architecture arch. */
bfd_mach_ft32,
"ft32", /* Arch name. */
"ft32", /* Printable name. */
2, /* Unsigned int section alignment power. */
TRUE, /* The one and only. */
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
0,
};

View File

@ -0,0 +1,60 @@
/* BFD support for the Intel MCU architecture.
Copyright (C) 2015 Free Software Foundation, Inc.
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
extern void * bfd_arch_i386_short_nop_fill (bfd_size_type, bfd_boolean,
bfd_boolean);
static const bfd_arch_info_type bfd_iamcu_arch_intel_syntax =
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_iamcu,
bfd_mach_i386_iamcu_intel_syntax,
"iamcu:intel",
"iamcu:intel",
3,
TRUE,
bfd_default_compatible,
bfd_default_scan,
bfd_arch_i386_short_nop_fill,
0
};
const bfd_arch_info_type bfd_iamcu_arch =
{
32, /* 32 bits in a word */
32, /* 32 bits in an address */
8, /* 8 bits in a byte */
bfd_arch_iamcu,
bfd_mach_i386_iamcu,
"iamcu",
"iamcu",
3,
TRUE,
bfd_default_compatible,
bfd_default_scan,
bfd_arch_i386_short_nop_fill,
&bfd_iamcu_arch_intel_syntax
};

View File

@ -0,0 +1,41 @@
/* BFD support for the Imagination Technologies Meta processor.
Copyright (C) 2013-2015 Free Software Foundation, Inc.
Contributed by Imagination Technologies Ltd.
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_metag_arch =
{
32, /* Bits per word. */
32, /* Bits per address. */
8, /* Bits per byte. */
bfd_arch_metag, /* Architecture. */
bfd_mach_metag, /* Machine. */
"metag", /* Architecture name. */
"metag", /* Printable name. */
4, /* Section align power. */
TRUE, /* The default ? */
bfd_default_compatible, /* Architecture comparison fn. */
bfd_default_scan, /* String to architecture convert fn. */
bfd_arch_default_fill, /* Default fill. */
NULL /* Next in list. */
};

View File

@ -0,0 +1,45 @@
/* BFD support for the NDS32 processor
Copyright (C) 2012-2015 Free Software Foundation, Inc.
Contributed by Andes Technology Corporation.
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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#define N(number, print, default, next) \
{32, 32, 8, bfd_arch_nds32, number, "nds32", print, 4, default, \
bfd_default_compatible, bfd_default_scan, bfd_arch_default_fill, next }
#define NEXT &arch_info_struct[0]
#define NDS32V2_NEXT &arch_info_struct[1]
#define NDS32V3_NEXT &arch_info_struct[2]
#define NDS32V3M_NEXT &arch_info_struct[3]
static const bfd_arch_info_type arch_info_struct[] =
{
N (bfd_mach_n1h, "n1h", FALSE, NDS32V2_NEXT),
N (bfd_mach_n1h_v2, "n1h_v2", FALSE, NDS32V3_NEXT),
N (bfd_mach_n1h_v3, "n1h_v3", FALSE, NDS32V3M_NEXT),
N (bfd_mach_n1h_v3m, "n1h_v3m", FALSE, NULL),
};
const bfd_arch_info_type bfd_nds32_arch =
N (bfd_mach_n1, "n1h", TRUE, NEXT);

View File

@ -0,0 +1,74 @@
/* BFD support for the Altera Nios II processor.
Copyright (C) 2012-2015 Free Software Foundation, Inc.
Contributed by Nigel Gray (ngray@altera.com).
Contributed by Mentor Graphics, Inc.
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
static const bfd_arch_info_type *
nios2_compatible (const bfd_arch_info_type *a,
const bfd_arch_info_type *b)
{
if (a->arch != b->arch)
return NULL;
if (a->bits_per_word != b->bits_per_word)
return NULL;
if (a->mach == bfd_mach_nios2)
return a;
else if (b->mach == bfd_mach_nios2)
return b;
else if (a->mach != b->mach)
return NULL;
return a;
}
#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \
{ \
BITS_WORD, /* bits in a word */ \
BITS_ADDR, /* bits in an address */ \
8, /* 8 bits in a byte */ \
bfd_arch_nios2, \
NUMBER, \
"nios2", \
PRINT, \
3, \
DEFAULT, \
nios2_compatible, \
bfd_default_scan, \
bfd_arch_default_fill, \
NEXT \
}
#define NIOS2R1_NEXT &arch_info_struct[0]
#define NIOS2R2_NEXT &arch_info_struct[1]
static const bfd_arch_info_type arch_info_struct[] =
{
N (32, 32, bfd_mach_nios2r1, "nios2:r1", FALSE, NIOS2R2_NEXT),
N (32, 32, bfd_mach_nios2r2, "nios2:r2", FALSE, NULL),
};
const bfd_arch_info_type bfd_nios2_arch =
N (32, 32, 0, "nios2", TRUE, NIOS2R1_NEXT);

View File

@ -0,0 +1,41 @@
/* BFD support for the NEC V850 processor with the RH850 ABI.
Copyright (C) 2012-2015 Free Software Foundation, Inc.
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#include "safe-ctype.h"
#define R(number, print, default, next) \
{ 32, 32, 8, bfd_arch_v850_rh850, number, "v850", print, 2, default, \
bfd_default_compatible, bfd_default_scan, bfd_arch_default_fill, next }
static const bfd_arch_info_type arch_info_struct[] =
{
R (bfd_mach_v850e3v5, "v850e3v5", FALSE, & arch_info_struct[1]),
R (bfd_mach_v850e3v5, "v850e2v4", FALSE, & arch_info_struct[2]),
R (bfd_mach_v850e2v3, "v850e2v3", FALSE, & arch_info_struct[3]),
R (bfd_mach_v850e2, "v850e2", FALSE, & arch_info_struct[4]),
R (bfd_mach_v850e1, "v850e1", FALSE, & arch_info_struct[5]),
R (bfd_mach_v850e, "v850e", FALSE, NULL)
};
const bfd_arch_info_type bfd_v850_rh850_arch =
R (bfd_mach_v850, "v850-rh850", TRUE, & arch_info_struct[0]);

View File

@ -0,0 +1,41 @@
/* BFD support for the Visium processor.
Copyright (C) 2003-2015 Free Software Foundation, Inc.
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 3 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., 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_visium_arch =
{
32, /* bits per word */
32, /* bits per address */
8, /* bits per byte */
bfd_arch_visium, /* architecture */
bfd_mach_visium, /* machine */
"visium", /* architecture name */
"visium", /* printable name */
2, /* section align power */
TRUE, /* the default ? */
bfd_default_compatible, /* architecture comparison fn */
bfd_default_scan, /* string to architecture convert fn */
bfd_arch_default_fill, /* default fill */
NULL /* next in list */
};

View File

@ -0,0 +1,19 @@
# Copyright (C) 2012-2015 Free Software Foundation, Inc.
#
# This file is part of GDB.
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
# Controls whether to enable development-mode features by default.
development=false

View File

@ -0,0 +1,127 @@
/* Definitions for PRPSINFO structures under ELF on GNU/Linux.
Copyright (C) 2013-2015 Free Software Foundation, Inc.
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#ifndef ELF_LINUX_PSINFO_H
#define ELF_LINUX_PSINFO_H
/* The PRPSINFO structures defined below are used by most
architectures, although some of them define their own versions
(like e.g., PPC). */
/* External 32-bit structure for PRPSINFO. This structure is
ABI-defined, thus we choose to use char arrays here in order to
avoid dealing with different types in different architectures.
This structure will ultimately be written in the corefile's note
section, as the PRPSINFO. */
struct elf_external_linux_prpsinfo32
{
char pr_state; /* Numeric process state. */
char pr_sname; /* Char for pr_state. */
char pr_zomb; /* Zombie. */
char pr_nice; /* Nice val. */
char pr_flag[4]; /* Flags. */
char pr_uid[2];
char pr_gid[2];
char pr_pid[4];
char pr_ppid[4];
char pr_pgrp[4];
char pr_sid[4];
char pr_fname[16]; /* Filename of executable. */
char pr_psargs[80]; /* Initial part of arg list. */
};
/* Helper macro to swap (properly handling endianess) things from the
`elf_internal_linux_prpsinfo' structure to the
`elf_external_linux_prpsinfo32' structure.
Note that FROM should be a pointer, and TO should be the explicit
type. */
#define LINUX_PRPSINFO32_SWAP_FIELDS(abfd, from, to) \
do \
{ \
H_PUT_8 (abfd, from->pr_state, &to.pr_state); \
H_PUT_8 (abfd, from->pr_sname, &to.pr_sname); \
H_PUT_8 (abfd, from->pr_zomb, &to.pr_zomb); \
H_PUT_8 (abfd, from->pr_nice, &to.pr_nice); \
H_PUT_32 (abfd, from->pr_flag, to.pr_flag); \
H_PUT_16 (abfd, from->pr_uid, to.pr_uid); \
H_PUT_16 (abfd, from->pr_gid, to.pr_gid); \
H_PUT_32 (abfd, from->pr_pid, to.pr_pid); \
H_PUT_32 (abfd, from->pr_ppid, to.pr_ppid); \
H_PUT_32 (abfd, from->pr_pgrp, to.pr_pgrp); \
H_PUT_32 (abfd, from->pr_sid, to.pr_sid); \
strncpy (to.pr_fname, from->pr_fname, sizeof (to.pr_fname)); \
strncpy (to.pr_psargs, from->pr_psargs, sizeof (to.pr_psargs)); \
} while (0)
/* External 64-bit structure for PRPSINFO. This structure is
ABI-defined, thus we choose to use char arrays here in order to
avoid dealing with different types in different architectures.
This structure will ultimately be written in the corefile's note
section, as the PRPSINFO. */
struct elf_external_linux_prpsinfo64
{
char pr_state; /* Numeric process state. */
char pr_sname; /* Char for pr_state. */
char pr_zomb; /* Zombie. */
char pr_nice; /* Nice val. */
char pr_flag[8]; /* Flags. */
char gap[4];
char pr_uid[4];
char pr_gid[4];
char pr_pid[4];
char pr_ppid[4];
char pr_pgrp[4];
char pr_sid[4];
char pr_fname[16]; /* Filename of executable. */
char pr_psargs[80]; /* Initial part of arg list. */
};
/* Helper macro to swap (properly handling endianess) things from the
`elf_internal_linux_prpsinfo' structure to the
`elf_external_linux_prpsinfo64' structure.
Note that FROM should be a pointer, and TO should be the explicit
type. */
#define LINUX_PRPSINFO64_SWAP_FIELDS(abfd, from, to) \
do \
{ \
H_PUT_8 (abfd, from->pr_state, &to.pr_state); \
H_PUT_8 (abfd, from->pr_sname, &to.pr_sname); \
H_PUT_8 (abfd, from->pr_zomb, &to.pr_zomb); \
H_PUT_8 (abfd, from->pr_nice, &to.pr_nice); \
H_PUT_64 (abfd, from->pr_flag, to.pr_flag); \
H_PUT_32 (abfd, from->pr_uid, to.pr_uid); \
H_PUT_32 (abfd, from->pr_gid, to.pr_gid); \
H_PUT_32 (abfd, from->pr_pid, to.pr_pid); \
H_PUT_32 (abfd, from->pr_ppid, to.pr_ppid); \
H_PUT_32 (abfd, from->pr_pgrp, to.pr_pgrp); \
H_PUT_32 (abfd, from->pr_sid, to.pr_sid); \
strncpy (to.pr_fname, from->pr_fname, sizeof (to.pr_fname)); \
strncpy (to.pr_psargs, from->pr_psargs, sizeof (to.pr_psargs)); \
} while (0)
#endif

View File

@ -0,0 +1,380 @@
/* ft32-specific support for 32-bit ELF.
Copyright (C) 2013-2015 Free Software Foundation, Inc.
Copied from elf32-moxie.c which is..
Copyright (C) 2009-2015 Free Software Foundation, Inc.
Free Software Foundation, Inc.
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/ft32.h"
/* Forward declarations. */
static reloc_howto_type ft32_elf_howto_table [] =
{
/* This reloc does nothing. */
HOWTO (R_FT32_NONE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_FT32_NONE", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE), /* pcrel_offset */
/* A 32 bit absolute relocation. */
HOWTO (R_FT32_32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_FT32_32", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_FT32_16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_FT32_16", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_FT32_8, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_FT32_8", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x000000ff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_FT32_10, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
10, /* bitsize */
FALSE, /* pc_relative */
4, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_FT32_10", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x00003ff0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_FT32_20, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
20, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_FT32_20", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x000fffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_FT32_17, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
17, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_FT32_17", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x0001ffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_FT32_18, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
18, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_FT32_18", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x0003ffff, /* dst_mask */
FALSE), /* pcrel_offset */
};
/* Map BFD reloc types to FT32 ELF reloc types. */
struct ft32_reloc_map
{
bfd_reloc_code_real_type bfd_reloc_val;
unsigned int ft32_reloc_val;
};
static const struct ft32_reloc_map ft32_reloc_map [] =
{
{ BFD_RELOC_NONE, R_FT32_NONE },
{ BFD_RELOC_32, R_FT32_20 },
{ BFD_RELOC_16, R_FT32_16 },
{ BFD_RELOC_8, R_FT32_8 },
{ BFD_RELOC_FT32_10, R_FT32_10 },
{ BFD_RELOC_FT32_20, R_FT32_20 },
{ BFD_RELOC_FT32_17, R_FT32_17 },
{ BFD_RELOC_FT32_18, R_FT32_18 },
};
static reloc_howto_type *
ft32_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
bfd_reloc_code_real_type code)
{
unsigned int i;
for (i = sizeof (ft32_reloc_map) / sizeof (ft32_reloc_map[0]);
--i;)
if (ft32_reloc_map [i].bfd_reloc_val == code)
return & ft32_elf_howto_table [ft32_reloc_map[i].ft32_reloc_val];
return NULL;
}
static reloc_howto_type *
ft32_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
{
unsigned int i;
for (i = 0;
i < sizeof (ft32_elf_howto_table) / sizeof (ft32_elf_howto_table[0]);
i++)
if (ft32_elf_howto_table[i].name != NULL
&& strcasecmp (ft32_elf_howto_table[i].name, r_name) == 0)
return &ft32_elf_howto_table[i];
return NULL;
}
/* Set the howto pointer for an FT32 ELF reloc. */
static void
ft32_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
arelent *cache_ptr,
Elf_Internal_Rela *dst)
{
unsigned int r_type;
r_type = ELF32_R_TYPE (dst->r_info);
BFD_ASSERT (r_type < (unsigned int) R_FT32_max);
cache_ptr->howto = & ft32_elf_howto_table [r_type];
}
/* Relocate an FT32 ELF section.
The RELOCATE_SECTION function is called by the new ELF backend linker
to handle the relocations for a section.
The relocs are always passed as Rela structures; if the section
actually uses Rel structures, the r_addend field will always be
zero.
This function is responsible for adjusting the section contents as
necessary, and (if using Rela relocs and generating a relocatable
output file) adjusting the reloc addend as necessary.
This function does not have to worry about setting the reloc
address or the reloc symbol index.
LOCAL_SYMS is a pointer to the swapped in local symbols.
LOCAL_SECTIONS is an array giving the section in the input file
corresponding to the st_shndx field of each local symbol.
The global hash table entry for the global symbols can be found
via elf_sym_hashes (input_bfd).
When generating relocatable output, this function must handle
STB_LOCAL/STT_SECTION symbols specially. The output symbol is
going to be the section symbol corresponding to the output
section, which means that the addend must be adjusted
accordingly. */
static bfd_boolean
ft32_elf_relocate_section (bfd *output_bfd,
struct bfd_link_info *info,
bfd *input_bfd,
asection *input_section,
bfd_byte *contents,
Elf_Internal_Rela *relocs,
Elf_Internal_Sym *local_syms,
asection **local_sections)
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
for (rel = relocs; rel < relend; rel ++)
{
reloc_howto_type *howto;
unsigned long r_symndx;
Elf_Internal_Sym *sym;
asection *sec;
struct elf_link_hash_entry *h;
bfd_vma relocation;
bfd_reloc_status_type r;
const char *name;
int r_type;
r_type = ELF32_R_TYPE (rel->r_info);
r_symndx = ELF32_R_SYM (rel->r_info);
howto = ft32_elf_howto_table + r_type;
h = NULL;
sym = NULL;
sec = NULL;
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
sec = local_sections [r_symndx];
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
}
else
{
bfd_boolean unresolved_reloc, warned, ignored;
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h, sec, relocation,
unresolved_reloc, warned, ignored);
name = h->root.root.string;
}
if (sec != NULL && discarded_section (sec))
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
if (bfd_link_relocatable (info))
continue;
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
relocation, rel->r_addend);
if (r != bfd_reloc_ok)
{
const char * msg = NULL;
switch (r)
{
case bfd_reloc_overflow:
r = info->callbacks->reloc_overflow
(info, (h ? &h->root : NULL), name, howto->name,
(bfd_vma) 0, input_bfd, input_section, rel->r_offset);
break;
case bfd_reloc_undefined:
r = info->callbacks->undefined_symbol
(info, name, input_bfd, input_section, rel->r_offset,
TRUE);
break;
case bfd_reloc_outofrange:
msg = _("internal error: out of range error");
break;
case bfd_reloc_notsupported:
msg = _("internal error: unsupported relocation error");
break;
case bfd_reloc_dangerous:
msg = _("internal error: dangerous relocation");
break;
default:
msg = _("internal error: unknown error");
break;
}
if (msg)
r = info->callbacks->warning
(info, msg, name, input_bfd, input_section, rel->r_offset);
if (! r)
return FALSE;
}
}
return TRUE;
}
#define ELF_ARCH bfd_arch_ft32
#define ELF_MACHINE_CODE EM_FT32
#define ELF_MAXPAGESIZE 0x1
#define TARGET_LITTLE_SYM ft32_elf32_vec
#define TARGET_LITTLE_NAME "elf32-ft32"
#define elf_info_to_howto_rel NULL
#define elf_info_to_howto ft32_info_to_howto_rela
#define elf_backend_relocate_section ft32_elf_relocate_section
#define elf_backend_can_gc_sections 1
#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_reloc_type_lookup ft32_reloc_type_lookup
#define bfd_elf32_bfd_reloc_name_lookup ft32_reloc_name_lookup
#include "elf32-target.h"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
/* Meta support for 32-bit ELF
Copyright (C) 2013-2015 Free Software Foundation, Inc.
Contributed by Imagination Technologies Ltd.
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#ifndef _ELF32_METAG_H
#define _ELF32_METAG_H
extern int elf_metag_setup_section_lists
(bfd *, struct bfd_link_info *);
extern void elf_metag_next_input_section
(struct bfd_link_info *, asection *);
extern bfd_boolean elf_metag_size_stubs
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
asection * (*) (const char *, asection *), void (*) (void));
extern bfd_boolean elf_metag_build_stubs
(struct bfd_link_info *);
#endif /* _ELF32_METAG_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,155 @@
/* NDS32-specific support for 32-bit ELF.
Copyright (C) 2012-2015 Free Software Foundation, Inc.
Contributed by Andes Technology Corporation.
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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA.*/
#ifndef ELF32_NDS32_H
#define ELF32_NDS32_H
/* Relocation flags encoded in r_addend. */
/* Relocation flags for R_NDS32_ERLAX_ENTRY. */
/* Set if relax on this section is done or disabled. */
#define R_NDS32_RELAX_ENTRY_DISABLE_RELAX_FLAG (1 << 31)
/* Optimize for performance. */
#define R_NDS32_RELAX_ENTRY_OPTIMIZE_FLAG (1 << 30)
/* Optimize for size. Branch destination 4-byte adjustment
may be disabled. */
#define R_NDS32_RELAX_ENTRY_OPTIMIZE_FOR_SPACE_FLAG (1 << 29)
/* To distinguish the assembly code generated by compiler
or written manually. */
#define R_NDS32_RELAX_ENTRY_VERBATIM_FLAG (1 << 28)
/* EX9 and link-time IFC must be explicitly enabled, so we
won't mess up handcraft assembly code. */
/* Enable EX9 optimization for this section. */
#define R_NDS32_RELAX_ENTRY_EX9_FLAG (1 << 2)
/* Enable IFC optimization for this section. */
#define R_NDS32_RELAX_ENTRY_IFC_FLAG (1 << 3)
/* Relocation flags for R_NDS32_INSN16. */
/* Tag the nop16 can be removed. */
#define R_NDS32_INSN16_CONVERT_FLAG (1 << 0)
/* Convert a gp-relative access (e.g., lwi.gp)
to fp-as-gp access (lwi37.fp).
This value is used by linker internally only.
It's fine to change the vlaue. */
#define R_NDS32_INSN16_FP7U2_FLAG (1 << 1)
/* Relocation flags for R_NDS32_RELAX_REGION_OMIT_FP_START/END. */
/* OMIT_FP_FLAG marks the region for applying fp-as-gp
optimization. */
#define R_NDS32_RELAX_REGION_OMIT_FP_FLAG (1 << 0)
/* NOT_OMIT_FP_FLAG is set if this region is not worth
for fp-as-gp. */
#define R_NDS32_RELAX_REGION_NOT_OMIT_FP_FLAG (1 << 1)
/* Suppress EX9 optimization in the region. */
#define R_NDS32_RELAX_REGION_NO_EX9_FLAG (1 << 2)
/* A Innermost loop region. Some optimizations is suppressed
in this region due to performance drop. */
#define R_NDS32_RELAX_REGION_INNERMOST_LOOP_FLAG (1 << 4)
/* Tag range for LOADSTORE relocation. */
enum
{
NDS32_LOADSTORE_NONE = 0x0,
NDS32_LOADSTORE_BYTE = 0x1,
NDS32_LOADSTORE_HALF = 0x2,
NDS32_LOADSTORE_WORD = 0x4,
NDS32_LOADSTORE_FLOAT_S = 0x8,
NDS32_LOADSTORE_FLOAT_D = 0x10,
NDS32_LOADSTORE_IMM = 0x20
};
/* Relax tag for nds32_elf_relax_section, we have to specify which
optimization do in this round. */
enum
{
NDS32_RELAX_NONE_ROUND = 0,
NDS32_RELAX_NORMAL_ROUND,
NDS32_RELAX_JUMP_IFC_ROUND,
NDS32_RELAX_EX9_BUILD_ROUND,
NDS32_RELAX_EX9_REPLACE_ROUND,
NDS32_RELAX_EMPTY_ROUND
};
/* Optimization status mask. */
#define NDS32_RELAX_JUMP_IFC_DONE (1 << 0)
#define NDS32_RELAX_EX9_DONE (1 << 1)
/* Optimization turn on mask. */
#define NDS32_RELAX_JUMP_IFC_ON (1 << 0)
#define NDS32_RELAX_EX9_ON (1 << 1)
extern void nds32_insertion_sort
(void *, size_t, size_t, int (*) (const void *, const void *));
extern int nds32_elf_ex9_init (void);
extern int nds32_convert_32_to_16 (bfd *, uint32_t, uint16_t *, int *);
extern int nds32_convert_16_to_32 (bfd *, uint16_t, uint32_t *);
extern void bfd_elf32_nds32_set_target_option (struct bfd_link_info *,
int, int, FILE *, int,
int, int, int, FILE *,
FILE *, int, int,
bfd_boolean, bfd_boolean);
#define nds32_elf_hash_table(info) \
(elf_hash_table_id ((struct elf_link_hash_table *) ((info)->hash)) \
== NDS32_ELF_DATA ? \
((struct elf_nds32_link_hash_table *) ((info)->hash)) : NULL)
/* Hash table structure for target nds32. There are some members to
save target options passed from nds32elf.em to bfd. */
struct elf_nds32_link_hash_table
{
struct elf_link_hash_table root;
/* Short-cuts to get to dynamic linker sections. */
asection *sgot;
asection *sgotplt;
asection *srelgot;
asection *splt;
asection *srelplt;
asection *sdynbss;
asection *srelbss;
/* Small local sym to section mapping cache. */
struct sym_cache sym_cache;
/* Target dependent options. */
int relax_fp_as_gp; /* --mrelax-omit-fp */
int eliminate_gc_relocs; /* --meliminate-gc-relocs */
FILE *sym_ld_script; /* --mgen-symbol-ld-script=<file> */
/* Disable if linking a dynamically linked executable. */
int load_store_relax;
int target_optimize; /* Switch optimization. */
int relax_status; /* Finished optimization. */
int relax_round; /* Going optimization. */
FILE *ex9_export_file; /* --mexport-ex9=<file> */
FILE *ex9_import_file; /* --mimport-ex9=<file> */
int update_ex9_table; /* --mupdate-ex9. */
int ex9_limit;
bfd_boolean ex9_loop_aware; /* Ignore ex9 if inside a loop. */
bfd_boolean ifc_loop_aware; /* Ignore ifc if inside a loop. */
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,38 @@
/* Nios II support for 32-bit ELF
Copyright (C) 2013-2015 Free Software Foundation, Inc.
Contributed by Mentor Graphics
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#ifndef _ELF32_NIOS2_H
#define _ELF32_NIOS2_H
extern int nios2_elf32_setup_section_lists
(bfd *, struct bfd_link_info *);
extern void nios2_elf32_next_input_section
(struct bfd_link_info *, asection *);
extern bfd_boolean nios2_elf32_size_stubs
(bfd *, bfd *, struct bfd_link_info *,
asection * (*) (const char *, asection *, bfd_boolean), void (*) (void));
extern bfd_boolean nios2_elf32_build_stubs
(struct bfd_link_info *);
#endif /* _ELF32_NIOS2_H */

View File

@ -0,0 +1,21 @@
/* Renesas RX specific support for 32-bit ELF.
Copyright (C) 2014-2015 Free Software Foundation, Inc.
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 3 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. */
void rx_additional_link_map_text (bfd *obfd, struct bfd_link_info *info, FILE *mapfile);

View File

@ -0,0 +1,877 @@
/* Visium-specific support for 32-bit ELF.
Copyright (C) 2003-2015 Free Software Foundation, Inc.
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 3 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., 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/visium.h"
static bfd_reloc_status_type visium_elf_howto_parity_reloc
(bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **);
static reloc_howto_type visium_elf_howto_table[] = {
/* This reloc does nothing. */
HOWTO (R_VISIUM_NONE, /* type */
0, /* rightshift */
3, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_VISIUM_NONE", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE), /* pcrel_offset */
/* A 8 bit absolute relocation. */
HOWTO (R_VISIUM_8, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_VISIUM_8", /* name */
FALSE, /* partial_inplace */
0x00, /* src_mask */
0xff, /* dst_mask */
FALSE), /* pcrel_offset */
/* A 16 bit absolute relocation. */
HOWTO (R_VISIUM_16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_VISIUM_16", /* name */
FALSE, /* partial_inplace */
0x0000, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* A 32 bit absolute relocation. */
HOWTO (R_VISIUM_32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_VISIUM_32", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* A 8 bit PC relative relocation. */
HOWTO (R_VISIUM_8_PCREL, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
8, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_VISIUM_8_PCREL", /* name */
FALSE, /* partial_inplace */
0x00, /* src_mask */
0xff, /* dst_mask */
TRUE), /* pcrel_offset */
/* A 16 bit PC relative relocation. */
HOWTO (R_VISIUM_16_PCREL, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_VISIUM_16_PCREL", /* name */
FALSE, /* partial inplace */
0x0000, /* src_mask */
0xffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* A 32-bit PC relative relocation. */
HOWTO (R_VISIUM_32_PCREL, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_VISIUM_32_PCREL", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0xffffffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* A 16-bit PC word relative offset, relative to start of instruction
and always in the second half of the instruction. */
HOWTO (R_VISIUM_PC16, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
visium_elf_howto_parity_reloc, /* special_function */
"R_VISIUM_PC16", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x0000ffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* The high 16 bits of symbol value. */
HOWTO (R_VISIUM_HI16, /* type */
16, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
visium_elf_howto_parity_reloc, /* special_function */
"R_VISIUM_HI16", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* The low 16 bits of symbol value. */
HOWTO (R_VISIUM_LO16, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
visium_elf_howto_parity_reloc, /* special_function */
"R_VISIUM_LO16", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* A 16 bit immediate value. */
HOWTO (R_VISIUM_IM16, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_unsigned, /* complain_on_overflow */
visium_elf_howto_parity_reloc, /* special_function */
"R_VISIUM_IM16", /* name */
FALSE, /* partial_inplace */
0x0000000, /* src_mask */
0x000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
/* The high 16 bits of symbol value, pc relative. */
HOWTO (R_VISIUM_HI16_PCREL, /* type */
16, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
visium_elf_howto_parity_reloc, /* special_function */
"R_VISIUM_HI16_PCREL", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x0000ffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* The low 16 bits of symbol value, pc relative. */
HOWTO (R_VISIUM_LO16_PCREL, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
visium_elf_howto_parity_reloc, /* special_function */
"R_VISIUM_LO16_PCREL", /* name */
FALSE, /* partial_inplace */
0x00000000, /* src_mask */
0x0000ffff, /* dst_mask */
TRUE), /* pcrel_offset */
/* A 16 bit immediate value, pc relative. */
HOWTO (R_VISIUM_IM16_PCREL, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_unsigned, /* complain_on_overflow */
visium_elf_howto_parity_reloc, /* special_function */
"R_VISIUM_IM16_PCREL", /* name */
FALSE, /* partial_inplace */
0x0000000, /* src_mask */
0x000ffff, /* dst_mask */
TRUE), /* pcrel_offset */
};
/* GNU extension to record C++ vtable hierarchy. */
static reloc_howto_type visium_elf_vtinherit_howto =
HOWTO (R_VISIUM_GNU_VTINHERIT, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_VISIUM_GNU_VTINHERIT", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE); /* pcrel_offset */
/* GNU extension to record C++ vtable member usage. */
static reloc_howto_type visium_elf_vtentry_howto =
HOWTO (R_VISIUM_GNU_VTENTRY, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
0, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"R_VISIUM_GNU_VTENTRY", /* name */
FALSE, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE); /* pcrel_offset */
/* Return the parity bit for INSN shifted to its final position. */
static bfd_vma
visium_parity_bit (bfd_vma insn)
{
bfd_vma p = 0;
int i;
for (i = 0; i < 31; i++)
{
p ^= (insn & 1);
insn >>= 1;
}
return p << 31;
}
/* This "special function" will only be used when the input and
output files have different formats ie. when generating S-records
directly using "--oformat srec". Otherwise we use
_bfd_final_link_relocate which uses a howto structure, but does
not use the special_function field.
It sets instruction parity to even. This cannot be done by a howto. */
static bfd_reloc_status_type
visium_elf_howto_parity_reloc (bfd * input_bfd, arelent *reloc_entry,
asymbol *symbol, PTR data,
asection *input_section, bfd *output_bfd,
char **error_message ATTRIBUTE_UNUSED)
{
bfd_reloc_status_type ret;
bfd_vma relocation;
bfd_byte *inplace_address;
bfd_vma insn;
const bfd_vma signmask = 0xffff8000;
/* This part is from bfd_elf_generic_reloc.
If we're relocating, and this an external symbol, we don't want
to change anything. */
if (output_bfd != (bfd *) NULL && (symbol->flags & BSF_SECTION_SYM) == 0)
{
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
/* Now do the reloc in the usual way. */
/* Sanity check the address (offset in section). */
if (reloc_entry->address > bfd_get_section_limit (input_bfd, input_section))
return bfd_reloc_outofrange;
ret = bfd_reloc_ok;
if (bfd_is_und_section (symbol->section) && output_bfd == (bfd *) NULL)
ret = bfd_reloc_undefined;
if (bfd_is_com_section (symbol->section) || output_bfd != (bfd *) NULL)
relocation = 0;
else
relocation = symbol->value;
/* Only do this for a final link. */
if (output_bfd == (bfd *) NULL)
{
relocation += symbol->section->output_section->vma;
relocation += symbol->section->output_offset;
}
relocation += reloc_entry->addend;
inplace_address = (bfd_byte *) data + reloc_entry->address;
insn = bfd_get_32 (input_bfd, inplace_address);
if (reloc_entry->howto->pc_relative)
{
relocation -= input_section->output_section->vma
+ input_section->output_offset;
relocation -= reloc_entry->address;
}
switch (reloc_entry->howto->type)
{
case R_VISIUM_PC16:
relocation >>= 2;
if (ret == bfd_reloc_ok && (relocation & signmask) != 0
&& (relocation & signmask) != signmask)
ret = bfd_reloc_overflow;
relocation &= 0xffff;
break;
case R_VISIUM_HI16:
case R_VISIUM_HI16_PCREL:
relocation = (relocation >> 16) & 0xffff;
break;
case R_VISIUM_LO16:
case R_VISIUM_LO16_PCREL:
relocation &= 0xffff;
break;
case R_VISIUM_IM16:
case R_VISIUM_IM16_PCREL:
if (ret == bfd_reloc_ok && (relocation & 0xffff0000) != 0)
ret = bfd_reloc_overflow;
relocation &= 0xffff;
break;
}
insn = (insn & 0x7fff0000) | relocation;
insn |= visium_parity_bit (insn);
bfd_put_32 (input_bfd, insn, inplace_address);
if (output_bfd != (bfd *) NULL)
reloc_entry->address += input_section->output_offset;
return ret;
}
static reloc_howto_type *
visium_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
bfd_reloc_code_real_type code)
{
/* Note that the visium_elf_howto_table is indexed by the R_
constants. Thus, the order that the howto records appear in the
table *must* match the order of the relocation types defined in
include/elf/visium.h. */
switch (code)
{
case BFD_RELOC_NONE:
return &visium_elf_howto_table[(int) R_VISIUM_NONE];
case BFD_RELOC_8:
return &visium_elf_howto_table[(int) R_VISIUM_8];
case BFD_RELOC_16:
return &visium_elf_howto_table[(int) R_VISIUM_16];
case BFD_RELOC_32:
return &visium_elf_howto_table[(int) R_VISIUM_32];
case BFD_RELOC_8_PCREL:
return &visium_elf_howto_table[(int) R_VISIUM_8_PCREL];
case BFD_RELOC_16_PCREL:
return &visium_elf_howto_table[(int) R_VISIUM_16_PCREL];
case BFD_RELOC_32_PCREL:
return &visium_elf_howto_table[(int) R_VISIUM_32_PCREL];
case BFD_RELOC_VISIUM_REL16:
return &visium_elf_howto_table[(int) R_VISIUM_PC16];
case BFD_RELOC_VISIUM_HI16:
return &visium_elf_howto_table[(int) R_VISIUM_HI16];
case BFD_RELOC_VISIUM_LO16:
return &visium_elf_howto_table[(int) R_VISIUM_LO16];
case BFD_RELOC_VISIUM_IM16:
return &visium_elf_howto_table[(int) R_VISIUM_IM16];
case BFD_RELOC_VISIUM_HI16_PCREL:
return &visium_elf_howto_table[(int) R_VISIUM_HI16_PCREL];
case BFD_RELOC_VISIUM_LO16_PCREL:
return &visium_elf_howto_table[(int) R_VISIUM_LO16_PCREL];
case BFD_RELOC_VISIUM_IM16_PCREL:
return &visium_elf_howto_table[(int) R_VISIUM_IM16_PCREL];
case BFD_RELOC_VTABLE_INHERIT:
return &visium_elf_vtinherit_howto;
case BFD_RELOC_VTABLE_ENTRY:
return &visium_elf_vtentry_howto;
default:
return NULL;
}
}
static reloc_howto_type *
visium_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, const char *r_name)
{
unsigned int i;
for (i = 0;
i < (sizeof (visium_elf_howto_table)
/ sizeof (visium_elf_howto_table[0])); i++)
if (visium_elf_howto_table[i].name != NULL
&& strcasecmp (visium_elf_howto_table[i].name, r_name) == 0)
return &visium_elf_howto_table[i];
if (strcasecmp (visium_elf_vtinherit_howto.name, r_name) == 0)
return &visium_elf_vtinherit_howto;
if (strcasecmp (visium_elf_vtentry_howto.name, r_name) == 0)
return &visium_elf_vtentry_howto;
return NULL;
}
/* Set the howto pointer for a VISIUM ELF reloc. */
static void
visium_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
Elf_Internal_Rela *dst)
{
unsigned int r_type = ELF32_R_TYPE (dst->r_info);
switch (r_type)
{
case R_VISIUM_GNU_VTINHERIT:
cache_ptr->howto = &visium_elf_vtinherit_howto;
break;
case R_VISIUM_GNU_VTENTRY:
cache_ptr->howto = &visium_elf_vtentry_howto;
break;
default:
if (r_type >= (unsigned int) R_VISIUM_max)
{
_bfd_error_handler (_("%B: invalid Visium reloc number: %d"), abfd, r_type);
r_type = 0;
}
cache_ptr->howto = &visium_elf_howto_table[r_type];
break;
}
}
/* Look through the relocs for a section during the first phase.
Since we don't do .gots or .plts, we just need to consider the
virtual table relocs for gc. */
static bfd_boolean
visium_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
asection *sec, const Elf_Internal_Rela *relocs)
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
const Elf_Internal_Rela *rel;
const Elf_Internal_Rela *rel_end;
if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd);
rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; rel++)
{
struct elf_link_hash_entry *h;
unsigned long r_symndx;
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx < symtab_hdr->sh_info)
h = NULL;
else
{
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
}
switch (ELF32_R_TYPE (rel->r_info))
{
/* This relocation describes the C++ object vtable hierarchy.
Reconstruct it for later use during GC. */
case R_VISIUM_GNU_VTINHERIT:
if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
return FALSE;
break;
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
case R_VISIUM_GNU_VTENTRY:
if (!bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
return FALSE;
break;
}
}
return TRUE;
}
/* Relocate a VISIUM ELF section. */
static bfd_boolean
visium_elf_relocate_section (bfd *output_bfd,
struct bfd_link_info *info, bfd *input_bfd,
asection *input_section, bfd_byte *contents,
Elf_Internal_Rela *relocs,
Elf_Internal_Sym *local_syms,
asection **local_sections)
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
for (rel = relocs; rel < relend; rel++)
{
reloc_howto_type *howto;
unsigned long r_symndx;
Elf_Internal_Sym *sym;
asection *sec;
struct elf_link_hash_entry *h;
bfd_vma relocation;
bfd_reloc_status_type r;
const char *name = NULL;
int r_type;
bfd_vma insn;
r_type = ELF32_R_TYPE (rel->r_info);
if (r_type == R_VISIUM_GNU_VTINHERIT || r_type == R_VISIUM_GNU_VTENTRY)
continue;
r_symndx = ELF32_R_SYM (rel->r_info);
howto = visium_elf_howto_table + ELF32_R_TYPE (rel->r_info);
h = NULL;
sym = NULL;
sec = NULL;
if (r_symndx < symtab_hdr->sh_info)
{
/* This is a local symbol. */
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name;
}
else
{
bfd_boolean unresolved_reloc;
bfd_boolean warned, ignored;
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h, sec, relocation,
unresolved_reloc, warned, ignored);
name = h->root.root.string;
}
if (sec != NULL && discarded_section (sec))
{
/* For relocs against symbols from removed linkonce sections,
or sections discarded by a linker script, we just want the
section contents zeroed. Avoid any special processing. */
_bfd_clear_contents (howto, input_bfd, input_section,
contents + rel->r_offset);
rel->r_info = 0;
rel->r_addend = 0;
continue;
}
if (bfd_link_relocatable (info))
continue;
switch (r_type)
{
case R_VISIUM_PC16:
case R_VISIUM_HI16:
case R_VISIUM_LO16:
case R_VISIUM_IM16:
case R_VISIUM_HI16_PCREL:
case R_VISIUM_LO16_PCREL:
case R_VISIUM_IM16_PCREL:
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
relocation, rel->r_addend);
/* For instruction relocations, the parity needs correcting. */
if (r == bfd_reloc_ok)
{
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn = (insn & 0x7fffffff) | visium_parity_bit (insn);
bfd_put_32 (input_bfd, insn, contents + rel->r_offset);
}
break;
default:
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, rel->r_offset,
relocation, rel->r_addend);
break;
}
if (r != bfd_reloc_ok)
{
const char *msg = (const char *) NULL;
switch (r)
{
case bfd_reloc_overflow:
r = info->callbacks->reloc_overflow
(info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0,
input_bfd, input_section, rel->r_offset);
break;
case bfd_reloc_undefined:
r = info->callbacks->undefined_symbol
(info, name, input_bfd, input_section, rel->r_offset, TRUE);
break;
case bfd_reloc_outofrange:
msg = _("internal error: out of range error");
break;
case bfd_reloc_notsupported:
msg = _("internal error: unsupported relocation error");
break;
case bfd_reloc_dangerous:
msg = _("internal error: dangerous relocation");
break;
default:
msg = _("internal error: unknown error");
break;
}
if (msg)
r = info->callbacks->warning
(info, msg, name, input_bfd, input_section, rel->r_offset);
if (!r)
return FALSE;
}
}
return TRUE;
}
/* This function is called during section gc to discover the section a
to which a particular relocation refers. Return the section that
should be marked against GC for a given relocation. */
static asection *
visium_elf_gc_mark_hook (asection *sec, struct bfd_link_info *info,
Elf_Internal_Rela *rel, struct elf_link_hash_entry *h,
Elf_Internal_Sym *sym)
{
if (h != NULL)
switch (ELF32_R_TYPE (rel->r_info))
{
case R_VISIUM_GNU_VTINHERIT:
case R_VISIUM_GNU_VTENTRY:
return NULL;
}
return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
}
static void
visium_elf_post_process_headers (bfd *abfd,
struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_STANDALONE;
i_ehdrp->e_ident[EI_ABIVERSION] = 1;
}
/* Function to set the ELF flag bits. */
static bfd_boolean
visium_elf_set_private_flags (bfd *abfd, flagword flags)
{
elf_elfheader (abfd)->e_flags = flags;
elf_flags_init (abfd) = TRUE;
return TRUE;
}
/* Copy backend specific data from one object module to another. */
static bfd_boolean
visium_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
return TRUE;
BFD_ASSERT (!elf_flags_init (obfd)
|| elf_elfheader (obfd)->e_flags ==
elf_elfheader (ibfd)->e_flags);
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags;
elf_flags_init (obfd) = TRUE;
/* Copy object attributes. */
_bfd_elf_copy_obj_attributes (ibfd, obfd);
return TRUE;
}
/* Merge backend specific data from an object
file to the output object file when linking. */
static bfd_boolean
visium_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd)
{
flagword old_flags;
flagword new_flags;
flagword mismatch;
const char *opt_arch = NULL;
const char *new_opt_with = NULL;
const char *old_opt_with = NULL;
const char *with = "with";
const char *without = "without";
const char *mcm = "mcm";
const char *mcm24 = "mcm24";
const char *gr6 = "gr6";
new_flags = elf_elfheader (ibfd)->e_flags;
old_flags = elf_elfheader (obfd)->e_flags;
if (!elf_flags_init (obfd))
{
/* First call, no flags set. */
elf_flags_init (obfd) = TRUE;
elf_elfheader (obfd)->e_flags = new_flags;
}
else
{
mismatch = (new_flags ^ old_flags)
& (EF_VISIUM_ARCH_MCM | EF_VISIUM_ARCH_MCM24 | EF_VISIUM_ARCH_GR6);
if (mismatch & EF_VISIUM_ARCH_GR6)
{
opt_arch = gr6;
new_opt_with = new_flags & EF_VISIUM_ARCH_GR6 ? with : without;
old_opt_with = old_flags & EF_VISIUM_ARCH_GR6 ? with : without;
}
else if (mismatch & EF_VISIUM_ARCH_MCM)
{
opt_arch = mcm;
new_opt_with = new_flags & EF_VISIUM_ARCH_MCM ? with : without;
old_opt_with = old_flags & EF_VISIUM_ARCH_MCM ? with : without;
}
else if (mismatch & EF_VISIUM_ARCH_MCM24)
{
opt_arch = mcm24;
new_opt_with = new_flags & EF_VISIUM_ARCH_MCM24 ? with : without;
old_opt_with = old_flags & EF_VISIUM_ARCH_MCM24 ? with : without;
}
if (mismatch)
_bfd_error_handler
(_
("%s: compiled %s -mtune=%s and linked with modules"
" compiled %s -mtune=%s"),
bfd_get_filename (ibfd), new_opt_with, opt_arch, old_opt_with,
opt_arch);
}
return TRUE;
}
static bfd_boolean
visium_elf_print_private_bfd_data (bfd *abfd, void *ptr)
{
FILE *file = (FILE *) ptr;
flagword flags;
BFD_ASSERT (abfd != NULL && ptr != NULL);
/* Print normal ELF private data. */
_bfd_elf_print_private_bfd_data (abfd, ptr);
flags = elf_elfheader (abfd)->e_flags;
fprintf (file, _("private flags = 0x%lx:"), (long) flags);
if (flags & EF_VISIUM_ARCH_GR6)
fprintf (file, " -mtune=gr6");
else if (flags & EF_VISIUM_ARCH_MCM)
fprintf (file, " -mtune=mcm");
else if (flags & EF_VISIUM_ARCH_MCM24)
fprintf (file, " -mtune=mcm24");
fputc ('\n', file);
return TRUE;
}
#define ELF_ARCH bfd_arch_visium
#define ELF_MACHINE_CODE EM_VISIUM
#define ELF_MAXPAGESIZE 1
#define TARGET_BIG_SYM visium_elf32_vec
#define TARGET_BIG_NAME "elf32-visium"
#define elf_info_to_howto_rel NULL
#define elf_info_to_howto visium_info_to_howto_rela
#define elf_backend_relocate_section visium_elf_relocate_section
#define elf_backend_gc_mark_hook visium_elf_gc_mark_hook
#define elf_backend_check_relocs visium_elf_check_relocs
#define elf_backend_rela_normal 1
#define elf_backend_can_gc_sections 1
#define bfd_elf32_bfd_reloc_type_lookup visium_reloc_type_lookup
#define bfd_elf32_bfd_reloc_name_lookup visium_reloc_name_lookup
#define bfd_elf32_bfd_set_private_flags visium_elf_set_private_flags
#define bfd_elf32_bfd_copy_private_bfd_data visium_elf_copy_private_bfd_data
#define bfd_elf32_bfd_merge_private_bfd_data visium_elf_merge_private_bfd_data
#define bfd_elf32_bfd_print_private_bfd_data visium_elf_print_private_bfd_data
#define elf_backend_post_process_headers visium_elf_post_process_headers
#include "elf32-target.h"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,661 @@
/* AArch64-specific support for ELF.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
Contributed by ARM Ltd.
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 3 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; see the file COPYING3. If not,
see <http://www.gnu.org/licenses/>. */
#include "sysdep.h"
#include "elfxx-aarch64.h"
#include <stdarg.h>
#include <string.h>
#define MASK(n) ((1u << (n)) - 1)
/* Sign-extend VALUE, which has the indicated number of BITS. */
bfd_signed_vma
_bfd_aarch64_sign_extend (bfd_vma value, int bits)
{
if (value & ((bfd_vma) 1 << (bits - 1)))
/* VALUE is negative. */
value |= ((bfd_vma) - 1) << bits;
return value;
}
/* Decode the IMM field of ADRP. */
uint32_t
_bfd_aarch64_decode_adrp_imm (uint32_t insn)
{
return (((insn >> 5) & MASK (19)) << 2) | ((insn >> 29) & MASK (2));
}
/* Reencode the imm field of add immediate. */
static inline uint32_t
reencode_add_imm (uint32_t insn, uint32_t imm)
{
return (insn & ~(MASK (12) << 10)) | ((imm & MASK (12)) << 10);
}
/* Reencode the IMM field of ADR. */
uint32_t
_bfd_aarch64_reencode_adr_imm (uint32_t insn, uint32_t imm)
{
return (insn & ~((MASK (2) << 29) | (MASK (19) << 5)))
| ((imm & MASK (2)) << 29) | ((imm & (MASK (19) << 2)) << 3);
}
/* Reencode the imm field of ld/st pos immediate. */
static inline uint32_t
reencode_ldst_pos_imm (uint32_t insn, uint32_t imm)
{
return (insn & ~(MASK (12) << 10)) | ((imm & MASK (12)) << 10);
}
/* Encode the 26-bit offset of unconditional branch. */
static inline uint32_t
reencode_branch_ofs_26 (uint32_t insn, uint32_t ofs)
{
return (insn & ~MASK (26)) | (ofs & MASK (26));
}
/* Encode the 19-bit offset of conditional branch and compare & branch. */
static inline uint32_t
reencode_cond_branch_ofs_19 (uint32_t insn, uint32_t ofs)
{
return (insn & ~(MASK (19) << 5)) | ((ofs & MASK (19)) << 5);
}
/* Decode the 19-bit offset of load literal. */
static inline uint32_t
reencode_ld_lit_ofs_19 (uint32_t insn, uint32_t ofs)
{
return (insn & ~(MASK (19) << 5)) | ((ofs & MASK (19)) << 5);
}
/* Encode the 14-bit offset of test & branch. */
static inline uint32_t
reencode_tst_branch_ofs_14 (uint32_t insn, uint32_t ofs)
{
return (insn & ~(MASK (14) << 5)) | ((ofs & MASK (14)) << 5);
}
/* Reencode the imm field of move wide. */
static inline uint32_t
reencode_movw_imm (uint32_t insn, uint32_t imm)
{
return (insn & ~(MASK (16) << 5)) | ((imm & MASK (16)) << 5);
}
/* Reencode mov[zn] to movz. */
static inline uint32_t
reencode_movzn_to_movz (uint32_t opcode)
{
return opcode | (1 << 30);
}
/* Reencode mov[zn] to movn. */
static inline uint32_t
reencode_movzn_to_movn (uint32_t opcode)
{
return opcode & ~(1 << 30);
}
/* Return non-zero if the indicated VALUE has overflowed the maximum
range expressible by a unsigned number with the indicated number of
BITS. */
static bfd_reloc_status_type
aarch64_unsigned_overflow (bfd_vma value, unsigned int bits)
{
bfd_vma lim;
if (bits >= sizeof (bfd_vma) * 8)
return bfd_reloc_ok;
lim = (bfd_vma) 1 << bits;
if (value >= lim)
return bfd_reloc_overflow;
return bfd_reloc_ok;
}
/* Return non-zero if the indicated VALUE has overflowed the maximum
range expressible by an signed number with the indicated number of
BITS. */
static bfd_reloc_status_type
aarch64_signed_overflow (bfd_vma value, unsigned int bits)
{
bfd_signed_vma svalue = (bfd_signed_vma) value;
bfd_signed_vma lim;
if (bits >= sizeof (bfd_vma) * 8)
return bfd_reloc_ok;
lim = (bfd_signed_vma) 1 << (bits - 1);
if (svalue < -lim || svalue >= lim)
return bfd_reloc_overflow;
return bfd_reloc_ok;
}
/* Insert the addend/value into the instruction or data object being
relocated. */
bfd_reloc_status_type
_bfd_aarch64_elf_put_addend (bfd *abfd,
bfd_byte *address, bfd_reloc_code_real_type r_type,
reloc_howto_type *howto, bfd_signed_vma addend)
{
bfd_reloc_status_type status = bfd_reloc_ok;
bfd_signed_vma old_addend = addend;
bfd_vma contents;
int size;
size = bfd_get_reloc_size (howto);
switch (size)
{
case 0:
return status;
case 2:
contents = bfd_get_16 (abfd, address);
break;
case 4:
if (howto->src_mask != 0xffffffff)
/* Must be 32-bit instruction, always little-endian. */
contents = bfd_getl32 (address);
else
/* Must be 32-bit data (endianness dependent). */
contents = bfd_get_32 (abfd, address);
break;
case 8:
contents = bfd_get_64 (abfd, address);
break;
default:
abort ();
}
switch (howto->complain_on_overflow)
{
case complain_overflow_dont:
break;
case complain_overflow_signed:
status = aarch64_signed_overflow (addend,
howto->bitsize + howto->rightshift);
break;
case complain_overflow_unsigned:
status = aarch64_unsigned_overflow (addend,
howto->bitsize + howto->rightshift);
break;
case complain_overflow_bitfield:
default:
abort ();
}
addend >>= howto->rightshift;
switch (r_type)
{
case BFD_RELOC_AARCH64_CALL26:
case BFD_RELOC_AARCH64_JUMP26:
contents = reencode_branch_ofs_26 (contents, addend);
break;
case BFD_RELOC_AARCH64_BRANCH19:
contents = reencode_cond_branch_ofs_19 (contents, addend);
break;
case BFD_RELOC_AARCH64_TSTBR14:
contents = reencode_tst_branch_ofs_14 (contents, addend);
break;
case BFD_RELOC_AARCH64_GOT_LD_PREL19:
case BFD_RELOC_AARCH64_LD_LO19_PCREL:
case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
if (old_addend & ((1 << howto->rightshift) - 1))
return bfd_reloc_overflow;
contents = reencode_ld_lit_ofs_19 (contents, addend);
break;
case BFD_RELOC_AARCH64_TLSDESC_CALL:
break;
case BFD_RELOC_AARCH64_ADR_GOT_PAGE:
case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL:
case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
case BFD_RELOC_AARCH64_ADR_LO21_PCREL:
case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21:
case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21:
case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
contents = _bfd_aarch64_reencode_adr_imm (contents, addend);
break;
case BFD_RELOC_AARCH64_ADD_LO12:
case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC:
case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12:
case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12:
case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12:
case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12:
case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
/* Corresponds to: add rd, rn, #uimm12 to provide the low order
12 bits of the page offset following
BFD_RELOC_AARCH64_ADR_HI21_PCREL which computes the
(pc-relative) page base. */
contents = reencode_add_imm (contents, addend);
break;
case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14:
case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC:
case BFD_RELOC_AARCH64_LD64_GOTOFF_LO15:
case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15:
case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC:
case BFD_RELOC_AARCH64_LDST128_LO12:
case BFD_RELOC_AARCH64_LDST16_LO12:
case BFD_RELOC_AARCH64_LDST32_LO12:
case BFD_RELOC_AARCH64_LDST64_LO12:
case BFD_RELOC_AARCH64_LDST8_LO12:
case BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC:
case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC:
case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12:
case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12:
case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12:
case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12:
case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC:
if (old_addend & ((1 << howto->rightshift) - 1))
return bfd_reloc_overflow;
/* Used for ldr*|str* rt, [rn, #uimm12] to provide the low order
12 bits of the page offset following BFD_RELOC_AARCH64_ADR_HI21_PCREL
which computes the (pc-relative) page base. */
contents = reencode_ldst_pos_imm (contents, addend);
break;
/* Group relocations to create high bits of a 16, 32, 48 or 64
bit signed data or abs address inline. Will change
instruction to MOVN or MOVZ depending on sign of calculated
value. */
case BFD_RELOC_AARCH64_MOVW_G0_S:
case BFD_RELOC_AARCH64_MOVW_G1_S:
case BFD_RELOC_AARCH64_MOVW_G2_S:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2:
/* NOTE: We can only come here with movz or movn. */
if (addend < 0)
{
/* Force use of MOVN. */
addend = ~addend;
contents = reencode_movzn_to_movn (contents);
}
else
{
/* Force use of MOVZ. */
contents = reencode_movzn_to_movz (contents);
}
/* fall through */
/* Group relocations to create a 16, 32, 48 or 64 bit unsigned
data or abs address inline. */
case BFD_RELOC_AARCH64_MOVW_G0:
case BFD_RELOC_AARCH64_MOVW_G0_NC:
case BFD_RELOC_AARCH64_MOVW_G1:
case BFD_RELOC_AARCH64_MOVW_G1_NC:
case BFD_RELOC_AARCH64_MOVW_G2:
case BFD_RELOC_AARCH64_MOVW_G2_NC:
case BFD_RELOC_AARCH64_MOVW_G3:
case BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC:
case BFD_RELOC_AARCH64_MOVW_GOTOFF_G1:
case BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC:
case BFD_RELOC_AARCH64_TLSDESC_OFF_G1:
case BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC:
case BFD_RELOC_AARCH64_TLSGD_MOVW_G1:
case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC:
case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
contents = reencode_movw_imm (contents, addend);
break;
default:
/* Repack simple data */
if (howto->dst_mask & (howto->dst_mask + 1))
return bfd_reloc_notsupported;
contents = ((contents & ~howto->dst_mask) | (addend & howto->dst_mask));
break;
}
switch (size)
{
case 2:
bfd_put_16 (abfd, contents, address);
break;
case 4:
if (howto->dst_mask != 0xffffffff)
/* must be 32-bit instruction, always little-endian */
bfd_putl32 (contents, address);
else
/* must be 32-bit data (endianness dependent) */
bfd_put_32 (abfd, contents, address);
break;
case 8:
bfd_put_64 (abfd, contents, address);
break;
default:
abort ();
}
return status;
}
bfd_vma
_bfd_aarch64_elf_resolve_relocation (bfd_reloc_code_real_type r_type,
bfd_vma place, bfd_vma value,
bfd_vma addend, bfd_boolean weak_undef_p)
{
switch (r_type)
{
case BFD_RELOC_AARCH64_NONE:
case BFD_RELOC_AARCH64_TLSDESC_CALL:
break;
case BFD_RELOC_AARCH64_16_PCREL:
case BFD_RELOC_AARCH64_32_PCREL:
case BFD_RELOC_AARCH64_64_PCREL:
case BFD_RELOC_AARCH64_ADR_LO21_PCREL:
case BFD_RELOC_AARCH64_BRANCH19:
case BFD_RELOC_AARCH64_LD_LO19_PCREL:
case BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21:
case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
case BFD_RELOC_AARCH64_TSTBR14:
if (weak_undef_p)
value = place;
value = value + addend - place;
break;
case BFD_RELOC_AARCH64_CALL26:
case BFD_RELOC_AARCH64_JUMP26:
value = value + addend - place;
break;
case BFD_RELOC_AARCH64_16:
case BFD_RELOC_AARCH64_32:
case BFD_RELOC_AARCH64_LD64_GOTOFF_LO15:
case BFD_RELOC_AARCH64_MOVW_G0:
case BFD_RELOC_AARCH64_MOVW_G0_NC:
case BFD_RELOC_AARCH64_MOVW_G0_S:
case BFD_RELOC_AARCH64_MOVW_G1:
case BFD_RELOC_AARCH64_MOVW_G1_NC:
case BFD_RELOC_AARCH64_MOVW_G1_S:
case BFD_RELOC_AARCH64_MOVW_G2:
case BFD_RELOC_AARCH64_MOVW_G2_NC:
case BFD_RELOC_AARCH64_MOVW_G2_S:
case BFD_RELOC_AARCH64_MOVW_G3:
case BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC:
case BFD_RELOC_AARCH64_MOVW_GOTOFF_G1:
case BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC:
case BFD_RELOC_AARCH64_TLSDESC_OFF_G1:
case BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC:
case BFD_RELOC_AARCH64_TLSGD_MOVW_G1:
case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12:
case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12:
case BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12:
case BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12:
case BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12:
case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12:
case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC:
case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2:
value = value + addend;
break;
case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL:
case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
if (weak_undef_p)
value = PG (place);
value = PG (value + addend) - PG (place);
break;
case BFD_RELOC_AARCH64_GOT_LD_PREL19:
value = value + addend - place;
break;
case BFD_RELOC_AARCH64_ADR_GOT_PAGE:
case BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21:
case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
value = PG (value + addend) - PG (place);
break;
case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14:
case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15:
/* Caller must make sure addend is the base address of .got section. */
value = value - PG (addend);
break;
case BFD_RELOC_AARCH64_ADD_LO12:
case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC:
case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC:
case BFD_RELOC_AARCH64_LDST128_LO12:
case BFD_RELOC_AARCH64_LDST16_LO12:
case BFD_RELOC_AARCH64_LDST32_LO12:
case BFD_RELOC_AARCH64_LDST64_LO12:
case BFD_RELOC_AARCH64_LDST8_LO12:
case BFD_RELOC_AARCH64_TLSDESC_ADD:
case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC:
case BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC:
case BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC:
case BFD_RELOC_AARCH64_TLSDESC_LDR:
case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
value = PG_OFFSET (value + addend);
break;
case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12:
value = value + addend;
break;
case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
value = (value + addend) & (bfd_vma) 0xffff0000;
break;
case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12:
/* Mask off low 12bits, keep all other high bits, so that the later
generic code could check whehter there is overflow. */
value = (value + addend) & ~(bfd_vma) 0xfff;
break;
case BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0:
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC:
value = (value + addend) & (bfd_vma) 0xffff;
break;
case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2:
value = (value + addend) & ~(bfd_vma) 0xffffffff;
value -= place & ~(bfd_vma) 0xffffffff;
break;
default:
break;
}
return value;
}
/* Hook called by the linker routine which adds symbols from an object
file. */
bfd_boolean
_bfd_aarch64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
Elf_Internal_Sym *sym,
const char **namep ATTRIBUTE_UNUSED,
flagword *flagsp ATTRIBUTE_UNUSED,
asection **secp ATTRIBUTE_UNUSED,
bfd_vma *valp ATTRIBUTE_UNUSED)
{
if ((ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
|| ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)
&& (abfd->flags & DYNAMIC) == 0
&& bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour)
elf_tdata (info->output_bfd)->has_gnu_symbols = elf_gnu_symbol_any;
return TRUE;
}
/* Support for core dump NOTE sections. */
bfd_boolean
_bfd_aarch64_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
{
int offset;
size_t size;
switch (note->descsz)
{
default:
return FALSE;
case 392: /* sizeof(struct elf_prstatus) on Linux/arm64. */
/* pr_cursig */
elf_tdata (abfd)->core->signal
= bfd_get_16 (abfd, note->descdata + 12);
/* pr_pid */
elf_tdata (abfd)->core->lwpid
= bfd_get_32 (abfd, note->descdata + 32);
/* pr_reg */
offset = 112;
size = 272;
break;
}
/* Make a ".reg/999" section. */
return _bfd_elfcore_make_pseudosection (abfd, ".reg",
size, note->descpos + offset);
}
bfd_boolean
_bfd_aarch64_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
{
switch (note->descsz)
{
default:
return FALSE;
case 136: /* This is sizeof(struct elf_prpsinfo) on Linux/aarch64. */
elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24);
elf_tdata (abfd)->core->program
= _bfd_elfcore_strndup (abfd, note->descdata + 40, 16);
elf_tdata (abfd)->core->command
= _bfd_elfcore_strndup (abfd, note->descdata + 56, 80);
}
/* Note that for some reason, a spurious space is tacked
onto the end of the args in some (at least one anyway)
implementations, so strip it off if it exists. */
{
char *command = elf_tdata (abfd)->core->command;
int n = strlen (command);
if (0 < n && command[n - 1] == ' ')
command[n - 1] = '\0';
}
return TRUE;
}
char *
_bfd_aarch64_elf_write_core_note (bfd *abfd, char *buf, int *bufsiz, int note_type,
...)
{
switch (note_type)
{
default:
return NULL;
case NT_PRPSINFO:
{
char data[136];
va_list ap;
va_start (ap, note_type);
memset (data, 0, sizeof (data));
strncpy (data + 40, va_arg (ap, const char *), 16);
strncpy (data + 56, va_arg (ap, const char *), 80);
va_end (ap);
return elfcore_write_note (abfd, buf, bufsiz, "CORE",
note_type, data, sizeof (data));
}
case NT_PRSTATUS:
{
char data[392];
va_list ap;
long pid;
int cursig;
const void *greg;
va_start (ap, note_type);
memset (data, 0, sizeof (data));
pid = va_arg (ap, long);
bfd_put_32 (abfd, pid, data + 32);
cursig = va_arg (ap, int);
bfd_put_16 (abfd, cursig, data + 12);
greg = va_arg (ap, const void *);
memcpy (data + 112, greg, 272);
va_end (ap);
return elfcore_write_note (abfd, buf, bufsiz, "CORE",
note_type, data, sizeof (data));
}
}
}

View File

@ -0,0 +1,67 @@
/* AArch64-specific backend routines.
Copyright (C) 2009-2015 Free Software Foundation, Inc.
Contributed by ARM Ltd.
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 3 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; see the file COPYING3. If not,
see <http://www.gnu.org/licenses/>. */
#include "bfd.h"
#include "elf-bfd.h"
#include "stdint.h"
/* Take the PAGE component of an address or offset. */
#define PG(x) ((x) & ~ (bfd_vma) 0xfff)
#define PG_OFFSET(x) ((x) & (bfd_vma) 0xfff)
#define AARCH64_ADR_OP 0x10000000
#define AARCH64_ADRP_OP 0x90000000
#define AARCH64_ADRP_OP_MASK 0x9F000000
extern bfd_signed_vma
_bfd_aarch64_sign_extend (bfd_vma, int);
extern uint32_t
_bfd_aarch64_decode_adrp_imm (uint32_t);
extern uint32_t
_bfd_aarch64_reencode_adr_imm (uint32_t, uint32_t);
extern bfd_reloc_status_type
_bfd_aarch64_elf_put_addend (bfd *, bfd_byte *, bfd_reloc_code_real_type,
reloc_howto_type *, bfd_signed_vma);
extern bfd_vma
_bfd_aarch64_elf_resolve_relocation (bfd_reloc_code_real_type, bfd_vma, bfd_vma,
bfd_vma, bfd_boolean);
extern bfd_boolean
_bfd_aarch64_elf_add_symbol_hook (bfd *, struct bfd_link_info *,
Elf_Internal_Sym *, const char **,
flagword *, asection **, bfd_vma *);
extern bfd_boolean
_bfd_aarch64_elf_grok_prstatus (bfd *, Elf_Internal_Note *);
extern bfd_boolean
_bfd_aarch64_elf_grok_psinfo (bfd *, Elf_Internal_Note *);
extern char *
_bfd_aarch64_elf_write_core_note (bfd *, char *, int *, int, ...);
#define elf_backend_add_symbol_hook _bfd_aarch64_elf_add_symbol_hook
#define elf_backend_grok_prstatus _bfd_aarch64_elf_grok_prstatus
#define elf_backend_grok_psinfo _bfd_aarch64_elf_grok_psinfo
#define elf_backend_write_core_note _bfd_aarch64_elf_write_core_note

View File

@ -0,0 +1 @@
m4_define([BFD_VERSION], [2.26.1])

View File

@ -0,0 +1,756 @@
2012-12-17 Nick Clifton <nickc@redhat.com>
* BRANCHES: Add copyright notice.
* MAINTAINERS: Likewise.
* Makefile.am: Likewise.
* NEWS: Likewise.
* README: Likewise.
* configure.com: Likewise.
* configure.in: Likewise.
* configure.tgt: Likewise.
* dwarf-mode.el: Likewise.
* makefile.vms: Likewise.
* syslex_wrap.c: Likewise.
* doc/Makefile.am: Likewise.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
2012-11-27 Kai Tietz <ktietz@redhat.com>
* resbin.c (bin_to_res_version): Correct offset
and length calculation of resource.
(get_version_header): Apply alignement of 4 to len.
2012-11-16 H.J. Lu <hongjiu.lu@intel.com>
* readelf.c (process_dynamic_section): Correct DF_1_CONFALT.
Also dump DF_1_ENDFILTEE, DF_1_DISPRELDNE, DF_1_NODIRECT,
DF_1_IGNMULDEF, DF_1_NOKSYMS, DF_1_NOHDR, DF_1_EDITED,
DF_1_NORELOC, DF_1_SYMINTPOSE, DF_1_GLOBAUDIT and DF_1_SINGLETON.
2012-11-14 Tristan Gingold <gingold@adacore.com>
* od-macho.c (bfd_mach_o_load_command_name): Add new definitions.
(dump_load_command): Handle BFD_MACH_O_LC_SOURCE_VERSION
and BFD_MACH_O_LC_MAIN.
2012-11-13 Maciej W. Rozycki <macro@codesourcery.com>
* readelf.c (get_machine_flags) <EM_MIPS, EM_MIPS_RS3_LE>: Move
code to handle EF_SH_PIC and EF_SH_FDPIC...
<EM_SH>: ... here.
2012-11-09 Nick Clifton <nickc@redhat.com>
* readelf.c (get_machine_flags): Add support for E_FLAG_RX_ABI.
(guess_is_rela): Add EM_V800.
(dump_relocations): Likewise.
(get_machine_name): Update EM_V800.
(get_machine_flags): Add support for RH850 ABI flags.
(is_32bit_abs_reloc): Add support for RH850 ABI reloc.
2012-11-09 H.J. Lu <hongjiu.lu@intel.com>
* coffgrok.c (coff_grok): Remove trailing redundant `;'.
* resrc.c (open_input_stream): Likewise.
2012-11-08 Alan Modra <amodra@gmail.com>
* po/POTFILES.in: Regenerate.
2012-11-07 H.J. Lu <hongjiu.lu@intel.com>
* objcopy.c (copy_section): Don't read beyond section end.
2012-11-06 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/14567
* Makefile.am (BFDTEST2_PROG): New.
(bfdtest2_DEPENDENCIES): Likewise.
(TEST_PROGS): Add $(BFDTEST2_PROG).
* Makefile.in: Regenerated.
* bfdtest2.c: New file.
2012-11-05 Stephane Carrez <Stephane.Carrez@gmail.com>
* MAINTAINERS: Update my email address.
2012-11-05 Alan Modra <amodra@gmail.com>
* configure.in: Apply 2012-09-10 change to config.in here. Add
__CONFIG_H__ check.
* config.in: Regenerate.
2012-11-01 Tom Tromey <tromey@redhat.com>
* readelf.c (get_note_type): Handle NT_386_TLS, NT_386_IOPERM.
2012-10-30 Nick Clifton <nickc@redhat.com>
PR binutils/14779
* configure.in: Add checks for wchar.h and mbstate_t.
* config.in: Regenerate.
* configure: Regenerate.
* readelf.c: Conditionally include wchar.h.
(print_symbol): Conditionally use mbstate_t.
2012-10-30 Steve McIntyre <steve.mcintyre@linaro.org>
* readelf.c (decode_ARM_machine_flags): Recognise and display the
new ARM hard-float/soft-float ABI flags for EABI_VER5. Split out
the code for EABI_VER4 and EABI_VER5 to allow this.
2012-10-29 Alan Modra <amodra@gmail.com>
* dlltool.c (INIT_SEC_DATA): Move.
(secdata <DLLTOOL_PPC>): Use here too.
2012-10-26 Nick Clifton <nickc@redhat.com>
* po/hr.po: New Croation translation.
* configure.in (ALL_LINGUAS): Add hr.
* configure: Regenerate.
2012-10-23 Cary Coutant <ccoutant@google.com>
* dwarf.c (do_debug_addr, do_debug_cu_index): New global flags.
(load_debug_info): Fix typo.
(cu_tu_indexes_read, shndx_pool, shndx_pool_size, shndx_pool_used):
New global variables.
(prealloc_cu_tu_list, add_shndx_to_cu_tu_entry, end_cu_tu_entry)
(process_cu_tu_index, load_cu_tu_indexes, find_cu_tu_set)
(display_cu_index): New functions.
(dwarf_select_sections_by_names): Add "debug_addr", "cu_index".
Sort entries alphabetically.
(dwarf_select_sections_all): Set do_debug_addr, do_debug_cu_index.
(debug_displays): Add .debug_cu_index, .debug_tu_index.
Clean up formatting.
* dwarf.h (dwarf_section_display_enum): Add dwp_cu_index,
dwp_tu_index.
(do_debug_addr, do_debug_cu_index): New global flags.
(find_cu_tu_set): New function declaration.
* objdump.c (usage): Add --dwarf=addr, --dwarf=cu_index.
* readelf.c (find_section_in_set): New function.
(usage): Add --debug-dump=addr, --debug_dump=cu_index.
(process_section_headers): Check do_debug_addr and do_debug_cu_index.
(section_subset): New global variable.
(load_debug_section): Restrict search to section subset.
(display_debug_section): Add section index as paramter. Select subset
of sections when dumping a .dwp file. Update caller.
2012-10-23 Tom Tromey <tromey@redhat.com>
* readelf.c (get_note_type): Handle NT_SIGINFO, NT_FILE.
(print_core_note): New function.
(process_note): Call it.
2012-10-21 H.J. Lu <hongjiu.lu@intel.com>
* objdump.c (dump_dwarf): Handle bfd_mach_x64_32 and
bfd_mach_x64_32_intel_syntax.
2012-10-21 Alan Modra <amodra@gmail.com>
* objdump.c (load_specific_debug_section): Use
bfd_cache_section_contents.
2012-10-18 Kai Tietz <ktietz@redhat.com>
* objdump.c (dump_bfd): Call dump headers after
call of slurp_symtab.
* objcopy.c (is_strip_section_1): Don't strip
.reloc section by default.
2012-10-11 Doug Evans <dje@google.com>
* dwarf.c (display_gdb_index): Include static/global information
of each symbol.
2012-09-14 David Edelsohn <dje.gcc@gmail.com>
* configure: Regenerate.
2012-09-10 Matthias Klose <doko@ubuntu.com>
* config.in: Disable sanity check for kfreebsd.
2012-09-10 H.J. Lu <hongjiu.lu@intel.com>
* configure: Regenerated.
2012-09-06 Cary Coutant <ccoutant@google.com>
* dwarf.c (decode_location_expression): Add
DW_OP_GNU_const_index.
2012-09-06 Nick Clifton <nickc@redhat.com>
* doc/binutils.texi (nm): Alpha-sort the option descriptions.
Add description of the --synthetic option.
2012-09-04 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/14493
* readelf.c (get_symbol_index_type): Check bad section index.
2012-08-24 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* readelf.c (arm_attr_tag_CPU_arch): Update for ARMv8.
(arm_attr_tag_FP_arch): Likewise.
(arm_attr_tag_Advanced_SIMD_arch): Likewise.
2012-08-17 Yuri Chornoivan <yurchor@ukr.net>
* doc/binutils.texi, * objdump.c, * od-xcoff.c: Typo fixes.
2012-08-16 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/14481
* Makefile.am (BFDTEST1_PROG): New.
(TEST_PROGS): Likewise.
(bfdtest1_DEPENDENCIES): Likewise.
(noinst_PROGRAMS): Add $(TEST_PROGS).
* Makefile.in: Regenerated.
* bfdtest1.c: New file.
2012-08-13 Ian Bolton <ian.bolton@arm.com>
Laurent Desnogues <laurent.desnogues@arm.com>
Jim MacArthur <jim.macarthur@arm.com>
Marcus Shawcroft <marcus.shawcroft@arm.com>
Nigel Stephens <nigel.stephens@arm.com>
Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Richard Earnshaw <rearnsha@arm.com>
Sofiane Naci <sofiane.naci@arm.com>
Tejas Belagod <tejas.belagod@arm.com>
Yufeng Zhang <yufeng.zhang@arm.com>
* readelf.c (guess_is_rela): Handle EM_AARCH64.
(get_machine_name): Likewise.
(get_aarch64_segment_type): New function.
(get_segment_type): Handle EM_AARCH64 by calling the new function.
(get_aarch64_section_type_name): New function.
(get_section_type_name): Handle EM_AARCH64 by calling the new function.
(is_32bit_abs_reloc): Handle EM_AARCH64.
(is_32bit_pcrel_reloc): Likewise.
(is_64bit_abs_reloc): Likewise.
(is_64bit_pcrel_reloc): Likewise.
(is_none_reloc): Likewise.
2012-08-09 Nick Clifton <nickc@redhat.com>
* po/vi.po: Updated Vietnamese translation.
2012-08-03 Tom Tromey <tromey@redhat.com>
* dlltool.c (scan_obj_file): Close arfile after calling
bfd_openr_next_archived_file.
2012-08-02 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/14420
* dwarf.c (process_abbrev_section): Add attribute terminator.
Warn missing section terminator.
(get_FORM_name): Special check for 0 value.
(get_AT_name): Likewise.
(process_debug_info): Display zero abbrev number. Check
attribute terminator.
2012-07-30 Nick Clifton <nickc@redhat.com>
* po/binutils.pot: Updated template.
* po/bg.po: Updated Bulgarian translation.
* po/es.po: Updated Spanish translation.
* po/fi.po: Updated Finnish translation.
* po/fr.po: Updated French translation.
* po/uk.po: Updated Ukranian translation.
2012-07-28 Kai Tietz <ktietz@redhat.com>
* rcparse.y (FILEVERSION): Use optcnumexpr instead of cnumexpr.
(PRODUCTVERSION): Likewise.
2012-07-27 Mike Frysinger <vapier@gentoo.org>
* configure.in (BFD_VERSION): Run bfd/configure --version and
parse the output of that.
* configure: Regenerate.
2012-07-27 Tristan Gingold <gingold@adacore.com>
* NEWS: Add marker for 2.23.
2012-07-24 Teresa Johnson <tejohnson@google.com>
* addr2line.c (find_address_in_section): Invoke
bfd_find_nearest_line_discriminator to get the discriminator.
(find_offset_in_section): Likewise.
(translate_addresses): Print discriminator if it is non-zero.
* objdump.c (show_line): Invoke
bfd_find_nearest_line_discriminator to get the discriminator,
and keep track of prev_discriminator. Print discriminator
if it is non-zero.
(disassemble_data): Initialize prev_discriminator.
(dump_reloc_set): Invoke bfd_find_nearest_line_discriminator
to get the discriminator, and keep track of last_discriminator.
Print discriminator if it is non-zero.
2012-07-17 Nick Clifton <nickc@redhat.com>
* elfcomm.c (setup_archive): Extract index table and symbol table
scanning code into...
(process_archive_index_and_symbols): ... this function and add
support for 64-bit index tables.
* elfcomm.h (struct archive_info): Change type of index_num and
index_array to elf_vma.
Add 'uses_64bit_indicies' field.
* readelf.c (process_archive): Fix support for 64-bit indicies.
2012-07-03 Nick Clifton <nickc@redhat.com>
* readelf.c (process_archive): Display member indicies when
dumping index.
2012-07-02 Tom Tromey <tromey@redhat.com>
* dwarf.c: Include gdb-index.h.
(display_gdb_index): Handle version 7.
2012-06-29 H.J. Lu <hongjiu.lu@intel.com>
* nm.c (filter_symbols): Simplify global symbol handling.
2012-06-29 Francois Gouget <fgouget@codeweavers.com>
PR binutils/14302
* bucomm.c (print_arelt_descr): Correctly report the archive size
field (for 'ar tv').
* ar.c (print_contents): Use correct types for archive element
sizes (for 'ar p').
(extract_file): Likewise (for 'ar x').
2012-06-29 Alan Modra <amodra@gmail.com>
* readelf.c (is_16bit_abs_reloc): Handle mn10200 reloc.
2012-06-12 Tom Tromey <tromey@redhat.com>
* dwarf-mode.el: Add final comment. Bump version.
(dwarf-insert-substructure-button): Use string-to-number.
(dwarf-browse): Fix autoload cookie.
2012-06-08 Jakub Jelinek <jakub@redhat.com>
* dwarf.c (read_and_display_attr_value): Handle
DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt.
(display_debug_macro): Handle DW_MACRO_GNU_define_indirect_alt,
DW_MACRO_GNU_undef_indirect_alt and
DW_MACRO_GNU_transparent_include_alt.
2012-06-01 Alan Modra <amodra@gmail.com>
* addr2line.c (translate_addresses): Truncate input addresses to
arch_size bits. Avoid undefined shift. Print '?' for zero line.
2012-05-30 Nick Clifton <nickc@redhat.com>
* readelf.c (process_section_headers): Correct bug in previous
delta - display full section type in wide mode.
2012-05-28 Nick Clifton <nickc@redhat.com>
* readelf.c (print_symbol): Display multibyte characters in symbol
names.
(process_section_headers): Use print_symbol.
2012-05-18 Andreas Schwab <schwab@linux-m68k.org>
* aclocal.m4: Regenerate.
* configure: Regenerate.
* config.in: Regenerate.
* Makefile.in: Regenerate.
2012-05-17 Daniel Richard G. <skunk@iskunk.org>
Nick Clifton <nickc@redhat.com>
PR 14072
* configure.in: Add check that sysdep.h has been included before
any system header files.
* configure: Regenerate.
* config.in: Regenerate.
* unwind-ia64.h: Include config.h.
2012-05-17 Alan Modra <amodra@gmail.com>
* dwarf.c (process_debug_info): Display abbrev offset in hex.
(display_debug_abbrev): Show offset of abbrev.
2012-05-17 Alan Modra <amodra@gmail.com>
* dwarf.c (display_debug_ranges): Don't report more than one use
of the same range set as an overlap.
2012-05-16 Daniel Richard G. <skunk@iskunk.org>
PR binutils/13558
* Makefile.am (CFILES): Add syslex_wrap.c.
(sysinfo): Depend upon syslex_wrap.o.
(syslex_wrap.o): New rule.
(syslex.o): Delete rule.
* syslex_wrap.c: New file.
* Makefile.in: Regenerate.
2012-05-15 James Murray <jsm@jsm-net.demon.co.uk>
* readelf.c (get_machine_name): Update m68hc12 entry.
2012-05-13 H.J. Lu <hongjiu.lu@intel.com>
* objdump.c (disassemble_bytes): Print addend as signed.
(dump_reloc_set): Likewise.
2012-05-04 Sterling Augustine <saugustine@google.com>
Cary Coutant <ccoutant@google.com>
* doc/binutils.texi: Add --dwarf-check option.
* dwarf.c (dwarf_check): New global flag.
(fetch_indexed_string): New function.
(fetch_indexed_value): New function.
(get_FORM_name): Add DW_FORM_GNU_str_index and DW_FORM_GNU_addr_index.
(decode_location_expression): Add DW_OP_GNU_addr_index.
(read_and_display_attr_value): Add DW_FORM_GNU_str_index,
DW_FORM_GNU_addr_index, DW_AT_GNU_addr_base, and DW_AT_GNU_ranges_base.
(get_AT_name): Add new attributes for Fission.
(process_debug_info): Load new debug sections for Fission.
(load_debug_info): Check for .debug_info.dwo section.
(display_loc_list, display_loc_list_dwo): New functions.
(display_debug_loc): Move logic to above two functions.
(display_debug_info): Choose abbrev section based on info section.
(display_debug_types): Likewise.
(display_trace_info): Likewise.
(comp_addr_base): New function.
(display_debug_addr): New function.
(display_debug_str_offsets): New function.
(display_debug_ranges): Allow missing range lists. Suppress
diagnostics if dwarf_check not set.
(debug_displays): Add column to select abbrev section.
* dwarf.h (enum dwarf_section_display_enum): Add new debug sections
for Fission.
(struct dwarf_section): Add abbrev_sec field.
(struct dwarf_section_display): New type.
(debug_info): Add addr_base, ranges_base fields.
(dwarf_check): New global variable.
* objdump.c (usage): Add --dwarf-check option.
(enum option_values): Add OPTION_DWARF_CHECK.
(long_options): Add --dwarf-check.
(main): Likewise.
* readelf.c (OPTION_DWARF_CHECK): New macro.
(options): Add --dwarf-check.
(parse_args): Likewise.
(process_section_headers): Use const_strneq instead of
streq.
2012-05-11 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/14088
* readelf.c (dump_relocations): Always display addend as
signed hex number.
2012-05-11 Daniel Richard G. <skunk@iskunk.org>
PR binutils/14028
* configure.in: Invoke ACX_HEADER_STRING.
* configure: Regenerate.
* config.in: Regenerate.
* sysdep.h: If STRINGS_WITH_STRING is defined then include both
string.h and strings.h.
2012-05-10 Jakub Jelinek <jakub@redhat.com>
* dwarf.c (read_and_display_attr_value): Don't look up tag from
abbrev for DW_FORM_ref_addr.
2012-05-08 Sean Keys <skeys@ipdatasys.com>
* binutils/MAINTAINERS: Added my entry to the maintainers secion.
2012-05-08 Cary Coutant <ccoutant@google.com>
* doc/binutils.texi (objcopy): Add --strip-dwo, --extract-dwo options.
(strip): Add --strip-dwo option.
* objcopy.c (enum strip_action): Add STRIP_DWO, STRIP_NONDWO.
(enum command_line_switch): Add OPTION_EXTRACT_DWO, OPTION_STRIP_DWO.
(strip_options): Add --strip-dwo option.
(copy_options): Add --extract-dwo, --strip-dwo options.
(copy_usage): Likewise.
(strip_usage): Add --strip-dwo option.
(is_dwo_section): New function.
(is_strip_section_1): Check for DWO sections.
(copy_object): Check for --strip-dwo, --extract-dwo options.
(copy_relocations_in_section): Discard relocations for DWO sections.
Discard entire relocation section when no relocations.
(strip_main): Add --strip-dwo option.
(copy_main): Add --strip-dwo, --extract-dwo options.
2012-05-08 Alan Modra <amodra@gmail.com>
* Makefile.am (check_DEJAGNU): Export LC_ALL=C in place of other
LC and LANG environment vars.
* Makefile.in: Regenerate.
2012-05-07 Tom Tromey <tromey@redhat.com>
* dwarf.c (get_TAG_name): Use get_DW_TAG_name.
(get_FORM_name): Use get_DW_FORM_name.
(get_AT_name): Use get_DW_AT_name.
2012-05-07 Alan Modra <amodra@gmail.com>
* Makefile.am (check-DEJAGNU): Clear LC_COLLATE, LC_ALL and LANG.
* Makefile.in: Regenerate.
2012-05-05 Alan Modra <amodra@gmail.com>
* dlltool.c (make_one_lib_file): Use bfd_und_section_ptr.
2012-05-03 Sean Keys <skeys@ipdatasys.com>
* readelf.c: Add support for XGATE.
2012-05-02 Nick Clifton <nickc@redhat.com>
* po/vi.po: Updated Vietnamese translation.
* po/it.po: New Italian translation.
* configure.in (ALL_LINGUAS): Add it.
* configure: Regenerate.
2012-05-01 Nick Clifton <nickc@redhat.com>
PR binutils/13121
* rescoff.c: Rename 'finfo' to 'flaginfo' to avoid conflicts with
AIX system headers.
2012-04-25 Cary Coutant <ccoutant@google.com>
* doc/binutils.texi: Add -D/--enable-deterministic-archives option
to strip and objcopy.
* objcopy.c (deterministic): New global variable.
(strip_options): Add --enable-deterministic-archives.
(copy_options): Likewise.
(copy_usage): Likewise.
(strip_usage): Likewise.
(copy_archive): When stripping all, don't add archive map; set
deterministic output when requested.
(strip_main): Add -D/--enable-deterministic-archives option.
(copy_main): Likewise.
2012-04-12 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/13947
* objcopy.c (copy_object): Call copy_relocations_in_section
before copy_section.
(skip_section): New.
(copy_relocations_in_section): Likewise.
(copy_section): Use skip_section. Don't copy relocations here.
2012-04-11 Ryan Mansfield <rmansfield@qnx.com>
* objdump.c (dump_bfd): If defaulting to dwarf call
dwarf_select_sections_all to enable displays.
2012-04-06 Roland McGrath <mcgrathr@google.com>
* configure.in (AC_CHECK_HEADERS): Add locale.h.
* config.in: Regenerate.
* configure: Regenerate.
2012-04-05 Nick Clifton <nickc@redhat.com>
* configure.in (AC_CHECK_FUNCS): Add setlocale.
(AM_LC_MESSAGES): Add.
* aclocal.m4: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
2012-03-30 Nick Clifton <nickc@redhat.com>
PR binutils/13925
* stabs.c (stab_demangle_v3_arglist): Cope with the demangler
returning an empty context for a function with no arguments.
2012-03-28 Tom Tromey <tromey@redhat.com>
* dwarf.c (display_gdb_index): Handle index version 6.
2012-03-07 Nick Clifton <nickc@redhat.com>
* readelf.c (is_16bit_abs_reloc): Add detection of R_MN10300_16.
2012-02-29 Jeff Law <law@redhat.com>
* doc/binutils.texi (c++filt): Fix typos.
2012-02-24 Kai Tietz <ktietz@redhat.com>
PR binutils/13710
* defparse.y (keyword_as_name): Disable LIBRARY
keyword.
* doc/binutils.texi: Document LIBRARY exception.
2012-02-21 Kai Tietz<ktietz@redhat.com>
PR binutils/13682
* NEWS: Mention new feature.
* dlltool.c (i386_x64_dljtab): New stub-code for x64
delayed-load feature.
(i386_x64_trampoline): New trampoline-code for x64
delayed-load feature.
(make_one_lib_file): Add support for x64 delayed-load
feature.
(make_delay_head): Likewis
2012-02-20 Namhyung Kim <namhyung.kim@lge.com>
* objdump.c (slurp_file): Close file if fstat fails.
2012-02-14 Cary Coutant <ccoutant@google.com>
* dwarf.c (dwarf_vmatoa64): New function.
(read_and_display_attr_value): Print 8-byte forms as single hex
numbers.
(process_debug_info): Print type signatures as single hex numbers.
* elfcomm.c (byte_get_64): New function.
* elfcomm.h (byte_get_64): New function.
2012-02-11 Kai Tietz <ktietz@redhat.com>
PR binutils/13657
* defparse.y (%union): New type id_const.
(opt_name2): New rule.
(keyword_as_name): New rule.
(opt_name): Adjust rule.
(opt_import_name): Likewise.
(opt_equal_name): Likewise.
2012-02-11 Kai Tietz <ktietz@redhat.com>
PR binutils/13297
* resrc.c (write_rc_dialog_control): Omit text dump for
EDITTEXT, COMBOBOX, LISTBOX, and SCROLLBAR.
2012-02-09 Alan Modra <amodra@gmail.com>
* sysdep.h: Include sys/stat.h here.
* ar.c: Don't include headers already included by sysdep.h.
* bucomm.c: Likewise.
* budbg.h: Likewise.
* dlltool.h: Likewise.
* elfedit.c: Likewise.
* nlmconv.c: Likewise.
* objcopy.c: Likewise.
* objdump.c: Likewise.
* objdump.h: Likewise.
* readelf.c: Likewise.
* rename.c: Likewise.
* resrc.c: Likewise.
* strings.c: Likewise.
* windres.c: Likewise.
* od-macho.c: Ensure #include sysdep.h is first.
* od-xcoff.c: Likewise.
* dllwrap.c: Remove alloca pragma handled by sysdep.h, and
remove duplicate headers.
* dlltool.c: Likewise and ensure #include sysdep.h is first.
2012-02-01 Nick Clifton <nickc@redhat.com>
PR binutils/13493
* ar.c (ranlib_main): Process --plugin option.
* doc/binutils.texi: Document --plugin support for ranlib.
2012-02-01 Nick Clifton <nickc@redhat.com>
PR binutils/13482
* readelf.c (process_corefile_note_segment): Fix off-by-one errors
verifying the contents of a note.
2012-01-26 Nick Clifton <nickc@redhat.com>
PR binutils/13622
* readelf.c (process_section_groups): If there are no section
headers do not scan for section groups.
(process_note_sections): Likewise for note sections.
2012-01-20 Tristan Gingold <gingold@adacore.com>
* od-macho.c (OPT_SEG_SPLIT_INFO): New macro.
(options): Add an entry for seg_split_info.
(mach_o_help): Document it.
(dump_segment_split_info): New function.
(dump_load_command): Handle seg_split_info.
2012-01-19 Tristan Gingold <gingold@adacore.com>
* dwarf.c (process_extended_line_op): Add a cast to silent a
warning.
2012-01-19 Tristan Gingold <gingold@adacore.com>
* dwarf.c (process_extended_line_op): Reindent define_file output.
Detect define_file opcode length mismatch.
(display_debug_lines_decoded): Add an entry in file_table for each
define_file opcode.
Ignore DW_LNE_set_discriminator and DW_LNE_HP_set_sequence.
Display extended opcode for unhandle opcode.
2012-01-17 Alan Modra <amodra@gmail.com>
* version.c (print_version): Update copyright message year.
2012-01-16 Alan Modra <amodra@gmail.com>
PR binutils/13593
* nm.c (OPTION_SIZE_SORT): Define.
(long_options): Don't set no_sort, sort_numerically or
sort_by_size directly.
(main): Instead set the flags here, making them mutually exclusive.
2012-01-10 Tristan Gingold <gingold@adacore.com>
* objdump.c (display_object_bfd): Renamed from ...
(display_bfd): ... this.
(display_any_bfd): New function.
(display_file): Split. Handle nested archives.
2012-01-09 Roland McGrath <mcgrathr@google.com>
* configure.in: Use AM_ZLIB.
* configure: Regenerated.
2012-01-06 Nick Clifton <nickc@redhat.com>
* po/ru.po: Updated Russian translation.
2012-01-04 Tristan Gingold <gingold@adacore.com>
* od-macho.c (dump_load_command): Handle fvmlib.
2012-01-04 Tristan Gingold <gingold@adacore.com>
* od-macho.c: Update copyright year.
(dump_load_command): Handle BFD_MACH_O_LC_ENCRYPTION_INFO.
For older changes see ChangeLog-2011
Copyright (C) 2012 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
Local Variables:
mode: change-log
left-margin: 8
fill-column: 74
version-control: never
End:

View File

@ -0,0 +1,681 @@
2013-12-31 Nick Clifton <nickc@redhat.com>
* objcopy.c (dump_sections): New list.
(command_line_switch): Add OPTION_DUMP_SECTION.
(copy_options): Add dump-section.
(copy_usage): Document new option.
(copy_object): Dump requested sections.
(copy_main): Handle --dump-section.
* doc/binutils.texi: Document --dump-section option.
* NEWS: Mention new feature.
2013-12-20 Nick Clifton <nickc@redhat.com>
PR binutils/16218
* dwarf.c (read_and_display_attr_value): Only print a tab
character if it preceeds further text.
2013-12-19 Tom Tromey <tromey@redhat.com>
* dwarf.c (fetch_indirect_string): Don't bias by section address.
(fetch_indexed_string): Likewise.
(process_debug_info): Likewise.
(display_debug_loc): Likewise.
(display_debug_ranges): Likewise.
2013-12-13 Kuan-Lin Chen <kuanlinchentw@gmail.com>
Wei-Cheng Wang <cole945@gmail.com>
* readelf.c: Include elf/nds32.h
(guess_is_rela): Add case for EM_NDS32.
(dump_relocations): Add case for EM_NDS32.
(decode_NDS32_machine_flags): New.
(get_machine_flags): Add case for EM_NDS32.
(is_32bit_abs_reloc): Likewise.
(is_16bit_abs_reloc): Likewise.
(process_nds32_specific): New.
(process_arch_specific): Add case for EM_NDS32.
* NEWS: Announce Andes nds32 support.
* MAINTAINERS: Add nds32 maintainers.
2013-12-10 Roland McGrath <mcgrathr@google.com>
* Makefile.am (install-exec-local): Prefix libtool invocation with
$(INSTALL_PROGRAM_ENV).
* Makefile.in: Regenerate.
2013-11-22 Cory Fields <cory@coryfields.com>
* windres.c (define_resource): Use zero for timestamp, making
output deterministic. time.h include is no longer needed.
* resres.c (res_append_resource): Likewise.
2013-11-13 Martin Mitas <mity@morous.org>
* rescoff.c (write_coff_file): Use 64-bit alignment for resource
data.
(coff_res_to_bin): Likewise.
2013-11-07 Doug Evans <dje@google.com>
Add pretty-printing of .debug_gnu_pubnames, .debug_gnu_pubtypes.
* dwarf.c (get_gdb_index_symbol_kind_name): New function.
(display_debug_pubnames_worker): Renamed from display_debug_pubnames.
Add support for .debug_gnu_pubnames, .debug_gnu_pubtypes.
(display_debug_pubnames, display_debug_pubnames_gnu): New functions.
(display_gdb_index): Redo printing of symbol kind.
(debug_displays): Add .debug_gnu_pubnames, .debug_gnu_pubtypes.
* dwarf.h (dwarf_section_display_enum): Add gnu_pubnames, gnu_pubtypes.
* readelf.c (process_section_headers): Add gnu_pubnames, gnu_pubtypes.
2013-11-07 Roland McGrath <mcgrathr@google.com>
* objdump.c (dump_dwarf): Grok bfd_mach_x86_64_nacl and
bfd_mach_x64_32_nacl as equivalent to bfd_mach_x86_64.
2013-10-30 Alan Modra <amodra@gmail.com>
* readelf.c (get_ppc_dynamic_type): Replace PPC_TLSOPT with PPC_OPT.
(get_ppc64_dynamic_type): Replace PPC64_TLSOPT with PPC64_OPT.
2013-10-30 Ulrich Weigand <uweigand@de.ibm.com>
* readelf.c (get_ppc64_symbol_other): New function.
(get_symbol_other): Use it for EM_PPC64.
2013-10-30 Alan Modra <amodra@gmail.com>
* readelf.c (get_machine_flags): Display ABI version for EM_PPC64.
2013-10-24 Nick Clifton <nickc@redhat.com>
* nm.c (display_rel_file): Treat bfd_error_no_symbols as
non-fatal.
2013-10-14 Chao-ying Fu <Chao-ying.Fu@imgtec.com>
* readelf.c (display_mips_gnu_attribute): Support Tag_GNU_MIPS_ABI_MSA.
* doc/binutils.texi: Document -Mmsa disassembler option.
2013-10-14 Jan-Benedict Glaw <jbglaw@lug-owl.de>
* readelf.c (decode_arm_unwind): Don't initialize `addr'.
2013-10-14 Nick Clifton <nickc@redhat.com>
* readelf.c (decode_arm_unwind): Initialise addr structure.
(process_symbol_table): Free lengths.
* srcconv.c (wr_sc): Free info.
2013-10-11 Roland McGrath <mcgrathr@google.com>
* winduni.c (languages): Use \345 (octal syntax) rather than
literal non-ASCII/non-UTF8 character in string literal.
* readelf.c (print_dynamic_symbol): Use array subscript syntax
rather than addition syntax with string literal.
2013-10-09 Nick Clifton <nickc@redhat.com>
PR binutils/16023
* debug.c (debug_type_samep): Add missing break statement.
PR binutils/16024
* objdump.c (usage): Mark as a no-return function.
(main): Add comment explaining why a break statement is not
needed.
* dwarf.c (add64): New function.
(read_and_display_attr_value): Add CU offset in to the value
displayed for a DW_AT_ref8 attribute.
2013-10-01 Cory Fields <cory@coryfields.com>
* arsup.c (ar_save): Respect the deterministic setting when
reading from an mri script.
* ar.c (main): Set the default deterministic mode when reading
from an mri script.
2013-10-01 Jan-Benedict Glaw <jbglaw@lug-owl.de>
* dwarf.c (SAFE_BYTE_GET): Fix argument check.
2013-09-27 H.J. Lu <hongjiu.lu@intel.com>
* dwarf.c (display_debug_frames): Pass offset_size to
print_dwarf_vma for cie_id.
2013-09-20 Alan Modra <amodra@gmail.com>
* configure: Regenerate.
2013-09-18 Tristan Gingold <gingold@adacore.com>
* NEWS: Add marker for 2.24.
2013-09-18 Tristan Gingold <gingold@adacore.com>
* Makefile.am (LEXLIB): Define. Replase references to @LEXLIB@
by $(LEXLIB).
* Makefile.in: Regenerate.
2013-09-17 Doug Gilmore <Doug.Gilmore@imgtec.com>
* readelf.c (get_machine_flags): Handle EF_MIPS_FP64.
2013-09-12 Nick Clifton <nickc@redhat.com>
* dwarf.c (dwarf_vmatoa): Rename to dwarf_vmatoa_1 and add a
precision parameter.
(dwarf_vmatoa): New wrapper for dwarf_vmatoa_1.
(print_dwarf_vma): Use dwarf_vmatoa_1.
(SAFE_BYTE_GET): Add check that VAL is big enough to contain
AMOUNT bytes.
(process_debug_info): Use an unsigned int for the offset size.
(process_debug_pubnames): Likewise.
(display_debug_aranges): Likewise.
(struct Frame_Chunk): Use dwarf_vma type for pc_begin and pc_range
fields.
(frame_display_row): Use print_dwarf_vma to display dwarf_vma
values.
(display_debug_frames): Likewise.
2013-09-10 Nick Clifton <nickc@redhat.com>
* dwarf.c (display_debug_frames): Check for DW64_CIE_ID when
parsing 64-bit frames.
2013-08-27 Nick Clifton <nickc@redhat.com>
PR binutils/15796
* ar.c (map_over_members): Correctly handle multiple same-name
entries on the command line and in the archive.
2013-08-23 H.J. Lu <hongjiu.lu@intel.com>
* doc/binutils.texi: Remove the extra space.
2013-08-23 Mikael Pettersson <mikpe@it.uu.se>
PR binutils/15779
* doc/binutils.texi (ranlib -D): Correct description.
PR binutils/15777
(nm --special-syms): Fix typo.
2013-08-23 Nick Clifton <nickc@redhat.com>
PR binutils/15798
* doc/binutils.texi (ar cmdline): Update description of 'q'
command.
PR binutils/14136
(nm): Add description of 'I' symbol type.
2013-08-23 Yuri Chornoivan <yurchor@ukr.net>
PR binutils/15834
* od-xcoff.c: Fix typos.
2013-08-19 Tristan Gingold <gingold@adacore.com>
* nm.c (print_size_symbols): Directly get symbol size.
2013-08-12 Andreas Schwab <schwab@suse.de>
PR binutils/15818
* objdump.c (disassemble_section): Return early if nothing from
this section needs to be disassembled.
2013-08-09 Nick Clifton <nickc@redhat.com>
* readelf.c (get_machine_flags): Handle RL78 G10 flag.
2013-07-26 Sergey Guriev <sergey.s.guriev@intel.com>
Alexander Ivchenko <alexander.ivchenko@intel.com>
Maxim Kuznetsov <maxim.kuznetsov@intel.com>
Sergey Lega <sergey.s.lega@intel.com>
Anna Tikhonova <anna.tikhonova@intel.com>
Ilya Tocar <ilya.tocar@intel.com>
Andrey Turetskiy <andrey.turetskiy@intel.com>
Ilya Verbin <ilya.verbin@intel.com>
Kirill Yukhin <kirill.yukhin@intel.com>
Michael Zolotukhin <michael.v.zolotukhin@intel.com>
* dwarf.c (dwarf_regnames_i386): Add k0-k7 registers and
numeration in comments.
(dwarf_regnames_x86_64): Add xmm16-31 and k0-k7 registers to
dwarf table.
2013-07-19 Nick Clifton <nickc@redhat.com>
PR binutils/15745
* readelf.c (get_unwind_section_word): Whilst searching for a
reloc section associated with an unwind section, check the type as
well as the section number.
2013-07-18 Jim Thomas <thomas@cfht.hawaii.edu>
* ar.c (usage): Fix C conformance issue.
2013-07-18 Nick Clifton <nickc@redhat.com>
* doc/binutils.texi (nm, objdump): Remove bogus links to STABS
documentation.
* readelf.c (process_unwind): Do not return the result of a void
function.
2013-07-15 Maciej W. Rozycki <macro@codesourcery.com>
* readelf.c (display_mips_gnu_attribute): Replace hardcoded magic
numbers with enum values.
2013-07-12 Maciej W. Rozycki <macro@codesourcery.com>
* readelf.c (get_machine_flags): Handle EF_MIPS_NAN2008.
2013-07-10 Tristan Gingold <gingold@adacore.com>
* od-xcoff.c (OPT_LDINFO): Define.
(options): Add ldinfo.
(xcoff_help): Mention ldinfo.
(xcoff_dump): Rename to ...
(xcoff_dump_obj): ... this. Add a break.
(dump_dumpx_core): New function.
(xcoff_dump_core): Likewise.
(xcoff_dump): Likewise.
* doc/binutils.texi (objdump): Mention ldinfo.
2013-07-09 Tristan Gingold <gingold@adacore.com>
* configure.com: Add new defines to match changes in configure.
2013-05-28 Cary Coutant <ccoutant@google.com>
* dwarf.c (display_debug_lines_raw): Print section offsets.
2013-05-15 Cary Coutant <ccoutant@google.com>
* dwarf.c (SAFE_BYTE_GET64): Correct end-of-buffer check;
don't increment PTR.
(decode_location_expression): DW_OP_const2u should read 2 bytes.
(display_debug_lines_decoded): Adjust formatting.
* elfcomm.c (byte_get_little_endian): Add cases for 5-, 6-, and
7-byte reads.
(byte_get_big_endian): Likewise.
(byte_get_signed): Likewise.
2013-05-09 Andrew Pinski <apinski@cavium.com>
* doc/binutils.texi: Document -Mvirt disassembler option.
2013-05-02 Nick Clifton <nickc@redhat.com>
* readelf.c: Add support for MSP430X architecture.
2013-05-02 Nick Clifton <nickc@redhat.com>
* dwarf.c (display_debug_lines_raw): Do not treat .debug_line.dwo
sections as if they were fragmentary .debug_line sections.
(display_debug_lines_decoded): Likewise.
2013-04-29 Nick Clifton <nickc@redhat.com>
* dwarf.c (read_debug_line_header): New function. Reads in a
header in a .debug_line section.
(display_debug_lines_raw): Use new function. Handle fragmentary
.debug_line sections.
(display_debug_lines_decoded): Likewise.
* readelf.c (process_section_headers): Handle fragmenatry
.debug_line sections.
(display_debug_section): Likewise.
2013-04-26 Ian Lance Taylor <iant@google.com>
* MAINTAINERS: Add myself and Cary as gold maintainers.
2013-04-08 Tom Tromey <tromey@redhat.com>
* dwarf.c (process_debug_info): Check dwarf_cutoff_level.
2013-04-08 Tom Tromey <tromey@redhat.com>
* dwarf-mode.el: Bump version number.
(dwarf-mode): Remove autoload.
(dwarf-die-reference): Relax regexp.
2013-04-05 Alan Modra <amodra@gmail.com>
PR binutils/15324
* configure.in: Add strnlen to AC_CHECK_DECLS, sort.
* dwarf.c (strnlen): Provide fallback decl.
* config.in: Regnerate.
* configure: Regenerate.
2013-03-29 H.J. Lu <hongjiu.lu@intel.com>
* dwarf.c (process_debug_info): Increment hdrptr by 8 after
SAFE_BYTE_GET64.
2013-03-27 Phil Krylov <phil.krylov@gmail.com>
PR binutils/13409
* winduni.c (codepages[]): Use UTF-16LE.
(wind_MultiByteToWideChar): Likewise.
(wind_WideCharToMultiByte): Likewise.
2013-03-27 Alan Modra <amodra@gmail.com>
PR binutils/15206
* dwarf.c (read_and_display_attr_value): Cast format '*' arg to int.
2013-03-26 Nick Clifton <nickc@redhat.com>
PR binutils/15206
* dwarf.c (SAFE_BYTE_GET): New macro - checks remaining buffer
space before calling byte_get.
(SAFE_BYTE_GET_AND_INC): New macro.
(SAFE_SIGNED_BYTE_GET): New macro.
(SAFE_SIGNED_BYTE_GET_AND_INC): New macro.
(SAFE_BYTE_GET64): New macro.
(process_extened_line_op): Use new macros. Use strnlen when
appropriate.
(fetch_indirect_string): Likewise.
(get_FORM_name): Likewise.
(decode_location_expression): Likewise.
(read_and_display_attr_value): Likewise.
(process_debug_info): Likewise.
(display_debug_lines_raw): Likewise.
(display_debug_lines_decoded): Likewise.
(display_debug_pubnames): Likewise.
(display_debug_macinfo): Likewise.
(get_line_filename_and_dirname): Likewise.
(display_debug_macro): Likewise.
(display_loc_list): Likewise.
(display_loc_list_dwo): Likewise.
(display_debug_aranges): Likewise.
(display_debug_ranges): Likewise.
(frame_display_row): Likewise.
(display_debug_frames): Likewise.
2013-03-25 Nick Clifton <nickc@redhat.com>
PR binutils/15202
* dwarf.c (read_leb128): Add END parameter. Do not read at or
beyond end.
(read_sleb128): Add END parameter.
(read_uleb128): New function.
(process_extended_line_op): Pass END to leb128 functions.
(process_abbrev_section): Likewise.
(decode_location_expression): Likewise.
(read_and_display_attr_value): Likewise.
(read_and_display_attr): Likewise.
(process_debug_info): Likewise.
(display_debug_lines_raw): Likewise.
(display_debug_lines_decoded): Likewise.
(display_debug_macinfo): Likewise.
(get_line_filename_and_dirname): Likewise.
(display_debug_macro): Likewise.
(display_loc_list_dwo): Likewise.
(display_debug_ranges): Likewise.
* dwarf.h (read_leb128): Update prototype.
* readelf.c (read_uleb128): Add END parameter.
(decode_arm_unwind_bytecode): Pass END to read_uleb128.
(decode_tic6x_unwind_bytecode): Likewise.
(display_tag_value): New function.
(display_arm_attribute): Add END parameter. Pass END to
read_uleb128. Use display_tag_value.
(display_gnu_attribute): Likewise.
(display_power_gnu_attribute): Likewise.
(display_sparc_gnu_attribute): Likewise.
(display_mips_gnu_attribute): Likewise.
(display_tic6x_attribute): Likewise.
(process_attributes): Likewise.
(display_raw_attribute): New function.
2013-03-22 Nick Clifton <nickc@redhat.com>
PR binutils/15201
* dwarf.c (display_debug_ranges): Add checks for reading beyond
the end of the section.
PR binutils/15157
* readelf.c (apply_relocations): Catch relocations with negative
offsets.
2013-03-15 Nick Clifton <nickc@redhat.com>
* addr2line.c (slurp_symtab): If canonicalization reveals that
there were no ordinary symbols, try loading the dynamic symbols
instead.
2013-03-14 Markos Chandras <markos.chandras@imgtec.com>
* MAINTAINERS: Add myself as Meta maintainer.
2013-03-08 Andreas Arnez <arnez@linux.vnet.ibm.com>
* readelf.c (get_note_type): Add NT_S390_TDB.
2013-03-07 Alan Modra <amodra@gmail.com>
* strings.c (get_char): Dispense with buf[]. Instead shift
chars into big-endian value and byte-swap later if
little-endian. Don't EOF check value read from object.
2013-03-05 Corinna Vinschen <vinschen@redhat.com>
* configure.in: Build DLL tools on x86_64-*-cygwin* as well.
* configure: Regenerate.
2013-03-04 Nick Clifton <nickc@redhat.com>
* elfcomm.c (error): Flush stdout before emitting the error
message.
(warn): Likewise.
2013-03-01 Cary Coutant <ccoutant@google.com>
* dwarf.c (cu_tu_indexes_read, shndx_pool, shndx_pool_size)
(shndx_pool_used): Move to top of file.
(struct cu_tu_set): New type.
(cu_count, tu_count, cu_sets, tu_sets): New file scope variables.
(fetch_indexed_string): Add "this_set" parameter. Update all callers.
(find_cu_tu_set_v2): New function.
(read_and_display_attr_value): Add "this_set" parameter.
(read_and_display_attr): Likewise.
(process_debug_info): Track base offsets for DWARF package files.
(load_debug_info): Call load_cu_tu_indexes.
(get_DW_SECT_short_name): New function.
(process_cu_tu_index): Add support for version 2 DWARF package files.
2013-02-27 Alan Modra <amodra@gmail.com>
PR binutils/15191
* readelf.c (offsetof): Define.
(CHECK_ENTSIZE_VALUES): Remove extraneous indefinite article.
(process_corefile_note_segment): Allow notes without name or
desc. Combine out-of-range checks. Disallow "negative"
notesz or descsz.
2013-02-26 Nick Clifton <nickc@redhat.com>
PR binutils/15191
* readelf.c (process_corefile_note_segment): Prevent attempts to
read beyond the end of the note buffer.
2013-02-15 Kai Tietz <ktietz@redhat.com>
* objcopy.c (copy_main): Initialize context variable.
2013-02-15 Nick Clifton <nickc@redhat.com>
PR binutils/15140
* ar.c (open_inarch): Fail on attempts to convert a normal archive
to a thin archive or vice versa.
* elfcomm.c (make_qualified_name): Handle corrupted thin
archives.
* readelf.c (process_archive): Likewise.
* doc/binutils.texi: Clarify documentation describing thin
archives.
2013-02-15 Nick Clifton <nickc@redhat.com>
PR binutils/15033
* objcopy.c (enum change_action): Delete.
(struct section_list): Delete remove, copy, change_vma, change_lma
and set_flags fields. Add context field.
(find_section_list): Add a context parameter. Add support for
wildcard characters in section names.
(is_strip_section): Check for sections being both copied and
removed.
(copy_object): Pass context to find_section_list.
(setup_section): Likewise.
(copy_section): Likewise.
(copy_main): Likewise.
* doc/binutils: Document the new behaviour.
* NEWS: Mention the new feature
2013-02-14 Nick Clifton <nickc@redhat.com>
PR binutils/15125
* objcopy.c (copy_object): Provide a helpful warning message when
adding a gnu_debuglink section to an object which already contains
one.
2013-02-07 Nick Clifton <nickc@redhat.com>
* elfcomm.c (get_archive_member_name): Prevent seg-fault if a
corrupt archive uses long names but has no long name table.
2013-02-06 Sandra Loosemore <sandra@codesourcery.com>
Andrew Jenner <andrew@codesourcery.com>
Based on patches from Altera Corporation.
* readelf.c: Include elf/nios2.h.
(dump_relocations): Add case for EM_ALTERA_NIOS2.
(get_nios2_dynamic_type): New.
(get_dynamic_type): Add case for EM_ALTERA_NIOS2.
(is_32bit_abs_reloc): Fix EM_ALTERA_NIOS2 case.
(is_16bit_abs_reloc): Likewise.
(is_none_reloc): Add EM_ALTERA_NIOS2 and EM_NIOS32 cases.
* NEWS: Note Altera Nios II support.
* MAINTAINERS: Add Nios II maintainers.
2013-01-29 Xi Wang <xi.wang@gmail.com>
* readelf.c (process_version_sections): Fix overflow checks to
avoid undefined behaviour.
2013-01-28 Doug Evans <dje@google.com>
* dwarf.c (display_gdb_index): Handle .gdb_index version 8.
2013-01-28 Robert Schiele <rschiele@gmail.com>
* objcopy.c (parse_flags): Add merge and strings section flags.
2013-01-25 Cary Coutant <ccoutant@google.com>
* dwarf.c (display_loc_list): Update offset for each line
printed.
(print_addr_index): New function.
(display_loc_list_dwo): Update offset for each line printed.
Fix problems displaying loclists in .dwo files. Add support
for type 4 entries.
(display_debug_loc): Remove custom header for .dwo files.
(display_debug_addr): Adjust formatting.
2013-01-25 Marco Atzeri <marco.atzeri@gmail.com>
* objcopy.c : Enable long section names for OPTION_ADD_GNU_DEBUGLINK.
2013-01-24 Doug Evans <dje@google.com>
* dwarf.c (display_debug_addr): Add missing parentheses to expression.
2013-01-24 Nick Clifton <nickc@redhat.com>
* readelf.c (get_machine_flags): Decode E_V850E3V5_ARCH.
2013-01-23 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* readelf.c: Add strings for NT_S390_LAST_BREAK and
NT_S390_SYSTEM_CALL.
2013-01-18 Nick Clifton <nickc@redhat.com>
PR binutils/15026
* addr2line.c (translate_addresses): When pretty printing, print
unknown function names on the same line as unknown symbol names.
2013-01-17 Nickolai Zeldovich <nickolai@csail.mit.edu>
* objdump.c (dump_target_specific): Fix NULL pointer test.
2013-01-16 Alan Modra <amodra@gmail.com>
PR binutils/15018
* stabs.c (parse_stab_members): Always set physname here to avoid
gcc warning..
(parse_stab_argtypes): ..and don't duplicate the init here.
2013-01-10 Will Newton <will.newton@imgtec.com>
* binutils/readelf.c: (guess_is_rela): Add EM_METAG.
(dump_relocations): Add EM_METAG.
(get_machine_name): Correct case for Meta.
(is_32bit_abs_reloc): Add support for Meta ADDR32 reloc.
(is_none_reloc): Add support for Meta NONE reloc.
2013-01-08 Yufeng Zhang <yufeng.zhang@arm.com>
* readelf.c (get_note_type): Handle NT_ARM_TLS, NT_ARM_HW_BREAK
and NT_ARM_HW_WATCH.
2013-01-07 Roland McGrath <mcgrathr@google.com>
* objcopy.c (deterministic): Make int rather than bfd_boolean,
initialize to -1.
(strip_options, copy_options): Add -U/--disable-deterministic-archives.
(default_deterministic): New function.
(strip_main, copy_main): Handle -U. Call default_deterministic.
(copy_usage, strip_usage): Describe -U. Cite whether -D or -U is
the default based on DEFAULT_AR_DETERMINISTIC.
* doc/binutils.texi (objcopy, strip): Describe -U and effect of
configure options on -D.
* ar.c (default_deterministic): Comment fix.
2013-01-07 Patrice Dumas <pertusus@free.fr>
* doc/binutils.texi: Fix ordering of top level nodes.
Replace erroneous uses of @itemx with @item.
2013-01-04 Andreas Schwab <schwab@linux-m68k.org>
* doc/binutils.texi (elfedit): Fix use of @itemx in @table.
2013-01-03 Marcus Shawcroft <marcus.shawcroft@arm.com>
* MAINTAINERS: Add myself as AArch64 co-maintainer.
2013-01-02 H.J. Lu <hongjiu.lu@intel.com>
* version.c (print_version): Update copyright year to 2013.
For older changes see ChangeLog-2012
Copyright (C) 2013 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
Local Variables:
mode: change-log
left-margin: 8
fill-column: 74
version-control: never
End:

View File

@ -0,0 +1,960 @@
2014-12-25 Thomas Preud'homme <thomas.preudhomme@arm.com>
* readelf.c (arm_attr_tag_ABI_VFP_args): Add "compatible".
2014-12-24 Alexander Cherepanov <cherepan@mccme.ru>
PR binutils/17671
* objcopy.c (copy_main, strip_main): Add D and U to the list of
accepted short versions of long options.
2014-12-24 Nick Clifton <nickc@redhat.com>
* dwarf.c (read_cie): Revert check for unused augmentation data -
it was bogus.
2014-12-23 Andrew Stubbs <ams@codesourcery.com>
* objcopy.c (strip_usage): Reword --remove-section description.
* doc/binutils.texi (strip): Likewise.
2014-12-23 Nick Clifton <nickc@redhat.com>
* doc/binutils.texi (objdump): Reformat to avoid overlong lines.
2014-12-22 H.J. Lu <hongjiu.lu@intel.com>
* dwarf.c (read_cie): Cast size to long to warn.
2014-12-22 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* dwarf.c (decode_location_expression): Check for an out of range
value for a DW_OP_GNU_entry_value expression.
(display_debug_lines_raw): Check for a partial
.debug_line. section being encountered without a prior, full
.debug.line section.
(display_debug_lines_decoded): Likewise. Also check for
li_line_range being zero.
(display_debug_pubnames_worker): Check for an invalid pn_length
field.
(read_cie): Add range checks.
* elfcomm.c (setup_archive): Check for a negative longnames_size.
2014-12-18 Mark Wielaard <mjw@redhat.com>
* dwarf.c (read_and_display_attr_value): Change display name of
DW_LANG_C11 from (ANSI C11) to (C11).
2014-12-11 Nick Clifton <nickc@redhat.com>
PR binutils/17512
* dwarf.c (display_gdb_index): Add more range checks.
2014-12-11 Alan Modra <amodra@gmail.com>
* configure.ac: Check for long long and sizes of long long and long.
* elfcomm.h (HOST_WIDEST_INT): Test HAVE_LONG_LONG in place of
__STDC_VERSION__ and __GNUC__.
* strings.c (print_strings): Likewise.
* dwarf.c (DWARF_VMA_FMT, DWARF_VMA_FMT_LONG): Likewise.
(read_debug_line_header): Use dwarf_vmatoa to print warning.
* configure: Regenerate.
* config.in: Regenerate.
2014-12-10 Alan Modra <amodra@gmail.com>
* objdump.c: #include "coff-bfd.h".
2014-12-09 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* od-elf32_avr.c (elf32_avr_dump_mem_usage): Fix device initialization.
2014-12-09 Nick Clifton <nickc@redhat.com>
PR binutils/17512
* objdump.c (display_any_bfd): Avoid infinite loop closing and
opening the same archive again and again.
2014-12-09 Chen Gang <gang.chen.5i5j@gmail.com>
* windres.c (open_file_search): Free path buffer on failure.
2014-12-08 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* dwarf.c (display_debug_frames): Check for a negative
augmentation data length.
(display_gdb_index): Check for invalid offsets.
* elfcomm.c (process_archive_index_and_symbols): Check for an
index number that overflows when multiplied by the ar index size.
* readelf.c (dump_ia64_unwind): Add range checks.
(slurp_ia64_unwind_table): Change to a boolean function. Add
range checks.
(process_version_sections): Add range checks.
(get_symbol_version_string): Add check for missing section
headers.
2014-12-08 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* configure.ac: Add od-elf32_avr to build.
* configure: Regenerate.
* od-elf32_avr.c: New file.
* objdump.h: Declare objdump_private_desc_elf32_avr.
2014-12-06 Eric Botcazou <ebotcazou@adacore.com>
* readelf.c: Include elf/visium.h.
(guess_is_rela): Deal with EM_VISIUM.
(dump_relocations): Likewise.
(get_machine_name): Likewise.
(get_machine_flags): Likewise.
(get_osabi_name): Likewise.
(is_32bit_abs_reloc): Likewise.
(is_32bit_pcrel_reloc): Likewise.
(is_16bit_abs_reloc): Likewise.
2014-12-05 Andrew Burgess <andrew.burgess@embecosm.com>
* readelf.c (decode_AVR_machine_flags): New function.
(get_machine_flags): Add EM_AVR case.
2014-12-03 Nick Clifton <nickc@redhat.com>
PR binutils/17512
* objdump.c (free_debug_section): Reset the compress_status as
well.
2014-12-03 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* readelf.c (get_machine_flags): Replace call to abort with a
warning message and a return value.
(get_elf_section_flags): Likewise.
(get_symbol_visibility): Likewise.
(get_ia64_symbol_other): Likewise.
(get_ia64_symbol_other): Likewise.
(is_32bit_abs_reloc): Likewise.
(apply_relocations): Likewise.
(display_arm_attribute): Likewise.
2014-12-02 Denis Chertykov <chertykov@gmail.com>
* MAINTAINERS: Fix my email address.
2014-12-01 H.J. Lu <hongjiu.lu@intel.com>
* dwarf.c (process_cu_tu_index): Properly check for an out of
range row index.
2014-12-01 Nick Clifton <nickc@redhat.com>
PR binutils/17512
* dwarf.h (struct dwarf_section): Add user_data field.
* dwarf.c (frame_need_space): Check for an over large register
number.
(display_debug_frames): Check the return value from
frame_need_space. Check for a CFA expression that is so long the
start address wraps around.
(debug_displays): Initialise the user_data field.
* objdump.c (load_specific_debug_section): Save the BFD section
pointer in the user_data field of the dwarf_section structure.
(free_debug_section): Update BFD section data when freeing section
contents.
* readelf.c (load_specific_debug_section): Initialise the
user_data field.
2014-12-01 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* dwarf.c (process_cu_tu_index): Check for an out of range row
index.
* elfcomm.c (adjust_relative_path): Change name_len parameter to
an unsigned long. Check for path length overflow.
(process_archive_index_and_symbols): Check for invalid header
size.
(setup_archive): Add checks for invalid archives.
(get_archive_member_name): Add range checks.
* elfcomm.h (adjust_relative_path): Update prototyoe.
* readelf.c (process_archive): Add range checks.
2014-11-28 Alan Modra <amodra@gmail.com>
* readelf.c (get_32bit_elf_symbols): Cast bfd_size_type values to
unsigned long for %lx.
(get_64bit_elf_symbols, process_section_groups): Likewise.
2014-11-27 Espen Grindhaug <espen@grindhaug.org>
Nick Clifton <nickc@redhat.com>
PR binutils/17531
* readelf.c (get_data): Move excessive length check to earlier on
in the function and allow for wraparound in the arithmetic.
(get_32bit_elf_symbols): Terminate early if the section size is
zero. Check for an invalid sh_entsize. Check for an index
section with an invalid size.
(get_64bit_elf_symbols): Likewise.
(process_section_groups): Check for an invalid sh_entsize.
2014-11-24 Mark Wielaard <mjw@redhat.com>
* dwarf.c (read_and_display_attr_value): Handle DW_LANG_C11,
DW_LANG_C_plus_plus_11 and DW_LANG_C_plus_plus_14.
2014-11-26 Nick Clifton <nickc@redhat.com>
PR binutils/17512
* dwarf.c (display_block): Do nothing if the block starts after
the end of the buffer.
(read_and_display_attr_value): Add range checks.
(struct Frame_Chunk): Make the ncols and ra fields unsigned.
(frame_need_space): Test for an ncols of zero.
(read_cie): Fail if the augmentation data extends off the end of
the buffer.
(display_debug_frames): Add checks for read_cie failing. Add
range checks.
2014-11-25 H.J. Lu <hongjiu.lu@intel.com>
* objdump.c (objdump_print_symname): Replace
bfd_elf_get_symbol_version_string with
bfd_get_symbol_version_string.
2014-11-25 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/16496
* objdump.c (objdump_print_symname): Call
bfd_elf_get_symbol_version_string to get ELF symbol version
string. Append version string if needed.
* readelf.c (versioned_symbol_info): New enum.
(get_symbol_version_string): New. Extracted from
process_symbol_table.
(dump_relocations): Add a new argument to indicate if dynamic
symbol table is used. Use get_symbol_version_string to get
symbol version string for dynamic symbol. Append version string
if needed.
(process_relocs): Updated dump_relocations call.
(process_symbol_table): Use get_symbol_version_string.
2014-11-24 H.J. Lu <hongjiu.lu@intel.com>
* configure: Regenerated.
2014-11-21 Nick Clifton <nickc@redhat.com>
PR binutils/17512
* dwarf.c (get_encoded_value): Check for an encoded size of 0.
(display_debug_lines_raw): Check for an invalid line range value.
(display_debug_frames): Check for corrupt augmentation data.
2014-11-21 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* readelf.c (process_version_sections): Prevent an infinite loop
processing corrupt version need data.
(process_corefile_note_segment): Handle corrupt notes.
2014-11-21 Terry Guo <terry.guo@arm.com>
* readelf.c (arm_attr_tag_FP_arch): Extended to support FPv5.
2014-11-19 Jan-Benedict Glaw <jbglaw@lug-owl.de>
* dwarf.c (process_extended_line_op): Fix signedness warning.
2014-11-18 Nick Clifton <nickc@redhat.com>
PR binutuls/17605
* bucomm.c (print_arelt_descr): Check for ctime returning NULL.
2014-11-18 Nick Clifton <nickc@redhat.com>
PR binutils/17512
* dwarf.c (get_encoded_value): Warn and return if the encoded
value is more than 64-bits long.
(SAFE_BYTE_GET): Do not attempt to read more than 64-bits.
(process_extended_line_op): Add more range checks.
(decode_location_expression): Use the return value from
display_block. Add more range checks.
(read_debug_line_header): Add range check.
(display_debug_lines_raw): Add range checks.
(display_debug_frames): Silently skip multiple zero terminators.
Add range checks.
(process_cu_tu_index): Check for non-existant or empty sections.
Use SAFE_BYTE_GET instead of byte_get.
2014-11-18 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* readelf.c (get_unwind_section_word): Skip reloc processing if
there are no relocs associated with the section.
(decode_tic6x_unwind_bytecode): Warn and return if the stack
pointer adjustment falls off the end of the buffer.
2014-11-14 Nick Clifton <nickc@redhat.com>
PR binutils/17512
* dwarf.c (get_encoded_value): Add an 'end' parameter. Change the
'data' parameter to a double pointer and return the updated value.
(decode_location_expression): Update call to get_encoded_value.
(frame_need_space): Handle the case where one or both of the
mallocs fails.
(read_cie): Initialise the cie pointer, even if the read fails.
(display_debug_frames): Warn if the calculated block_end is before
the start of the block. Break the loop if the CIE could not be
read. Update call to get_encoded_value. Warn if the read CFA
expressions are too big.
2014-11-13 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* readelf.c (process_version_sections): If the read of the version
def information fails, make sure that the external verdef data is
not used.
(get_dynamic_data): Do not attempt to allocate memory for more
dynamic data than there is in the file. If the read fails, free
the allocated buffer.
(process_symbol_table): Do not print dynamic information if we
were unable to read the dynamic symbol table.
(print_gnu_note): Do not print the note if the descsz is too
small.
2014-11-12 Nick Clifton <nickc@redhat.com>
PR binutils/17512
* dwarf.c (read_and_display_attr_value): Check that we do not read
past end.
(display_debug_pubnames_worker): Add range checks.
(process_debug_info): Check for invalid pointer sizes.
(display_loc_list): Likewise.
(display_loc_list_dwo): Likewise.
(display_debug_ranges): Likewise.
(display_debug_aranges): Check for invalid address size.
(read_cie): Add range checks. Replace call strchr with while loop.
* objdump.c (dump_dwarf): Replace abort with a warning message.
(print_section_stabs): Improve range checks.
* rdcoff.c (coff_get_slot): Use long for indx parameter type.
Add check for an excesively large index.
* rddbg.c (read_section_stabs_debugging_info): Zero terminate the
string table. Avoid walking off the end of the stabs data.
* stabs.c (parse_stab_string): Add check for a NULL name.
2014-11-11 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* binutils/readelf.c (dynamic_nent): Change type to size_t.
(slurp_rela_relocs): Use size_t type for nrelas.
(slurp_rel_relocs): Likewise.
(get_program_headers): Improve out of memory error message.
(get_32bit_section_headers): Likewise.
(get_32bit_section_headers): Likewise.
(get_64bit_section_headers): Likewise.
(get_32bit_elf_symbols): Likewise.
(get_64bit_elf_symbols): Likewise.
(process_section_groups): Likewise.
(get_32bit_dynamic_section): Likewise.
(get_64bit_dynamic_section): Likewise.
(process_dynamic_section): Likewise.
(process_version_sections): Likewise.
(get_symbol_index_type): Likewise.
(process_mips_specific): Likewise.
(process_corefile_note_segment): Likewise.
(process_version_sections): Use size_t type for total.
(get_dynamic_data): Change type of number parameter to size_t.
Improve out of memory error messages.
(process_symbol_table): Change type of nbuckets and nchains to
size_t. Skip processing of sections headers if there are none.
Improve out of memory error messages.
2014-11-11 Nick Clifton <nickc@redhat.com>
* po/fr.po: Updated French translation.
2014-11-11 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* readelf.c (display_arm_attribute): Avoid reading off the end of
the buffer when processing a Tag_nodefaults.
2014-11-10 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* (ia64_process_unwind): Replace assertion with an error message.
Add range checking for group section indicies.
(hppa_process_unwind): Replace assertion with an error message.
(process_syminfo): Likewise.
(decode_arm_unwind_bytecode): Add range checking.
(dump_section_as_strings): Add more string range checking.
(display_tag_value): Likewise.
(display_arm_attribute): Likewise.
(display_gnu_attribute): Likewise.
(display_tic6x_attribute): Likewise.
(display_msp430x_attribute): Likewise.
2014-11-10 Nick Clifton <nickc@redhat.com>
PR binutils/17552
* (copy_archive): Clean up temporary files even if an error
occurs.
2014-11-07 H.J. Lu <hongjiu.lu@intel.com>
* readelf.c (process_dynamic_section): Cast time value to unsigned
long to print.
2014-11-07 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* readelf.c (get_data): Avoid allocating memory when we know that
the read will fail.
(find_section_by_type): New function.
(get_unwind_section_word): Check for invalid symbol indicies.
Check for invalid reloc types.
(get_32bit_dynamic_section): Add range checks.
(get_64bit_dynamic_section): Add range checks.
(process_dynamic_section): Check for a corrupt time value.
(process_symbol_table): Add range checks.
(dump_section_as_strings): Add string length range checks.
(display_tag_value): Likewise.
(display_arm_attribute): Likewise.
(display_gnu_attribute): Likewise.
(display_tic6x_attribute): Likewise.
(display_msp430x_attribute): Likewise.
(process_mips_specific): Add range check.
2014-11-06 Nick Clifton <nickc@redhat.com>
PR binutils/17552, binutils/17533
* bucomm.c (is_valid_archive_path): New function. Returns false
for absolute pathnames and pathnames that include /../.
* bucomm.h (is_valid_archive_path): Add prototype.
* ar.c (extract_file): Use new function to check for valid
pathnames when extracting files from an archive.
* objcopy.c (copy_archive): Likewise.
* doc/binutils.texi: Update documentation to mention the
limitation on pathname of archive members.
2014-11-05 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* readelf.c (printable_section_name): New function.
(printable_section_name_from_index): New function.
(dump_relocations): Use new function.
(process_program_headers, get_32bit_elf_symbols,
(get_64bit_elf_symbols, process_section_headers,
(process_section_groups, process_relocs, ia64_process_unwind,
(hppa_process_unwind, get_unwind_section_word, decode_arm_unwind,
(arm_process_unwind, process_version_sections,
(process_symbol_table, apply_relocations, get_section_contents,
(dump_section_as_strings, dump_section_as_bytes,
(display_debug_section, process_attributes, process_mips_specific,
(process_mips_specific process_gnu_liblist): Likewise.
(get_unwind_section_word): Check for a missing symbol table.
Replace aborts with error messages.
(arm_process_unwind): Check for a missing string table.
(process_attributes): Check for an attribute length that is too
small.
(process_mips_specific): Check for a corrupt GOT symbol offset.
2014-11-05 Nick Clifton <nickc@redhat.com>
PR binutils/17533
* bucomm.c (is_valid_archive_path): New function.
* bucomm.h (is_valid_archive_path): Prototype it.
* ar.c (extract_file): Call is_valid_archive_path to verify a
member filename before extracting it.
* objcopy.c (copy_archive): Likewise.
2014-11-05 Jan-Benedict Glaw <jbglaw@lug-owl.de>
* readelf.c (process_mips_specific): Fix format string warning.
2014-11-04 Matthew Fortune <matthew.fortune@imgtec.com>
* readelf.c (process_mips_specific): Rename index to idx.
2014-11-04 Nick Clifton <nickc@redhat.com>
PR binutils/17531
* readelf.c (get_data): If the reason parameter is null, do not
print any error messages.
(get_32bit_section_headers): Verify section header entry size
before reading in the section headers.
(get_64bit_section_headers): Likewise.
(process_section_headers): Pass FALSE to get_section_headers.
(get_file_header): Pass TRUE to get_section_headers.
(process_dynamic_section): Change an assert to an error message.
(process_symbol_table): Handle corrupt histograms.
(get_32bit_program_headers): Verify program header entry size
before reading in the program headers.
(get_64bit_program_headers): Likewise.
(get_unwind_section_word): Do nothing if no section was provided.
Fail if the offset is outside of the section.
(print_dynamic_symbol): Catch out of range symbol indicies.
(process_mips_specific): Likewise.
(process_attributes): Make sure that there is enough space left in
the section before attempting to read the length of the next
attribute.
2014-11-03 Nick Clifton <nickc@redhat.com>
PR binutils/17512
* objdump.c (slurp_symtab): Fail gracefully if the table could not
be read.
(dump_relocs_in_section): Likewise.
2014-11-03 Nick Clifton <nickc@redhat.com>
* po/fi.po: Updated Finnish translation.
* po/sv.po: Updated Swedish translation.
2014-11-01 Hans-Peter Nilsson <hp@axis.com>
* readelf.c (get_32bit_elf_symbols): Cast error
parameters of bfd_size_type with the %lx format to
unsigned long.
2014-10-31 Andrew Pinski <apinski@cavium.com>
Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com>
* readelf.c (print_mips_isa_ext): Print the value of Octeon3.
2014-10-31 Iain Buclaw <ibuclaw@gdcproject.org>
* cxxfilt.c (main): Add case for dlang_demangling style.
2014-10-31 Nick Clifton <nickc@redhat.com>
PR binutils/17512
* readelf.c (process_program_headers): Avoid memory exhaustion due
to corrupt values in a dynamis segment header.
(get_32bit_elf_symbols): Do not attempt to read an over-large
section.
(get_64bit_elf_symbols): Likewise.
2014-10-31 Nick Clifton <nickc@redhat.com>
* strings.c: Add new command line option --data to only scan the
initialized, loadable data secions of binaries. Choose the
default behaviour of --all or --data based upon a configure
option.
* doc/binutils.texi (strings): Update documentation. Include
description of why the --data option might be unsafe.
* configure.ac: Add new option --disable-default-strings-all which
restores the old behaviour of strings using --data by default. If
the option is not used make strings use --all by default.
* NEWS: Mention the new behaviour of strings.
* configure: Regenerate.
* config.in: Regenerate.
2014-10-30 Nick Clifton <nickc@redhat.com>
* readelf.c (CHECK_ENTSIZE_VALUES): Rewrite error message so that
there is a single string for translation.
(dynamic_section_mips_val): Likewise.
2014-10-29 Nick Clifton <nickc@redhat.com>
* po/bg.po: Updated Bulgarian translation.
* po/sr.po: New Serbian translation.
* po/sv.po: Updated Swedish translation.
2014-10-22 Matthew Fortune <matthew.fortune@imgtec.com>
* readelf.c (print_mips_ases): Print unknown ASEs.
(print_mips_isa_ext): Print the value of an unknown extension.
2014-10-15 Tristan Gingold <gingold@adacore.com>
* configure: Regenerate.
2014-10-14 Tristan Gingold <gingold@adacore.com>
* NEWS: Add marker for 2.25.
2014-10-14 Alan Modra <amodra@gmail.com>
PR 17453
* dwarf.c (read_leb128): Avoid signed overflow.
(read_debug_line_header): Likewise.
2014-10-14 Alan Modra <amodra@gmail.com>
PR 17453
* readelf.c (process_program_headers): Correct fscanf format used
for interpreter.
2014-10-09 Jose E. Marchesi <jose.marchesi@oracle.com>
* readelf.c (display_sparc_hwcaps2): New function.
(display_sparc_gnu_attribute): Call `display_sparc_hwcaps2' when
handling `Tag_GNU_Sparc_HWCAPS2' attributes.
2014-09-22 Alan Modra <amodra@gmail.com>
PR 16563
* dwarf.c (GET): Remove semicolon.
(read_cie): New function, extracted from..
(display_debug_frames): ..here. Correctly handle signed offset
from FDE to CIE in .eh_frame. Decode forward referenced CIEs too.
2014-09-16 Nick Clifton <nickc@redhat.com>
* readelf.c (display_arm_attribute): Use unsigned int type for
tag, val and type variables.
2014-09-16 Kuan-Lin Chen <kuanlinchentw@gmail.com>
* readelf.c (decode_NDS32_machine_flags): Display ABI2 FP+.
2014-09-15 Andrew Bennett <andrew.bennett@imgtec.com>
Matthew Fortune <matthew.fortune@imgtec.com>
* readelf.c (get_machine_flags): Add support for mips32r6 and
mips64r6.
2014-09-01 Jon TURNEY <jon.turney@dronecode.org.uk>
* objcopy.c (is_nondebug_keep_contents_section): Change
'.build-id' to '.buildid'.
2014-08-22 Richard Henderson <rth@redhat.com>
* dwarf.h (init_dwarf_regnames_aarch64): Declare.
* dwarf.c (dwarf_regnames_aarch64): New.
(init_dwarf_regnames_aarch64): New.
(init_dwarf_regnames): Call it.
* objdump.c (dump_dwarf): Likewise.
2014-08-19 Alan Modra <amodra@gmail.com>
* configure: Regenerate.
2014-08-14 Alan Modra <amodra@gmail.com>
* configure.ac: Move ACX_LARGEFILE after LT_INIT.
* config.in: Regenerate.
* configure: Regenerate.
2014-07-29 Matthew Fortune <matthew.fortune@imgtec.com>
* readelf.c (get_mips_segment_type): Display name for PT_MIPS_ABIFLAGS.
(get_mips_section_type_name): Display name for SHT_MIPS_ABIFLAGS.
(display_mips_gnu_attribute): Abstracted fp abi printing to...
(print_mips_fp_abi_value): New static function. Handle new FP ABIs.
(print_mips_ases, print_mips_isa_ext): New static functions.
(get_mips_reg_size): Likewise.
(process_mips_specific): Display abiflags data.
2014-07-28 Alan Modra <amodra@gmail.com>
PR 13227
* nm.c (filter_symbols): Warn on __gnu_lto_slim.
2014-07-07 Nick Clifton <nickc@redhat.com>
* readelf.c (get_symbol_type): Revert accidental change to
detection of thumb function symbols.
2014-07-04 Alan Modra <amodra@gmail.com>
* configure.ac: Rename from configure.in.
* Makefile.in: Regenerate.
* config.in: Regenerate.
* doc/Makefile.in: Regenerate.
2014-07-04 Alan Modra <amodra@gmail.com>
* configure.in: Include bfd/version.m4.
(AC_INIT, AM_INIT_AUTOMAKE): Use modern form.
(BFD_VERSION): Delete.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Remove bfd/configure.in.
* configure: Regenerate.
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
2014-07-03 Tristan Gingold <gingold@adacore.com>
* doc/binutils.texi: Clarify addr2line output.
2014-07-01 Alan Modra <amodra@gmail.com>
* objdump.c (dump_bfd_header): Don't print HAS_LOAD_PAGE.
2014-06-26 Erik Akermann <kurterikackermann@gmail.com>
* strings.c: Add -w/--include-all-whitespace option to include any
whitespace character in the displayed strings.
* NEWS: Mention the new feature.
* doc/binutils.texi (strings): Document the new command line
option.
2014-06-26 Nick Clifton <nickc@redhat.com>
* readelf.c (process_note_sections): If there are no note sections
try processing note segments instead.
2014-06-17 Anton Lavrentiwev <lavr@ncbi.nim.nih.gov>
PR binutils/16923
* rcparse.y (fixedverinfo): Prevent large version numbers from
corrupting other values.
2014-06-09 Romain Chastenet <romain.chastenet@free.fr>
PR binutils/16252
* dwarf.c (display_debug_frames): Remember the state of the
cfa_offset, cfa_reg, ra and cfa_exp field
2014-06-05 Joel Brobecker <brobecker@adacore.com>
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Add dependency on
bfd's development.sh.
* Makefile.in, configure: Regenerate.
2014-05-16 Jon Turney <jon.turney@dronecode.org.uk>
* objcopy.c (is_nondebug_keep_contents_section): New function.
(setup_section): Use it.
2014-05-16 Kaushik Phata <Kaushik.Phatak@kpit.com>
* readelf.c (get_machine_flags): Handle RL78 64-bit doubles flag.
2014-05-02 Alan Modra <amodra@gmail.com>
* emul_aix.c: Update bfd target vector naming.
* testsuite/binutils-all/objcopy.exp: Likewise.
2014-04-24 Christian Svensson <blue@cmd.nu>
* MAINTAINERS: Add myself and Stefan as OR1K maintainers.
2014-04-23 Andrew Bennett <andrew.bennett@imgtec.com>
* doc/binutils.texi: Document the disassemble MIPS XPA instructions
command line option.
2014-04-22 Christian Svensson <blue@cmd.nu>
* readelf.c: Remove openrisc and or32 support. Add support for or1k.
2014-04-18 Tristan Gingold <gingold@adacore.com>
* od-macho.c (dump_section_map): Adjust as load commands
are now chained.
(dump_load_command, dump_section_content): Likewise.
2014-04-16 Tristan Gingold <gingold@adacore.com>
* od-macho.c (OPT_DYLD_INFO): New macro.
(options): Add entry for dyld_info.
(mach_o_help): Likewise.
(load_and_dump, dump_dyld_info_rebase, dump_dyld_info_bind)
(dump_dyld_info_export_1, dump_dyld_info_export): New functions.
(bfd_mach_o_dyld_rebase_type_name): New array.
(export_info_data): New struct.
(dump_dyld_info): Add verbose argument. Dump rebase, bind and
exports data.
(dump_load_command): Adjust dump_dyld_info call.
(mach_o_dump): Handle dyld_info.
2014-04-16 Tristan Gingold <gingold@adacore.com>
* od-macho.c (dump_header): Display sizeofcmds in decimal too.
(dump_segment): Reformat output.
(dump_dyld_info): Also display end offsets.
(dump_load_command): Add IDX argument, display commands size
and offset, reformat display.
(dump_load_commands): Adjust for added argument.
2014-04-07 Alan Modra <amodra@gmail.com>
PR binutils/16811
* objcopy.c (copy_object): Error if no sections.
2014-04-03 Markus Trippelsdorf <markus@trippelsdorf.de>
PR binutils/14698
ar.c: Set plugin_target early if plugins are supported.
nm.c: Likewise.
2014-04-03 Tristan Gingold <gingold@adacore.com>
* od-macho.c (printf_uint64): New function.
(dump_load_command, dump_obj_compact_unwind): Use it.
(dump_exe_compact_unwind): Display personality functions.
2014-04-02 Tristan Gingold <gingold@adacore.com>
* od-macho.c (OPT_TWOLEVEL_HINTS): New macro.
(options): Add entry for twolevel_hints.
(dump_data_in_code): Fix error message.
(dump_twolevel_hints): New function.
(dump_load_command): Handle prebound dylib, prebind cksum
and twolevel hints.
(mach_o_dump): Handle twolevel hints.
2014-04-01 Tristan Gingold <gingold@adacore.com>
* od-macho.c (OPT_DATA_IN_CODE): New macro.
(options): Add entry for data in code.
(mach_o_help): Ditto.
(data_in_code_kind_name): New array.
(dump_data_in_code): New function.
(dump_load_command): Handle data in code.
(mach_o_dump): Ditto.
(dump_header): Display a terminal newline.
2014-03-27 Tristan Gingold <gingold@adacore.com>
* od-macho.c (dump_load_command): Display value for
BFD_MACH_O_LC_DYLD_ENVIRONMENT. Handle BFD_MACH_O_LC_DATA_IN_CODE
and BFD_MACH_O_LC_DYLIB_CODE_SIGN_DRS.
2014-03-27 Tristan Gingold <gingold@adacore.com>
* od-macho.c (OPT_FUNCTION_STARTS): New macro.
(options): Add entry for function_starts.
(mach_o_help): Ditto.
(disp_segment_prot): New function.
(dump_section_map): Call disp_segment_prot.
(dump_function_starts): New function.
(dump_obj_compact_unwind): Fix ouput indentation.
(dump_exe_compact_unwind): Fix ouput indentation.
(mach_o_dump): Handle function_starts.
2014-03-26 Tristan Gingold <gingold@adacore.com>
* od-macho.c (bfd_mach_o_cpu_name): Add BFD_MACH_O_CPU_TYPE_ARM64.
2014-03-24 Tristan Gingold <gingold@adacore.com>
* objdump.c (load_specific_debug_section): Set address of section.
2014-03-24 Tristan Gingold <gingold@adacore.com>
* od-macho.c (dump_unwind_encoding_x86): Set the factor.
(dump_exe_compact_unwind): Change the condition. Improve
indentation.
2014-03-20 Nick Clifton <nickc@redhat.com>
* readelf.c (process_version_sections): Fix off-by-one error in
previous delta.
2014-03-19 Nick Clifton <nickc@redhat.com>
PR binutils/16723
* readelf.c (process_version_sections): Prevent an infinite loop
when the vn_next field is zero but there are still entries to be
processed.
2014-03-17 Tristan Gingold <gingold@adacore.com>
* od-macho.c (dump_section_header): Renames of dump_section.
(dump_segment): Adjust after renaming.
(OPT_COMPACT_UNWIND): Define.
(options): Add compact unwind.
(mach_o_help): Document compact_unwind.
(unwind_x86_64_regs, unwind_x86_regs): New arrays.
(dump_unwind_encoding_x86, dump_unwind_encoding)
(dump_obj_compact_unwind, dump_exe_compact_unwind)
(dump_section_content): New functions.
(mach_o_dump): Handle compact unwind.
2014-03-17 Tristan Gingold <gingold@adacore.com>
* od-macho.c (dump_load_command): Handle lazy load dylib.
2014-03-14 Anthony Green <green@moxielogic.com>
* objcopy.c (copy_object): Check fwrite return code.
2014-03-14 Meador Inge <meadori@codesourcery.com>
* dwarf.c (strnlen): Move prototype ...
* sysdep.h (strnlen): ... to here.
2014-03-12 Nick Clifton <nickc@redhat.com>
PR binutils/16652
* doc/binutils.texi (ar cmdline): Move --plugin command line
option to after the command option.
2014-03-12 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
PR binutils/16567
* deflex.l: Add noinput and nounput options.
2014-03-12 Alan Modra <amodra@gmail.com>
* Makefile.in: Regenerate.
* doc/Makefile.in: Regenerate.
2014-03-06 Nick Clifton <nickc@redhat.com>
PR binutils/16664
* readelf.c (process_attributes): Add checks for corrupt
attribute section names.
2014-03-05 Alan Modra <amodra@gmail.com>
Update copyright years.
2014-03-03 Alan Modra <amodra@gmail.com>
* README: Add "Copyright Notices" paragraph.
2014-02-11 Cary Coutant <ccoutant@google.com>
* binutils/dwarf.c (read_and_display_attr_value): Don't warn
for zero-length attribute value.
2014-02-10 Alan Modra <amodra@gmail.com>
* po/binutils.pot: Regenerate.
2014-02-06 Andrew Pinski <apinski@cavium.com>
* readelf.c (get_machine_flags): Handle E_MIPS_MACH_OCTEON3 case.
2014-02-06 Cary Coutant <ccoutant@google.com>
PR binutils/16444
* readelf.c (print_gnu_note): Add support for NT_GNU_GOLD_VERSION.
2014-01-08 H.J. Lu <hongjiu.lu@intel.com>
* version.c (print_version): Update copyright year to 2014.
2014-01-07 Tom Tromey <tromey@redhat.com>
* bucomm.c (fatal, non_fatal): Replace obsolete VA_* macros with
stdarg macros.
* dlltool.c (inform): Replace obsolete VA_* macros with stdarg
macros.
* dllwrap.c (inform, warn): Replace obsolete VA_* macros with
stdarg macros.
2014-01-07 Tom Tromey <tromey@redhat.com>
* coffgrok.h (coff_ofile): Don't use PARAMS.
* nlmheader.y (strerror): Don't use PARAMS.
For older changes see ChangeLog-2013
Copyright (C) 2014 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
Local Variables:
mode: change-log
left-margin: 8
fill-column: 74
version-control: never
End:

View File

@ -0,0 +1,70 @@
/* A program to test BFD.
Copyright (C) 2012-2015 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
static void
die (const char *s)
{
printf ("oops: %s\n", s);
exit (1);
}
int
main (int argc, char **argv)
{
bfd *archive;
bfd *last, *next;
if (argc != 2)
die ("usage: bfdtest1 <archive>");
archive = bfd_openr (argv[1], NULL);
if (archive == NULL)
die ("no such archive");
if (!bfd_check_format (archive, bfd_archive))
{
bfd_close (archive);
die ("bfd_check_format");
}
for (last = bfd_openr_next_archived_file (archive, NULL);
last;
last = next)
{
next = bfd_openr_next_archived_file (archive, last);
bfd_close (last);
}
for (last = bfd_openr_next_archived_file (archive, NULL);
last;
last = next)
{
next = bfd_openr_next_archived_file (archive, last);
bfd_close (last);
}
if (!bfd_close (archive))
die ("bfd_close");
return 0;
}

View File

@ -0,0 +1,106 @@
/* A program to test BFD.
Copyright (C) 2012-2015 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
static void
die (const char *s)
{
printf ("oops: %s\n", s);
exit (1);
}
static void *
iovec_open (struct bfd *nbfd ATTRIBUTE_UNUSED, void *open_closure)
{
return open_closure;
}
static file_ptr iovec_read (struct bfd *nbfd ATTRIBUTE_UNUSED,
void *stream, void *buf, file_ptr nbytes,
file_ptr offset)
{
FILE* file = (FILE*) stream;
if (fseek(file, offset, SEEK_SET) != 0)
die ("fseek error");
return fread (buf, 1, nbytes, file);
}
static int
iovec_stat (struct bfd *abfd ATTRIBUTE_UNUSED,
void *stream, struct stat *sb)
{
return fstat (fileno ((FILE*) stream), sb);
}
static bfd_boolean
check_format_any (struct bfd *abfd, bfd_format format)
{
char** targets = NULL;
if (bfd_check_format_matches (abfd, format, &targets))
return TRUE;
if (targets)
{
bfd_find_target (targets[0], abfd);
return bfd_check_format (abfd, format);
}
return FALSE;
}
int
main (int argc, const char** argv)
{
FILE* file;
bfd *abfd, *mbfd;
if (argc < 2)
die ("Usage: test archivefile");
file = fopen(argv[1], "rb");
if (!file)
die ("file not found");
abfd = bfd_openr_iovec (argv[1], 0, iovec_open, file,
iovec_read, NULL, iovec_stat);
if (!abfd)
die ("error opening file");
if (!check_format_any (abfd, bfd_archive))
die ("not an archive");
mbfd = bfd_openr_next_archived_file (abfd, 0);
if (!mbfd)
die ("error opening archive member");
if (!bfd_close (mbfd))
die ("error closing archive member");
if (!bfd_close (abfd))
die ("error closing archive");
return 0;
}

View File

@ -0,0 +1,517 @@
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright (C) 2012-2015 Free Software Foundation, Inc.
dnl
dnl This file is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; see the file COPYING3. If not see
dnl <http://www.gnu.org/licenses/>.
dnl
AC_PREREQ(2.59)
m4_include([../bfd/version.m4])
AC_INIT([binutils], BFD_VERSION)
AC_CONFIG_SRCDIR(ar.c)
AC_CANONICAL_TARGET
AC_ISC_POSIX
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_GNU_SOURCE
AC_USE_SYSTEM_EXTENSIONS
LT_INIT
ACX_LARGEFILE
AC_ARG_ENABLE(targets,
[ --enable-targets alternative target configurations],
[case "${enableval}" in
yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
;;
no) enable_targets= ;;
*) enable_targets=$enableval ;;
esac])dnl
AC_ARG_ENABLE(deterministic-archives,
[AS_HELP_STRING([--enable-deterministic-archives],
[ar and ranlib default to -D behavior])], [
if test "${enableval}" = no; then
default_ar_deterministic=0
else
default_ar_deterministic=1
fi], [default_ar_deterministic=0])
AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
[Should ar and ranlib use -D behavior by default?])
AC_ARG_ENABLE(default-strings-all,
[AS_HELP_STRING([--disable-default-strings-all],
[strings defaults to --data behavior])], [
if test "${enableval}" = no; then
default_strings_all=0
else
default_strings_all=1
fi], [default_strings_all=1])
AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
[Should strings use -a behavior by default?])
AM_BINUTILS_WARNINGS
AC_CONFIG_HEADERS(config.h:config.in)
AH_VERBATIM([00_CONFIG_H_CHECK],
[/* Check that config.h is #included before system headers
(this works only for glibc, but that should be enough). */
#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__CONFIG_H__)
# error config.h must be #included before system headers
#endif
#define __CONFIG_H__ 1])
if test -z "$target" ; then
AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
fi
if test -z "$host" ; then
AC_MSG_ERROR(Unrecognized host system type; please check config.sub.)
fi
AC_PROG_YACC
AM_PROG_LEX
ALL_LINGUAS="bg ca da es fi fr id it ja ro ru rw sk sv tr uk vi zh_CN zh_TW hr"
ZW_GNU_GETTEXT_SISTER_DIR
AM_PO_SUBDIRS
AM_MAINTAINER_MODE
AM_CONDITIONAL(GENINSRC_NEVER, false)
AC_EXEEXT
if test -n "$EXEEXT"; then
AC_DEFINE(HAVE_EXECUTABLE_SUFFIX, 1,
[Does the platform use an executable suffix?])
fi
AC_DEFINE_UNQUOTED(EXECUTABLE_SUFFIX, "${EXEEXT}",
[Suffix used for executables, if any.])
# host-specific stuff:
HDEFINES=
. ${srcdir}/../bfd/configure.host
AC_SUBST(HDEFINES)
AR=${AR-ar}
AC_SUBST(AR)
AC_PROG_RANLIB
AC_PROG_INSTALL
BFD_CC_FOR_BUILD
DEMANGLER_NAME=c++filt
case "${host}" in
*-*-go32* | *-*-msdos*)
DEMANGLER_NAME=cxxfilt
esac
AC_SUBST(DEMANGLER_NAME)
AC_CHECK_SIZEOF([long])
AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
AC_CHECK_HEADERS(string.h strings.h stdlib.h unistd.h fcntl.h sys/file.h limits.h locale.h sys/param.h wchar.h)
AC_HEADER_SYS_WAIT
ACX_HEADER_STRING
AC_FUNC_ALLOCA
AC_CHECK_FUNCS(sbrk utimes setmode getc_unlocked strcoll setlocale)
AC_CHECK_FUNC([mkstemp],
AC_DEFINE([HAVE_MKSTEMP], 1,
[Define to 1 if you have the `mkstemp' function.]))
AC_CHECK_FUNC([mkdtemp],
AC_DEFINE([HAVE_MKDTEMP], 1,
[Define to 1 if you have the `mkdtemp' function.]))
AC_MSG_CHECKING([for mbstate_t])
AC_TRY_COMPILE([#include <wchar.h>],
[mbstate_t teststate;],
have_mbstate_t=yes, have_mbstate_t=no)
AC_MSG_RESULT($have_mbstate_t)
if test x"$have_mbstate_t" = xyes; then
AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
fi
# Some systems have frexp only in -lm, not in -lc.
AC_SEARCH_LIBS(frexp, m)
AM_LC_MESSAGES
AC_MSG_CHECKING(for time_t in time.h)
AC_CACHE_VAL(bu_cv_decl_time_t_time_h,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <time.h>], [time_t i;])],
bu_cv_decl_time_t_time_h=yes, bu_cv_decl_time_t_time_h=no)])
AC_MSG_RESULT($bu_cv_decl_time_t_time_h)
if test $bu_cv_decl_time_t_time_h = yes; then
AC_DEFINE([HAVE_TIME_T_IN_TIME_H], 1,
[Is the type time_t defined in <time.h>?])
fi
AC_MSG_CHECKING(for time_t in sys/types.h)
AC_CACHE_VAL(bu_cv_decl_time_t_types_h,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>], [time_t i;])],
bu_cv_decl_time_t_types_h=yes, bu_cv_decl_time_t_types_h=no)])
AC_MSG_RESULT($bu_cv_decl_time_t_types_h)
if test $bu_cv_decl_time_t_types_h = yes; then
AC_DEFINE([HAVE_TIME_T_IN_TYPES_H], 1,
[Is the type time_t defined in <sys/types.h>?])
fi
AC_MSG_CHECKING(for a known getopt prototype in unistd.h)
AC_CACHE_VAL(bu_cv_decl_getopt_unistd_h,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <unistd.h>], [extern int getopt (int, char *const*, const char *);])],
bu_cv_decl_getopt_unistd_h=yes, bu_cv_decl_getopt_unistd_h=no)])
AC_MSG_RESULT($bu_cv_decl_getopt_unistd_h)
if test $bu_cv_decl_getopt_unistd_h = yes; then
AC_DEFINE([HAVE_DECL_GETOPT], 1,
[Is the prototype for getopt in <unistd.h> in the expected format?])
fi
# Under Next 3.2 <utime.h> apparently does not define struct utimbuf
# by default.
AC_MSG_CHECKING([for utime.h])
AC_CACHE_VAL(bu_cv_header_utime_h,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#include <utime.h>],
[struct utimbuf s;])],
bu_cv_header_utime_h=yes, bu_cv_header_utime_h=no)])
AC_MSG_RESULT($bu_cv_header_utime_h)
if test $bu_cv_header_utime_h = yes; then
AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does <utime.h> define struct utimbuf?])
fi
AC_CHECK_DECLS([environ, fprintf, getc_unlocked, getenv,
sbrk, snprintf, stpcpy, strnlen, strstr, vsnprintf])
# Link in zlib if we can. This allows us to read compressed debug
# sections. This is used only by readelf.c (objdump uses bfd for
# reading compressed sections).
AM_ZLIB
BFD_BINARY_FOPEN
# target-specific stuff:
# Canonicalize the secondary target names.
if test -n "$enable_targets"; then
for targ in `echo $enable_targets | sed 's/,/ /g'`
do
result=`$ac_config_sub $targ 2>/dev/null`
if test -n "$result"; then
canon_targets="$canon_targets $result"
else
# Allow targets that config.sub doesn't recognize, like "all".
canon_targets="$canon_targets $targ"
fi
done
fi
AC_CHECK_HEADER(iconv.h)
AM_ICONV
all_targets=false
BUILD_NLMCONV=
NLMCONV_DEFS=
BUILD_SRCONV=
BUILD_DLLTOOL=
DLLTOOL_DEFS=
DLLTOOL_DEFAULT=
BUILD_WINDRES=
BUILD_WINDMC=
BUILD_DLLWRAP=
BUILD_MISC=
BUILD_INSTALL_MISC=
OBJDUMP_DEFS=
OBJDUMP_PRIVATE_VECTORS=
OBJDUMP_PRIVATE_OFILES=
od_vectors=
for targ in $target $canon_targets
do
if test "x$targ" = "xall"; then
all_targets=true
BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
BUILD_SRCONV='$(SRCONV_PROG)'
NLMCONV_DEFS="-DNLMCONV_I386 -DNLMCONV_ALPHA -DNLMCONV_POWERPC -DNLMCONV_SPARC"
BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
if test -z "$DLLTOOL_DEFAULT"; then
DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
fi
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
od_vectors="$od_vectors objdump_private_desc_xcoff"
else
case $targ in
changequote(,)dnl
i[3-7]86*-*-netware*)
changequote([,])dnl
BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_I386"
;;
alpha*-*-netware*)
BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_ALPHA"
;;
powerpc*-*-netware*)
BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_POWERPC"
;;
sparc*-*-netware*)
BUILD_NLMCONV='$(NLMCONV_PROG)$(EXEEXT)'
NLMCONV_DEFS="$NLMCONV_DEFS -DNLMCONV_SPARC"
;;
esac
case $targ in
*-*-hms*) BUILD_SRCONV='$(SRCONV_PROG)' ;;
esac
case $targ in
arm-epoc-pe*)
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
if test -z "$DLLTOOL_DEFAULT"; then
DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_EPOC"
fi
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_EPOC -DDLLTOOL_ARM"
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
;;
arm-wince-pe* | arm-*-wince | arm*-*-cegcc* | arm*-*-mingw32ce*)
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
if test -z "$DLLTOOL_DEFAULT"; then
DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM_WINCE"
fi
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM_WINCE -DDLLTOOL_ARM"
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
;;
arm-*-pe*)
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
if test -z "$DLLTOOL_DEFAULT"; then
DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_ARM"
fi
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
;;
x86_64-*-mingw* | x86_64-*-cygwin*)
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
if test -z "$DLLTOOL_DEFAULT"; then
DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MX86_64"
fi
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MX86_64"
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
;;
changequote(,)dnl
i[3-7]86-*-pe* | i[3-7]86-*-cygwin* | i[3-7]86-*-mingw32** | i[3-7]86-*-netbsdpe*)
changequote([,])dnl
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
if test -z "$DLLTOOL_DEFAULT"; then
DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
fi
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
BUILD_DLLWRAP='$(DLLWRAP_PROG)$(EXEEXT)'
;;
changequote(,)dnl
i[3-7]86-*-interix)
changequote([,])dnl
BUILD_DLLTOOL='$(DLLTOOL_PROG)'
if test -z "$DLLTOOL_DEFAULT"; then
DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_I386"
fi
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_I386"
;;
changequote(,)dnl
powerpc*-aix5.[01])
changequote([,])dnl
;;
changequote(,)dnl
powerpc*-aix[5-9].*)
changequote([,])dnl
OBJDUMP_DEFS="-DAIX_WEAK_SUPPORT"
;;
powerpc*-*-pe* | powerpc*-*-cygwin*)
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
if test -z "$DLLTOOL_DEFAULT"; then
DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_PPC"
fi
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_PPC"
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
;;
powerpc*-*-linux* | powerpc*-*-elf* | powerpc*-*-eabi*)
case "$BUILD_INSTALL_MISC" in
*embedspu*) ;;
*) BUILD_INSTALL_MISC="${BUILD_INSTALL_MISC} embedspu"
esac
;;
sh*-*-pe)
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
if test -z "$DLLTOOL_DEFAULT"; then
DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_SH"
fi
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_SH"
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
;;
spu-*-*)
BUILD_MISC="${BUILD_MISC} "'bin2c$(EXEEXT_FOR_BUILD)'
;;
mips*-*-pe)
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
if test -z "$DLLTOOL_DEFAULT"; then
DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MIPS"
fi
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MIPS"
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
;;
mcore-*-pe)
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
if test -z "$DLLTOOL_DEFAULT"; then
DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE"
fi
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE"
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
;;
mcore-*-elf)
BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
if test -z "$DLLTOOL_DEFAULT"; then
DLLTOOL_DEFAULT="-DDLLTOOL_DEFAULT_MCORE_ELF"
fi
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
;;
mep-*)
OBJDUMP_DEFS="-DSKIP_ZEROES=256 -DSKIP_ZEROES_AT_END=0"
;;
esac
# Add objdump private vectors.
case $targ in
avr-*-*)
od_vectors="$od_vectors objdump_private_desc_elf32_avr"
;;
powerpc-*-aix*)
od_vectors="$od_vectors objdump_private_desc_xcoff"
;;
*-*-darwin*)
od_vectors="$od_vectors objdump_private_desc_mach_o"
;;
esac
fi
done
# Uniq objdump private vector, build objdump target ofiles.
od_files=
f=""
for i in $od_vectors ; do
case " $f " in
*" $i "*) ;;
*)
f="$f $i"
OBJDUMP_PRIVATE_VECTORS="$OBJDUMP_PRIVATE_VECTORS &$i,"
case $i in
objdump_private_desc_elf32_avr)
od_files="$od_files od-elf32_avr" ;;
objdump_private_desc_xcoff)
od_files="$od_files od-xcoff" ;;
objdump_private_desc_mach_o)
od_files="$od_files od-macho" ;;
*) AC_MSG_ERROR(*** unknown private vector $i) ;;
esac
;;
esac
done
# Uniq objdump target ofiles
f=""
for i in $od_files ; do
case " $f " in
*" $i "*) ;;
*)
f="$f $i"
OBJDUMP_PRIVATE_OFILES="$OBJDUMP_PRIVATE_OFILES $i.$objext"
;;
esac
done
DLLTOOL_DEFS="$DLLTOOL_DEFS $DLLTOOL_DEFAULT"
if test "${with_windres+set}" = set; then
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
fi
if test "${with_windmc+set}" = set; then
BUILD_WINDMC='$(WINDMC_PROG)$(EXEEXT)'
fi
OBJDUMP_DEFS="${OBJDUMP_DEFS} -DOBJDUMP_PRIVATE_VECTORS=\"${OBJDUMP_PRIVATE_VECTORS}\""
AC_SUBST(NLMCONV_DEFS)
AC_SUBST(BUILD_NLMCONV)
AC_SUBST(BUILD_SRCONV)
AC_SUBST(BUILD_DLLTOOL)
AC_SUBST(DLLTOOL_DEFS)
AC_SUBST(BUILD_WINDRES)
AC_SUBST(BUILD_WINDMC)
AC_SUBST(BUILD_DLLWRAP)
AC_SUBST(BUILD_MISC)
AC_SUBST(BUILD_INSTALL_MISC)
AC_SUBST(OBJDUMP_DEFS)
AC_SUBST(OBJDUMP_PRIVATE_OFILES)
AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
targ=$target
. $srcdir/../bfd/config.bfd
if test "x$targ_underscore" = "xyes"; then
UNDERSCORE=1
else
UNDERSCORE=0
fi
AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
[Define to 1 if user symbol names have a leading underscore, 0 if not.])
# Emulation
targ=$target
. ${srcdir}/configure.tgt
EMULATION=$targ_emul
EMULATION_VECTOR=$targ_emul_vector
AC_SUBST(EMULATION)
AC_SUBST(EMULATION_VECTOR)
# Required for html and install-html
AC_SUBST(datarootdir)
AC_SUBST(docdir)
AC_SUBST(htmldir)
AC_SUBST(pdfdir)
AC_CONFIG_FILES(Makefile doc/Makefile po/Makefile.in:po/Make-in)
AC_OUTPUT

View File

@ -0,0 +1,303 @@
/* od-avrelf.c -- dump information about an AVR elf object file.
Copyright (C) 2011-2015 Free Software Foundation, Inc.
Written by Senthil Kumar Selvaraj, Atmel.
This file is part of GNU Binutils.
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 3, 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, 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include <stddef.h>
#include <time.h>
#include <stdint.h>
#include "safe-ctype.h"
#include "bfd.h"
#include "objdump.h"
#include "bucomm.h"
#include "bfdlink.h"
#include "bfd.h"
#include "elf/external.h"
#include "elf/internal.h"
#include "elf32-avr.h"
/* Index of the options in the options[] array. */
#define OPT_MEMUSAGE 0
#define OPT_AVRPROP 1
/* List of actions. */
static struct objdump_private_option options[] =
{
{ "mem-usage", 0 },
{ "avr-prop", 0},
{ NULL, 0 }
};
/* Display help. */
static void
elf32_avr_help (FILE *stream)
{
fprintf (stream, _("\
For AVR ELF files:\n\
mem-usage Display memory usage\n\
avr-prop Display contents of .avr.prop section\n\
"));
}
typedef struct tagDeviceInfo
{
uint32_t flash_start;
uint32_t flash_size;
uint32_t ram_start;
uint32_t ram_size;
uint32_t eeprom_start;
uint32_t eeprom_size;
char * name;
} deviceinfo;
/* Return TRUE if ABFD is handled. */
static int
elf32_avr_filter (bfd *abfd)
{
return bfd_get_flavour (abfd) == bfd_target_elf_flavour;
}
static char*
elf32_avr_get_note_section_contents (bfd *abfd, bfd_size_type *size)
{
asection *section;
if ((section = bfd_get_section_by_name (abfd, ".note.gnu.avr.deviceinfo")) == NULL)
return NULL;
*size = bfd_get_section_size (section);
char *contents = (char *) xmalloc (*size);
bfd_get_section_contents (abfd, section, contents, 0, *size);
return contents;
}
static char* elf32_avr_get_note_desc (bfd *abfd, char *contents,
bfd_size_type size)
{
Elf_External_Note *xnp = (Elf_External_Note *) contents;
Elf_Internal_Note in;
if (offsetof (Elf_External_Note, name) > size)
return NULL;
in.type = bfd_get_32 (abfd, xnp->type);
in.namesz = bfd_get_32 (abfd, xnp->namesz);
in.namedata = xnp->name;
if (in.namesz > contents - in.namedata + size)
return NULL;
in.descsz = bfd_get_32 (abfd, xnp->descsz);
in.descdata = in.namedata + align_power (in.namesz, 2);
if (in.descsz != 0
&& (in.descdata >= contents + size
|| in.descsz > contents - in.descdata + size))
return NULL;
if (strcmp (in.namedata, "AVR") != 0)
return NULL;
return in.descdata;
}
static void
elf32_avr_get_device_info (bfd *abfd, char *description,
deviceinfo *device)
{
if (description == NULL)
return;
const bfd_size_type memory_sizes = 6;
memcpy (device, description, memory_sizes * sizeof(uint32_t));
device->name = NULL;
uint32_t *stroffset_table = ((uint32_t *) description) + memory_sizes;
bfd_size_type stroffset_table_size = bfd_get_32 (abfd, stroffset_table);
char *str_table = ((char *) stroffset_table) + stroffset_table_size;
/* If the only content is the size itself, there's nothing in the table */
if (stroffset_table_size == 4)
return;
/* First entry is the device name index. */
uint32_t device_name_index = bfd_get_32 (abfd, stroffset_table + 1);
device->name = str_table + device_name_index;
}
static void
elf32_avr_get_memory_usage (bfd *abfd,
bfd_size_type *text_usage,
bfd_size_type *data_usage,
bfd_size_type *eeprom_usage)
{
bfd_size_type avr_datasize = 0;
bfd_size_type avr_textsize = 0;
bfd_size_type avr_bsssize = 0;
bfd_size_type bootloadersize = 0;
bfd_size_type noinitsize = 0;
bfd_size_type eepromsize = 0;
asection *section;
if ((section = bfd_get_section_by_name (abfd, ".data")) != NULL)
avr_datasize = bfd_section_size (abfd, section);
if ((section = bfd_get_section_by_name (abfd, ".text")) != NULL)
avr_textsize = bfd_section_size (abfd, section);
if ((section = bfd_get_section_by_name (abfd, ".bss")) != NULL)
avr_bsssize = bfd_section_size (abfd, section);
if ((section = bfd_get_section_by_name (abfd, ".bootloader")) != NULL)
bootloadersize = bfd_section_size (abfd, section);
if ((section = bfd_get_section_by_name (abfd, ".noinit")) != NULL)
noinitsize = bfd_section_size (abfd, section);
if ((section = bfd_get_section_by_name (abfd, ".eeprom")) != NULL)
eepromsize = bfd_section_size (abfd, section);
*text_usage = avr_textsize + avr_datasize + bootloadersize;
*data_usage = avr_datasize + avr_bsssize + noinitsize;
*eeprom_usage = eepromsize;
}
static void
elf32_avr_dump_mem_usage (bfd *abfd)
{
char *description = NULL;
bfd_size_type note_section_size = 0;
deviceinfo device = { 0, 0, 0, 0, 0, 0, NULL };
device.name = "Unknown";
bfd_size_type data_usage = 0;
bfd_size_type text_usage = 0;
bfd_size_type eeprom_usage = 0;
char *contents = elf32_avr_get_note_section_contents (abfd,
&note_section_size);
if (contents != NULL)
{
description = elf32_avr_get_note_desc (abfd, contents, note_section_size);
elf32_avr_get_device_info (abfd, description, &device);
}
elf32_avr_get_memory_usage (abfd, &text_usage, &data_usage,
&eeprom_usage);
printf ("AVR Memory Usage\n"
"----------------\n"
"Device: %s\n\n", device.name);
/* Text size */
printf ("Program:%8ld bytes", text_usage);
if (device.flash_size > 0)
printf (" (%2.1f%% Full)", ((float) text_usage / device.flash_size) * 100);
printf ("\n(.text + .data + .bootloader)\n\n");
/* Data size */
printf ("Data: %8ld bytes", data_usage);
if (device.ram_size > 0)
printf (" (%2.1f%% Full)", ((float) data_usage / device.ram_size) * 100);
printf ("\n(.data + .bss + .noinit)\n\n");
/* EEPROM size */
if (eeprom_usage > 0)
{
printf ("EEPROM: %8ld bytes", eeprom_usage);
if (device.eeprom_size > 0)
printf (" (%2.1f%% Full)", ((float) eeprom_usage / device.eeprom_size) * 100);
printf ("\n(.eeprom)\n\n");
}
if (contents != NULL)
free (contents);
}
static void
elf32_avr_dump_avr_prop (bfd *abfd)
{
struct avr_property_record_list *r_list;
unsigned int i;
r_list = avr_elf32_load_property_records (abfd);
if (r_list == NULL)
return;
printf ("\nContents of `%s' section:\n\n", r_list->section->name);
printf (" Version: %d\n", r_list->version);
printf (" Flags: %#x\n\n", r_list->flags);
for (i = 0; i < r_list->record_count; ++i)
{
printf (" %d %s @ %s + %#08lx (%#08lx)\n",
i,
avr_elf32_property_record_name (&r_list->records [i]),
r_list->records [i].section->name,
r_list->records [i].offset,
(bfd_get_section_vma (abfd, r_list->records [i].section)
+ r_list->records [i].offset));
switch (r_list->records [i].type)
{
case RECORD_ORG:
/* Nothing else to print. */
break;
case RECORD_ORG_AND_FILL:
printf (" Fill: %#08lx\n",
r_list->records [i].data.org.fill);
break;
case RECORD_ALIGN:
printf (" Align: %#08lx\n",
r_list->records [i].data.align.bytes);
break;
case RECORD_ALIGN_AND_FILL:
printf (" Align: %#08lx, Fill: %#08lx\n",
r_list->records [i].data.align.bytes,
r_list->records [i].data.align.fill);
break;
}
}
free (r_list);
}
static void
elf32_avr_dump (bfd *abfd)
{
if (options[OPT_MEMUSAGE].selected)
elf32_avr_dump_mem_usage (abfd);
if (options[OPT_AVRPROP].selected)
elf32_avr_dump_avr_prop (abfd);
}
const struct objdump_private_desc objdump_private_desc_elf32_avr =
{
elf32_avr_help,
elf32_avr_filter,
elf32_avr_dump,
options
};

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
# Copyright (C) 2014-2015 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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
if {![istarget "aarch64*-*-*"]
|| ![is_elf_format]} then {
return
}
set tempfile tmpdir/aarch64temp.o
set copyfile tmpdir/aarch64copy
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach t $test_list {
# We need to strip the ".d", but can leave the dirname.
verbose [file rootname $t]
run_dump_test [file rootname $t]
}

View File

@ -0,0 +1,29 @@
#PROG: objcopy
#objdump: -dr
#name: Disassembler detects unallocated instruction encodings.
.*: +file format .*aarch64.*
Disassembly of section \.text:
0000000000000000 <.*>:
0: 0d0047de .inst 0x0d0047de ; undefined
4: 0d2047dd .inst 0x0d2047dd ; undefined
8: 0d0067dc .inst 0x0d0067dc ; undefined
c: 0d2067db .inst 0x0d2067db ; undefined
10: 0d008bde .inst 0x0d008bde ; undefined
14: 0d208bdd .inst 0x0d208bdd ; undefined
18: 0d00abdc .inst 0x0d00abdc ; undefined
1c: 0d20abdb .inst 0x0d20abdb ; undefined
20: 0d008fde .inst 0x0d008fde ; undefined
24: 0d208fdd .inst 0x0d208fdd ; undefined
28: 0d00afdc .inst 0x0d00afdc ; undefined
2c: 0d20afdb .inst 0x0d20afdb ; undefined
30: 0d0097de .inst 0x0d0097de ; undefined
34: 0d2097dd .inst 0x0d2097dd ; undefined
38: 0d00b7dc .inst 0x0d00b7dc ; undefined
3c: 0d20b7db .inst 0x0d20b7db ; undefined
40: 0d009fde .inst 0x0d009fde ; undefined
44: 0d209fdd .inst 0x0d209fdd ; undefined
48: 0d00bfdc .inst 0x0d00bfdc ; undefined
4c: 0d20bfdb .inst 0x0d20bfdb ; undefined

View File

@ -0,0 +1,51 @@
.text
func:
//scale 1, size<0> check for H.
#st1 {v30.h}[0], [x30]
.inst 0x0d0043de | (1 << 10)
#st2 {v29.h, v30.h}[0], [x30]
.inst 0x0d2043dd | (1 << 10)
#st3 {v28.h, v29.h, v30.h}[0], [x30]
.inst 0x0d0063dc | (1 << 10)
#st4 {v27.h, v28.h, v29.h, v30.h}[0], [x30]
.inst 0x0d2063db | (1 << 10)
//scale 2, size<1> check for S.
#st1 {v30.s}[0], [x30]
.inst 0x0d0083de | (1 << 11)
#st2 {v29.s, v30.s}[0], [x30]
.inst 0x0d2083dd | (1 << 11)
#st3 {v28.s, v29.s, v30.s}[0], [x30]
.inst 0x0d00a3dc | (1 << 11)
#st4 {v27.s, v28.s, v29.s, v30.s}[0], [x30]
.inst 0x0d20a3db | (1 << 11)
//scale 2, size<1> check for D.
#st1 {v30.d}[0], [x30]
.inst 0x0d0087de | (1 << 11)
#st2 {v29.d, v30.d}[0], [x30]
.inst 0x0d2087dd | (1 << 11)
#st3 {v28.d, v29.d, v30.d}[0], [x30]
.inst 0x0d00a7dc | (1 << 11)
#st4 {v27.d, v28.d, v29.d, v30.d}[0], [x30]
.inst 0x0d20a7db | (1 << 11)
//scale 2, S-bit check for D.
#st1 {v30.d}[0], [x30]
.inst 0x0d0087de | (2 << 11)
#st2 {v29.d, v30.d}[0], [x30]
.inst 0x0d2087dd | (2 << 11)
#st3 {v28.d, v29.d, v30.d}[0], [x30]
.inst 0x0d00a7dc | (2 << 11)
#st4 {v27.d, v28.d, v29.d, v30.d}[0], [x30]
.inst 0x0d20a7db | (2 << 11)
//scale 2, size<1> & S-bit check for D.
#st1 {v30.d}[0], [x30]
.inst 0x0d0087de | (3 << 11)
#st2 {v29.d, v30.d}[0], [x30]
.inst 0x0d2087dd | (3 << 11)
#st3 {v28.d, v29.d, v30.d}[0], [x30]
.inst 0x0d00a7dc | (3 << 11)
#st4 {v27.d, v28.d, v29.d, v30.d}[0], [x30]
.inst 0x0d20a7db | (3 << 11)

View File

@ -0,0 +1,14 @@
#PROG: objcopy
#name: objcopy add-symbol
#source: symbols.s
#objcopy: --add-symbol NEW=0x1234 --add-symbol NEW_DATA=.data:0x4321,local
#objdump: --syms
.*: +file format .*
SYMBOL TABLE:
#...
(0+04321 l[ ]+.data[ ]+0+00 NEW_DATA|0+01234 g[ ]+\*ABS\*[ ]+0+00 NEW)
#...
(0+01234 g[ ]+\*ABS\*[ ]+0+00 NEW|0+04321 l[ ]+.data[ ]+0+00 NEW_DATA)
#pass

View File

@ -0,0 +1,15 @@
.text
foo:
__tagsym$$0:
add r0, r1, r2
.data
.global global_a
__tagsym$$used0:
global_a:
.word 0xcafedead
.global __tagsym$$used1
__tagsym$$used1:
global_b:
.word 0xcafecafe

View File

@ -0,0 +1,9 @@
#PROG: objcopy
#source: debug_str.s
#objdump: -h
#name: Uncompressed .debug_str section starting with ZLIB
.*ebug_str.copy.o: file format .*
#...
. .debug_str 0+01. 0+0 0+0 0+0.. 2..0
#...

View File

@ -0,0 +1,12 @@
/* This test is derived from a C source file which, when compiled by gcc
with debugging enabled, managed to create a .debug_str section whose
first string was ZLIB_VER_SUBVERSION. The code in bfd/compress.c
used to just check for the characters "ZLIB" at the start of a section
and then assume that the section was compressed. This meant that the BFD
library then processed the next 8 bytes as if they were the size of the
decompressed version of the section. Naturally with this test case the
resulting size was gigantic and consequently the library quickly ran out
of memory. */
.section .debug_str,"MS",@progbits,1
.string "ZLIB_VER_SUBREVISION 0"

View File

@ -0,0 +1,103 @@
.*dw2-1-compressed.o: file format .*
Contents of the .z?debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x4e \(32-bit\)
Version: 2
Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<c> DW_AT_stmt_list : 0x0
<10> DW_AT_high_pc : 0x.
<14> DW_AT_low_pc : 0x.
<18> DW_AT_name : file1.txt
<22> DW_AT_producer : GNU C 3.3.3
<2e> DW_AT_language : 1 \(ANSI C\)
<1><2f>: Abbrev Number: 2 \(DW_TAG_subprogram\)
<30> DW_AT_external : 1
<31> DW_AT_decl_file : 1
<32> DW_AT_decl_line : 2
<33> DW_AT_name : func_cu1
<3c> DW_AT_type : <0x4a>
<40> DW_AT_low_pc : 0x.
<44> DW_AT_high_pc : 0x.
<48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5 \([^()]*\)\)
<1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
<4b> DW_AT_name : int
<4f> DW_AT_byte_size : 4
<50> DW_AT_encoding : 5 \(signed\)
<1><51>: Abbrev Number: 0
Raw dump of debug contents of section .z?debug_line:
Offset: 0x0
Length: 62
DWARF Version: 2
Prologue Length: 35
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: 1
Line Range: 1
Opcode Base: 16
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
Opcode 13 has 0 args
Opcode 14 has 0 args
Opcode 15 has 0 args
The Directory Table is empty.
The File Name Table \(offset 0x.*\):
Entry Dir Time Size Name
1 0 0 0 file1.txt
Line Number Statements:
\[0x.*\] Extended opcode 2: set Address to 0x4
\[0x.*\] Advance Line by 3 to 4
\[0x.*\] Copy
\[0x.*\] Copy
\[0x.*\] Extended opcode 2: set Address to 0x8
\[0x.*\] Extended opcode 1: End of Sequence
Contents of the .debug_abbrev section:
Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_stmt_list DW_FORM_data4
DW_AT_high_pc DW_FORM_addr
DW_AT_low_pc DW_FORM_addr
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
DW_AT_language DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
2 DW_TAG_subprogram \[no children\]
DW_AT_external DW_FORM_flag
DW_AT_decl_file DW_FORM_data1
DW_AT_decl_line DW_FORM_data1
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_low_pc DW_FORM_addr
DW_AT_high_pc DW_FORM_addr
DW_AT_frame_base DW_FORM_block1
DW_AT value: 0 DW_FORM value: 0
3 DW_TAG_base_type \[no children\]
DW_AT_name DW_FORM_string
DW_AT_byte_size DW_FORM_data1
DW_AT_encoding DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0

View File

@ -0,0 +1,316 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2004-2015 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 3 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, see <http://www.gnu.org/licenses/>. */
/* Test a minimal file containing DWARF-2 information. This test also
serves as a skeleton for other DWARF-2 tests. Most other tests will
not be this extensively itemized and commented... */
/* Dummy function to provide debug information for. */
.text
.Lbegin_text1:
.globl func_cu1
.type func_cu1, %function
func_cu1:
.Lbegin_func_cu1:
.4byte 0
.Lend_func_cu1:
.size func_cu1, .-func_cu1
.Lend_text1:
/* Debug information */
.section .debug_info
.Lcu1_begin:
/* CU header */
.4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
.Lcu1_start:
.2byte 2 /* DWARF Version */
.4byte .Labbrev1_begin /* Offset into abbrev section */
.byte 4 /* Pointer size */
/* CU die */
.uleb128 1 /* Abbrev: DW_TAG_compile_unit */
.4byte .Lline1_begin /* DW_AT_stmt_list */
.4byte .Lend_text1 /* DW_AT_high_pc */
.4byte .Lbegin_text1 /* DW_AT_low_pc */
.ascii "file1.txt\0" /* DW_AT_name */
.ascii "GNU C 3.3.3\0" /* DW_AT_producer */
.byte 1 /* DW_AT_language (C) */
/* func_cu1 */
.uleb128 2 /* Abbrev: DW_TAG_subprogram */
.byte 1 /* DW_AT_external */
.byte 1 /* DW_AT_decl_file */
.byte 2 /* DW_AT_decl_line */
.ascii "func_cu1\0" /* DW_AT_name */
.4byte .Ltype_int2_in_cu2 /* DW_AT_type */
.4byte .Lbegin_func_cu1 /* DW_AT_low_pc */
.4byte .Lend_func_cu1 /* DW_AT_high_pc */
.byte 1 /* DW_AT_frame_base: length */
.byte 0x55 /* DW_AT_frame_base: DW_OP_reg5 */
/* This type is named "int1" and not "int" to ensure it is unique,
and thus we can easily ensure we expand this CU and not some
other CU with "int". */
.Ltype_int1_in_cu1:
.uleb128 3 /* Abbrev: DW_TAG_base_type */
.ascii "int1\0" /* DW_AT_name */
.byte 4 /* DW_AT_byte_size */
.byte 5 /* DW_AT_encoding */
.Ltype_const_int1_in_cu1:
.uleb128 4 /* Abbrev: DW_TAG_const_type */
.4byte .Ltype_int1_in_cu1-.Lcu1_begin /* DW_AT_type */
.uleb128 5 /* Abbrev: DW_TAG_variable */
.ascii "one\0" /* DW_AT_name */
.4byte .Ltype_const_int1_in_cu1-.Lcu1_begin /* DW_AT_type */
.byte 1 /* DW_AT_const_value */
.byte 0 /* End of children of CU */
.Lcu1_end:
/* Second compilation unit. */
.Lcu2_begin:
/* CU header */
.4byte .Lcu2_end - .Lcu2_start /* Length of Compilation Unit */
.Lcu2_start:
.2byte 2 /* DWARF Version */
.4byte .Labbrev2_begin /* Offset into abbrev section */
.byte 4 /* Pointer size */
/* CU die */
.uleb128 1 /* Abbrev: DW_TAG_compile_unit */
.ascii "file1.txt\0" /* DW_AT_name */
.ascii "GNU C 3.3.3\0" /* DW_AT_producer */
.byte 1 /* DW_AT_language (C) */
/* This type is named "int2" and not "int" to ensure it is unique,
and thus we can easily ensure we expand this CU and not some
other CU with "int". */
.Ltype_int2_in_cu2:
.uleb128 2 /* Abbrev: DW_TAG_base_type */
.ascii "int2\0" /* DW_AT_name */
.byte 4 /* DW_AT_byte_size */
.byte 5 /* DW_AT_encoding */
.Ltype_const_int2_in_cu2:
.uleb128 3 /* Abbrev: DW_TAG_const_type */
.4byte .Ltype_int2_in_cu2-.Lcu2_begin /* DW_AT_type */
.uleb128 4 /* Abbrev: DW_TAG_variable */
.ascii "two\0" /* DW_AT_name */
.4byte .Ltype_const_int2_in_cu2-.Lcu2_begin /* DW_AT_type */
.byte 2 /* DW_AT_const_value */
.byte 0 /* End of children of CU */
.Lcu2_end:
/* Abbrev table */
.section .debug_abbrev
.Labbrev1_begin:
.uleb128 1 /* Abbrev code */
.uleb128 0x11 /* DW_TAG_compile_unit */
.byte 1 /* has_children */
.uleb128 0x10 /* DW_AT_stmt_list */
.uleb128 0x6 /* DW_FORM_data4 */
.uleb128 0x12 /* DW_AT_high_pc */
.uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x11 /* DW_AT_low_pc */
.uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x25 /* DW_AT_producer */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x13 /* DW_AT_language */
.uleb128 0xb /* DW_FORM_data1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 2 /* Abbrev code */
.uleb128 0x2e /* DW_TAG_subprogram */
.byte 0 /* has_children */
.uleb128 0x3f /* DW_AT_external */
.uleb128 0xc /* DW_FORM_flag */
.uleb128 0x3a /* DW_AT_decl_file */
.uleb128 0xb /* DW_FORM_data1 */
.uleb128 0x3b /* DW_AT_decl_line */
.uleb128 0xb /* DW_FORM_data1 */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x10 /* DW_FORM_ref_addr */
.uleb128 0x11 /* DW_AT_low_pc */
.uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x12 /* DW_AT_high_pc */
.uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x40 /* DW_AT_frame_base */
.uleb128 0xa /* DW_FORM_block1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 3 /* Abbrev code */
.uleb128 0x24 /* DW_TAG_base_type */
.byte 0 /* has_children */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0xb /* DW_AT_byte_size */
.uleb128 0xb /* DW_FORM_data1 */
.uleb128 0x3e /* DW_AT_encoding */
.uleb128 0xb /* DW_FORM_data1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 4 /* Abbrev code */
.uleb128 0x26 /* DW_TAG_const_type */
.byte 0x0 /* DW_children_no */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x13 /* DW_FORM_ref4 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 5 /* Abbrev code */
.uleb128 0x34 /* DW_TAG_variable */
.byte 0x0 /* DW_children_no */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x13 /* DW_FORM_ref4 */
.uleb128 0x1c /* DW_AT_const_value */
.uleb128 0xb /* DW_FORM_data1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.Labbrev2_begin:
.uleb128 1 /* Abbrev code */
.uleb128 0x11 /* DW_TAG_compile_unit */
.byte 1 /* has_children */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x25 /* DW_AT_producer */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x13 /* DW_AT_language */
.uleb128 0xb /* DW_FORM_data1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 2 /* Abbrev code */
.uleb128 0x24 /* DW_TAG_base_type */
.byte 0 /* has_children */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0xb /* DW_AT_byte_size */
.uleb128 0xb /* DW_FORM_data1 */
.uleb128 0x3e /* DW_AT_encoding */
.uleb128 0xb /* DW_FORM_data1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 3 /* Abbrev code */
.uleb128 0x26 /* DW_TAG_const_type */
.byte 0x0 /* DW_children_no */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x13 /* DW_FORM_ref4 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 4 /* Abbrev code */
.uleb128 0x34 /* DW_TAG_variable */
.byte 0x0 /* DW_children_no */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x13 /* DW_FORM_ref4 */
.uleb128 0x1c /* DW_AT_const_value */
.uleb128 0xb /* DW_FORM_data1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
/* Line table */
.section .debug_line
.Lline1_begin:
.4byte .Lline1_end - .Lline1_start /* Initial length */
.Lline1_start:
.2byte 2 /* Version */
.4byte .Lline1_lines - .Lline1_hdr /* header_length */
.Lline1_hdr:
.byte 1 /* Minimum insn length */
.byte 1 /* default_is_stmt */
.byte 1 /* line_base */
.byte 1 /* line_range */
.byte 0x10 /* opcode_base */
/* Standard lengths */
.byte 0
.byte 1
.byte 1
.byte 1
.byte 1
.byte 0
.byte 0
.byte 0
.byte 1
.byte 0
.byte 0
.byte 1
.byte 0
.byte 0
.byte 0
/* Include directories */
.byte 0
/* File names */
.ascii "file1.txt\0"
.uleb128 0
.uleb128 0
.uleb128 0
.byte 0
.Lline1_lines:
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
.4byte .Lbegin_func_cu1
.byte 3 /* DW_LNS_advance_line */
.sleb128 3 /* ... to 4 */
.byte 1 /* DW_LNS_copy */
.byte 1 /* DW_LNS_copy (second time as an end-of-prologue marker) */
.byte 0 /* DW_LNE_set_address */
.uleb128 5
.byte 2
.4byte .Lend_func_cu1
.byte 0 /* DW_LNE_end_of_sequence */
.uleb128 1
.byte 1
.Lline1_end:

View File

@ -0,0 +1,156 @@
.*: +file format .*
Contents of the .z?debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x5e \(32-bit\)
Version: 2
Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<c> DW_AT_stmt_list : 0x0
<10> DW_AT_high_pc : 0x4
<14> DW_AT_low_pc : 0x0
<18> DW_AT_name : file1.txt
<22> DW_AT_producer : GNU C 3.3.3
<2e> DW_AT_language : 1 \(ANSI C\)
<1><2f>: Abbrev Number: 2 \(DW_TAG_subprogram\)
<30> DW_AT_external : 1
<31> DW_AT_decl_file : 1
<32> DW_AT_decl_line : 2
<33> DW_AT_name : func_cu1
<3c> DW_AT_type : <0x85>
<40> DW_AT_low_pc : 0x0
<44> DW_AT_high_pc : 0x4
<48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5 \([^()]*\)\)
<1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
<4b> DW_AT_name : int1
<50> DW_AT_byte_size : 4
<51> DW_AT_encoding : 5 \(signed\)
<1><52>: Abbrev Number: 4 \(DW_TAG_const_type\)
<53> DW_AT_type : <0x4a>
<1><57>: Abbrev Number: 5 \(DW_TAG_variable\)
<58> DW_AT_name : one
<5c> DW_AT_type : <0x52>
<60> DW_AT_const_value : 1
<1><61>: Abbrev Number: 0
Compilation Unit @ offset 0x62:
Length: 0x37 \(32-bit\)
Version: 2
Abbrev Offset: 0x45
Pointer Size: 4
<0><6d>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<6e> DW_AT_name : file1.txt
<78> DW_AT_producer : GNU C 3.3.3
<84> DW_AT_language : 1 \(ANSI C\)
<1><85>: Abbrev Number: 2 \(DW_TAG_base_type\)
<86> DW_AT_name : int2
<8b> DW_AT_byte_size : 4
<8c> DW_AT_encoding : 5 \(signed\)
<1><8d>: Abbrev Number: 3 \(DW_TAG_const_type\)
<8e> DW_AT_type : <0x85>
<1><92>: Abbrev Number: 4 \(DW_TAG_variable\)
<93> DW_AT_name : two
<97> DW_AT_type : <0x8d>
<9b> DW_AT_const_value : 2
<1><9c>: Abbrev Number: 0
Contents of the .z?debug_abbrev section:
Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_stmt_list DW_FORM_data4
DW_AT_high_pc DW_FORM_addr
DW_AT_low_pc DW_FORM_addr
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
DW_AT_language DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
2 DW_TAG_subprogram \[no children\]
DW_AT_external DW_FORM_flag
DW_AT_decl_file DW_FORM_data1
DW_AT_decl_line DW_FORM_data1
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref_addr
DW_AT_low_pc DW_FORM_addr
DW_AT_high_pc DW_FORM_addr
DW_AT_frame_base DW_FORM_block1
DW_AT value: 0 DW_FORM value: 0
3 DW_TAG_base_type \[no children\]
DW_AT_name DW_FORM_string
DW_AT_byte_size DW_FORM_data1
DW_AT_encoding DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
4 DW_TAG_const_type \[no children\]
DW_AT_type DW_FORM_ref4
DW_AT value: 0 DW_FORM value: 0
5 DW_TAG_variable \[no children\]
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_const_value DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
Number TAG \(0x45\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
DW_AT_language DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
2 DW_TAG_base_type \[no children\]
DW_AT_name DW_FORM_string
DW_AT_byte_size DW_FORM_data1
DW_AT_encoding DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
3 DW_TAG_const_type \[no children\]
DW_AT_type DW_FORM_ref4
DW_AT value: 0 DW_FORM value: 0
4 DW_TAG_variable \[no children\]
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_const_value DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
Raw dump of debug contents of section .z?debug_line:
Offset: 0x0
Length: 62
DWARF Version: 2
Prologue Length: 35
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: 1
Line Range: 1
Opcode Base: 16
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
Opcode 13 has 0 args
Opcode 14 has 0 args
Opcode 15 has 0 args
The Directory Table is empty.
The File Name Table \(offset 0x1f\):
Entry Dir Time Size Name
1 0 0 0 file1.txt
Line Number Statements:
\[0x0000002d\] Extended opcode 2: set Address to 0x0
\[0x00000034\] Advance Line by 3 to 4
\[0x00000036\] Copy
\[0x00000037\] Copy
\[0x00000038\] Extended opcode 2: set Address to 0x4
\[0x0000003f\] Extended opcode 1: End of Sequence

View File

@ -0,0 +1,3 @@
#...
+\[[ 0-9]+\] .debug_info +(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ [0-9a-f]+ +C +0 +0 +1
#pass

View File

@ -0,0 +1,6 @@
#...
+\[[ 0-9]+\] .debug_info
+(PROGBITS|MIPS_DWARF) +0+ +[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+ +0 +0 +1
+\[0+800\]: COMPRESSED
+ZLIB, 0+9d, 1
#pass

View File

@ -0,0 +1,156 @@
.*: +file format .*
Contents of the .debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x5e \(32-bit\)
Version: 2
Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<c> DW_AT_stmt_list : 0x0
<10> DW_AT_high_pc : 0x4
<14> DW_AT_low_pc : 0x0
<18> DW_AT_name : file1.txt
<22> DW_AT_producer : GNU C 3.3.3
<2e> DW_AT_language : 1 \(ANSI C\)
<1><2f>: Abbrev Number: 2 \(DW_TAG_subprogram\)
<30> DW_AT_external : 1
<31> DW_AT_decl_file : 1
<32> DW_AT_decl_line : 2
<33> DW_AT_name : func_cu1
<3c> DW_AT_type : <0x85>
<40> DW_AT_low_pc : 0x0
<44> DW_AT_high_pc : 0x4
<48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5 \([^()]*\)\)
<1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
<4b> DW_AT_name : int1
<50> DW_AT_byte_size : 4
<51> DW_AT_encoding : 5 \(signed\)
<1><52>: Abbrev Number: 4 \(DW_TAG_const_type\)
<53> DW_AT_type : <0x4a>
<1><57>: Abbrev Number: 5 \(DW_TAG_variable\)
<58> DW_AT_name : one
<5c> DW_AT_type : <0x52>
<60> DW_AT_const_value : 1
<1><61>: Abbrev Number: 0
Compilation Unit @ offset 0x62:
Length: 0x37 \(32-bit\)
Version: 2
Abbrev Offset: 0x45
Pointer Size: 4
<0><6d>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<6e> DW_AT_name : file1.txt
<78> DW_AT_producer : GNU C 3.3.3
<84> DW_AT_language : 1 \(ANSI C\)
<1><85>: Abbrev Number: 2 \(DW_TAG_base_type\)
<86> DW_AT_name : int2
<8b> DW_AT_byte_size : 4
<8c> DW_AT_encoding : 5 \(signed\)
<1><8d>: Abbrev Number: 3 \(DW_TAG_const_type\)
<8e> DW_AT_type : <0x85>
<1><92>: Abbrev Number: 4 \(DW_TAG_variable\)
<93> DW_AT_name : two
<97> DW_AT_type : <0x8d>
<9b> DW_AT_const_value : 2
<1><9c>: Abbrev Number: 0
Contents of the .debug_abbrev section:
Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_stmt_list DW_FORM_data4
DW_AT_high_pc DW_FORM_addr
DW_AT_low_pc DW_FORM_addr
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
DW_AT_language DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
2 DW_TAG_subprogram \[no children\]
DW_AT_external DW_FORM_flag
DW_AT_decl_file DW_FORM_data1
DW_AT_decl_line DW_FORM_data1
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref_addr
DW_AT_low_pc DW_FORM_addr
DW_AT_high_pc DW_FORM_addr
DW_AT_frame_base DW_FORM_block1
DW_AT value: 0 DW_FORM value: 0
3 DW_TAG_base_type \[no children\]
DW_AT_name DW_FORM_string
DW_AT_byte_size DW_FORM_data1
DW_AT_encoding DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
4 DW_TAG_const_type \[no children\]
DW_AT_type DW_FORM_ref4
DW_AT value: 0 DW_FORM value: 0
5 DW_TAG_variable \[no children\]
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_const_value DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
Number TAG \(0x45\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
DW_AT_language DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
2 DW_TAG_base_type \[no children\]
DW_AT_name DW_FORM_string
DW_AT_byte_size DW_FORM_data1
DW_AT_encoding DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
3 DW_TAG_const_type \[no children\]
DW_AT_type DW_FORM_ref4
DW_AT value: 0 DW_FORM value: 0
4 DW_TAG_variable \[no children\]
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_const_value DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
Raw dump of debug contents of section .debug_line:
Offset: 0x0
Length: 62
DWARF Version: 2
Prologue Length: 35
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: 1
Line Range: 1
Opcode Base: 16
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
Opcode 13 has 0 args
Opcode 14 has 0 args
Opcode 15 has 0 args
The Directory Table is empty.
The File Name Table \(offset 0x1f\):
Entry Dir Time Size Name
1 0 0 0 file1.txt
Line Number Statements:
\[0x0000002d\] Extended opcode 2: set Address to 0x0
\[0x00000034\] Advance Line by 3 to 4
\[0x00000036\] Copy
\[0x00000037\] Copy
\[0x00000038\] Extended opcode 2: set Address to 0x4
\[0x0000003f\] Extended opcode 1: End of Sequence

View File

@ -0,0 +1,16 @@
.file "dw2-decodedline.c"
.file 1 "dw2-decodedline.c"
.file 2 "directory/file1.c"
.text
.globl f1
.type f1, %function
f1:
.loc 2 1 0
l.nop
.size f1, .-f1
.globl main
.type main, %function
main:
.loc 1 2 0
l.nop
.size main, .-main

View File

@ -0,0 +1,140 @@
/* Copyright (C) 2015 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 3 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, see <http://www.gnu.org/licenses/>. */
/* This tests makes use of the .debug_ranges section, especially,
making sure that the base address encoding scheme is used. */
/* Dummy function to provide debug information for. */
.text
.globl _start
_start:
.4byte 0
.Lbegin_text1:
.globl func_cu1
.type func_cu1, %function
func_cu1:
.Lbegin_func_cu1:
.4byte 0
.Lend_func_cu1:
.size func_cu1, .-func_cu1
.Lend_text1:
.Lbegin_text2:
.globl func_cu2
.type func_cu2, %function
func_cu2:
.Lbegin_func_cu2:
.4byte 0
.Lend_func_cu2:
.size func_cu2, .-func_cu2
.Lend_text2:
/* Debug information */
.section .debug_info
.Lcu1_begin:
/* CU header */
.4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
.Lcu1_start:
.2byte 2 /* DWARF Version */
.4byte .Labbrev1_begin /* Offset into abbrev section */
.byte 4 /* Pointer size */
/* CU die */
.uleb128 1 /* Abbrev: DW_TAG_compile_unit */
.4byte .Lrange1_begin
.ascii "file1.c\0" /* DW_AT_name */
.byte 1 /* DW_AT_language (C) */
/* func_cu1 */
.uleb128 2 /* Abbrev: DW_TAG_subprogram */
.ascii "func_cu1\0" /* DW_AT_name */
.4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
.4byte .Lbegin_func_cu1 /* DW_AT_low_pc */
.4byte .Lend_func_cu1 /* DW_AT_high_pc */
/* func_cu1 */
.uleb128 2 /* Abbrev: DW_TAG_subprogram */
.ascii "func_cu2\0" /* DW_AT_name */
.4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
.4byte .Lbegin_func_cu2 /* DW_AT_low_pc */
.4byte .Lend_func_cu2 /* DW_AT_high_pc */
.Ltype_int:
.uleb128 3 /* Abbrev: DW_TAG_base_type */
.ascii "int\0" /* DW_AT_name */
.byte 4 /* DW_AT_byte_size */
.byte 5 /* DW_AT_encoding */
.byte 0 /* End of children of CU */
.Lcu1_end:
.section .debug_ranges
.Lrange1_begin:
.4byte 0xffffffff /* base address marker */
.4byte .Lbegin_text1 /* base address */
.4byte 0 /* start offset */
.4byte .Lend_text1 - .Lbegin_text1 /* end offset */
.4byte 0xffffffff /* base address marker */
.4byte .Lbegin_text2 /* base address */
.4byte 0 /* start offset */
.4byte .Lend_text2 - .Lbegin_text2 /* end offset */
.4byte 0 /* End marker (Part 1) */
.4byte 0 /* End marker (Part 2) */
.section .debug_abbrev
.Labbrev1_begin:
.uleb128 1 /* Abbrev code */
.uleb128 0x11 /* DW_TAG_compile_unit */
.byte 1 /* has_children */
.uleb128 0x55 /* DW_AT_ranges */
.uleb128 0x17 /* DW_FORM_sec_offset */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x13 /* DW_AT_language */
.uleb128 0xb /* DW_FORM_data1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 2 /* Abbrev code */
.uleb128 0x2e /* DW_TAG_subprogram */
.byte 0 /* has_children */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0x49 /* DW_AT_type */
.uleb128 0x13 /* DW_FORM_ref4 */
.uleb128 0x11 /* DW_AT_low_pc */
.uleb128 0x1 /* DW_FORM_addr */
.uleb128 0x12 /* DW_AT_high_pc */
.uleb128 0x1 /* DW_FORM_addr */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.uleb128 3 /* Abbrev code */
.uleb128 0x24 /* DW_TAG_base_type */
.byte 0 /* has_children */
.uleb128 0x3 /* DW_AT_name */
.uleb128 0x8 /* DW_FORM_string */
.uleb128 0xb /* DW_AT_byte_size */
.uleb128 0xb /* DW_FORM_data1 */
.uleb128 0x3e /* DW_AT_encoding */
.uleb128 0xb /* DW_FORM_data1 */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */
.byte 0x0 /* Terminator */

View File

@ -0,0 +1,11 @@
.*: file format .*
Contents of the \.debug_ranges section:
Offset Begin End
00000000 ffffffff 00000004 \(base address\)
00000000 00000004 00000008
00000000 ffffffff 00000008 \(base address\)
00000000 00000008 0000000c
00000000 <End of list>

View File

@ -0,0 +1,17 @@
#PROG: elfedit
#elfedit: --output-mach iamcu
#source: empty.s
#as: --32
#readelf: -h
#name: Update ELF header 5
#target: x86_64-*-* i386-*-*
#...
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 \(current\)
#...
Machine: Intel MCU
#...

View File

@ -0,0 +1,362 @@
In archive tmpdir/dw2-copy-compressedgabi.a:
dw2-1-compressedgabi.o: +file format .*
Contents of the .debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x4e \(32-bit\)
Version: 2
Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<c> DW_AT_stmt_list : 0x0
<10> DW_AT_high_pc : 0x.
<14> DW_AT_low_pc : 0x.
<18> DW_AT_name : file1.txt
<22> DW_AT_producer : GNU C 3.3.3
<2e> DW_AT_language : 1 \(ANSI C\)
<1><2f>: Abbrev Number: 2 \(DW_TAG_subprogram\)
<30> DW_AT_external : 1
<31> DW_AT_decl_file : 1
<32> DW_AT_decl_line : 2
<33> DW_AT_name : func_cu1
<3c> DW_AT_type : <0x4a>
<40> DW_AT_low_pc : 0x.
<44> DW_AT_high_pc : 0x.
<48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5 \([^()]*\)\)
<1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
<4b> DW_AT_name : int
<4f> DW_AT_byte_size : 4
<50> DW_AT_encoding : 5 \(signed\)
<1><51>: Abbrev Number: 0
Raw dump of debug contents of section .debug_line:
Offset: 0x0
Length: 62
DWARF Version: 2
Prologue Length: 35
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: 1
Line Range: 1
Opcode Base: 16
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
Opcode 13 has 0 args
Opcode 14 has 0 args
Opcode 15 has 0 args
The Directory Table is empty.
The File Name Table \(offset 0x.*\):
Entry Dir Time Size Name
1 0 0 0 file1.txt
Line Number Statements:
\[0x.*\] Extended opcode 2: set Address to 0x4
\[0x.*\] Advance Line by 3 to 4
\[0x.*\] Copy
\[0x.*\] Copy
\[0x.*\] Extended opcode 2: set Address to 0x8
\[0x.*\] Extended opcode 1: End of Sequence
Contents of the .debug_abbrev section:
Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_stmt_list DW_FORM_data4
DW_AT_high_pc DW_FORM_addr
DW_AT_low_pc DW_FORM_addr
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
DW_AT_language DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
2 DW_TAG_subprogram \[no children\]
DW_AT_external DW_FORM_flag
DW_AT_decl_file DW_FORM_data1
DW_AT_decl_line DW_FORM_data1
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_low_pc DW_FORM_addr
DW_AT_high_pc DW_FORM_addr
DW_AT_frame_base DW_FORM_block1
DW_AT value: 0 DW_FORM value: 0
3 DW_TAG_base_type \[no children\]
DW_AT_name DW_FORM_string
DW_AT_byte_size DW_FORM_data1
DW_AT_encoding DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
dw2-2-compressedgabi.o: +file format .*
Contents of the .debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x4e \(32-bit\)
Version: 2
Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<c> DW_AT_stmt_list : 0x0
<10> DW_AT_high_pc : 0x4
<14> DW_AT_low_pc : 0x0
<18> DW_AT_name : file1.txt
<22> DW_AT_producer : GNU C 3.3.3
<2e> DW_AT_language : 1 \(ANSI C\)
<1><2f>: Abbrev Number: 2 \(DW_TAG_subprogram\)
<30> DW_AT_external : 1
<31> DW_AT_decl_file : 1
<32> DW_AT_decl_line : 2
<33> DW_AT_name : func_cu2
<3c> DW_AT_type : <0x4a>
<40> DW_AT_low_pc : 0x0
<44> DW_AT_high_pc : 0x4
<48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5 \(.*\)\)
<1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
<4b> DW_AT_name : int
<4f> DW_AT_byte_size : 4
<50> DW_AT_encoding : 5 \(signed\)
<1><51>: Abbrev Number: 0
Raw dump of debug contents of section .debug_line:
Offset: 0x0
Length: 62
DWARF Version: 2
Prologue Length: 35
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: 1
Line Range: 1
Opcode Base: 16
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
Opcode 13 has 0 args
Opcode 14 has 0 args
Opcode 15 has 0 args
The Directory Table is empty.
The File Name Table \(offset 0x1f\):
Entry Dir Time Size Name
1 0 0 0 file1.txt
Line Number Statements:
\[0x0000002d\] Extended opcode 2: set Address to 0x0
\[0x00000034\] Advance Line by 3 to 4
\[0x00000036\] Copy
\[0x00000037\] Copy
\[0x00000038\] Extended opcode 2: set Address to 0x4
\[0x0000003f\] Extended opcode 1: End of Sequence
Contents of the .debug_abbrev section:
Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_stmt_list DW_FORM_data4
DW_AT_high_pc DW_FORM_addr
DW_AT_low_pc DW_FORM_addr
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
DW_AT_language DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
2 DW_TAG_subprogram \[no children\]
DW_AT_external DW_FORM_flag
DW_AT_decl_file DW_FORM_data1
DW_AT_decl_line DW_FORM_data1
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_low_pc DW_FORM_addr
DW_AT_high_pc DW_FORM_addr
DW_AT_frame_base DW_FORM_block1
DW_AT value: 0 DW_FORM value: 0
3 DW_TAG_base_type \[no children\]
DW_AT_name DW_FORM_string
DW_AT_byte_size DW_FORM_data1
DW_AT_encoding DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
dw2-3-compressedgabi.o: +file format .*
Contents of the .debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x5e \(32-bit\)
Version: 2
Abbrev Offset: 0x0
Pointer Size: 4
<0><b>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<c> DW_AT_stmt_list : 0x0
<10> DW_AT_high_pc : 0x4
<14> DW_AT_low_pc : 0x0
<18> DW_AT_name : file1.txt
<22> DW_AT_producer : GNU C 3.3.3
<2e> DW_AT_language : 1 \(ANSI C\)
<1><2f>: Abbrev Number: 2 \(DW_TAG_subprogram\)
<30> DW_AT_external : 1
<31> DW_AT_decl_file : 1
<32> DW_AT_decl_line : 2
<33> DW_AT_name : func_cu1
<3c> DW_AT_type : <0x85>
<40> DW_AT_low_pc : 0x0
<44> DW_AT_high_pc : 0x4
<48> DW_AT_frame_base : 1 byte block: 55 \(DW_OP_reg5 \([^()]*\)\)
<1><4a>: Abbrev Number: 3 \(DW_TAG_base_type\)
<4b> DW_AT_name : int1
<50> DW_AT_byte_size : 4
<51> DW_AT_encoding : 5 \(signed\)
<1><52>: Abbrev Number: 4 \(DW_TAG_const_type\)
<53> DW_AT_type : <0x4a>
<1><57>: Abbrev Number: 5 \(DW_TAG_variable\)
<58> DW_AT_name : one
<5c> DW_AT_type : <0x52>
<60> DW_AT_const_value : 1
<1><61>: Abbrev Number: 0
Compilation Unit @ offset 0x62:
Length: 0x37 \(32-bit\)
Version: 2
Abbrev Offset: 0x45
Pointer Size: 4
<0><6d>: Abbrev Number: 1 \(DW_TAG_compile_unit\)
<6e> DW_AT_name : file1.txt
<78> DW_AT_producer : GNU C 3.3.3
<84> DW_AT_language : 1 \(ANSI C\)
<1><85>: Abbrev Number: 2 \(DW_TAG_base_type\)
<86> DW_AT_name : int2
<8b> DW_AT_byte_size : 4
<8c> DW_AT_encoding : 5 \(signed\)
<1><8d>: Abbrev Number: 3 \(DW_TAG_const_type\)
<8e> DW_AT_type : <0x85>
<1><92>: Abbrev Number: 4 \(DW_TAG_variable\)
<93> DW_AT_name : two
<97> DW_AT_type : <0x8d>
<9b> DW_AT_const_value : 2
<1><9c>: Abbrev Number: 0
Contents of the .debug_abbrev section:
Number TAG \(0x0\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_stmt_list DW_FORM_data4
DW_AT_high_pc DW_FORM_addr
DW_AT_low_pc DW_FORM_addr
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
DW_AT_language DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
2 DW_TAG_subprogram \[no children\]
DW_AT_external DW_FORM_flag
DW_AT_decl_file DW_FORM_data1
DW_AT_decl_line DW_FORM_data1
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref_addr
DW_AT_low_pc DW_FORM_addr
DW_AT_high_pc DW_FORM_addr
DW_AT_frame_base DW_FORM_block1
DW_AT value: 0 DW_FORM value: 0
3 DW_TAG_base_type \[no children\]
DW_AT_name DW_FORM_string
DW_AT_byte_size DW_FORM_data1
DW_AT_encoding DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
4 DW_TAG_const_type \[no children\]
DW_AT_type DW_FORM_ref4
DW_AT value: 0 DW_FORM value: 0
5 DW_TAG_variable \[no children\]
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_const_value DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
Number TAG \(0x45\)
1 DW_TAG_compile_unit \[has children\]
DW_AT_name DW_FORM_string
DW_AT_producer DW_FORM_string
DW_AT_language DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
2 DW_TAG_base_type \[no children\]
DW_AT_name DW_FORM_string
DW_AT_byte_size DW_FORM_data1
DW_AT_encoding DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
3 DW_TAG_const_type \[no children\]
DW_AT_type DW_FORM_ref4
DW_AT value: 0 DW_FORM value: 0
4 DW_TAG_variable \[no children\]
DW_AT_name DW_FORM_string
DW_AT_type DW_FORM_ref4
DW_AT_const_value DW_FORM_data1
DW_AT value: 0 DW_FORM value: 0
Raw dump of debug contents of section .debug_line:
Offset: 0x0
Length: 62
DWARF Version: 2
Prologue Length: 35
Minimum Instruction Length: 1
Initial value of 'is_stmt': 1
Line Base: 1
Line Range: 1
Opcode Base: 16
Opcodes:
Opcode 1 has 0 args
Opcode 2 has 1 args
Opcode 3 has 1 args
Opcode 4 has 1 args
Opcode 5 has 1 args
Opcode 6 has 0 args
Opcode 7 has 0 args
Opcode 8 has 0 args
Opcode 9 has 1 args
Opcode 10 has 0 args
Opcode 11 has 0 args
Opcode 12 has 1 args
Opcode 13 has 0 args
Opcode 14 has 0 args
Opcode 15 has 0 args
The Directory Table is empty.
The File Name Table \(offset 0x1f\):
Entry Dir Time Size Name
1 0 0 0 file1.txt
Line Number Statements:
\[0x0000002d\] Extended opcode 2: set Address to 0x0
\[0x00000034\] Advance Line by 3 to 4
\[0x00000036\] Copy
\[0x00000037\] Copy
\[0x00000038\] Extended opcode 2: set Address to 0x4
\[0x0000003f\] Extended opcode 1: End of Sequence
#pass

View File

@ -0,0 +1,25 @@
# Copyright (C) 2013-2015 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
if ![istarget mips*-*-*] {
return
}
if [is_elf_format] {
run_dump_test "mixed-mips16"
run_dump_test "mixed-micromips"
}

View File

@ -0,0 +1,30 @@
#PROG: objcopy
#objdump: -dr --prefix-addresses --show-raw-insn
#name: Mixed MIPS and microMIPS disassembly
#as: -32 -mips2
# Test mixed-mode disassembly in overlapping sections.
.*: +file format .*mips.*
Disassembly of section \.text\.foo:
[0-9a-f]+ <[^>]*> 27bdffe0 addiu sp,sp,-32
[0-9a-f]+ <[^>]*> afbf001c sw ra,28\(sp\)
[0-9a-f]+ <[^>]*> 0c000000 jal 00000000 <.*>
[ ]*[0-9a-f]+: R_MIPS_26 baz
[0-9a-f]+ <[^>]*> 00000000 nop
[0-9a-f]+ <[^>]*> 8fbf001c lw ra,28\(sp\)
[0-9a-f]+ <[^>]*> 03e00008 jr ra
[0-9a-f]+ <[^>]*> 27bd0020 addiu sp,sp,32
\.\.\.
Disassembly of section \.text\.bar:
[0-9a-f]+ <[^>]*> 4ff1 addiu sp,sp,-32
[0-9a-f]+ <[^>]*> cbe7 sw ra,28\(sp\)
[0-9a-f]+ <[^>]*> 7400 0000 jals 00000000 <.*>
[ ]*[0-9a-f]+: R_MICROMIPS_26_S1 baz
[0-9a-f]+ <[^>]*> 0c00 nop
[0-9a-f]+ <[^>]*> 4be7 lw ra,28\(sp\)
[0-9a-f]+ <[^>]*> 4708 jraddiusp 32
[0-9a-f]+ <[^>]*> 0c00 nop
\.\.\.

View File

@ -0,0 +1,33 @@
.section .text.foo, "ax", @progbits
.set nomicromips
.globl foo
.ent foo
foo:
addiu $sp, $sp, -32
sw $ra, 28($sp)
jal baz
lw $ra, 28($sp)
addiu $sp, $sp, 32
jr $ra
.end foo
# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
.align 2
.space 8
.section .text.bar, "ax", @progbits
.set micromips
.globl bar
.ent bar
bar:
addiu $sp, $sp, -32
sw $ra, 28($sp)
jals baz
lw $ra, 28($sp)
jraddiusp 32
.end bar
# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
.align 2
.space 8

View File

@ -0,0 +1,30 @@
#PROG: objcopy
#objdump: -dr --prefix-addresses --show-raw-insn
#name: Mixed MIPS and MIPS16 disassembly
#as: -32 -mips2
# Test mixed-mode disassembly in overlapping sections.
.*: +file format .*mips.*
Disassembly of section \.text\.foo:
[0-9a-f]+ <[^>]*> 27bdffe0 addiu sp,sp,-32
[0-9a-f]+ <[^>]*> afbf001c sw ra,28\(sp\)
[0-9a-f]+ <[^>]*> 0c000000 jal 00000000 <.*>
[ ]*[0-9a-f]+: R_MIPS_26 baz
[0-9a-f]+ <[^>]*> 00000000 nop
[0-9a-f]+ <[^>]*> 8fbf001c lw ra,28\(sp\)
[0-9a-f]+ <[^>]*> 03e00008 jr ra
[0-9a-f]+ <[^>]*> 27bd0020 addiu sp,sp,32
\.\.\.
Disassembly of section \.text\.bar:
[0-9a-f]+ <[^>]*> 63fc addiu sp,-32
[0-9a-f]+ <[^>]*> 6207 sw ra,28\(sp\)
[0-9a-f]+ <[^>]*> 1800 0000 jal 00000000 <.*>
[ ]*[0-9a-f]+: R_MIPS16_26 baz
[0-9a-f]+ <[^>]*> 6500 nop
[0-9a-f]+ <[^>]*> 9707 lw a3,28\(sp\)
[0-9a-f]+ <[^>]*> ef00 jr a3
[0-9a-f]+ <[^>]*> 6304 addiu sp,32
\.\.\.

View File

@ -0,0 +1,34 @@
.section .text.foo, "ax", @progbits
.set nomips16
.globl foo
.ent foo
foo:
addiu $sp, $sp, -32
sw $ra, 28($sp)
jal baz
lw $ra, 28($sp)
addiu $sp, $sp, 32
jr $ra
.end foo
# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
.align 2
.space 8
.section .text.bar, "ax", @progbits
.set mips16
.globl bar
.ent bar
bar:
addiu $sp, -32
sw $ra, 28($sp)
jal baz
lw $a3, 28($sp)
addiu $sp, 32
jr $a3
.end bar
# Force at least 8 (non-delay-slot) zero bytes, to make 'objdump' print ...
.align 2
.space 8

View File

@ -0,0 +1,15 @@
.globl text_symbol1
.globl text_symbol2
.globl text_symbol3
.globl end_symbol
.text
text_symbol1:
.byte 0,0,0,0
.byte 0,0,0,0
.byte 0,0,0,0
text_symbol2:
.byte 0,0,0,0
.byte 0,0,0,0
text_symbol3:
.byte 0,0,0,0
end_symbol:

View File

@ -0,0 +1,16 @@
.globl text_symbol1
.globl text_symbol2
.globl text_symbol3
.text
text_symbol1:
.long 0
.long 0
.long 0
.size text_symbol1, . - text_symbol1
text_symbol2:
.long 0
.long 0
.size text_symbol2, . - text_symbol2
text_symbol3:
.long 0
.size text_symbol3, . - text_symbol3

View File

@ -0,0 +1,234 @@
.section .debug_info,"",%progbits
.4byte 0x77
.2byte 0x4
.4byte .Ldebug_abbrev0
.byte 0x4
.uleb128 0x1
.4byte .LASF3
.byte 0xc
.ascii "x.c\000"
.4byte .LASF4
.4byte .Ltext0
.4byte .Letext0
.4byte .Ldebug_line0
.uleb128 0x2
.ascii "foo\000"
.byte 0x1
.byte 0x2
.4byte .LFB0
.4byte .LFE0
.uleb128 0x1
.byte 0x9c
.4byte 0x64
.uleb128 0x3
.ascii "b\000"
.byte 0x1
.byte 0x2
.4byte 0x64
.4byte .LLST0
.uleb128 0x4
.4byte .LASF0
.byte 0x1
.byte 0x2
.4byte 0x66
.4byte .LLST1
.uleb128 0x5
.ascii "ptr\000"
.byte 0x1
.byte 0x4
.4byte 0x6d
.uleb128 0x1
.byte 0x50
.byte 0
.uleb128 0x6
.byte 0x4
.uleb128 0x7
.byte 0x4
.byte 0x7
.4byte .LASF1
.uleb128 0x8
.byte 0x4
.4byte 0x73
.uleb128 0x7
.byte 0x1
.byte 0x8
.4byte .LASF2
.byte 0
.section .debug_abbrev,"",%progbits
.Ldebug_abbrev0:
.uleb128 0x1
.uleb128 0x11
.byte 0x1
.uleb128 0x25
.uleb128 0xe
.uleb128 0x13
.uleb128 0xb
.uleb128 0x3
.uleb128 0x8
.uleb128 0x1b
.uleb128 0xe
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x6
.uleb128 0x10
.uleb128 0x17
.byte 0
.byte 0
.uleb128 0x2
.uleb128 0x2e
.byte 0x1
.uleb128 0x3f
.uleb128 0x19
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x27
.uleb128 0x19
.uleb128 0x11
.uleb128 0x1
.uleb128 0x12
.uleb128 0x6
.uleb128 0x40
.uleb128 0x18
.uleb128 0x2117
.uleb128 0x19
.uleb128 0x1
.uleb128 0x13
.byte 0
.byte 0
.uleb128 0x3
.uleb128 0x5
.byte 0
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0x17
.byte 0
.byte 0
.uleb128 0x4
.uleb128 0x5
.byte 0
.uleb128 0x3
.uleb128 0xe
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0x17
.byte 0
.byte 0
.uleb128 0x5
.uleb128 0x34
.byte 0
.uleb128 0x3
.uleb128 0x8
.uleb128 0x3a
.uleb128 0xb
.uleb128 0x3b
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.uleb128 0x2
.uleb128 0x18
.byte 0
.byte 0
.uleb128 0x6
.uleb128 0xf
.byte 0
.uleb128 0xb
.uleb128 0xb
.byte 0
.byte 0
.uleb128 0x7
.uleb128 0x24
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x3e
.uleb128 0xb
.uleb128 0x3
.uleb128 0xe
.byte 0
.byte 0
.uleb128 0x8
.uleb128 0xf
.byte 0
.uleb128 0xb
.uleb128 0xb
.uleb128 0x49
.uleb128 0x13
.byte 0
.byte 0
.byte 0
.section .debug_loc,"",%progbits
.Ldebug_loc0:
.LLST0:
.4byte .LVL0
.4byte .LVL2
.2byte 0x1
.byte 0x50
.4byte .LVL2
.4byte .LFE0
.2byte 0x4
.byte 0xf3
.uleb128 0x1
.byte 0x50
.byte 0x9f
.4byte 0
.4byte 0
.LLST1:
.4byte .LVL0
.4byte .LVL1
.2byte 0x1
.byte 0x51
.4byte .LVL1
.4byte .LVL2
.2byte 0x3
.byte 0x71
.sleb128 -1
.byte 0x9f
.4byte .LVL2
.4byte .LVL3
.2byte 0xb
.byte 0x70
.sleb128 0
.byte 0x20
.byte 0xf3
.uleb128 0x1
.byte 0x51
.byte 0x22
.byte 0x70
.sleb128 0
.byte 0x22
.byte 0x9f
.4byte .LVL3
.4byte .LFE0
.2byte 0xb
.byte 0x70
.sleb128 0
.byte 0x20
.byte 0x70
.sleb128 0
.byte 0x22
.byte 0xf3
.uleb128 0x1
.byte 0x51
.byte 0x22
.byte 0x9f
.4byte 0
.4byte 0

View File

@ -0,0 +1 @@
abcdefgh

View File

@ -0,0 +1,9 @@
#PROG: objcopy
#source: pr19020.in
#as: binary
#objcopy: -O binary -I binary --pad-to=10 --gap-fill=65 --interleave=2 --interleave-width=1 --byte=0
#objdump: -b binary -s
#...
Contents of section .data:
0000 61636567 41414141 4141 +acegAAAAAA +

View File

@ -0,0 +1,9 @@
#PROG: objcopy
#source: pr19020.in
#as: binary
#objcopy: -O binary -I binary --pad-to=10 --gap-fill=65 --reverse-bytes=8
#objdump: -b binary -s
#...
Contents of section .data:
0000 68676665 64636261 4141 +hgfedcbaAA +

View File

@ -0,0 +1,14 @@
Contents of the .*ebug_loc section:
Warning: This section has relocations - addresses seen here may not be accurate.
Offset Begin End Expression
0+0 0+0 0+0 .*
0000000b 0+0 0+0 .*
00000019 <End of list>
00000021 0+0 0+0 .*
0000002c 0+0 0+0 .*
00000039 0+0 0+0 .*
0000004e 0+0 0+0 .*
00000063 <End of list>
#pass

View File

@ -0,0 +1,8 @@
Hex dump of section '.debug_loc':
0x00000000 00000000 00000000 01005000 00000000 ..........P.....
0x00000010 00000004 00f30150 9f000000 00000000 .......P........
0x00000020 00000000 00000000 00010051 00000000 ...........Q....
0x00000030 00000000 0300717f 9f000000 00000000 ......q.........
0x00000040 000b0070 0020f301 51227000 229f0000 ...p. ..Q"p."...
0x00000050 00000000 00000b00 70002070 0022f301 ........p. p."..
0x00000060 51229f00 00000000 000000 Q".........

View File

@ -0,0 +1,14 @@
#PROG: strip
#source: empty.s
#strip: -g
#readelf: -S --wide
#name: strip -g empty file
# The RL78 linker scripts always PROVIDE a __rl78_abs__ symbol so the stripped symbol table is never empty.
#not-target: rl78-*-*
#...
\[ 0\] +NULL +0+ .*
#...
\[ .\] \.shstrtab +STRTAB +0+ .*
Key to Flags:
#pass

View File

@ -0,0 +1,7 @@
#PROG: strip
#strip:
#readelf: -S --wide
#...
\[[ 0-9]+\] \.bss[ \t]+NOBITS[ \t0-9a-f]+WA[ \t]+0[ \t]+0[ \t]+16
#pass

View File

@ -0,0 +1,7 @@
.section .bss
.p2align 4
.space 8
.section .debug_str,"MS",%progbits,1
.string ""
.section .text.foo,"axG",%progbits,foo,comdat
.byte 0

View File

@ -0,0 +1,15 @@
#name: localize 'fo*' but not 'foo'
#PROG: objcopy
#objcopy: -w -L !foo -L fo*
#source: symbols.s
#DUMPPROG: nm
#nm: -n
#...
0+ D bar
0+ d foa
0+ d fob
0+ D foo
0+ d foo1
0+ d foo2

View File

@ -0,0 +1,15 @@
#name: weaken 'fo*' but not 'foo'
#PROG: objcopy
#objcopy: -w -W !foo -W fo*
#source: symbols.s
#DUMPPROG: nm
#nm: -n
#...
0+ D bar
0+ [VW] foa
0+ [VW] fob
0+ D foo
0+ [VW] foo1
0+ [VW] foo2

View File

@ -0,0 +1,15 @@
#name: weaken 'fo*' but not 'foo', localize foo.
#PROG: objcopy
#objcopy: -w -W !foo -W fo* -L foo
#source: symbols.s
#DUMPPROG: nm
#nm: -n
#...
0+ D bar
0+ [VW] foa
0+ [VW] fob
0+ d foo
0+ [VW] foo1
0+ [VW] foo2

View File

@ -0,0 +1,15 @@
#name: weaken '*' but not 'foo' or 'bar'
#PROG: objcopy
#objcopy: -w -W !foo -W !bar -W *
#source: symbols.s
#DUMPPROG: nm
#nm: -n
#...
0+ D bar
0+ [VW] foa
0+ [VW] fob
0+ D foo
0+ [VW] foo1
0+ [VW] foo2

View File

@ -0,0 +1,14 @@
.section ".data", "aw"
.global foo
.global foo1
.global foo2
.global foa
.global fob
.global bar
foo:
foo1:
foo2:
foa:
fob:
bar:
.word 0x0

View File

@ -0,0 +1,2 @@
.section ".foo", "aw"
.word 1, 1, 1, 1

View File

@ -0,0 +1,2 @@
.section ".foo", "aw"
.word 2, 2, 2, 2, 2, 2

View File

@ -0,0 +1,3 @@
.section ".foo", "aw"
.word 3, 3

View File

@ -0,0 +1,2 @@
.section ".bar", "aw"
.word 5

View File

@ -0,0 +1,119 @@
# Copyright (C) 2015 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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
if { [is_remote host] } then {
return
}
# These tests use ELF .section directives
if ![is_elf_format] {
return
}
send_user "Version [binutil_version $OBJCOPY]"
proc do_assemble {srcfile} {
global srcdir
global subdir
set objfile [regsub -- "\.s$" $srcfile ".o"]
if {![binutils_assemble $srcdir/$subdir/${srcfile} tmpdir/${objfile}]} then {
return 0;
}
return 1;
}
proc do_objcopy {objfile extraflags {pattern ""}} {
global OBJCOPY
global OBJCOPYFLAGS
set testname "objcopy $extraflags ${objfile}"
set got [binutils_run $OBJCOPY \
"$OBJCOPYFLAGS ${extraflags} tmpdir/${objfile}"]
if ![regexp $pattern $got] then {
fail "objcopy ($testname)"
return 0
}
if { $pattern != "" } then {
pass "objcopy ($testname)"
}
return 1
}
proc do_compare {file1 file2} {
set src1 "tmpdir/${file1}"
set src2 "tmpdir/${file2}"
set status [remote_exec build cmp "${src1} ${src2}"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
set testname "compare ${file1} ${file2}"
if [string match "" $exec_output] then {
pass "objcopy ($testname)"
} else {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "objcopy ($testname)"
return 0
}
return 1
}
#
# Start Of Tests
#
foreach f [list update-1.s update-2.s update-3.s update-4.s] {
if { ![do_assemble $f] } then {
unsupported "update-section.exp"
return
}
}
if { ![do_objcopy update-1.o \
"--dump-section .foo=tmpdir/dumped-contents"]
|| ![do_objcopy update-2.o \
"--update-section .foo=tmpdir/dumped-contents"]
|| ![do_objcopy update-3.o \
"--update-section .foo=tmpdir/dumped-contents"]
|| ![do_objcopy update-4.o \
"--update-section .bar=tmpdir/dumped-contents \
--rename-section .bar=.foo"] } then {
# If any of the above tests failed then a FAIL will already have
# been reported.
return
}
# Check that the updated object files are as expected.
do_compare update-1.o update-2.o
do_compare update-1.o update-3.o
do_compare update-1.o update-4.o
# Check that --update-section on an unknown section will fail.
if { ![do_objcopy update-2.o \
"--update-section .bar=tmpdir/dumped-contents" \
"error: .bar not found, can't be updated"] } then {
return
}
# Check that --update-section and --remove-section on the same section
# will fail.
if { ![do_objcopy update-2.o \
"--update-section .foo=tmpdir/dumped-contents \
--remove-section .foo" \
"error: section .foo matches both update and remove options"] \
} then {
return
}

View File

@ -0,0 +1,32 @@
#include "windows.h"
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,1
PRODUCTVERSION 1,1
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040704e4"
BEGIN
VALUE L"CompanyName", L"binutil\x0073"
VALUE "FileDescription", "RC compiler."
VALUE "FileVersion", "1.0.1.0"
VALUE "InternalName", "windres.exe"
VALUE "LegalCopyright", "(c) FSF. All rights are reserved."
VALUE "OriginalFilename", "windres.exe"
VALUE "ProductName", "windows resource compiler"
VALUE "ProductVersion", "1.1.0.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x407, 1252
END
END

View File

@ -0,0 +1,51 @@
0000 00000000 20000000 ffff0000 ffff0000 .... ...........
0010 00000000 00000000 00000000 00000000 ................
0020 ec020000 20000000 ffff1000 ffff0100 .... ...........
0030 00000000 00000704 00000000 00000000 ................
0040 ec023400 00005600 53005f00 56004500 ..4...V.S._.V.E.
0050 52005300 49004f00 4e005f00 49004e00 R.S.I.O.N._.I.N.
0060 46004f00 00000000 bd04effe 00000100 F.O.............
0070 00000100 00000100 01000100 00000000 ................
0080 3f000000 00000000 04000000 01000000 ?...............
0090 00000000 00000000 00000000 4c020000 ............L...
00a0 01005300 74007200 69006e00 67004600 ..S.t.r.i.n.g.F.
00b0 69006c00 65004900 6e006600 6f000000 i.l.e.I.n.f.o...
00c0 28020000 01003000 34003000 37003000 (.....0.4.0.7.0.
00d0 34006500 34000000 32000900 01004300 4.e.4...2.....C.
00e0 6f006d00 70006100 6e007900 4e006100 o.m.p.a.n.y.N.a.
00f0 6d006500 00000000 62006900 6e007500 m.e.....b.i.n.u.
0100 74006900 6c007300 00000000 42000d00 t.i.l.s.....B...
0110 01004600 69006c00 65004400 65007300 ..F.i.l.e.D.e.s.
0120 63007200 69007000 74006900 6f006e00 c.r.i.p.t.i.o.n.
0130 00000000 52004300 20006300 6f006d00 ....R.C. .c.o.m.
0140 70006900 6c006500 72002e00 00000000 p.i.l.e.r.......
0150 30000800 01004600 69006c00 65005600 0.....F.i.l.e.V.
0160 65007200 73006900 6f006e00 00000000 e.r.s.i.o.n.....
0170 31002e00 30002e00 31002e00 30000000 1...0...1...0...
0180 38000c00 01004900 6e007400 65007200 8.....I.n.t.e.r.
0190 6e006100 6c004e00 61006d00 65000000 n.a.l.N.a.m.e...
01a0 77006900 6e006400 72006500 73002e00 w.i.n.d.r.e.s...
01b0 65007800 65000000 68002200 01004c00 e.x.e...h."...L.
01c0 65006700 61006c00 43006f00 70007900 e.g.a.l.C.o.p.y.
01d0 72006900 67006800 74000000 28006300 r.i.g.h.t...(.c.
01e0 29002000 46005300 46002e00 20004100 ). .F.S.F... .A.
01f0 6c006c00 20007200 69006700 68007400 l.l. .r.i.g.h.t.
0200 73002000 61007200 65002000 72006500 s. .a.r.e. .r.e.
0210 73006500 72007600 65006400 2e000000 s.e.r.v.e.d.....
0220 40000c00 01004f00 72006900 67006900 @.....O.r.i.g.i.
0230 6e006100 6c004600 69006c00 65006e00 n.a.l.F.i.l.e.n.
0240 61006d00 65000000 77006900 6e006400 a.m.e...w.i.n.d.
0250 72006500 73002e00 65007800 65000000 r.e.s...e.x.e...
0260 54001a00 01005000 72006f00 64007500 T.....P.r.o.d.u.
0270 63007400 4e006100 6d006500 00000000 c.t.N.a.m.e.....
0280 77006900 6e006400 6f007700 73002000 w.i.n.d.o.w.s. .
0290 72006500 73006f00 75007200 63006500 r.e.s.o.u.r.c.e.
02a0 20006300 6f006d00 70006900 6c006500 .c.o.m.p.i.l.e.
02b0 72000000 34000800 01005000 72006f00 r...4.....P.r.o.
02c0 64007500 63007400 56006500 72007300 d.u.c.t.V.e.r.s.
02d0 69006f00 6e000000 31002e00 31002e00 i.o.n...1...1...
02e0 30002e00 30000000 44000000 01005600 0...0...D.....V.
02f0 61007200 46006900 6c006500 49006e00 a.r.F.i.l.e.I.n.
0300 66006f00 00000000 24000400 00005400 f.o.....$.....T.
0310 72006100 6e007300 6c006100 74006900 r.a.n.s.l.a.t.i.
0320 6f006e00 00000000 0704e404 o.n.........

View File

@ -0,0 +1,70 @@
.section .debug_loc,"",%progbits
.byte 0x5a
.byte 0x4c
.byte 0x49
.byte 0x42
.byte 0x00
.byte 0x00
.byte 0x00
.byte 0x00
.byte 0x00
.byte 0x00
.byte 0x00
.byte 0x6b
.byte 0x78
.byte 0x9c
.byte 0x63
.byte 0x60
.byte 0x80
.byte 0x00
.byte 0x46
.byte 0x86
.byte 0x00
.byte 0x28
.byte 0x8b
.byte 0x81
.byte 0x85
.byte 0xe1
.byte 0x33
.byte 0x63
.byte 0xc0
.byte 0x7c
.byte 0x06
.byte 0x34
.byte 0xc0
.byte 0xc8
.byte 0x10
.byte 0x08
.byte 0x63
.byte 0x32
.byte 0x33
.byte 0x14
.byte 0xd6
.byte 0xc3
.byte 0xe5
.byte 0xb9
.byte 0x19
.byte 0x0a
.byte 0x18
.byte 0x14
.byte 0x3e
.byte 0x33
.byte 0x06
.byte 0x2a
.byte 0x15
.byte 0x30
.byte 0x28
.byte 0xa1
.byte 0x0a
.byte 0x02
.byte 0x05
.byte 0x40
.byte 0xe2
.byte 0x70
.byte 0x41
.byte 0x00
.byte 0xc1
.byte 0x6a
.byte 0x0a
.byte 0x83

View File

@ -0,0 +1,25 @@
dnl Copyright (C) 2015 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
# Define HAVE_BITFIELD_TYPE_MATTERS if the type of bitfields effects their
# alignment.
AC_DEFUN([gt_BITFIELD_TYPE_MATTERS],
[
AC_CACHE_CHECK([if the type of bitfields matters], gt_cv_bitfield_type_matters,
[
AC_TRY_COMPILE(
[struct foo1 { char x; char y:1; char z; };
struct foo2 { char x; long long int y:1; char z; };
int foo1test[ sizeof (struct foo1) < sizeof (struct foo2) ? 1 : -1 ]; ],
[], gt_cv_bitfield_type_matters=yes, gt_cv_bitfield_type_matters=no)
])
if test $gt_cv_bitfield_type_matters = yes; then
AC_DEFINE(HAVE_BITFIELD_TYPE_MATTERS, 1,
[Define if the type of bitfields effects alignment.])
fi
])

View File

@ -0,0 +1,11 @@
# This option enables -fsanitize=address for stage2 and stage3.
# Suppress LeakSanitizer in bootstrap.
export ASAN_OPTIONS="detect_leaks=0"
STAGE2_CFLAGS += -fsanitize=address
STAGE3_CFLAGS += -fsanitize=address
POSTSTAGE1_LDFLAGS += -fsanitize=address -static-libasan \
-B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ \
-B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/asan/ \
-B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/asan/.libs

View File

@ -0,0 +1,6 @@
# This option enables LTO for stage2 and stage3 on
# hosts without linker plugin support.
STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects
STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 -ffat-lto-objects
STAGEprofile_CFLAGS += -fno-lto

View File

@ -0,0 +1,9 @@
# This option enables -fcheck-pointer-bounds -mmpx for stage2 and stage3.
STAGE2_CFLAGS += -fcheck-pointer-bounds -mmpx -frandom-seed=1
STAGE3_CFLAGS += -fcheck-pointer-bounds -mmpx -frandom-seed=1
POSTSTAGE1_LDFLAGS += -fcheck-pointer-bounds -mmpx -frandom-seed=1 \
-static-libmpx -static-libmpxwrappers \
-B$$r/prev-$(TARGET_SUBDIR)/libmpx \
-B$$r/prev-$(TARGET_SUBDIR)/libmpx/mpxrt/.libs \
-B$$r/prev-$(TARGET_SUBDIR)/libmpx/mpxwrap/.libs

View File

@ -0,0 +1,8 @@
# This option enables -fsanitize=undefined for stage2 and stage3.
STAGE2_CFLAGS += -fsanitize=undefined
STAGE3_CFLAGS += -fsanitize=undefined
POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan \
-B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ \
-B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/ \
-B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/.libs

View File

@ -0,0 +1,113 @@
# gcc-plugin.m4 -*- Autoconf -*-
# Check whether GCC is able to be built with plugin support.
dnl Copyright (C) 2014 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
# Check for plugin support.
# Respects --enable-plugin.
# Sets the shell variables enable_plugin and pluginlibs.
AC_DEFUN([GCC_ENABLE_PLUGINS],
[# Check for plugin support
AC_ARG_ENABLE(plugin,
[AS_HELP_STRING([--enable-plugin], [enable plugin support])],
enable_plugin=$enableval,
enable_plugin=yes; default_plugin=yes)
pluginlibs=
case "${host}" in
*-*-darwin*)
if test x$build = x$host; then
export_sym_check="nm${exeext} -g"
elif test x$host = x$target; then
export_sym_check="$gcc_cv_nm -g"
else
export_sym_check=
fi
;;
*)
if test x$build = x$host; then
export_sym_check="objdump${exeext} -T"
elif test x$host = x$target; then
export_sym_check="$gcc_cv_objdump -T"
else
export_sym_check=
fi
;;
esac
if test x"$enable_plugin" = x"yes"; then
AC_MSG_CHECKING([for exported symbols])
if test "x$export_sym_check" != x; then
echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c
${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest$ac_exeext > /dev/null 2>&1
if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then
: # No need to use a flag
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([for -rdynamic])
${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest$ac_exeext > /dev/null 2>&1
if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then
plugin_rdynamic=yes
pluginlibs="-rdynamic"
else
plugin_rdynamic=no
enable_plugin=no
fi
AC_MSG_RESULT([$plugin_rdynamic])
fi
else
AC_MSG_RESULT([unable to check])
fi
# Check -ldl
saved_LIBS="$LIBS"
AC_SEARCH_LIBS([dlopen], [dl])
if test x"$ac_cv_search_dlopen" = x"-ldl"; then
pluginlibs="$pluginlibs -ldl"
fi
LIBS="$saved_LIBS"
# Check that we can build shared objects with -fPIC -shared
saved_LDFLAGS="$LDFLAGS"
saved_CFLAGS="$CFLAGS"
case "${host}" in
*-*-darwin*)
CFLAGS=`echo $CFLAGS | sed s/-mdynamic-no-pic//g`
CFLAGS="$CFLAGS -fPIC"
LDFLAGS="$LDFLAGS -shared -undefined dynamic_lookup"
;;
*)
CFLAGS="$CFLAGS -fPIC"
LDFLAGS="$LDFLAGS -fPIC -shared"
;;
esac
AC_MSG_CHECKING([for -fPIC -shared])
AC_TRY_LINK(
[extern int X;],[return X == 0;],
[AC_MSG_RESULT([yes]); have_pic_shared=yes],
[AC_MSG_RESULT([no]); have_pic_shared=no])
if test x"$have_pic_shared" != x"yes" -o x"$ac_cv_search_dlopen" = x"no"; then
pluginlibs=
enable_plugin=no
fi
LDFLAGS="$saved_LDFLAGS"
CFLAGS="$saved_CFLAGS"
# If plugin support had been requested but not available, fail.
if test x"$enable_plugin" = x"no" ; then
if test x"$default_plugin" != x"yes"; then
AC_MSG_ERROR([
Building GCC with plugin support requires a host that supports
-fPIC, -shared, -ldl and -rdynamic.])
fi
fi
fi
])

View File

@ -0,0 +1,27 @@
dnl Copyright (C) 2012 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
dnl Define header location by thread model
dnl usage: GCC_AC_THREAD_HEADER([thread_model])
AC_DEFUN([GCC_AC_THREAD_HEADER],
[
case $1 in
aix) thread_header=config/rs6000/gthr-aix.h ;;
dce) thread_header=config/pa/gthr-dce.h ;;
lynx) thread_header=config/gthr-lynx.h ;;
mipssde) thread_header=config/mips/gthr-mipssde.h ;;
posix) thread_header=gthr-posix.h ;;
rtems) thread_header=config/gthr-rtems.h ;;
single) thread_header=gthr-single.h ;;
tpf) thread_header=config/s390/gthr-tpf.h ;;
vxworks) thread_header=config/gthr-vxworks.h ;;
win32) thread_header=config/i386/gthr-win32.h ;;
esac
AC_SUBST(thread_header)
])

View File

@ -0,0 +1,141 @@
# This file is part of GCC.
#
# GCC is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# GCC 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 GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
#
# Contributed by Richard Guenther <rguenther@suse.de>
# Based on cloog.m4
# ISL_INIT_FLAGS ()
# -------------------------
# Provide configure switches for ISL support.
# Initialize isllibs/islinc according to the user input.
AC_DEFUN([ISL_INIT_FLAGS],
[
AC_ARG_WITH([isl-include],
[AS_HELP_STRING(
[--with-isl-include=PATH],
[Specify directory for installed ISL include files])])
AC_ARG_WITH([isl-lib],
[AS_HELP_STRING(
[--with-isl-lib=PATH],
[Specify the directory for the installed ISL library])])
AC_ARG_ENABLE(isl-version-check,
[AS_HELP_STRING(
[--disable-isl-version-check],
[disable check for ISL version])],
ENABLE_ISL_CHECK=$enableval,
ENABLE_ISL_CHECK=yes)
# Initialize isllibs and islinc.
case $with_isl in
no)
isllibs=
islinc=
;;
"" | yes)
;;
*)
isllibs="-L$with_isl/lib"
islinc="-I$with_isl/include"
;;
esac
if test "x${with_isl_include}" != x ; then
islinc="-I$with_isl_include"
fi
if test "x${with_isl_lib}" != x; then
isllibs="-L$with_isl_lib"
fi
dnl If no --with-isl flag was specified and there is in-tree ISL
dnl source, set up flags to use that and skip any version tests
dnl as we cannot run them before building ISL.
if test "x${islinc}" = x && test "x${isllibs}" = x \
&& test -d ${srcdir}/isl; then
isllibs='-L$$r/$(HOST_SUBDIR)/isl/'"$lt_cv_objdir"' '
islinc='-I$$r/$(HOST_SUBDIR)/isl/include -I$$s/isl/include'
ENABLE_ISL_CHECK=no
AC_MSG_WARN([using in-tree ISL, disabling version check])
fi
isllibs="${isllibs} -lisl"
]
)
# ISL_REQUESTED (ACTION-IF-REQUESTED, ACTION-IF-NOT)
# ----------------------------------------------------
# Provide actions for failed ISL detection.
AC_DEFUN([ISL_REQUESTED],
[
AC_REQUIRE([ISL_INIT_FLAGS])
if test "x${with_isl}" = xno; then
$2
elif test "x${with_isl}" != x \
|| test "x${with_isl_include}" != x \
|| test "x${with_isl_lib}" != x ; then
$1
else
$2
fi
]
)
# ISL_CHECK_VERSION ISL_CHECK_VERSION ()
# ----------------------------------------------------------------
# Test that ISL contains functionality added to the minimum expected version.
AC_DEFUN([ISL_CHECK_VERSION],
[
if test "${ENABLE_ISL_CHECK}" = yes ; then
_isl_saved_CFLAGS=$CFLAGS
_isl_saved_LDFLAGS=$LDFLAGS
_isl_saved_LIBS=$LIBS
CFLAGS="${_isl_saved_CFLAGS} ${islinc} ${gmpinc}"
LDFLAGS="${_isl_saved_LDFLAGS} ${isllibs}"
LIBS="${_isl_saved_LIBS} -lisl"
AC_MSG_CHECKING([for compatible ISL])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <isl/val.h>]], [[;]])],
[gcc_cv_isl=yes],
[gcc_cv_isl=no])
AC_MSG_RESULT([$gcc_cv_isl])
CFLAGS=$_isl_saved_CFLAGS
LDFLAGS=$_isl_saved_LDFLAGS
LIBS=$_isl_saved_LIBS
fi
]
)
# ISL_IF_FAILED (ACTION-IF-FAILED)
# ----------------------------------
# Executes ACTION-IF-FAILED, if GRAPHITE was requested and
# the checks failed.
AC_DEFUN([ISL_IF_FAILED],
[
ISL_REQUESTED([graphite_requested=yes], [graphite_requested=no])
if test "${gcc_cv_isl}" = no ; then
isllibs=
islinc=
fi
if test "${graphite_requested}" = yes \
&& test "x${isllibs}" = x \
&& test "x${islinc}" = x ; then
$1
fi
]
)

View File

@ -0,0 +1,30 @@
# This file is part of GCC.
#
# GCC is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3, or (at your option) any later
# version.
#
# GCC 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 GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# Define flags, LIBSTDCXX_RAW_CXX_CXXFLAGS and # LIBSTDCXX_RAW_CXX_LDFLAGS,
# for libstdc++-v3 header files to compile and link libraries in C++ with
# raw_cxx=true.
AC_DEFUN([GCC_LIBSTDCXX_RAW_CXX_FLAGS], [
AC_REQUIRE([ACX_NONCANONICAL_TARGET])
LIBSTDCXX_RAW_CXX_CXXFLAGS="\
-I\$(top_builddir)/../libstdc++-v3/include \
-I\$(top_builddir)/../libstdc++-v3/include/\$(target_noncanonical) \
-I\$(top_srcdir)/../libstdc++-v3/libsupc++"
LIBSTDCXX_RAW_CXX_LDFLAGS="\
\$(top_builddir)/../libstdc++-v3/src/libstdc++.la"
AC_SUBST(LIBSTDCXX_RAW_CXX_CXXFLAGS)
AC_SUBST(LIBSTDCXX_RAW_CXX_LDFLAGS)
])

View File

@ -0,0 +1,3 @@
# Prevent GPREL16 relocation truncation
LDFLAGS += -Wl,--no-relax
BOOT_LDFLAGS += -Wl,--no-relax

View File

@ -0,0 +1,5 @@
# We build library code with -mno-gpopt so that it can be linked with
# larger executables with small-data sections that exceed the 16-bit
# offset range for GP-relative addressing.
CFLAGS_FOR_TARGET += -mno-gpopt
CXXFLAGS_FOR_TARGET += -mno-gpopt

Some files were not shown because too many files have changed in this diff Show More