/contrib/toolchain/binutils/bfd/Makefile |
---|
6,14 → 6,14 |
INCLUDES= -I. -I../include -I$(SDK_DIR)/sources/newlib/libc/include -I$(SDK_DIR)/sources/zlib |
DEFINES= -DHAVE_CONFIG_H -DHAVE_i386pe_vec -DHAVE_i386pei_vec -DHAVE_bfd_elf32_i386_vec -DHAVE_bfd_elf32_little_generic_vec |
DEFINES+= -DHAVE_bfd_elf32_big_generic_vec -DBINDIR="/home/autobuild/tools/win32/bin" |
TDEFS= -DDEFAULT_VECTOR=i386pe_vec "-DSELECT_VECS=&i386pe_vec,&i386pei_vec,&bfd_elf32_i386_vec,&bfd_elf32_little_generic_vec,&bfd_elf32_big_generic_vec" |
DEFINES= -DHAVE_CONFIG_H -DHAVE_i386_pe_vec -DHAVE_i386_pei_vec -DHAVE_i386_elf32_vec |
DEFINES+= -DHAVE_elf32_le_vec -DHAVE_elf32_be_vec |
DEFINES+= -DBINDIR="/home/autobuild/tools/win32/bin" |
TDEFS= -DDEFAULT_VECTOR=i386_pe_vec "-DSELECT_VECS=&i386_pe_vec,&i386_pei_vec,&i386_elf32_vec,&elf32_le_vec,&elf32_be_vec" |
TDEFS+= "-DSELECT_ARCHITECTURES=&bfd_i386_arch" |
SRCS = \ |
archive.c archures.c bfd.c bfdio.c \ |
binary.c cache.c coffgen.c cofflink.c \ |
binary.c cache.c coff-bfd.c coffgen.c cofflink.c \ |
compress.c corefile.c cpu-i386.c \ |
dwarf1.c dwarf2.c elf.c elf32.c \ |
elf32-gen.c elf32-i386.c elf-attrs.c \ |
/contrib/toolchain/binutils/bfd/archive.c |
---|
1,5 → 1,5 |
/* BFD back-end for archive files (libraries). |
Copyright 1990-2013 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault. |
This file is part of BFD, the Binary File Descriptor library. |
140,6 → 140,7 |
#include "safe-ctype.h" |
#include "hashtab.h" |
#include "filenames.h" |
#include "bfdlink.h" |
#ifndef errno |
extern int errno; |
310,7 → 311,11 |
struct ar_cache *entry = (struct ar_cache *) htab_find (hash_table, &m); |
if (!entry) |
return NULL; |
else |
/* Unfortunately this flag is set after checking that we have |
an archive, and checking for an archive means one element has |
sneaked into the cache. */ |
entry->arbfd->no_export = arch_bfd->no_export; |
return entry->arbfd; |
} |
else |
374,11 → 379,28 |
} |
static bfd * |
_bfd_find_nested_archive (bfd *arch_bfd, const char *filename) |
open_nested_file (const char *filename, bfd *archive) |
{ |
bfd *abfd; |
const char *target; |
bfd *n_bfd; |
target = NULL; |
if (!archive->target_defaulted) |
target = archive->xvec->name; |
n_bfd = bfd_openr (filename, target); |
if (n_bfd != NULL) |
{ |
n_bfd->lto_output = archive->lto_output; |
n_bfd->no_export = archive->no_export; |
} |
return n_bfd; |
} |
static bfd * |
find_nested_archive (const char *filename, bfd *arch_bfd) |
{ |
bfd *abfd; |
/* PR 15140: Don't allow a nested archive pointing to itself. */ |
if (filename_cmp (filename, arch_bfd->filename) == 0) |
{ |
393,10 → 415,7 |
if (filename_cmp (filename, abfd->filename) == 0) |
return abfd; |
} |
target = NULL; |
if (!arch_bfd->target_defaulted) |
target = arch_bfd->xvec->name; |
abfd = bfd_openr (filename, target); |
abfd = open_nested_file (filename, arch_bfd); |
if (abfd) |
{ |
abfd->archive_next = arch_bfd->nested_archives; |
625,12 → 644,12 |
_bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos) |
{ |
struct areltdata *new_areldata; |
bfd *n_nfd; |
bfd *n_bfd; |
char *filename; |
n_nfd = _bfd_look_for_bfd_in_cache (archive, filepos); |
if (n_nfd) |
return n_nfd; |
n_bfd = _bfd_look_for_bfd_in_cache (archive, filepos); |
if (n_bfd) |
return n_bfd; |
if (0 > bfd_seek (archive, filepos, SEEK_SET)) |
return NULL; |
642,8 → 661,6 |
if (bfd_is_thin_archive (archive)) |
{ |
const char *target; |
/* This is a proxy entry for an external file. */ |
if (! IS_ABSOLUTE_PATH (filename)) |
{ |
659,7 → 676,7 |
{ |
/* This proxy entry refers to an element of a nested archive. |
Locate the member of that archive and return a bfd for it. */ |
bfd *ext_arch = _bfd_find_nested_archive (archive, filename); |
bfd *ext_arch = find_nested_archive (filename, archive); |
if (ext_arch == NULL |
|| ! bfd_check_format (ext_arch, bfd_archive)) |
667,57 → 684,60 |
free (new_areldata); |
return NULL; |
} |
n_nfd = _bfd_get_elt_at_filepos (ext_arch, new_areldata->origin); |
if (n_nfd == NULL) |
n_bfd = _bfd_get_elt_at_filepos (ext_arch, new_areldata->origin); |
if (n_bfd == NULL) |
{ |
free (new_areldata); |
return NULL; |
} |
n_nfd->proxy_origin = bfd_tell (archive); |
return n_nfd; |
n_bfd->proxy_origin = bfd_tell (archive); |
return n_bfd; |
} |
/* It's not an element of a nested archive; |
open the external file as a bfd. */ |
target = NULL; |
if (!archive->target_defaulted) |
target = archive->xvec->name; |
n_nfd = bfd_openr (filename, target); |
if (n_nfd == NULL) |
n_bfd = open_nested_file (filename, archive); |
if (n_bfd == NULL) |
bfd_set_error (bfd_error_malformed_archive); |
} |
else |
{ |
n_nfd = _bfd_create_empty_archive_element_shell (archive); |
n_bfd = _bfd_create_empty_archive_element_shell (archive); |
} |
if (n_nfd == NULL) |
if (n_bfd == NULL) |
{ |
free (new_areldata); |
return NULL; |
} |
n_nfd->proxy_origin = bfd_tell (archive); |
n_bfd->proxy_origin = bfd_tell (archive); |
if (bfd_is_thin_archive (archive)) |
{ |
n_nfd->origin = 0; |
n_bfd->origin = 0; |
} |
else |
{ |
n_nfd->origin = n_nfd->proxy_origin; |
n_nfd->filename = filename; |
n_bfd->origin = n_bfd->proxy_origin; |
n_bfd->filename = xstrdup (filename); |
} |
n_nfd->arelt_data = new_areldata; |
n_bfd->arelt_data = new_areldata; |
/* Copy BFD_COMPRESS and BFD_DECOMPRESS flags. */ |
n_nfd->flags |= archive->flags & (BFD_COMPRESS | BFD_DECOMPRESS); |
/* Copy BFD_COMPRESS, BFD_DECOMPRESS and BFD_COMPRESS_GABI flags. */ |
n_bfd->flags |= archive->flags & (BFD_COMPRESS |
| BFD_DECOMPRESS |
| BFD_COMPRESS_GABI); |
if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_nfd)) |
return n_nfd; |
/* Copy is_linker_input. */ |
n_bfd->is_linker_input = archive->is_linker_input; |
if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_bfd)) |
return n_bfd; |
free (new_areldata); |
n_nfd->arelt_data = NULL; |
n_bfd->arelt_data = NULL; |
return NULL; |
} |
766,22 → 786,30 |
bfd * |
bfd_generic_openr_next_archived_file (bfd *archive, bfd *last_file) |
{ |
file_ptr filestart; |
ufile_ptr filestart; |
if (!last_file) |
filestart = bfd_ardata (archive)->first_file_filepos; |
else |
{ |
filestart = last_file->proxy_origin; |
if (! bfd_is_thin_archive (archive)) |
{ |
bfd_size_type size = arelt_size (last_file); |
filestart = last_file->proxy_origin; |
if (! bfd_is_thin_archive (archive)) |
filestart += size; |
/* Pad to an even boundary... |
Note that last_file->origin can be odd in the case of |
BSD-4.4-style element with a long odd size. */ |
filestart += filestart % 2; |
if (filestart <= last_file->proxy_origin) |
{ |
/* Prevent looping. See PR19256. */ |
bfd_set_error (bfd_error_malformed_archive); |
return NULL; |
} |
} |
} |
return _bfd_get_elt_at_filepos (archive, filestart); |
} |
901,6 → 929,10 |
return FALSE; |
parsed_size = mapdata->parsed_size; |
free (mapdata); |
/* PR 17512: file: 883ff754. */ |
/* PR 17512: file: 0458885f. */ |
if (parsed_size < 4) |
return FALSE; |
raw_armap = (bfd_byte *) bfd_zalloc (abfd, parsed_size); |
if (raw_armap == NULL) |
916,7 → 948,6 |
} |
ardata->symdef_count = H_GET_32 (abfd, raw_armap) / BSD_SYMDEF_SIZE; |
if (ardata->symdef_count * BSD_SYMDEF_SIZE > |
parsed_size - BSD_SYMDEF_COUNT_SIZE) |
{ |
1037,12 → 1068,19 |
} |
/* OK, build the carsyms. */ |
for (i = 0; i < nsymz; i++) |
for (i = 0; i < nsymz && stringsize > 0; i++) |
{ |
bfd_size_type len; |
rawptr = raw_armap + i; |
carsyms->file_offset = swap ((bfd_byte *) rawptr); |
carsyms->name = stringbase; |
stringbase += strlen (stringbase) + 1; |
/* PR 17512: file: 4a1d50c1. */ |
len = strnlen (stringbase, stringsize); |
if (len < stringsize) |
len ++; |
stringbase += len; |
stringsize -= len; |
carsyms++; |
} |
*stringbase = 0; |
1130,6 → 1168,7 |
return FALSE; |
if (bfd_seek (abfd, -(file_ptr) (sizeof (hdr) + 20), SEEK_CUR) != 0) |
return FALSE; |
extname[20] = 0; |
if (CONST_STRNEQ (extname, "__.SYMDEF SORTED") |
|| CONST_STRNEQ (extname, "__.SYMDEF")) |
return do_slurp_bsd_armap (abfd); |
1299,6 → 1338,8 |
{ |
byebye: |
free (namedata); |
bfd_ardata (abfd)->extended_names = NULL; |
bfd_ardata (abfd)->extended_names_size = 0; |
return FALSE; |
} |
1315,11 → 1356,12 |
text, the entries in the list are newline-padded, not null |
padded. In SVR4-style archives, the names also have a |
trailing '/'. DOS/NT created archive often have \ in them |
We'll fix all problems here.. */ |
We'll fix all problems here. */ |
{ |
char *ext_names = bfd_ardata (abfd)->extended_names; |
char *temp = ext_names; |
char *limit = temp + namedata->parsed_size; |
for (; temp < limit; ++temp) |
{ |
if (*temp == ARFMAG[1]) |
1960,7 → 2002,9 |
} |
hdr = arch_hdr (abfd); |
/* PR 17512: file: 3d9e9fe9. */ |
if (hdr == NULL) |
return -1; |
#define foo(arelt, stelt, size) \ |
buf->stelt = strtol (hdr->arelt, &aloser, size); \ |
if (aloser == hdr->arelt) \ |
2356,6 → 2400,10 |
map = new_map; |
} |
if (strcmp (syms[src_count]->name, "__gnu_lto_slim") == 0) |
(*_bfd_error_handler) |
(_("%s: plugin needed to handle lto object"), |
bfd_get_filename (current)); |
namelen = strlen (syms[src_count]->name); |
amt = sizeof (char *); |
map[orl_count].name = (char **) bfd_alloc (arch, amt); |
2751,5 → 2799,8 |
} |
} |
} |
if (abfd->is_linker_output) |
(*abfd->link.hash->hash_table_free) (abfd); |
return TRUE; |
} |
/contrib/toolchain/binutils/bfd/archures.c |
---|
1,5 → 1,5 |
/* BFD library support routines for architectures. |
Copyright 1990-2013 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Hacked by John Gilmore and Steve Chamberlain of Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
121,7 → 121,9 |
.#define bfd_mach_i960_jx 7 |
.#define bfd_mach_i960_hx 8 |
. |
. bfd_arch_or32, {* OpenRISC 32 *} |
. bfd_arch_or1k, {* OpenRISC 1000 *} |
.#define bfd_mach_or1k 1 |
.#define bfd_mach_or1knd 2 |
. |
. bfd_arch_sparc, {* SPARC *} |
.#define bfd_mach_sparc 1 |
177,11 → 179,18 |
.#define bfd_mach_mips_octeon 6501 |
.#define bfd_mach_mips_octeonp 6601 |
.#define bfd_mach_mips_octeon2 6502 |
.#define bfd_mach_mips_octeon3 6503 |
.#define bfd_mach_mips_xlr 887682 {* decimal 'XLR' *} |
.#define bfd_mach_mipsisa32 32 |
.#define bfd_mach_mipsisa32r2 33 |
.#define bfd_mach_mipsisa32r3 34 |
.#define bfd_mach_mipsisa32r5 36 |
.#define bfd_mach_mipsisa32r6 37 |
.#define bfd_mach_mipsisa64 64 |
.#define bfd_mach_mipsisa64r2 65 |
.#define bfd_mach_mipsisa64r3 66 |
.#define bfd_mach_mipsisa64r5 68 |
.#define bfd_mach_mipsisa64r6 69 |
.#define bfd_mach_mips_micromips 96 |
. bfd_arch_i386, {* Intel 386 *} |
.#define bfd_mach_i386_intel_syntax (1 << 0) |
202,6 → 211,10 |
.#define bfd_mach_i386_i386_nacl (bfd_mach_i386_i386 | bfd_mach_i386_nacl) |
.#define bfd_mach_x86_64_nacl (bfd_mach_x86_64 | bfd_mach_i386_nacl) |
.#define bfd_mach_x64_32_nacl (bfd_mach_x64_32 | bfd_mach_i386_nacl) |
. bfd_arch_iamcu, {* Intel MCU *} |
.#define bfd_mach_iamcu (1 << 8) |
.#define bfd_mach_i386_iamcu (bfd_mach_i386_i386 | bfd_mach_iamcu) |
.#define bfd_mach_i386_iamcu_intel_syntax (bfd_mach_i386_iamcu | bfd_mach_i386_intel_syntax) |
. bfd_arch_we32k, {* AT&T WE32xxx *} |
. bfd_arch_tahoe, {* CCI/Harris Tahoe *} |
. bfd_arch_i860, {* Intel 860 *} |
316,6 → 329,12 |
.#define bfd_mach_arm_ep9312 11 |
.#define bfd_mach_arm_iWMMXt 12 |
.#define bfd_mach_arm_iWMMXt2 13 |
. bfd_arch_nds32, {* Andes NDS32 *} |
.#define bfd_mach_n1 1 |
.#define bfd_mach_n1h 2 |
.#define bfd_mach_n1h_v2 3 |
.#define bfd_mach_n1h_v3 4 |
.#define bfd_mach_n1h_v3m 5 |
. bfd_arch_ns32k, {* National Semiconductors ns32000 *} |
. bfd_arch_w65, {* WDC 65816 *} |
. bfd_arch_tic30, {* Texas Instruments TMS320C30 *} |
334,10 → 353,12 |
.#define bfd_mach_v850e2v3 0x45325633 |
.#define bfd_mach_v850e3v5 0x45335635 {* ('E'|'3'|'V'|'5') *} |
. bfd_arch_arc, {* ARC Cores *} |
.#define bfd_mach_arc_5 5 |
.#define bfd_mach_arc_6 6 |
.#define bfd_mach_arc_7 7 |
.#define bfd_mach_arc_8 8 |
.#define bfd_mach_arc_a4 0 |
.#define bfd_mach_arc_a5 1 |
.#define bfd_mach_arc_arc600 2 |
.#define bfd_mach_arc_arc601 4 |
.#define bfd_mach_arc_arc700 3 |
.#define bfd_mach_arc_arcv2 5 |
. bfd_arch_m32c, {* Renesas M16C/M32C. *} |
.#define bfd_mach_m16c 0x75 |
.#define bfd_mach_m32c 0x78 |
363,6 → 384,8 |
.#define bfd_mach_fr550 550 |
. bfd_arch_moxie, {* The moxie processor *} |
.#define bfd_mach_moxie 1 |
. bfd_arch_ft32, {* The ft32 processor *} |
.#define bfd_mach_ft32 1 |
. bfd_arch_mcore, |
. bfd_arch_mep, |
.#define bfd_mach_mep 1 |
398,6 → 421,7 |
.#define bfd_mach_avr5 5 |
.#define bfd_mach_avr51 51 |
.#define bfd_mach_avr6 6 |
.#define bfd_mach_avrtiny 100 |
.#define bfd_mach_avrxmega1 101 |
.#define bfd_mach_avrxmega2 102 |
.#define bfd_mach_avrxmega3 103 |
427,7 → 451,6 |
. bfd_arch_score, {* Sunplus score *} |
.#define bfd_mach_score3 3 |
.#define bfd_mach_score7 7 |
. bfd_arch_openrisc, {* OpenRISC *} |
. bfd_arch_mmix, {* Donald Knuth's educational processor. *} |
. bfd_arch_xstormy16, |
.#define bfd_mach_xstormy16 1 |
480,8 → 503,12 |
. bfd_arch_aarch64, {* AArch64 *} |
.#define bfd_mach_aarch64 0 |
.#define bfd_mach_aarch64_ilp32 32 |
. bfd_arch_nios2, |
. bfd_arch_nios2, {* Nios II *} |
.#define bfd_mach_nios2 0 |
.#define bfd_mach_nios2r1 1 |
.#define bfd_mach_nios2r2 2 |
. bfd_arch_visium, {* Visium *} |
.#define bfd_mach_visium 1 |
. bfd_arch_last |
. }; |
*/ |
547,6 → 574,7 |
extern const bfd_arch_info_type bfd_hppa_arch; |
extern const bfd_arch_info_type bfd_i370_arch; |
extern const bfd_arch_info_type bfd_i386_arch; |
extern const bfd_arch_info_type bfd_iamcu_arch; |
extern const bfd_arch_info_type bfd_i860_arch; |
extern const bfd_arch_info_type bfd_i960_arch; |
extern const bfd_arch_info_type bfd_ia64_arch; |
572,12 → 600,13 |
extern const bfd_arch_info_type bfd_mn10200_arch; |
extern const bfd_arch_info_type bfd_mn10300_arch; |
extern const bfd_arch_info_type bfd_moxie_arch; |
extern const bfd_arch_info_type bfd_ft32_arch; |
extern const bfd_arch_info_type bfd_msp430_arch; |
extern const bfd_arch_info_type bfd_mt_arch; |
extern const bfd_arch_info_type bfd_nds32_arch; |
extern const bfd_arch_info_type bfd_nios2_arch; |
extern const bfd_arch_info_type bfd_ns32k_arch; |
extern const bfd_arch_info_type bfd_openrisc_arch; |
extern const bfd_arch_info_type bfd_or32_arch; |
extern const bfd_arch_info_type bfd_or1k_arch; |
extern const bfd_arch_info_type bfd_pdp11_arch; |
extern const bfd_arch_info_type bfd_pj_arch; |
extern const bfd_arch_info_type bfd_plugin_arch; |
601,6 → 630,7 |
extern const bfd_arch_info_type bfd_v850_arch; |
extern const bfd_arch_info_type bfd_v850_rh850_arch; |
extern const bfd_arch_info_type bfd_vax_arch; |
extern const bfd_arch_info_type bfd_visium_arch; |
extern const bfd_arch_info_type bfd_w65_arch; |
extern const bfd_arch_info_type bfd_we32k_arch; |
extern const bfd_arch_info_type bfd_xstormy16_arch; |
636,6 → 666,7 |
&bfd_hppa_arch, |
&bfd_i370_arch, |
&bfd_i386_arch, |
&bfd_iamcu_arch, |
&bfd_i860_arch, |
&bfd_i960_arch, |
&bfd_ia64_arch, |
661,12 → 692,13 |
&bfd_mn10200_arch, |
&bfd_mn10300_arch, |
&bfd_moxie_arch, |
&bfd_ft32_arch, |
&bfd_msp430_arch, |
&bfd_mt_arch, |
&bfd_nds32_arch, |
&bfd_nios2_arch, |
&bfd_ns32k_arch, |
&bfd_openrisc_arch, |
&bfd_or32_arch, |
&bfd_or1k_arch, |
&bfd_pdp11_arch, |
&bfd_powerpc_arch, |
&bfd_rs6000_arch, |
687,6 → 719,7 |
&bfd_v850_arch, |
&bfd_v850_rh850_arch, |
&bfd_vax_arch, |
&bfd_visium_arch, |
&bfd_w65_arch, |
&bfd_we32k_arch, |
&bfd_xstormy16_arch, |
/contrib/toolchain/binutils/bfd/bfd-in.h |
---|
0,0 → 1,1024 |
/* Main header file for the bfd library -- portable access to object files. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Contributed 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. */ |
#ifndef __BFD_H_SEEN__ |
#define __BFD_H_SEEN__ |
/* PR 14072: Ensure that config.h is included first. */ |
#if !defined PACKAGE && !defined PACKAGE_VERSION |
#error config.h must be included before this header |
#endif |
#ifdef __cplusplus |
extern "C" { |
#endif |
#include "ansidecl.h" |
#include "symcat.h" |
#include <sys/stat.h> |
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) |
#ifndef SABER |
/* This hack is to avoid a problem with some strict ANSI C preprocessors. |
The problem is, "32_" is not a valid preprocessing token, and we don't |
want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will |
cause the inner CONCAT2 macros to be evaluated first, producing |
still-valid pp-tokens. Then the final concatenation can be done. */ |
#undef CONCAT4 |
#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d)) |
#endif |
#endif |
/* This is a utility macro to handle the situation where the code |
wants to place a constant string into the code, followed by a |
comma and then the length of the string. Doing this by hand |
is error prone, so using this macro is safer. */ |
#define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1) |
/* Unfortunately it is not possible to use the STRING_COMMA_LEN macro |
to create the arguments to another macro, since the preprocessor |
will mis-count the number of arguments to the outer macro (by not |
evaluating STRING_COMMA_LEN and so missing the comma). This is a |
problem for example when trying to use STRING_COMMA_LEN to build |
the arguments to the strncmp() macro. Hence this alternative |
definition of strncmp is provided here. |
Note - these macros do NOT work if STR2 is not a constant string. */ |
#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0) |
/* strcpy() can have a similar problem, but since we know we are |
copying a constant string, we can use memcpy which will be faster |
since there is no need to check for a NUL byte inside STR. We |
can also save time if we do not need to copy the terminating NUL. */ |
#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1) |
#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2)) |
#define BFD_SUPPORTS_PLUGINS @supports_plugins@ |
/* The word size used by BFD on the host. This may be 64 with a 32 |
bit target if the host is 64 bit, or if other 64 bit targets have |
been selected with --enable-targets, or if --enable-64-bit-bfd. */ |
#define BFD_ARCH_SIZE @wordsize@ |
/* The word size of the default bfd target. */ |
#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@ |
#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@ |
#define BFD_HOST_64BIT_LONG_LONG @BFD_HOST_64BIT_LONG_LONG@ |
#if @BFD_HOST_64_BIT_DEFINED@ |
#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@ |
#define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@ |
typedef BFD_HOST_64_BIT bfd_int64_t; |
typedef BFD_HOST_U_64_BIT bfd_uint64_t; |
#endif |
#if BFD_ARCH_SIZE >= 64 |
#define BFD64 |
#endif |
#ifndef INLINE |
#if __GNUC__ >= 2 |
#define INLINE __inline__ |
#else |
#define INLINE |
#endif |
#endif |
/* Declaring a type wide enough to hold a host long and a host pointer. */ |
#define BFD_HOSTPTR_T @BFD_HOSTPTR_T@ |
typedef BFD_HOSTPTR_T bfd_hostptr_t; |
/* Forward declaration. */ |
typedef struct bfd bfd; |
/* Boolean type used in bfd. Too many systems define their own |
versions of "boolean" for us to safely typedef a "boolean" of |
our own. Using an enum for "bfd_boolean" has its own set of |
problems, with strange looking casts required to avoid warnings |
on some older compilers. Thus we just use an int. |
General rule: Functions which are bfd_boolean return TRUE on |
success and FALSE on failure (unless they're a predicate). */ |
typedef int bfd_boolean; |
#undef FALSE |
#undef TRUE |
#define FALSE 0 |
#define TRUE 1 |
#ifdef BFD64 |
#ifndef BFD_HOST_64_BIT |
#error No 64 bit integer type available |
#endif /* ! defined (BFD_HOST_64_BIT) */ |
typedef BFD_HOST_U_64_BIT bfd_vma; |
typedef BFD_HOST_64_BIT bfd_signed_vma; |
typedef BFD_HOST_U_64_BIT bfd_size_type; |
typedef BFD_HOST_U_64_BIT symvalue; |
#if BFD_HOST_64BIT_LONG |
#define BFD_VMA_FMT "l" |
#elif defined (__MSVCRT__) |
#define BFD_VMA_FMT "I64" |
#else |
#define BFD_VMA_FMT "ll" |
#endif |
#ifndef fprintf_vma |
#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x) |
#define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x) |
#endif |
#else /* not BFD64 */ |
/* Represent a target address. Also used as a generic unsigned type |
which is guaranteed to be big enough to hold any arithmetic types |
we need to deal with. */ |
typedef unsigned long bfd_vma; |
/* A generic signed type which is guaranteed to be big enough to hold any |
arithmetic types we need to deal with. Can be assumed to be compatible |
with bfd_vma in the same way that signed and unsigned ints are compatible |
(as parameters, in assignment, etc). */ |
typedef long bfd_signed_vma; |
typedef unsigned long symvalue; |
typedef unsigned long bfd_size_type; |
/* Print a bfd_vma x on stream s. */ |
#define BFD_VMA_FMT "l" |
#define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x) |
#define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x) |
#endif /* not BFD64 */ |
#define HALF_BFD_SIZE_TYPE \ |
(((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2)) |
#ifndef BFD_HOST_64_BIT |
/* Fall back on a 32 bit type. The idea is to make these types always |
available for function return types, but in the case that |
BFD_HOST_64_BIT is undefined such a function should abort or |
otherwise signal an error. */ |
typedef bfd_signed_vma bfd_int64_t; |
typedef bfd_vma bfd_uint64_t; |
#endif |
/* An offset into a file. BFD always uses the largest possible offset |
based on the build time availability of fseek, fseeko, or fseeko64. */ |
typedef @bfd_file_ptr@ file_ptr; |
typedef unsigned @bfd_file_ptr@ ufile_ptr; |
extern void bfd_sprintf_vma (bfd *, char *, bfd_vma); |
extern void bfd_fprintf_vma (bfd *, void *, bfd_vma); |
#define printf_vma(x) fprintf_vma(stdout,x) |
#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x) |
typedef unsigned int flagword; /* 32 bits of flags */ |
typedef unsigned char bfd_byte; |
/* File formats. */ |
typedef enum bfd_format |
{ |
bfd_unknown = 0, /* File format is unknown. */ |
bfd_object, /* Linker/assembler/compiler output. */ |
bfd_archive, /* Object archive file. */ |
bfd_core, /* Core dump. */ |
bfd_type_end /* Marks the end; don't use it! */ |
} |
bfd_format; |
/* Symbols and relocation. */ |
/* A count of carsyms (canonical archive symbols). */ |
typedef unsigned long symindex; |
/* How to perform a relocation. */ |
typedef const struct reloc_howto_struct reloc_howto_type; |
#define BFD_NO_MORE_SYMBOLS ((symindex) ~0) |
/* General purpose part of a symbol X; |
target specific parts are in libcoff.h, libaout.h, etc. */ |
#define bfd_get_section(x) ((x)->section) |
#define bfd_get_output_section(x) ((x)->section->output_section) |
#define bfd_set_section(x,y) ((x)->section) = (y) |
#define bfd_asymbol_base(x) ((x)->section->vma) |
#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value) |
#define bfd_asymbol_name(x) ((x)->name) |
/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/ |
#define bfd_asymbol_bfd(x) ((x)->the_bfd) |
#define bfd_asymbol_flavour(x) \ |
(((x)->flags & BSF_SYNTHETIC) != 0 \ |
? bfd_target_unknown_flavour \ |
: bfd_asymbol_bfd (x)->xvec->flavour) |
/* A canonical archive symbol. */ |
/* This is a type pun with struct ranlib on purpose! */ |
typedef struct carsym |
{ |
char *name; |
file_ptr file_offset; /* Look here to find the file. */ |
} |
carsym; /* To make these you call a carsymogen. */ |
/* Used in generating armaps (archive tables of contents). |
Perhaps just a forward definition would do? */ |
struct orl /* Output ranlib. */ |
{ |
char **name; /* Symbol name. */ |
union |
{ |
file_ptr pos; |
bfd *abfd; |
} u; /* bfd* or file position. */ |
int namidx; /* Index into string table. */ |
}; |
/* Linenumber stuff. */ |
typedef struct lineno_cache_entry |
{ |
unsigned int line_number; /* Linenumber from start of function. */ |
union |
{ |
struct bfd_symbol *sym; /* Function name. */ |
bfd_vma offset; /* Offset into section. */ |
} u; |
} |
alent; |
/* Object and core file sections. */ |
#define align_power(addr, align) \ |
(((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align)))) |
typedef struct bfd_section *sec_ptr; |
#define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name) |
#define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma) |
#define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma) |
#define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \ |
(ptr)->alignment_power) |
#define bfd_section_name(bfd, ptr) ((ptr)->name) |
#define bfd_section_size(bfd, ptr) ((ptr)->size) |
#define bfd_get_section_size(ptr) ((ptr)->size) |
#define bfd_section_vma(bfd, ptr) ((ptr)->vma) |
#define bfd_section_lma(bfd, ptr) ((ptr)->lma) |
#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power) |
#define bfd_get_section_flags(bfd, ptr) ((void) bfd, (ptr)->flags) |
#define bfd_get_section_userdata(bfd, ptr) ((void) bfd, (ptr)->userdata) |
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) |
#define bfd_get_section_limit_octets(bfd, sec) \ |
((bfd)->direction != write_direction && (sec)->rawsize != 0 \ |
? (sec)->rawsize : (sec)->size) |
/* Find the address one past the end of SEC. */ |
#define bfd_get_section_limit(bfd, sec) \ |
(bfd_get_section_limit_octets(bfd, sec) / bfd_octets_per_byte (bfd)) |
/* Return TRUE if input section SEC has been discarded. */ |
#define discarded_section(sec) \ |
(!bfd_is_abs_section (sec) \ |
&& bfd_is_abs_section ((sec)->output_section) \ |
&& (sec)->sec_info_type != SEC_INFO_TYPE_MERGE \ |
&& (sec)->sec_info_type != SEC_INFO_TYPE_JUST_SYMS) |
typedef enum bfd_print_symbol |
{ |
bfd_print_symbol_name, |
bfd_print_symbol_more, |
bfd_print_symbol_all |
} bfd_print_symbol_type; |
/* Information about a symbol that nm needs. */ |
typedef struct _symbol_info |
{ |
symvalue value; |
char type; |
const char *name; /* Symbol name. */ |
unsigned char stab_type; /* Stab type. */ |
char stab_other; /* Stab other. */ |
short stab_desc; /* Stab desc. */ |
const char *stab_name; /* String for stab type. */ |
} symbol_info; |
/* Get the name of a stabs type code. */ |
extern const char *bfd_get_stab_name (int); |
/* Hash table routines. There is no way to free up a hash table. */ |
/* An element in the hash table. Most uses will actually use a larger |
structure, and an instance of this will be the first field. */ |
struct bfd_hash_entry |
{ |
/* Next entry for this hash code. */ |
struct bfd_hash_entry *next; |
/* String being hashed. */ |
const char *string; |
/* Hash code. This is the full hash code, not the index into the |
table. */ |
unsigned long hash; |
}; |
/* A hash table. */ |
struct bfd_hash_table |
{ |
/* The hash array. */ |
struct bfd_hash_entry **table; |
/* A function used to create new elements in the hash table. The |
first entry is itself a pointer to an element. When this |
function is first invoked, this pointer will be NULL. However, |
having the pointer permits a hierarchy of method functions to be |
built each of which calls the function in the superclass. Thus |
each function should be written to allocate a new block of memory |
only if the argument is NULL. */ |
struct bfd_hash_entry *(*newfunc) |
(struct bfd_hash_entry *, struct bfd_hash_table *, const char *); |
/* An objalloc for this hash table. This is a struct objalloc *, |
but we use void * to avoid requiring the inclusion of objalloc.h. */ |
void *memory; |
/* The number of slots in the hash table. */ |
unsigned int size; |
/* The number of entries in the hash table. */ |
unsigned int count; |
/* The size of elements. */ |
unsigned int entsize; |
/* If non-zero, don't grow the hash table. */ |
unsigned int frozen:1; |
}; |
/* Initialize a hash table. */ |
extern bfd_boolean bfd_hash_table_init |
(struct bfd_hash_table *, |
struct bfd_hash_entry *(*) (struct bfd_hash_entry *, |
struct bfd_hash_table *, |
const char *), |
unsigned int); |
/* Initialize a hash table specifying a size. */ |
extern bfd_boolean bfd_hash_table_init_n |
(struct bfd_hash_table *, |
struct bfd_hash_entry *(*) (struct bfd_hash_entry *, |
struct bfd_hash_table *, |
const char *), |
unsigned int, unsigned int); |
/* Free up a hash table. */ |
extern void bfd_hash_table_free |
(struct bfd_hash_table *); |
/* Look up a string in a hash table. If CREATE is TRUE, a new entry |
will be created for this string if one does not already exist. The |
COPY argument must be TRUE if this routine should copy the string |
into newly allocated memory when adding an entry. */ |
extern struct bfd_hash_entry *bfd_hash_lookup |
(struct bfd_hash_table *, const char *, bfd_boolean create, |
bfd_boolean copy); |
/* Insert an entry in a hash table. */ |
extern struct bfd_hash_entry *bfd_hash_insert |
(struct bfd_hash_table *, const char *, unsigned long); |
/* Rename an entry in a hash table. */ |
extern void bfd_hash_rename |
(struct bfd_hash_table *, const char *, struct bfd_hash_entry *); |
/* Replace an entry in a hash table. */ |
extern void bfd_hash_replace |
(struct bfd_hash_table *, struct bfd_hash_entry *old, |
struct bfd_hash_entry *nw); |
/* Base method for creating a hash table entry. */ |
extern struct bfd_hash_entry *bfd_hash_newfunc |
(struct bfd_hash_entry *, struct bfd_hash_table *, const char *); |
/* Grab some space for a hash table entry. */ |
extern void *bfd_hash_allocate |
(struct bfd_hash_table *, unsigned int); |
/* Traverse a hash table in a random order, calling a function on each |
element. If the function returns FALSE, the traversal stops. The |
INFO argument is passed to the function. */ |
extern void bfd_hash_traverse |
(struct bfd_hash_table *, |
bfd_boolean (*) (struct bfd_hash_entry *, void *), |
void *info); |
/* Allows the default size of a hash table to be configured. New hash |
tables allocated using bfd_hash_table_init will be created with |
this size. */ |
extern unsigned long bfd_hash_set_default_size (unsigned long); |
/* Types of compressed DWARF debug sections. We currently support |
zlib. */ |
enum compressed_debug_section_type |
{ |
COMPRESS_DEBUG_NONE = 0, |
COMPRESS_DEBUG = 1 << 0, |
COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1, |
COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2 |
}; |
/* This structure is used to keep track of stabs in sections |
information while linking. */ |
struct stab_info |
{ |
/* A hash table used to hold stabs strings. */ |
struct bfd_strtab_hash *strings; |
/* The header file hash table. */ |
struct bfd_hash_table includes; |
/* The first .stabstr section. */ |
struct bfd_section *stabstr; |
}; |
#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table |
/* User program access to BFD facilities. */ |
/* Direct I/O routines, for programs which know more about the object |
file than BFD does. Use higher level routines if possible. */ |
extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *); |
extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *); |
extern int bfd_seek (bfd *, file_ptr, int); |
extern file_ptr bfd_tell (bfd *); |
extern int bfd_flush (bfd *); |
extern int bfd_stat (bfd *, struct stat *); |
/* Deprecated old routines. */ |
#if __GNUC__ |
#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ |
(warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \ |
bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) |
#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ |
(warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \ |
bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) |
#else |
#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ |
(warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \ |
bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) |
#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ |
(warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\ |
bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) |
#endif |
extern void warn_deprecated (const char *, const char *, int, const char *); |
/* Cast from const char * to char * so that caller can assign to |
a char * without a warning. */ |
#define bfd_get_filename(abfd) ((char *) (abfd)->filename) |
#define bfd_get_cacheable(abfd) ((abfd)->cacheable) |
#define bfd_get_format(abfd) ((abfd)->format) |
#define bfd_get_target(abfd) ((abfd)->xvec->name) |
#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour) |
#define bfd_family_coff(abfd) \ |
(bfd_get_flavour (abfd) == bfd_target_coff_flavour || \ |
bfd_get_flavour (abfd) == bfd_target_xcoff_flavour) |
#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG) |
#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE) |
#define bfd_header_big_endian(abfd) \ |
((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG) |
#define bfd_header_little_endian(abfd) \ |
((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE) |
#define bfd_get_file_flags(abfd) ((abfd)->flags) |
#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags) |
#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags) |
#define bfd_my_archive(abfd) ((abfd)->my_archive) |
#define bfd_has_map(abfd) ((abfd)->has_armap) |
#define bfd_is_thin_archive(abfd) ((abfd)->is_thin_archive) |
#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types) |
#define bfd_usrdata(abfd) ((abfd)->usrdata) |
#define bfd_get_start_address(abfd) ((abfd)->start_address) |
#define bfd_get_symcount(abfd) ((abfd)->symcount) |
#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols) |
#define bfd_count_sections(abfd) ((abfd)->section_count) |
#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount) |
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) |
extern bfd_boolean bfd_cache_close |
(bfd *abfd); |
/* NB: This declaration should match the autogenerated one in libbfd.h. */ |
extern bfd_boolean bfd_cache_close_all (void); |
extern bfd_boolean bfd_record_phdr |
(bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, |
bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **); |
/* Byte swapping routines. */ |
bfd_uint64_t bfd_getb64 (const void *); |
bfd_uint64_t bfd_getl64 (const void *); |
bfd_int64_t bfd_getb_signed_64 (const void *); |
bfd_int64_t bfd_getl_signed_64 (const void *); |
bfd_vma bfd_getb32 (const void *); |
bfd_vma bfd_getl32 (const void *); |
bfd_signed_vma bfd_getb_signed_32 (const void *); |
bfd_signed_vma bfd_getl_signed_32 (const void *); |
bfd_vma bfd_getb16 (const void *); |
bfd_vma bfd_getl16 (const void *); |
bfd_signed_vma bfd_getb_signed_16 (const void *); |
bfd_signed_vma bfd_getl_signed_16 (const void *); |
void bfd_putb64 (bfd_uint64_t, void *); |
void bfd_putl64 (bfd_uint64_t, void *); |
void bfd_putb32 (bfd_vma, void *); |
void bfd_putl32 (bfd_vma, void *); |
void bfd_putb16 (bfd_vma, void *); |
void bfd_putl16 (bfd_vma, void *); |
/* Byte swapping routines which take size and endiannes as arguments. */ |
bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean); |
void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean); |
#if defined(__STDC__) || defined(ALMOST_STDC) |
struct ecoff_debug_info; |
struct ecoff_debug_swap; |
struct ecoff_extr; |
struct bfd_symbol; |
struct bfd_link_info; |
struct bfd_link_hash_entry; |
struct bfd_section_already_linked; |
struct bfd_elf_version_tree; |
#endif |
extern bfd_boolean bfd_section_already_linked_table_init (void); |
extern void bfd_section_already_linked_table_free (void); |
extern bfd_boolean _bfd_handle_already_linked |
(struct bfd_section *, struct bfd_section_already_linked *, |
struct bfd_link_info *); |
/* Externally visible ECOFF routines. */ |
extern bfd_vma bfd_ecoff_get_gp_value |
(bfd * abfd); |
extern bfd_boolean bfd_ecoff_set_gp_value |
(bfd *abfd, bfd_vma gp_value); |
extern bfd_boolean bfd_ecoff_set_regmasks |
(bfd *abfd, unsigned long gprmask, unsigned long fprmask, |
unsigned long *cprmask); |
extern void *bfd_ecoff_debug_init |
(bfd *output_bfd, struct ecoff_debug_info *output_debug, |
const struct ecoff_debug_swap *output_swap, struct bfd_link_info *); |
extern void bfd_ecoff_debug_free |
(void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, |
const struct ecoff_debug_swap *output_swap, struct bfd_link_info *); |
extern bfd_boolean bfd_ecoff_debug_accumulate |
(void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, |
const struct ecoff_debug_swap *output_swap, bfd *input_bfd, |
struct ecoff_debug_info *input_debug, |
const struct ecoff_debug_swap *input_swap, struct bfd_link_info *); |
extern bfd_boolean bfd_ecoff_debug_accumulate_other |
(void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, |
const struct ecoff_debug_swap *output_swap, bfd *input_bfd, |
struct bfd_link_info *); |
extern bfd_boolean bfd_ecoff_debug_externals |
(bfd *abfd, struct ecoff_debug_info *debug, |
const struct ecoff_debug_swap *swap, bfd_boolean relocatable, |
bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *), |
void (*set_index) (struct bfd_symbol *, bfd_size_type)); |
extern bfd_boolean bfd_ecoff_debug_one_external |
(bfd *abfd, struct ecoff_debug_info *debug, |
const struct ecoff_debug_swap *swap, const char *name, |
struct ecoff_extr *esym); |
extern bfd_size_type bfd_ecoff_debug_size |
(bfd *abfd, struct ecoff_debug_info *debug, |
const struct ecoff_debug_swap *swap); |
extern bfd_boolean bfd_ecoff_write_debug |
(bfd *abfd, struct ecoff_debug_info *debug, |
const struct ecoff_debug_swap *swap, file_ptr where); |
extern bfd_boolean bfd_ecoff_write_accumulated_debug |
(void *handle, bfd *abfd, struct ecoff_debug_info *debug, |
const struct ecoff_debug_swap *swap, |
struct bfd_link_info *info, file_ptr where); |
/* Externally visible ELF routines. */ |
struct bfd_link_needed_list |
{ |
struct bfd_link_needed_list *next; |
bfd *by; |
const char *name; |
}; |
enum dynamic_lib_link_class { |
DYN_NORMAL = 0, |
DYN_AS_NEEDED = 1, |
DYN_DT_NEEDED = 2, |
DYN_NO_ADD_NEEDED = 4, |
DYN_NO_NEEDED = 8 |
}; |
enum notice_asneeded_action { |
notice_as_needed, |
notice_not_needed, |
notice_needed |
}; |
extern bfd_boolean bfd_elf_record_link_assignment |
(bfd *, struct bfd_link_info *, const char *, bfd_boolean, |
bfd_boolean); |
extern struct bfd_link_needed_list *bfd_elf_get_needed_list |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_elf_get_bfd_needed_list |
(bfd *, struct bfd_link_needed_list **); |
extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *, |
const char *, bfd_vma); |
extern bfd_boolean bfd_elf_size_dynamic_sections |
(bfd *, const char *, const char *, const char *, const char *, const char *, |
const char * const *, struct bfd_link_info *, struct bfd_section **); |
extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr |
(bfd *, struct bfd_link_info *); |
extern void bfd_elf_set_dt_needed_name |
(bfd *, const char *); |
extern const char *bfd_elf_get_dt_soname |
(bfd *); |
extern void bfd_elf_set_dyn_lib_class |
(bfd *, enum dynamic_lib_link_class); |
extern int bfd_elf_get_dyn_lib_class |
(bfd *); |
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list |
(bfd *, struct bfd_link_info *); |
extern int bfd_elf_discard_info |
(bfd *, struct bfd_link_info *); |
extern unsigned int _bfd_elf_default_action_discarded |
(struct bfd_section *); |
/* Return an upper bound on the number of bytes required to store a |
copy of ABFD's program header table entries. Return -1 if an error |
occurs; bfd_get_error will return an appropriate code. */ |
extern long bfd_get_elf_phdr_upper_bound |
(bfd *abfd); |
/* Copy ABFD's program header table entries to *PHDRS. The entries |
will be stored as an array of Elf_Internal_Phdr structures, as |
defined in include/elf/internal.h. To find out how large the |
buffer needs to be, call bfd_get_elf_phdr_upper_bound. |
Return the number of program header table entries read, or -1 if an |
error occurs; bfd_get_error will return an appropriate code. */ |
extern int bfd_get_elf_phdrs |
(bfd *abfd, void *phdrs); |
/* Create a new BFD as if by bfd_openr. Rather than opening a file, |
reconstruct an ELF file by reading the segments out of remote |
memory based on the ELF file header at EHDR_VMA and the ELF program |
headers it points to. If non-zero, SIZE is the known extent of the |
object. If not null, *LOADBASEP is filled in with the difference |
between the VMAs from which the segments were read, and the VMAs |
the file headers (and hence BFD's idea of each section's VMA) put |
them at. |
The function TARGET_READ_MEMORY is called to copy LEN bytes from |
the remote memory at target address VMA into the local buffer at |
MYADDR; it should return zero on success or an `errno' code on |
failure. TEMPL must be a BFD for a target with the word size and |
byte order found in the remote memory. */ |
extern bfd *bfd_elf_bfd_from_remote_memory |
(bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep, |
int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, |
bfd_size_type len)); |
extern struct bfd_section *_bfd_elf_tls_setup |
(bfd *, struct bfd_link_info *); |
extern struct bfd_section * |
_bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma); |
extern void _bfd_fix_excluded_sec_syms |
(bfd *, struct bfd_link_info *); |
extern unsigned bfd_m68k_mach_to_features (int); |
extern int bfd_m68k_features_to_mach (unsigned); |
extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs |
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, |
char **); |
extern void bfd_elf_m68k_set_target_options (struct bfd_link_info *, int); |
extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs |
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, |
char **); |
extern bfd_boolean bfd_cr16_elf32_create_embedded_relocs |
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, |
char **); |
/* SunOS shared library support routines for the linker. */ |
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_sunos_record_link_assignment |
(bfd *, struct bfd_link_info *, const char *); |
extern bfd_boolean bfd_sunos_size_dynamic_sections |
(bfd *, struct bfd_link_info *, struct bfd_section **, |
struct bfd_section **, struct bfd_section **); |
/* Linux shared library support routines for the linker. */ |
extern bfd_boolean bfd_i386linux_size_dynamic_sections |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_m68klinux_size_dynamic_sections |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_sparclinux_size_dynamic_sections |
(bfd *, struct bfd_link_info *); |
/* mmap hacks */ |
struct _bfd_window_internal; |
typedef struct _bfd_window_internal bfd_window_internal; |
typedef struct _bfd_window |
{ |
/* What the user asked for. */ |
void *data; |
bfd_size_type size; |
/* The actual window used by BFD. Small user-requested read-only |
regions sharing a page may share a single window into the object |
file. Read-write versions shouldn't until I've fixed things to |
keep track of which portions have been claimed by the |
application; don't want to give the same region back when the |
application wants two writable copies! */ |
struct _bfd_window_internal *i; |
} |
bfd_window; |
extern void bfd_init_window |
(bfd_window *); |
extern void bfd_free_window |
(bfd_window *); |
extern bfd_boolean bfd_get_file_window |
(bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean); |
/* XCOFF support routines for the linker. */ |
extern bfd_boolean bfd_xcoff_split_import_path |
(bfd *, const char *, const char **, const char **); |
extern bfd_boolean bfd_xcoff_set_archive_import_path |
(struct bfd_link_info *, bfd *, const char *); |
extern bfd_boolean bfd_xcoff_link_record_set |
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type); |
extern bfd_boolean bfd_xcoff_import_symbol |
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma, |
const char *, const char *, const char *, unsigned int); |
extern bfd_boolean bfd_xcoff_export_symbol |
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *); |
extern bfd_boolean bfd_xcoff_link_count_reloc |
(bfd *, struct bfd_link_info *, const char *); |
extern bfd_boolean bfd_xcoff_record_link_assignment |
(bfd *, struct bfd_link_info *, const char *); |
extern bfd_boolean bfd_xcoff_size_dynamic_sections |
(bfd *, struct bfd_link_info *, const char *, const char *, |
unsigned long, unsigned long, unsigned long, bfd_boolean, |
int, bfd_boolean, unsigned int, struct bfd_section **, bfd_boolean); |
extern bfd_boolean bfd_xcoff_link_generate_rtinit |
(bfd *, const char *, const char *, bfd_boolean); |
/* XCOFF support routines for ar. */ |
extern bfd_boolean bfd_xcoff_ar_archive_set_magic |
(bfd *, char *); |
/* Externally visible COFF routines. */ |
#if defined(__STDC__) || defined(ALMOST_STDC) |
struct internal_syment; |
union internal_auxent; |
#endif |
extern bfd_boolean bfd_coff_set_symbol_class |
(bfd *, struct bfd_symbol *, unsigned int); |
extern bfd_boolean bfd_m68k_coff_create_embedded_relocs |
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); |
/* ARM VFP11 erratum workaround support. */ |
typedef enum |
{ |
BFD_ARM_VFP11_FIX_DEFAULT, |
BFD_ARM_VFP11_FIX_NONE, |
BFD_ARM_VFP11_FIX_SCALAR, |
BFD_ARM_VFP11_FIX_VECTOR |
} bfd_arm_vfp11_fix; |
extern void bfd_elf32_arm_init_maps |
(bfd *); |
extern void bfd_elf32_arm_set_vfp11_fix |
(bfd *, struct bfd_link_info *); |
extern void bfd_elf32_arm_set_cortex_a8_fix |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan |
(bfd *, struct bfd_link_info *); |
extern void bfd_elf32_arm_vfp11_fix_veneer_locations |
(bfd *, struct bfd_link_info *); |
/* ARM STM STM32L4XX erratum workaround support. */ |
typedef enum |
{ |
BFD_ARM_STM32L4XX_FIX_NONE, |
BFD_ARM_STM32L4XX_FIX_DEFAULT, |
BFD_ARM_STM32L4XX_FIX_ALL |
} bfd_arm_stm32l4xx_fix; |
extern void bfd_elf32_arm_set_stm32l4xx_fix |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_elf32_arm_stm32l4xx_erratum_scan |
(bfd *, struct bfd_link_info *); |
extern void bfd_elf32_arm_stm32l4xx_fix_veneer_locations |
(bfd *, struct bfd_link_info *); |
/* ARM Interworking support. Called from linker. */ |
extern bfd_boolean bfd_arm_allocate_interworking_sections |
(struct bfd_link_info *); |
extern bfd_boolean bfd_arm_process_before_allocation |
(bfd *, struct bfd_link_info *, int); |
extern bfd_boolean bfd_arm_get_bfd_for_interworking |
(bfd *, struct bfd_link_info *); |
/* PE ARM Interworking support. Called from linker. */ |
extern bfd_boolean bfd_arm_pe_allocate_interworking_sections |
(struct bfd_link_info *); |
extern bfd_boolean bfd_arm_pe_process_before_allocation |
(bfd *, struct bfd_link_info *, int); |
extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking |
(bfd *, struct bfd_link_info *); |
/* ELF ARM Interworking support. Called from linker. */ |
extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections |
(struct bfd_link_info *); |
extern bfd_boolean bfd_elf32_arm_process_before_allocation |
(bfd *, struct bfd_link_info *); |
void bfd_elf32_arm_set_target_relocs |
(bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix, |
bfd_arm_stm32l4xx_fix, int, int, int, int, int); |
extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd |
(bfd *, struct bfd_link_info *); |
/* ELF ARM mapping symbol support. */ |
#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0) |
#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1) |
#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2) |
#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0) |
extern bfd_boolean bfd_is_arm_special_symbol_name |
(const char *, int); |
extern void bfd_elf32_arm_set_byteswap_code |
(struct bfd_link_info *, int); |
extern void bfd_elf32_arm_use_long_plt (void); |
/* ARM Note section processing. */ |
extern bfd_boolean bfd_arm_merge_machines |
(bfd *, bfd *); |
extern bfd_boolean bfd_arm_update_notes |
(bfd *, const char *); |
extern unsigned int bfd_arm_get_mach_from_notes |
(bfd *, const char *); |
/* ARM stub generation support. Called from the linker. */ |
extern int elf32_arm_setup_section_lists |
(bfd *, struct bfd_link_info *); |
extern void elf32_arm_next_input_section |
(struct bfd_link_info *, struct bfd_section *); |
extern bfd_boolean elf32_arm_size_stubs |
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, |
struct bfd_section * (*) (const char *, struct bfd_section *, unsigned int), |
void (*) (void)); |
extern bfd_boolean elf32_arm_build_stubs |
(struct bfd_link_info *); |
/* ARM unwind section editing support. */ |
extern bfd_boolean elf32_arm_fix_exidx_coverage |
(struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean); |
/* C6x unwind section editing support. */ |
extern bfd_boolean elf32_tic6x_fix_exidx_coverage |
(struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean); |
/* PowerPC @tls opcode transform/validate. */ |
extern unsigned int _bfd_elf_ppc_at_tls_transform |
(unsigned int, unsigned int); |
/* PowerPC @tprel opcode transform/validate. */ |
extern unsigned int _bfd_elf_ppc_at_tprel_transform |
(unsigned int, unsigned int); |
extern void bfd_elf64_aarch64_init_maps |
(bfd *); |
extern void bfd_elf32_aarch64_init_maps |
(bfd *); |
extern void bfd_elf64_aarch64_set_options |
(bfd *, struct bfd_link_info *, int, int, int, int, int); |
extern void bfd_elf32_aarch64_set_options |
(bfd *, struct bfd_link_info *, int, int, int, int, int); |
/* ELF AArch64 mapping symbol support. */ |
#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) |
#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG (1 << 1) |
#define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER (1 << 2) |
#define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY (~0) |
extern bfd_boolean bfd_is_aarch64_special_symbol_name |
(const char * name, int type); |
/* AArch64 stub generation support for ELF64. Called from the linker. */ |
extern int elf64_aarch64_setup_section_lists |
(bfd *, struct bfd_link_info *); |
extern void elf64_aarch64_next_input_section |
(struct bfd_link_info *, struct bfd_section *); |
extern bfd_boolean elf64_aarch64_size_stubs |
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, |
struct bfd_section * (*) (const char *, struct bfd_section *), |
void (*) (void)); |
extern bfd_boolean elf64_aarch64_build_stubs |
(struct bfd_link_info *); |
/* AArch64 stub generation support for ELF32. Called from the linker. */ |
extern int elf32_aarch64_setup_section_lists |
(bfd *, struct bfd_link_info *); |
extern void elf32_aarch64_next_input_section |
(struct bfd_link_info *, struct bfd_section *); |
extern bfd_boolean elf32_aarch64_size_stubs |
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, |
struct bfd_section * (*) (const char *, struct bfd_section *), |
void (*) (void)); |
extern bfd_boolean elf32_aarch64_build_stubs |
(struct bfd_link_info *); |
/* TI COFF load page support. */ |
extern void bfd_ticoff_set_section_load_page |
(struct bfd_section *, int); |
extern int bfd_ticoff_get_section_load_page |
(struct bfd_section *); |
/* H8/300 functions. */ |
extern bfd_vma bfd_h8300_pad_address |
(bfd *, bfd_vma); |
/* IA64 Itanium code generation. Called from linker. */ |
extern void bfd_elf32_ia64_after_parse |
(int); |
extern void bfd_elf64_ia64_after_parse |
(int); |
/* V850 Note manipulation routines. */ |
extern bfd_boolean v850_elf_create_sections |
(struct bfd_link_info *); |
extern bfd_boolean v850_elf_set_note |
(bfd *, unsigned int, unsigned int); |
/contrib/toolchain/binutils/bfd/bfd-in2.h |
---|
0,0 → 1,7569 |
/* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically |
generated from "bfd-in.h", "init.c", "opncls.c", "libbfd.c", |
"bfdio.c", "bfdwin.c", "section.c", "archures.c", "reloc.c", |
"syms.c", "bfd.c", "archive.c", "corefile.c", "targets.c", "format.c", |
"linker.c", "simple.c" and "compress.c". |
Run "make headers" in your build bfd/ to regenerate. */ |
/* Main header file for the bfd library -- portable access to object files. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Contributed 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. */ |
#ifndef __BFD_H_SEEN__ |
#define __BFD_H_SEEN__ |
/* PR 14072: Ensure that config.h is included first. */ |
#if !defined PACKAGE && !defined PACKAGE_VERSION |
#error config.h must be included before this header |
#endif |
#ifdef __cplusplus |
extern "C" { |
#endif |
#include "ansidecl.h" |
#include "symcat.h" |
#include <sys/stat.h> |
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) |
#ifndef SABER |
/* This hack is to avoid a problem with some strict ANSI C preprocessors. |
The problem is, "32_" is not a valid preprocessing token, and we don't |
want extra underscores (e.g., "nlm_32_"). The XCONCAT2 macro will |
cause the inner CONCAT2 macros to be evaluated first, producing |
still-valid pp-tokens. Then the final concatenation can be done. */ |
#undef CONCAT4 |
#define CONCAT4(a,b,c,d) XCONCAT2(CONCAT2(a,b),CONCAT2(c,d)) |
#endif |
#endif |
/* This is a utility macro to handle the situation where the code |
wants to place a constant string into the code, followed by a |
comma and then the length of the string. Doing this by hand |
is error prone, so using this macro is safer. */ |
#define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1) |
/* Unfortunately it is not possible to use the STRING_COMMA_LEN macro |
to create the arguments to another macro, since the preprocessor |
will mis-count the number of arguments to the outer macro (by not |
evaluating STRING_COMMA_LEN and so missing the comma). This is a |
problem for example when trying to use STRING_COMMA_LEN to build |
the arguments to the strncmp() macro. Hence this alternative |
definition of strncmp is provided here. |
Note - these macros do NOT work if STR2 is not a constant string. */ |
#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0) |
/* strcpy() can have a similar problem, but since we know we are |
copying a constant string, we can use memcpy which will be faster |
since there is no need to check for a NUL byte inside STR. We |
can also save time if we do not need to copy the terminating NUL. */ |
#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1) |
#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2)) |
#define BFD_SUPPORTS_PLUGINS @supports_plugins@ |
/* The word size used by BFD on the host. This may be 64 with a 32 |
bit target if the host is 64 bit, or if other 64 bit targets have |
been selected with --enable-targets, or if --enable-64-bit-bfd. */ |
#define BFD_ARCH_SIZE @wordsize@ |
/* The word size of the default bfd target. */ |
#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@ |
#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@ |
#define BFD_HOST_64BIT_LONG_LONG @BFD_HOST_64BIT_LONG_LONG@ |
#if @BFD_HOST_64_BIT_DEFINED@ |
#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@ |
#define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@ |
typedef BFD_HOST_64_BIT bfd_int64_t; |
typedef BFD_HOST_U_64_BIT bfd_uint64_t; |
#endif |
#if BFD_ARCH_SIZE >= 64 |
#define BFD64 |
#endif |
#ifndef INLINE |
#if __GNUC__ >= 2 |
#define INLINE __inline__ |
#else |
#define INLINE |
#endif |
#endif |
/* Declaring a type wide enough to hold a host long and a host pointer. */ |
#define BFD_HOSTPTR_T @BFD_HOSTPTR_T@ |
typedef BFD_HOSTPTR_T bfd_hostptr_t; |
/* Forward declaration. */ |
typedef struct bfd bfd; |
/* Boolean type used in bfd. Too many systems define their own |
versions of "boolean" for us to safely typedef a "boolean" of |
our own. Using an enum for "bfd_boolean" has its own set of |
problems, with strange looking casts required to avoid warnings |
on some older compilers. Thus we just use an int. |
General rule: Functions which are bfd_boolean return TRUE on |
success and FALSE on failure (unless they're a predicate). */ |
typedef int bfd_boolean; |
#undef FALSE |
#undef TRUE |
#define FALSE 0 |
#define TRUE 1 |
#ifdef BFD64 |
#ifndef BFD_HOST_64_BIT |
#error No 64 bit integer type available |
#endif /* ! defined (BFD_HOST_64_BIT) */ |
typedef BFD_HOST_U_64_BIT bfd_vma; |
typedef BFD_HOST_64_BIT bfd_signed_vma; |
typedef BFD_HOST_U_64_BIT bfd_size_type; |
typedef BFD_HOST_U_64_BIT symvalue; |
#if BFD_HOST_64BIT_LONG |
#define BFD_VMA_FMT "l" |
#elif defined (__MSVCRT__) |
#define BFD_VMA_FMT "I64" |
#else |
#define BFD_VMA_FMT "ll" |
#endif |
#ifndef fprintf_vma |
#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x) |
#define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x) |
#endif |
#else /* not BFD64 */ |
/* Represent a target address. Also used as a generic unsigned type |
which is guaranteed to be big enough to hold any arithmetic types |
we need to deal with. */ |
typedef unsigned long bfd_vma; |
/* A generic signed type which is guaranteed to be big enough to hold any |
arithmetic types we need to deal with. Can be assumed to be compatible |
with bfd_vma in the same way that signed and unsigned ints are compatible |
(as parameters, in assignment, etc). */ |
typedef long bfd_signed_vma; |
typedef unsigned long symvalue; |
typedef unsigned long bfd_size_type; |
/* Print a bfd_vma x on stream s. */ |
#define BFD_VMA_FMT "l" |
#define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x) |
#define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x) |
#endif /* not BFD64 */ |
#define HALF_BFD_SIZE_TYPE \ |
(((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2)) |
#ifndef BFD_HOST_64_BIT |
/* Fall back on a 32 bit type. The idea is to make these types always |
available for function return types, but in the case that |
BFD_HOST_64_BIT is undefined such a function should abort or |
otherwise signal an error. */ |
typedef bfd_signed_vma bfd_int64_t; |
typedef bfd_vma bfd_uint64_t; |
#endif |
/* An offset into a file. BFD always uses the largest possible offset |
based on the build time availability of fseek, fseeko, or fseeko64. */ |
typedef @bfd_file_ptr@ file_ptr; |
typedef unsigned @bfd_file_ptr@ ufile_ptr; |
extern void bfd_sprintf_vma (bfd *, char *, bfd_vma); |
extern void bfd_fprintf_vma (bfd *, void *, bfd_vma); |
#define printf_vma(x) fprintf_vma(stdout,x) |
#define bfd_printf_vma(abfd,x) bfd_fprintf_vma (abfd,stdout,x) |
typedef unsigned int flagword; /* 32 bits of flags */ |
typedef unsigned char bfd_byte; |
/* File formats. */ |
typedef enum bfd_format |
{ |
bfd_unknown = 0, /* File format is unknown. */ |
bfd_object, /* Linker/assembler/compiler output. */ |
bfd_archive, /* Object archive file. */ |
bfd_core, /* Core dump. */ |
bfd_type_end /* Marks the end; don't use it! */ |
} |
bfd_format; |
/* Symbols and relocation. */ |
/* A count of carsyms (canonical archive symbols). */ |
typedef unsigned long symindex; |
/* How to perform a relocation. */ |
typedef const struct reloc_howto_struct reloc_howto_type; |
#define BFD_NO_MORE_SYMBOLS ((symindex) ~0) |
/* General purpose part of a symbol X; |
target specific parts are in libcoff.h, libaout.h, etc. */ |
#define bfd_get_section(x) ((x)->section) |
#define bfd_get_output_section(x) ((x)->section->output_section) |
#define bfd_set_section(x,y) ((x)->section) = (y) |
#define bfd_asymbol_base(x) ((x)->section->vma) |
#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value) |
#define bfd_asymbol_name(x) ((x)->name) |
/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/ |
#define bfd_asymbol_bfd(x) ((x)->the_bfd) |
#define bfd_asymbol_flavour(x) \ |
(((x)->flags & BSF_SYNTHETIC) != 0 \ |
? bfd_target_unknown_flavour \ |
: bfd_asymbol_bfd (x)->xvec->flavour) |
/* A canonical archive symbol. */ |
/* This is a type pun with struct ranlib on purpose! */ |
typedef struct carsym |
{ |
char *name; |
file_ptr file_offset; /* Look here to find the file. */ |
} |
carsym; /* To make these you call a carsymogen. */ |
/* Used in generating armaps (archive tables of contents). |
Perhaps just a forward definition would do? */ |
struct orl /* Output ranlib. */ |
{ |
char **name; /* Symbol name. */ |
union |
{ |
file_ptr pos; |
bfd *abfd; |
} u; /* bfd* or file position. */ |
int namidx; /* Index into string table. */ |
}; |
/* Linenumber stuff. */ |
typedef struct lineno_cache_entry |
{ |
unsigned int line_number; /* Linenumber from start of function. */ |
union |
{ |
struct bfd_symbol *sym; /* Function name. */ |
bfd_vma offset; /* Offset into section. */ |
} u; |
} |
alent; |
/* Object and core file sections. */ |
#define align_power(addr, align) \ |
(((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align)))) |
typedef struct bfd_section *sec_ptr; |
#define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name) |
#define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma) |
#define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma) |
#define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \ |
(ptr)->alignment_power) |
#define bfd_section_name(bfd, ptr) ((ptr)->name) |
#define bfd_section_size(bfd, ptr) ((ptr)->size) |
#define bfd_get_section_size(ptr) ((ptr)->size) |
#define bfd_section_vma(bfd, ptr) ((ptr)->vma) |
#define bfd_section_lma(bfd, ptr) ((ptr)->lma) |
#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power) |
#define bfd_get_section_flags(bfd, ptr) ((void) bfd, (ptr)->flags) |
#define bfd_get_section_userdata(bfd, ptr) ((void) bfd, (ptr)->userdata) |
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) |
#define bfd_get_section_limit_octets(bfd, sec) \ |
((bfd)->direction != write_direction && (sec)->rawsize != 0 \ |
? (sec)->rawsize : (sec)->size) |
/* Find the address one past the end of SEC. */ |
#define bfd_get_section_limit(bfd, sec) \ |
(bfd_get_section_limit_octets(bfd, sec) / bfd_octets_per_byte (bfd)) |
/* Return TRUE if input section SEC has been discarded. */ |
#define discarded_section(sec) \ |
(!bfd_is_abs_section (sec) \ |
&& bfd_is_abs_section ((sec)->output_section) \ |
&& (sec)->sec_info_type != SEC_INFO_TYPE_MERGE \ |
&& (sec)->sec_info_type != SEC_INFO_TYPE_JUST_SYMS) |
typedef enum bfd_print_symbol |
{ |
bfd_print_symbol_name, |
bfd_print_symbol_more, |
bfd_print_symbol_all |
} bfd_print_symbol_type; |
/* Information about a symbol that nm needs. */ |
typedef struct _symbol_info |
{ |
symvalue value; |
char type; |
const char *name; /* Symbol name. */ |
unsigned char stab_type; /* Stab type. */ |
char stab_other; /* Stab other. */ |
short stab_desc; /* Stab desc. */ |
const char *stab_name; /* String for stab type. */ |
} symbol_info; |
/* Get the name of a stabs type code. */ |
extern const char *bfd_get_stab_name (int); |
/* Hash table routines. There is no way to free up a hash table. */ |
/* An element in the hash table. Most uses will actually use a larger |
structure, and an instance of this will be the first field. */ |
struct bfd_hash_entry |
{ |
/* Next entry for this hash code. */ |
struct bfd_hash_entry *next; |
/* String being hashed. */ |
const char *string; |
/* Hash code. This is the full hash code, not the index into the |
table. */ |
unsigned long hash; |
}; |
/* A hash table. */ |
struct bfd_hash_table |
{ |
/* The hash array. */ |
struct bfd_hash_entry **table; |
/* A function used to create new elements in the hash table. The |
first entry is itself a pointer to an element. When this |
function is first invoked, this pointer will be NULL. However, |
having the pointer permits a hierarchy of method functions to be |
built each of which calls the function in the superclass. Thus |
each function should be written to allocate a new block of memory |
only if the argument is NULL. */ |
struct bfd_hash_entry *(*newfunc) |
(struct bfd_hash_entry *, struct bfd_hash_table *, const char *); |
/* An objalloc for this hash table. This is a struct objalloc *, |
but we use void * to avoid requiring the inclusion of objalloc.h. */ |
void *memory; |
/* The number of slots in the hash table. */ |
unsigned int size; |
/* The number of entries in the hash table. */ |
unsigned int count; |
/* The size of elements. */ |
unsigned int entsize; |
/* If non-zero, don't grow the hash table. */ |
unsigned int frozen:1; |
}; |
/* Initialize a hash table. */ |
extern bfd_boolean bfd_hash_table_init |
(struct bfd_hash_table *, |
struct bfd_hash_entry *(*) (struct bfd_hash_entry *, |
struct bfd_hash_table *, |
const char *), |
unsigned int); |
/* Initialize a hash table specifying a size. */ |
extern bfd_boolean bfd_hash_table_init_n |
(struct bfd_hash_table *, |
struct bfd_hash_entry *(*) (struct bfd_hash_entry *, |
struct bfd_hash_table *, |
const char *), |
unsigned int, unsigned int); |
/* Free up a hash table. */ |
extern void bfd_hash_table_free |
(struct bfd_hash_table *); |
/* Look up a string in a hash table. If CREATE is TRUE, a new entry |
will be created for this string if one does not already exist. The |
COPY argument must be TRUE if this routine should copy the string |
into newly allocated memory when adding an entry. */ |
extern struct bfd_hash_entry *bfd_hash_lookup |
(struct bfd_hash_table *, const char *, bfd_boolean create, |
bfd_boolean copy); |
/* Insert an entry in a hash table. */ |
extern struct bfd_hash_entry *bfd_hash_insert |
(struct bfd_hash_table *, const char *, unsigned long); |
/* Rename an entry in a hash table. */ |
extern void bfd_hash_rename |
(struct bfd_hash_table *, const char *, struct bfd_hash_entry *); |
/* Replace an entry in a hash table. */ |
extern void bfd_hash_replace |
(struct bfd_hash_table *, struct bfd_hash_entry *old, |
struct bfd_hash_entry *nw); |
/* Base method for creating a hash table entry. */ |
extern struct bfd_hash_entry *bfd_hash_newfunc |
(struct bfd_hash_entry *, struct bfd_hash_table *, const char *); |
/* Grab some space for a hash table entry. */ |
extern void *bfd_hash_allocate |
(struct bfd_hash_table *, unsigned int); |
/* Traverse a hash table in a random order, calling a function on each |
element. If the function returns FALSE, the traversal stops. The |
INFO argument is passed to the function. */ |
extern void bfd_hash_traverse |
(struct bfd_hash_table *, |
bfd_boolean (*) (struct bfd_hash_entry *, void *), |
void *info); |
/* Allows the default size of a hash table to be configured. New hash |
tables allocated using bfd_hash_table_init will be created with |
this size. */ |
extern unsigned long bfd_hash_set_default_size (unsigned long); |
/* Types of compressed DWARF debug sections. We currently support |
zlib. */ |
enum compressed_debug_section_type |
{ |
COMPRESS_DEBUG_NONE = 0, |
COMPRESS_DEBUG = 1 << 0, |
COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1, |
COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2 |
}; |
/* This structure is used to keep track of stabs in sections |
information while linking. */ |
struct stab_info |
{ |
/* A hash table used to hold stabs strings. */ |
struct bfd_strtab_hash *strings; |
/* The header file hash table. */ |
struct bfd_hash_table includes; |
/* The first .stabstr section. */ |
struct bfd_section *stabstr; |
}; |
#define COFF_SWAP_TABLE (void *) &bfd_coff_std_swap_table |
/* User program access to BFD facilities. */ |
/* Direct I/O routines, for programs which know more about the object |
file than BFD does. Use higher level routines if possible. */ |
extern bfd_size_type bfd_bread (void *, bfd_size_type, bfd *); |
extern bfd_size_type bfd_bwrite (const void *, bfd_size_type, bfd *); |
extern int bfd_seek (bfd *, file_ptr, int); |
extern file_ptr bfd_tell (bfd *); |
extern int bfd_flush (bfd *); |
extern int bfd_stat (bfd *, struct stat *); |
/* Deprecated old routines. */ |
#if __GNUC__ |
#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ |
(warn_deprecated ("bfd_read", __FILE__, __LINE__, __FUNCTION__), \ |
bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) |
#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ |
(warn_deprecated ("bfd_write", __FILE__, __LINE__, __FUNCTION__), \ |
bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) |
#else |
#define bfd_read(BUF, ELTSIZE, NITEMS, ABFD) \ |
(warn_deprecated ("bfd_read", (const char *) 0, 0, (const char *) 0), \ |
bfd_bread ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) |
#define bfd_write(BUF, ELTSIZE, NITEMS, ABFD) \ |
(warn_deprecated ("bfd_write", (const char *) 0, 0, (const char *) 0),\ |
bfd_bwrite ((BUF), (ELTSIZE) * (NITEMS), (ABFD))) |
#endif |
extern void warn_deprecated (const char *, const char *, int, const char *); |
/* Cast from const char * to char * so that caller can assign to |
a char * without a warning. */ |
#define bfd_get_filename(abfd) ((char *) (abfd)->filename) |
#define bfd_get_cacheable(abfd) ((abfd)->cacheable) |
#define bfd_get_format(abfd) ((abfd)->format) |
#define bfd_get_target(abfd) ((abfd)->xvec->name) |
#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour) |
#define bfd_family_coff(abfd) \ |
(bfd_get_flavour (abfd) == bfd_target_coff_flavour || \ |
bfd_get_flavour (abfd) == bfd_target_xcoff_flavour) |
#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG) |
#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE) |
#define bfd_header_big_endian(abfd) \ |
((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG) |
#define bfd_header_little_endian(abfd) \ |
((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE) |
#define bfd_get_file_flags(abfd) ((abfd)->flags) |
#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags) |
#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags) |
#define bfd_my_archive(abfd) ((abfd)->my_archive) |
#define bfd_has_map(abfd) ((abfd)->has_armap) |
#define bfd_is_thin_archive(abfd) ((abfd)->is_thin_archive) |
#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types) |
#define bfd_usrdata(abfd) ((abfd)->usrdata) |
#define bfd_get_start_address(abfd) ((abfd)->start_address) |
#define bfd_get_symcount(abfd) ((abfd)->symcount) |
#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols) |
#define bfd_count_sections(abfd) ((abfd)->section_count) |
#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount) |
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) |
extern bfd_boolean bfd_cache_close |
(bfd *abfd); |
/* NB: This declaration should match the autogenerated one in libbfd.h. */ |
extern bfd_boolean bfd_cache_close_all (void); |
extern bfd_boolean bfd_record_phdr |
(bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma, |
bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **); |
/* Byte swapping routines. */ |
bfd_uint64_t bfd_getb64 (const void *); |
bfd_uint64_t bfd_getl64 (const void *); |
bfd_int64_t bfd_getb_signed_64 (const void *); |
bfd_int64_t bfd_getl_signed_64 (const void *); |
bfd_vma bfd_getb32 (const void *); |
bfd_vma bfd_getl32 (const void *); |
bfd_signed_vma bfd_getb_signed_32 (const void *); |
bfd_signed_vma bfd_getl_signed_32 (const void *); |
bfd_vma bfd_getb16 (const void *); |
bfd_vma bfd_getl16 (const void *); |
bfd_signed_vma bfd_getb_signed_16 (const void *); |
bfd_signed_vma bfd_getl_signed_16 (const void *); |
void bfd_putb64 (bfd_uint64_t, void *); |
void bfd_putl64 (bfd_uint64_t, void *); |
void bfd_putb32 (bfd_vma, void *); |
void bfd_putl32 (bfd_vma, void *); |
void bfd_putb16 (bfd_vma, void *); |
void bfd_putl16 (bfd_vma, void *); |
/* Byte swapping routines which take size and endiannes as arguments. */ |
bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean); |
void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean); |
#if defined(__STDC__) || defined(ALMOST_STDC) |
struct ecoff_debug_info; |
struct ecoff_debug_swap; |
struct ecoff_extr; |
struct bfd_symbol; |
struct bfd_link_info; |
struct bfd_link_hash_entry; |
struct bfd_section_already_linked; |
struct bfd_elf_version_tree; |
#endif |
extern bfd_boolean bfd_section_already_linked_table_init (void); |
extern void bfd_section_already_linked_table_free (void); |
extern bfd_boolean _bfd_handle_already_linked |
(struct bfd_section *, struct bfd_section_already_linked *, |
struct bfd_link_info *); |
/* Externally visible ECOFF routines. */ |
extern bfd_vma bfd_ecoff_get_gp_value |
(bfd * abfd); |
extern bfd_boolean bfd_ecoff_set_gp_value |
(bfd *abfd, bfd_vma gp_value); |
extern bfd_boolean bfd_ecoff_set_regmasks |
(bfd *abfd, unsigned long gprmask, unsigned long fprmask, |
unsigned long *cprmask); |
extern void *bfd_ecoff_debug_init |
(bfd *output_bfd, struct ecoff_debug_info *output_debug, |
const struct ecoff_debug_swap *output_swap, struct bfd_link_info *); |
extern void bfd_ecoff_debug_free |
(void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, |
const struct ecoff_debug_swap *output_swap, struct bfd_link_info *); |
extern bfd_boolean bfd_ecoff_debug_accumulate |
(void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, |
const struct ecoff_debug_swap *output_swap, bfd *input_bfd, |
struct ecoff_debug_info *input_debug, |
const struct ecoff_debug_swap *input_swap, struct bfd_link_info *); |
extern bfd_boolean bfd_ecoff_debug_accumulate_other |
(void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug, |
const struct ecoff_debug_swap *output_swap, bfd *input_bfd, |
struct bfd_link_info *); |
extern bfd_boolean bfd_ecoff_debug_externals |
(bfd *abfd, struct ecoff_debug_info *debug, |
const struct ecoff_debug_swap *swap, bfd_boolean relocatable, |
bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *), |
void (*set_index) (struct bfd_symbol *, bfd_size_type)); |
extern bfd_boolean bfd_ecoff_debug_one_external |
(bfd *abfd, struct ecoff_debug_info *debug, |
const struct ecoff_debug_swap *swap, const char *name, |
struct ecoff_extr *esym); |
extern bfd_size_type bfd_ecoff_debug_size |
(bfd *abfd, struct ecoff_debug_info *debug, |
const struct ecoff_debug_swap *swap); |
extern bfd_boolean bfd_ecoff_write_debug |
(bfd *abfd, struct ecoff_debug_info *debug, |
const struct ecoff_debug_swap *swap, file_ptr where); |
extern bfd_boolean bfd_ecoff_write_accumulated_debug |
(void *handle, bfd *abfd, struct ecoff_debug_info *debug, |
const struct ecoff_debug_swap *swap, |
struct bfd_link_info *info, file_ptr where); |
/* Externally visible ELF routines. */ |
struct bfd_link_needed_list |
{ |
struct bfd_link_needed_list *next; |
bfd *by; |
const char *name; |
}; |
enum dynamic_lib_link_class { |
DYN_NORMAL = 0, |
DYN_AS_NEEDED = 1, |
DYN_DT_NEEDED = 2, |
DYN_NO_ADD_NEEDED = 4, |
DYN_NO_NEEDED = 8 |
}; |
enum notice_asneeded_action { |
notice_as_needed, |
notice_not_needed, |
notice_needed |
}; |
extern bfd_boolean bfd_elf_record_link_assignment |
(bfd *, struct bfd_link_info *, const char *, bfd_boolean, |
bfd_boolean); |
extern struct bfd_link_needed_list *bfd_elf_get_needed_list |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_elf_get_bfd_needed_list |
(bfd *, struct bfd_link_needed_list **); |
extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *, |
const char *, bfd_vma); |
extern bfd_boolean bfd_elf_size_dynamic_sections |
(bfd *, const char *, const char *, const char *, const char *, const char *, |
const char * const *, struct bfd_link_info *, struct bfd_section **); |
extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr |
(bfd *, struct bfd_link_info *); |
extern void bfd_elf_set_dt_needed_name |
(bfd *, const char *); |
extern const char *bfd_elf_get_dt_soname |
(bfd *); |
extern void bfd_elf_set_dyn_lib_class |
(bfd *, enum dynamic_lib_link_class); |
extern int bfd_elf_get_dyn_lib_class |
(bfd *); |
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list |
(bfd *, struct bfd_link_info *); |
extern int bfd_elf_discard_info |
(bfd *, struct bfd_link_info *); |
extern unsigned int _bfd_elf_default_action_discarded |
(struct bfd_section *); |
/* Return an upper bound on the number of bytes required to store a |
copy of ABFD's program header table entries. Return -1 if an error |
occurs; bfd_get_error will return an appropriate code. */ |
extern long bfd_get_elf_phdr_upper_bound |
(bfd *abfd); |
/* Copy ABFD's program header table entries to *PHDRS. The entries |
will be stored as an array of Elf_Internal_Phdr structures, as |
defined in include/elf/internal.h. To find out how large the |
buffer needs to be, call bfd_get_elf_phdr_upper_bound. |
Return the number of program header table entries read, or -1 if an |
error occurs; bfd_get_error will return an appropriate code. */ |
extern int bfd_get_elf_phdrs |
(bfd *abfd, void *phdrs); |
/* Create a new BFD as if by bfd_openr. Rather than opening a file, |
reconstruct an ELF file by reading the segments out of remote |
memory based on the ELF file header at EHDR_VMA and the ELF program |
headers it points to. If non-zero, SIZE is the known extent of the |
object. If not null, *LOADBASEP is filled in with the difference |
between the VMAs from which the segments were read, and the VMAs |
the file headers (and hence BFD's idea of each section's VMA) put |
them at. |
The function TARGET_READ_MEMORY is called to copy LEN bytes from |
the remote memory at target address VMA into the local buffer at |
MYADDR; it should return zero on success or an `errno' code on |
failure. TEMPL must be a BFD for a target with the word size and |
byte order found in the remote memory. */ |
extern bfd *bfd_elf_bfd_from_remote_memory |
(bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep, |
int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, |
bfd_size_type len)); |
extern struct bfd_section *_bfd_elf_tls_setup |
(bfd *, struct bfd_link_info *); |
extern struct bfd_section * |
_bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma); |
extern void _bfd_fix_excluded_sec_syms |
(bfd *, struct bfd_link_info *); |
extern unsigned bfd_m68k_mach_to_features (int); |
extern int bfd_m68k_features_to_mach (unsigned); |
extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs |
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, |
char **); |
extern void bfd_elf_m68k_set_target_options (struct bfd_link_info *, int); |
extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs |
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, |
char **); |
extern bfd_boolean bfd_cr16_elf32_create_embedded_relocs |
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, |
char **); |
/* SunOS shared library support routines for the linker. */ |
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_sunos_record_link_assignment |
(bfd *, struct bfd_link_info *, const char *); |
extern bfd_boolean bfd_sunos_size_dynamic_sections |
(bfd *, struct bfd_link_info *, struct bfd_section **, |
struct bfd_section **, struct bfd_section **); |
/* Linux shared library support routines for the linker. */ |
extern bfd_boolean bfd_i386linux_size_dynamic_sections |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_m68klinux_size_dynamic_sections |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_sparclinux_size_dynamic_sections |
(bfd *, struct bfd_link_info *); |
/* mmap hacks */ |
struct _bfd_window_internal; |
typedef struct _bfd_window_internal bfd_window_internal; |
typedef struct _bfd_window |
{ |
/* What the user asked for. */ |
void *data; |
bfd_size_type size; |
/* The actual window used by BFD. Small user-requested read-only |
regions sharing a page may share a single window into the object |
file. Read-write versions shouldn't until I've fixed things to |
keep track of which portions have been claimed by the |
application; don't want to give the same region back when the |
application wants two writable copies! */ |
struct _bfd_window_internal *i; |
} |
bfd_window; |
extern void bfd_init_window |
(bfd_window *); |
extern void bfd_free_window |
(bfd_window *); |
extern bfd_boolean bfd_get_file_window |
(bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean); |
/* XCOFF support routines for the linker. */ |
extern bfd_boolean bfd_xcoff_split_import_path |
(bfd *, const char *, const char **, const char **); |
extern bfd_boolean bfd_xcoff_set_archive_import_path |
(struct bfd_link_info *, bfd *, const char *); |
extern bfd_boolean bfd_xcoff_link_record_set |
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type); |
extern bfd_boolean bfd_xcoff_import_symbol |
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma, |
const char *, const char *, const char *, unsigned int); |
extern bfd_boolean bfd_xcoff_export_symbol |
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *); |
extern bfd_boolean bfd_xcoff_link_count_reloc |
(bfd *, struct bfd_link_info *, const char *); |
extern bfd_boolean bfd_xcoff_record_link_assignment |
(bfd *, struct bfd_link_info *, const char *); |
extern bfd_boolean bfd_xcoff_size_dynamic_sections |
(bfd *, struct bfd_link_info *, const char *, const char *, |
unsigned long, unsigned long, unsigned long, bfd_boolean, |
int, bfd_boolean, unsigned int, struct bfd_section **, bfd_boolean); |
extern bfd_boolean bfd_xcoff_link_generate_rtinit |
(bfd *, const char *, const char *, bfd_boolean); |
/* XCOFF support routines for ar. */ |
extern bfd_boolean bfd_xcoff_ar_archive_set_magic |
(bfd *, char *); |
/* Externally visible COFF routines. */ |
#if defined(__STDC__) || defined(ALMOST_STDC) |
struct internal_syment; |
union internal_auxent; |
#endif |
extern bfd_boolean bfd_coff_set_symbol_class |
(bfd *, struct bfd_symbol *, unsigned int); |
extern bfd_boolean bfd_m68k_coff_create_embedded_relocs |
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *, char **); |
/* ARM VFP11 erratum workaround support. */ |
typedef enum |
{ |
BFD_ARM_VFP11_FIX_DEFAULT, |
BFD_ARM_VFP11_FIX_NONE, |
BFD_ARM_VFP11_FIX_SCALAR, |
BFD_ARM_VFP11_FIX_VECTOR |
} bfd_arm_vfp11_fix; |
extern void bfd_elf32_arm_init_maps |
(bfd *); |
extern void bfd_elf32_arm_set_vfp11_fix |
(bfd *, struct bfd_link_info *); |
extern void bfd_elf32_arm_set_cortex_a8_fix |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan |
(bfd *, struct bfd_link_info *); |
extern void bfd_elf32_arm_vfp11_fix_veneer_locations |
(bfd *, struct bfd_link_info *); |
/* ARM STM STM32L4XX erratum workaround support. */ |
typedef enum |
{ |
BFD_ARM_STM32L4XX_FIX_NONE, |
BFD_ARM_STM32L4XX_FIX_DEFAULT, |
BFD_ARM_STM32L4XX_FIX_ALL |
} bfd_arm_stm32l4xx_fix; |
extern void bfd_elf32_arm_set_stm32l4xx_fix |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_elf32_arm_stm32l4xx_erratum_scan |
(bfd *, struct bfd_link_info *); |
extern void bfd_elf32_arm_stm32l4xx_fix_veneer_locations |
(bfd *, struct bfd_link_info *); |
/* ARM Interworking support. Called from linker. */ |
extern bfd_boolean bfd_arm_allocate_interworking_sections |
(struct bfd_link_info *); |
extern bfd_boolean bfd_arm_process_before_allocation |
(bfd *, struct bfd_link_info *, int); |
extern bfd_boolean bfd_arm_get_bfd_for_interworking |
(bfd *, struct bfd_link_info *); |
/* PE ARM Interworking support. Called from linker. */ |
extern bfd_boolean bfd_arm_pe_allocate_interworking_sections |
(struct bfd_link_info *); |
extern bfd_boolean bfd_arm_pe_process_before_allocation |
(bfd *, struct bfd_link_info *, int); |
extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking |
(bfd *, struct bfd_link_info *); |
/* ELF ARM Interworking support. Called from linker. */ |
extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections |
(struct bfd_link_info *); |
extern bfd_boolean bfd_elf32_arm_process_before_allocation |
(bfd *, struct bfd_link_info *); |
void bfd_elf32_arm_set_target_relocs |
(bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix, |
bfd_arm_stm32l4xx_fix, int, int, int, int, int); |
extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd |
(bfd *, struct bfd_link_info *); |
/* ELF ARM mapping symbol support. */ |
#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0) |
#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1) |
#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2) |
#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0) |
extern bfd_boolean bfd_is_arm_special_symbol_name |
(const char *, int); |
extern void bfd_elf32_arm_set_byteswap_code |
(struct bfd_link_info *, int); |
extern void bfd_elf32_arm_use_long_plt (void); |
/* ARM Note section processing. */ |
extern bfd_boolean bfd_arm_merge_machines |
(bfd *, bfd *); |
extern bfd_boolean bfd_arm_update_notes |
(bfd *, const char *); |
extern unsigned int bfd_arm_get_mach_from_notes |
(bfd *, const char *); |
/* ARM stub generation support. Called from the linker. */ |
extern int elf32_arm_setup_section_lists |
(bfd *, struct bfd_link_info *); |
extern void elf32_arm_next_input_section |
(struct bfd_link_info *, struct bfd_section *); |
extern bfd_boolean elf32_arm_size_stubs |
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, |
struct bfd_section * (*) (const char *, struct bfd_section *, unsigned int), |
void (*) (void)); |
extern bfd_boolean elf32_arm_build_stubs |
(struct bfd_link_info *); |
/* ARM unwind section editing support. */ |
extern bfd_boolean elf32_arm_fix_exidx_coverage |
(struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean); |
/* C6x unwind section editing support. */ |
extern bfd_boolean elf32_tic6x_fix_exidx_coverage |
(struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean); |
/* PowerPC @tls opcode transform/validate. */ |
extern unsigned int _bfd_elf_ppc_at_tls_transform |
(unsigned int, unsigned int); |
/* PowerPC @tprel opcode transform/validate. */ |
extern unsigned int _bfd_elf_ppc_at_tprel_transform |
(unsigned int, unsigned int); |
extern void bfd_elf64_aarch64_init_maps |
(bfd *); |
extern void bfd_elf32_aarch64_init_maps |
(bfd *); |
extern void bfd_elf64_aarch64_set_options |
(bfd *, struct bfd_link_info *, int, int, int, int, int); |
extern void bfd_elf32_aarch64_set_options |
(bfd *, struct bfd_link_info *, int, int, int, int, int); |
/* ELF AArch64 mapping symbol support. */ |
#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) |
#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG (1 << 1) |
#define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER (1 << 2) |
#define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY (~0) |
extern bfd_boolean bfd_is_aarch64_special_symbol_name |
(const char * name, int type); |
/* AArch64 stub generation support for ELF64. Called from the linker. */ |
extern int elf64_aarch64_setup_section_lists |
(bfd *, struct bfd_link_info *); |
extern void elf64_aarch64_next_input_section |
(struct bfd_link_info *, struct bfd_section *); |
extern bfd_boolean elf64_aarch64_size_stubs |
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, |
struct bfd_section * (*) (const char *, struct bfd_section *), |
void (*) (void)); |
extern bfd_boolean elf64_aarch64_build_stubs |
(struct bfd_link_info *); |
/* AArch64 stub generation support for ELF32. Called from the linker. */ |
extern int elf32_aarch64_setup_section_lists |
(bfd *, struct bfd_link_info *); |
extern void elf32_aarch64_next_input_section |
(struct bfd_link_info *, struct bfd_section *); |
extern bfd_boolean elf32_aarch64_size_stubs |
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, |
struct bfd_section * (*) (const char *, struct bfd_section *), |
void (*) (void)); |
extern bfd_boolean elf32_aarch64_build_stubs |
(struct bfd_link_info *); |
/* TI COFF load page support. */ |
extern void bfd_ticoff_set_section_load_page |
(struct bfd_section *, int); |
extern int bfd_ticoff_get_section_load_page |
(struct bfd_section *); |
/* H8/300 functions. */ |
extern bfd_vma bfd_h8300_pad_address |
(bfd *, bfd_vma); |
/* IA64 Itanium code generation. Called from linker. */ |
extern void bfd_elf32_ia64_after_parse |
(int); |
extern void bfd_elf64_ia64_after_parse |
(int); |
/* V850 Note manipulation routines. */ |
extern bfd_boolean v850_elf_create_sections |
(struct bfd_link_info *); |
extern bfd_boolean v850_elf_set_note |
(bfd *, unsigned int, unsigned int); |
/* Extracted from init.c. */ |
void bfd_init (void); |
/* Extracted from opncls.c. */ |
/* Set to N to open the next N BFDs using an alternate id space. */ |
extern unsigned int bfd_use_reserved_id; |
bfd *bfd_fopen (const char *filename, const char *target, |
const char *mode, int fd); |
bfd *bfd_openr (const char *filename, const char *target); |
bfd *bfd_fdopenr (const char *filename, const char *target, int fd); |
bfd *bfd_openstreamr (const char * filename, const char * target, void * stream); |
bfd *bfd_openr_iovec (const char *filename, const char *target, |
void *(*open_func) (struct bfd *nbfd, |
void *open_closure), |
void *open_closure, |
file_ptr (*pread_func) (struct bfd *nbfd, |
void *stream, |
void *buf, |
file_ptr nbytes, |
file_ptr offset), |
int (*close_func) (struct bfd *nbfd, |
void *stream), |
int (*stat_func) (struct bfd *abfd, |
void *stream, |
struct stat *sb)); |
bfd *bfd_openw (const char *filename, const char *target); |
bfd_boolean bfd_close (bfd *abfd); |
bfd_boolean bfd_close_all_done (bfd *); |
bfd *bfd_create (const char *filename, bfd *templ); |
bfd_boolean bfd_make_writable (bfd *abfd); |
bfd_boolean bfd_make_readable (bfd *abfd); |
void *bfd_alloc (bfd *abfd, bfd_size_type wanted); |
void *bfd_zalloc (bfd *abfd, bfd_size_type wanted); |
unsigned long bfd_calc_gnu_debuglink_crc32 |
(unsigned long crc, const unsigned char *buf, bfd_size_type len); |
char *bfd_get_debug_link_info (bfd *abfd, unsigned long *crc32_out); |
char *bfd_get_alt_debug_link_info (bfd * abfd, |
bfd_size_type *buildid_len, |
bfd_byte **buildid_out); |
char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir); |
char *bfd_follow_gnu_debugaltlink (bfd *abfd, const char *dir); |
struct bfd_section *bfd_create_gnu_debuglink_section |
(bfd *abfd, const char *filename); |
bfd_boolean bfd_fill_in_gnu_debuglink_section |
(bfd *abfd, struct bfd_section *sect, const char *filename); |
/* Extracted from libbfd.c. */ |
/* Byte swapping macros for user section data. */ |
#define bfd_put_8(abfd, val, ptr) \ |
((void) (*((unsigned char *) (ptr)) = (val) & 0xff)) |
#define bfd_put_signed_8 \ |
bfd_put_8 |
#define bfd_get_8(abfd, ptr) \ |
(*(const unsigned char *) (ptr) & 0xff) |
#define bfd_get_signed_8(abfd, ptr) \ |
(((*(const unsigned char *) (ptr) & 0xff) ^ 0x80) - 0x80) |
#define bfd_put_16(abfd, val, ptr) \ |
BFD_SEND (abfd, bfd_putx16, ((val),(ptr))) |
#define bfd_put_signed_16 \ |
bfd_put_16 |
#define bfd_get_16(abfd, ptr) \ |
BFD_SEND (abfd, bfd_getx16, (ptr)) |
#define bfd_get_signed_16(abfd, ptr) \ |
BFD_SEND (abfd, bfd_getx_signed_16, (ptr)) |
#define bfd_put_32(abfd, val, ptr) \ |
BFD_SEND (abfd, bfd_putx32, ((val),(ptr))) |
#define bfd_put_signed_32 \ |
bfd_put_32 |
#define bfd_get_32(abfd, ptr) \ |
BFD_SEND (abfd, bfd_getx32, (ptr)) |
#define bfd_get_signed_32(abfd, ptr) \ |
BFD_SEND (abfd, bfd_getx_signed_32, (ptr)) |
#define bfd_put_64(abfd, val, ptr) \ |
BFD_SEND (abfd, bfd_putx64, ((val), (ptr))) |
#define bfd_put_signed_64 \ |
bfd_put_64 |
#define bfd_get_64(abfd, ptr) \ |
BFD_SEND (abfd, bfd_getx64, (ptr)) |
#define bfd_get_signed_64(abfd, ptr) \ |
BFD_SEND (abfd, bfd_getx_signed_64, (ptr)) |
#define bfd_get(bits, abfd, ptr) \ |
((bits) == 8 ? (bfd_vma) bfd_get_8 (abfd, ptr) \ |
: (bits) == 16 ? bfd_get_16 (abfd, ptr) \ |
: (bits) == 32 ? bfd_get_32 (abfd, ptr) \ |
: (bits) == 64 ? bfd_get_64 (abfd, ptr) \ |
: (abort (), (bfd_vma) - 1)) |
#define bfd_put(bits, abfd, val, ptr) \ |
((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \ |
: (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \ |
: (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \ |
: (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \ |
: (abort (), (void) 0)) |
/* Byte swapping macros for file header data. */ |
#define bfd_h_put_8(abfd, val, ptr) \ |
bfd_put_8 (abfd, val, ptr) |
#define bfd_h_put_signed_8(abfd, val, ptr) \ |
bfd_put_8 (abfd, val, ptr) |
#define bfd_h_get_8(abfd, ptr) \ |
bfd_get_8 (abfd, ptr) |
#define bfd_h_get_signed_8(abfd, ptr) \ |
bfd_get_signed_8 (abfd, ptr) |
#define bfd_h_put_16(abfd, val, ptr) \ |
BFD_SEND (abfd, bfd_h_putx16, (val, ptr)) |
#define bfd_h_put_signed_16 \ |
bfd_h_put_16 |
#define bfd_h_get_16(abfd, ptr) \ |
BFD_SEND (abfd, bfd_h_getx16, (ptr)) |
#define bfd_h_get_signed_16(abfd, ptr) \ |
BFD_SEND (abfd, bfd_h_getx_signed_16, (ptr)) |
#define bfd_h_put_32(abfd, val, ptr) \ |
BFD_SEND (abfd, bfd_h_putx32, (val, ptr)) |
#define bfd_h_put_signed_32 \ |
bfd_h_put_32 |
#define bfd_h_get_32(abfd, ptr) \ |
BFD_SEND (abfd, bfd_h_getx32, (ptr)) |
#define bfd_h_get_signed_32(abfd, ptr) \ |
BFD_SEND (abfd, bfd_h_getx_signed_32, (ptr)) |
#define bfd_h_put_64(abfd, val, ptr) \ |
BFD_SEND (abfd, bfd_h_putx64, (val, ptr)) |
#define bfd_h_put_signed_64 \ |
bfd_h_put_64 |
#define bfd_h_get_64(abfd, ptr) \ |
BFD_SEND (abfd, bfd_h_getx64, (ptr)) |
#define bfd_h_get_signed_64(abfd, ptr) \ |
BFD_SEND (abfd, bfd_h_getx_signed_64, (ptr)) |
/* Aliases for the above, which should eventually go away. */ |
#define H_PUT_64 bfd_h_put_64 |
#define H_PUT_32 bfd_h_put_32 |
#define H_PUT_16 bfd_h_put_16 |
#define H_PUT_8 bfd_h_put_8 |
#define H_PUT_S64 bfd_h_put_signed_64 |
#define H_PUT_S32 bfd_h_put_signed_32 |
#define H_PUT_S16 bfd_h_put_signed_16 |
#define H_PUT_S8 bfd_h_put_signed_8 |
#define H_GET_64 bfd_h_get_64 |
#define H_GET_32 bfd_h_get_32 |
#define H_GET_16 bfd_h_get_16 |
#define H_GET_8 bfd_h_get_8 |
#define H_GET_S64 bfd_h_get_signed_64 |
#define H_GET_S32 bfd_h_get_signed_32 |
#define H_GET_S16 bfd_h_get_signed_16 |
#define H_GET_S8 bfd_h_get_signed_8 |
/* Extracted from bfdio.c. */ |
long bfd_get_mtime (bfd *abfd); |
file_ptr bfd_get_size (bfd *abfd); |
void *bfd_mmap (bfd *abfd, void *addr, bfd_size_type len, |
int prot, int flags, file_ptr offset, |
void **map_addr, bfd_size_type *map_len); |
/* Extracted from bfdwin.c. */ |
/* Extracted from section.c. */ |
typedef struct bfd_section |
{ |
/* The name of the section; the name isn't a copy, the pointer is |
the same as that passed to bfd_make_section. */ |
const char *name; |
/* A unique sequence number. */ |
unsigned int id; |
/* Which section in the bfd; 0..n-1 as sections are created in a bfd. */ |
unsigned int index; |
/* The next section in the list belonging to the BFD, or NULL. */ |
struct bfd_section *next; |
/* The previous section in the list belonging to the BFD, or NULL. */ |
struct bfd_section *prev; |
/* The field flags contains attributes of the section. Some |
flags are read in from the object file, and some are |
synthesized from other information. */ |
flagword flags; |
#define SEC_NO_FLAGS 0x000 |
/* Tells the OS to allocate space for this section when loading. |
This is clear for a section containing debug information only. */ |
#define SEC_ALLOC 0x001 |
/* Tells the OS to load the section from the file when loading. |
This is clear for a .bss section. */ |
#define SEC_LOAD 0x002 |
/* The section contains data still to be relocated, so there is |
some relocation information too. */ |
#define SEC_RELOC 0x004 |
/* A signal to the OS that the section contains read only data. */ |
#define SEC_READONLY 0x008 |
/* The section contains code only. */ |
#define SEC_CODE 0x010 |
/* The section contains data only. */ |
#define SEC_DATA 0x020 |
/* The section will reside in ROM. */ |
#define SEC_ROM 0x040 |
/* The section contains constructor information. This section |
type is used by the linker to create lists of constructors and |
destructors used by <<g++>>. When a back end sees a symbol |
which should be used in a constructor list, it creates a new |
section for the type of name (e.g., <<__CTOR_LIST__>>), attaches |
the symbol to it, and builds a relocation. To build the lists |
of constructors, all the linker has to do is catenate all the |
sections called <<__CTOR_LIST__>> and relocate the data |
contained within - exactly the operations it would peform on |
standard data. */ |
#define SEC_CONSTRUCTOR 0x080 |
/* The section has contents - a data section could be |
<<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be |
<<SEC_HAS_CONTENTS>> */ |
#define SEC_HAS_CONTENTS 0x100 |
/* An instruction to the linker to not output the section |
even if it has information which would normally be written. */ |
#define SEC_NEVER_LOAD 0x200 |
/* The section contains thread local data. */ |
#define SEC_THREAD_LOCAL 0x400 |
/* The section has GOT references. This flag is only for the |
linker, and is currently only used by the elf32-hppa back end. |
It will be set if global offset table references were detected |
in this section, which indicate to the linker that the section |
contains PIC code, and must be handled specially when doing a |
static link. */ |
#define SEC_HAS_GOT_REF 0x800 |
/* The section contains common symbols (symbols may be defined |
multiple times, the value of a symbol is the amount of |
space it requires, and the largest symbol value is the one |
used). Most targets have exactly one of these (which we |
translate to bfd_com_section_ptr), but ECOFF has two. */ |
#define SEC_IS_COMMON 0x1000 |
/* The section contains only debugging information. For |
example, this is set for ELF .debug and .stab sections. |
strip tests this flag to see if a section can be |
discarded. */ |
#define SEC_DEBUGGING 0x2000 |
/* The contents of this section are held in memory pointed to |
by the contents field. This is checked by bfd_get_section_contents, |
and the data is retrieved from memory if appropriate. */ |
#define SEC_IN_MEMORY 0x4000 |
/* The contents of this section are to be excluded by the |
linker for executable and shared objects unless those |
objects are to be further relocated. */ |
#define SEC_EXCLUDE 0x8000 |
/* The contents of this section are to be sorted based on the sum of |
the symbol and addend values specified by the associated relocation |
entries. Entries without associated relocation entries will be |
appended to the end of the section in an unspecified order. */ |
#define SEC_SORT_ENTRIES 0x10000 |
/* When linking, duplicate sections of the same name should be |
discarded, rather than being combined into a single section as |
is usually done. This is similar to how common symbols are |
handled. See SEC_LINK_DUPLICATES below. */ |
#define SEC_LINK_ONCE 0x20000 |
/* If SEC_LINK_ONCE is set, this bitfield describes how the linker |
should handle duplicate sections. */ |
#define SEC_LINK_DUPLICATES 0xc0000 |
/* This value for SEC_LINK_DUPLICATES means that duplicate |
sections with the same name should simply be discarded. */ |
#define SEC_LINK_DUPLICATES_DISCARD 0x0 |
/* This value for SEC_LINK_DUPLICATES means that the linker |
should warn if there are any duplicate sections, although |
it should still only link one copy. */ |
#define SEC_LINK_DUPLICATES_ONE_ONLY 0x40000 |
/* This value for SEC_LINK_DUPLICATES means that the linker |
should warn if any duplicate sections are a different size. */ |
#define SEC_LINK_DUPLICATES_SAME_SIZE 0x80000 |
/* This value for SEC_LINK_DUPLICATES means that the linker |
should warn if any duplicate sections contain different |
contents. */ |
#define SEC_LINK_DUPLICATES_SAME_CONTENTS \ |
(SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE) |
/* This section was created by the linker as part of dynamic |
relocation or other arcane processing. It is skipped when |
going through the first-pass output, trusting that someone |
else up the line will take care of it later. */ |
#define SEC_LINKER_CREATED 0x100000 |
/* This section should not be subject to garbage collection. |
Also set to inform the linker that this section should not be |
listed in the link map as discarded. */ |
#define SEC_KEEP 0x200000 |
/* This section contains "short" data, and should be placed |
"near" the GP. */ |
#define SEC_SMALL_DATA 0x400000 |
/* Attempt to merge identical entities in the section. |
Entity size is given in the entsize field. */ |
#define SEC_MERGE 0x800000 |
/* If given with SEC_MERGE, entities to merge are zero terminated |
strings where entsize specifies character size instead of fixed |
size entries. */ |
#define SEC_STRINGS 0x1000000 |
/* This section contains data about section groups. */ |
#define SEC_GROUP 0x2000000 |
/* The section is a COFF shared library section. This flag is |
only for the linker. If this type of section appears in |
the input file, the linker must copy it to the output file |
without changing the vma or size. FIXME: Although this |
was originally intended to be general, it really is COFF |
specific (and the flag was renamed to indicate this). It |
might be cleaner to have some more general mechanism to |
allow the back end to control what the linker does with |
sections. */ |
#define SEC_COFF_SHARED_LIBRARY 0x4000000 |
/* This input section should be copied to output in reverse order |
as an array of pointers. This is for ELF linker internal use |
only. */ |
#define SEC_ELF_REVERSE_COPY 0x4000000 |
/* This section contains data which may be shared with other |
executables or shared objects. This is for COFF only. */ |
#define SEC_COFF_SHARED 0x8000000 |
/* This section should be compressed. This is for ELF linker |
internal use only. */ |
#define SEC_ELF_COMPRESS 0x8000000 |
/* When a section with this flag is being linked, then if the size of |
the input section is less than a page, it should not cross a page |
boundary. If the size of the input section is one page or more, |
it should be aligned on a page boundary. This is for TI |
TMS320C54X only. */ |
#define SEC_TIC54X_BLOCK 0x10000000 |
/* This section should be renamed. This is for ELF linker |
internal use only. */ |
#define SEC_ELF_RENAME 0x10000000 |
/* Conditionally link this section; do not link if there are no |
references found to any symbol in the section. This is for TI |
TMS320C54X only. */ |
#define SEC_TIC54X_CLINK 0x20000000 |
/* This section contains vliw code. This is for Toshiba MeP only. */ |
#define SEC_MEP_VLIW 0x20000000 |
/* Indicate that section has the no read flag set. This happens |
when memory read flag isn't set. */ |
#define SEC_COFF_NOREAD 0x40000000 |
/* End of section flags. */ |
/* Some internal packed boolean fields. */ |
/* See the vma field. */ |
unsigned int user_set_vma : 1; |
/* A mark flag used by some of the linker backends. */ |
unsigned int linker_mark : 1; |
/* Another mark flag used by some of the linker backends. Set for |
output sections that have an input section. */ |
unsigned int linker_has_input : 1; |
/* Mark flag used by some linker backends for garbage collection. */ |
unsigned int gc_mark : 1; |
/* Section compression status. */ |
unsigned int compress_status : 2; |
#define COMPRESS_SECTION_NONE 0 |
#define COMPRESS_SECTION_DONE 1 |
#define DECOMPRESS_SECTION_SIZED 2 |
/* The following flags are used by the ELF linker. */ |
/* Mark sections which have been allocated to segments. */ |
unsigned int segment_mark : 1; |
/* Type of sec_info information. */ |
unsigned int sec_info_type:3; |
#define SEC_INFO_TYPE_NONE 0 |
#define SEC_INFO_TYPE_STABS 1 |
#define SEC_INFO_TYPE_MERGE 2 |
#define SEC_INFO_TYPE_EH_FRAME 3 |
#define SEC_INFO_TYPE_JUST_SYMS 4 |
#define SEC_INFO_TYPE_TARGET 5 |
#define SEC_INFO_TYPE_EH_FRAME_ENTRY 6 |
/* Nonzero if this section uses RELA relocations, rather than REL. */ |
unsigned int use_rela_p:1; |
/* Bits used by various backends. The generic code doesn't touch |
these fields. */ |
unsigned int sec_flg0:1; |
unsigned int sec_flg1:1; |
unsigned int sec_flg2:1; |
unsigned int sec_flg3:1; |
unsigned int sec_flg4:1; |
unsigned int sec_flg5:1; |
/* End of internal packed boolean fields. */ |
/* The virtual memory address of the section - where it will be |
at run time. The symbols are relocated against this. The |
user_set_vma flag is maintained by bfd; if it's not set, the |
backend can assign addresses (for example, in <<a.out>>, where |
the default address for <<.data>> is dependent on the specific |
target and various flags). */ |
bfd_vma vma; |
/* The load address of the section - where it would be in a |
rom image; really only used for writing section header |
information. */ |
bfd_vma lma; |
/* The size of the section in octets, as it will be output. |
Contains a value even if the section has no contents (e.g., the |
size of <<.bss>>). */ |
bfd_size_type size; |
/* For input sections, the original size on disk of the section, in |
octets. This field should be set for any section whose size is |
changed by linker relaxation. It is required for sections where |
the linker relaxation scheme doesn't cache altered section and |
reloc contents (stabs, eh_frame, SEC_MERGE, some coff relaxing |
targets), and thus the original size needs to be kept to read the |
section multiple times. For output sections, rawsize holds the |
section size calculated on a previous linker relaxation pass. */ |
bfd_size_type rawsize; |
/* The compressed size of the section in octets. */ |
bfd_size_type compressed_size; |
/* Relaxation table. */ |
struct relax_table *relax; |
/* Count of used relaxation table entries. */ |
int relax_count; |
/* If this section is going to be output, then this value is the |
offset in *bytes* into the output section of the first byte in the |
input section (byte ==> smallest addressable unit on the |
target). In most cases, if this was going to start at the |
100th octet (8-bit quantity) in the output section, this value |
would be 100. However, if the target byte size is 16 bits |
(bfd_octets_per_byte is "2"), this value would be 50. */ |
bfd_vma output_offset; |
/* The output section through which to map on output. */ |
struct bfd_section *output_section; |
/* The alignment requirement of the section, as an exponent of 2 - |
e.g., 3 aligns to 2^3 (or 8). */ |
unsigned int alignment_power; |
/* If an input section, a pointer to a vector of relocation |
records for the data in this section. */ |
struct reloc_cache_entry *relocation; |
/* If an output section, a pointer to a vector of pointers to |
relocation records for the data in this section. */ |
struct reloc_cache_entry **orelocation; |
/* The number of relocation records in one of the above. */ |
unsigned reloc_count; |
/* Information below is back end specific - and not always used |
or updated. */ |
/* File position of section data. */ |
file_ptr filepos; |
/* File position of relocation info. */ |
file_ptr rel_filepos; |
/* File position of line data. */ |
file_ptr line_filepos; |
/* Pointer to data for applications. */ |
void *userdata; |
/* If the SEC_IN_MEMORY flag is set, this points to the actual |
contents. */ |
unsigned char *contents; |
/* Attached line number information. */ |
alent *lineno; |
/* Number of line number records. */ |
unsigned int lineno_count; |
/* Entity size for merging purposes. */ |
unsigned int entsize; |
/* Points to the kept section if this section is a link-once section, |
and is discarded. */ |
struct bfd_section *kept_section; |
/* When a section is being output, this value changes as more |
linenumbers are written out. */ |
file_ptr moving_line_filepos; |
/* What the section number is in the target world. */ |
int target_index; |
void *used_by_bfd; |
/* If this is a constructor section then here is a list of the |
relocations created to relocate items within it. */ |
struct relent_chain *constructor_chain; |
/* The BFD which owns the section. */ |
bfd *owner; |
/* A symbol which points at this section only. */ |
struct bfd_symbol *symbol; |
struct bfd_symbol **symbol_ptr_ptr; |
/* Early in the link process, map_head and map_tail are used to build |
a list of input sections attached to an output section. Later, |
output sections use these fields for a list of bfd_link_order |
structs. */ |
union { |
struct bfd_link_order *link_order; |
struct bfd_section *s; |
} map_head, map_tail; |
} asection; |
/* Relax table contains information about instructions which can |
be removed by relaxation -- replacing a long address with a |
short address. */ |
struct relax_table { |
/* Address where bytes may be deleted. */ |
bfd_vma addr; |
/* Number of bytes to be deleted. */ |
int size; |
}; |
/* Note: the following are provided as inline functions rather than macros |
because not all callers use the return value. A macro implementation |
would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some |
compilers will complain about comma expressions that have no effect. */ |
static inline bfd_boolean |
bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val) |
{ |
ptr->userdata = val; |
return TRUE; |
} |
static inline bfd_boolean |
bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) |
{ |
ptr->vma = ptr->lma = val; |
ptr->user_set_vma = TRUE; |
return TRUE; |
} |
static inline bfd_boolean |
bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val) |
{ |
ptr->alignment_power = val; |
return TRUE; |
} |
/* These sections are global, and are managed by BFD. The application |
and target back end are not permitted to change the values in |
these sections. */ |
extern asection _bfd_std_section[4]; |
#define BFD_ABS_SECTION_NAME "*ABS*" |
#define BFD_UND_SECTION_NAME "*UND*" |
#define BFD_COM_SECTION_NAME "*COM*" |
#define BFD_IND_SECTION_NAME "*IND*" |
/* Pointer to the common section. */ |
#define bfd_com_section_ptr (&_bfd_std_section[0]) |
/* Pointer to the undefined section. */ |
#define bfd_und_section_ptr (&_bfd_std_section[1]) |
/* Pointer to the absolute section. */ |
#define bfd_abs_section_ptr (&_bfd_std_section[2]) |
/* Pointer to the indirect section. */ |
#define bfd_ind_section_ptr (&_bfd_std_section[3]) |
#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr) |
#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr) |
#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr) |
#define bfd_is_const_section(SEC) \ |
( ((SEC) == bfd_abs_section_ptr) \ |
|| ((SEC) == bfd_und_section_ptr) \ |
|| ((SEC) == bfd_com_section_ptr) \ |
|| ((SEC) == bfd_ind_section_ptr)) |
/* Macros to handle insertion and deletion of a bfd's sections. These |
only handle the list pointers, ie. do not adjust section_count, |
target_index etc. */ |
#define bfd_section_list_remove(ABFD, S) \ |
do \ |
{ \ |
asection *_s = S; \ |
asection *_next = _s->next; \ |
asection *_prev = _s->prev; \ |
if (_prev) \ |
_prev->next = _next; \ |
else \ |
(ABFD)->sections = _next; \ |
if (_next) \ |
_next->prev = _prev; \ |
else \ |
(ABFD)->section_last = _prev; \ |
} \ |
while (0) |
#define bfd_section_list_append(ABFD, S) \ |
do \ |
{ \ |
asection *_s = S; \ |
bfd *_abfd = ABFD; \ |
_s->next = NULL; \ |
if (_abfd->section_last) \ |
{ \ |
_s->prev = _abfd->section_last; \ |
_abfd->section_last->next = _s; \ |
} \ |
else \ |
{ \ |
_s->prev = NULL; \ |
_abfd->sections = _s; \ |
} \ |
_abfd->section_last = _s; \ |
} \ |
while (0) |
#define bfd_section_list_prepend(ABFD, S) \ |
do \ |
{ \ |
asection *_s = S; \ |
bfd *_abfd = ABFD; \ |
_s->prev = NULL; \ |
if (_abfd->sections) \ |
{ \ |
_s->next = _abfd->sections; \ |
_abfd->sections->prev = _s; \ |
} \ |
else \ |
{ \ |
_s->next = NULL; \ |
_abfd->section_last = _s; \ |
} \ |
_abfd->sections = _s; \ |
} \ |
while (0) |
#define bfd_section_list_insert_after(ABFD, A, S) \ |
do \ |
{ \ |
asection *_a = A; \ |
asection *_s = S; \ |
asection *_next = _a->next; \ |
_s->next = _next; \ |
_s->prev = _a; \ |
_a->next = _s; \ |
if (_next) \ |
_next->prev = _s; \ |
else \ |
(ABFD)->section_last = _s; \ |
} \ |
while (0) |
#define bfd_section_list_insert_before(ABFD, B, S) \ |
do \ |
{ \ |
asection *_b = B; \ |
asection *_s = S; \ |
asection *_prev = _b->prev; \ |
_s->prev = _prev; \ |
_s->next = _b; \ |
_b->prev = _s; \ |
if (_prev) \ |
_prev->next = _s; \ |
else \ |
(ABFD)->sections = _s; \ |
} \ |
while (0) |
#define bfd_section_removed_from_list(ABFD, S) \ |
((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S)) |
#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \ |
/* name, id, index, next, prev, flags, user_set_vma, */ \ |
{ NAME, IDX, 0, NULL, NULL, FLAGS, 0, \ |
\ |
/* linker_mark, linker_has_input, gc_mark, decompress_status, */ \ |
0, 0, 1, 0, \ |
\ |
/* segment_mark, sec_info_type, use_rela_p, */ \ |
0, 0, 0, \ |
\ |
/* sec_flg0, sec_flg1, sec_flg2, sec_flg3, sec_flg4, sec_flg5, */ \ |
0, 0, 0, 0, 0, 0, \ |
\ |
/* vma, lma, size, rawsize, compressed_size, relax, relax_count, */ \ |
0, 0, 0, 0, 0, 0, 0, \ |
\ |
/* output_offset, output_section, alignment_power, */ \ |
0, &SEC, 0, \ |
\ |
/* relocation, orelocation, reloc_count, filepos, rel_filepos, */ \ |
NULL, NULL, 0, 0, 0, \ |
\ |
/* line_filepos, userdata, contents, lineno, lineno_count, */ \ |
0, NULL, NULL, NULL, 0, \ |
\ |
/* entsize, kept_section, moving_line_filepos, */ \ |
0, NULL, 0, \ |
\ |
/* target_index, used_by_bfd, constructor_chain, owner, */ \ |
0, NULL, NULL, NULL, \ |
\ |
/* symbol, symbol_ptr_ptr, */ \ |
(struct bfd_symbol *) SYM, &SEC.symbol, \ |
\ |
/* map_head, map_tail */ \ |
{ NULL }, { NULL } \ |
} |
void bfd_section_list_clear (bfd *); |
asection *bfd_get_section_by_name (bfd *abfd, const char *name); |
asection *bfd_get_next_section_by_name (bfd *ibfd, asection *sec); |
asection *bfd_get_linker_section (bfd *abfd, const char *name); |
asection *bfd_get_section_by_name_if |
(bfd *abfd, |
const char *name, |
bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj), |
void *obj); |
char *bfd_get_unique_section_name |
(bfd *abfd, const char *templat, int *count); |
asection *bfd_make_section_old_way (bfd *abfd, const char *name); |
asection *bfd_make_section_anyway_with_flags |
(bfd *abfd, const char *name, flagword flags); |
asection *bfd_make_section_anyway (bfd *abfd, const char *name); |
asection *bfd_make_section_with_flags |
(bfd *, const char *name, flagword flags); |
asection *bfd_make_section (bfd *, const char *name); |
int bfd_get_next_section_id (void); |
bfd_boolean bfd_set_section_flags |
(bfd *abfd, asection *sec, flagword flags); |
void bfd_rename_section |
(bfd *abfd, asection *sec, const char *newname); |
void bfd_map_over_sections |
(bfd *abfd, |
void (*func) (bfd *abfd, asection *sect, void *obj), |
void *obj); |
asection *bfd_sections_find_if |
(bfd *abfd, |
bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj), |
void *obj); |
bfd_boolean bfd_set_section_size |
(bfd *abfd, asection *sec, bfd_size_type val); |
bfd_boolean bfd_set_section_contents |
(bfd *abfd, asection *section, const void *data, |
file_ptr offset, bfd_size_type count); |
bfd_boolean bfd_get_section_contents |
(bfd *abfd, asection *section, void *location, file_ptr offset, |
bfd_size_type count); |
bfd_boolean bfd_malloc_and_get_section |
(bfd *abfd, asection *section, bfd_byte **buf); |
bfd_boolean bfd_copy_private_section_data |
(bfd *ibfd, asection *isec, bfd *obfd, asection *osec); |
#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \ |
BFD_SEND (obfd, _bfd_copy_private_section_data, \ |
(ibfd, isection, obfd, osection)) |
bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec); |
bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group); |
/* Extracted from archures.c. */ |
enum bfd_architecture |
{ |
bfd_arch_unknown, /* File arch not known. */ |
bfd_arch_obscure, /* Arch known, not one of these. */ |
bfd_arch_m68k, /* Motorola 68xxx */ |
#define bfd_mach_m68000 1 |
#define bfd_mach_m68008 2 |
#define bfd_mach_m68010 3 |
#define bfd_mach_m68020 4 |
#define bfd_mach_m68030 5 |
#define bfd_mach_m68040 6 |
#define bfd_mach_m68060 7 |
#define bfd_mach_cpu32 8 |
#define bfd_mach_fido 9 |
#define bfd_mach_mcf_isa_a_nodiv 10 |
#define bfd_mach_mcf_isa_a 11 |
#define bfd_mach_mcf_isa_a_mac 12 |
#define bfd_mach_mcf_isa_a_emac 13 |
#define bfd_mach_mcf_isa_aplus 14 |
#define bfd_mach_mcf_isa_aplus_mac 15 |
#define bfd_mach_mcf_isa_aplus_emac 16 |
#define bfd_mach_mcf_isa_b_nousp 17 |
#define bfd_mach_mcf_isa_b_nousp_mac 18 |
#define bfd_mach_mcf_isa_b_nousp_emac 19 |
#define bfd_mach_mcf_isa_b 20 |
#define bfd_mach_mcf_isa_b_mac 21 |
#define bfd_mach_mcf_isa_b_emac 22 |
#define bfd_mach_mcf_isa_b_float 23 |
#define bfd_mach_mcf_isa_b_float_mac 24 |
#define bfd_mach_mcf_isa_b_float_emac 25 |
#define bfd_mach_mcf_isa_c 26 |
#define bfd_mach_mcf_isa_c_mac 27 |
#define bfd_mach_mcf_isa_c_emac 28 |
#define bfd_mach_mcf_isa_c_nodiv 29 |
#define bfd_mach_mcf_isa_c_nodiv_mac 30 |
#define bfd_mach_mcf_isa_c_nodiv_emac 31 |
bfd_arch_vax, /* DEC Vax */ |
bfd_arch_i960, /* Intel 960 */ |
/* The order of the following is important. |
lower number indicates a machine type that |
only accepts a subset of the instructions |
available to machines with higher numbers. |
The exception is the "ca", which is |
incompatible with all other machines except |
"core". */ |
#define bfd_mach_i960_core 1 |
#define bfd_mach_i960_ka_sa 2 |
#define bfd_mach_i960_kb_sb 3 |
#define bfd_mach_i960_mc 4 |
#define bfd_mach_i960_xa 5 |
#define bfd_mach_i960_ca 6 |
#define bfd_mach_i960_jx 7 |
#define bfd_mach_i960_hx 8 |
bfd_arch_or1k, /* OpenRISC 1000 */ |
#define bfd_mach_or1k 1 |
#define bfd_mach_or1knd 2 |
bfd_arch_sparc, /* SPARC */ |
#define bfd_mach_sparc 1 |
/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */ |
#define bfd_mach_sparc_sparclet 2 |
#define bfd_mach_sparc_sparclite 3 |
#define bfd_mach_sparc_v8plus 4 |
#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */ |
#define bfd_mach_sparc_sparclite_le 6 |
#define bfd_mach_sparc_v9 7 |
#define bfd_mach_sparc_v9a 8 /* with ultrasparc add'ns. */ |
#define bfd_mach_sparc_v8plusb 9 /* with cheetah add'ns. */ |
#define bfd_mach_sparc_v9b 10 /* with cheetah add'ns. */ |
/* Nonzero if MACH has the v9 instruction set. */ |
#define bfd_mach_sparc_v9_p(mach) \ |
((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9b \ |
&& (mach) != bfd_mach_sparc_sparclite_le) |
/* Nonzero if MACH is a 64 bit sparc architecture. */ |
#define bfd_mach_sparc_64bit_p(mach) \ |
((mach) >= bfd_mach_sparc_v9 && (mach) != bfd_mach_sparc_v8plusb) |
bfd_arch_spu, /* PowerPC SPU */ |
#define bfd_mach_spu 256 |
bfd_arch_mips, /* MIPS Rxxxx */ |
#define bfd_mach_mips3000 3000 |
#define bfd_mach_mips3900 3900 |
#define bfd_mach_mips4000 4000 |
#define bfd_mach_mips4010 4010 |
#define bfd_mach_mips4100 4100 |
#define bfd_mach_mips4111 4111 |
#define bfd_mach_mips4120 4120 |
#define bfd_mach_mips4300 4300 |
#define bfd_mach_mips4400 4400 |
#define bfd_mach_mips4600 4600 |
#define bfd_mach_mips4650 4650 |
#define bfd_mach_mips5000 5000 |
#define bfd_mach_mips5400 5400 |
#define bfd_mach_mips5500 5500 |
#define bfd_mach_mips5900 5900 |
#define bfd_mach_mips6000 6000 |
#define bfd_mach_mips7000 7000 |
#define bfd_mach_mips8000 8000 |
#define bfd_mach_mips9000 9000 |
#define bfd_mach_mips10000 10000 |
#define bfd_mach_mips12000 12000 |
#define bfd_mach_mips14000 14000 |
#define bfd_mach_mips16000 16000 |
#define bfd_mach_mips16 16 |
#define bfd_mach_mips5 5 |
#define bfd_mach_mips_loongson_2e 3001 |
#define bfd_mach_mips_loongson_2f 3002 |
#define bfd_mach_mips_loongson_3a 3003 |
#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */ |
#define bfd_mach_mips_octeon 6501 |
#define bfd_mach_mips_octeonp 6601 |
#define bfd_mach_mips_octeon2 6502 |
#define bfd_mach_mips_octeon3 6503 |
#define bfd_mach_mips_xlr 887682 /* decimal 'XLR' */ |
#define bfd_mach_mipsisa32 32 |
#define bfd_mach_mipsisa32r2 33 |
#define bfd_mach_mipsisa32r3 34 |
#define bfd_mach_mipsisa32r5 36 |
#define bfd_mach_mipsisa32r6 37 |
#define bfd_mach_mipsisa64 64 |
#define bfd_mach_mipsisa64r2 65 |
#define bfd_mach_mipsisa64r3 66 |
#define bfd_mach_mipsisa64r5 68 |
#define bfd_mach_mipsisa64r6 69 |
#define bfd_mach_mips_micromips 96 |
bfd_arch_i386, /* Intel 386 */ |
#define bfd_mach_i386_intel_syntax (1 << 0) |
#define bfd_mach_i386_i8086 (1 << 1) |
#define bfd_mach_i386_i386 (1 << 2) |
#define bfd_mach_x86_64 (1 << 3) |
#define bfd_mach_x64_32 (1 << 4) |
#define bfd_mach_i386_i386_intel_syntax (bfd_mach_i386_i386 | bfd_mach_i386_intel_syntax) |
#define bfd_mach_x86_64_intel_syntax (bfd_mach_x86_64 | bfd_mach_i386_intel_syntax) |
#define bfd_mach_x64_32_intel_syntax (bfd_mach_x64_32 | bfd_mach_i386_intel_syntax) |
bfd_arch_l1om, /* Intel L1OM */ |
#define bfd_mach_l1om (1 << 5) |
#define bfd_mach_l1om_intel_syntax (bfd_mach_l1om | bfd_mach_i386_intel_syntax) |
bfd_arch_k1om, /* Intel K1OM */ |
#define bfd_mach_k1om (1 << 6) |
#define bfd_mach_k1om_intel_syntax (bfd_mach_k1om | bfd_mach_i386_intel_syntax) |
#define bfd_mach_i386_nacl (1 << 7) |
#define bfd_mach_i386_i386_nacl (bfd_mach_i386_i386 | bfd_mach_i386_nacl) |
#define bfd_mach_x86_64_nacl (bfd_mach_x86_64 | bfd_mach_i386_nacl) |
#define bfd_mach_x64_32_nacl (bfd_mach_x64_32 | bfd_mach_i386_nacl) |
bfd_arch_iamcu, /* Intel MCU */ |
#define bfd_mach_iamcu (1 << 8) |
#define bfd_mach_i386_iamcu (bfd_mach_i386_i386 | bfd_mach_iamcu) |
#define bfd_mach_i386_iamcu_intel_syntax (bfd_mach_i386_iamcu | bfd_mach_i386_intel_syntax) |
bfd_arch_we32k, /* AT&T WE32xxx */ |
bfd_arch_tahoe, /* CCI/Harris Tahoe */ |
bfd_arch_i860, /* Intel 860 */ |
bfd_arch_i370, /* IBM 360/370 Mainframes */ |
bfd_arch_romp, /* IBM ROMP PC/RT */ |
bfd_arch_convex, /* Convex */ |
bfd_arch_m88k, /* Motorola 88xxx */ |
bfd_arch_m98k, /* Motorola 98xxx */ |
bfd_arch_pyramid, /* Pyramid Technology */ |
bfd_arch_h8300, /* Renesas H8/300 (formerly Hitachi H8/300) */ |
#define bfd_mach_h8300 1 |
#define bfd_mach_h8300h 2 |
#define bfd_mach_h8300s 3 |
#define bfd_mach_h8300hn 4 |
#define bfd_mach_h8300sn 5 |
#define bfd_mach_h8300sx 6 |
#define bfd_mach_h8300sxn 7 |
bfd_arch_pdp11, /* DEC PDP-11 */ |
bfd_arch_plugin, |
bfd_arch_powerpc, /* PowerPC */ |
#define bfd_mach_ppc 32 |
#define bfd_mach_ppc64 64 |
#define bfd_mach_ppc_403 403 |
#define bfd_mach_ppc_403gc 4030 |
#define bfd_mach_ppc_405 405 |
#define bfd_mach_ppc_505 505 |
#define bfd_mach_ppc_601 601 |
#define bfd_mach_ppc_602 602 |
#define bfd_mach_ppc_603 603 |
#define bfd_mach_ppc_ec603e 6031 |
#define bfd_mach_ppc_604 604 |
#define bfd_mach_ppc_620 620 |
#define bfd_mach_ppc_630 630 |
#define bfd_mach_ppc_750 750 |
#define bfd_mach_ppc_860 860 |
#define bfd_mach_ppc_a35 35 |
#define bfd_mach_ppc_rs64ii 642 |
#define bfd_mach_ppc_rs64iii 643 |
#define bfd_mach_ppc_7400 7400 |
#define bfd_mach_ppc_e500 500 |
#define bfd_mach_ppc_e500mc 5001 |
#define bfd_mach_ppc_e500mc64 5005 |
#define bfd_mach_ppc_e5500 5006 |
#define bfd_mach_ppc_e6500 5007 |
#define bfd_mach_ppc_titan 83 |
#define bfd_mach_ppc_vle 84 |
bfd_arch_rs6000, /* IBM RS/6000 */ |
#define bfd_mach_rs6k 6000 |
#define bfd_mach_rs6k_rs1 6001 |
#define bfd_mach_rs6k_rsc 6003 |
#define bfd_mach_rs6k_rs2 6002 |
bfd_arch_hppa, /* HP PA RISC */ |
#define bfd_mach_hppa10 10 |
#define bfd_mach_hppa11 11 |
#define bfd_mach_hppa20 20 |
#define bfd_mach_hppa20w 25 |
bfd_arch_d10v, /* Mitsubishi D10V */ |
#define bfd_mach_d10v 1 |
#define bfd_mach_d10v_ts2 2 |
#define bfd_mach_d10v_ts3 3 |
bfd_arch_d30v, /* Mitsubishi D30V */ |
bfd_arch_dlx, /* DLX */ |
bfd_arch_m68hc11, /* Motorola 68HC11 */ |
bfd_arch_m68hc12, /* Motorola 68HC12 */ |
#define bfd_mach_m6812_default 0 |
#define bfd_mach_m6812 1 |
#define bfd_mach_m6812s 2 |
bfd_arch_m9s12x, /* Freescale S12X */ |
bfd_arch_m9s12xg, /* Freescale XGATE */ |
bfd_arch_z8k, /* Zilog Z8000 */ |
#define bfd_mach_z8001 1 |
#define bfd_mach_z8002 2 |
bfd_arch_h8500, /* Renesas H8/500 (formerly Hitachi H8/500) */ |
bfd_arch_sh, /* Renesas / SuperH SH (formerly Hitachi SH) */ |
#define bfd_mach_sh 1 |
#define bfd_mach_sh2 0x20 |
#define bfd_mach_sh_dsp 0x2d |
#define bfd_mach_sh2a 0x2a |
#define bfd_mach_sh2a_nofpu 0x2b |
#define bfd_mach_sh2a_nofpu_or_sh4_nommu_nofpu 0x2a1 |
#define bfd_mach_sh2a_nofpu_or_sh3_nommu 0x2a2 |
#define bfd_mach_sh2a_or_sh4 0x2a3 |
#define bfd_mach_sh2a_or_sh3e 0x2a4 |
#define bfd_mach_sh2e 0x2e |
#define bfd_mach_sh3 0x30 |
#define bfd_mach_sh3_nommu 0x31 |
#define bfd_mach_sh3_dsp 0x3d |
#define bfd_mach_sh3e 0x3e |
#define bfd_mach_sh4 0x40 |
#define bfd_mach_sh4_nofpu 0x41 |
#define bfd_mach_sh4_nommu_nofpu 0x42 |
#define bfd_mach_sh4a 0x4a |
#define bfd_mach_sh4a_nofpu 0x4b |
#define bfd_mach_sh4al_dsp 0x4d |
#define bfd_mach_sh5 0x50 |
bfd_arch_alpha, /* Dec Alpha */ |
#define bfd_mach_alpha_ev4 0x10 |
#define bfd_mach_alpha_ev5 0x20 |
#define bfd_mach_alpha_ev6 0x30 |
bfd_arch_arm, /* Advanced Risc Machines ARM. */ |
#define bfd_mach_arm_unknown 0 |
#define bfd_mach_arm_2 1 |
#define bfd_mach_arm_2a 2 |
#define bfd_mach_arm_3 3 |
#define bfd_mach_arm_3M 4 |
#define bfd_mach_arm_4 5 |
#define bfd_mach_arm_4T 6 |
#define bfd_mach_arm_5 7 |
#define bfd_mach_arm_5T 8 |
#define bfd_mach_arm_5TE 9 |
#define bfd_mach_arm_XScale 10 |
#define bfd_mach_arm_ep9312 11 |
#define bfd_mach_arm_iWMMXt 12 |
#define bfd_mach_arm_iWMMXt2 13 |
bfd_arch_nds32, /* Andes NDS32 */ |
#define bfd_mach_n1 1 |
#define bfd_mach_n1h 2 |
#define bfd_mach_n1h_v2 3 |
#define bfd_mach_n1h_v3 4 |
#define bfd_mach_n1h_v3m 5 |
bfd_arch_ns32k, /* National Semiconductors ns32000 */ |
bfd_arch_w65, /* WDC 65816 */ |
bfd_arch_tic30, /* Texas Instruments TMS320C30 */ |
bfd_arch_tic4x, /* Texas Instruments TMS320C3X/4X */ |
#define bfd_mach_tic3x 30 |
#define bfd_mach_tic4x 40 |
bfd_arch_tic54x, /* Texas Instruments TMS320C54X */ |
bfd_arch_tic6x, /* Texas Instruments TMS320C6X */ |
bfd_arch_tic80, /* TI TMS320c80 (MVP) */ |
bfd_arch_v850, /* NEC V850 */ |
bfd_arch_v850_rh850,/* NEC V850 (using RH850 ABI) */ |
#define bfd_mach_v850 1 |
#define bfd_mach_v850e 'E' |
#define bfd_mach_v850e1 '1' |
#define bfd_mach_v850e2 0x4532 |
#define bfd_mach_v850e2v3 0x45325633 |
#define bfd_mach_v850e3v5 0x45335635 /* ('E'|'3'|'V'|'5') */ |
bfd_arch_arc, /* ARC Cores */ |
#define bfd_mach_arc_a4 0 |
#define bfd_mach_arc_a5 1 |
#define bfd_mach_arc_arc600 2 |
#define bfd_mach_arc_arc601 4 |
#define bfd_mach_arc_arc700 3 |
#define bfd_mach_arc_arcv2 5 |
bfd_arch_m32c, /* Renesas M16C/M32C. */ |
#define bfd_mach_m16c 0x75 |
#define bfd_mach_m32c 0x78 |
bfd_arch_m32r, /* Renesas M32R (formerly Mitsubishi M32R/D) */ |
#define bfd_mach_m32r 1 /* For backwards compatibility. */ |
#define bfd_mach_m32rx 'x' |
#define bfd_mach_m32r2 '2' |
bfd_arch_mn10200, /* Matsushita MN10200 */ |
bfd_arch_mn10300, /* Matsushita MN10300 */ |
#define bfd_mach_mn10300 300 |
#define bfd_mach_am33 330 |
#define bfd_mach_am33_2 332 |
bfd_arch_fr30, |
#define bfd_mach_fr30 0x46523330 |
bfd_arch_frv, |
#define bfd_mach_frv 1 |
#define bfd_mach_frvsimple 2 |
#define bfd_mach_fr300 300 |
#define bfd_mach_fr400 400 |
#define bfd_mach_fr450 450 |
#define bfd_mach_frvtomcat 499 /* fr500 prototype */ |
#define bfd_mach_fr500 500 |
#define bfd_mach_fr550 550 |
bfd_arch_moxie, /* The moxie processor */ |
#define bfd_mach_moxie 1 |
bfd_arch_ft32, /* The ft32 processor */ |
#define bfd_mach_ft32 1 |
bfd_arch_mcore, |
bfd_arch_mep, |
#define bfd_mach_mep 1 |
#define bfd_mach_mep_h1 0x6831 |
#define bfd_mach_mep_c5 0x6335 |
bfd_arch_metag, |
#define bfd_mach_metag 1 |
bfd_arch_ia64, /* HP/Intel ia64 */ |
#define bfd_mach_ia64_elf64 64 |
#define bfd_mach_ia64_elf32 32 |
bfd_arch_ip2k, /* Ubicom IP2K microcontrollers. */ |
#define bfd_mach_ip2022 1 |
#define bfd_mach_ip2022ext 2 |
bfd_arch_iq2000, /* Vitesse IQ2000. */ |
#define bfd_mach_iq2000 1 |
#define bfd_mach_iq10 2 |
bfd_arch_epiphany, /* Adapteva EPIPHANY */ |
#define bfd_mach_epiphany16 1 |
#define bfd_mach_epiphany32 2 |
bfd_arch_mt, |
#define bfd_mach_ms1 1 |
#define bfd_mach_mrisc2 2 |
#define bfd_mach_ms2 3 |
bfd_arch_pj, |
bfd_arch_avr, /* Atmel AVR microcontrollers. */ |
#define bfd_mach_avr1 1 |
#define bfd_mach_avr2 2 |
#define bfd_mach_avr25 25 |
#define bfd_mach_avr3 3 |
#define bfd_mach_avr31 31 |
#define bfd_mach_avr35 35 |
#define bfd_mach_avr4 4 |
#define bfd_mach_avr5 5 |
#define bfd_mach_avr51 51 |
#define bfd_mach_avr6 6 |
#define bfd_mach_avrtiny 100 |
#define bfd_mach_avrxmega1 101 |
#define bfd_mach_avrxmega2 102 |
#define bfd_mach_avrxmega3 103 |
#define bfd_mach_avrxmega4 104 |
#define bfd_mach_avrxmega5 105 |
#define bfd_mach_avrxmega6 106 |
#define bfd_mach_avrxmega7 107 |
bfd_arch_bfin, /* ADI Blackfin */ |
#define bfd_mach_bfin 1 |
bfd_arch_cr16, /* National Semiconductor CompactRISC (ie CR16). */ |
#define bfd_mach_cr16 1 |
bfd_arch_cr16c, /* National Semiconductor CompactRISC. */ |
#define bfd_mach_cr16c 1 |
bfd_arch_crx, /* National Semiconductor CRX. */ |
#define bfd_mach_crx 1 |
bfd_arch_cris, /* Axis CRIS */ |
#define bfd_mach_cris_v0_v10 255 |
#define bfd_mach_cris_v32 32 |
#define bfd_mach_cris_v10_v32 1032 |
bfd_arch_rl78, |
#define bfd_mach_rl78 0x75 |
bfd_arch_rx, /* Renesas RX. */ |
#define bfd_mach_rx 0x75 |
bfd_arch_s390, /* IBM s390 */ |
#define bfd_mach_s390_31 31 |
#define bfd_mach_s390_64 64 |
bfd_arch_score, /* Sunplus score */ |
#define bfd_mach_score3 3 |
#define bfd_mach_score7 7 |
bfd_arch_mmix, /* Donald Knuth's educational processor. */ |
bfd_arch_xstormy16, |
#define bfd_mach_xstormy16 1 |
bfd_arch_msp430, /* Texas Instruments MSP430 architecture. */ |
#define bfd_mach_msp11 11 |
#define bfd_mach_msp110 110 |
#define bfd_mach_msp12 12 |
#define bfd_mach_msp13 13 |
#define bfd_mach_msp14 14 |
#define bfd_mach_msp15 15 |
#define bfd_mach_msp16 16 |
#define bfd_mach_msp20 20 |
#define bfd_mach_msp21 21 |
#define bfd_mach_msp22 22 |
#define bfd_mach_msp23 23 |
#define bfd_mach_msp24 24 |
#define bfd_mach_msp26 26 |
#define bfd_mach_msp31 31 |
#define bfd_mach_msp32 32 |
#define bfd_mach_msp33 33 |
#define bfd_mach_msp41 41 |
#define bfd_mach_msp42 42 |
#define bfd_mach_msp43 43 |
#define bfd_mach_msp44 44 |
#define bfd_mach_msp430x 45 |
#define bfd_mach_msp46 46 |
#define bfd_mach_msp47 47 |
#define bfd_mach_msp54 54 |
bfd_arch_xc16x, /* Infineon's XC16X Series. */ |
#define bfd_mach_xc16x 1 |
#define bfd_mach_xc16xl 2 |
#define bfd_mach_xc16xs 3 |
bfd_arch_xgate, /* Freescale XGATE */ |
#define bfd_mach_xgate 1 |
bfd_arch_xtensa, /* Tensilica's Xtensa cores. */ |
#define bfd_mach_xtensa 1 |
bfd_arch_z80, |
#define bfd_mach_z80strict 1 /* No undocumented opcodes. */ |
#define bfd_mach_z80 3 /* With ixl, ixh, iyl, and iyh. */ |
#define bfd_mach_z80full 7 /* All undocumented instructions. */ |
#define bfd_mach_r800 11 /* R800: successor with multiplication. */ |
bfd_arch_lm32, /* Lattice Mico32 */ |
#define bfd_mach_lm32 1 |
bfd_arch_microblaze,/* Xilinx MicroBlaze. */ |
bfd_arch_tilepro, /* Tilera TILEPro */ |
bfd_arch_tilegx, /* Tilera TILE-Gx */ |
#define bfd_mach_tilepro 1 |
#define bfd_mach_tilegx 1 |
#define bfd_mach_tilegx32 2 |
bfd_arch_aarch64, /* AArch64 */ |
#define bfd_mach_aarch64 0 |
#define bfd_mach_aarch64_ilp32 32 |
bfd_arch_nios2, /* Nios II */ |
#define bfd_mach_nios2 0 |
#define bfd_mach_nios2r1 1 |
#define bfd_mach_nios2r2 2 |
bfd_arch_visium, /* Visium */ |
#define bfd_mach_visium 1 |
bfd_arch_last |
}; |
typedef struct bfd_arch_info |
{ |
int bits_per_word; |
int bits_per_address; |
int bits_per_byte; |
enum bfd_architecture arch; |
unsigned long mach; |
const char *arch_name; |
const char *printable_name; |
unsigned int section_align_power; |
/* TRUE if this is the default machine for the architecture. |
The default arch should be the first entry for an arch so that |
all the entries for that arch can be accessed via <<next>>. */ |
bfd_boolean the_default; |
const struct bfd_arch_info * (*compatible) |
(const struct bfd_arch_info *a, const struct bfd_arch_info *b); |
bfd_boolean (*scan) (const struct bfd_arch_info *, const char *); |
/* Allocate via bfd_malloc and return a fill buffer of size COUNT. If |
IS_BIGENDIAN is TRUE, the order of bytes is big endian. If CODE is |
TRUE, the buffer contains code. */ |
void *(*fill) (bfd_size_type count, bfd_boolean is_bigendian, |
bfd_boolean code); |
const struct bfd_arch_info *next; |
} |
bfd_arch_info_type; |
const char *bfd_printable_name (bfd *abfd); |
const bfd_arch_info_type *bfd_scan_arch (const char *string); |
const char **bfd_arch_list (void); |
const bfd_arch_info_type *bfd_arch_get_compatible |
(const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns); |
void bfd_set_arch_info (bfd *abfd, const bfd_arch_info_type *arg); |
enum bfd_architecture bfd_get_arch (bfd *abfd); |
unsigned long bfd_get_mach (bfd *abfd); |
unsigned int bfd_arch_bits_per_byte (bfd *abfd); |
unsigned int bfd_arch_bits_per_address (bfd *abfd); |
const bfd_arch_info_type *bfd_get_arch_info (bfd *abfd); |
const bfd_arch_info_type *bfd_lookup_arch |
(enum bfd_architecture arch, unsigned long machine); |
const char *bfd_printable_arch_mach |
(enum bfd_architecture arch, unsigned long machine); |
unsigned int bfd_octets_per_byte (bfd *abfd); |
unsigned int bfd_arch_mach_octets_per_byte |
(enum bfd_architecture arch, unsigned long machine); |
/* Extracted from reloc.c. */ |
typedef enum bfd_reloc_status |
{ |
/* No errors detected. */ |
bfd_reloc_ok, |
/* The relocation was performed, but there was an overflow. */ |
bfd_reloc_overflow, |
/* The address to relocate was not within the section supplied. */ |
bfd_reloc_outofrange, |
/* Used by special functions. */ |
bfd_reloc_continue, |
/* Unsupported relocation size requested. */ |
bfd_reloc_notsupported, |
/* Unused. */ |
bfd_reloc_other, |
/* The symbol to relocate against was undefined. */ |
bfd_reloc_undefined, |
/* The relocation was performed, but may not be ok - presently |
generated only when linking i960 coff files with i960 b.out |
symbols. If this type is returned, the error_message argument |
to bfd_perform_relocation will be set. */ |
bfd_reloc_dangerous |
} |
bfd_reloc_status_type; |
typedef struct reloc_cache_entry |
{ |
/* A pointer into the canonical table of pointers. */ |
struct bfd_symbol **sym_ptr_ptr; |
/* offset in section. */ |
bfd_size_type address; |
/* addend for relocation value. */ |
bfd_vma addend; |
/* Pointer to how to perform the required relocation. */ |
reloc_howto_type *howto; |
} |
arelent; |
enum complain_overflow |
{ |
/* Do not complain on overflow. */ |
complain_overflow_dont, |
/* Complain if the value overflows when considered as a signed |
number one bit larger than the field. ie. A bitfield of N bits |
is allowed to represent -2**n to 2**n-1. */ |
complain_overflow_bitfield, |
/* Complain if the value overflows when considered as a signed |
number. */ |
complain_overflow_signed, |
/* Complain if the value overflows when considered as an |
unsigned number. */ |
complain_overflow_unsigned |
}; |
struct bfd_symbol; /* Forward declaration. */ |
struct reloc_howto_struct |
{ |
/* The type field has mainly a documentary use - the back end can |
do what it wants with it, though normally the back end's |
external idea of what a reloc number is stored |
in this field. For example, a PC relative word relocation |
in a coff environment has the type 023 - because that's |
what the outside world calls a R_PCRWORD reloc. */ |
unsigned int type; |
/* The value the final relocation is shifted right by. This drops |
unwanted data from the relocation. */ |
unsigned int rightshift; |
/* The size of the item to be relocated. This is *not* a |
power-of-two measure. To get the number of bytes operated |
on by a type of relocation, use bfd_get_reloc_size. */ |
int size; |
/* The number of bits in the item to be relocated. This is used |
when doing overflow checking. */ |
unsigned int bitsize; |
/* The relocation is relative to the field being relocated. */ |
bfd_boolean pc_relative; |
/* The bit position of the reloc value in the destination. |
The relocated value is left shifted by this amount. */ |
unsigned int bitpos; |
/* What type of overflow error should be checked for when |
relocating. */ |
enum complain_overflow complain_on_overflow; |
/* If this field is non null, then the supplied function is |
called rather than the normal function. This allows really |
strange relocation methods to be accommodated (e.g., i960 callj |
instructions). */ |
bfd_reloc_status_type (*special_function) |
(bfd *, arelent *, struct bfd_symbol *, void *, asection *, |
bfd *, char **); |
/* The textual name of the relocation type. */ |
char *name; |
/* Some formats record a relocation addend in the section contents |
rather than with the relocation. For ELF formats this is the |
distinction between USE_REL and USE_RELA (though the code checks |
for USE_REL == 1/0). The value of this field is TRUE if the |
addend is recorded with the section contents; when performing a |
partial link (ld -r) the section contents (the data) will be |
modified. The value of this field is FALSE if addends are |
recorded with the relocation (in arelent.addend); when performing |
a partial link the relocation will be modified. |
All relocations for all ELF USE_RELA targets should set this field |
to FALSE (values of TRUE should be looked on with suspicion). |
However, the converse is not true: not all relocations of all ELF |
USE_REL targets set this field to TRUE. Why this is so is peculiar |
to each particular target. For relocs that aren't used in partial |
links (e.g. GOT stuff) it doesn't matter what this is set to. */ |
bfd_boolean partial_inplace; |
/* src_mask selects the part of the instruction (or data) to be used |
in the relocation sum. If the target relocations don't have an |
addend in the reloc, eg. ELF USE_REL, src_mask will normally equal |
dst_mask to extract the addend from the section contents. If |
relocations do have an addend in the reloc, eg. ELF USE_RELA, this |
field should be zero. Non-zero values for ELF USE_RELA targets are |
bogus as in those cases the value in the dst_mask part of the |
section contents should be treated as garbage. */ |
bfd_vma src_mask; |
/* dst_mask selects which parts of the instruction (or data) are |
replaced with a relocated value. */ |
bfd_vma dst_mask; |
/* When some formats create PC relative instructions, they leave |
the value of the pc of the place being relocated in the offset |
slot of the instruction, so that a PC relative relocation can |
be made just by adding in an ordinary offset (e.g., sun3 a.out). |
Some formats leave the displacement part of an instruction |
empty (e.g., m88k bcs); this flag signals the fact. */ |
bfd_boolean pcrel_offset; |
}; |
#define HOWTO(C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \ |
{ (unsigned) C, R, S, B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC } |
#define NEWHOWTO(FUNCTION, NAME, SIZE, REL, IN) \ |
HOWTO (0, 0, SIZE, 0, REL, 0, complain_overflow_dont, FUNCTION, \ |
NAME, FALSE, 0, 0, IN) |
#define EMPTY_HOWTO(C) \ |
HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \ |
NULL, FALSE, 0, 0, FALSE) |
#define HOWTO_PREPARE(relocation, symbol) \ |
{ \ |
if (symbol != NULL) \ |
{ \ |
if (bfd_is_com_section (symbol->section)) \ |
{ \ |
relocation = 0; \ |
} \ |
else \ |
{ \ |
relocation = symbol->value; \ |
} \ |
} \ |
} |
unsigned int bfd_get_reloc_size (reloc_howto_type *); |
typedef struct relent_chain |
{ |
arelent relent; |
struct relent_chain *next; |
} |
arelent_chain; |
bfd_reloc_status_type bfd_check_overflow |
(enum complain_overflow how, |
unsigned int bitsize, |
unsigned int rightshift, |
unsigned int addrsize, |
bfd_vma relocation); |
bfd_reloc_status_type bfd_perform_relocation |
(bfd *abfd, |
arelent *reloc_entry, |
void *data, |
asection *input_section, |
bfd *output_bfd, |
char **error_message); |
bfd_reloc_status_type bfd_install_relocation |
(bfd *abfd, |
arelent *reloc_entry, |
void *data, bfd_vma data_start, |
asection *input_section, |
char **error_message); |
enum bfd_reloc_code_real { |
_dummy_first_bfd_reloc_code_real, |
/* Basic absolute relocations of N bits. */ |
BFD_RELOC_64, |
BFD_RELOC_32, |
BFD_RELOC_26, |
BFD_RELOC_24, |
BFD_RELOC_16, |
BFD_RELOC_14, |
BFD_RELOC_8, |
/* PC-relative relocations. Sometimes these are relative to the address |
of the relocation itself; sometimes they are relative to the start of |
the section containing the relocation. It depends on the specific target. |
The 24-bit relocation is used in some Intel 960 configurations. */ |
BFD_RELOC_64_PCREL, |
BFD_RELOC_32_PCREL, |
BFD_RELOC_24_PCREL, |
BFD_RELOC_16_PCREL, |
BFD_RELOC_12_PCREL, |
BFD_RELOC_8_PCREL, |
/* Section relative relocations. Some targets need this for DWARF2. */ |
BFD_RELOC_32_SECREL, |
/* For ELF. */ |
BFD_RELOC_32_GOT_PCREL, |
BFD_RELOC_16_GOT_PCREL, |
BFD_RELOC_8_GOT_PCREL, |
BFD_RELOC_32_GOTOFF, |
BFD_RELOC_16_GOTOFF, |
BFD_RELOC_LO16_GOTOFF, |
BFD_RELOC_HI16_GOTOFF, |
BFD_RELOC_HI16_S_GOTOFF, |
BFD_RELOC_8_GOTOFF, |
BFD_RELOC_64_PLT_PCREL, |
BFD_RELOC_32_PLT_PCREL, |
BFD_RELOC_24_PLT_PCREL, |
BFD_RELOC_16_PLT_PCREL, |
BFD_RELOC_8_PLT_PCREL, |
BFD_RELOC_64_PLTOFF, |
BFD_RELOC_32_PLTOFF, |
BFD_RELOC_16_PLTOFF, |
BFD_RELOC_LO16_PLTOFF, |
BFD_RELOC_HI16_PLTOFF, |
BFD_RELOC_HI16_S_PLTOFF, |
BFD_RELOC_8_PLTOFF, |
/* Size relocations. */ |
BFD_RELOC_SIZE32, |
BFD_RELOC_SIZE64, |
/* Relocations used by 68K ELF. */ |
BFD_RELOC_68K_GLOB_DAT, |
BFD_RELOC_68K_JMP_SLOT, |
BFD_RELOC_68K_RELATIVE, |
BFD_RELOC_68K_TLS_GD32, |
BFD_RELOC_68K_TLS_GD16, |
BFD_RELOC_68K_TLS_GD8, |
BFD_RELOC_68K_TLS_LDM32, |
BFD_RELOC_68K_TLS_LDM16, |
BFD_RELOC_68K_TLS_LDM8, |
BFD_RELOC_68K_TLS_LDO32, |
BFD_RELOC_68K_TLS_LDO16, |
BFD_RELOC_68K_TLS_LDO8, |
BFD_RELOC_68K_TLS_IE32, |
BFD_RELOC_68K_TLS_IE16, |
BFD_RELOC_68K_TLS_IE8, |
BFD_RELOC_68K_TLS_LE32, |
BFD_RELOC_68K_TLS_LE16, |
BFD_RELOC_68K_TLS_LE8, |
/* Linkage-table relative. */ |
BFD_RELOC_32_BASEREL, |
BFD_RELOC_16_BASEREL, |
BFD_RELOC_LO16_BASEREL, |
BFD_RELOC_HI16_BASEREL, |
BFD_RELOC_HI16_S_BASEREL, |
BFD_RELOC_8_BASEREL, |
BFD_RELOC_RVA, |
/* Absolute 8-bit relocation, but used to form an address like 0xFFnn. */ |
BFD_RELOC_8_FFnn, |
/* These PC-relative relocations are stored as word displacements -- |
i.e., byte displacements shifted right two bits. The 30-bit word |
displacement (<<32_PCREL_S2>> -- 32 bits, shifted 2) is used on the |
SPARC. (SPARC tools generally refer to this as <<WDISP30>>.) The |
signed 16-bit displacement is used on the MIPS, and the 23-bit |
displacement is used on the Alpha. */ |
BFD_RELOC_32_PCREL_S2, |
BFD_RELOC_16_PCREL_S2, |
BFD_RELOC_23_PCREL_S2, |
/* High 22 bits and low 10 bits of 32-bit value, placed into lower bits of |
the target word. These are used on the SPARC. */ |
BFD_RELOC_HI22, |
BFD_RELOC_LO10, |
/* For systems that allocate a Global Pointer register, these are |
displacements off that register. These relocation types are |
handled specially, because the value the register will have is |
decided relatively late. */ |
BFD_RELOC_GPREL16, |
BFD_RELOC_GPREL32, |
/* Reloc types used for i960/b.out. */ |
BFD_RELOC_I960_CALLJ, |
/* SPARC ELF relocations. There is probably some overlap with other |
relocation types already defined. */ |
BFD_RELOC_NONE, |
BFD_RELOC_SPARC_WDISP22, |
BFD_RELOC_SPARC22, |
BFD_RELOC_SPARC13, |
BFD_RELOC_SPARC_GOT10, |
BFD_RELOC_SPARC_GOT13, |
BFD_RELOC_SPARC_GOT22, |
BFD_RELOC_SPARC_PC10, |
BFD_RELOC_SPARC_PC22, |
BFD_RELOC_SPARC_WPLT30, |
BFD_RELOC_SPARC_COPY, |
BFD_RELOC_SPARC_GLOB_DAT, |
BFD_RELOC_SPARC_JMP_SLOT, |
BFD_RELOC_SPARC_RELATIVE, |
BFD_RELOC_SPARC_UA16, |
BFD_RELOC_SPARC_UA32, |
BFD_RELOC_SPARC_UA64, |
BFD_RELOC_SPARC_GOTDATA_HIX22, |
BFD_RELOC_SPARC_GOTDATA_LOX10, |
BFD_RELOC_SPARC_GOTDATA_OP_HIX22, |
BFD_RELOC_SPARC_GOTDATA_OP_LOX10, |
BFD_RELOC_SPARC_GOTDATA_OP, |
BFD_RELOC_SPARC_JMP_IREL, |
BFD_RELOC_SPARC_IRELATIVE, |
/* I think these are specific to SPARC a.out (e.g., Sun 4). */ |
BFD_RELOC_SPARC_BASE13, |
BFD_RELOC_SPARC_BASE22, |
/* SPARC64 relocations */ |
#define BFD_RELOC_SPARC_64 BFD_RELOC_64 |
BFD_RELOC_SPARC_10, |
BFD_RELOC_SPARC_11, |
BFD_RELOC_SPARC_OLO10, |
BFD_RELOC_SPARC_HH22, |
BFD_RELOC_SPARC_HM10, |
BFD_RELOC_SPARC_LM22, |
BFD_RELOC_SPARC_PC_HH22, |
BFD_RELOC_SPARC_PC_HM10, |
BFD_RELOC_SPARC_PC_LM22, |
BFD_RELOC_SPARC_WDISP16, |
BFD_RELOC_SPARC_WDISP19, |
BFD_RELOC_SPARC_7, |
BFD_RELOC_SPARC_6, |
BFD_RELOC_SPARC_5, |
#define BFD_RELOC_SPARC_DISP64 BFD_RELOC_64_PCREL |
BFD_RELOC_SPARC_PLT32, |
BFD_RELOC_SPARC_PLT64, |
BFD_RELOC_SPARC_HIX22, |
BFD_RELOC_SPARC_LOX10, |
BFD_RELOC_SPARC_H44, |
BFD_RELOC_SPARC_M44, |
BFD_RELOC_SPARC_L44, |
BFD_RELOC_SPARC_REGISTER, |
BFD_RELOC_SPARC_H34, |
BFD_RELOC_SPARC_SIZE32, |
BFD_RELOC_SPARC_SIZE64, |
BFD_RELOC_SPARC_WDISP10, |
/* SPARC little endian relocation */ |
BFD_RELOC_SPARC_REV32, |
/* SPARC TLS relocations */ |
BFD_RELOC_SPARC_TLS_GD_HI22, |
BFD_RELOC_SPARC_TLS_GD_LO10, |
BFD_RELOC_SPARC_TLS_GD_ADD, |
BFD_RELOC_SPARC_TLS_GD_CALL, |
BFD_RELOC_SPARC_TLS_LDM_HI22, |
BFD_RELOC_SPARC_TLS_LDM_LO10, |
BFD_RELOC_SPARC_TLS_LDM_ADD, |
BFD_RELOC_SPARC_TLS_LDM_CALL, |
BFD_RELOC_SPARC_TLS_LDO_HIX22, |
BFD_RELOC_SPARC_TLS_LDO_LOX10, |
BFD_RELOC_SPARC_TLS_LDO_ADD, |
BFD_RELOC_SPARC_TLS_IE_HI22, |
BFD_RELOC_SPARC_TLS_IE_LO10, |
BFD_RELOC_SPARC_TLS_IE_LD, |
BFD_RELOC_SPARC_TLS_IE_LDX, |
BFD_RELOC_SPARC_TLS_IE_ADD, |
BFD_RELOC_SPARC_TLS_LE_HIX22, |
BFD_RELOC_SPARC_TLS_LE_LOX10, |
BFD_RELOC_SPARC_TLS_DTPMOD32, |
BFD_RELOC_SPARC_TLS_DTPMOD64, |
BFD_RELOC_SPARC_TLS_DTPOFF32, |
BFD_RELOC_SPARC_TLS_DTPOFF64, |
BFD_RELOC_SPARC_TLS_TPOFF32, |
BFD_RELOC_SPARC_TLS_TPOFF64, |
/* SPU Relocations. */ |
BFD_RELOC_SPU_IMM7, |
BFD_RELOC_SPU_IMM8, |
BFD_RELOC_SPU_IMM10, |
BFD_RELOC_SPU_IMM10W, |
BFD_RELOC_SPU_IMM16, |
BFD_RELOC_SPU_IMM16W, |
BFD_RELOC_SPU_IMM18, |
BFD_RELOC_SPU_PCREL9a, |
BFD_RELOC_SPU_PCREL9b, |
BFD_RELOC_SPU_PCREL16, |
BFD_RELOC_SPU_LO16, |
BFD_RELOC_SPU_HI16, |
BFD_RELOC_SPU_PPU32, |
BFD_RELOC_SPU_PPU64, |
BFD_RELOC_SPU_ADD_PIC, |
/* Alpha ECOFF and ELF relocations. Some of these treat the symbol or |
"addend" in some special way. |
For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when |
writing; when reading, it will be the absolute section symbol. The |
addend is the displacement in bytes of the "lda" instruction from |
the "ldah" instruction (which is at the address of this reloc). */ |
BFD_RELOC_ALPHA_GPDISP_HI16, |
/* For GPDISP_LO16 ("ignore") relocations, the symbol is handled as |
with GPDISP_HI16 relocs. The addend is ignored when writing the |
relocations out, and is filled in with the file's GP value on |
reading, for convenience. */ |
BFD_RELOC_ALPHA_GPDISP_LO16, |
/* The ELF GPDISP relocation is exactly the same as the GPDISP_HI16 |
relocation except that there is no accompanying GPDISP_LO16 |
relocation. */ |
BFD_RELOC_ALPHA_GPDISP, |
/* The Alpha LITERAL/LITUSE relocs are produced by a symbol reference; |
the assembler turns it into a LDQ instruction to load the address of |
the symbol, and then fills in a register in the real instruction. |
The LITERAL reloc, at the LDQ instruction, refers to the .lita |
section symbol. The addend is ignored when writing, but is filled |
in with the file's GP value on reading, for convenience, as with the |
GPDISP_LO16 reloc. |
The ELF_LITERAL reloc is somewhere between 16_GOTOFF and GPDISP_LO16. |
It should refer to the symbol to be referenced, as with 16_GOTOFF, |
but it generates output not based on the position within the .got |
section, but relative to the GP value chosen for the file during the |
final link stage. |
The LITUSE reloc, on the instruction using the loaded address, gives |
information to the linker that it might be able to use to optimize |
away some literal section references. The symbol is ignored (read |
as the absolute section symbol), and the "addend" indicates the type |
of instruction using the register: |
1 - "memory" fmt insn |
2 - byte-manipulation (byte offset reg) |
3 - jsr (target of branch) */ |
BFD_RELOC_ALPHA_LITERAL, |
BFD_RELOC_ALPHA_ELF_LITERAL, |
BFD_RELOC_ALPHA_LITUSE, |
/* The HINT relocation indicates a value that should be filled into the |
"hint" field of a jmp/jsr/ret instruction, for possible branch- |
prediction logic which may be provided on some processors. */ |
BFD_RELOC_ALPHA_HINT, |
/* The LINKAGE relocation outputs a linkage pair in the object file, |
which is filled by the linker. */ |
BFD_RELOC_ALPHA_LINKAGE, |
/* The CODEADDR relocation outputs a STO_CA in the object file, |
which is filled by the linker. */ |
BFD_RELOC_ALPHA_CODEADDR, |
/* The GPREL_HI/LO relocations together form a 32-bit offset from the |
GP register. */ |
BFD_RELOC_ALPHA_GPREL_HI16, |
BFD_RELOC_ALPHA_GPREL_LO16, |
/* Like BFD_RELOC_23_PCREL_S2, except that the source and target must |
share a common GP, and the target address is adjusted for |
STO_ALPHA_STD_GPLOAD. */ |
BFD_RELOC_ALPHA_BRSGP, |
/* The NOP relocation outputs a NOP if the longword displacement |
between two procedure entry points is < 2^21. */ |
BFD_RELOC_ALPHA_NOP, |
/* The BSR relocation outputs a BSR if the longword displacement |
between two procedure entry points is < 2^21. */ |
BFD_RELOC_ALPHA_BSR, |
/* The LDA relocation outputs a LDA if the longword displacement |
between two procedure entry points is < 2^16. */ |
BFD_RELOC_ALPHA_LDA, |
/* The BOH relocation outputs a BSR if the longword displacement |
between two procedure entry points is < 2^21, or else a hint. */ |
BFD_RELOC_ALPHA_BOH, |
/* Alpha thread-local storage relocations. */ |
BFD_RELOC_ALPHA_TLSGD, |
BFD_RELOC_ALPHA_TLSLDM, |
BFD_RELOC_ALPHA_DTPMOD64, |
BFD_RELOC_ALPHA_GOTDTPREL16, |
BFD_RELOC_ALPHA_DTPREL64, |
BFD_RELOC_ALPHA_DTPREL_HI16, |
BFD_RELOC_ALPHA_DTPREL_LO16, |
BFD_RELOC_ALPHA_DTPREL16, |
BFD_RELOC_ALPHA_GOTTPREL16, |
BFD_RELOC_ALPHA_TPREL64, |
BFD_RELOC_ALPHA_TPREL_HI16, |
BFD_RELOC_ALPHA_TPREL_LO16, |
BFD_RELOC_ALPHA_TPREL16, |
/* The MIPS jump instruction. */ |
BFD_RELOC_MIPS_JMP, |
BFD_RELOC_MICROMIPS_JMP, |
/* The MIPS16 jump instruction. */ |
BFD_RELOC_MIPS16_JMP, |
/* MIPS16 GP relative reloc. */ |
BFD_RELOC_MIPS16_GPREL, |
/* High 16 bits of 32-bit value; simple reloc. */ |
BFD_RELOC_HI16, |
/* High 16 bits of 32-bit value but the low 16 bits will be sign |
extended and added to form the final result. If the low 16 |
bits form a negative number, we need to add one to the high value |
to compensate for the borrow when the low bits are added. */ |
BFD_RELOC_HI16_S, |
/* Low 16 bits. */ |
BFD_RELOC_LO16, |
/* High 16 bits of 32-bit pc-relative value */ |
BFD_RELOC_HI16_PCREL, |
/* High 16 bits of 32-bit pc-relative value, adjusted */ |
BFD_RELOC_HI16_S_PCREL, |
/* Low 16 bits of pc-relative value */ |
BFD_RELOC_LO16_PCREL, |
/* Equivalent of BFD_RELOC_MIPS_*, but with the MIPS16 layout of |
16-bit immediate fields */ |
BFD_RELOC_MIPS16_GOT16, |
BFD_RELOC_MIPS16_CALL16, |
/* MIPS16 high 16 bits of 32-bit value. */ |
BFD_RELOC_MIPS16_HI16, |
/* MIPS16 high 16 bits of 32-bit value but the low 16 bits will be sign |
extended and added to form the final result. If the low 16 |
bits form a negative number, we need to add one to the high value |
to compensate for the borrow when the low bits are added. */ |
BFD_RELOC_MIPS16_HI16_S, |
/* MIPS16 low 16 bits. */ |
BFD_RELOC_MIPS16_LO16, |
/* MIPS16 TLS relocations */ |
BFD_RELOC_MIPS16_TLS_GD, |
BFD_RELOC_MIPS16_TLS_LDM, |
BFD_RELOC_MIPS16_TLS_DTPREL_HI16, |
BFD_RELOC_MIPS16_TLS_DTPREL_LO16, |
BFD_RELOC_MIPS16_TLS_GOTTPREL, |
BFD_RELOC_MIPS16_TLS_TPREL_HI16, |
BFD_RELOC_MIPS16_TLS_TPREL_LO16, |
/* Relocation against a MIPS literal section. */ |
BFD_RELOC_MIPS_LITERAL, |
BFD_RELOC_MICROMIPS_LITERAL, |
/* microMIPS PC-relative relocations. */ |
BFD_RELOC_MICROMIPS_7_PCREL_S1, |
BFD_RELOC_MICROMIPS_10_PCREL_S1, |
BFD_RELOC_MICROMIPS_16_PCREL_S1, |
/* MIPS PC-relative relocations. */ |
BFD_RELOC_MIPS_21_PCREL_S2, |
BFD_RELOC_MIPS_26_PCREL_S2, |
BFD_RELOC_MIPS_18_PCREL_S3, |
BFD_RELOC_MIPS_19_PCREL_S2, |
/* microMIPS versions of generic BFD relocs. */ |
BFD_RELOC_MICROMIPS_GPREL16, |
BFD_RELOC_MICROMIPS_HI16, |
BFD_RELOC_MICROMIPS_HI16_S, |
BFD_RELOC_MICROMIPS_LO16, |
/* MIPS ELF relocations. */ |
BFD_RELOC_MIPS_GOT16, |
BFD_RELOC_MICROMIPS_GOT16, |
BFD_RELOC_MIPS_CALL16, |
BFD_RELOC_MICROMIPS_CALL16, |
BFD_RELOC_MIPS_GOT_HI16, |
BFD_RELOC_MICROMIPS_GOT_HI16, |
BFD_RELOC_MIPS_GOT_LO16, |
BFD_RELOC_MICROMIPS_GOT_LO16, |
BFD_RELOC_MIPS_CALL_HI16, |
BFD_RELOC_MICROMIPS_CALL_HI16, |
BFD_RELOC_MIPS_CALL_LO16, |
BFD_RELOC_MICROMIPS_CALL_LO16, |
BFD_RELOC_MIPS_SUB, |
BFD_RELOC_MICROMIPS_SUB, |
BFD_RELOC_MIPS_GOT_PAGE, |
BFD_RELOC_MICROMIPS_GOT_PAGE, |
BFD_RELOC_MIPS_GOT_OFST, |
BFD_RELOC_MICROMIPS_GOT_OFST, |
BFD_RELOC_MIPS_GOT_DISP, |
BFD_RELOC_MICROMIPS_GOT_DISP, |
BFD_RELOC_MIPS_SHIFT5, |
BFD_RELOC_MIPS_SHIFT6, |
BFD_RELOC_MIPS_INSERT_A, |
BFD_RELOC_MIPS_INSERT_B, |
BFD_RELOC_MIPS_DELETE, |
BFD_RELOC_MIPS_HIGHEST, |
BFD_RELOC_MICROMIPS_HIGHEST, |
BFD_RELOC_MIPS_HIGHER, |
BFD_RELOC_MICROMIPS_HIGHER, |
BFD_RELOC_MIPS_SCN_DISP, |
BFD_RELOC_MICROMIPS_SCN_DISP, |
BFD_RELOC_MIPS_REL16, |
BFD_RELOC_MIPS_RELGOT, |
BFD_RELOC_MIPS_JALR, |
BFD_RELOC_MICROMIPS_JALR, |
BFD_RELOC_MIPS_TLS_DTPMOD32, |
BFD_RELOC_MIPS_TLS_DTPREL32, |
BFD_RELOC_MIPS_TLS_DTPMOD64, |
BFD_RELOC_MIPS_TLS_DTPREL64, |
BFD_RELOC_MIPS_TLS_GD, |
BFD_RELOC_MICROMIPS_TLS_GD, |
BFD_RELOC_MIPS_TLS_LDM, |
BFD_RELOC_MICROMIPS_TLS_LDM, |
BFD_RELOC_MIPS_TLS_DTPREL_HI16, |
BFD_RELOC_MICROMIPS_TLS_DTPREL_HI16, |
BFD_RELOC_MIPS_TLS_DTPREL_LO16, |
BFD_RELOC_MICROMIPS_TLS_DTPREL_LO16, |
BFD_RELOC_MIPS_TLS_GOTTPREL, |
BFD_RELOC_MICROMIPS_TLS_GOTTPREL, |
BFD_RELOC_MIPS_TLS_TPREL32, |
BFD_RELOC_MIPS_TLS_TPREL64, |
BFD_RELOC_MIPS_TLS_TPREL_HI16, |
BFD_RELOC_MICROMIPS_TLS_TPREL_HI16, |
BFD_RELOC_MIPS_TLS_TPREL_LO16, |
BFD_RELOC_MICROMIPS_TLS_TPREL_LO16, |
BFD_RELOC_MIPS_EH, |
/* MIPS ELF relocations (VxWorks and PLT extensions). */ |
BFD_RELOC_MIPS_COPY, |
BFD_RELOC_MIPS_JUMP_SLOT, |
/* Moxie ELF relocations. */ |
BFD_RELOC_MOXIE_10_PCREL, |
/* FT32 ELF relocations. */ |
BFD_RELOC_FT32_10, |
BFD_RELOC_FT32_20, |
BFD_RELOC_FT32_17, |
BFD_RELOC_FT32_18, |
/* Fujitsu Frv Relocations. */ |
BFD_RELOC_FRV_LABEL16, |
BFD_RELOC_FRV_LABEL24, |
BFD_RELOC_FRV_LO16, |
BFD_RELOC_FRV_HI16, |
BFD_RELOC_FRV_GPREL12, |
BFD_RELOC_FRV_GPRELU12, |
BFD_RELOC_FRV_GPREL32, |
BFD_RELOC_FRV_GPRELHI, |
BFD_RELOC_FRV_GPRELLO, |
BFD_RELOC_FRV_GOT12, |
BFD_RELOC_FRV_GOTHI, |
BFD_RELOC_FRV_GOTLO, |
BFD_RELOC_FRV_FUNCDESC, |
BFD_RELOC_FRV_FUNCDESC_GOT12, |
BFD_RELOC_FRV_FUNCDESC_GOTHI, |
BFD_RELOC_FRV_FUNCDESC_GOTLO, |
BFD_RELOC_FRV_FUNCDESC_VALUE, |
BFD_RELOC_FRV_FUNCDESC_GOTOFF12, |
BFD_RELOC_FRV_FUNCDESC_GOTOFFHI, |
BFD_RELOC_FRV_FUNCDESC_GOTOFFLO, |
BFD_RELOC_FRV_GOTOFF12, |
BFD_RELOC_FRV_GOTOFFHI, |
BFD_RELOC_FRV_GOTOFFLO, |
BFD_RELOC_FRV_GETTLSOFF, |
BFD_RELOC_FRV_TLSDESC_VALUE, |
BFD_RELOC_FRV_GOTTLSDESC12, |
BFD_RELOC_FRV_GOTTLSDESCHI, |
BFD_RELOC_FRV_GOTTLSDESCLO, |
BFD_RELOC_FRV_TLSMOFF12, |
BFD_RELOC_FRV_TLSMOFFHI, |
BFD_RELOC_FRV_TLSMOFFLO, |
BFD_RELOC_FRV_GOTTLSOFF12, |
BFD_RELOC_FRV_GOTTLSOFFHI, |
BFD_RELOC_FRV_GOTTLSOFFLO, |
BFD_RELOC_FRV_TLSOFF, |
BFD_RELOC_FRV_TLSDESC_RELAX, |
BFD_RELOC_FRV_GETTLSOFF_RELAX, |
BFD_RELOC_FRV_TLSOFF_RELAX, |
BFD_RELOC_FRV_TLSMOFF, |
/* This is a 24bit GOT-relative reloc for the mn10300. */ |
BFD_RELOC_MN10300_GOTOFF24, |
/* This is a 32bit GOT-relative reloc for the mn10300, offset by two bytes |
in the instruction. */ |
BFD_RELOC_MN10300_GOT32, |
/* This is a 24bit GOT-relative reloc for the mn10300, offset by two bytes |
in the instruction. */ |
BFD_RELOC_MN10300_GOT24, |
/* This is a 16bit GOT-relative reloc for the mn10300, offset by two bytes |
in the instruction. */ |
BFD_RELOC_MN10300_GOT16, |
/* Copy symbol at runtime. */ |
BFD_RELOC_MN10300_COPY, |
/* Create GOT entry. */ |
BFD_RELOC_MN10300_GLOB_DAT, |
/* Create PLT entry. */ |
BFD_RELOC_MN10300_JMP_SLOT, |
/* Adjust by program base. */ |
BFD_RELOC_MN10300_RELATIVE, |
/* Together with another reloc targeted at the same location, |
allows for a value that is the difference of two symbols |
in the same section. */ |
BFD_RELOC_MN10300_SYM_DIFF, |
/* The addend of this reloc is an alignment power that must |
be honoured at the offset's location, regardless of linker |
relaxation. */ |
BFD_RELOC_MN10300_ALIGN, |
/* Various TLS-related relocations. */ |
BFD_RELOC_MN10300_TLS_GD, |
BFD_RELOC_MN10300_TLS_LD, |
BFD_RELOC_MN10300_TLS_LDO, |
BFD_RELOC_MN10300_TLS_GOTIE, |
BFD_RELOC_MN10300_TLS_IE, |
BFD_RELOC_MN10300_TLS_LE, |
BFD_RELOC_MN10300_TLS_DTPMOD, |
BFD_RELOC_MN10300_TLS_DTPOFF, |
BFD_RELOC_MN10300_TLS_TPOFF, |
/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the |
instruction. */ |
BFD_RELOC_MN10300_32_PCREL, |
/* This is a 16bit pcrel reloc for the mn10300, offset by two bytes in the |
instruction. */ |
BFD_RELOC_MN10300_16_PCREL, |
/* i386/elf relocations */ |
BFD_RELOC_386_GOT32, |
BFD_RELOC_386_PLT32, |
BFD_RELOC_386_COPY, |
BFD_RELOC_386_GLOB_DAT, |
BFD_RELOC_386_JUMP_SLOT, |
BFD_RELOC_386_RELATIVE, |
BFD_RELOC_386_GOTOFF, |
BFD_RELOC_386_GOTPC, |
BFD_RELOC_386_TLS_TPOFF, |
BFD_RELOC_386_TLS_IE, |
BFD_RELOC_386_TLS_GOTIE, |
BFD_RELOC_386_TLS_LE, |
BFD_RELOC_386_TLS_GD, |
BFD_RELOC_386_TLS_LDM, |
BFD_RELOC_386_TLS_LDO_32, |
BFD_RELOC_386_TLS_IE_32, |
BFD_RELOC_386_TLS_LE_32, |
BFD_RELOC_386_TLS_DTPMOD32, |
BFD_RELOC_386_TLS_DTPOFF32, |
BFD_RELOC_386_TLS_TPOFF32, |
BFD_RELOC_386_TLS_GOTDESC, |
BFD_RELOC_386_TLS_DESC_CALL, |
BFD_RELOC_386_TLS_DESC, |
BFD_RELOC_386_IRELATIVE, |
BFD_RELOC_386_GOT32X, |
/* x86-64/elf relocations */ |
BFD_RELOC_X86_64_GOT32, |
BFD_RELOC_X86_64_PLT32, |
BFD_RELOC_X86_64_COPY, |
BFD_RELOC_X86_64_GLOB_DAT, |
BFD_RELOC_X86_64_JUMP_SLOT, |
BFD_RELOC_X86_64_RELATIVE, |
BFD_RELOC_X86_64_GOTPCREL, |
BFD_RELOC_X86_64_32S, |
BFD_RELOC_X86_64_DTPMOD64, |
BFD_RELOC_X86_64_DTPOFF64, |
BFD_RELOC_X86_64_TPOFF64, |
BFD_RELOC_X86_64_TLSGD, |
BFD_RELOC_X86_64_TLSLD, |
BFD_RELOC_X86_64_DTPOFF32, |
BFD_RELOC_X86_64_GOTTPOFF, |
BFD_RELOC_X86_64_TPOFF32, |
BFD_RELOC_X86_64_GOTOFF64, |
BFD_RELOC_X86_64_GOTPC32, |
BFD_RELOC_X86_64_GOT64, |
BFD_RELOC_X86_64_GOTPCREL64, |
BFD_RELOC_X86_64_GOTPC64, |
BFD_RELOC_X86_64_GOTPLT64, |
BFD_RELOC_X86_64_PLTOFF64, |
BFD_RELOC_X86_64_GOTPC32_TLSDESC, |
BFD_RELOC_X86_64_TLSDESC_CALL, |
BFD_RELOC_X86_64_TLSDESC, |
BFD_RELOC_X86_64_IRELATIVE, |
BFD_RELOC_X86_64_PC32_BND, |
BFD_RELOC_X86_64_PLT32_BND, |
BFD_RELOC_X86_64_GOTPCRELX, |
BFD_RELOC_X86_64_REX_GOTPCRELX, |
/* ns32k relocations */ |
BFD_RELOC_NS32K_IMM_8, |
BFD_RELOC_NS32K_IMM_16, |
BFD_RELOC_NS32K_IMM_32, |
BFD_RELOC_NS32K_IMM_8_PCREL, |
BFD_RELOC_NS32K_IMM_16_PCREL, |
BFD_RELOC_NS32K_IMM_32_PCREL, |
BFD_RELOC_NS32K_DISP_8, |
BFD_RELOC_NS32K_DISP_16, |
BFD_RELOC_NS32K_DISP_32, |
BFD_RELOC_NS32K_DISP_8_PCREL, |
BFD_RELOC_NS32K_DISP_16_PCREL, |
BFD_RELOC_NS32K_DISP_32_PCREL, |
/* PDP11 relocations */ |
BFD_RELOC_PDP11_DISP_8_PCREL, |
BFD_RELOC_PDP11_DISP_6_PCREL, |
/* Picojava relocs. Not all of these appear in object files. */ |
BFD_RELOC_PJ_CODE_HI16, |
BFD_RELOC_PJ_CODE_LO16, |
BFD_RELOC_PJ_CODE_DIR16, |
BFD_RELOC_PJ_CODE_DIR32, |
BFD_RELOC_PJ_CODE_REL16, |
BFD_RELOC_PJ_CODE_REL32, |
/* Power(rs6000) and PowerPC relocations. */ |
BFD_RELOC_PPC_B26, |
BFD_RELOC_PPC_BA26, |
BFD_RELOC_PPC_TOC16, |
BFD_RELOC_PPC_B16, |
BFD_RELOC_PPC_B16_BRTAKEN, |
BFD_RELOC_PPC_B16_BRNTAKEN, |
BFD_RELOC_PPC_BA16, |
BFD_RELOC_PPC_BA16_BRTAKEN, |
BFD_RELOC_PPC_BA16_BRNTAKEN, |
BFD_RELOC_PPC_COPY, |
BFD_RELOC_PPC_GLOB_DAT, |
BFD_RELOC_PPC_JMP_SLOT, |
BFD_RELOC_PPC_RELATIVE, |
BFD_RELOC_PPC_LOCAL24PC, |
BFD_RELOC_PPC_EMB_NADDR32, |
BFD_RELOC_PPC_EMB_NADDR16, |
BFD_RELOC_PPC_EMB_NADDR16_LO, |
BFD_RELOC_PPC_EMB_NADDR16_HI, |
BFD_RELOC_PPC_EMB_NADDR16_HA, |
BFD_RELOC_PPC_EMB_SDAI16, |
BFD_RELOC_PPC_EMB_SDA2I16, |
BFD_RELOC_PPC_EMB_SDA2REL, |
BFD_RELOC_PPC_EMB_SDA21, |
BFD_RELOC_PPC_EMB_MRKREF, |
BFD_RELOC_PPC_EMB_RELSEC16, |
BFD_RELOC_PPC_EMB_RELST_LO, |
BFD_RELOC_PPC_EMB_RELST_HI, |
BFD_RELOC_PPC_EMB_RELST_HA, |
BFD_RELOC_PPC_EMB_BIT_FLD, |
BFD_RELOC_PPC_EMB_RELSDA, |
BFD_RELOC_PPC_VLE_REL8, |
BFD_RELOC_PPC_VLE_REL15, |
BFD_RELOC_PPC_VLE_REL24, |
BFD_RELOC_PPC_VLE_LO16A, |
BFD_RELOC_PPC_VLE_LO16D, |
BFD_RELOC_PPC_VLE_HI16A, |
BFD_RELOC_PPC_VLE_HI16D, |
BFD_RELOC_PPC_VLE_HA16A, |
BFD_RELOC_PPC_VLE_HA16D, |
BFD_RELOC_PPC_VLE_SDA21, |
BFD_RELOC_PPC_VLE_SDA21_LO, |
BFD_RELOC_PPC_VLE_SDAREL_LO16A, |
BFD_RELOC_PPC_VLE_SDAREL_LO16D, |
BFD_RELOC_PPC_VLE_SDAREL_HI16A, |
BFD_RELOC_PPC_VLE_SDAREL_HI16D, |
BFD_RELOC_PPC_VLE_SDAREL_HA16A, |
BFD_RELOC_PPC_VLE_SDAREL_HA16D, |
BFD_RELOC_PPC_REL16DX_HA, |
BFD_RELOC_PPC64_HIGHER, |
BFD_RELOC_PPC64_HIGHER_S, |
BFD_RELOC_PPC64_HIGHEST, |
BFD_RELOC_PPC64_HIGHEST_S, |
BFD_RELOC_PPC64_TOC16_LO, |
BFD_RELOC_PPC64_TOC16_HI, |
BFD_RELOC_PPC64_TOC16_HA, |
BFD_RELOC_PPC64_TOC, |
BFD_RELOC_PPC64_PLTGOT16, |
BFD_RELOC_PPC64_PLTGOT16_LO, |
BFD_RELOC_PPC64_PLTGOT16_HI, |
BFD_RELOC_PPC64_PLTGOT16_HA, |
BFD_RELOC_PPC64_ADDR16_DS, |
BFD_RELOC_PPC64_ADDR16_LO_DS, |
BFD_RELOC_PPC64_GOT16_DS, |
BFD_RELOC_PPC64_GOT16_LO_DS, |
BFD_RELOC_PPC64_PLT16_LO_DS, |
BFD_RELOC_PPC64_SECTOFF_DS, |
BFD_RELOC_PPC64_SECTOFF_LO_DS, |
BFD_RELOC_PPC64_TOC16_DS, |
BFD_RELOC_PPC64_TOC16_LO_DS, |
BFD_RELOC_PPC64_PLTGOT16_DS, |
BFD_RELOC_PPC64_PLTGOT16_LO_DS, |
BFD_RELOC_PPC64_ADDR16_HIGH, |
BFD_RELOC_PPC64_ADDR16_HIGHA, |
BFD_RELOC_PPC64_ADDR64_LOCAL, |
BFD_RELOC_PPC64_ENTRY, |
/* PowerPC and PowerPC64 thread-local storage relocations. */ |
BFD_RELOC_PPC_TLS, |
BFD_RELOC_PPC_TLSGD, |
BFD_RELOC_PPC_TLSLD, |
BFD_RELOC_PPC_DTPMOD, |
BFD_RELOC_PPC_TPREL16, |
BFD_RELOC_PPC_TPREL16_LO, |
BFD_RELOC_PPC_TPREL16_HI, |
BFD_RELOC_PPC_TPREL16_HA, |
BFD_RELOC_PPC_TPREL, |
BFD_RELOC_PPC_DTPREL16, |
BFD_RELOC_PPC_DTPREL16_LO, |
BFD_RELOC_PPC_DTPREL16_HI, |
BFD_RELOC_PPC_DTPREL16_HA, |
BFD_RELOC_PPC_DTPREL, |
BFD_RELOC_PPC_GOT_TLSGD16, |
BFD_RELOC_PPC_GOT_TLSGD16_LO, |
BFD_RELOC_PPC_GOT_TLSGD16_HI, |
BFD_RELOC_PPC_GOT_TLSGD16_HA, |
BFD_RELOC_PPC_GOT_TLSLD16, |
BFD_RELOC_PPC_GOT_TLSLD16_LO, |
BFD_RELOC_PPC_GOT_TLSLD16_HI, |
BFD_RELOC_PPC_GOT_TLSLD16_HA, |
BFD_RELOC_PPC_GOT_TPREL16, |
BFD_RELOC_PPC_GOT_TPREL16_LO, |
BFD_RELOC_PPC_GOT_TPREL16_HI, |
BFD_RELOC_PPC_GOT_TPREL16_HA, |
BFD_RELOC_PPC_GOT_DTPREL16, |
BFD_RELOC_PPC_GOT_DTPREL16_LO, |
BFD_RELOC_PPC_GOT_DTPREL16_HI, |
BFD_RELOC_PPC_GOT_DTPREL16_HA, |
BFD_RELOC_PPC64_TPREL16_DS, |
BFD_RELOC_PPC64_TPREL16_LO_DS, |
BFD_RELOC_PPC64_TPREL16_HIGHER, |
BFD_RELOC_PPC64_TPREL16_HIGHERA, |
BFD_RELOC_PPC64_TPREL16_HIGHEST, |
BFD_RELOC_PPC64_TPREL16_HIGHESTA, |
BFD_RELOC_PPC64_DTPREL16_DS, |
BFD_RELOC_PPC64_DTPREL16_LO_DS, |
BFD_RELOC_PPC64_DTPREL16_HIGHER, |
BFD_RELOC_PPC64_DTPREL16_HIGHERA, |
BFD_RELOC_PPC64_DTPREL16_HIGHEST, |
BFD_RELOC_PPC64_DTPREL16_HIGHESTA, |
BFD_RELOC_PPC64_TPREL16_HIGH, |
BFD_RELOC_PPC64_TPREL16_HIGHA, |
BFD_RELOC_PPC64_DTPREL16_HIGH, |
BFD_RELOC_PPC64_DTPREL16_HIGHA, |
/* IBM 370/390 relocations */ |
BFD_RELOC_I370_D12, |
/* The type of reloc used to build a constructor table - at the moment |
probably a 32 bit wide absolute relocation, but the target can choose. |
It generally does map to one of the other relocation types. */ |
BFD_RELOC_CTOR, |
/* ARM 26 bit pc-relative branch. The lowest two bits must be zero and are |
not stored in the instruction. */ |
BFD_RELOC_ARM_PCREL_BRANCH, |
/* ARM 26 bit pc-relative branch. The lowest bit must be zero and is |
not stored in the instruction. The 2nd lowest bit comes from a 1 bit |
field in the instruction. */ |
BFD_RELOC_ARM_PCREL_BLX, |
/* Thumb 22 bit pc-relative branch. The lowest bit must be zero and is |
not stored in the instruction. The 2nd lowest bit comes from a 1 bit |
field in the instruction. */ |
BFD_RELOC_THUMB_PCREL_BLX, |
/* ARM 26-bit pc-relative branch for an unconditional BL or BLX instruction. */ |
BFD_RELOC_ARM_PCREL_CALL, |
/* ARM 26-bit pc-relative branch for B or conditional BL instruction. */ |
BFD_RELOC_ARM_PCREL_JUMP, |
/* Thumb 7-, 9-, 12-, 20-, 23-, and 25-bit pc-relative branches. |
The lowest bit must be zero and is not stored in the instruction. |
Note that the corresponding ELF R_ARM_THM_JUMPnn constant has an |
"nn" one smaller in all cases. Note further that BRANCH23 |
corresponds to R_ARM_THM_CALL. */ |
BFD_RELOC_THUMB_PCREL_BRANCH7, |
BFD_RELOC_THUMB_PCREL_BRANCH9, |
BFD_RELOC_THUMB_PCREL_BRANCH12, |
BFD_RELOC_THUMB_PCREL_BRANCH20, |
BFD_RELOC_THUMB_PCREL_BRANCH23, |
BFD_RELOC_THUMB_PCREL_BRANCH25, |
/* 12-bit immediate offset, used in ARM-format ldr and str instructions. */ |
BFD_RELOC_ARM_OFFSET_IMM, |
/* 5-bit immediate offset, used in Thumb-format ldr and str instructions. */ |
BFD_RELOC_ARM_THUMB_OFFSET, |
/* Pc-relative or absolute relocation depending on target. Used for |
entries in .init_array sections. */ |
BFD_RELOC_ARM_TARGET1, |
/* Read-only segment base relative address. */ |
BFD_RELOC_ARM_ROSEGREL32, |
/* Data segment base relative address. */ |
BFD_RELOC_ARM_SBREL32, |
/* This reloc is used for references to RTTI data from exception handling |
tables. The actual definition depends on the target. It may be a |
pc-relative or some form of GOT-indirect relocation. */ |
BFD_RELOC_ARM_TARGET2, |
/* 31-bit PC relative address. */ |
BFD_RELOC_ARM_PREL31, |
/* Low and High halfword relocations for MOVW and MOVT instructions. */ |
BFD_RELOC_ARM_MOVW, |
BFD_RELOC_ARM_MOVT, |
BFD_RELOC_ARM_MOVW_PCREL, |
BFD_RELOC_ARM_MOVT_PCREL, |
BFD_RELOC_ARM_THUMB_MOVW, |
BFD_RELOC_ARM_THUMB_MOVT, |
BFD_RELOC_ARM_THUMB_MOVW_PCREL, |
BFD_RELOC_ARM_THUMB_MOVT_PCREL, |
/* Relocations for setting up GOTs and PLTs for shared libraries. */ |
BFD_RELOC_ARM_JUMP_SLOT, |
BFD_RELOC_ARM_GLOB_DAT, |
BFD_RELOC_ARM_GOT32, |
BFD_RELOC_ARM_PLT32, |
BFD_RELOC_ARM_RELATIVE, |
BFD_RELOC_ARM_GOTOFF, |
BFD_RELOC_ARM_GOTPC, |
BFD_RELOC_ARM_GOT_PREL, |
/* ARM thread-local storage relocations. */ |
BFD_RELOC_ARM_TLS_GD32, |
BFD_RELOC_ARM_TLS_LDO32, |
BFD_RELOC_ARM_TLS_LDM32, |
BFD_RELOC_ARM_TLS_DTPOFF32, |
BFD_RELOC_ARM_TLS_DTPMOD32, |
BFD_RELOC_ARM_TLS_TPOFF32, |
BFD_RELOC_ARM_TLS_IE32, |
BFD_RELOC_ARM_TLS_LE32, |
BFD_RELOC_ARM_TLS_GOTDESC, |
BFD_RELOC_ARM_TLS_CALL, |
BFD_RELOC_ARM_THM_TLS_CALL, |
BFD_RELOC_ARM_TLS_DESCSEQ, |
BFD_RELOC_ARM_THM_TLS_DESCSEQ, |
BFD_RELOC_ARM_TLS_DESC, |
/* ARM group relocations. */ |
BFD_RELOC_ARM_ALU_PC_G0_NC, |
BFD_RELOC_ARM_ALU_PC_G0, |
BFD_RELOC_ARM_ALU_PC_G1_NC, |
BFD_RELOC_ARM_ALU_PC_G1, |
BFD_RELOC_ARM_ALU_PC_G2, |
BFD_RELOC_ARM_LDR_PC_G0, |
BFD_RELOC_ARM_LDR_PC_G1, |
BFD_RELOC_ARM_LDR_PC_G2, |
BFD_RELOC_ARM_LDRS_PC_G0, |
BFD_RELOC_ARM_LDRS_PC_G1, |
BFD_RELOC_ARM_LDRS_PC_G2, |
BFD_RELOC_ARM_LDC_PC_G0, |
BFD_RELOC_ARM_LDC_PC_G1, |
BFD_RELOC_ARM_LDC_PC_G2, |
BFD_RELOC_ARM_ALU_SB_G0_NC, |
BFD_RELOC_ARM_ALU_SB_G0, |
BFD_RELOC_ARM_ALU_SB_G1_NC, |
BFD_RELOC_ARM_ALU_SB_G1, |
BFD_RELOC_ARM_ALU_SB_G2, |
BFD_RELOC_ARM_LDR_SB_G0, |
BFD_RELOC_ARM_LDR_SB_G1, |
BFD_RELOC_ARM_LDR_SB_G2, |
BFD_RELOC_ARM_LDRS_SB_G0, |
BFD_RELOC_ARM_LDRS_SB_G1, |
BFD_RELOC_ARM_LDRS_SB_G2, |
BFD_RELOC_ARM_LDC_SB_G0, |
BFD_RELOC_ARM_LDC_SB_G1, |
BFD_RELOC_ARM_LDC_SB_G2, |
/* Annotation of BX instructions. */ |
BFD_RELOC_ARM_V4BX, |
/* ARM support for STT_GNU_IFUNC. */ |
BFD_RELOC_ARM_IRELATIVE, |
/* These relocs are only used within the ARM assembler. They are not |
(at present) written to any object files. */ |
BFD_RELOC_ARM_IMMEDIATE, |
BFD_RELOC_ARM_ADRL_IMMEDIATE, |
BFD_RELOC_ARM_T32_IMMEDIATE, |
BFD_RELOC_ARM_T32_ADD_IMM, |
BFD_RELOC_ARM_T32_IMM12, |
BFD_RELOC_ARM_T32_ADD_PC12, |
BFD_RELOC_ARM_SHIFT_IMM, |
BFD_RELOC_ARM_SMC, |
BFD_RELOC_ARM_HVC, |
BFD_RELOC_ARM_SWI, |
BFD_RELOC_ARM_MULTI, |
BFD_RELOC_ARM_CP_OFF_IMM, |
BFD_RELOC_ARM_CP_OFF_IMM_S2, |
BFD_RELOC_ARM_T32_CP_OFF_IMM, |
BFD_RELOC_ARM_T32_CP_OFF_IMM_S2, |
BFD_RELOC_ARM_ADR_IMM, |
BFD_RELOC_ARM_LDR_IMM, |
BFD_RELOC_ARM_LITERAL, |
BFD_RELOC_ARM_IN_POOL, |
BFD_RELOC_ARM_OFFSET_IMM8, |
BFD_RELOC_ARM_T32_OFFSET_U8, |
BFD_RELOC_ARM_T32_OFFSET_IMM, |
BFD_RELOC_ARM_HWLITERAL, |
BFD_RELOC_ARM_THUMB_ADD, |
BFD_RELOC_ARM_THUMB_IMM, |
BFD_RELOC_ARM_THUMB_SHIFT, |
/* Renesas / SuperH SH relocs. Not all of these appear in object files. */ |
BFD_RELOC_SH_PCDISP8BY2, |
BFD_RELOC_SH_PCDISP12BY2, |
BFD_RELOC_SH_IMM3, |
BFD_RELOC_SH_IMM3U, |
BFD_RELOC_SH_DISP12, |
BFD_RELOC_SH_DISP12BY2, |
BFD_RELOC_SH_DISP12BY4, |
BFD_RELOC_SH_DISP12BY8, |
BFD_RELOC_SH_DISP20, |
BFD_RELOC_SH_DISP20BY8, |
BFD_RELOC_SH_IMM4, |
BFD_RELOC_SH_IMM4BY2, |
BFD_RELOC_SH_IMM4BY4, |
BFD_RELOC_SH_IMM8, |
BFD_RELOC_SH_IMM8BY2, |
BFD_RELOC_SH_IMM8BY4, |
BFD_RELOC_SH_PCRELIMM8BY2, |
BFD_RELOC_SH_PCRELIMM8BY4, |
BFD_RELOC_SH_SWITCH16, |
BFD_RELOC_SH_SWITCH32, |
BFD_RELOC_SH_USES, |
BFD_RELOC_SH_COUNT, |
BFD_RELOC_SH_ALIGN, |
BFD_RELOC_SH_CODE, |
BFD_RELOC_SH_DATA, |
BFD_RELOC_SH_LABEL, |
BFD_RELOC_SH_LOOP_START, |
BFD_RELOC_SH_LOOP_END, |
BFD_RELOC_SH_COPY, |
BFD_RELOC_SH_GLOB_DAT, |
BFD_RELOC_SH_JMP_SLOT, |
BFD_RELOC_SH_RELATIVE, |
BFD_RELOC_SH_GOTPC, |
BFD_RELOC_SH_GOT_LOW16, |
BFD_RELOC_SH_GOT_MEDLOW16, |
BFD_RELOC_SH_GOT_MEDHI16, |
BFD_RELOC_SH_GOT_HI16, |
BFD_RELOC_SH_GOTPLT_LOW16, |
BFD_RELOC_SH_GOTPLT_MEDLOW16, |
BFD_RELOC_SH_GOTPLT_MEDHI16, |
BFD_RELOC_SH_GOTPLT_HI16, |
BFD_RELOC_SH_PLT_LOW16, |
BFD_RELOC_SH_PLT_MEDLOW16, |
BFD_RELOC_SH_PLT_MEDHI16, |
BFD_RELOC_SH_PLT_HI16, |
BFD_RELOC_SH_GOTOFF_LOW16, |
BFD_RELOC_SH_GOTOFF_MEDLOW16, |
BFD_RELOC_SH_GOTOFF_MEDHI16, |
BFD_RELOC_SH_GOTOFF_HI16, |
BFD_RELOC_SH_GOTPC_LOW16, |
BFD_RELOC_SH_GOTPC_MEDLOW16, |
BFD_RELOC_SH_GOTPC_MEDHI16, |
BFD_RELOC_SH_GOTPC_HI16, |
BFD_RELOC_SH_COPY64, |
BFD_RELOC_SH_GLOB_DAT64, |
BFD_RELOC_SH_JMP_SLOT64, |
BFD_RELOC_SH_RELATIVE64, |
BFD_RELOC_SH_GOT10BY4, |
BFD_RELOC_SH_GOT10BY8, |
BFD_RELOC_SH_GOTPLT10BY4, |
BFD_RELOC_SH_GOTPLT10BY8, |
BFD_RELOC_SH_GOTPLT32, |
BFD_RELOC_SH_SHMEDIA_CODE, |
BFD_RELOC_SH_IMMU5, |
BFD_RELOC_SH_IMMS6, |
BFD_RELOC_SH_IMMS6BY32, |
BFD_RELOC_SH_IMMU6, |
BFD_RELOC_SH_IMMS10, |
BFD_RELOC_SH_IMMS10BY2, |
BFD_RELOC_SH_IMMS10BY4, |
BFD_RELOC_SH_IMMS10BY8, |
BFD_RELOC_SH_IMMS16, |
BFD_RELOC_SH_IMMU16, |
BFD_RELOC_SH_IMM_LOW16, |
BFD_RELOC_SH_IMM_LOW16_PCREL, |
BFD_RELOC_SH_IMM_MEDLOW16, |
BFD_RELOC_SH_IMM_MEDLOW16_PCREL, |
BFD_RELOC_SH_IMM_MEDHI16, |
BFD_RELOC_SH_IMM_MEDHI16_PCREL, |
BFD_RELOC_SH_IMM_HI16, |
BFD_RELOC_SH_IMM_HI16_PCREL, |
BFD_RELOC_SH_PT_16, |
BFD_RELOC_SH_TLS_GD_32, |
BFD_RELOC_SH_TLS_LD_32, |
BFD_RELOC_SH_TLS_LDO_32, |
BFD_RELOC_SH_TLS_IE_32, |
BFD_RELOC_SH_TLS_LE_32, |
BFD_RELOC_SH_TLS_DTPMOD32, |
BFD_RELOC_SH_TLS_DTPOFF32, |
BFD_RELOC_SH_TLS_TPOFF32, |
BFD_RELOC_SH_GOT20, |
BFD_RELOC_SH_GOTOFF20, |
BFD_RELOC_SH_GOTFUNCDESC, |
BFD_RELOC_SH_GOTFUNCDESC20, |
BFD_RELOC_SH_GOTOFFFUNCDESC, |
BFD_RELOC_SH_GOTOFFFUNCDESC20, |
BFD_RELOC_SH_FUNCDESC, |
/* ARC relocs. */ |
BFD_RELOC_ARC_NONE, |
BFD_RELOC_ARC_8, |
BFD_RELOC_ARC_16, |
BFD_RELOC_ARC_24, |
BFD_RELOC_ARC_32, |
BFD_RELOC_ARC_N8, |
BFD_RELOC_ARC_N16, |
BFD_RELOC_ARC_N24, |
BFD_RELOC_ARC_N32, |
BFD_RELOC_ARC_SDA, |
BFD_RELOC_ARC_SECTOFF, |
BFD_RELOC_ARC_S21H_PCREL, |
BFD_RELOC_ARC_S21W_PCREL, |
BFD_RELOC_ARC_S25H_PCREL, |
BFD_RELOC_ARC_S25W_PCREL, |
BFD_RELOC_ARC_SDA32, |
BFD_RELOC_ARC_SDA_LDST, |
BFD_RELOC_ARC_SDA_LDST1, |
BFD_RELOC_ARC_SDA_LDST2, |
BFD_RELOC_ARC_SDA16_LD, |
BFD_RELOC_ARC_SDA16_LD1, |
BFD_RELOC_ARC_SDA16_LD2, |
BFD_RELOC_ARC_S13_PCREL, |
BFD_RELOC_ARC_W, |
BFD_RELOC_ARC_32_ME, |
BFD_RELOC_ARC_32_ME_S, |
BFD_RELOC_ARC_N32_ME, |
BFD_RELOC_ARC_SECTOFF_ME, |
BFD_RELOC_ARC_SDA32_ME, |
BFD_RELOC_ARC_W_ME, |
BFD_RELOC_AC_SECTOFF_U8, |
BFD_RELOC_AC_SECTOFF_U8_1, |
BFD_RELOC_AC_SECTOFF_U8_2, |
BFD_RELOC_AC_SECTFOFF_S9, |
BFD_RELOC_AC_SECTFOFF_S9_1, |
BFD_RELOC_AC_SECTFOFF_S9_2, |
BFD_RELOC_ARC_SECTOFF_ME_1, |
BFD_RELOC_ARC_SECTOFF_ME_2, |
BFD_RELOC_ARC_SECTOFF_1, |
BFD_RELOC_ARC_SECTOFF_2, |
BFD_RELOC_ARC_SDA16_ST2, |
BFD_RELOC_ARC_32_PCREL, |
BFD_RELOC_ARC_PC32, |
BFD_RELOC_ARC_GOT32, |
BFD_RELOC_ARC_GOTPC32, |
BFD_RELOC_ARC_PLT32, |
BFD_RELOC_ARC_COPY, |
BFD_RELOC_ARC_GLOB_DAT, |
BFD_RELOC_ARC_JMP_SLOT, |
BFD_RELOC_ARC_RELATIVE, |
BFD_RELOC_ARC_GOTOFF, |
BFD_RELOC_ARC_GOTPC, |
BFD_RELOC_ARC_S21W_PCREL_PLT, |
BFD_RELOC_ARC_S25H_PCREL_PLT, |
BFD_RELOC_ARC_TLS_DTPMOD, |
BFD_RELOC_ARC_TLS_TPOFF, |
BFD_RELOC_ARC_TLS_GD_GOT, |
BFD_RELOC_ARC_TLS_GD_LD, |
BFD_RELOC_ARC_TLS_GD_CALL, |
BFD_RELOC_ARC_TLS_IE_GOT, |
BFD_RELOC_ARC_TLS_DTPOFF, |
BFD_RELOC_ARC_TLS_DTPOFF_S9, |
BFD_RELOC_ARC_TLS_LE_S9, |
BFD_RELOC_ARC_TLS_LE_32, |
BFD_RELOC_ARC_S25W_PCREL_PLT, |
BFD_RELOC_ARC_S21H_PCREL_PLT, |
/* ADI Blackfin 16 bit immediate absolute reloc. */ |
BFD_RELOC_BFIN_16_IMM, |
/* ADI Blackfin 16 bit immediate absolute reloc higher 16 bits. */ |
BFD_RELOC_BFIN_16_HIGH, |
/* ADI Blackfin 'a' part of LSETUP. */ |
BFD_RELOC_BFIN_4_PCREL, |
/* ADI Blackfin. */ |
BFD_RELOC_BFIN_5_PCREL, |
/* ADI Blackfin 16 bit immediate absolute reloc lower 16 bits. */ |
BFD_RELOC_BFIN_16_LOW, |
/* ADI Blackfin. */ |
BFD_RELOC_BFIN_10_PCREL, |
/* ADI Blackfin 'b' part of LSETUP. */ |
BFD_RELOC_BFIN_11_PCREL, |
/* ADI Blackfin. */ |
BFD_RELOC_BFIN_12_PCREL_JUMP, |
/* ADI Blackfin Short jump, pcrel. */ |
BFD_RELOC_BFIN_12_PCREL_JUMP_S, |
/* ADI Blackfin Call.x not implemented. */ |
BFD_RELOC_BFIN_24_PCREL_CALL_X, |
/* ADI Blackfin Long Jump pcrel. */ |
BFD_RELOC_BFIN_24_PCREL_JUMP_L, |
/* ADI Blackfin FD-PIC relocations. */ |
BFD_RELOC_BFIN_GOT17M4, |
BFD_RELOC_BFIN_GOTHI, |
BFD_RELOC_BFIN_GOTLO, |
BFD_RELOC_BFIN_FUNCDESC, |
BFD_RELOC_BFIN_FUNCDESC_GOT17M4, |
BFD_RELOC_BFIN_FUNCDESC_GOTHI, |
BFD_RELOC_BFIN_FUNCDESC_GOTLO, |
BFD_RELOC_BFIN_FUNCDESC_VALUE, |
BFD_RELOC_BFIN_FUNCDESC_GOTOFF17M4, |
BFD_RELOC_BFIN_FUNCDESC_GOTOFFHI, |
BFD_RELOC_BFIN_FUNCDESC_GOTOFFLO, |
BFD_RELOC_BFIN_GOTOFF17M4, |
BFD_RELOC_BFIN_GOTOFFHI, |
BFD_RELOC_BFIN_GOTOFFLO, |
/* ADI Blackfin GOT relocation. */ |
BFD_RELOC_BFIN_GOT, |
/* ADI Blackfin PLTPC relocation. */ |
BFD_RELOC_BFIN_PLTPC, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_PUSH, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_CONST, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_ADD, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_SUB, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_MULT, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_DIV, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_MOD, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_LSHIFT, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_RSHIFT, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_AND, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_OR, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_XOR, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_LAND, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_LOR, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_LEN, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_NEG, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_COMP, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_PAGE, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_HWPAGE, |
/* ADI Blackfin arithmetic relocation. */ |
BFD_ARELOC_BFIN_ADDR, |
/* Mitsubishi D10V relocs. |
This is a 10-bit reloc with the right 2 bits |
assumed to be 0. */ |
BFD_RELOC_D10V_10_PCREL_R, |
/* Mitsubishi D10V relocs. |
This is a 10-bit reloc with the right 2 bits |
assumed to be 0. This is the same as the previous reloc |
except it is in the left container, i.e., |
shifted left 15 bits. */ |
BFD_RELOC_D10V_10_PCREL_L, |
/* This is an 18-bit reloc with the right 2 bits |
assumed to be 0. */ |
BFD_RELOC_D10V_18, |
/* This is an 18-bit reloc with the right 2 bits |
assumed to be 0. */ |
BFD_RELOC_D10V_18_PCREL, |
/* Mitsubishi D30V relocs. |
This is a 6-bit absolute reloc. */ |
BFD_RELOC_D30V_6, |
/* This is a 6-bit pc-relative reloc with |
the right 3 bits assumed to be 0. */ |
BFD_RELOC_D30V_9_PCREL, |
/* This is a 6-bit pc-relative reloc with |
the right 3 bits assumed to be 0. Same |
as the previous reloc but on the right side |
of the container. */ |
BFD_RELOC_D30V_9_PCREL_R, |
/* This is a 12-bit absolute reloc with the |
right 3 bitsassumed to be 0. */ |
BFD_RELOC_D30V_15, |
/* This is a 12-bit pc-relative reloc with |
the right 3 bits assumed to be 0. */ |
BFD_RELOC_D30V_15_PCREL, |
/* This is a 12-bit pc-relative reloc with |
the right 3 bits assumed to be 0. Same |
as the previous reloc but on the right side |
of the container. */ |
BFD_RELOC_D30V_15_PCREL_R, |
/* This is an 18-bit absolute reloc with |
the right 3 bits assumed to be 0. */ |
BFD_RELOC_D30V_21, |
/* This is an 18-bit pc-relative reloc with |
the right 3 bits assumed to be 0. */ |
BFD_RELOC_D30V_21_PCREL, |
/* This is an 18-bit pc-relative reloc with |
the right 3 bits assumed to be 0. Same |
as the previous reloc but on the right side |
of the container. */ |
BFD_RELOC_D30V_21_PCREL_R, |
/* This is a 32-bit absolute reloc. */ |
BFD_RELOC_D30V_32, |
/* This is a 32-bit pc-relative reloc. */ |
BFD_RELOC_D30V_32_PCREL, |
/* DLX relocs */ |
BFD_RELOC_DLX_HI16_S, |
/* DLX relocs */ |
BFD_RELOC_DLX_LO16, |
/* DLX relocs */ |
BFD_RELOC_DLX_JMP26, |
/* Renesas M16C/M32C Relocations. */ |
BFD_RELOC_M32C_HI8, |
BFD_RELOC_M32C_RL_JUMP, |
BFD_RELOC_M32C_RL_1ADDR, |
BFD_RELOC_M32C_RL_2ADDR, |
/* Renesas M32R (formerly Mitsubishi M32R) relocs. |
This is a 24 bit absolute address. */ |
BFD_RELOC_M32R_24, |
/* This is a 10-bit pc-relative reloc with the right 2 bits assumed to be 0. */ |
BFD_RELOC_M32R_10_PCREL, |
/* This is an 18-bit reloc with the right 2 bits assumed to be 0. */ |
BFD_RELOC_M32R_18_PCREL, |
/* This is a 26-bit reloc with the right 2 bits assumed to be 0. */ |
BFD_RELOC_M32R_26_PCREL, |
/* This is a 16-bit reloc containing the high 16 bits of an address |
used when the lower 16 bits are treated as unsigned. */ |
BFD_RELOC_M32R_HI16_ULO, |
/* This is a 16-bit reloc containing the high 16 bits of an address |
used when the lower 16 bits are treated as signed. */ |
BFD_RELOC_M32R_HI16_SLO, |
/* This is a 16-bit reloc containing the lower 16 bits of an address. */ |
BFD_RELOC_M32R_LO16, |
/* This is a 16-bit reloc containing the small data area offset for use in |
add3, load, and store instructions. */ |
BFD_RELOC_M32R_SDA16, |
/* For PIC. */ |
BFD_RELOC_M32R_GOT24, |
BFD_RELOC_M32R_26_PLTREL, |
BFD_RELOC_M32R_COPY, |
BFD_RELOC_M32R_GLOB_DAT, |
BFD_RELOC_M32R_JMP_SLOT, |
BFD_RELOC_M32R_RELATIVE, |
BFD_RELOC_M32R_GOTOFF, |
BFD_RELOC_M32R_GOTOFF_HI_ULO, |
BFD_RELOC_M32R_GOTOFF_HI_SLO, |
BFD_RELOC_M32R_GOTOFF_LO, |
BFD_RELOC_M32R_GOTPC24, |
BFD_RELOC_M32R_GOT16_HI_ULO, |
BFD_RELOC_M32R_GOT16_HI_SLO, |
BFD_RELOC_M32R_GOT16_LO, |
BFD_RELOC_M32R_GOTPC_HI_ULO, |
BFD_RELOC_M32R_GOTPC_HI_SLO, |
BFD_RELOC_M32R_GOTPC_LO, |
/* NDS32 relocs. |
This is a 20 bit absolute address. */ |
BFD_RELOC_NDS32_20, |
/* This is a 9-bit pc-relative reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_9_PCREL, |
/* This is a 9-bit pc-relative reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_WORD_9_PCREL, |
/* This is an 15-bit reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_15_PCREL, |
/* This is an 17-bit reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_17_PCREL, |
/* This is a 25-bit reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_25_PCREL, |
/* This is a 20-bit reloc containing the high 20 bits of an address |
used with the lower 12 bits */ |
BFD_RELOC_NDS32_HI20, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift right by 3. This is used with ldi,sdi... */ |
BFD_RELOC_NDS32_LO12S3, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 2. This is used with lwi,swi... */ |
BFD_RELOC_NDS32_LO12S2, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 1. This is used with lhi,shi... */ |
BFD_RELOC_NDS32_LO12S1, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 0. This is used with lbisbi... */ |
BFD_RELOC_NDS32_LO12S0, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 0. This is only used with branch relaxations */ |
BFD_RELOC_NDS32_LO12S0_ORI, |
/* This is a 15-bit reloc containing the small data area 18-bit signed offset |
and shift left by 3 for use in ldi, sdi... */ |
BFD_RELOC_NDS32_SDA15S3, |
/* This is a 15-bit reloc containing the small data area 17-bit signed offset |
and shift left by 2 for use in lwi, swi... */ |
BFD_RELOC_NDS32_SDA15S2, |
/* This is a 15-bit reloc containing the small data area 16-bit signed offset |
and shift left by 1 for use in lhi, shi... */ |
BFD_RELOC_NDS32_SDA15S1, |
/* This is a 15-bit reloc containing the small data area 15-bit signed offset |
and shift left by 0 for use in lbi, sbi... */ |
BFD_RELOC_NDS32_SDA15S0, |
/* This is a 16-bit reloc containing the small data area 16-bit signed offset |
and shift left by 3 */ |
BFD_RELOC_NDS32_SDA16S3, |
/* This is a 17-bit reloc containing the small data area 17-bit signed offset |
and shift left by 2 for use in lwi.gp, swi.gp... */ |
BFD_RELOC_NDS32_SDA17S2, |
/* This is a 18-bit reloc containing the small data area 18-bit signed offset |
and shift left by 1 for use in lhi.gp, shi.gp... */ |
BFD_RELOC_NDS32_SDA18S1, |
/* This is a 19-bit reloc containing the small data area 19-bit signed offset |
and shift left by 0 for use in lbi.gp, sbi.gp... */ |
BFD_RELOC_NDS32_SDA19S0, |
/* for PIC */ |
BFD_RELOC_NDS32_GOT20, |
BFD_RELOC_NDS32_9_PLTREL, |
BFD_RELOC_NDS32_25_PLTREL, |
BFD_RELOC_NDS32_COPY, |
BFD_RELOC_NDS32_GLOB_DAT, |
BFD_RELOC_NDS32_JMP_SLOT, |
BFD_RELOC_NDS32_RELATIVE, |
BFD_RELOC_NDS32_GOTOFF, |
BFD_RELOC_NDS32_GOTOFF_HI20, |
BFD_RELOC_NDS32_GOTOFF_LO12, |
BFD_RELOC_NDS32_GOTPC20, |
BFD_RELOC_NDS32_GOT_HI20, |
BFD_RELOC_NDS32_GOT_LO12, |
BFD_RELOC_NDS32_GOTPC_HI20, |
BFD_RELOC_NDS32_GOTPC_LO12, |
/* for relax */ |
BFD_RELOC_NDS32_INSN16, |
BFD_RELOC_NDS32_LABEL, |
BFD_RELOC_NDS32_LONGCALL1, |
BFD_RELOC_NDS32_LONGCALL2, |
BFD_RELOC_NDS32_LONGCALL3, |
BFD_RELOC_NDS32_LONGJUMP1, |
BFD_RELOC_NDS32_LONGJUMP2, |
BFD_RELOC_NDS32_LONGJUMP3, |
BFD_RELOC_NDS32_LOADSTORE, |
BFD_RELOC_NDS32_9_FIXED, |
BFD_RELOC_NDS32_15_FIXED, |
BFD_RELOC_NDS32_17_FIXED, |
BFD_RELOC_NDS32_25_FIXED, |
BFD_RELOC_NDS32_LONGCALL4, |
BFD_RELOC_NDS32_LONGCALL5, |
BFD_RELOC_NDS32_LONGCALL6, |
BFD_RELOC_NDS32_LONGJUMP4, |
BFD_RELOC_NDS32_LONGJUMP5, |
BFD_RELOC_NDS32_LONGJUMP6, |
BFD_RELOC_NDS32_LONGJUMP7, |
/* for PIC */ |
BFD_RELOC_NDS32_PLTREL_HI20, |
BFD_RELOC_NDS32_PLTREL_LO12, |
BFD_RELOC_NDS32_PLT_GOTREL_HI20, |
BFD_RELOC_NDS32_PLT_GOTREL_LO12, |
/* for floating point */ |
BFD_RELOC_NDS32_SDA12S2_DP, |
BFD_RELOC_NDS32_SDA12S2_SP, |
BFD_RELOC_NDS32_LO12S2_DP, |
BFD_RELOC_NDS32_LO12S2_SP, |
/* for dwarf2 debug_line. */ |
BFD_RELOC_NDS32_DWARF2_OP1, |
BFD_RELOC_NDS32_DWARF2_OP2, |
BFD_RELOC_NDS32_DWARF2_LEB, |
/* for eliminate 16-bit instructions */ |
BFD_RELOC_NDS32_UPDATE_TA, |
/* for PIC object relaxation */ |
BFD_RELOC_NDS32_PLT_GOTREL_LO20, |
BFD_RELOC_NDS32_PLT_GOTREL_LO15, |
BFD_RELOC_NDS32_PLT_GOTREL_LO19, |
BFD_RELOC_NDS32_GOT_LO15, |
BFD_RELOC_NDS32_GOT_LO19, |
BFD_RELOC_NDS32_GOTOFF_LO15, |
BFD_RELOC_NDS32_GOTOFF_LO19, |
BFD_RELOC_NDS32_GOT15S2, |
BFD_RELOC_NDS32_GOT17S2, |
/* NDS32 relocs. |
This is a 5 bit absolute address. */ |
BFD_RELOC_NDS32_5, |
/* This is a 10-bit unsigned pc-relative reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_10_UPCREL, |
/* If fp were omitted, fp can used as another gp. */ |
BFD_RELOC_NDS32_SDA_FP7U2_RELA, |
/* relaxation relative relocation types */ |
BFD_RELOC_NDS32_RELAX_ENTRY, |
BFD_RELOC_NDS32_GOT_SUFF, |
BFD_RELOC_NDS32_GOTOFF_SUFF, |
BFD_RELOC_NDS32_PLT_GOT_SUFF, |
BFD_RELOC_NDS32_MULCALL_SUFF, |
BFD_RELOC_NDS32_PTR, |
BFD_RELOC_NDS32_PTR_COUNT, |
BFD_RELOC_NDS32_PTR_RESOLVED, |
BFD_RELOC_NDS32_PLTBLOCK, |
BFD_RELOC_NDS32_RELAX_REGION_BEGIN, |
BFD_RELOC_NDS32_RELAX_REGION_END, |
BFD_RELOC_NDS32_MINUEND, |
BFD_RELOC_NDS32_SUBTRAHEND, |
BFD_RELOC_NDS32_DIFF8, |
BFD_RELOC_NDS32_DIFF16, |
BFD_RELOC_NDS32_DIFF32, |
BFD_RELOC_NDS32_DIFF_ULEB128, |
BFD_RELOC_NDS32_EMPTY, |
/* This is a 25 bit absolute address. */ |
BFD_RELOC_NDS32_25_ABS, |
/* For ex9 and ifc using. */ |
BFD_RELOC_NDS32_DATA, |
BFD_RELOC_NDS32_TRAN, |
BFD_RELOC_NDS32_17IFC_PCREL, |
BFD_RELOC_NDS32_10IFCU_PCREL, |
/* For TLS. */ |
BFD_RELOC_NDS32_TPOFF, |
BFD_RELOC_NDS32_TLS_LE_HI20, |
BFD_RELOC_NDS32_TLS_LE_LO12, |
BFD_RELOC_NDS32_TLS_LE_ADD, |
BFD_RELOC_NDS32_TLS_LE_LS, |
BFD_RELOC_NDS32_GOTTPOFF, |
BFD_RELOC_NDS32_TLS_IE_HI20, |
BFD_RELOC_NDS32_TLS_IE_LO12S2, |
BFD_RELOC_NDS32_TLS_TPOFF, |
BFD_RELOC_NDS32_TLS_LE_20, |
BFD_RELOC_NDS32_TLS_LE_15S0, |
BFD_RELOC_NDS32_TLS_LE_15S1, |
BFD_RELOC_NDS32_TLS_LE_15S2, |
/* This is a 9-bit reloc */ |
BFD_RELOC_V850_9_PCREL, |
/* This is a 22-bit reloc */ |
BFD_RELOC_V850_22_PCREL, |
/* This is a 16 bit offset from the short data area pointer. */ |
BFD_RELOC_V850_SDA_16_16_OFFSET, |
/* This is a 16 bit offset (of which only 15 bits are used) from the |
short data area pointer. */ |
BFD_RELOC_V850_SDA_15_16_OFFSET, |
/* This is a 16 bit offset from the zero data area pointer. */ |
BFD_RELOC_V850_ZDA_16_16_OFFSET, |
/* This is a 16 bit offset (of which only 15 bits are used) from the |
zero data area pointer. */ |
BFD_RELOC_V850_ZDA_15_16_OFFSET, |
/* This is an 8 bit offset (of which only 6 bits are used) from the |
tiny data area pointer. */ |
BFD_RELOC_V850_TDA_6_8_OFFSET, |
/* This is an 8bit offset (of which only 7 bits are used) from the tiny |
data area pointer. */ |
BFD_RELOC_V850_TDA_7_8_OFFSET, |
/* This is a 7 bit offset from the tiny data area pointer. */ |
BFD_RELOC_V850_TDA_7_7_OFFSET, |
/* This is a 16 bit offset from the tiny data area pointer. */ |
BFD_RELOC_V850_TDA_16_16_OFFSET, |
/* This is a 5 bit offset (of which only 4 bits are used) from the tiny |
data area pointer. */ |
BFD_RELOC_V850_TDA_4_5_OFFSET, |
/* This is a 4 bit offset from the tiny data area pointer. */ |
BFD_RELOC_V850_TDA_4_4_OFFSET, |
/* This is a 16 bit offset from the short data area pointer, with the |
bits placed non-contiguously in the instruction. */ |
BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET, |
/* This is a 16 bit offset from the zero data area pointer, with the |
bits placed non-contiguously in the instruction. */ |
BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET, |
/* This is a 6 bit offset from the call table base pointer. */ |
BFD_RELOC_V850_CALLT_6_7_OFFSET, |
/* This is a 16 bit offset from the call table base pointer. */ |
BFD_RELOC_V850_CALLT_16_16_OFFSET, |
/* Used for relaxing indirect function calls. */ |
BFD_RELOC_V850_LONGCALL, |
/* Used for relaxing indirect jumps. */ |
BFD_RELOC_V850_LONGJUMP, |
/* Used to maintain alignment whilst relaxing. */ |
BFD_RELOC_V850_ALIGN, |
/* This is a variation of BFD_RELOC_LO16 that can be used in v850e ld.bu |
instructions. */ |
BFD_RELOC_V850_LO16_SPLIT_OFFSET, |
/* This is a 16-bit reloc. */ |
BFD_RELOC_V850_16_PCREL, |
/* This is a 17-bit reloc. */ |
BFD_RELOC_V850_17_PCREL, |
/* This is a 23-bit reloc. */ |
BFD_RELOC_V850_23, |
/* This is a 32-bit reloc. */ |
BFD_RELOC_V850_32_PCREL, |
/* This is a 32-bit reloc. */ |
BFD_RELOC_V850_32_ABS, |
/* This is a 16-bit reloc. */ |
BFD_RELOC_V850_16_SPLIT_OFFSET, |
/* This is a 16-bit reloc. */ |
BFD_RELOC_V850_16_S1, |
/* Low 16 bits. 16 bit shifted by 1. */ |
BFD_RELOC_V850_LO16_S1, |
/* This is a 16 bit offset from the call table base pointer. */ |
BFD_RELOC_V850_CALLT_15_16_OFFSET, |
/* DSO relocations. */ |
BFD_RELOC_V850_32_GOTPCREL, |
/* DSO relocations. */ |
BFD_RELOC_V850_16_GOT, |
/* DSO relocations. */ |
BFD_RELOC_V850_32_GOT, |
/* DSO relocations. */ |
BFD_RELOC_V850_22_PLT_PCREL, |
/* DSO relocations. */ |
BFD_RELOC_V850_32_PLT_PCREL, |
/* DSO relocations. */ |
BFD_RELOC_V850_COPY, |
/* DSO relocations. */ |
BFD_RELOC_V850_GLOB_DAT, |
/* DSO relocations. */ |
BFD_RELOC_V850_JMP_SLOT, |
/* DSO relocations. */ |
BFD_RELOC_V850_RELATIVE, |
/* DSO relocations. */ |
BFD_RELOC_V850_16_GOTOFF, |
/* DSO relocations. */ |
BFD_RELOC_V850_32_GOTOFF, |
/* start code. */ |
BFD_RELOC_V850_CODE, |
/* start data in text. */ |
BFD_RELOC_V850_DATA, |
/* This is a 8bit DP reloc for the tms320c30, where the most |
significant 8 bits of a 24 bit word are placed into the least |
significant 8 bits of the opcode. */ |
BFD_RELOC_TIC30_LDP, |
/* This is a 7bit reloc for the tms320c54x, where the least |
significant 7 bits of a 16 bit word are placed into the least |
significant 7 bits of the opcode. */ |
BFD_RELOC_TIC54X_PARTLS7, |
/* This is a 9bit DP reloc for the tms320c54x, where the most |
significant 9 bits of a 16 bit word are placed into the least |
significant 9 bits of the opcode. */ |
BFD_RELOC_TIC54X_PARTMS9, |
/* This is an extended address 23-bit reloc for the tms320c54x. */ |
BFD_RELOC_TIC54X_23, |
/* This is a 16-bit reloc for the tms320c54x, where the least |
significant 16 bits of a 23-bit extended address are placed into |
the opcode. */ |
BFD_RELOC_TIC54X_16_OF_23, |
/* This is a reloc for the tms320c54x, where the most |
significant 7 bits of a 23-bit extended address are placed into |
the opcode. */ |
BFD_RELOC_TIC54X_MS7_OF_23, |
/* TMS320C6000 relocations. */ |
BFD_RELOC_C6000_PCR_S21, |
BFD_RELOC_C6000_PCR_S12, |
BFD_RELOC_C6000_PCR_S10, |
BFD_RELOC_C6000_PCR_S7, |
BFD_RELOC_C6000_ABS_S16, |
BFD_RELOC_C6000_ABS_L16, |
BFD_RELOC_C6000_ABS_H16, |
BFD_RELOC_C6000_SBR_U15_B, |
BFD_RELOC_C6000_SBR_U15_H, |
BFD_RELOC_C6000_SBR_U15_W, |
BFD_RELOC_C6000_SBR_S16, |
BFD_RELOC_C6000_SBR_L16_B, |
BFD_RELOC_C6000_SBR_L16_H, |
BFD_RELOC_C6000_SBR_L16_W, |
BFD_RELOC_C6000_SBR_H16_B, |
BFD_RELOC_C6000_SBR_H16_H, |
BFD_RELOC_C6000_SBR_H16_W, |
BFD_RELOC_C6000_SBR_GOT_U15_W, |
BFD_RELOC_C6000_SBR_GOT_L16_W, |
BFD_RELOC_C6000_SBR_GOT_H16_W, |
BFD_RELOC_C6000_DSBT_INDEX, |
BFD_RELOC_C6000_PREL31, |
BFD_RELOC_C6000_COPY, |
BFD_RELOC_C6000_JUMP_SLOT, |
BFD_RELOC_C6000_EHTYPE, |
BFD_RELOC_C6000_PCR_H16, |
BFD_RELOC_C6000_PCR_L16, |
BFD_RELOC_C6000_ALIGN, |
BFD_RELOC_C6000_FPHEAD, |
BFD_RELOC_C6000_NOCMP, |
/* This is a 48 bit reloc for the FR30 that stores 32 bits. */ |
BFD_RELOC_FR30_48, |
/* This is a 32 bit reloc for the FR30 that stores 20 bits split up into |
two sections. */ |
BFD_RELOC_FR30_20, |
/* This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in |
4 bits. */ |
BFD_RELOC_FR30_6_IN_4, |
/* This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset |
into 8 bits. */ |
BFD_RELOC_FR30_8_IN_8, |
/* This is a 16 bit reloc for the FR30 that stores a 9 bit short offset |
into 8 bits. */ |
BFD_RELOC_FR30_9_IN_8, |
/* This is a 16 bit reloc for the FR30 that stores a 10 bit word offset |
into 8 bits. */ |
BFD_RELOC_FR30_10_IN_8, |
/* This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative |
short offset into 8 bits. */ |
BFD_RELOC_FR30_9_PCREL, |
/* This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative |
short offset into 11 bits. */ |
BFD_RELOC_FR30_12_PCREL, |
/* Motorola Mcore relocations. */ |
BFD_RELOC_MCORE_PCREL_IMM8BY4, |
BFD_RELOC_MCORE_PCREL_IMM11BY2, |
BFD_RELOC_MCORE_PCREL_IMM4BY2, |
BFD_RELOC_MCORE_PCREL_32, |
BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2, |
BFD_RELOC_MCORE_RVA, |
/* Toshiba Media Processor Relocations. */ |
BFD_RELOC_MEP_8, |
BFD_RELOC_MEP_16, |
BFD_RELOC_MEP_32, |
BFD_RELOC_MEP_PCREL8A2, |
BFD_RELOC_MEP_PCREL12A2, |
BFD_RELOC_MEP_PCREL17A2, |
BFD_RELOC_MEP_PCREL24A2, |
BFD_RELOC_MEP_PCABS24A2, |
BFD_RELOC_MEP_LOW16, |
BFD_RELOC_MEP_HI16U, |
BFD_RELOC_MEP_HI16S, |
BFD_RELOC_MEP_GPREL, |
BFD_RELOC_MEP_TPREL, |
BFD_RELOC_MEP_TPREL7, |
BFD_RELOC_MEP_TPREL7A2, |
BFD_RELOC_MEP_TPREL7A4, |
BFD_RELOC_MEP_UIMM24, |
BFD_RELOC_MEP_ADDR24A4, |
BFD_RELOC_MEP_GNU_VTINHERIT, |
BFD_RELOC_MEP_GNU_VTENTRY, |
/* Imagination Technologies Meta relocations. */ |
BFD_RELOC_METAG_HIADDR16, |
BFD_RELOC_METAG_LOADDR16, |
BFD_RELOC_METAG_RELBRANCH, |
BFD_RELOC_METAG_GETSETOFF, |
BFD_RELOC_METAG_HIOG, |
BFD_RELOC_METAG_LOOG, |
BFD_RELOC_METAG_REL8, |
BFD_RELOC_METAG_REL16, |
BFD_RELOC_METAG_HI16_GOTOFF, |
BFD_RELOC_METAG_LO16_GOTOFF, |
BFD_RELOC_METAG_GETSET_GOTOFF, |
BFD_RELOC_METAG_GETSET_GOT, |
BFD_RELOC_METAG_HI16_GOTPC, |
BFD_RELOC_METAG_LO16_GOTPC, |
BFD_RELOC_METAG_HI16_PLT, |
BFD_RELOC_METAG_LO16_PLT, |
BFD_RELOC_METAG_RELBRANCH_PLT, |
BFD_RELOC_METAG_GOTOFF, |
BFD_RELOC_METAG_PLT, |
BFD_RELOC_METAG_COPY, |
BFD_RELOC_METAG_JMP_SLOT, |
BFD_RELOC_METAG_RELATIVE, |
BFD_RELOC_METAG_GLOB_DAT, |
BFD_RELOC_METAG_TLS_GD, |
BFD_RELOC_METAG_TLS_LDM, |
BFD_RELOC_METAG_TLS_LDO_HI16, |
BFD_RELOC_METAG_TLS_LDO_LO16, |
BFD_RELOC_METAG_TLS_LDO, |
BFD_RELOC_METAG_TLS_IE, |
BFD_RELOC_METAG_TLS_IENONPIC, |
BFD_RELOC_METAG_TLS_IENONPIC_HI16, |
BFD_RELOC_METAG_TLS_IENONPIC_LO16, |
BFD_RELOC_METAG_TLS_TPOFF, |
BFD_RELOC_METAG_TLS_DTPMOD, |
BFD_RELOC_METAG_TLS_DTPOFF, |
BFD_RELOC_METAG_TLS_LE, |
BFD_RELOC_METAG_TLS_LE_HI16, |
BFD_RELOC_METAG_TLS_LE_LO16, |
/* These are relocations for the GETA instruction. */ |
BFD_RELOC_MMIX_GETA, |
BFD_RELOC_MMIX_GETA_1, |
BFD_RELOC_MMIX_GETA_2, |
BFD_RELOC_MMIX_GETA_3, |
/* These are relocations for a conditional branch instruction. */ |
BFD_RELOC_MMIX_CBRANCH, |
BFD_RELOC_MMIX_CBRANCH_J, |
BFD_RELOC_MMIX_CBRANCH_1, |
BFD_RELOC_MMIX_CBRANCH_2, |
BFD_RELOC_MMIX_CBRANCH_3, |
/* These are relocations for the PUSHJ instruction. */ |
BFD_RELOC_MMIX_PUSHJ, |
BFD_RELOC_MMIX_PUSHJ_1, |
BFD_RELOC_MMIX_PUSHJ_2, |
BFD_RELOC_MMIX_PUSHJ_3, |
BFD_RELOC_MMIX_PUSHJ_STUBBABLE, |
/* These are relocations for the JMP instruction. */ |
BFD_RELOC_MMIX_JMP, |
BFD_RELOC_MMIX_JMP_1, |
BFD_RELOC_MMIX_JMP_2, |
BFD_RELOC_MMIX_JMP_3, |
/* This is a relocation for a relative address as in a GETA instruction or |
a branch. */ |
BFD_RELOC_MMIX_ADDR19, |
/* This is a relocation for a relative address as in a JMP instruction. */ |
BFD_RELOC_MMIX_ADDR27, |
/* This is a relocation for an instruction field that may be a general |
register or a value 0..255. */ |
BFD_RELOC_MMIX_REG_OR_BYTE, |
/* This is a relocation for an instruction field that may be a general |
register. */ |
BFD_RELOC_MMIX_REG, |
/* This is a relocation for two instruction fields holding a register and |
an offset, the equivalent of the relocation. */ |
BFD_RELOC_MMIX_BASE_PLUS_OFFSET, |
/* This relocation is an assertion that the expression is not allocated as |
a global register. It does not modify contents. */ |
BFD_RELOC_MMIX_LOCAL, |
/* This is a 16 bit reloc for the AVR that stores 8 bit pc relative |
short offset into 7 bits. */ |
BFD_RELOC_AVR_7_PCREL, |
/* This is a 16 bit reloc for the AVR that stores 13 bit pc relative |
short offset into 12 bits. */ |
BFD_RELOC_AVR_13_PCREL, |
/* This is a 16 bit reloc for the AVR that stores 17 bit value (usually |
program memory address) into 16 bits. */ |
BFD_RELOC_AVR_16_PM, |
/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually |
data memory address) into 8 bit immediate value of LDI insn. */ |
BFD_RELOC_AVR_LO8_LDI, |
/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit |
of data memory address) into 8 bit immediate value of LDI insn. */ |
BFD_RELOC_AVR_HI8_LDI, |
/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit |
of program memory address) into 8 bit immediate value of LDI insn. */ |
BFD_RELOC_AVR_HH8_LDI, |
/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit |
of 32 bit value) into 8 bit immediate value of LDI insn. */ |
BFD_RELOC_AVR_MS8_LDI, |
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value |
(usually data memory address) into 8 bit immediate value of SUBI insn. */ |
BFD_RELOC_AVR_LO8_LDI_NEG, |
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value |
(high 8 bit of data memory address) into 8 bit immediate value of |
SUBI insn. */ |
BFD_RELOC_AVR_HI8_LDI_NEG, |
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value |
(most high 8 bit of program memory address) into 8 bit immediate value |
of LDI or SUBI insn. */ |
BFD_RELOC_AVR_HH8_LDI_NEG, |
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value (msb |
of 32 bit value) into 8 bit immediate value of LDI insn. */ |
BFD_RELOC_AVR_MS8_LDI_NEG, |
/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually |
command address) into 8 bit immediate value of LDI insn. */ |
BFD_RELOC_AVR_LO8_LDI_PM, |
/* This is a 16 bit reloc for the AVR that stores 8 bit value |
(command address) into 8 bit immediate value of LDI insn. If the address |
is beyond the 128k boundary, the linker inserts a jump stub for this reloc |
in the lower 128k. */ |
BFD_RELOC_AVR_LO8_LDI_GS, |
/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit |
of command address) into 8 bit immediate value of LDI insn. */ |
BFD_RELOC_AVR_HI8_LDI_PM, |
/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit |
of command address) into 8 bit immediate value of LDI insn. If the address |
is beyond the 128k boundary, the linker inserts a jump stub for this reloc |
below 128k. */ |
BFD_RELOC_AVR_HI8_LDI_GS, |
/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit |
of command address) into 8 bit immediate value of LDI insn. */ |
BFD_RELOC_AVR_HH8_LDI_PM, |
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value |
(usually command address) into 8 bit immediate value of SUBI insn. */ |
BFD_RELOC_AVR_LO8_LDI_PM_NEG, |
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value |
(high 8 bit of 16 bit command address) into 8 bit immediate value |
of SUBI insn. */ |
BFD_RELOC_AVR_HI8_LDI_PM_NEG, |
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value |
(high 6 bit of 22 bit command address) into 8 bit immediate |
value of SUBI insn. */ |
BFD_RELOC_AVR_HH8_LDI_PM_NEG, |
/* This is a 32 bit reloc for the AVR that stores 23 bit value |
into 22 bits. */ |
BFD_RELOC_AVR_CALL, |
/* This is a 16 bit reloc for the AVR that stores all needed bits |
for absolute addressing with ldi with overflow check to linktime */ |
BFD_RELOC_AVR_LDI, |
/* This is a 6 bit reloc for the AVR that stores offset for ldd/std |
instructions */ |
BFD_RELOC_AVR_6, |
/* This is a 6 bit reloc for the AVR that stores offset for adiw/sbiw |
instructions */ |
BFD_RELOC_AVR_6_ADIW, |
/* This is a 8 bit reloc for the AVR that stores bits 0..7 of a symbol |
in .byte lo8(symbol) */ |
BFD_RELOC_AVR_8_LO, |
/* This is a 8 bit reloc for the AVR that stores bits 8..15 of a symbol |
in .byte hi8(symbol) */ |
BFD_RELOC_AVR_8_HI, |
/* This is a 8 bit reloc for the AVR that stores bits 16..23 of a symbol |
in .byte hlo8(symbol) */ |
BFD_RELOC_AVR_8_HLO, |
/* AVR relocations to mark the difference of two local symbols. |
These are only needed to support linker relaxation and can be ignored |
when not relaxing. The field is set to the value of the difference |
assuming no relaxation. The relocation encodes the position of the |
second symbol so the linker can determine whether to adjust the field |
value. */ |
BFD_RELOC_AVR_DIFF8, |
BFD_RELOC_AVR_DIFF16, |
BFD_RELOC_AVR_DIFF32, |
/* This is a 7 bit reloc for the AVR that stores SRAM address for 16bit |
lds and sts instructions supported only tiny core. */ |
BFD_RELOC_AVR_LDS_STS_16, |
/* This is a 6 bit reloc for the AVR that stores an I/O register |
number for the IN and OUT instructions */ |
BFD_RELOC_AVR_PORT6, |
/* This is a 5 bit reloc for the AVR that stores an I/O register |
number for the SBIC, SBIS, SBI and CBI instructions */ |
BFD_RELOC_AVR_PORT5, |
/* Renesas RL78 Relocations. */ |
BFD_RELOC_RL78_NEG8, |
BFD_RELOC_RL78_NEG16, |
BFD_RELOC_RL78_NEG24, |
BFD_RELOC_RL78_NEG32, |
BFD_RELOC_RL78_16_OP, |
BFD_RELOC_RL78_24_OP, |
BFD_RELOC_RL78_32_OP, |
BFD_RELOC_RL78_8U, |
BFD_RELOC_RL78_16U, |
BFD_RELOC_RL78_24U, |
BFD_RELOC_RL78_DIR3U_PCREL, |
BFD_RELOC_RL78_DIFF, |
BFD_RELOC_RL78_GPRELB, |
BFD_RELOC_RL78_GPRELW, |
BFD_RELOC_RL78_GPRELL, |
BFD_RELOC_RL78_SYM, |
BFD_RELOC_RL78_OP_SUBTRACT, |
BFD_RELOC_RL78_OP_NEG, |
BFD_RELOC_RL78_OP_AND, |
BFD_RELOC_RL78_OP_SHRA, |
BFD_RELOC_RL78_ABS8, |
BFD_RELOC_RL78_ABS16, |
BFD_RELOC_RL78_ABS16_REV, |
BFD_RELOC_RL78_ABS32, |
BFD_RELOC_RL78_ABS32_REV, |
BFD_RELOC_RL78_ABS16U, |
BFD_RELOC_RL78_ABS16UW, |
BFD_RELOC_RL78_ABS16UL, |
BFD_RELOC_RL78_RELAX, |
BFD_RELOC_RL78_HI16, |
BFD_RELOC_RL78_HI8, |
BFD_RELOC_RL78_LO16, |
BFD_RELOC_RL78_CODE, |
BFD_RELOC_RL78_SADDR, |
/* Renesas RX Relocations. */ |
BFD_RELOC_RX_NEG8, |
BFD_RELOC_RX_NEG16, |
BFD_RELOC_RX_NEG24, |
BFD_RELOC_RX_NEG32, |
BFD_RELOC_RX_16_OP, |
BFD_RELOC_RX_24_OP, |
BFD_RELOC_RX_32_OP, |
BFD_RELOC_RX_8U, |
BFD_RELOC_RX_16U, |
BFD_RELOC_RX_24U, |
BFD_RELOC_RX_DIR3U_PCREL, |
BFD_RELOC_RX_DIFF, |
BFD_RELOC_RX_GPRELB, |
BFD_RELOC_RX_GPRELW, |
BFD_RELOC_RX_GPRELL, |
BFD_RELOC_RX_SYM, |
BFD_RELOC_RX_OP_SUBTRACT, |
BFD_RELOC_RX_OP_NEG, |
BFD_RELOC_RX_ABS8, |
BFD_RELOC_RX_ABS16, |
BFD_RELOC_RX_ABS16_REV, |
BFD_RELOC_RX_ABS32, |
BFD_RELOC_RX_ABS32_REV, |
BFD_RELOC_RX_ABS16U, |
BFD_RELOC_RX_ABS16UW, |
BFD_RELOC_RX_ABS16UL, |
BFD_RELOC_RX_RELAX, |
/* Direct 12 bit. */ |
BFD_RELOC_390_12, |
/* 12 bit GOT offset. */ |
BFD_RELOC_390_GOT12, |
/* 32 bit PC relative PLT address. */ |
BFD_RELOC_390_PLT32, |
/* Copy symbol at runtime. */ |
BFD_RELOC_390_COPY, |
/* Create GOT entry. */ |
BFD_RELOC_390_GLOB_DAT, |
/* Create PLT entry. */ |
BFD_RELOC_390_JMP_SLOT, |
/* Adjust by program base. */ |
BFD_RELOC_390_RELATIVE, |
/* 32 bit PC relative offset to GOT. */ |
BFD_RELOC_390_GOTPC, |
/* 16 bit GOT offset. */ |
BFD_RELOC_390_GOT16, |
/* PC relative 12 bit shifted by 1. */ |
BFD_RELOC_390_PC12DBL, |
/* 12 bit PC rel. PLT shifted by 1. */ |
BFD_RELOC_390_PLT12DBL, |
/* PC relative 16 bit shifted by 1. */ |
BFD_RELOC_390_PC16DBL, |
/* 16 bit PC rel. PLT shifted by 1. */ |
BFD_RELOC_390_PLT16DBL, |
/* PC relative 24 bit shifted by 1. */ |
BFD_RELOC_390_PC24DBL, |
/* 24 bit PC rel. PLT shifted by 1. */ |
BFD_RELOC_390_PLT24DBL, |
/* PC relative 32 bit shifted by 1. */ |
BFD_RELOC_390_PC32DBL, |
/* 32 bit PC rel. PLT shifted by 1. */ |
BFD_RELOC_390_PLT32DBL, |
/* 32 bit PC rel. GOT shifted by 1. */ |
BFD_RELOC_390_GOTPCDBL, |
/* 64 bit GOT offset. */ |
BFD_RELOC_390_GOT64, |
/* 64 bit PC relative PLT address. */ |
BFD_RELOC_390_PLT64, |
/* 32 bit rel. offset to GOT entry. */ |
BFD_RELOC_390_GOTENT, |
/* 64 bit offset to GOT. */ |
BFD_RELOC_390_GOTOFF64, |
/* 12-bit offset to symbol-entry within GOT, with PLT handling. */ |
BFD_RELOC_390_GOTPLT12, |
/* 16-bit offset to symbol-entry within GOT, with PLT handling. */ |
BFD_RELOC_390_GOTPLT16, |
/* 32-bit offset to symbol-entry within GOT, with PLT handling. */ |
BFD_RELOC_390_GOTPLT32, |
/* 64-bit offset to symbol-entry within GOT, with PLT handling. */ |
BFD_RELOC_390_GOTPLT64, |
/* 32-bit rel. offset to symbol-entry within GOT, with PLT handling. */ |
BFD_RELOC_390_GOTPLTENT, |
/* 16-bit rel. offset from the GOT to a PLT entry. */ |
BFD_RELOC_390_PLTOFF16, |
/* 32-bit rel. offset from the GOT to a PLT entry. */ |
BFD_RELOC_390_PLTOFF32, |
/* 64-bit rel. offset from the GOT to a PLT entry. */ |
BFD_RELOC_390_PLTOFF64, |
/* s390 tls relocations. */ |
BFD_RELOC_390_TLS_LOAD, |
BFD_RELOC_390_TLS_GDCALL, |
BFD_RELOC_390_TLS_LDCALL, |
BFD_RELOC_390_TLS_GD32, |
BFD_RELOC_390_TLS_GD64, |
BFD_RELOC_390_TLS_GOTIE12, |
BFD_RELOC_390_TLS_GOTIE32, |
BFD_RELOC_390_TLS_GOTIE64, |
BFD_RELOC_390_TLS_LDM32, |
BFD_RELOC_390_TLS_LDM64, |
BFD_RELOC_390_TLS_IE32, |
BFD_RELOC_390_TLS_IE64, |
BFD_RELOC_390_TLS_IEENT, |
BFD_RELOC_390_TLS_LE32, |
BFD_RELOC_390_TLS_LE64, |
BFD_RELOC_390_TLS_LDO32, |
BFD_RELOC_390_TLS_LDO64, |
BFD_RELOC_390_TLS_DTPMOD, |
BFD_RELOC_390_TLS_DTPOFF, |
BFD_RELOC_390_TLS_TPOFF, |
/* Long displacement extension. */ |
BFD_RELOC_390_20, |
BFD_RELOC_390_GOT20, |
BFD_RELOC_390_GOTPLT20, |
BFD_RELOC_390_TLS_GOTIE20, |
/* STT_GNU_IFUNC relocation. */ |
BFD_RELOC_390_IRELATIVE, |
/* Score relocations |
Low 16 bit for load/store */ |
BFD_RELOC_SCORE_GPREL15, |
/* This is a 24-bit reloc with the right 1 bit assumed to be 0 */ |
BFD_RELOC_SCORE_DUMMY2, |
BFD_RELOC_SCORE_JMP, |
/* This is a 19-bit reloc with the right 1 bit assumed to be 0 */ |
BFD_RELOC_SCORE_BRANCH, |
/* This is a 32-bit reloc for 48-bit instructions. */ |
BFD_RELOC_SCORE_IMM30, |
/* This is a 32-bit reloc for 48-bit instructions. */ |
BFD_RELOC_SCORE_IMM32, |
/* This is a 11-bit reloc with the right 1 bit assumed to be 0 */ |
BFD_RELOC_SCORE16_JMP, |
/* This is a 8-bit reloc with the right 1 bit assumed to be 0 */ |
BFD_RELOC_SCORE16_BRANCH, |
/* This is a 9-bit reloc with the right 1 bit assumed to be 0 */ |
BFD_RELOC_SCORE_BCMP, |
/* Undocumented Score relocs */ |
BFD_RELOC_SCORE_GOT15, |
BFD_RELOC_SCORE_GOT_LO16, |
BFD_RELOC_SCORE_CALL15, |
BFD_RELOC_SCORE_DUMMY_HI16, |
/* Scenix IP2K - 9-bit register number / data address */ |
BFD_RELOC_IP2K_FR9, |
/* Scenix IP2K - 4-bit register/data bank number */ |
BFD_RELOC_IP2K_BANK, |
/* Scenix IP2K - low 13 bits of instruction word address */ |
BFD_RELOC_IP2K_ADDR16CJP, |
/* Scenix IP2K - high 3 bits of instruction word address */ |
BFD_RELOC_IP2K_PAGE3, |
/* Scenix IP2K - ext/low/high 8 bits of data address */ |
BFD_RELOC_IP2K_LO8DATA, |
BFD_RELOC_IP2K_HI8DATA, |
BFD_RELOC_IP2K_EX8DATA, |
/* Scenix IP2K - low/high 8 bits of instruction word address */ |
BFD_RELOC_IP2K_LO8INSN, |
BFD_RELOC_IP2K_HI8INSN, |
/* Scenix IP2K - even/odd PC modifier to modify snb pcl.0 */ |
BFD_RELOC_IP2K_PC_SKIP, |
/* Scenix IP2K - 16 bit word address in text section. */ |
BFD_RELOC_IP2K_TEXT, |
/* Scenix IP2K - 7-bit sp or dp offset */ |
BFD_RELOC_IP2K_FR_OFFSET, |
/* Scenix VPE4K coprocessor - data/insn-space addressing */ |
BFD_RELOC_VPE4KMATH_DATA, |
BFD_RELOC_VPE4KMATH_INSN, |
/* These two relocations are used by the linker to determine which of |
the entries in a C++ virtual function table are actually used. When |
the --gc-sections option is given, the linker will zero out the entries |
that are not used, so that the code for those functions need not be |
included in the output. |
VTABLE_INHERIT is a zero-space relocation used to describe to the |
linker the inheritance tree of a C++ virtual function table. The |
relocation's symbol should be the parent class' vtable, and the |
relocation should be located at the child vtable. |
VTABLE_ENTRY is a zero-space relocation that describes the use of a |
virtual function table entry. The reloc's symbol should refer to the |
table of the class mentioned in the code. Off of that base, an offset |
describes the entry that is being used. For Rela hosts, this offset |
is stored in the reloc's addend. For Rel hosts, we are forced to put |
this offset in the reloc's section offset. */ |
BFD_RELOC_VTABLE_INHERIT, |
BFD_RELOC_VTABLE_ENTRY, |
/* Intel IA64 Relocations. */ |
BFD_RELOC_IA64_IMM14, |
BFD_RELOC_IA64_IMM22, |
BFD_RELOC_IA64_IMM64, |
BFD_RELOC_IA64_DIR32MSB, |
BFD_RELOC_IA64_DIR32LSB, |
BFD_RELOC_IA64_DIR64MSB, |
BFD_RELOC_IA64_DIR64LSB, |
BFD_RELOC_IA64_GPREL22, |
BFD_RELOC_IA64_GPREL64I, |
BFD_RELOC_IA64_GPREL32MSB, |
BFD_RELOC_IA64_GPREL32LSB, |
BFD_RELOC_IA64_GPREL64MSB, |
BFD_RELOC_IA64_GPREL64LSB, |
BFD_RELOC_IA64_LTOFF22, |
BFD_RELOC_IA64_LTOFF64I, |
BFD_RELOC_IA64_PLTOFF22, |
BFD_RELOC_IA64_PLTOFF64I, |
BFD_RELOC_IA64_PLTOFF64MSB, |
BFD_RELOC_IA64_PLTOFF64LSB, |
BFD_RELOC_IA64_FPTR64I, |
BFD_RELOC_IA64_FPTR32MSB, |
BFD_RELOC_IA64_FPTR32LSB, |
BFD_RELOC_IA64_FPTR64MSB, |
BFD_RELOC_IA64_FPTR64LSB, |
BFD_RELOC_IA64_PCREL21B, |
BFD_RELOC_IA64_PCREL21BI, |
BFD_RELOC_IA64_PCREL21M, |
BFD_RELOC_IA64_PCREL21F, |
BFD_RELOC_IA64_PCREL22, |
BFD_RELOC_IA64_PCREL60B, |
BFD_RELOC_IA64_PCREL64I, |
BFD_RELOC_IA64_PCREL32MSB, |
BFD_RELOC_IA64_PCREL32LSB, |
BFD_RELOC_IA64_PCREL64MSB, |
BFD_RELOC_IA64_PCREL64LSB, |
BFD_RELOC_IA64_LTOFF_FPTR22, |
BFD_RELOC_IA64_LTOFF_FPTR64I, |
BFD_RELOC_IA64_LTOFF_FPTR32MSB, |
BFD_RELOC_IA64_LTOFF_FPTR32LSB, |
BFD_RELOC_IA64_LTOFF_FPTR64MSB, |
BFD_RELOC_IA64_LTOFF_FPTR64LSB, |
BFD_RELOC_IA64_SEGREL32MSB, |
BFD_RELOC_IA64_SEGREL32LSB, |
BFD_RELOC_IA64_SEGREL64MSB, |
BFD_RELOC_IA64_SEGREL64LSB, |
BFD_RELOC_IA64_SECREL32MSB, |
BFD_RELOC_IA64_SECREL32LSB, |
BFD_RELOC_IA64_SECREL64MSB, |
BFD_RELOC_IA64_SECREL64LSB, |
BFD_RELOC_IA64_REL32MSB, |
BFD_RELOC_IA64_REL32LSB, |
BFD_RELOC_IA64_REL64MSB, |
BFD_RELOC_IA64_REL64LSB, |
BFD_RELOC_IA64_LTV32MSB, |
BFD_RELOC_IA64_LTV32LSB, |
BFD_RELOC_IA64_LTV64MSB, |
BFD_RELOC_IA64_LTV64LSB, |
BFD_RELOC_IA64_IPLTMSB, |
BFD_RELOC_IA64_IPLTLSB, |
BFD_RELOC_IA64_COPY, |
BFD_RELOC_IA64_LTOFF22X, |
BFD_RELOC_IA64_LDXMOV, |
BFD_RELOC_IA64_TPREL14, |
BFD_RELOC_IA64_TPREL22, |
BFD_RELOC_IA64_TPREL64I, |
BFD_RELOC_IA64_TPREL64MSB, |
BFD_RELOC_IA64_TPREL64LSB, |
BFD_RELOC_IA64_LTOFF_TPREL22, |
BFD_RELOC_IA64_DTPMOD64MSB, |
BFD_RELOC_IA64_DTPMOD64LSB, |
BFD_RELOC_IA64_LTOFF_DTPMOD22, |
BFD_RELOC_IA64_DTPREL14, |
BFD_RELOC_IA64_DTPREL22, |
BFD_RELOC_IA64_DTPREL64I, |
BFD_RELOC_IA64_DTPREL32MSB, |
BFD_RELOC_IA64_DTPREL32LSB, |
BFD_RELOC_IA64_DTPREL64MSB, |
BFD_RELOC_IA64_DTPREL64LSB, |
BFD_RELOC_IA64_LTOFF_DTPREL22, |
/* Motorola 68HC11 reloc. |
This is the 8 bit high part of an absolute address. */ |
BFD_RELOC_M68HC11_HI8, |
/* Motorola 68HC11 reloc. |
This is the 8 bit low part of an absolute address. */ |
BFD_RELOC_M68HC11_LO8, |
/* Motorola 68HC11 reloc. |
This is the 3 bit of a value. */ |
BFD_RELOC_M68HC11_3B, |
/* Motorola 68HC11 reloc. |
This reloc marks the beginning of a jump/call instruction. |
It is used for linker relaxation to correctly identify beginning |
of instruction and change some branches to use PC-relative |
addressing mode. */ |
BFD_RELOC_M68HC11_RL_JUMP, |
/* Motorola 68HC11 reloc. |
This reloc marks a group of several instructions that gcc generates |
and for which the linker relaxation pass can modify and/or remove |
some of them. */ |
BFD_RELOC_M68HC11_RL_GROUP, |
/* Motorola 68HC11 reloc. |
This is the 16-bit lower part of an address. It is used for 'call' |
instruction to specify the symbol address without any special |
transformation (due to memory bank window). */ |
BFD_RELOC_M68HC11_LO16, |
/* Motorola 68HC11 reloc. |
This is a 8-bit reloc that specifies the page number of an address. |
It is used by 'call' instruction to specify the page number of |
the symbol. */ |
BFD_RELOC_M68HC11_PAGE, |
/* Motorola 68HC11 reloc. |
This is a 24-bit reloc that represents the address with a 16-bit |
value and a 8-bit page number. The symbol address is transformed |
to follow the 16K memory bank of 68HC12 (seen as mapped in the window). */ |
BFD_RELOC_M68HC11_24, |
/* Motorola 68HC12 reloc. |
This is the 5 bits of a value. */ |
BFD_RELOC_M68HC12_5B, |
/* Freescale XGATE reloc. |
This reloc marks the beginning of a bra/jal instruction. */ |
BFD_RELOC_XGATE_RL_JUMP, |
/* Freescale XGATE reloc. |
This reloc marks a group of several instructions that gcc generates |
and for which the linker relaxation pass can modify and/or remove |
some of them. */ |
BFD_RELOC_XGATE_RL_GROUP, |
/* Freescale XGATE reloc. |
This is the 16-bit lower part of an address. It is used for the '16-bit' |
instructions. */ |
BFD_RELOC_XGATE_LO16, |
/* Freescale XGATE reloc. */ |
BFD_RELOC_XGATE_GPAGE, |
/* Freescale XGATE reloc. */ |
BFD_RELOC_XGATE_24, |
/* Freescale XGATE reloc. |
This is a 9-bit pc-relative reloc. */ |
BFD_RELOC_XGATE_PCREL_9, |
/* Freescale XGATE reloc. |
This is a 10-bit pc-relative reloc. */ |
BFD_RELOC_XGATE_PCREL_10, |
/* Freescale XGATE reloc. |
This is the 16-bit lower part of an address. It is used for the '16-bit' |
instructions. */ |
BFD_RELOC_XGATE_IMM8_LO, |
/* Freescale XGATE reloc. |
This is the 16-bit higher part of an address. It is used for the '16-bit' |
instructions. */ |
BFD_RELOC_XGATE_IMM8_HI, |
/* Freescale XGATE reloc. |
This is a 3-bit pc-relative reloc. */ |
BFD_RELOC_XGATE_IMM3, |
/* Freescale XGATE reloc. |
This is a 4-bit pc-relative reloc. */ |
BFD_RELOC_XGATE_IMM4, |
/* Freescale XGATE reloc. |
This is a 5-bit pc-relative reloc. */ |
BFD_RELOC_XGATE_IMM5, |
/* Motorola 68HC12 reloc. |
This is the 9 bits of a value. */ |
BFD_RELOC_M68HC12_9B, |
/* Motorola 68HC12 reloc. |
This is the 16 bits of a value. */ |
BFD_RELOC_M68HC12_16B, |
/* Motorola 68HC12/XGATE reloc. |
This is a PCREL9 branch. */ |
BFD_RELOC_M68HC12_9_PCREL, |
/* Motorola 68HC12/XGATE reloc. |
This is a PCREL10 branch. */ |
BFD_RELOC_M68HC12_10_PCREL, |
/* Motorola 68HC12/XGATE reloc. |
This is the 8 bit low part of an absolute address and immediately precedes |
a matching HI8XG part. */ |
BFD_RELOC_M68HC12_LO8XG, |
/* Motorola 68HC12/XGATE reloc. |
This is the 8 bit high part of an absolute address and immediately follows |
a matching LO8XG part. */ |
BFD_RELOC_M68HC12_HI8XG, |
/* NS CR16C Relocations. */ |
BFD_RELOC_16C_NUM08, |
BFD_RELOC_16C_NUM08_C, |
BFD_RELOC_16C_NUM16, |
BFD_RELOC_16C_NUM16_C, |
BFD_RELOC_16C_NUM32, |
BFD_RELOC_16C_NUM32_C, |
BFD_RELOC_16C_DISP04, |
BFD_RELOC_16C_DISP04_C, |
BFD_RELOC_16C_DISP08, |
BFD_RELOC_16C_DISP08_C, |
BFD_RELOC_16C_DISP16, |
BFD_RELOC_16C_DISP16_C, |
BFD_RELOC_16C_DISP24, |
BFD_RELOC_16C_DISP24_C, |
BFD_RELOC_16C_DISP24a, |
BFD_RELOC_16C_DISP24a_C, |
BFD_RELOC_16C_REG04, |
BFD_RELOC_16C_REG04_C, |
BFD_RELOC_16C_REG04a, |
BFD_RELOC_16C_REG04a_C, |
BFD_RELOC_16C_REG14, |
BFD_RELOC_16C_REG14_C, |
BFD_RELOC_16C_REG16, |
BFD_RELOC_16C_REG16_C, |
BFD_RELOC_16C_REG20, |
BFD_RELOC_16C_REG20_C, |
BFD_RELOC_16C_ABS20, |
BFD_RELOC_16C_ABS20_C, |
BFD_RELOC_16C_ABS24, |
BFD_RELOC_16C_ABS24_C, |
BFD_RELOC_16C_IMM04, |
BFD_RELOC_16C_IMM04_C, |
BFD_RELOC_16C_IMM16, |
BFD_RELOC_16C_IMM16_C, |
BFD_RELOC_16C_IMM20, |
BFD_RELOC_16C_IMM20_C, |
BFD_RELOC_16C_IMM24, |
BFD_RELOC_16C_IMM24_C, |
BFD_RELOC_16C_IMM32, |
BFD_RELOC_16C_IMM32_C, |
/* NS CR16 Relocations. */ |
BFD_RELOC_CR16_NUM8, |
BFD_RELOC_CR16_NUM16, |
BFD_RELOC_CR16_NUM32, |
BFD_RELOC_CR16_NUM32a, |
BFD_RELOC_CR16_REGREL0, |
BFD_RELOC_CR16_REGREL4, |
BFD_RELOC_CR16_REGREL4a, |
BFD_RELOC_CR16_REGREL14, |
BFD_RELOC_CR16_REGREL14a, |
BFD_RELOC_CR16_REGREL16, |
BFD_RELOC_CR16_REGREL20, |
BFD_RELOC_CR16_REGREL20a, |
BFD_RELOC_CR16_ABS20, |
BFD_RELOC_CR16_ABS24, |
BFD_RELOC_CR16_IMM4, |
BFD_RELOC_CR16_IMM8, |
BFD_RELOC_CR16_IMM16, |
BFD_RELOC_CR16_IMM20, |
BFD_RELOC_CR16_IMM24, |
BFD_RELOC_CR16_IMM32, |
BFD_RELOC_CR16_IMM32a, |
BFD_RELOC_CR16_DISP4, |
BFD_RELOC_CR16_DISP8, |
BFD_RELOC_CR16_DISP16, |
BFD_RELOC_CR16_DISP20, |
BFD_RELOC_CR16_DISP24, |
BFD_RELOC_CR16_DISP24a, |
BFD_RELOC_CR16_SWITCH8, |
BFD_RELOC_CR16_SWITCH16, |
BFD_RELOC_CR16_SWITCH32, |
BFD_RELOC_CR16_GOT_REGREL20, |
BFD_RELOC_CR16_GOTC_REGREL20, |
BFD_RELOC_CR16_GLOB_DAT, |
/* NS CRX Relocations. */ |
BFD_RELOC_CRX_REL4, |
BFD_RELOC_CRX_REL8, |
BFD_RELOC_CRX_REL8_CMP, |
BFD_RELOC_CRX_REL16, |
BFD_RELOC_CRX_REL24, |
BFD_RELOC_CRX_REL32, |
BFD_RELOC_CRX_REGREL12, |
BFD_RELOC_CRX_REGREL22, |
BFD_RELOC_CRX_REGREL28, |
BFD_RELOC_CRX_REGREL32, |
BFD_RELOC_CRX_ABS16, |
BFD_RELOC_CRX_ABS32, |
BFD_RELOC_CRX_NUM8, |
BFD_RELOC_CRX_NUM16, |
BFD_RELOC_CRX_NUM32, |
BFD_RELOC_CRX_IMM16, |
BFD_RELOC_CRX_IMM32, |
BFD_RELOC_CRX_SWITCH8, |
BFD_RELOC_CRX_SWITCH16, |
BFD_RELOC_CRX_SWITCH32, |
/* These relocs are only used within the CRIS assembler. They are not |
(at present) written to any object files. */ |
BFD_RELOC_CRIS_BDISP8, |
BFD_RELOC_CRIS_UNSIGNED_5, |
BFD_RELOC_CRIS_SIGNED_6, |
BFD_RELOC_CRIS_UNSIGNED_6, |
BFD_RELOC_CRIS_SIGNED_8, |
BFD_RELOC_CRIS_UNSIGNED_8, |
BFD_RELOC_CRIS_SIGNED_16, |
BFD_RELOC_CRIS_UNSIGNED_16, |
BFD_RELOC_CRIS_LAPCQ_OFFSET, |
BFD_RELOC_CRIS_UNSIGNED_4, |
/* Relocs used in ELF shared libraries for CRIS. */ |
BFD_RELOC_CRIS_COPY, |
BFD_RELOC_CRIS_GLOB_DAT, |
BFD_RELOC_CRIS_JUMP_SLOT, |
BFD_RELOC_CRIS_RELATIVE, |
/* 32-bit offset to symbol-entry within GOT. */ |
BFD_RELOC_CRIS_32_GOT, |
/* 16-bit offset to symbol-entry within GOT. */ |
BFD_RELOC_CRIS_16_GOT, |
/* 32-bit offset to symbol-entry within GOT, with PLT handling. */ |
BFD_RELOC_CRIS_32_GOTPLT, |
/* 16-bit offset to symbol-entry within GOT, with PLT handling. */ |
BFD_RELOC_CRIS_16_GOTPLT, |
/* 32-bit offset to symbol, relative to GOT. */ |
BFD_RELOC_CRIS_32_GOTREL, |
/* 32-bit offset to symbol with PLT entry, relative to GOT. */ |
BFD_RELOC_CRIS_32_PLT_GOTREL, |
/* 32-bit offset to symbol with PLT entry, relative to this relocation. */ |
BFD_RELOC_CRIS_32_PLT_PCREL, |
/* Relocs used in TLS code for CRIS. */ |
BFD_RELOC_CRIS_32_GOT_GD, |
BFD_RELOC_CRIS_16_GOT_GD, |
BFD_RELOC_CRIS_32_GD, |
BFD_RELOC_CRIS_DTP, |
BFD_RELOC_CRIS_32_DTPREL, |
BFD_RELOC_CRIS_16_DTPREL, |
BFD_RELOC_CRIS_32_GOT_TPREL, |
BFD_RELOC_CRIS_16_GOT_TPREL, |
BFD_RELOC_CRIS_32_TPREL, |
BFD_RELOC_CRIS_16_TPREL, |
BFD_RELOC_CRIS_DTPMOD, |
BFD_RELOC_CRIS_32_IE, |
/* Intel i860 Relocations. */ |
BFD_RELOC_860_COPY, |
BFD_RELOC_860_GLOB_DAT, |
BFD_RELOC_860_JUMP_SLOT, |
BFD_RELOC_860_RELATIVE, |
BFD_RELOC_860_PC26, |
BFD_RELOC_860_PLT26, |
BFD_RELOC_860_PC16, |
BFD_RELOC_860_LOW0, |
BFD_RELOC_860_SPLIT0, |
BFD_RELOC_860_LOW1, |
BFD_RELOC_860_SPLIT1, |
BFD_RELOC_860_LOW2, |
BFD_RELOC_860_SPLIT2, |
BFD_RELOC_860_LOW3, |
BFD_RELOC_860_LOGOT0, |
BFD_RELOC_860_SPGOT0, |
BFD_RELOC_860_LOGOT1, |
BFD_RELOC_860_SPGOT1, |
BFD_RELOC_860_LOGOTOFF0, |
BFD_RELOC_860_SPGOTOFF0, |
BFD_RELOC_860_LOGOTOFF1, |
BFD_RELOC_860_SPGOTOFF1, |
BFD_RELOC_860_LOGOTOFF2, |
BFD_RELOC_860_LOGOTOFF3, |
BFD_RELOC_860_LOPC, |
BFD_RELOC_860_HIGHADJ, |
BFD_RELOC_860_HAGOT, |
BFD_RELOC_860_HAGOTOFF, |
BFD_RELOC_860_HAPC, |
BFD_RELOC_860_HIGH, |
BFD_RELOC_860_HIGOT, |
BFD_RELOC_860_HIGOTOFF, |
/* OpenRISC 1000 Relocations. */ |
BFD_RELOC_OR1K_REL_26, |
BFD_RELOC_OR1K_GOTPC_HI16, |
BFD_RELOC_OR1K_GOTPC_LO16, |
BFD_RELOC_OR1K_GOT16, |
BFD_RELOC_OR1K_PLT26, |
BFD_RELOC_OR1K_GOTOFF_HI16, |
BFD_RELOC_OR1K_GOTOFF_LO16, |
BFD_RELOC_OR1K_COPY, |
BFD_RELOC_OR1K_GLOB_DAT, |
BFD_RELOC_OR1K_JMP_SLOT, |
BFD_RELOC_OR1K_RELATIVE, |
BFD_RELOC_OR1K_TLS_GD_HI16, |
BFD_RELOC_OR1K_TLS_GD_LO16, |
BFD_RELOC_OR1K_TLS_LDM_HI16, |
BFD_RELOC_OR1K_TLS_LDM_LO16, |
BFD_RELOC_OR1K_TLS_LDO_HI16, |
BFD_RELOC_OR1K_TLS_LDO_LO16, |
BFD_RELOC_OR1K_TLS_IE_HI16, |
BFD_RELOC_OR1K_TLS_IE_LO16, |
BFD_RELOC_OR1K_TLS_LE_HI16, |
BFD_RELOC_OR1K_TLS_LE_LO16, |
BFD_RELOC_OR1K_TLS_TPOFF, |
BFD_RELOC_OR1K_TLS_DTPOFF, |
BFD_RELOC_OR1K_TLS_DTPMOD, |
/* H8 elf Relocations. */ |
BFD_RELOC_H8_DIR16A8, |
BFD_RELOC_H8_DIR16R8, |
BFD_RELOC_H8_DIR24A8, |
BFD_RELOC_H8_DIR24R8, |
BFD_RELOC_H8_DIR32A16, |
BFD_RELOC_H8_DISP32A16, |
/* Sony Xstormy16 Relocations. */ |
BFD_RELOC_XSTORMY16_REL_12, |
BFD_RELOC_XSTORMY16_12, |
BFD_RELOC_XSTORMY16_24, |
BFD_RELOC_XSTORMY16_FPTR16, |
/* Self-describing complex relocations. */ |
BFD_RELOC_RELC, |
/* Infineon Relocations. */ |
BFD_RELOC_XC16X_PAG, |
BFD_RELOC_XC16X_POF, |
BFD_RELOC_XC16X_SEG, |
BFD_RELOC_XC16X_SOF, |
/* Relocations used by VAX ELF. */ |
BFD_RELOC_VAX_GLOB_DAT, |
BFD_RELOC_VAX_JMP_SLOT, |
BFD_RELOC_VAX_RELATIVE, |
/* Morpho MT - 16 bit immediate relocation. */ |
BFD_RELOC_MT_PC16, |
/* Morpho MT - Hi 16 bits of an address. */ |
BFD_RELOC_MT_HI16, |
/* Morpho MT - Low 16 bits of an address. */ |
BFD_RELOC_MT_LO16, |
/* Morpho MT - Used to tell the linker which vtable entries are used. */ |
BFD_RELOC_MT_GNU_VTINHERIT, |
/* Morpho MT - Used to tell the linker which vtable entries are used. */ |
BFD_RELOC_MT_GNU_VTENTRY, |
/* Morpho MT - 8 bit immediate relocation. */ |
BFD_RELOC_MT_PCINSN8, |
/* msp430 specific relocation codes */ |
BFD_RELOC_MSP430_10_PCREL, |
BFD_RELOC_MSP430_16_PCREL, |
BFD_RELOC_MSP430_16, |
BFD_RELOC_MSP430_16_PCREL_BYTE, |
BFD_RELOC_MSP430_16_BYTE, |
BFD_RELOC_MSP430_2X_PCREL, |
BFD_RELOC_MSP430_RL_PCREL, |
BFD_RELOC_MSP430_ABS8, |
BFD_RELOC_MSP430X_PCR20_EXT_SRC, |
BFD_RELOC_MSP430X_PCR20_EXT_DST, |
BFD_RELOC_MSP430X_PCR20_EXT_ODST, |
BFD_RELOC_MSP430X_ABS20_EXT_SRC, |
BFD_RELOC_MSP430X_ABS20_EXT_DST, |
BFD_RELOC_MSP430X_ABS20_EXT_ODST, |
BFD_RELOC_MSP430X_ABS20_ADR_SRC, |
BFD_RELOC_MSP430X_ABS20_ADR_DST, |
BFD_RELOC_MSP430X_PCR16, |
BFD_RELOC_MSP430X_PCR20_CALL, |
BFD_RELOC_MSP430X_ABS16, |
BFD_RELOC_MSP430_ABS_HI16, |
BFD_RELOC_MSP430_PREL31, |
BFD_RELOC_MSP430_SYM_DIFF, |
/* Relocations used by the Altera Nios II core. */ |
BFD_RELOC_NIOS2_S16, |
BFD_RELOC_NIOS2_U16, |
BFD_RELOC_NIOS2_CALL26, |
BFD_RELOC_NIOS2_IMM5, |
BFD_RELOC_NIOS2_CACHE_OPX, |
BFD_RELOC_NIOS2_IMM6, |
BFD_RELOC_NIOS2_IMM8, |
BFD_RELOC_NIOS2_HI16, |
BFD_RELOC_NIOS2_LO16, |
BFD_RELOC_NIOS2_HIADJ16, |
BFD_RELOC_NIOS2_GPREL, |
BFD_RELOC_NIOS2_UJMP, |
BFD_RELOC_NIOS2_CJMP, |
BFD_RELOC_NIOS2_CALLR, |
BFD_RELOC_NIOS2_ALIGN, |
BFD_RELOC_NIOS2_GOT16, |
BFD_RELOC_NIOS2_CALL16, |
BFD_RELOC_NIOS2_GOTOFF_LO, |
BFD_RELOC_NIOS2_GOTOFF_HA, |
BFD_RELOC_NIOS2_PCREL_LO, |
BFD_RELOC_NIOS2_PCREL_HA, |
BFD_RELOC_NIOS2_TLS_GD16, |
BFD_RELOC_NIOS2_TLS_LDM16, |
BFD_RELOC_NIOS2_TLS_LDO16, |
BFD_RELOC_NIOS2_TLS_IE16, |
BFD_RELOC_NIOS2_TLS_LE16, |
BFD_RELOC_NIOS2_TLS_DTPMOD, |
BFD_RELOC_NIOS2_TLS_DTPREL, |
BFD_RELOC_NIOS2_TLS_TPREL, |
BFD_RELOC_NIOS2_COPY, |
BFD_RELOC_NIOS2_GLOB_DAT, |
BFD_RELOC_NIOS2_JUMP_SLOT, |
BFD_RELOC_NIOS2_RELATIVE, |
BFD_RELOC_NIOS2_GOTOFF, |
BFD_RELOC_NIOS2_CALL26_NOAT, |
BFD_RELOC_NIOS2_GOT_LO, |
BFD_RELOC_NIOS2_GOT_HA, |
BFD_RELOC_NIOS2_CALL_LO, |
BFD_RELOC_NIOS2_CALL_HA, |
BFD_RELOC_NIOS2_R2_S12, |
BFD_RELOC_NIOS2_R2_I10_1_PCREL, |
BFD_RELOC_NIOS2_R2_T1I7_1_PCREL, |
BFD_RELOC_NIOS2_R2_T1I7_2, |
BFD_RELOC_NIOS2_R2_T2I4, |
BFD_RELOC_NIOS2_R2_T2I4_1, |
BFD_RELOC_NIOS2_R2_T2I4_2, |
BFD_RELOC_NIOS2_R2_X1I7_2, |
BFD_RELOC_NIOS2_R2_X2L5, |
BFD_RELOC_NIOS2_R2_F1I5_2, |
BFD_RELOC_NIOS2_R2_L5I4X1, |
BFD_RELOC_NIOS2_R2_T1X1I6, |
BFD_RELOC_NIOS2_R2_T1X1I6_2, |
/* IQ2000 Relocations. */ |
BFD_RELOC_IQ2000_OFFSET_16, |
BFD_RELOC_IQ2000_OFFSET_21, |
BFD_RELOC_IQ2000_UHI16, |
/* Special Xtensa relocation used only by PLT entries in ELF shared |
objects to indicate that the runtime linker should set the value |
to one of its own internal functions or data structures. */ |
BFD_RELOC_XTENSA_RTLD, |
/* Xtensa relocations for ELF shared objects. */ |
BFD_RELOC_XTENSA_GLOB_DAT, |
BFD_RELOC_XTENSA_JMP_SLOT, |
BFD_RELOC_XTENSA_RELATIVE, |
/* Xtensa relocation used in ELF object files for symbols that may require |
PLT entries. Otherwise, this is just a generic 32-bit relocation. */ |
BFD_RELOC_XTENSA_PLT, |
/* Xtensa relocations to mark the difference of two local symbols. |
These are only needed to support linker relaxation and can be ignored |
when not relaxing. The field is set to the value of the difference |
assuming no relaxation. The relocation encodes the position of the |
first symbol so the linker can determine whether to adjust the field |
value. */ |
BFD_RELOC_XTENSA_DIFF8, |
BFD_RELOC_XTENSA_DIFF16, |
BFD_RELOC_XTENSA_DIFF32, |
/* Generic Xtensa relocations for instruction operands. Only the slot |
number is encoded in the relocation. The relocation applies to the |
last PC-relative immediate operand, or if there are no PC-relative |
immediates, to the last immediate operand. */ |
BFD_RELOC_XTENSA_SLOT0_OP, |
BFD_RELOC_XTENSA_SLOT1_OP, |
BFD_RELOC_XTENSA_SLOT2_OP, |
BFD_RELOC_XTENSA_SLOT3_OP, |
BFD_RELOC_XTENSA_SLOT4_OP, |
BFD_RELOC_XTENSA_SLOT5_OP, |
BFD_RELOC_XTENSA_SLOT6_OP, |
BFD_RELOC_XTENSA_SLOT7_OP, |
BFD_RELOC_XTENSA_SLOT8_OP, |
BFD_RELOC_XTENSA_SLOT9_OP, |
BFD_RELOC_XTENSA_SLOT10_OP, |
BFD_RELOC_XTENSA_SLOT11_OP, |
BFD_RELOC_XTENSA_SLOT12_OP, |
BFD_RELOC_XTENSA_SLOT13_OP, |
BFD_RELOC_XTENSA_SLOT14_OP, |
/* Alternate Xtensa relocations. Only the slot is encoded in the |
relocation. The meaning of these relocations is opcode-specific. */ |
BFD_RELOC_XTENSA_SLOT0_ALT, |
BFD_RELOC_XTENSA_SLOT1_ALT, |
BFD_RELOC_XTENSA_SLOT2_ALT, |
BFD_RELOC_XTENSA_SLOT3_ALT, |
BFD_RELOC_XTENSA_SLOT4_ALT, |
BFD_RELOC_XTENSA_SLOT5_ALT, |
BFD_RELOC_XTENSA_SLOT6_ALT, |
BFD_RELOC_XTENSA_SLOT7_ALT, |
BFD_RELOC_XTENSA_SLOT8_ALT, |
BFD_RELOC_XTENSA_SLOT9_ALT, |
BFD_RELOC_XTENSA_SLOT10_ALT, |
BFD_RELOC_XTENSA_SLOT11_ALT, |
BFD_RELOC_XTENSA_SLOT12_ALT, |
BFD_RELOC_XTENSA_SLOT13_ALT, |
BFD_RELOC_XTENSA_SLOT14_ALT, |
/* Xtensa relocations for backward compatibility. These have all been |
replaced by BFD_RELOC_XTENSA_SLOT0_OP. */ |
BFD_RELOC_XTENSA_OP0, |
BFD_RELOC_XTENSA_OP1, |
BFD_RELOC_XTENSA_OP2, |
/* Xtensa relocation to mark that the assembler expanded the |
instructions from an original target. The expansion size is |
encoded in the reloc size. */ |
BFD_RELOC_XTENSA_ASM_EXPAND, |
/* Xtensa relocation to mark that the linker should simplify |
assembler-expanded instructions. This is commonly used |
internally by the linker after analysis of a |
BFD_RELOC_XTENSA_ASM_EXPAND. */ |
BFD_RELOC_XTENSA_ASM_SIMPLIFY, |
/* Xtensa TLS relocations. */ |
BFD_RELOC_XTENSA_TLSDESC_FN, |
BFD_RELOC_XTENSA_TLSDESC_ARG, |
BFD_RELOC_XTENSA_TLS_DTPOFF, |
BFD_RELOC_XTENSA_TLS_TPOFF, |
BFD_RELOC_XTENSA_TLS_FUNC, |
BFD_RELOC_XTENSA_TLS_ARG, |
BFD_RELOC_XTENSA_TLS_CALL, |
/* 8 bit signed offset in (ix+d) or (iy+d). */ |
BFD_RELOC_Z80_DISP8, |
/* DJNZ offset. */ |
BFD_RELOC_Z8K_DISP7, |
/* CALR offset. */ |
BFD_RELOC_Z8K_CALLR, |
/* 4 bit value. */ |
BFD_RELOC_Z8K_IMM4L, |
/* Lattice Mico32 relocations. */ |
BFD_RELOC_LM32_CALL, |
BFD_RELOC_LM32_BRANCH, |
BFD_RELOC_LM32_16_GOT, |
BFD_RELOC_LM32_GOTOFF_HI16, |
BFD_RELOC_LM32_GOTOFF_LO16, |
BFD_RELOC_LM32_COPY, |
BFD_RELOC_LM32_GLOB_DAT, |
BFD_RELOC_LM32_JMP_SLOT, |
BFD_RELOC_LM32_RELATIVE, |
/* Difference between two section addreses. Must be followed by a |
BFD_RELOC_MACH_O_PAIR. */ |
BFD_RELOC_MACH_O_SECTDIFF, |
/* Like BFD_RELOC_MACH_O_SECTDIFF but with a local symbol. */ |
BFD_RELOC_MACH_O_LOCAL_SECTDIFF, |
/* Pair of relocation. Contains the first symbol. */ |
BFD_RELOC_MACH_O_PAIR, |
/* PCREL relocations. They are marked as branch to create PLT entry if |
required. */ |
BFD_RELOC_MACH_O_X86_64_BRANCH32, |
BFD_RELOC_MACH_O_X86_64_BRANCH8, |
/* Used when referencing a GOT entry. */ |
BFD_RELOC_MACH_O_X86_64_GOT, |
/* Used when loading a GOT entry with movq. It is specially marked so that |
the linker could optimize the movq to a leaq if possible. */ |
BFD_RELOC_MACH_O_X86_64_GOT_LOAD, |
/* Symbol will be substracted. Must be followed by a BFD_RELOC_64. */ |
BFD_RELOC_MACH_O_X86_64_SUBTRACTOR32, |
/* Symbol will be substracted. Must be followed by a BFD_RELOC_64. */ |
BFD_RELOC_MACH_O_X86_64_SUBTRACTOR64, |
/* Same as BFD_RELOC_32_PCREL but with an implicit -1 addend. */ |
BFD_RELOC_MACH_O_X86_64_PCREL32_1, |
/* Same as BFD_RELOC_32_PCREL but with an implicit -2 addend. */ |
BFD_RELOC_MACH_O_X86_64_PCREL32_2, |
/* Same as BFD_RELOC_32_PCREL but with an implicit -4 addend. */ |
BFD_RELOC_MACH_O_X86_64_PCREL32_4, |
/* This is a 32 bit reloc for the microblaze that stores the |
low 16 bits of a value */ |
BFD_RELOC_MICROBLAZE_32_LO, |
/* This is a 32 bit pc-relative reloc for the microblaze that |
stores the low 16 bits of a value */ |
BFD_RELOC_MICROBLAZE_32_LO_PCREL, |
/* This is a 32 bit reloc for the microblaze that stores a |
value relative to the read-only small data area anchor */ |
BFD_RELOC_MICROBLAZE_32_ROSDA, |
/* This is a 32 bit reloc for the microblaze that stores a |
value relative to the read-write small data area anchor */ |
BFD_RELOC_MICROBLAZE_32_RWSDA, |
/* This is a 32 bit reloc for the microblaze to handle |
expressions of the form "Symbol Op Symbol" */ |
BFD_RELOC_MICROBLAZE_32_SYM_OP_SYM, |
/* This is a 64 bit reloc that stores the 32 bit pc relative |
value in two words (with an imm instruction). No relocation is |
done here - only used for relaxing */ |
BFD_RELOC_MICROBLAZE_64_NONE, |
/* This is a 64 bit reloc that stores the 32 bit pc relative |
value in two words (with an imm instruction). The relocation is |
PC-relative GOT offset */ |
BFD_RELOC_MICROBLAZE_64_GOTPC, |
/* This is a 64 bit reloc that stores the 32 bit pc relative |
value in two words (with an imm instruction). The relocation is |
GOT offset */ |
BFD_RELOC_MICROBLAZE_64_GOT, |
/* This is a 64 bit reloc that stores the 32 bit pc relative |
value in two words (with an imm instruction). The relocation is |
PC-relative offset into PLT */ |
BFD_RELOC_MICROBLAZE_64_PLT, |
/* This is a 64 bit reloc that stores the 32 bit GOT relative |
value in two words (with an imm instruction). The relocation is |
relative offset from _GLOBAL_OFFSET_TABLE_ */ |
BFD_RELOC_MICROBLAZE_64_GOTOFF, |
/* This is a 32 bit reloc that stores the 32 bit GOT relative |
value in a word. The relocation is relative offset from */ |
BFD_RELOC_MICROBLAZE_32_GOTOFF, |
/* This is used to tell the dynamic linker to copy the value out of |
the dynamic object into the runtime process image. */ |
BFD_RELOC_MICROBLAZE_COPY, |
/* Unused Reloc */ |
BFD_RELOC_MICROBLAZE_64_TLS, |
/* This is a 64 bit reloc that stores the 32 bit GOT relative value |
of the GOT TLS GD info entry in two words (with an imm instruction). The |
relocation is GOT offset. */ |
BFD_RELOC_MICROBLAZE_64_TLSGD, |
/* This is a 64 bit reloc that stores the 32 bit GOT relative value |
of the GOT TLS LD info entry in two words (with an imm instruction). The |
relocation is GOT offset. */ |
BFD_RELOC_MICROBLAZE_64_TLSLD, |
/* This is a 32 bit reloc that stores the Module ID to GOT(n). */ |
BFD_RELOC_MICROBLAZE_32_TLSDTPMOD, |
/* This is a 32 bit reloc that stores TLS offset to GOT(n+1). */ |
BFD_RELOC_MICROBLAZE_32_TLSDTPREL, |
/* This is a 32 bit reloc for storing TLS offset to two words (uses imm |
instruction) */ |
BFD_RELOC_MICROBLAZE_64_TLSDTPREL, |
/* This is a 64 bit reloc that stores 32-bit thread pointer relative offset |
to two words (uses imm instruction). */ |
BFD_RELOC_MICROBLAZE_64_TLSGOTTPREL, |
/* This is a 64 bit reloc that stores 32-bit thread pointer relative offset |
to two words (uses imm instruction). */ |
BFD_RELOC_MICROBLAZE_64_TLSTPREL, |
/* AArch64 pseudo relocation code to mark the start of the AArch64 |
relocation enumerators. N.B. the order of the enumerators is |
important as several tables in the AArch64 bfd backend are indexed |
by these enumerators; make sure they are all synced. */ |
BFD_RELOC_AARCH64_RELOC_START, |
/* AArch64 null relocation code. */ |
BFD_RELOC_AARCH64_NONE, |
/* Basic absolute relocations of N bits. These are equivalent to |
BFD_RELOC_N and they were added to assist the indexing of the howto |
table. */ |
BFD_RELOC_AARCH64_64, |
BFD_RELOC_AARCH64_32, |
BFD_RELOC_AARCH64_16, |
/* PC-relative relocations. These are equivalent to BFD_RELOC_N_PCREL |
and they were added to assist the indexing of the howto table. */ |
BFD_RELOC_AARCH64_64_PCREL, |
BFD_RELOC_AARCH64_32_PCREL, |
BFD_RELOC_AARCH64_16_PCREL, |
/* AArch64 MOV[NZK] instruction with most significant bits 0 to 15 |
of an unsigned address/value. */ |
BFD_RELOC_AARCH64_MOVW_G0, |
/* AArch64 MOV[NZK] instruction with less significant bits 0 to 15 of |
an address/value. No overflow checking. */ |
BFD_RELOC_AARCH64_MOVW_G0_NC, |
/* AArch64 MOV[NZK] instruction with most significant bits 16 to 31 |
of an unsigned address/value. */ |
BFD_RELOC_AARCH64_MOVW_G1, |
/* AArch64 MOV[NZK] instruction with less significant bits 16 to 31 |
of an address/value. No overflow checking. */ |
BFD_RELOC_AARCH64_MOVW_G1_NC, |
/* AArch64 MOV[NZK] instruction with most significant bits 32 to 47 |
of an unsigned address/value. */ |
BFD_RELOC_AARCH64_MOVW_G2, |
/* AArch64 MOV[NZK] instruction with less significant bits 32 to 47 |
of an address/value. No overflow checking. */ |
BFD_RELOC_AARCH64_MOVW_G2_NC, |
/* AArch64 MOV[NZK] instruction with most signficant bits 48 to 64 |
of a signed or unsigned address/value. */ |
BFD_RELOC_AARCH64_MOVW_G3, |
/* AArch64 MOV[NZ] instruction with most significant bits 0 to 15 |
of a signed value. Changes instruction to MOVZ or MOVN depending on the |
value's sign. */ |
BFD_RELOC_AARCH64_MOVW_G0_S, |
/* AArch64 MOV[NZ] instruction with most significant bits 16 to 31 |
of a signed value. Changes instruction to MOVZ or MOVN depending on the |
value's sign. */ |
BFD_RELOC_AARCH64_MOVW_G1_S, |
/* AArch64 MOV[NZ] instruction with most significant bits 32 to 47 |
of a signed value. Changes instruction to MOVZ or MOVN depending on the |
value's sign. */ |
BFD_RELOC_AARCH64_MOVW_G2_S, |
/* AArch64 Load Literal instruction, holding a 19 bit pc-relative word |
offset. The lowest two bits must be zero and are not stored in the |
instruction, giving a 21 bit signed byte offset. */ |
BFD_RELOC_AARCH64_LD_LO19_PCREL, |
/* AArch64 ADR instruction, holding a simple 21 bit pc-relative byte offset. */ |
BFD_RELOC_AARCH64_ADR_LO21_PCREL, |
/* AArch64 ADRP instruction, with bits 12 to 32 of a pc-relative page |
offset, giving a 4KB aligned page base address. */ |
BFD_RELOC_AARCH64_ADR_HI21_PCREL, |
/* AArch64 ADRP instruction, with bits 12 to 32 of a pc-relative page |
offset, giving a 4KB aligned page base address, but with no overflow |
checking. */ |
BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL, |
/* AArch64 ADD immediate instruction, holding bits 0 to 11 of the address. |
Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. */ |
BFD_RELOC_AARCH64_ADD_LO12, |
/* AArch64 8-bit load/store instruction, holding bits 0 to 11 of the |
address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. */ |
BFD_RELOC_AARCH64_LDST8_LO12, |
/* AArch64 14 bit pc-relative test bit and branch. |
The lowest two bits must be zero and are not stored in the instruction, |
giving a 16 bit signed byte offset. */ |
BFD_RELOC_AARCH64_TSTBR14, |
/* AArch64 19 bit pc-relative conditional branch and compare & branch. |
The lowest two bits must be zero and are not stored in the instruction, |
giving a 21 bit signed byte offset. */ |
BFD_RELOC_AARCH64_BRANCH19, |
/* AArch64 26 bit pc-relative unconditional branch. |
The lowest two bits must be zero and are not stored in the instruction, |
giving a 28 bit signed byte offset. */ |
BFD_RELOC_AARCH64_JUMP26, |
/* AArch64 26 bit pc-relative unconditional branch and link. |
The lowest two bits must be zero and are not stored in the instruction, |
giving a 28 bit signed byte offset. */ |
BFD_RELOC_AARCH64_CALL26, |
/* AArch64 16-bit load/store instruction, holding bits 0 to 11 of the |
address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. */ |
BFD_RELOC_AARCH64_LDST16_LO12, |
/* AArch64 32-bit load/store instruction, holding bits 0 to 11 of the |
address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. */ |
BFD_RELOC_AARCH64_LDST32_LO12, |
/* AArch64 64-bit load/store instruction, holding bits 0 to 11 of the |
address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. */ |
BFD_RELOC_AARCH64_LDST64_LO12, |
/* AArch64 128-bit load/store instruction, holding bits 0 to 11 of the |
address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. */ |
BFD_RELOC_AARCH64_LDST128_LO12, |
/* AArch64 Load Literal instruction, holding a 19 bit PC relative word |
offset of the global offset table entry for a symbol. The lowest two |
bits must be zero and are not stored in the instruction, giving a 21 |
bit signed byte offset. This relocation type requires signed overflow |
checking. */ |
BFD_RELOC_AARCH64_GOT_LD_PREL19, |
/* Get to the page base of the global offset table entry for a symbol as |
part of an ADRP instruction using a 21 bit PC relative value.Used in |
conjunction with BFD_RELOC_AARCH64_LD64_GOT_LO12_NC. */ |
BFD_RELOC_AARCH64_ADR_GOT_PAGE, |
/* Unsigned 12 bit byte offset for 64 bit load/store from the page of |
the GOT entry for this symbol. Used in conjunction with |
BFD_RELOC_AARCH64_ADR_GOTPAGE. Valid in LP64 ABI only. */ |
BFD_RELOC_AARCH64_LD64_GOT_LO12_NC, |
/* Unsigned 12 bit byte offset for 32 bit load/store from the page of |
the GOT entry for this symbol. Used in conjunction with |
BFD_RELOC_AARCH64_ADR_GOTPAGE. Valid in ILP32 ABI only. */ |
BFD_RELOC_AARCH64_LD32_GOT_LO12_NC, |
/* Unsigned 16 bit byte offset for 64 bit load/store from the GOT entry |
for this symbol. Valid in LP64 ABI only. */ |
BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC, |
/* Unsigned 16 bit byte higher offset for 64 bit load/store from the GOT entry |
for this symbol. Valid in LP64 ABI only. */ |
BFD_RELOC_AARCH64_MOVW_GOTOFF_G1, |
/* Unsigned 15 bit byte offset for 64 bit load/store from the page of |
the GOT entry for this symbol. Valid in LP64 ABI only. */ |
BFD_RELOC_AARCH64_LD64_GOTOFF_LO15, |
/* Scaled 14 bit byte offset to the page base of the global offset table. */ |
BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14, |
/* Scaled 15 bit byte offset to the page base of the global offset table. */ |
BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15, |
/* Get to the page base of the global offset table entry for a symbols |
tls_index structure as part of an adrp instruction using a 21 bit PC |
relative value. Used in conjunction with |
BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC. */ |
BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21, |
/* AArch64 TLS General Dynamic */ |
BFD_RELOC_AARCH64_TLSGD_ADR_PREL21, |
/* Unsigned 12 bit byte offset to global offset table entry for a symbols |
tls_index structure. Used in conjunction with |
BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21. */ |
BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC, |
/* AArch64 TLS General Dynamic relocation. */ |
BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC, |
/* AArch64 TLS General Dynamic relocation. */ |
BFD_RELOC_AARCH64_TLSGD_MOVW_G1, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1, |
/* bit[23:12] of byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12, |
/* Unsigned 12 bit byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12, |
/* No overflow check version of BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12. */ |
BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC, |
/* Unsigned 12 bit byte offset to global offset table entry for a symbols |
tls_index structure. Used in conjunction with |
BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21. */ |
BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC, |
/* GOT entry page address for AArch64 TLS Local Dynamic, used with ADRP |
instruction. */ |
BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21, |
/* GOT entry address for AArch64 TLS Local Dynamic, used with ADR instruction. */ |
BFD_RELOC_AARCH64_TLSLD_ADR_PREL21, |
/* bit[11:1] of byte offset to module TLS base address, encoded in ldst |
instructions. */ |
BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, |
/* bit[11:2] of byte offset to module TLS base address, encoded in ldst |
instructions. */ |
BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, |
/* bit[11:3] of byte offset to module TLS base address, encoded in ldst |
instructions. */ |
BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, |
/* bit[11:0] of byte offset to module TLS base address, encoded in ldst |
instructions. */ |
BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC, |
/* bit[15:0] of byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0, |
/* No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0 */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, |
/* bit[31:16] of byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1, |
/* No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1 */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, |
/* bit[47:32] of byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2, |
/* AArch64 TLS LOCAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2, |
/* AArch64 TLS LOCAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1, |
/* AArch64 TLS LOCAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC, |
/* AArch64 TLS LOCAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0, |
/* AArch64 TLS LOCAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0_NC, |
/* AArch64 TLS LOCAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12, |
/* AArch64 TLS LOCAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12, |
/* AArch64 TLS LOCAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC, |
/* AArch64 TLS DESC relocation. */ |
BFD_RELOC_AARCH64_TLSDESC_LD_PREL19, |
/* AArch64 TLS DESC relocation. */ |
BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21, |
/* AArch64 TLS DESC relocation. */ |
BFD_RELOC_AARCH64_TLSDESC_ADR_PAGE21, |
/* AArch64 TLS DESC relocation. */ |
BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC, |
/* AArch64 TLS DESC relocation. */ |
BFD_RELOC_AARCH64_TLSDESC_LD32_LO12_NC, |
/* AArch64 TLS DESC relocation. */ |
BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC, |
/* AArch64 TLS DESC relocation. */ |
BFD_RELOC_AARCH64_TLSDESC_OFF_G1, |
/* AArch64 TLS DESC relocation. */ |
BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC, |
/* AArch64 TLS DESC relocation. */ |
BFD_RELOC_AARCH64_TLSDESC_LDR, |
/* AArch64 TLS DESC relocation. */ |
BFD_RELOC_AARCH64_TLSDESC_ADD, |
/* AArch64 TLS DESC relocation. */ |
BFD_RELOC_AARCH64_TLSDESC_CALL, |
/* AArch64 TLS relocation. */ |
BFD_RELOC_AARCH64_COPY, |
/* AArch64 TLS relocation. */ |
BFD_RELOC_AARCH64_GLOB_DAT, |
/* AArch64 TLS relocation. */ |
BFD_RELOC_AARCH64_JUMP_SLOT, |
/* AArch64 TLS relocation. */ |
BFD_RELOC_AARCH64_RELATIVE, |
/* AArch64 TLS relocation. */ |
BFD_RELOC_AARCH64_TLS_DTPMOD, |
/* AArch64 TLS relocation. */ |
BFD_RELOC_AARCH64_TLS_DTPREL, |
/* AArch64 TLS relocation. */ |
BFD_RELOC_AARCH64_TLS_TPREL, |
/* AArch64 TLS relocation. */ |
BFD_RELOC_AARCH64_TLSDESC, |
/* AArch64 support for STT_GNU_IFUNC. */ |
BFD_RELOC_AARCH64_IRELATIVE, |
/* AArch64 pseudo relocation code to mark the end of the AArch64 |
relocation enumerators that have direct mapping to ELF reloc codes. |
There are a few more enumerators after this one; those are mainly |
used by the AArch64 assembler for the internal fixup or to select |
one of the above enumerators. */ |
BFD_RELOC_AARCH64_RELOC_END, |
/* AArch64 pseudo relocation code to be used internally by the AArch64 |
assembler and not (currently) written to any object files. */ |
BFD_RELOC_AARCH64_GAS_INTERNAL_FIXUP, |
/* AArch64 unspecified load/store instruction, holding bits 0 to 11 of the |
address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. */ |
BFD_RELOC_AARCH64_LDST_LO12, |
/* AArch64 pseudo relocation code for TLS local dynamic mode. It's to be |
used internally by the AArch64 assembler and not (currently) written to |
any object files. */ |
BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12_NC, |
/* AArch64 pseudo relocation code to be used internally by the AArch64 |
assembler and not (currently) written to any object files. */ |
BFD_RELOC_AARCH64_LD_GOT_LO12_NC, |
/* AArch64 pseudo relocation code to be used internally by the AArch64 |
assembler and not (currently) written to any object files. */ |
BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_LO12_NC, |
/* AArch64 pseudo relocation code to be used internally by the AArch64 |
assembler and not (currently) written to any object files. */ |
BFD_RELOC_AARCH64_TLSDESC_LD_LO12_NC, |
/* Tilera TILEPro Relocations. */ |
BFD_RELOC_TILEPRO_COPY, |
BFD_RELOC_TILEPRO_GLOB_DAT, |
BFD_RELOC_TILEPRO_JMP_SLOT, |
BFD_RELOC_TILEPRO_RELATIVE, |
BFD_RELOC_TILEPRO_BROFF_X1, |
BFD_RELOC_TILEPRO_JOFFLONG_X1, |
BFD_RELOC_TILEPRO_JOFFLONG_X1_PLT, |
BFD_RELOC_TILEPRO_IMM8_X0, |
BFD_RELOC_TILEPRO_IMM8_Y0, |
BFD_RELOC_TILEPRO_IMM8_X1, |
BFD_RELOC_TILEPRO_IMM8_Y1, |
BFD_RELOC_TILEPRO_DEST_IMM8_X1, |
BFD_RELOC_TILEPRO_MT_IMM15_X1, |
BFD_RELOC_TILEPRO_MF_IMM15_X1, |
BFD_RELOC_TILEPRO_IMM16_X0, |
BFD_RELOC_TILEPRO_IMM16_X1, |
BFD_RELOC_TILEPRO_IMM16_X0_LO, |
BFD_RELOC_TILEPRO_IMM16_X1_LO, |
BFD_RELOC_TILEPRO_IMM16_X0_HI, |
BFD_RELOC_TILEPRO_IMM16_X1_HI, |
BFD_RELOC_TILEPRO_IMM16_X0_HA, |
BFD_RELOC_TILEPRO_IMM16_X1_HA, |
BFD_RELOC_TILEPRO_IMM16_X0_PCREL, |
BFD_RELOC_TILEPRO_IMM16_X1_PCREL, |
BFD_RELOC_TILEPRO_IMM16_X0_LO_PCREL, |
BFD_RELOC_TILEPRO_IMM16_X1_LO_PCREL, |
BFD_RELOC_TILEPRO_IMM16_X0_HI_PCREL, |
BFD_RELOC_TILEPRO_IMM16_X1_HI_PCREL, |
BFD_RELOC_TILEPRO_IMM16_X0_HA_PCREL, |
BFD_RELOC_TILEPRO_IMM16_X1_HA_PCREL, |
BFD_RELOC_TILEPRO_IMM16_X0_GOT, |
BFD_RELOC_TILEPRO_IMM16_X1_GOT, |
BFD_RELOC_TILEPRO_IMM16_X0_GOT_LO, |
BFD_RELOC_TILEPRO_IMM16_X1_GOT_LO, |
BFD_RELOC_TILEPRO_IMM16_X0_GOT_HI, |
BFD_RELOC_TILEPRO_IMM16_X1_GOT_HI, |
BFD_RELOC_TILEPRO_IMM16_X0_GOT_HA, |
BFD_RELOC_TILEPRO_IMM16_X1_GOT_HA, |
BFD_RELOC_TILEPRO_MMSTART_X0, |
BFD_RELOC_TILEPRO_MMEND_X0, |
BFD_RELOC_TILEPRO_MMSTART_X1, |
BFD_RELOC_TILEPRO_MMEND_X1, |
BFD_RELOC_TILEPRO_SHAMT_X0, |
BFD_RELOC_TILEPRO_SHAMT_X1, |
BFD_RELOC_TILEPRO_SHAMT_Y0, |
BFD_RELOC_TILEPRO_SHAMT_Y1, |
BFD_RELOC_TILEPRO_TLS_GD_CALL, |
BFD_RELOC_TILEPRO_IMM8_X0_TLS_GD_ADD, |
BFD_RELOC_TILEPRO_IMM8_X1_TLS_GD_ADD, |
BFD_RELOC_TILEPRO_IMM8_Y0_TLS_GD_ADD, |
BFD_RELOC_TILEPRO_IMM8_Y1_TLS_GD_ADD, |
BFD_RELOC_TILEPRO_TLS_IE_LOAD, |
BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD, |
BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD, |
BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_LO, |
BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_LO, |
BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_HI, |
BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_HI, |
BFD_RELOC_TILEPRO_IMM16_X0_TLS_GD_HA, |
BFD_RELOC_TILEPRO_IMM16_X1_TLS_GD_HA, |
BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE, |
BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE, |
BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_LO, |
BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_LO, |
BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_HI, |
BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_HI, |
BFD_RELOC_TILEPRO_IMM16_X0_TLS_IE_HA, |
BFD_RELOC_TILEPRO_IMM16_X1_TLS_IE_HA, |
BFD_RELOC_TILEPRO_TLS_DTPMOD32, |
BFD_RELOC_TILEPRO_TLS_DTPOFF32, |
BFD_RELOC_TILEPRO_TLS_TPOFF32, |
BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE, |
BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE, |
BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_LO, |
BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_LO, |
BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HI, |
BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HI, |
BFD_RELOC_TILEPRO_IMM16_X0_TLS_LE_HA, |
BFD_RELOC_TILEPRO_IMM16_X1_TLS_LE_HA, |
/* Tilera TILE-Gx Relocations. */ |
BFD_RELOC_TILEGX_HW0, |
BFD_RELOC_TILEGX_HW1, |
BFD_RELOC_TILEGX_HW2, |
BFD_RELOC_TILEGX_HW3, |
BFD_RELOC_TILEGX_HW0_LAST, |
BFD_RELOC_TILEGX_HW1_LAST, |
BFD_RELOC_TILEGX_HW2_LAST, |
BFD_RELOC_TILEGX_COPY, |
BFD_RELOC_TILEGX_GLOB_DAT, |
BFD_RELOC_TILEGX_JMP_SLOT, |
BFD_RELOC_TILEGX_RELATIVE, |
BFD_RELOC_TILEGX_BROFF_X1, |
BFD_RELOC_TILEGX_JUMPOFF_X1, |
BFD_RELOC_TILEGX_JUMPOFF_X1_PLT, |
BFD_RELOC_TILEGX_IMM8_X0, |
BFD_RELOC_TILEGX_IMM8_Y0, |
BFD_RELOC_TILEGX_IMM8_X1, |
BFD_RELOC_TILEGX_IMM8_Y1, |
BFD_RELOC_TILEGX_DEST_IMM8_X1, |
BFD_RELOC_TILEGX_MT_IMM14_X1, |
BFD_RELOC_TILEGX_MF_IMM14_X1, |
BFD_RELOC_TILEGX_MMSTART_X0, |
BFD_RELOC_TILEGX_MMEND_X0, |
BFD_RELOC_TILEGX_SHAMT_X0, |
BFD_RELOC_TILEGX_SHAMT_X1, |
BFD_RELOC_TILEGX_SHAMT_Y0, |
BFD_RELOC_TILEGX_SHAMT_Y1, |
BFD_RELOC_TILEGX_IMM16_X0_HW0, |
BFD_RELOC_TILEGX_IMM16_X1_HW0, |
BFD_RELOC_TILEGX_IMM16_X0_HW1, |
BFD_RELOC_TILEGX_IMM16_X1_HW1, |
BFD_RELOC_TILEGX_IMM16_X0_HW2, |
BFD_RELOC_TILEGX_IMM16_X1_HW2, |
BFD_RELOC_TILEGX_IMM16_X0_HW3, |
BFD_RELOC_TILEGX_IMM16_X1_HW3, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST, |
BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST, |
BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST, |
BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST, |
BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW1_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW1_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW2_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW2_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW3_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW3_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_GOT, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_GOT, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW1_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW1_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW2_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW2_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_GOT, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_GOT, |
BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_GOT, |
BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_GOT, |
BFD_RELOC_TILEGX_IMM16_X0_HW3_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW3_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_GD, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_GD, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_LE, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_LE, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_LE, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_LE, |
BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_LE, |
BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_LE, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_GD, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_GD, |
BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_GD, |
BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_GD, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_TLS_IE, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_TLS_IE, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL, |
BFD_RELOC_TILEGX_IMM16_X0_HW0_LAST_TLS_IE, |
BFD_RELOC_TILEGX_IMM16_X1_HW0_LAST_TLS_IE, |
BFD_RELOC_TILEGX_IMM16_X0_HW1_LAST_TLS_IE, |
BFD_RELOC_TILEGX_IMM16_X1_HW1_LAST_TLS_IE, |
BFD_RELOC_TILEGX_TLS_DTPMOD64, |
BFD_RELOC_TILEGX_TLS_DTPOFF64, |
BFD_RELOC_TILEGX_TLS_TPOFF64, |
BFD_RELOC_TILEGX_TLS_DTPMOD32, |
BFD_RELOC_TILEGX_TLS_DTPOFF32, |
BFD_RELOC_TILEGX_TLS_TPOFF32, |
BFD_RELOC_TILEGX_TLS_GD_CALL, |
BFD_RELOC_TILEGX_IMM8_X0_TLS_GD_ADD, |
BFD_RELOC_TILEGX_IMM8_X1_TLS_GD_ADD, |
BFD_RELOC_TILEGX_IMM8_Y0_TLS_GD_ADD, |
BFD_RELOC_TILEGX_IMM8_Y1_TLS_GD_ADD, |
BFD_RELOC_TILEGX_TLS_IE_LOAD, |
BFD_RELOC_TILEGX_IMM8_X0_TLS_ADD, |
BFD_RELOC_TILEGX_IMM8_X1_TLS_ADD, |
BFD_RELOC_TILEGX_IMM8_Y0_TLS_ADD, |
BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD, |
/* Adapteva EPIPHANY - 8 bit signed pc-relative displacement */ |
BFD_RELOC_EPIPHANY_SIMM8, |
/* Adapteva EPIPHANY - 24 bit signed pc-relative displacement */ |
BFD_RELOC_EPIPHANY_SIMM24, |
/* Adapteva EPIPHANY - 16 most-significant bits of absolute address */ |
BFD_RELOC_EPIPHANY_HIGH, |
/* Adapteva EPIPHANY - 16 least-significant bits of absolute address */ |
BFD_RELOC_EPIPHANY_LOW, |
/* Adapteva EPIPHANY - 11 bit signed number - add/sub immediate */ |
BFD_RELOC_EPIPHANY_SIMM11, |
/* Adapteva EPIPHANY - 11 bit sign-magnitude number (ld/st displacement) */ |
BFD_RELOC_EPIPHANY_IMM11, |
/* Adapteva EPIPHANY - 8 bit immediate for 16 bit mov instruction. */ |
BFD_RELOC_EPIPHANY_IMM8, |
/* Visium Relocations. */ |
BFD_RELOC_VISIUM_HI16, |
BFD_RELOC_VISIUM_LO16, |
BFD_RELOC_VISIUM_IM16, |
BFD_RELOC_VISIUM_REL16, |
BFD_RELOC_VISIUM_HI16_PCREL, |
BFD_RELOC_VISIUM_LO16_PCREL, |
BFD_RELOC_VISIUM_IM16_PCREL, |
BFD_RELOC_UNUSED }; |
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; |
reloc_howto_type *bfd_reloc_type_lookup |
(bfd *abfd, bfd_reloc_code_real_type code); |
reloc_howto_type *bfd_reloc_name_lookup |
(bfd *abfd, const char *reloc_name); |
const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code); |
/* Extracted from syms.c. */ |
typedef struct bfd_symbol |
{ |
/* A pointer to the BFD which owns the symbol. This information |
is necessary so that a back end can work out what additional |
information (invisible to the application writer) is carried |
with the symbol. |
This field is *almost* redundant, since you can use section->owner |
instead, except that some symbols point to the global sections |
bfd_{abs,com,und}_section. This could be fixed by making |
these globals be per-bfd (or per-target-flavor). FIXME. */ |
struct bfd *the_bfd; /* Use bfd_asymbol_bfd(sym) to access this field. */ |
/* The text of the symbol. The name is left alone, and not copied; the |
application may not alter it. */ |
const char *name; |
/* The value of the symbol. This really should be a union of a |
numeric value with a pointer, since some flags indicate that |
a pointer to another symbol is stored here. */ |
symvalue value; |
/* Attributes of a symbol. */ |
#define BSF_NO_FLAGS 0x00 |
/* The symbol has local scope; <<static>> in <<C>>. The value |
is the offset into the section of the data. */ |
#define BSF_LOCAL (1 << 0) |
/* The symbol has global scope; initialized data in <<C>>. The |
value is the offset into the section of the data. */ |
#define BSF_GLOBAL (1 << 1) |
/* The symbol has global scope and is exported. The value is |
the offset into the section of the data. */ |
#define BSF_EXPORT BSF_GLOBAL /* No real difference. */ |
/* A normal C symbol would be one of: |
<<BSF_LOCAL>>, <<BSF_COMMON>>, <<BSF_UNDEFINED>> or |
<<BSF_GLOBAL>>. */ |
/* The symbol is a debugging record. The value has an arbitrary |
meaning, unless BSF_DEBUGGING_RELOC is also set. */ |
#define BSF_DEBUGGING (1 << 2) |
/* The symbol denotes a function entry point. Used in ELF, |
perhaps others someday. */ |
#define BSF_FUNCTION (1 << 3) |
/* Used by the linker. */ |
#define BSF_KEEP (1 << 5) |
#define BSF_KEEP_G (1 << 6) |
/* A weak global symbol, overridable without warnings by |
a regular global symbol of the same name. */ |
#define BSF_WEAK (1 << 7) |
/* This symbol was created to point to a section, e.g. ELF's |
STT_SECTION symbols. */ |
#define BSF_SECTION_SYM (1 << 8) |
/* The symbol used to be a common symbol, but now it is |
allocated. */ |
#define BSF_OLD_COMMON (1 << 9) |
/* In some files the type of a symbol sometimes alters its |
location in an output file - ie in coff a <<ISFCN>> symbol |
which is also <<C_EXT>> symbol appears where it was |
declared and not at the end of a section. This bit is set |
by the target BFD part to convey this information. */ |
#define BSF_NOT_AT_END (1 << 10) |
/* Signal that the symbol is the label of constructor section. */ |
#define BSF_CONSTRUCTOR (1 << 11) |
/* Signal that the symbol is a warning symbol. The name is a |
warning. The name of the next symbol is the one to warn about; |
if a reference is made to a symbol with the same name as the next |
symbol, a warning is issued by the linker. */ |
#define BSF_WARNING (1 << 12) |
/* Signal that the symbol is indirect. This symbol is an indirect |
pointer to the symbol with the same name as the next symbol. */ |
#define BSF_INDIRECT (1 << 13) |
/* BSF_FILE marks symbols that contain a file name. This is used |
for ELF STT_FILE symbols. */ |
#define BSF_FILE (1 << 14) |
/* Symbol is from dynamic linking information. */ |
#define BSF_DYNAMIC (1 << 15) |
/* The symbol denotes a data object. Used in ELF, and perhaps |
others someday. */ |
#define BSF_OBJECT (1 << 16) |
/* This symbol is a debugging symbol. The value is the offset |
into the section of the data. BSF_DEBUGGING should be set |
as well. */ |
#define BSF_DEBUGGING_RELOC (1 << 17) |
/* This symbol is thread local. Used in ELF. */ |
#define BSF_THREAD_LOCAL (1 << 18) |
/* This symbol represents a complex relocation expression, |
with the expression tree serialized in the symbol name. */ |
#define BSF_RELC (1 << 19) |
/* This symbol represents a signed complex relocation expression, |
with the expression tree serialized in the symbol name. */ |
#define BSF_SRELC (1 << 20) |
/* This symbol was created by bfd_get_synthetic_symtab. */ |
#define BSF_SYNTHETIC (1 << 21) |
/* This symbol is an indirect code object. Unrelated to BSF_INDIRECT. |
The dynamic linker will compute the value of this symbol by |
calling the function that it points to. BSF_FUNCTION must |
also be also set. */ |
#define BSF_GNU_INDIRECT_FUNCTION (1 << 22) |
/* This symbol is a globally unique data object. The dynamic linker |
will make sure that in the entire process there is just one symbol |
with this name and type in use. BSF_OBJECT must also be set. */ |
#define BSF_GNU_UNIQUE (1 << 23) |
flagword flags; |
/* A pointer to the section to which this symbol is |
relative. This will always be non NULL, there are special |
sections for undefined and absolute symbols. */ |
struct bfd_section *section; |
/* Back end special data. */ |
union |
{ |
void *p; |
bfd_vma i; |
} |
udata; |
} |
asymbol; |
#define bfd_get_symtab_upper_bound(abfd) \ |
BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd)) |
bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym); |
bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name); |
#define bfd_is_local_label_name(abfd, name) \ |
BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name)) |
bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym); |
#define bfd_is_target_special_symbol(abfd, sym) \ |
BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym)) |
#define bfd_canonicalize_symtab(abfd, location) \ |
BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location)) |
bfd_boolean bfd_set_symtab |
(bfd *abfd, asymbol **location, unsigned int count); |
void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol); |
#define bfd_make_empty_symbol(abfd) \ |
BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd)) |
asymbol *_bfd_generic_make_empty_symbol (bfd *); |
#define bfd_make_debug_symbol(abfd,ptr,size) \ |
BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size)) |
int bfd_decode_symclass (asymbol *symbol); |
bfd_boolean bfd_is_undefined_symclass (int symclass); |
void bfd_symbol_info (asymbol *symbol, symbol_info *ret); |
bfd_boolean bfd_copy_private_symbol_data |
(bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym); |
#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \ |
BFD_SEND (obfd, _bfd_copy_private_symbol_data, \ |
(ibfd, isymbol, obfd, osymbol)) |
/* Extracted from bfd.c. */ |
enum bfd_direction |
{ |
no_direction = 0, |
read_direction = 1, |
write_direction = 2, |
both_direction = 3 |
}; |
enum bfd_plugin_format |
{ |
bfd_plugin_uknown = 0, |
bfd_plugin_yes = 1, |
bfd_plugin_no = 2 |
}; |
struct bfd_build_id |
{ |
bfd_size_type size; |
bfd_byte data[1]; |
}; |
struct bfd |
{ |
/* The filename the application opened the BFD with. */ |
const char *filename; |
/* A pointer to the target jump table. */ |
const struct bfd_target *xvec; |
/* The IOSTREAM, and corresponding IO vector that provide access |
to the file backing the BFD. */ |
void *iostream; |
const struct bfd_iovec *iovec; |
/* The caching routines use these to maintain a |
least-recently-used list of BFDs. */ |
struct bfd *lru_prev, *lru_next; |
/* When a file is closed by the caching routines, BFD retains |
state information on the file here... */ |
ufile_ptr where; |
/* File modified time, if mtime_set is TRUE. */ |
long mtime; |
/* A unique identifier of the BFD */ |
unsigned int id; |
/* The format which belongs to the BFD. (object, core, etc.) */ |
ENUM_BITFIELD (bfd_format) format : 3; |
/* The direction with which the BFD was opened. */ |
ENUM_BITFIELD (bfd_direction) direction : 2; |
/* Format_specific flags. */ |
flagword flags : 18; |
/* Values that may appear in the flags field of a BFD. These also |
appear in the object_flags field of the bfd_target structure, where |
they indicate the set of flags used by that backend (not all flags |
are meaningful for all object file formats) (FIXME: at the moment, |
the object_flags values have mostly just been copied from backend |
to another, and are not necessarily correct). */ |
#define BFD_NO_FLAGS 0x00 |
/* BFD contains relocation entries. */ |
#define HAS_RELOC 0x01 |
/* BFD is directly executable. */ |
#define EXEC_P 0x02 |
/* BFD has line number information (basically used for F_LNNO in a |
COFF header). */ |
#define HAS_LINENO 0x04 |
/* BFD has debugging information. */ |
#define HAS_DEBUG 0x08 |
/* BFD has symbols. */ |
#define HAS_SYMS 0x10 |
/* BFD has local symbols (basically used for F_LSYMS in a COFF |
header). */ |
#define HAS_LOCALS 0x20 |
/* BFD is a dynamic object. */ |
#define DYNAMIC 0x40 |
/* Text section is write protected (if D_PAGED is not set, this is |
like an a.out NMAGIC file) (the linker sets this by default, but |
clears it for -r or -N). */ |
#define WP_TEXT 0x80 |
/* BFD is dynamically paged (this is like an a.out ZMAGIC file) (the |
linker sets this by default, but clears it for -r or -n or -N). */ |
#define D_PAGED 0x100 |
/* BFD is relaxable (this means that bfd_relax_section may be able to |
do something) (sometimes bfd_relax_section can do something even if |
this is not set). */ |
#define BFD_IS_RELAXABLE 0x200 |
/* This may be set before writing out a BFD to request using a |
traditional format. For example, this is used to request that when |
writing out an a.out object the symbols not be hashed to eliminate |
duplicates. */ |
#define BFD_TRADITIONAL_FORMAT 0x400 |
/* This flag indicates that the BFD contents are actually cached |
in memory. If this is set, iostream points to a bfd_in_memory |
struct. */ |
#define BFD_IN_MEMORY 0x800 |
/* This BFD has been created by the linker and doesn't correspond |
to any input file. */ |
#define BFD_LINKER_CREATED 0x1000 |
/* This may be set before writing out a BFD to request that it |
be written using values for UIDs, GIDs, timestamps, etc. that |
will be consistent from run to run. */ |
#define BFD_DETERMINISTIC_OUTPUT 0x2000 |
/* Compress sections in this BFD. */ |
#define BFD_COMPRESS 0x4000 |
/* Decompress sections in this BFD. */ |
#define BFD_DECOMPRESS 0x8000 |
/* BFD is a dummy, for plugins. */ |
#define BFD_PLUGIN 0x10000 |
/* Compress sections in this BFD with SHF_COMPRESSED from gABI. */ |
#define BFD_COMPRESS_GABI 0x20000 |
/* Flags bits to be saved in bfd_preserve_save. */ |
#define BFD_FLAGS_SAVED \ |
(BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_PLUGIN \ |
| BFD_COMPRESS_GABI) |
/* Flags bits which are for BFD use only. */ |
#define BFD_FLAGS_FOR_BFD_USE_MASK \ |
(BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \ |
| BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT \ |
| BFD_COMPRESS_GABI) |
/* Is the file descriptor being cached? That is, can it be closed as |
needed, and re-opened when accessed later? */ |
unsigned int cacheable : 1; |
/* Marks whether there was a default target specified when the |
BFD was opened. This is used to select which matching algorithm |
to use to choose the back end. */ |
unsigned int target_defaulted : 1; |
/* ... and here: (``once'' means at least once). */ |
unsigned int opened_once : 1; |
/* Set if we have a locally maintained mtime value, rather than |
getting it from the file each time. */ |
unsigned int mtime_set : 1; |
/* Flag set if symbols from this BFD should not be exported. */ |
unsigned int no_export : 1; |
/* Remember when output has begun, to stop strange things |
from happening. */ |
unsigned int output_has_begun : 1; |
/* Have archive map. */ |
unsigned int has_armap : 1; |
/* Set if this is a thin archive. */ |
unsigned int is_thin_archive : 1; |
/* Set if only required symbols should be added in the link hash table for |
this object. Used by VMS linkers. */ |
unsigned int selective_search : 1; |
/* Set if this is the linker output BFD. */ |
unsigned int is_linker_output : 1; |
/* Set if this is the linker input BFD. */ |
unsigned int is_linker_input : 1; |
/* If this is an input for a compiler plug-in library. */ |
ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2; |
/* Set if this is a plugin output file. */ |
unsigned int lto_output : 1; |
/* Set to dummy BFD created when claimed by a compiler plug-in |
library. */ |
bfd *plugin_dummy_bfd; |
/* Currently my_archive is tested before adding origin to |
anything. I believe that this can become always an add of |
origin, with origin set to 0 for non archive files. */ |
ufile_ptr origin; |
/* The origin in the archive of the proxy entry. This will |
normally be the same as origin, except for thin archives, |
when it will contain the current offset of the proxy in the |
thin archive rather than the offset of the bfd in its actual |
container. */ |
ufile_ptr proxy_origin; |
/* A hash table for section names. */ |
struct bfd_hash_table section_htab; |
/* Pointer to linked list of sections. */ |
struct bfd_section *sections; |
/* The last section on the section list. */ |
struct bfd_section *section_last; |
/* The number of sections. */ |
unsigned int section_count; |
/* A field used by _bfd_generic_link_add_archive_symbols. This will |
be used only for archive elements. */ |
int archive_pass; |
/* Stuff only useful for object files: |
The start address. */ |
bfd_vma start_address; |
/* Symbol table for output BFD (with symcount entries). |
Also used by the linker to cache input BFD symbols. */ |
struct bfd_symbol **outsymbols; |
/* Used for input and output. */ |
unsigned int symcount; |
/* Used for slurped dynamic symbol tables. */ |
unsigned int dynsymcount; |
/* Pointer to structure which contains architecture information. */ |
const struct bfd_arch_info *arch_info; |
/* Stuff only useful for archives. */ |
void *arelt_data; |
struct bfd *my_archive; /* The containing archive BFD. */ |
struct bfd *archive_next; /* The next BFD in the archive. */ |
struct bfd *archive_head; /* The first BFD in the archive. */ |
struct bfd *nested_archives; /* List of nested archive in a flattened |
thin archive. */ |
union { |
/* For input BFDs, a chain of BFDs involved in a link. */ |
struct bfd *next; |
/* For output BFD, the linker hash table. */ |
struct bfd_link_hash_table *hash; |
} link; |
/* Used by the back end to hold private data. */ |
union |
{ |
struct aout_data_struct *aout_data; |
struct artdata *aout_ar_data; |
struct _oasys_data *oasys_obj_data; |
struct _oasys_ar_data *oasys_ar_data; |
struct coff_tdata *coff_obj_data; |
struct pe_tdata *pe_obj_data; |
struct xcoff_tdata *xcoff_obj_data; |
struct ecoff_tdata *ecoff_obj_data; |
struct ieee_data_struct *ieee_data; |
struct ieee_ar_data_struct *ieee_ar_data; |
struct srec_data_struct *srec_data; |
struct verilog_data_struct *verilog_data; |
struct ihex_data_struct *ihex_data; |
struct tekhex_data_struct *tekhex_data; |
struct elf_obj_tdata *elf_obj_data; |
struct nlm_obj_tdata *nlm_obj_data; |
struct bout_data_struct *bout_data; |
struct mmo_data_struct *mmo_data; |
struct sun_core_struct *sun_core_data; |
struct sco5_core_struct *sco5_core_data; |
struct trad_core_struct *trad_core_data; |
struct som_data_struct *som_data; |
struct hpux_core_struct *hpux_core_data; |
struct hppabsd_core_struct *hppabsd_core_data; |
struct sgi_core_struct *sgi_core_data; |
struct lynx_core_struct *lynx_core_data; |
struct osf_core_struct *osf_core_data; |
struct cisco_core_struct *cisco_core_data; |
struct versados_data_struct *versados_data; |
struct netbsd_core_struct *netbsd_core_data; |
struct mach_o_data_struct *mach_o_data; |
struct mach_o_fat_data_struct *mach_o_fat_data; |
struct plugin_data_struct *plugin_data; |
struct bfd_pef_data_struct *pef_data; |
struct bfd_pef_xlib_data_struct *pef_xlib_data; |
struct bfd_sym_data_struct *sym_data; |
void *any; |
} |
tdata; |
/* Used by the application to hold private data. */ |
void *usrdata; |
/* Where all the allocated stuff under this BFD goes. This is a |
struct objalloc *, but we use void * to avoid requiring the inclusion |
of objalloc.h. */ |
void *memory; |
/* For input BFDs, the build ID, if the object has one. */ |
const struct bfd_build_id *build_id; |
}; |
/* See note beside bfd_set_section_userdata. */ |
static inline bfd_boolean |
bfd_set_cacheable (bfd * abfd, bfd_boolean val) |
{ |
abfd->cacheable = val; |
return TRUE; |
} |
typedef enum bfd_error |
{ |
bfd_error_no_error = 0, |
bfd_error_system_call, |
bfd_error_invalid_target, |
bfd_error_wrong_format, |
bfd_error_wrong_object_format, |
bfd_error_invalid_operation, |
bfd_error_no_memory, |
bfd_error_no_symbols, |
bfd_error_no_armap, |
bfd_error_no_more_archived_files, |
bfd_error_malformed_archive, |
bfd_error_missing_dso, |
bfd_error_file_not_recognized, |
bfd_error_file_ambiguously_recognized, |
bfd_error_no_contents, |
bfd_error_nonrepresentable_section, |
bfd_error_no_debug_section, |
bfd_error_bad_value, |
bfd_error_file_truncated, |
bfd_error_file_too_big, |
bfd_error_on_input, |
bfd_error_invalid_error_code |
} |
bfd_error_type; |
bfd_error_type bfd_get_error (void); |
void bfd_set_error (bfd_error_type error_tag, ...); |
const char *bfd_errmsg (bfd_error_type error_tag); |
void bfd_perror (const char *message); |
typedef void (*bfd_error_handler_type) (const char *, ...); |
bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); |
void bfd_set_error_program_name (const char *); |
bfd_error_handler_type bfd_get_error_handler (void); |
typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg, |
const char *bfd_version, |
const char *bfd_file, |
int bfd_line); |
bfd_assert_handler_type bfd_set_assert_handler (bfd_assert_handler_type); |
bfd_assert_handler_type bfd_get_assert_handler (void); |
long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect); |
long bfd_canonicalize_reloc |
(bfd *abfd, asection *sec, arelent **loc, asymbol **syms); |
void bfd_set_reloc |
(bfd *abfd, asection *sec, arelent **rel, unsigned int count); |
bfd_boolean bfd_set_file_flags (bfd *abfd, flagword flags); |
int bfd_get_arch_size (bfd *abfd); |
int bfd_get_sign_extend_vma (bfd *abfd); |
bfd_boolean bfd_set_start_address (bfd *abfd, bfd_vma vma); |
unsigned int bfd_get_gp_size (bfd *abfd); |
void bfd_set_gp_size (bfd *abfd, unsigned int i); |
bfd_vma bfd_scan_vma (const char *string, const char **end, int base); |
bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd); |
#define bfd_copy_private_header_data(ibfd, obfd) \ |
BFD_SEND (obfd, _bfd_copy_private_header_data, \ |
(ibfd, obfd)) |
bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd); |
#define bfd_copy_private_bfd_data(ibfd, obfd) \ |
BFD_SEND (obfd, _bfd_copy_private_bfd_data, \ |
(ibfd, obfd)) |
bfd_boolean bfd_merge_private_bfd_data (bfd *ibfd, bfd *obfd); |
#define bfd_merge_private_bfd_data(ibfd, obfd) \ |
BFD_SEND (obfd, _bfd_merge_private_bfd_data, \ |
(ibfd, obfd)) |
bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); |
#define bfd_set_private_flags(abfd, flags) \ |
BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags)) |
#define bfd_sizeof_headers(abfd, info) \ |
BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info)) |
#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ |
BFD_SEND (abfd, _bfd_find_nearest_line, \ |
(abfd, syms, sec, off, file, func, line, NULL)) |
#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \ |
line, disc) \ |
BFD_SEND (abfd, _bfd_find_nearest_line, \ |
(abfd, syms, sec, off, file, func, line, disc)) |
#define bfd_find_line(abfd, syms, sym, file, line) \ |
BFD_SEND (abfd, _bfd_find_line, \ |
(abfd, syms, sym, file, line)) |
#define bfd_find_inliner_info(abfd, file, func, line) \ |
BFD_SEND (abfd, _bfd_find_inliner_info, \ |
(abfd, file, func, line)) |
#define bfd_debug_info_start(abfd) \ |
BFD_SEND (abfd, _bfd_debug_info_start, (abfd)) |
#define bfd_debug_info_end(abfd) \ |
BFD_SEND (abfd, _bfd_debug_info_end, (abfd)) |
#define bfd_debug_info_accumulate(abfd, section) \ |
BFD_SEND (abfd, _bfd_debug_info_accumulate, (abfd, section)) |
#define bfd_stat_arch_elt(abfd, stat) \ |
BFD_SEND (abfd, _bfd_stat_arch_elt,(abfd, stat)) |
#define bfd_update_armap_timestamp(abfd) \ |
BFD_SEND (abfd, _bfd_update_armap_timestamp, (abfd)) |
#define bfd_set_arch_mach(abfd, arch, mach)\ |
BFD_SEND ( abfd, _bfd_set_arch_mach, (abfd, arch, mach)) |
#define bfd_relax_section(abfd, section, link_info, again) \ |
BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again)) |
#define bfd_gc_sections(abfd, link_info) \ |
BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info)) |
#define bfd_lookup_section_flags(link_info, flag_info, section) \ |
BFD_SEND (abfd, _bfd_lookup_section_flags, (link_info, flag_info, section)) |
#define bfd_merge_sections(abfd, link_info) \ |
BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) |
#define bfd_is_group_section(abfd, sec) \ |
BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec)) |
#define bfd_discard_group(abfd, sec) \ |
BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) |
#define bfd_link_hash_table_create(abfd) \ |
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) |
#define bfd_link_add_symbols(abfd, info) \ |
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) |
#define bfd_link_just_syms(abfd, sec, info) \ |
BFD_SEND (abfd, _bfd_link_just_syms, (sec, info)) |
#define bfd_final_link(abfd, info) \ |
BFD_SEND (abfd, _bfd_final_link, (abfd, info)) |
#define bfd_free_cached_info(abfd) \ |
BFD_SEND (abfd, _bfd_free_cached_info, (abfd)) |
#define bfd_get_dynamic_symtab_upper_bound(abfd) \ |
BFD_SEND (abfd, _bfd_get_dynamic_symtab_upper_bound, (abfd)) |
#define bfd_print_private_bfd_data(abfd, file)\ |
BFD_SEND (abfd, _bfd_print_private_bfd_data, (abfd, file)) |
#define bfd_canonicalize_dynamic_symtab(abfd, asymbols) \ |
BFD_SEND (abfd, _bfd_canonicalize_dynamic_symtab, (abfd, asymbols)) |
#define bfd_get_synthetic_symtab(abfd, count, syms, dyncount, dynsyms, ret) \ |
BFD_SEND (abfd, _bfd_get_synthetic_symtab, (abfd, count, syms, \ |
dyncount, dynsyms, ret)) |
#define bfd_get_dynamic_reloc_upper_bound(abfd) \ |
BFD_SEND (abfd, _bfd_get_dynamic_reloc_upper_bound, (abfd)) |
#define bfd_canonicalize_dynamic_reloc(abfd, arels, asyms) \ |
BFD_SEND (abfd, _bfd_canonicalize_dynamic_reloc, (abfd, arels, asyms)) |
extern bfd_byte *bfd_get_relocated_section_contents |
(bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, |
bfd_boolean, asymbol **); |
bfd_boolean bfd_alt_mach_code (bfd *abfd, int alternative); |
bfd_vma bfd_emul_get_maxpagesize (const char *); |
void bfd_emul_set_maxpagesize (const char *, bfd_vma); |
bfd_vma bfd_emul_get_commonpagesize (const char *); |
void bfd_emul_set_commonpagesize (const char *, bfd_vma); |
char *bfd_demangle (bfd *, const char *, int); |
void bfd_update_compression_header |
(bfd *abfd, bfd_byte *contents, asection *sec); |
bfd_boolean bfd_check_compression_header |
(bfd *abfd, bfd_byte *contents, asection *sec, |
bfd_size_type *uncompressed_size); |
int bfd_get_compression_header_size (bfd *abfd, asection *sec); |
bfd_size_type bfd_convert_section_size |
(bfd *ibfd, asection *isec, bfd *obfd, bfd_size_type size); |
bfd_boolean bfd_convert_section_contents |
(bfd *ibfd, asection *isec, bfd *obfd, |
bfd_byte **ptr, bfd_size_type *ptr_size); |
/* Extracted from archive.c. */ |
symindex bfd_get_next_mapent |
(bfd *abfd, symindex previous, carsym **sym); |
bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head); |
bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous); |
/* Extracted from corefile.c. */ |
const char *bfd_core_file_failing_command (bfd *abfd); |
int bfd_core_file_failing_signal (bfd *abfd); |
int bfd_core_file_pid (bfd *abfd); |
bfd_boolean core_file_matches_executable_p |
(bfd *core_bfd, bfd *exec_bfd); |
bfd_boolean generic_core_file_matches_executable_p |
(bfd *core_bfd, bfd *exec_bfd); |
/* Extracted from targets.c. */ |
#define BFD_SEND(bfd, message, arglist) \ |
((*((bfd)->xvec->message)) arglist) |
#ifdef DEBUG_BFD_SEND |
#undef BFD_SEND |
#define BFD_SEND(bfd, message, arglist) \ |
(((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ |
((*((bfd)->xvec->message)) arglist) : \ |
(bfd_assert (__FILE__,__LINE__), NULL)) |
#endif |
#define BFD_SEND_FMT(bfd, message, arglist) \ |
(((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) |
#ifdef DEBUG_BFD_SEND |
#undef BFD_SEND_FMT |
#define BFD_SEND_FMT(bfd, message, arglist) \ |
(((bfd) && (bfd)->xvec && (bfd)->xvec->message) ? \ |
(((bfd)->xvec->message[(int) ((bfd)->format)]) arglist) : \ |
(bfd_assert (__FILE__,__LINE__), NULL)) |
#endif |
enum bfd_flavour |
{ |
/* N.B. Update bfd_flavour_name if you change this. */ |
bfd_target_unknown_flavour, |
bfd_target_aout_flavour, |
bfd_target_coff_flavour, |
bfd_target_ecoff_flavour, |
bfd_target_xcoff_flavour, |
bfd_target_elf_flavour, |
bfd_target_ieee_flavour, |
bfd_target_nlm_flavour, |
bfd_target_oasys_flavour, |
bfd_target_tekhex_flavour, |
bfd_target_srec_flavour, |
bfd_target_verilog_flavour, |
bfd_target_ihex_flavour, |
bfd_target_som_flavour, |
bfd_target_os9k_flavour, |
bfd_target_versados_flavour, |
bfd_target_msdos_flavour, |
bfd_target_ovax_flavour, |
bfd_target_evax_flavour, |
bfd_target_mmo_flavour, |
bfd_target_mach_o_flavour, |
bfd_target_pef_flavour, |
bfd_target_pef_xlib_flavour, |
bfd_target_sym_flavour |
}; |
enum bfd_endian { BFD_ENDIAN_BIG, BFD_ENDIAN_LITTLE, BFD_ENDIAN_UNKNOWN }; |
/* Forward declaration. */ |
typedef struct bfd_link_info _bfd_link_info; |
/* Forward declaration. */ |
typedef struct flag_info flag_info; |
typedef struct bfd_target |
{ |
/* Identifies the kind of target, e.g., SunOS4, Ultrix, etc. */ |
char *name; |
/* The "flavour" of a back end is a general indication about |
the contents of a file. */ |
enum bfd_flavour flavour; |
/* The order of bytes within the data area of a file. */ |
enum bfd_endian byteorder; |
/* The order of bytes within the header parts of a file. */ |
enum bfd_endian header_byteorder; |
/* A mask of all the flags which an executable may have set - |
from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>. */ |
flagword object_flags; |
/* A mask of all the flags which a section may have set - from |
the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>. */ |
flagword section_flags; |
/* The character normally found at the front of a symbol. |
(if any), perhaps `_'. */ |
char symbol_leading_char; |
/* The pad character for file names within an archive header. */ |
char ar_pad_char; |
/* The maximum number of characters in an archive header. */ |
unsigned char ar_max_namelen; |
/* How well this target matches, used to select between various |
possible targets when more than one target matches. */ |
unsigned char match_priority; |
/* Entries for byte swapping for data. These are different from the |
other entry points, since they don't take a BFD as the first argument. |
Certain other handlers could do the same. */ |
bfd_uint64_t (*bfd_getx64) (const void *); |
bfd_int64_t (*bfd_getx_signed_64) (const void *); |
void (*bfd_putx64) (bfd_uint64_t, void *); |
bfd_vma (*bfd_getx32) (const void *); |
bfd_signed_vma (*bfd_getx_signed_32) (const void *); |
void (*bfd_putx32) (bfd_vma, void *); |
bfd_vma (*bfd_getx16) (const void *); |
bfd_signed_vma (*bfd_getx_signed_16) (const void *); |
void (*bfd_putx16) (bfd_vma, void *); |
/* Byte swapping for the headers. */ |
bfd_uint64_t (*bfd_h_getx64) (const void *); |
bfd_int64_t (*bfd_h_getx_signed_64) (const void *); |
void (*bfd_h_putx64) (bfd_uint64_t, void *); |
bfd_vma (*bfd_h_getx32) (const void *); |
bfd_signed_vma (*bfd_h_getx_signed_32) (const void *); |
void (*bfd_h_putx32) (bfd_vma, void *); |
bfd_vma (*bfd_h_getx16) (const void *); |
bfd_signed_vma (*bfd_h_getx_signed_16) (const void *); |
void (*bfd_h_putx16) (bfd_vma, void *); |
/* Format dependent routines: these are vectors of entry points |
within the target vector structure, one for each format to check. */ |
/* Check the format of a file being read. Return a <<bfd_target *>> or zero. */ |
const struct bfd_target *(*_bfd_check_format[bfd_type_end]) (bfd *); |
/* Set the format of a file being written. */ |
bfd_boolean (*_bfd_set_format[bfd_type_end]) (bfd *); |
/* Write cached information into a file being written, at <<bfd_close>>. */ |
bfd_boolean (*_bfd_write_contents[bfd_type_end]) (bfd *); |
/* Generic entry points. */ |
#define BFD_JUMP_TABLE_GENERIC(NAME) \ |
NAME##_close_and_cleanup, \ |
NAME##_bfd_free_cached_info, \ |
NAME##_new_section_hook, \ |
NAME##_get_section_contents, \ |
NAME##_get_section_contents_in_window |
/* Called when the BFD is being closed to do any necessary cleanup. */ |
bfd_boolean (*_close_and_cleanup) (bfd *); |
/* Ask the BFD to free all cached information. */ |
bfd_boolean (*_bfd_free_cached_info) (bfd *); |
/* Called when a new section is created. */ |
bfd_boolean (*_new_section_hook) (bfd *, sec_ptr); |
/* Read the contents of a section. */ |
bfd_boolean (*_bfd_get_section_contents) |
(bfd *, sec_ptr, void *, file_ptr, bfd_size_type); |
bfd_boolean (*_bfd_get_section_contents_in_window) |
(bfd *, sec_ptr, bfd_window *, file_ptr, bfd_size_type); |
/* Entry points to copy private data. */ |
#define BFD_JUMP_TABLE_COPY(NAME) \ |
NAME##_bfd_copy_private_bfd_data, \ |
NAME##_bfd_merge_private_bfd_data, \ |
_bfd_generic_init_private_section_data, \ |
NAME##_bfd_copy_private_section_data, \ |
NAME##_bfd_copy_private_symbol_data, \ |
NAME##_bfd_copy_private_header_data, \ |
NAME##_bfd_set_private_flags, \ |
NAME##_bfd_print_private_bfd_data |
/* Called to copy BFD general private data from one object file |
to another. */ |
bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *); |
/* Called to merge BFD general private data from one object file |
to a common output file when linking. */ |
bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *); |
/* Called to initialize BFD private section data from one object file |
to another. */ |
#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \ |
BFD_SEND (obfd, _bfd_init_private_section_data, (ibfd, isec, obfd, osec, link_info)) |
bfd_boolean (*_bfd_init_private_section_data) |
(bfd *, sec_ptr, bfd *, sec_ptr, struct bfd_link_info *); |
/* Called to copy BFD private section data from one object file |
to another. */ |
bfd_boolean (*_bfd_copy_private_section_data) |
(bfd *, sec_ptr, bfd *, sec_ptr); |
/* Called to copy BFD private symbol data from one symbol |
to another. */ |
bfd_boolean (*_bfd_copy_private_symbol_data) |
(bfd *, asymbol *, bfd *, asymbol *); |
/* Called to copy BFD private header data from one object file |
to another. */ |
bfd_boolean (*_bfd_copy_private_header_data) |
(bfd *, bfd *); |
/* Called to set private backend flags. */ |
bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword); |
/* Called to print private BFD data. */ |
bfd_boolean (*_bfd_print_private_bfd_data) (bfd *, void *); |
/* Core file entry points. */ |
#define BFD_JUMP_TABLE_CORE(NAME) \ |
NAME##_core_file_failing_command, \ |
NAME##_core_file_failing_signal, \ |
NAME##_core_file_matches_executable_p, \ |
NAME##_core_file_pid |
char * (*_core_file_failing_command) (bfd *); |
int (*_core_file_failing_signal) (bfd *); |
bfd_boolean (*_core_file_matches_executable_p) (bfd *, bfd *); |
int (*_core_file_pid) (bfd *); |
/* Archive entry points. */ |
#define BFD_JUMP_TABLE_ARCHIVE(NAME) \ |
NAME##_slurp_armap, \ |
NAME##_slurp_extended_name_table, \ |
NAME##_construct_extended_name_table, \ |
NAME##_truncate_arname, \ |
NAME##_write_armap, \ |
NAME##_read_ar_hdr, \ |
NAME##_write_ar_hdr, \ |
NAME##_openr_next_archived_file, \ |
NAME##_get_elt_at_index, \ |
NAME##_generic_stat_arch_elt, \ |
NAME##_update_armap_timestamp |
bfd_boolean (*_bfd_slurp_armap) (bfd *); |
bfd_boolean (*_bfd_slurp_extended_name_table) (bfd *); |
bfd_boolean (*_bfd_construct_extended_name_table) |
(bfd *, char **, bfd_size_type *, const char **); |
void (*_bfd_truncate_arname) (bfd *, const char *, char *); |
bfd_boolean (*write_armap) |
(bfd *, unsigned int, struct orl *, unsigned int, int); |
void * (*_bfd_read_ar_hdr_fn) (bfd *); |
bfd_boolean (*_bfd_write_ar_hdr_fn) (bfd *, bfd *); |
bfd * (*openr_next_archived_file) (bfd *, bfd *); |
#define bfd_get_elt_at_index(b,i) BFD_SEND (b, _bfd_get_elt_at_index, (b,i)) |
bfd * (*_bfd_get_elt_at_index) (bfd *, symindex); |
int (*_bfd_stat_arch_elt) (bfd *, struct stat *); |
bfd_boolean (*_bfd_update_armap_timestamp) (bfd *); |
/* Entry points used for symbols. */ |
#define BFD_JUMP_TABLE_SYMBOLS(NAME) \ |
NAME##_get_symtab_upper_bound, \ |
NAME##_canonicalize_symtab, \ |
NAME##_make_empty_symbol, \ |
NAME##_print_symbol, \ |
NAME##_get_symbol_info, \ |
NAME##_get_symbol_version_string, \ |
NAME##_bfd_is_local_label_name, \ |
NAME##_bfd_is_target_special_symbol, \ |
NAME##_get_lineno, \ |
NAME##_find_nearest_line, \ |
NAME##_find_line, \ |
NAME##_find_inliner_info, \ |
NAME##_bfd_make_debug_symbol, \ |
NAME##_read_minisymbols, \ |
NAME##_minisymbol_to_symbol |
long (*_bfd_get_symtab_upper_bound) (bfd *); |
long (*_bfd_canonicalize_symtab) |
(bfd *, struct bfd_symbol **); |
struct bfd_symbol * |
(*_bfd_make_empty_symbol) (bfd *); |
void (*_bfd_print_symbol) |
(bfd *, void *, struct bfd_symbol *, bfd_print_symbol_type); |
#define bfd_print_symbol(b,p,s,e) BFD_SEND (b, _bfd_print_symbol, (b,p,s,e)) |
void (*_bfd_get_symbol_info) |
(bfd *, struct bfd_symbol *, symbol_info *); |
#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) |
const char *(*_bfd_get_symbol_version_string) |
(bfd *, struct bfd_symbol *, bfd_boolean *); |
#define bfd_get_symbol_version_string(b,s,h) BFD_SEND (b, _bfd_get_symbol_version_string, (b,s,h)) |
bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); |
bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); |
alent * (*_get_lineno) (bfd *, struct bfd_symbol *); |
bfd_boolean (*_bfd_find_nearest_line) |
(bfd *, struct bfd_symbol **, struct bfd_section *, bfd_vma, |
const char **, const char **, unsigned int *, unsigned int *); |
bfd_boolean (*_bfd_find_line) |
(bfd *, struct bfd_symbol **, struct bfd_symbol *, |
const char **, unsigned int *); |
bfd_boolean (*_bfd_find_inliner_info) |
(bfd *, const char **, const char **, unsigned int *); |
/* Back-door to allow format-aware applications to create debug symbols |
while using BFD for everything else. Currently used by the assembler |
when creating COFF files. */ |
asymbol * (*_bfd_make_debug_symbol) |
(bfd *, void *, unsigned long size); |
#define bfd_read_minisymbols(b, d, m, s) \ |
BFD_SEND (b, _read_minisymbols, (b, d, m, s)) |
long (*_read_minisymbols) |
(bfd *, bfd_boolean, void **, unsigned int *); |
#define bfd_minisymbol_to_symbol(b, d, m, f) \ |
BFD_SEND (b, _minisymbol_to_symbol, (b, d, m, f)) |
asymbol * (*_minisymbol_to_symbol) |
(bfd *, bfd_boolean, const void *, asymbol *); |
/* Routines for relocs. */ |
#define BFD_JUMP_TABLE_RELOCS(NAME) \ |
NAME##_get_reloc_upper_bound, \ |
NAME##_canonicalize_reloc, \ |
NAME##_bfd_reloc_type_lookup, \ |
NAME##_bfd_reloc_name_lookup |
long (*_get_reloc_upper_bound) (bfd *, sec_ptr); |
long (*_bfd_canonicalize_reloc) |
(bfd *, sec_ptr, arelent **, struct bfd_symbol **); |
/* See documentation on reloc types. */ |
reloc_howto_type * |
(*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type); |
reloc_howto_type * |
(*reloc_name_lookup) (bfd *, const char *); |
/* Routines used when writing an object file. */ |
#define BFD_JUMP_TABLE_WRITE(NAME) \ |
NAME##_set_arch_mach, \ |
NAME##_set_section_contents |
bfd_boolean (*_bfd_set_arch_mach) |
(bfd *, enum bfd_architecture, unsigned long); |
bfd_boolean (*_bfd_set_section_contents) |
(bfd *, sec_ptr, const void *, file_ptr, bfd_size_type); |
/* Routines used by the linker. */ |
#define BFD_JUMP_TABLE_LINK(NAME) \ |
NAME##_sizeof_headers, \ |
NAME##_bfd_get_relocated_section_contents, \ |
NAME##_bfd_relax_section, \ |
NAME##_bfd_link_hash_table_create, \ |
NAME##_bfd_link_add_symbols, \ |
NAME##_bfd_link_just_syms, \ |
NAME##_bfd_copy_link_hash_symbol_type, \ |
NAME##_bfd_final_link, \ |
NAME##_bfd_link_split_section, \ |
NAME##_bfd_gc_sections, \ |
NAME##_bfd_lookup_section_flags, \ |
NAME##_bfd_merge_sections, \ |
NAME##_bfd_is_group_section, \ |
NAME##_bfd_discard_group, \ |
NAME##_section_already_linked, \ |
NAME##_bfd_define_common_symbol |
int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *); |
bfd_byte * (*_bfd_get_relocated_section_contents) |
(bfd *, struct bfd_link_info *, struct bfd_link_order *, |
bfd_byte *, bfd_boolean, struct bfd_symbol **); |
bfd_boolean (*_bfd_relax_section) |
(bfd *, struct bfd_section *, struct bfd_link_info *, bfd_boolean *); |
/* Create a hash table for the linker. Different backends store |
different information in this table. */ |
struct bfd_link_hash_table * |
(*_bfd_link_hash_table_create) (bfd *); |
/* Add symbols from this object file into the hash table. */ |
bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); |
/* Indicate that we are only retrieving symbol values from this section. */ |
void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *); |
/* Copy the symbol type and other attributes for a linker script |
assignment of one symbol to another. */ |
#define bfd_copy_link_hash_symbol_type(b, t, f) \ |
BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f)) |
void (*_bfd_copy_link_hash_symbol_type) |
(bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *); |
/* Do a link based on the link_order structures attached to each |
section of the BFD. */ |
bfd_boolean (*_bfd_final_link) (bfd *, struct bfd_link_info *); |
/* Should this section be split up into smaller pieces during linking. */ |
bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *); |
/* Remove sections that are not referenced from the output. */ |
bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *); |
/* Sets the bitmask of allowed and disallowed section flags. */ |
bfd_boolean (*_bfd_lookup_section_flags) (struct bfd_link_info *, |
struct flag_info *, |
asection *); |
/* Attempt to merge SEC_MERGE sections. */ |
bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); |
/* Is this section a member of a group? */ |
bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *); |
/* Discard members of a group. */ |
bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); |
/* Check if SEC has been already linked during a reloceatable or |
final link. */ |
bfd_boolean (*_section_already_linked) (bfd *, asection *, |
struct bfd_link_info *); |
/* Define a common symbol. */ |
bfd_boolean (*_bfd_define_common_symbol) (bfd *, struct bfd_link_info *, |
struct bfd_link_hash_entry *); |
/* Routines to handle dynamic symbols and relocs. */ |
#define BFD_JUMP_TABLE_DYNAMIC(NAME) \ |
NAME##_get_dynamic_symtab_upper_bound, \ |
NAME##_canonicalize_dynamic_symtab, \ |
NAME##_get_synthetic_symtab, \ |
NAME##_get_dynamic_reloc_upper_bound, \ |
NAME##_canonicalize_dynamic_reloc |
/* Get the amount of memory required to hold the dynamic symbols. */ |
long (*_bfd_get_dynamic_symtab_upper_bound) (bfd *); |
/* Read in the dynamic symbols. */ |
long (*_bfd_canonicalize_dynamic_symtab) |
(bfd *, struct bfd_symbol **); |
/* Create synthetized symbols. */ |
long (*_bfd_get_synthetic_symtab) |
(bfd *, long, struct bfd_symbol **, long, struct bfd_symbol **, |
struct bfd_symbol **); |
/* Get the amount of memory required to hold the dynamic relocs. */ |
long (*_bfd_get_dynamic_reloc_upper_bound) (bfd *); |
/* Read in the dynamic relocs. */ |
long (*_bfd_canonicalize_dynamic_reloc) |
(bfd *, arelent **, struct bfd_symbol **); |
/* Opposite endian version of this target. */ |
const struct bfd_target * alternative_target; |
/* Data for use by back-end routines, which isn't |
generic enough to belong in this structure. */ |
const void *backend_data; |
} bfd_target; |
bfd_boolean bfd_set_default_target (const char *name); |
const bfd_target *bfd_find_target (const char *target_name, bfd *abfd); |
const bfd_target *bfd_get_target_info (const char *target_name, |
bfd *abfd, |
bfd_boolean *is_bigendian, |
int *underscoring, |
const char **def_target_arch); |
const char ** bfd_target_list (void); |
const bfd_target *bfd_search_for_target |
(int (*search_func) (const bfd_target *, void *), |
void *); |
const char *bfd_flavour_name (enum bfd_flavour flavour); |
/* Extracted from format.c. */ |
bfd_boolean bfd_check_format (bfd *abfd, bfd_format format); |
bfd_boolean bfd_check_format_matches |
(bfd *abfd, bfd_format format, char ***matching); |
bfd_boolean bfd_set_format (bfd *abfd, bfd_format format); |
const char *bfd_format_string (bfd_format format); |
/* Extracted from linker.c. */ |
bfd_boolean bfd_link_split_section (bfd *abfd, asection *sec); |
#define bfd_link_split_section(abfd, sec) \ |
BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec)) |
bfd_boolean bfd_section_already_linked (bfd *abfd, |
asection *sec, |
struct bfd_link_info *info); |
#define bfd_section_already_linked(abfd, sec, info) \ |
BFD_SEND (abfd, _section_already_linked, (abfd, sec, info)) |
bfd_boolean bfd_generic_define_common_symbol |
(bfd *output_bfd, struct bfd_link_info *info, |
struct bfd_link_hash_entry *h); |
#define bfd_define_common_symbol(output_bfd, info, h) \ |
BFD_SEND (output_bfd, _bfd_define_common_symbol, (output_bfd, info, h)) |
struct bfd_elf_version_tree * bfd_find_version_for_sym |
(struct bfd_elf_version_tree *verdefs, |
const char *sym_name, bfd_boolean *hide); |
bfd_boolean bfd_hide_sym_by_version |
(struct bfd_elf_version_tree *verdefs, const char *sym_name); |
/* Extracted from simple.c. */ |
bfd_byte *bfd_simple_get_relocated_section_contents |
(bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table); |
/* Extracted from compress.c. */ |
bfd_boolean bfd_get_full_section_contents |
(bfd *abfd, asection *section, bfd_byte **ptr); |
void bfd_cache_section_contents |
(asection *sec, void *contents); |
bfd_boolean bfd_is_section_compressed_with_header |
(bfd *abfd, asection *section, |
int *compression_header_size_p, |
bfd_size_type *uncompressed_size_p); |
bfd_boolean bfd_is_section_compressed |
(bfd *abfd, asection *section); |
bfd_boolean bfd_init_section_decompress_status |
(bfd *abfd, asection *section); |
bfd_boolean bfd_init_section_compress_status |
(bfd *abfd, asection *section); |
bfd_boolean bfd_compress_section |
(bfd *abfd, asection *section, bfd_byte *uncompressed_buffer); |
#ifdef __cplusplus |
} |
#endif |
#endif |
/contrib/toolchain/binutils/bfd/bfd-in3.h |
---|
7,7 → 7,7 |
/* Main header file for the bfd library -- portable access to object files. |
Copyright 1990-2013 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Contributed by Cygnus Support. |
279,7 → 279,7 |
/* Object and core file sections. */ |
#define align_power(addr, align) \ |
(((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align))) |
(((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align)))) |
typedef struct bfd_section *sec_ptr; |
299,13 → 299,13 |
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) |
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE) |
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE) |
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE) |
#define bfd_get_section_limit_octets(bfd, sec) \ |
((bfd)->direction != write_direction && (sec)->rawsize != 0 \ |
? (sec)->rawsize : (sec)->size) |
/* Find the address one past the end of SEC. */ |
#define bfd_get_section_limit(bfd, sec) \ |
(((bfd)->direction != write_direction && (sec)->rawsize != 0 \ |
? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd)) |
(bfd_get_section_limit_octets(bfd, sec) / bfd_octets_per_byte (bfd)) |
/* Return TRUE if input section SEC has been discarded. */ |
#define discarded_section(sec) \ |
444,6 → 444,16 |
this size. */ |
extern unsigned long bfd_hash_set_default_size (unsigned long); |
/* Types of compressed DWARF debug sections. We currently support |
zlib. */ |
enum compressed_debug_section_type |
{ |
COMPRESS_DEBUG_NONE = 0, |
COMPRESS_DEBUG = 1 << 0, |
COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1, |
COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2 |
}; |
/* This structure is used to keep track of stabs in sections |
information while linking. */ |
524,8 → 534,6 |
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) |
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE) |
extern bfd_boolean bfd_cache_close |
(bfd *abfd); |
/* NB: This declaration should match the autogenerated one in libbfd.h. */ |
670,7 → 678,7 |
(bfd *); |
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_elf_discard_info |
extern int bfd_elf_discard_info |
(bfd *, struct bfd_link_info *); |
extern unsigned int _bfd_elf_default_action_discarded |
(struct bfd_section *); |
692,19 → 700,21 |
(bfd *abfd, void *phdrs); |
/* Create a new BFD as if by bfd_openr. Rather than opening a file, |
reconstruct an ELF file by reading the segments out of remote memory |
based on the ELF file header at EHDR_VMA and the ELF program headers it |
points to. If not null, *LOADBASEP is filled in with the difference |
between the VMAs from which the segments were read, and the VMAs the |
file headers (and hence BFD's idea of each section's VMA) put them at. |
reconstruct an ELF file by reading the segments out of remote |
memory based on the ELF file header at EHDR_VMA and the ELF program |
headers it points to. If non-zero, SIZE is the known extent of the |
object. If not null, *LOADBASEP is filled in with the difference |
between the VMAs from which the segments were read, and the VMAs |
the file headers (and hence BFD's idea of each section's VMA) put |
them at. |
The function TARGET_READ_MEMORY is called to copy LEN bytes from the |
remote memory at target address VMA into the local buffer at MYADDR; it |
should return zero on success or an `errno' code on failure. TEMPL must |
be a BFD for an ELF target with the word size and byte order found in |
the remote memory. */ |
The function TARGET_READ_MEMORY is called to copy LEN bytes from |
the remote memory at target address VMA into the local buffer at |
MYADDR; it should return zero on success or an `errno' code on |
failure. TEMPL must be a BFD for a target with the word size and |
byte order found in the remote memory. */ |
extern bfd *bfd_elf_bfd_from_remote_memory |
(bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, |
(bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep, |
int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, |
bfd_size_type len)); |
816,12 → 826,6 |
union internal_auxent; |
#endif |
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 *); |
extern bfd_boolean bfd_coff_set_symbol_class |
(bfd *, struct bfd_symbol *, unsigned int); |
852,6 → 856,23 |
extern void bfd_elf32_arm_vfp11_fix_veneer_locations |
(bfd *, struct bfd_link_info *); |
/* ARM STM STM32L4XX erratum workaround support. */ |
typedef enum |
{ |
BFD_ARM_STM32L4XX_FIX_NONE, |
BFD_ARM_STM32L4XX_FIX_DEFAULT, |
BFD_ARM_STM32L4XX_FIX_ALL |
} bfd_arm_stm32l4xx_fix; |
extern void bfd_elf32_arm_set_stm32l4xx_fix |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_elf32_arm_stm32l4xx_erratum_scan |
(bfd *, struct bfd_link_info *); |
extern void bfd_elf32_arm_stm32l4xx_fix_veneer_locations |
(bfd *, struct bfd_link_info *); |
/* ARM Interworking support. Called from linker. */ |
extern bfd_boolean bfd_arm_allocate_interworking_sections |
(struct bfd_link_info *); |
881,7 → 902,7 |
void bfd_elf32_arm_set_target_relocs |
(bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix, |
int, int, int, int, int); |
bfd_arm_stm32l4xx_fix, int, int, int, int, int); |
extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking |
(bfd *, struct bfd_link_info *); |
889,16 → 910,20 |
extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd |
(bfd *, struct bfd_link_info *); |
/* ELF ARM mapping symbol support */ |
/* ELF ARM mapping symbol support. */ |
#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0) |
#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1) |
#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2) |
#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0) |
extern bfd_boolean bfd_is_arm_special_symbol_name |
(const char * name, int type); |
(const char *, int); |
extern void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int); |
extern void bfd_elf32_arm_set_byteswap_code |
(struct bfd_link_info *, int); |
extern void bfd_elf32_arm_use_long_plt (void); |
/* ARM Note section processing. */ |
extern bfd_boolean bfd_arm_merge_machines |
(bfd *, bfd *); |
943,10 → 968,10 |
(bfd *); |
extern void bfd_elf64_aarch64_set_options |
(bfd *, struct bfd_link_info *, int, int, int); |
(bfd *, struct bfd_link_info *, int, int, int, int, int); |
extern void bfd_elf32_aarch64_set_options |
(bfd *, struct bfd_link_info *, int, int, int); |
(bfd *, struct bfd_link_info *, int, int, int, int, int); |
/* ELF AArch64 mapping symbol support. */ |
#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) |
998,29 → 1023,17 |
extern void bfd_elf64_ia64_after_parse |
(int); |
/* 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. */ |
/* V850 Note manipulation routines. */ |
extern bfd_boolean v850_elf_create_sections |
(struct bfd_link_info *); |
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; |
}; |
extern struct coff_comdat_info * bfd_coff_get_comdat_section |
(bfd *, struct bfd_section *); |
extern bfd_boolean v850_elf_set_note |
(bfd *, unsigned int, unsigned int); |
/* Extracted from init.c. */ |
void bfd_init (void); |
/* Extracted from opncls.c. */ |
/* Set to N to open the next N BFDs using an alternate id space. */ |
extern unsigned int bfd_use_reserved_id; |
bfd *bfd_fopen (const char *filename, const char *target, |
const char *mode, int fd); |
1029,7 → 1042,7 |
bfd *bfd_fdopenr (const char *filename, const char *target, int fd); |
bfd *bfd_openstreamr (const char *, const char *, void *); |
bfd *bfd_openstreamr (const char * filename, const char * target, void * stream); |
bfd *bfd_openr_iovec (const char *filename, const char *target, |
void *(*open_func) (struct bfd *nbfd, |
1067,7 → 1080,9 |
char *bfd_get_debug_link_info (bfd *abfd, unsigned long *crc32_out); |
char *bfd_get_alt_debug_link_info (bfd *abfd, unsigned long *crc32_out); |
char *bfd_get_alt_debug_link_info (bfd * abfd, |
bfd_size_type *buildid_len, |
bfd_byte **buildid_out); |
char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir); |
1203,6 → 1218,7 |
/* Extracted from bfdwin.c. */ |
/* Extracted from section.c. */ |
typedef struct bfd_section |
{ |
/* The name of the section; the name isn't a copy, the pointer is |
1210,10 → 1226,10 |
const char *name; |
/* A unique sequence number. */ |
int id; |
unsigned int id; |
/* Which section in the bfd; 0..n-1 as sections are created in a bfd. */ |
int index; |
unsigned int index; |
/* The next section in the list belonging to the BFD, or NULL. */ |
struct bfd_section *next; |
1389,6 → 1405,10 |
executables or shared objects. This is for COFF only. */ |
#define SEC_COFF_SHARED 0x8000000 |
/* This section should be compressed. This is for ELF linker |
internal use only. */ |
#define SEC_ELF_COMPRESS 0x8000000 |
/* When a section with this flag is being linked, then if the size of |
the input section is less than a page, it should not cross a page |
boundary. If the size of the input section is one page or more, |
1396,11 → 1416,18 |
TMS320C54X only. */ |
#define SEC_TIC54X_BLOCK 0x10000000 |
/* This section should be renamed. This is for ELF linker |
internal use only. */ |
#define SEC_ELF_RENAME 0x10000000 |
/* Conditionally link this section; do not link if there are no |
references found to any symbol in the section. This is for TI |
TMS320C54X only. */ |
#define SEC_TIC54X_CLINK 0x20000000 |
/* This section contains vliw code. This is for Toshiba MeP only. */ |
#define SEC_MEP_VLIW 0x20000000 |
/* Indicate that section has the no read flag set. This happens |
when memory read flag isn't set. */ |
#define SEC_COFF_NOREAD 0x40000000 |
1440,6 → 1467,8 |
#define SEC_INFO_TYPE_MERGE 2 |
#define SEC_INFO_TYPE_EH_FRAME 3 |
#define SEC_INFO_TYPE_JUST_SYMS 4 |
#define SEC_INFO_TYPE_TARGET 5 |
#define SEC_INFO_TYPE_EH_FRAME_ENTRY 6 |
/* Nonzero if this section uses RELA relocations, rather than REL. */ |
unsigned int use_rela_p:1; |
1594,6 → 1623,32 |
int size; |
}; |
/* Note: the following are provided as inline functions rather than macros |
because not all callers use the return value. A macro implementation |
would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some |
compilers will complain about comma expressions that have no effect. */ |
static inline bfd_boolean |
bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val) |
{ |
ptr->userdata = val; |
return TRUE; |
} |
static inline bfd_boolean |
bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) |
{ |
ptr->vma = ptr->lma = val; |
ptr->user_set_vma = TRUE; |
return TRUE; |
} |
static inline bfd_boolean |
bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val) |
{ |
ptr->alignment_power = val; |
return TRUE; |
} |
/* These sections are global, and are managed by BFD. The application |
and target back end are not permitted to change the values in |
these sections. */ |
1755,7 → 1810,7 |
asection *bfd_get_section_by_name (bfd *abfd, const char *name); |
asection *bfd_get_next_section_by_name (asection *sec); |
asection *bfd_get_next_section_by_name (bfd *ibfd, asection *sec); |
asection *bfd_get_linker_section (bfd *abfd, const char *name); |
1780,6 → 1835,8 |
asection *bfd_make_section (bfd *, const char *name); |
int bfd_get_next_section_id (void); |
bfd_boolean bfd_set_section_flags |
(bfd *abfd, asection *sec, flagword flags); |
1876,7 → 1933,9 |
#define bfd_mach_i960_jx 7 |
#define bfd_mach_i960_hx 8 |
bfd_arch_or32, /* OpenRISC 32 */ |
bfd_arch_or1k, /* OpenRISC 1000 */ |
#define bfd_mach_or1k 1 |
#define bfd_mach_or1knd 2 |
bfd_arch_sparc, /* SPARC */ |
#define bfd_mach_sparc 1 |
1932,11 → 1991,18 |
#define bfd_mach_mips_octeon 6501 |
#define bfd_mach_mips_octeonp 6601 |
#define bfd_mach_mips_octeon2 6502 |
#define bfd_mach_mips_octeon3 6503 |
#define bfd_mach_mips_xlr 887682 /* decimal 'XLR' */ |
#define bfd_mach_mipsisa32 32 |
#define bfd_mach_mipsisa32r2 33 |
#define bfd_mach_mipsisa32r3 34 |
#define bfd_mach_mipsisa32r5 36 |
#define bfd_mach_mipsisa32r6 37 |
#define bfd_mach_mipsisa64 64 |
#define bfd_mach_mipsisa64r2 65 |
#define bfd_mach_mipsisa64r3 66 |
#define bfd_mach_mipsisa64r5 68 |
#define bfd_mach_mipsisa64r6 69 |
#define bfd_mach_mips_micromips 96 |
bfd_arch_i386, /* Intel 386 */ |
#define bfd_mach_i386_intel_syntax (1 << 0) |
1957,6 → 2023,10 |
#define bfd_mach_i386_i386_nacl (bfd_mach_i386_i386 | bfd_mach_i386_nacl) |
#define bfd_mach_x86_64_nacl (bfd_mach_x86_64 | bfd_mach_i386_nacl) |
#define bfd_mach_x64_32_nacl (bfd_mach_x64_32 | bfd_mach_i386_nacl) |
bfd_arch_iamcu, /* Intel MCU */ |
#define bfd_mach_iamcu (1 << 8) |
#define bfd_mach_i386_iamcu (bfd_mach_i386_i386 | bfd_mach_iamcu) |
#define bfd_mach_i386_iamcu_intel_syntax (bfd_mach_i386_iamcu | bfd_mach_i386_intel_syntax) |
bfd_arch_we32k, /* AT&T WE32xxx */ |
bfd_arch_tahoe, /* CCI/Harris Tahoe */ |
bfd_arch_i860, /* Intel 860 */ |
2071,6 → 2141,12 |
#define bfd_mach_arm_ep9312 11 |
#define bfd_mach_arm_iWMMXt 12 |
#define bfd_mach_arm_iWMMXt2 13 |
bfd_arch_nds32, /* Andes NDS32 */ |
#define bfd_mach_n1 1 |
#define bfd_mach_n1h 2 |
#define bfd_mach_n1h_v2 3 |
#define bfd_mach_n1h_v3 4 |
#define bfd_mach_n1h_v3m 5 |
bfd_arch_ns32k, /* National Semiconductors ns32000 */ |
bfd_arch_w65, /* WDC 65816 */ |
bfd_arch_tic30, /* Texas Instruments TMS320C30 */ |
2089,10 → 2165,12 |
#define bfd_mach_v850e2v3 0x45325633 |
#define bfd_mach_v850e3v5 0x45335635 /* ('E'|'3'|'V'|'5') */ |
bfd_arch_arc, /* ARC Cores */ |
#define bfd_mach_arc_5 5 |
#define bfd_mach_arc_6 6 |
#define bfd_mach_arc_7 7 |
#define bfd_mach_arc_8 8 |
#define bfd_mach_arc_a4 0 |
#define bfd_mach_arc_a5 1 |
#define bfd_mach_arc_arc600 2 |
#define bfd_mach_arc_arc601 4 |
#define bfd_mach_arc_arc700 3 |
#define bfd_mach_arc_arcv2 5 |
bfd_arch_m32c, /* Renesas M16C/M32C. */ |
#define bfd_mach_m16c 0x75 |
#define bfd_mach_m32c 0x78 |
2118,6 → 2196,8 |
#define bfd_mach_fr550 550 |
bfd_arch_moxie, /* The moxie processor */ |
#define bfd_mach_moxie 1 |
bfd_arch_ft32, /* The ft32 processor */ |
#define bfd_mach_ft32 1 |
bfd_arch_mcore, |
bfd_arch_mep, |
#define bfd_mach_mep 1 |
2153,6 → 2233,7 |
#define bfd_mach_avr5 5 |
#define bfd_mach_avr51 51 |
#define bfd_mach_avr6 6 |
#define bfd_mach_avrtiny 100 |
#define bfd_mach_avrxmega1 101 |
#define bfd_mach_avrxmega2 102 |
#define bfd_mach_avrxmega3 103 |
2182,7 → 2263,6 |
bfd_arch_score, /* Sunplus score */ |
#define bfd_mach_score3 3 |
#define bfd_mach_score7 7 |
bfd_arch_openrisc, /* OpenRISC */ |
bfd_arch_mmix, /* Donald Knuth's educational processor. */ |
bfd_arch_xstormy16, |
#define bfd_mach_xstormy16 1 |
2235,8 → 2315,12 |
bfd_arch_aarch64, /* AArch64 */ |
#define bfd_mach_aarch64 0 |
#define bfd_mach_aarch64_ilp32 32 |
bfd_arch_nios2, |
bfd_arch_nios2, /* Nios II */ |
#define bfd_mach_nios2 0 |
#define bfd_mach_nios2r1 1 |
#define bfd_mach_nios2r2 2 |
bfd_arch_visium, /* Visium */ |
#define bfd_mach_visium 1 |
bfd_arch_last |
}; |
2302,6 → 2386,7 |
(enum bfd_architecture arch, unsigned long machine); |
/* Extracted from reloc.c. */ |
typedef enum bfd_reloc_status |
{ |
/* No errors detected. */ |
2351,6 → 2436,7 |
} |
arelent; |
enum complain_overflow |
{ |
/* Do not complain on overflow. */ |
2369,6 → 2455,7 |
unsigned number. */ |
complain_overflow_unsigned |
}; |
struct bfd_symbol; /* Forward declaration. */ |
struct reloc_howto_struct |
{ |
2896,6 → 2983,12 |
BFD_RELOC_MICROMIPS_10_PCREL_S1, |
BFD_RELOC_MICROMIPS_16_PCREL_S1, |
/* MIPS PC-relative relocations. */ |
BFD_RELOC_MIPS_21_PCREL_S2, |
BFD_RELOC_MIPS_26_PCREL_S2, |
BFD_RELOC_MIPS_18_PCREL_S3, |
BFD_RELOC_MIPS_19_PCREL_S2, |
/* microMIPS versions of generic BFD relocs. */ |
BFD_RELOC_MICROMIPS_GPREL16, |
BFD_RELOC_MICROMIPS_HI16, |
2970,6 → 3063,13 |
BFD_RELOC_MOXIE_10_PCREL, |
/* FT32 ELF relocations. */ |
BFD_RELOC_FT32_10, |
BFD_RELOC_FT32_20, |
BFD_RELOC_FT32_17, |
BFD_RELOC_FT32_18, |
/* Fujitsu Frv Relocations. */ |
BFD_RELOC_FRV_LABEL16, |
BFD_RELOC_FRV_LABEL24, |
3094,6 → 3194,7 |
BFD_RELOC_386_TLS_DESC_CALL, |
BFD_RELOC_386_TLS_DESC, |
BFD_RELOC_386_IRELATIVE, |
BFD_RELOC_386_GOT32X, |
/* x86-64/elf relocations */ |
BFD_RELOC_X86_64_GOT32, |
3125,6 → 3226,8 |
BFD_RELOC_X86_64_IRELATIVE, |
BFD_RELOC_X86_64_PC32_BND, |
BFD_RELOC_X86_64_PLT32_BND, |
BFD_RELOC_X86_64_GOTPCRELX, |
BFD_RELOC_X86_64_REX_GOTPCRELX, |
/* ns32k relocations */ |
BFD_RELOC_NS32K_IMM_8, |
3200,6 → 3303,7 |
BFD_RELOC_PPC_VLE_SDAREL_HI16D, |
BFD_RELOC_PPC_VLE_SDAREL_HA16A, |
BFD_RELOC_PPC_VLE_SDAREL_HA16D, |
BFD_RELOC_PPC_REL16DX_HA, |
BFD_RELOC_PPC64_HIGHER, |
BFD_RELOC_PPC64_HIGHER_S, |
BFD_RELOC_PPC64_HIGHEST, |
3225,6 → 3329,8 |
BFD_RELOC_PPC64_PLTGOT16_LO_DS, |
BFD_RELOC_PPC64_ADDR16_HIGH, |
BFD_RELOC_PPC64_ADDR16_HIGHA, |
BFD_RELOC_PPC64_ADDR64_LOCAL, |
BFD_RELOC_PPC64_ENTRY, |
/* PowerPC and PowerPC64 thread-local storage relocations. */ |
BFD_RELOC_PPC_TLS, |
3538,17 → 3644,74 |
BFD_RELOC_SH_GOTOFFFUNCDESC20, |
BFD_RELOC_SH_FUNCDESC, |
/* ARC Cores relocs. |
ARC 22 bit pc-relative branch. The lowest two bits must be zero and are |
not stored in the instruction. The high 20 bits are installed in bits 26 |
through 7 of the instruction. */ |
BFD_RELOC_ARC_B22_PCREL, |
/* ARC relocs. */ |
BFD_RELOC_ARC_NONE, |
BFD_RELOC_ARC_8, |
BFD_RELOC_ARC_16, |
BFD_RELOC_ARC_24, |
BFD_RELOC_ARC_32, |
BFD_RELOC_ARC_N8, |
BFD_RELOC_ARC_N16, |
BFD_RELOC_ARC_N24, |
BFD_RELOC_ARC_N32, |
BFD_RELOC_ARC_SDA, |
BFD_RELOC_ARC_SECTOFF, |
BFD_RELOC_ARC_S21H_PCREL, |
BFD_RELOC_ARC_S21W_PCREL, |
BFD_RELOC_ARC_S25H_PCREL, |
BFD_RELOC_ARC_S25W_PCREL, |
BFD_RELOC_ARC_SDA32, |
BFD_RELOC_ARC_SDA_LDST, |
BFD_RELOC_ARC_SDA_LDST1, |
BFD_RELOC_ARC_SDA_LDST2, |
BFD_RELOC_ARC_SDA16_LD, |
BFD_RELOC_ARC_SDA16_LD1, |
BFD_RELOC_ARC_SDA16_LD2, |
BFD_RELOC_ARC_S13_PCREL, |
BFD_RELOC_ARC_W, |
BFD_RELOC_ARC_32_ME, |
BFD_RELOC_ARC_32_ME_S, |
BFD_RELOC_ARC_N32_ME, |
BFD_RELOC_ARC_SECTOFF_ME, |
BFD_RELOC_ARC_SDA32_ME, |
BFD_RELOC_ARC_W_ME, |
BFD_RELOC_AC_SECTOFF_U8, |
BFD_RELOC_AC_SECTOFF_U8_1, |
BFD_RELOC_AC_SECTOFF_U8_2, |
BFD_RELOC_AC_SECTFOFF_S9, |
BFD_RELOC_AC_SECTFOFF_S9_1, |
BFD_RELOC_AC_SECTFOFF_S9_2, |
BFD_RELOC_ARC_SECTOFF_ME_1, |
BFD_RELOC_ARC_SECTOFF_ME_2, |
BFD_RELOC_ARC_SECTOFF_1, |
BFD_RELOC_ARC_SECTOFF_2, |
BFD_RELOC_ARC_SDA16_ST2, |
BFD_RELOC_ARC_32_PCREL, |
BFD_RELOC_ARC_PC32, |
BFD_RELOC_ARC_GOT32, |
BFD_RELOC_ARC_GOTPC32, |
BFD_RELOC_ARC_PLT32, |
BFD_RELOC_ARC_COPY, |
BFD_RELOC_ARC_GLOB_DAT, |
BFD_RELOC_ARC_JMP_SLOT, |
BFD_RELOC_ARC_RELATIVE, |
BFD_RELOC_ARC_GOTOFF, |
BFD_RELOC_ARC_GOTPC, |
BFD_RELOC_ARC_S21W_PCREL_PLT, |
BFD_RELOC_ARC_S25H_PCREL_PLT, |
BFD_RELOC_ARC_TLS_DTPMOD, |
BFD_RELOC_ARC_TLS_TPOFF, |
BFD_RELOC_ARC_TLS_GD_GOT, |
BFD_RELOC_ARC_TLS_GD_LD, |
BFD_RELOC_ARC_TLS_GD_CALL, |
BFD_RELOC_ARC_TLS_IE_GOT, |
BFD_RELOC_ARC_TLS_DTPOFF, |
BFD_RELOC_ARC_TLS_DTPOFF_S9, |
BFD_RELOC_ARC_TLS_LE_S9, |
BFD_RELOC_ARC_TLS_LE_32, |
BFD_RELOC_ARC_S25W_PCREL_PLT, |
BFD_RELOC_ARC_S21H_PCREL_PLT, |
/* ARC 26 bit absolute branch. The lowest two bits must be zero and are not |
stored in the instruction. The high 24 bits are installed in bits 23 |
through 0. */ |
BFD_RELOC_ARC_B26, |
/* ADI Blackfin 16 bit immediate absolute reloc. */ |
BFD_RELOC_BFIN_16_IMM, |
3794,6 → 3957,205 |
BFD_RELOC_M32R_GOTPC_HI_SLO, |
BFD_RELOC_M32R_GOTPC_LO, |
/* NDS32 relocs. |
This is a 20 bit absolute address. */ |
BFD_RELOC_NDS32_20, |
/* This is a 9-bit pc-relative reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_9_PCREL, |
/* This is a 9-bit pc-relative reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_WORD_9_PCREL, |
/* This is an 15-bit reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_15_PCREL, |
/* This is an 17-bit reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_17_PCREL, |
/* This is a 25-bit reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_25_PCREL, |
/* This is a 20-bit reloc containing the high 20 bits of an address |
used with the lower 12 bits */ |
BFD_RELOC_NDS32_HI20, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift right by 3. This is used with ldi,sdi... */ |
BFD_RELOC_NDS32_LO12S3, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 2. This is used with lwi,swi... */ |
BFD_RELOC_NDS32_LO12S2, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 1. This is used with lhi,shi... */ |
BFD_RELOC_NDS32_LO12S1, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 0. This is used with lbisbi... */ |
BFD_RELOC_NDS32_LO12S0, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 0. This is only used with branch relaxations */ |
BFD_RELOC_NDS32_LO12S0_ORI, |
/* This is a 15-bit reloc containing the small data area 18-bit signed offset |
and shift left by 3 for use in ldi, sdi... */ |
BFD_RELOC_NDS32_SDA15S3, |
/* This is a 15-bit reloc containing the small data area 17-bit signed offset |
and shift left by 2 for use in lwi, swi... */ |
BFD_RELOC_NDS32_SDA15S2, |
/* This is a 15-bit reloc containing the small data area 16-bit signed offset |
and shift left by 1 for use in lhi, shi... */ |
BFD_RELOC_NDS32_SDA15S1, |
/* This is a 15-bit reloc containing the small data area 15-bit signed offset |
and shift left by 0 for use in lbi, sbi... */ |
BFD_RELOC_NDS32_SDA15S0, |
/* This is a 16-bit reloc containing the small data area 16-bit signed offset |
and shift left by 3 */ |
BFD_RELOC_NDS32_SDA16S3, |
/* This is a 17-bit reloc containing the small data area 17-bit signed offset |
and shift left by 2 for use in lwi.gp, swi.gp... */ |
BFD_RELOC_NDS32_SDA17S2, |
/* This is a 18-bit reloc containing the small data area 18-bit signed offset |
and shift left by 1 for use in lhi.gp, shi.gp... */ |
BFD_RELOC_NDS32_SDA18S1, |
/* This is a 19-bit reloc containing the small data area 19-bit signed offset |
and shift left by 0 for use in lbi.gp, sbi.gp... */ |
BFD_RELOC_NDS32_SDA19S0, |
/* for PIC */ |
BFD_RELOC_NDS32_GOT20, |
BFD_RELOC_NDS32_9_PLTREL, |
BFD_RELOC_NDS32_25_PLTREL, |
BFD_RELOC_NDS32_COPY, |
BFD_RELOC_NDS32_GLOB_DAT, |
BFD_RELOC_NDS32_JMP_SLOT, |
BFD_RELOC_NDS32_RELATIVE, |
BFD_RELOC_NDS32_GOTOFF, |
BFD_RELOC_NDS32_GOTOFF_HI20, |
BFD_RELOC_NDS32_GOTOFF_LO12, |
BFD_RELOC_NDS32_GOTPC20, |
BFD_RELOC_NDS32_GOT_HI20, |
BFD_RELOC_NDS32_GOT_LO12, |
BFD_RELOC_NDS32_GOTPC_HI20, |
BFD_RELOC_NDS32_GOTPC_LO12, |
/* for relax */ |
BFD_RELOC_NDS32_INSN16, |
BFD_RELOC_NDS32_LABEL, |
BFD_RELOC_NDS32_LONGCALL1, |
BFD_RELOC_NDS32_LONGCALL2, |
BFD_RELOC_NDS32_LONGCALL3, |
BFD_RELOC_NDS32_LONGJUMP1, |
BFD_RELOC_NDS32_LONGJUMP2, |
BFD_RELOC_NDS32_LONGJUMP3, |
BFD_RELOC_NDS32_LOADSTORE, |
BFD_RELOC_NDS32_9_FIXED, |
BFD_RELOC_NDS32_15_FIXED, |
BFD_RELOC_NDS32_17_FIXED, |
BFD_RELOC_NDS32_25_FIXED, |
BFD_RELOC_NDS32_LONGCALL4, |
BFD_RELOC_NDS32_LONGCALL5, |
BFD_RELOC_NDS32_LONGCALL6, |
BFD_RELOC_NDS32_LONGJUMP4, |
BFD_RELOC_NDS32_LONGJUMP5, |
BFD_RELOC_NDS32_LONGJUMP6, |
BFD_RELOC_NDS32_LONGJUMP7, |
/* for PIC */ |
BFD_RELOC_NDS32_PLTREL_HI20, |
BFD_RELOC_NDS32_PLTREL_LO12, |
BFD_RELOC_NDS32_PLT_GOTREL_HI20, |
BFD_RELOC_NDS32_PLT_GOTREL_LO12, |
/* for floating point */ |
BFD_RELOC_NDS32_SDA12S2_DP, |
BFD_RELOC_NDS32_SDA12S2_SP, |
BFD_RELOC_NDS32_LO12S2_DP, |
BFD_RELOC_NDS32_LO12S2_SP, |
/* for dwarf2 debug_line. */ |
BFD_RELOC_NDS32_DWARF2_OP1, |
BFD_RELOC_NDS32_DWARF2_OP2, |
BFD_RELOC_NDS32_DWARF2_LEB, |
/* for eliminate 16-bit instructions */ |
BFD_RELOC_NDS32_UPDATE_TA, |
/* for PIC object relaxation */ |
BFD_RELOC_NDS32_PLT_GOTREL_LO20, |
BFD_RELOC_NDS32_PLT_GOTREL_LO15, |
BFD_RELOC_NDS32_PLT_GOTREL_LO19, |
BFD_RELOC_NDS32_GOT_LO15, |
BFD_RELOC_NDS32_GOT_LO19, |
BFD_RELOC_NDS32_GOTOFF_LO15, |
BFD_RELOC_NDS32_GOTOFF_LO19, |
BFD_RELOC_NDS32_GOT15S2, |
BFD_RELOC_NDS32_GOT17S2, |
/* NDS32 relocs. |
This is a 5 bit absolute address. */ |
BFD_RELOC_NDS32_5, |
/* This is a 10-bit unsigned pc-relative reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_10_UPCREL, |
/* If fp were omitted, fp can used as another gp. */ |
BFD_RELOC_NDS32_SDA_FP7U2_RELA, |
/* relaxation relative relocation types */ |
BFD_RELOC_NDS32_RELAX_ENTRY, |
BFD_RELOC_NDS32_GOT_SUFF, |
BFD_RELOC_NDS32_GOTOFF_SUFF, |
BFD_RELOC_NDS32_PLT_GOT_SUFF, |
BFD_RELOC_NDS32_MULCALL_SUFF, |
BFD_RELOC_NDS32_PTR, |
BFD_RELOC_NDS32_PTR_COUNT, |
BFD_RELOC_NDS32_PTR_RESOLVED, |
BFD_RELOC_NDS32_PLTBLOCK, |
BFD_RELOC_NDS32_RELAX_REGION_BEGIN, |
BFD_RELOC_NDS32_RELAX_REGION_END, |
BFD_RELOC_NDS32_MINUEND, |
BFD_RELOC_NDS32_SUBTRAHEND, |
BFD_RELOC_NDS32_DIFF8, |
BFD_RELOC_NDS32_DIFF16, |
BFD_RELOC_NDS32_DIFF32, |
BFD_RELOC_NDS32_DIFF_ULEB128, |
BFD_RELOC_NDS32_EMPTY, |
/* This is a 25 bit absolute address. */ |
BFD_RELOC_NDS32_25_ABS, |
/* For ex9 and ifc using. */ |
BFD_RELOC_NDS32_DATA, |
BFD_RELOC_NDS32_TRAN, |
BFD_RELOC_NDS32_17IFC_PCREL, |
BFD_RELOC_NDS32_10IFCU_PCREL, |
/* For TLS. */ |
BFD_RELOC_NDS32_TPOFF, |
BFD_RELOC_NDS32_TLS_LE_HI20, |
BFD_RELOC_NDS32_TLS_LE_LO12, |
BFD_RELOC_NDS32_TLS_LE_ADD, |
BFD_RELOC_NDS32_TLS_LE_LS, |
BFD_RELOC_NDS32_GOTTPOFF, |
BFD_RELOC_NDS32_TLS_IE_HI20, |
BFD_RELOC_NDS32_TLS_IE_LO12S2, |
BFD_RELOC_NDS32_TLS_TPOFF, |
BFD_RELOC_NDS32_TLS_LE_20, |
BFD_RELOC_NDS32_TLS_LE_15S0, |
BFD_RELOC_NDS32_TLS_LE_15S1, |
BFD_RELOC_NDS32_TLS_LE_15S2, |
/* This is a 9-bit reloc */ |
BFD_RELOC_V850_9_PCREL, |
4251,6 → 4613,28 |
in .byte hlo8(symbol) */ |
BFD_RELOC_AVR_8_HLO, |
/* AVR relocations to mark the difference of two local symbols. |
These are only needed to support linker relaxation and can be ignored |
when not relaxing. The field is set to the value of the difference |
assuming no relaxation. The relocation encodes the position of the |
second symbol so the linker can determine whether to adjust the field |
value. */ |
BFD_RELOC_AVR_DIFF8, |
BFD_RELOC_AVR_DIFF16, |
BFD_RELOC_AVR_DIFF32, |
/* This is a 7 bit reloc for the AVR that stores SRAM address for 16bit |
lds and sts instructions supported only tiny core. */ |
BFD_RELOC_AVR_LDS_STS_16, |
/* This is a 6 bit reloc for the AVR that stores an I/O register |
number for the IN and OUT instructions */ |
BFD_RELOC_AVR_PORT6, |
/* This is a 5 bit reloc for the AVR that stores an I/O register |
number for the SBIC, SBIS, SBI and CBI instructions */ |
BFD_RELOC_AVR_PORT5, |
/* Renesas RL78 Relocations. */ |
BFD_RELOC_RL78_NEG8, |
BFD_RELOC_RL78_NEG16, |
4285,6 → 4669,7 |
BFD_RELOC_RL78_HI8, |
BFD_RELOC_RL78_LO16, |
BFD_RELOC_RL78_CODE, |
BFD_RELOC_RL78_SADDR, |
/* Renesas RX Relocations. */ |
BFD_RELOC_RX_NEG8, |
4914,9 → 5299,31 |
BFD_RELOC_860_HIGOT, |
BFD_RELOC_860_HIGOTOFF, |
/* OpenRISC Relocations. */ |
BFD_RELOC_OPENRISC_ABS_26, |
BFD_RELOC_OPENRISC_REL_26, |
/* OpenRISC 1000 Relocations. */ |
BFD_RELOC_OR1K_REL_26, |
BFD_RELOC_OR1K_GOTPC_HI16, |
BFD_RELOC_OR1K_GOTPC_LO16, |
BFD_RELOC_OR1K_GOT16, |
BFD_RELOC_OR1K_PLT26, |
BFD_RELOC_OR1K_GOTOFF_HI16, |
BFD_RELOC_OR1K_GOTOFF_LO16, |
BFD_RELOC_OR1K_COPY, |
BFD_RELOC_OR1K_GLOB_DAT, |
BFD_RELOC_OR1K_JMP_SLOT, |
BFD_RELOC_OR1K_RELATIVE, |
BFD_RELOC_OR1K_TLS_GD_HI16, |
BFD_RELOC_OR1K_TLS_GD_LO16, |
BFD_RELOC_OR1K_TLS_LDM_HI16, |
BFD_RELOC_OR1K_TLS_LDM_LO16, |
BFD_RELOC_OR1K_TLS_LDO_HI16, |
BFD_RELOC_OR1K_TLS_LDO_LO16, |
BFD_RELOC_OR1K_TLS_IE_HI16, |
BFD_RELOC_OR1K_TLS_IE_LO16, |
BFD_RELOC_OR1K_TLS_LE_HI16, |
BFD_RELOC_OR1K_TLS_LE_LO16, |
BFD_RELOC_OR1K_TLS_TPOFF, |
BFD_RELOC_OR1K_TLS_DTPOFF, |
BFD_RELOC_OR1K_TLS_DTPMOD, |
/* H8 elf Relocations. */ |
BFD_RELOC_H8_DIR16A8, |
5024,6 → 5431,24 |
BFD_RELOC_NIOS2_JUMP_SLOT, |
BFD_RELOC_NIOS2_RELATIVE, |
BFD_RELOC_NIOS2_GOTOFF, |
BFD_RELOC_NIOS2_CALL26_NOAT, |
BFD_RELOC_NIOS2_GOT_LO, |
BFD_RELOC_NIOS2_GOT_HA, |
BFD_RELOC_NIOS2_CALL_LO, |
BFD_RELOC_NIOS2_CALL_HA, |
BFD_RELOC_NIOS2_R2_S12, |
BFD_RELOC_NIOS2_R2_I10_1_PCREL, |
BFD_RELOC_NIOS2_R2_T1I7_1_PCREL, |
BFD_RELOC_NIOS2_R2_T1I7_2, |
BFD_RELOC_NIOS2_R2_T2I4, |
BFD_RELOC_NIOS2_R2_T2I4_1, |
BFD_RELOC_NIOS2_R2_T2I4_2, |
BFD_RELOC_NIOS2_R2_X1I7_2, |
BFD_RELOC_NIOS2_R2_X2L5, |
BFD_RELOC_NIOS2_R2_F1I5_2, |
BFD_RELOC_NIOS2_R2_L5I4X1, |
BFD_RELOC_NIOS2_R2_T1X1I6, |
BFD_RELOC_NIOS2_R2_T1X1I6_2, |
/* IQ2000 Relocations. */ |
BFD_RELOC_IQ2000_OFFSET_16, |
5410,6 → 5835,24 |
BFD_RELOC_AARCH64_ADR_GOTPAGE. Valid in ILP32 ABI only. */ |
BFD_RELOC_AARCH64_LD32_GOT_LO12_NC, |
/* Unsigned 16 bit byte offset for 64 bit load/store from the GOT entry |
for this symbol. Valid in LP64 ABI only. */ |
BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC, |
/* Unsigned 16 bit byte higher offset for 64 bit load/store from the GOT entry |
for this symbol. Valid in LP64 ABI only. */ |
BFD_RELOC_AARCH64_MOVW_GOTOFF_G1, |
/* Unsigned 15 bit byte offset for 64 bit load/store from the page of |
the GOT entry for this symbol. Valid in LP64 ABI only. */ |
BFD_RELOC_AARCH64_LD64_GOTOFF_LO15, |
/* Scaled 14 bit byte offset to the page base of the global offset table. */ |
BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14, |
/* Scaled 15 bit byte offset to the page base of the global offset table. */ |
BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15, |
/* Get to the page base of the global offset table entry for a symbols |
tls_index structure as part of an adrp instruction using a 21 bit PC |
relative value. Used in conjunction with |
5416,16 → 5859,19 |
BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC. */ |
BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21, |
/* AArch64 TLS General Dynamic */ |
BFD_RELOC_AARCH64_TLSGD_ADR_PREL21, |
/* Unsigned 12 bit byte offset to global offset table entry for a symbols |
tls_index structure. Used in conjunction with |
BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21. */ |
BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1, |
/* AArch64 TLS General Dynamic relocation. */ |
BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC, |
/* AArch64 TLS General Dynamic relocation. */ |
BFD_RELOC_AARCH64_TLSGD_MOVW_G1, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21, |
5439,6 → 5885,76 |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1, |
/* bit[23:12] of byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12, |
/* Unsigned 12 bit byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12, |
/* No overflow check version of BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12. */ |
BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC, |
/* Unsigned 12 bit byte offset to global offset table entry for a symbols |
tls_index structure. Used in conjunction with |
BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21. */ |
BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC, |
/* GOT entry page address for AArch64 TLS Local Dynamic, used with ADRP |
instruction. */ |
BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21, |
/* GOT entry address for AArch64 TLS Local Dynamic, used with ADR instruction. */ |
BFD_RELOC_AARCH64_TLSLD_ADR_PREL21, |
/* bit[11:1] of byte offset to module TLS base address, encoded in ldst |
instructions. */ |
BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, |
/* bit[11:2] of byte offset to module TLS base address, encoded in ldst |
instructions. */ |
BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, |
/* bit[11:3] of byte offset to module TLS base address, encoded in ldst |
instructions. */ |
BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, |
/* bit[11:0] of byte offset to module TLS base address, encoded in ldst |
instructions. */ |
BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC, |
/* bit[15:0] of byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0, |
/* No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0 */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, |
/* bit[31:16] of byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1, |
/* No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1 */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, |
/* bit[47:32] of byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2, |
/* AArch64 TLS LOCAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2, |
5538,6 → 6054,14 |
address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. */ |
BFD_RELOC_AARCH64_LDST_LO12, |
/* AArch64 pseudo relocation code for TLS local dynamic mode. It's to be |
used internally by the AArch64 assembler and not (currently) written to |
any object files. */ |
BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12_NC, |
/* AArch64 pseudo relocation code to be used internally by the AArch64 |
assembler and not (currently) written to any object files. */ |
BFD_RELOC_AARCH64_LD_GOT_LO12_NC, |
5762,7 → 6286,17 |
/* Adapteva EPIPHANY - 8 bit immediate for 16 bit mov instruction. */ |
BFD_RELOC_EPIPHANY_IMM8, |
/* Visium Relocations. */ |
BFD_RELOC_VISIUM_HI16, |
BFD_RELOC_VISIUM_LO16, |
BFD_RELOC_VISIUM_IM16, |
BFD_RELOC_VISIUM_REL16, |
BFD_RELOC_VISIUM_HI16_PCREL, |
BFD_RELOC_VISIUM_LO16_PCREL, |
BFD_RELOC_VISIUM_IM16_PCREL, |
BFD_RELOC_UNUSED }; |
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; |
reloc_howto_type *bfd_reloc_type_lookup |
(bfd *abfd, bfd_reloc_code_real_type code); |
5960,6 → 6494,7 |
(ibfd, isymbol, obfd, osymbol)) |
/* Extracted from bfd.c. */ |
enum bfd_direction |
{ |
no_direction = 0, |
5968,11 → 6503,21 |
both_direction = 3 |
}; |
enum bfd_plugin_format |
{ |
bfd_plugin_uknown = 0, |
bfd_plugin_yes = 1, |
bfd_plugin_no = 2 |
}; |
struct bfd_build_id |
{ |
bfd_size_type size; |
bfd_byte data[1]; |
}; |
struct bfd |
{ |
/* A unique identifier of the BFD */ |
unsigned int id; |
/* The filename the application opened the BFD with. */ |
const char *filename; |
5995,17 → 6540,17 |
/* File modified time, if mtime_set is TRUE. */ |
long mtime; |
/* Reserved for an unimplemented file locking extension. */ |
int ifd; |
/* A unique identifier of the BFD */ |
unsigned int id; |
/* The format which belongs to the BFD. (object, core, etc.) */ |
bfd_format format; |
ENUM_BITFIELD (bfd_format) format : 3; |
/* The direction with which the BFD was opened. */ |
enum bfd_direction direction; |
ENUM_BITFIELD (bfd_direction) direction : 2; |
/* Format_specific flags. */ |
flagword flags; |
flagword flags : 18; |
/* Values that may appear in the flags field of a BFD. These also |
appear in the object_flags field of the bfd_target structure, where |
6064,36 → 6609,87 |
struct. */ |
#define BFD_IN_MEMORY 0x800 |
/* The sections in this BFD specify a memory page. */ |
#define HAS_LOAD_PAGE 0x1000 |
/* This BFD has been created by the linker and doesn't correspond |
to any input file. */ |
#define BFD_LINKER_CREATED 0x2000 |
#define BFD_LINKER_CREATED 0x1000 |
/* This may be set before writing out a BFD to request that it |
be written using values for UIDs, GIDs, timestamps, etc. that |
will be consistent from run to run. */ |
#define BFD_DETERMINISTIC_OUTPUT 0x4000 |
#define BFD_DETERMINISTIC_OUTPUT 0x2000 |
/* Compress sections in this BFD. */ |
#define BFD_COMPRESS 0x8000 |
#define BFD_COMPRESS 0x4000 |
/* Decompress sections in this BFD. */ |
#define BFD_DECOMPRESS 0x10000 |
#define BFD_DECOMPRESS 0x8000 |
/* BFD is a dummy, for plugins. */ |
#define BFD_PLUGIN 0x20000 |
#define BFD_PLUGIN 0x10000 |
/* Compress sections in this BFD with SHF_COMPRESSED from gABI. */ |
#define BFD_COMPRESS_GABI 0x20000 |
/* Flags bits to be saved in bfd_preserve_save. */ |
#define BFD_FLAGS_SAVED \ |
(BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_PLUGIN) |
(BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_PLUGIN \ |
| BFD_COMPRESS_GABI) |
/* Flags bits which are for BFD use only. */ |
#define BFD_FLAGS_FOR_BFD_USE_MASK \ |
(BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \ |
| BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT) |
| BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT \ |
| BFD_COMPRESS_GABI) |
/* Is the file descriptor being cached? That is, can it be closed as |
needed, and re-opened when accessed later? */ |
unsigned int cacheable : 1; |
/* Marks whether there was a default target specified when the |
BFD was opened. This is used to select which matching algorithm |
to use to choose the back end. */ |
unsigned int target_defaulted : 1; |
/* ... and here: (``once'' means at least once). */ |
unsigned int opened_once : 1; |
/* Set if we have a locally maintained mtime value, rather than |
getting it from the file each time. */ |
unsigned int mtime_set : 1; |
/* Flag set if symbols from this BFD should not be exported. */ |
unsigned int no_export : 1; |
/* Remember when output has begun, to stop strange things |
from happening. */ |
unsigned int output_has_begun : 1; |
/* Have archive map. */ |
unsigned int has_armap : 1; |
/* Set if this is a thin archive. */ |
unsigned int is_thin_archive : 1; |
/* Set if only required symbols should be added in the link hash table for |
this object. Used by VMS linkers. */ |
unsigned int selective_search : 1; |
/* Set if this is the linker output BFD. */ |
unsigned int is_linker_output : 1; |
/* Set if this is the linker input BFD. */ |
unsigned int is_linker_input : 1; |
/* If this is an input for a compiler plug-in library. */ |
ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2; |
/* Set if this is a plugin output file. */ |
unsigned int lto_output : 1; |
/* Set to dummy BFD created when claimed by a compiler plug-in |
library. */ |
bfd *plugin_dummy_bfd; |
/* Currently my_archive is tested before adding origin to |
anything. I believe that this can become always an add of |
origin, with origin set to 0 for non archive files. */ |
6118,17 → 6714,21 |
/* The number of sections. */ |
unsigned int section_count; |
/* A field used by _bfd_generic_link_add_archive_symbols. This will |
be used only for archive elements. */ |
int archive_pass; |
/* Stuff only useful for object files: |
The start address. */ |
bfd_vma start_address; |
/* Used for input and output. */ |
unsigned int symcount; |
/* Symbol table for output BFD (with symcount entries). |
Also used by the linker to cache input BFD symbols. */ |
struct bfd_symbol **outsymbols; |
/* Used for input and output. */ |
unsigned int symcount; |
/* Used for slurped dynamic symbol tables. */ |
unsigned int dynsymcount; |
6143,13 → 6743,13 |
struct bfd *nested_archives; /* List of nested archive in a flattened |
thin archive. */ |
/* A chain of BFD structures involved in a link. */ |
struct bfd *link_next; |
union { |
/* For input BFDs, a chain of BFDs involved in a link. */ |
struct bfd *next; |
/* For output BFD, the linker hash table. */ |
struct bfd_link_hash_table *hash; |
} link; |
/* A field used by _bfd_generic_link_add_archive_symbols. This will |
be used only for archive elements. */ |
int archive_pass; |
/* Used by the back end to hold private data. */ |
union |
{ |
6201,40 → 6801,19 |
of objalloc.h. */ |
void *memory; |
/* Is the file descriptor being cached? That is, can it be closed as |
needed, and re-opened when accessed later? */ |
unsigned int cacheable : 1; |
/* For input BFDs, the build ID, if the object has one. */ |
const struct bfd_build_id *build_id; |
}; |
/* Marks whether there was a default target specified when the |
BFD was opened. This is used to select which matching algorithm |
to use to choose the back end. */ |
unsigned int target_defaulted : 1; |
/* See note beside bfd_set_section_userdata. */ |
static inline bfd_boolean |
bfd_set_cacheable (bfd * abfd, bfd_boolean val) |
{ |
abfd->cacheable = val; |
return TRUE; |
} |
/* ... and here: (``once'' means at least once). */ |
unsigned int opened_once : 1; |
/* Set if we have a locally maintained mtime value, rather than |
getting it from the file each time. */ |
unsigned int mtime_set : 1; |
/* Flag set if symbols from this BFD should not be exported. */ |
unsigned int no_export : 1; |
/* Remember when output has begun, to stop strange things |
from happening. */ |
unsigned int output_has_begun : 1; |
/* Have archive map. */ |
unsigned int has_armap : 1; |
/* Set if this is a thin archive. */ |
unsigned int is_thin_archive : 1; |
/* Set if only required symbols should be added in the link hash table for |
this object. Used by VMS linkers. */ |
unsigned int selective_search : 1; |
}; |
typedef enum bfd_error |
{ |
bfd_error_no_error = 0, |
6270,6 → 6849,7 |
void bfd_perror (const char *message); |
typedef void (*bfd_error_handler_type) (const char *, ...); |
bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); |
6278,6 → 6858,7 |
bfd_error_handler_type bfd_get_error_handler (void); |
typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg, |
const char *bfd_version, |
const char *bfd_file, |
6333,12 → 6914,12 |
#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ |
BFD_SEND (abfd, _bfd_find_nearest_line, \ |
(abfd, sec, syms, off, file, func, line)) |
(abfd, syms, sec, off, file, func, line, NULL)) |
#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \ |
line, disc) \ |
BFD_SEND (abfd, _bfd_find_nearest_line_discriminator, \ |
(abfd, sec, syms, off, file, func, line, disc)) |
BFD_SEND (abfd, _bfd_find_nearest_line, \ |
(abfd, syms, sec, off, file, func, line, disc)) |
#define bfd_find_line(abfd, syms, sym, file, line) \ |
BFD_SEND (abfd, _bfd_find_line, \ |
6387,9 → 6968,6 |
#define bfd_link_hash_table_create(abfd) \ |
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) |
#define bfd_link_hash_table_free(abfd, hash) \ |
BFD_SEND (abfd, _bfd_link_hash_table_free, (hash)) |
#define bfd_link_add_symbols(abfd, info) \ |
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) |
6437,6 → 7015,22 |
char *bfd_demangle (bfd *, const char *, int); |
void bfd_update_compression_header |
(bfd *abfd, bfd_byte *contents, asection *sec); |
bfd_boolean bfd_check_compression_header |
(bfd *abfd, bfd_byte *contents, asection *sec, |
bfd_size_type *uncompressed_size); |
int bfd_get_compression_header_size (bfd *abfd, asection *sec); |
bfd_size_type bfd_convert_section_size |
(bfd *ibfd, asection *isec, bfd *obfd, bfd_size_type size); |
bfd_boolean bfd_convert_section_contents |
(bfd *ibfd, asection *isec, bfd *obfd, |
bfd_byte **ptr, bfd_size_type *ptr_size); |
/* Extracted from archive.c. */ |
symindex bfd_get_next_mapent |
(bfd *abfd, symindex previous, carsym **sym); |
6482,6 → 7076,7 |
enum bfd_flavour |
{ |
/* N.B. Update bfd_flavour_name if you change this. */ |
bfd_target_unknown_flavour, |
bfd_target_aout_flavour, |
bfd_target_coff_flavour, |
6699,12 → 7294,12 |
NAME##_make_empty_symbol, \ |
NAME##_print_symbol, \ |
NAME##_get_symbol_info, \ |
NAME##_get_symbol_version_string, \ |
NAME##_bfd_is_local_label_name, \ |
NAME##_bfd_is_target_special_symbol, \ |
NAME##_get_lineno, \ |
NAME##_find_nearest_line, \ |
_bfd_generic_find_nearest_line_discriminator, \ |
_bfd_generic_find_line, \ |
NAME##_find_line, \ |
NAME##_find_inliner_info, \ |
NAME##_bfd_make_debug_symbol, \ |
NAME##_read_minisymbols, \ |
6721,14 → 7316,14 |
void (*_bfd_get_symbol_info) |
(bfd *, struct bfd_symbol *, symbol_info *); |
#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) |
const char *(*_bfd_get_symbol_version_string) |
(bfd *, struct bfd_symbol *, bfd_boolean *); |
#define bfd_get_symbol_version_string(b,s,h) BFD_SEND (b, _bfd_get_symbol_version_string, (b,s,h)) |
bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); |
bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); |
alent * (*_get_lineno) (bfd *, struct bfd_symbol *); |
bfd_boolean (*_bfd_find_nearest_line) |
(bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, |
const char **, const char **, unsigned int *); |
bfd_boolean (*_bfd_find_nearest_line_discriminator) |
(bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, |
(bfd *, struct bfd_symbol **, struct bfd_section *, bfd_vma, |
const char **, const char **, unsigned int *, unsigned int *); |
bfd_boolean (*_bfd_find_line) |
(bfd *, struct bfd_symbol **, struct bfd_symbol *, |
6782,7 → 7377,6 |
NAME##_bfd_get_relocated_section_contents, \ |
NAME##_bfd_relax_section, \ |
NAME##_bfd_link_hash_table_create, \ |
NAME##_bfd_link_hash_table_free, \ |
NAME##_bfd_link_add_symbols, \ |
NAME##_bfd_link_just_syms, \ |
NAME##_bfd_copy_link_hash_symbol_type, \ |
6809,9 → 7403,6 |
struct bfd_link_hash_table * |
(*_bfd_link_hash_table_create) (bfd *); |
/* Release the memory associated with the linker hash table. */ |
void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *); |
/* Add symbols from this object file into the hash table. */ |
bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); |
6818,7 → 7409,8 |
/* Indicate that we are only retrieving symbol values from this section. */ |
void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *); |
/* Copy the symbol type of a linker hash table entry. */ |
/* Copy the symbol type and other attributes for a linker script |
assignment of one symbol to another. */ |
#define bfd_copy_link_hash_symbol_type(b, t, f) \ |
BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f)) |
void (*_bfd_copy_link_hash_symbol_type) |
6904,6 → 7496,8 |
(int (*search_func) (const bfd_target *, void *), |
void *); |
const char *bfd_flavour_name (enum bfd_flavour flavour); |
/* Extracted from format.c. */ |
bfd_boolean bfd_check_format (bfd *abfd, bfd_format format); |
6946,10 → 7540,6 |
(bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table); |
/* Extracted from compress.c. */ |
bfd_boolean bfd_compress_section_contents |
(bfd *abfd, asection *section, bfd_byte *uncompressed_buffer, |
bfd_size_type uncompressed_size); |
bfd_boolean bfd_get_full_section_contents |
(bfd *abfd, asection *section, bfd_byte **ptr); |
6956,6 → 7546,11 |
void bfd_cache_section_contents |
(asection *sec, void *contents); |
bfd_boolean bfd_is_section_compressed_with_header |
(bfd *abfd, asection *section, |
int *compression_header_size_p, |
bfd_size_type *uncompressed_size_p); |
bfd_boolean bfd_is_section_compressed |
(bfd *abfd, asection *section); |
6965,6 → 7560,9 |
bfd_boolean bfd_init_section_compress_status |
(bfd *abfd, asection *section); |
bfd_boolean bfd_compress_section |
(bfd *abfd, asection *section, bfd_byte *uncompressed_buffer); |
#ifdef __cplusplus |
} |
#endif |
/contrib/toolchain/binutils/bfd/bfd.c |
---|
1,5 → 1,5 |
/* Generic BFD library interface and support routines. |
Copyright 1990-2013 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
44,11 → 44,21 |
. both_direction = 3 |
. }; |
. |
.enum bfd_plugin_format |
. { |
. bfd_plugin_uknown = 0, |
. bfd_plugin_yes = 1, |
. bfd_plugin_no = 2 |
. }; |
. |
.struct bfd_build_id |
. { |
. bfd_size_type size; |
. bfd_byte data[1]; |
. }; |
. |
.struct bfd |
.{ |
. {* A unique identifier of the BFD *} |
. unsigned int id; |
. |
. {* The filename the application opened the BFD with. *} |
. const char *filename; |
. |
71,17 → 81,17 |
. {* File modified time, if mtime_set is TRUE. *} |
. long mtime; |
. |
. {* Reserved for an unimplemented file locking extension. *} |
. int ifd; |
. {* A unique identifier of the BFD *} |
. unsigned int id; |
. |
. {* The format which belongs to the BFD. (object, core, etc.) *} |
. bfd_format format; |
. ENUM_BITFIELD (bfd_format) format : 3; |
. |
. {* The direction with which the BFD was opened. *} |
. enum bfd_direction direction; |
. ENUM_BITFIELD (bfd_direction) direction : 2; |
. |
. {* Format_specific flags. *} |
. flagword flags; |
. flagword flags : 18; |
. |
. {* Values that may appear in the flags field of a BFD. These also |
. appear in the object_flags field of the bfd_target structure, where |
140,36 → 150,87 |
. struct. *} |
.#define BFD_IN_MEMORY 0x800 |
. |
. {* The sections in this BFD specify a memory page. *} |
.#define HAS_LOAD_PAGE 0x1000 |
. |
. {* This BFD has been created by the linker and doesn't correspond |
. to any input file. *} |
.#define BFD_LINKER_CREATED 0x2000 |
.#define BFD_LINKER_CREATED 0x1000 |
. |
. {* This may be set before writing out a BFD to request that it |
. be written using values for UIDs, GIDs, timestamps, etc. that |
. will be consistent from run to run. *} |
.#define BFD_DETERMINISTIC_OUTPUT 0x4000 |
.#define BFD_DETERMINISTIC_OUTPUT 0x2000 |
. |
. {* Compress sections in this BFD. *} |
.#define BFD_COMPRESS 0x8000 |
.#define BFD_COMPRESS 0x4000 |
. |
. {* Decompress sections in this BFD. *} |
.#define BFD_DECOMPRESS 0x10000 |
.#define BFD_DECOMPRESS 0x8000 |
. |
. {* BFD is a dummy, for plugins. *} |
.#define BFD_PLUGIN 0x20000 |
.#define BFD_PLUGIN 0x10000 |
. |
. {* Compress sections in this BFD with SHF_COMPRESSED from gABI. *} |
.#define BFD_COMPRESS_GABI 0x20000 |
. |
. {* Flags bits to be saved in bfd_preserve_save. *} |
.#define BFD_FLAGS_SAVED \ |
. (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_PLUGIN) |
. (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_PLUGIN \ |
. | BFD_COMPRESS_GABI) |
. |
. {* Flags bits which are for BFD use only. *} |
.#define BFD_FLAGS_FOR_BFD_USE_MASK \ |
. (BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \ |
. | BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT) |
. | BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT \ |
. | BFD_COMPRESS_GABI) |
. |
. {* Is the file descriptor being cached? That is, can it be closed as |
. needed, and re-opened when accessed later? *} |
. unsigned int cacheable : 1; |
. |
. {* Marks whether there was a default target specified when the |
. BFD was opened. This is used to select which matching algorithm |
. to use to choose the back end. *} |
. unsigned int target_defaulted : 1; |
. |
. {* ... and here: (``once'' means at least once). *} |
. unsigned int opened_once : 1; |
. |
. {* Set if we have a locally maintained mtime value, rather than |
. getting it from the file each time. *} |
. unsigned int mtime_set : 1; |
. |
. {* Flag set if symbols from this BFD should not be exported. *} |
. unsigned int no_export : 1; |
. |
. {* Remember when output has begun, to stop strange things |
. from happening. *} |
. unsigned int output_has_begun : 1; |
. |
. {* Have archive map. *} |
. unsigned int has_armap : 1; |
. |
. {* Set if this is a thin archive. *} |
. unsigned int is_thin_archive : 1; |
. |
. {* Set if only required symbols should be added in the link hash table for |
. this object. Used by VMS linkers. *} |
. unsigned int selective_search : 1; |
. |
. {* Set if this is the linker output BFD. *} |
. unsigned int is_linker_output : 1; |
. |
. {* Set if this is the linker input BFD. *} |
. unsigned int is_linker_input : 1; |
. |
. {* If this is an input for a compiler plug-in library. *} |
. ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2; |
. |
. {* Set if this is a plugin output file. *} |
. unsigned int lto_output : 1; |
. |
. {* Set to dummy BFD created when claimed by a compiler plug-in |
. library. *} |
. bfd *plugin_dummy_bfd; |
. |
. {* Currently my_archive is tested before adding origin to |
. anything. I believe that this can become always an add of |
. origin, with origin set to 0 for non archive files. *} |
194,17 → 255,21 |
. {* The number of sections. *} |
. unsigned int section_count; |
. |
. {* A field used by _bfd_generic_link_add_archive_symbols. This will |
. be used only for archive elements. *} |
. int archive_pass; |
. |
. {* Stuff only useful for object files: |
. The start address. *} |
. bfd_vma start_address; |
. |
. {* Used for input and output. *} |
. unsigned int symcount; |
. |
. {* Symbol table for output BFD (with symcount entries). |
. Also used by the linker to cache input BFD symbols. *} |
. struct bfd_symbol **outsymbols; |
. |
. {* Used for input and output. *} |
. unsigned int symcount; |
. |
. {* Used for slurped dynamic symbol tables. *} |
. unsigned int dynsymcount; |
. |
219,13 → 284,13 |
. struct bfd *nested_archives; {* List of nested archive in a flattened |
. thin archive. *} |
. |
. {* A chain of BFD structures involved in a link. *} |
. struct bfd *link_next; |
. union { |
. {* For input BFDs, a chain of BFDs involved in a link. *} |
. struct bfd *next; |
. {* For output BFD, the linker hash table. *} |
. struct bfd_link_hash_table *hash; |
. } link; |
. |
. {* A field used by _bfd_generic_link_add_archive_symbols. This will |
. be used only for archive elements. *} |
. int archive_pass; |
. |
. {* Used by the back end to hold private data. *} |
. union |
. { |
277,40 → 342,18 |
. of objalloc.h. *} |
. void *memory; |
. |
. {* Is the file descriptor being cached? That is, can it be closed as |
. needed, and re-opened when accessed later? *} |
. unsigned int cacheable : 1; |
. {* For input BFDs, the build ID, if the object has one. *} |
. const struct bfd_build_id *build_id; |
.}; |
. |
. {* Marks whether there was a default target specified when the |
. BFD was opened. This is used to select which matching algorithm |
. to use to choose the back end. *} |
. unsigned int target_defaulted : 1; |
.{* See note beside bfd_set_section_userdata. *} |
.static inline bfd_boolean |
.bfd_set_cacheable (bfd * abfd, bfd_boolean val) |
.{ |
. abfd->cacheable = val; |
. return TRUE; |
.} |
. |
. {* ... and here: (``once'' means at least once). *} |
. unsigned int opened_once : 1; |
. |
. {* Set if we have a locally maintained mtime value, rather than |
. getting it from the file each time. *} |
. unsigned int mtime_set : 1; |
. |
. {* Flag set if symbols from this BFD should not be exported. *} |
. unsigned int no_export : 1; |
. |
. {* Remember when output has begun, to stop strange things |
. from happening. *} |
. unsigned int output_has_begun : 1; |
. |
. {* Have archive map. *} |
. unsigned int has_armap : 1; |
. |
. {* Set if this is a thin archive. *} |
. unsigned int is_thin_archive : 1; |
. |
. {* Set if only required symbols should be added in the link hash table for |
. this object. Used by VMS linkers. *} |
. unsigned int selective_search : 1; |
.}; |
. |
*/ |
#include "sysdep.h" |
1047,11 → 1090,11 |
{ |
if (fn != NULL) |
(*_bfd_error_handler) |
(_("BFD %s internal error, aborting at %s line %d in %s\n"), |
(_("BFD %s internal error, aborting at %s:%d in %s\n"), |
BFD_VERSION_STRING, file, line, fn); |
else |
(*_bfd_error_handler) |
(_("BFD %s internal error, aborting at %s line %d\n"), |
(_("BFD %s internal error, aborting at %s:%d\n"), |
BFD_VERSION_STRING, file, line); |
(*_bfd_error_handler) (_("Please report this bug.\n")); |
_exit (EXIT_FAILURE); |
1065,9 → 1108,11 |
int bfd_get_arch_size (bfd *abfd); |
DESCRIPTION |
Returns the architecture address size, in bits, as determined |
by the object file's format. For ELF, this information is |
included in the header. |
Returns the normalized architecture address size, in bits, as |
determined by the object file's format. By normalized, we mean |
either 32 or 64. For ELF, this information is included in the |
header. Use bfd_arch_bits_per_address for number of bits in |
the architecture address. |
RETURNS |
Returns the arch size in bits if known, <<-1>> otherwise. |
1079,7 → 1124,7 |
if (abfd->xvec->flavour == bfd_target_elf_flavour) |
return get_elf_backend_data (abfd)->s->arch_size; |
return -1; |
return bfd_arch_bits_per_address (abfd) > 32 ? 64 : 32; |
} |
/* |
1433,12 → 1478,12 |
. |
.#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ |
. BFD_SEND (abfd, _bfd_find_nearest_line, \ |
. (abfd, sec, syms, off, file, func, line)) |
. (abfd, syms, sec, off, file, func, line, NULL)) |
. |
.#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \ |
. line, disc) \ |
. BFD_SEND (abfd, _bfd_find_nearest_line_discriminator, \ |
. (abfd, sec, syms, off, file, func, line, disc)) |
. BFD_SEND (abfd, _bfd_find_nearest_line, \ |
. (abfd, syms, sec, off, file, func, line, disc)) |
. |
.#define bfd_find_line(abfd, syms, sym, file, line) \ |
. BFD_SEND (abfd, _bfd_find_line, \ |
1487,9 → 1532,6 |
.#define bfd_link_hash_table_create(abfd) \ |
. BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) |
. |
.#define bfd_link_hash_table_free(abfd, hash) \ |
. BFD_SEND (abfd, _bfd_link_hash_table_free, (hash)) |
. |
.#define bfd_link_add_symbols(abfd, info) \ |
. BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) |
. |
1915,3 → 1957,316 |
return res; |
} |
/* |
FUNCTION |
bfd_update_compression_header |
SYNOPSIS |
void bfd_update_compression_header |
(bfd *abfd, bfd_byte *contents, asection *sec); |
DESCRIPTION |
Set the compression header at CONTENTS of SEC in ABFD and update |
elf_section_flags for compression. |
*/ |
void |
bfd_update_compression_header (bfd *abfd, bfd_byte *contents, |
asection *sec) |
{ |
if ((abfd->flags & BFD_COMPRESS) != 0) |
{ |
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) |
{ |
if ((abfd->flags & BFD_COMPRESS_GABI) != 0) |
{ |
const struct elf_backend_data *bed |
= get_elf_backend_data (abfd); |
/* Set the SHF_COMPRESSED bit. */ |
elf_section_flags (sec) |= SHF_COMPRESSED; |
if (bed->s->elfclass == ELFCLASS32) |
{ |
Elf32_External_Chdr *echdr |
= (Elf32_External_Chdr *) contents; |
bfd_put_32 (abfd, ELFCOMPRESS_ZLIB, &echdr->ch_type); |
bfd_put_32 (abfd, sec->size, &echdr->ch_size); |
bfd_put_32 (abfd, 1 << sec->alignment_power, |
&echdr->ch_addralign); |
} |
else |
{ |
Elf64_External_Chdr *echdr |
= (Elf64_External_Chdr *) contents; |
bfd_put_32 (abfd, ELFCOMPRESS_ZLIB, &echdr->ch_type); |
bfd_put_32 (abfd, 0, &echdr->ch_reserved); |
bfd_put_64 (abfd, sec->size, &echdr->ch_size); |
bfd_put_64 (abfd, 1 << sec->alignment_power, |
&echdr->ch_addralign); |
} |
} |
else |
{ |
/* Clear the SHF_COMPRESSED bit. */ |
elf_section_flags (sec) &= ~SHF_COMPRESSED; |
/* Write the zlib header. It should be "ZLIB" followed by |
the uncompressed section size, 8 bytes in big-endian |
order. */ |
memcpy (contents, "ZLIB", 4); |
bfd_putb64 (sec->size, contents + 4); |
} |
} |
} |
else |
abort (); |
} |
/* |
FUNCTION |
bfd_check_compression_header |
SYNOPSIS |
bfd_boolean bfd_check_compression_header |
(bfd *abfd, bfd_byte *contents, asection *sec, |
bfd_size_type *uncompressed_size); |
DESCRIPTION |
Check the compression header at CONTENTS of SEC in ABFD and |
store the uncompressed size in UNCOMPRESSED_SIZE if the |
compression header is valid. |
RETURNS |
Return TRUE if the compression header is valid. |
*/ |
bfd_boolean |
bfd_check_compression_header (bfd *abfd, bfd_byte *contents, |
asection *sec, |
bfd_size_type *uncompressed_size) |
{ |
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour |
&& (elf_section_flags (sec) & SHF_COMPRESSED) != 0) |
{ |
Elf_Internal_Chdr chdr; |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
if (bed->s->elfclass == ELFCLASS32) |
{ |
Elf32_External_Chdr *echdr = (Elf32_External_Chdr *) contents; |
chdr.ch_type = bfd_get_32 (abfd, &echdr->ch_type); |
chdr.ch_size = bfd_get_32 (abfd, &echdr->ch_size); |
chdr.ch_addralign = bfd_get_32 (abfd, &echdr->ch_addralign); |
} |
else |
{ |
Elf64_External_Chdr *echdr = (Elf64_External_Chdr *) contents; |
chdr.ch_type = bfd_get_32 (abfd, &echdr->ch_type); |
chdr.ch_size = bfd_get_64 (abfd, &echdr->ch_size); |
chdr.ch_addralign = bfd_get_64 (abfd, &echdr->ch_addralign); |
} |
if (chdr.ch_type == ELFCOMPRESS_ZLIB |
&& chdr.ch_addralign == 1U << sec->alignment_power) |
{ |
*uncompressed_size = chdr.ch_size; |
return TRUE; |
} |
} |
return FALSE; |
} |
/* |
FUNCTION |
bfd_get_compression_header_size |
SYNOPSIS |
int bfd_get_compression_header_size (bfd *abfd, asection *sec); |
DESCRIPTION |
Return the size of the compression header of SEC in ABFD. |
RETURNS |
Return the size of the compression header in bytes. |
*/ |
int |
bfd_get_compression_header_size (bfd *abfd, asection *sec) |
{ |
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) |
{ |
if (sec == NULL) |
{ |
if (!(abfd->flags & BFD_COMPRESS_GABI)) |
return 0; |
} |
else if (!(elf_section_flags (sec) & SHF_COMPRESSED)) |
return 0; |
if (get_elf_backend_data (abfd)->s->elfclass == ELFCLASS32) |
return sizeof (Elf32_External_Chdr); |
else |
return sizeof (Elf64_External_Chdr); |
} |
return 0; |
} |
/* |
FUNCTION |
bfd_convert_section_size |
SYNOPSIS |
bfd_size_type bfd_convert_section_size |
(bfd *ibfd, asection *isec, bfd *obfd, bfd_size_type size); |
DESCRIPTION |
Convert the size @var{size} of the section @var{isec} in input |
BFD @var{ibfd} to the section size in output BFD @var{obfd}. |
*/ |
bfd_size_type |
bfd_convert_section_size (bfd *ibfd, sec_ptr isec, bfd *obfd, |
bfd_size_type size) |
{ |
bfd_size_type hdr_size; |
/* Do nothing if input file will be decompressed. */ |
if ((ibfd->flags & BFD_DECOMPRESS)) |
return size; |
/* Do nothing if either input or output aren't ELF. */ |
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour |
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour) |
return size; |
/* Do nothing if ELF classes of input and output are the same. */ |
if (get_elf_backend_data (ibfd)->s->elfclass |
== get_elf_backend_data (obfd)->s->elfclass) |
return size; |
/* Do nothing if the input section isn't a SHF_COMPRESSED section. */ |
hdr_size = bfd_get_compression_header_size (ibfd, isec); |
if (hdr_size == 0) |
return size; |
/* Adjust the size of the output SHF_COMPRESSED section. */ |
if (hdr_size == sizeof (Elf32_External_Chdr)) |
return (size - sizeof (Elf32_External_Chdr) |
+ sizeof (Elf64_External_Chdr)); |
else |
return (size - sizeof (Elf64_External_Chdr) |
+ sizeof (Elf32_External_Chdr)); |
} |
/* |
FUNCTION |
bfd_convert_section_contents |
SYNOPSIS |
bfd_boolean bfd_convert_section_contents |
(bfd *ibfd, asection *isec, bfd *obfd, |
bfd_byte **ptr, bfd_size_type *ptr_size); |
DESCRIPTION |
Convert the contents, stored in @var{*ptr}, of the section |
@var{isec} in input BFD @var{ibfd} to output BFD @var{obfd} |
if needed. The original buffer pointed to by @var{*ptr} may |
be freed and @var{*ptr} is returned with memory malloc'd by this |
function, and the new size written to @var{ptr_size}. |
*/ |
bfd_boolean |
bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd, |
bfd_byte **ptr, bfd_size_type *ptr_size) |
{ |
bfd_byte *contents; |
bfd_size_type ihdr_size, ohdr_size, size; |
Elf_Internal_Chdr chdr; |
bfd_boolean use_memmove; |
/* Do nothing if input file will be decompressed. */ |
if ((ibfd->flags & BFD_DECOMPRESS)) |
return TRUE; |
/* Do nothing if either input or output aren't ELF. */ |
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour |
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour) |
return TRUE; |
/* Do nothing if ELF classes of input and output are the same. */ |
if (get_elf_backend_data (ibfd)->s->elfclass |
== get_elf_backend_data (obfd)->s->elfclass) |
return TRUE; |
/* Do nothing if the input section isn't a SHF_COMPRESSED section. */ |
ihdr_size = bfd_get_compression_header_size (ibfd, isec); |
if (ihdr_size == 0) |
return TRUE; |
contents = *ptr; |
/* Convert the contents of the input SHF_COMPRESSED section to |
output. Get the input compression header and the size of the |
output compression header. */ |
if (ihdr_size == sizeof (Elf32_External_Chdr)) |
{ |
Elf32_External_Chdr *echdr = (Elf32_External_Chdr *) contents; |
chdr.ch_type = bfd_get_32 (ibfd, &echdr->ch_type); |
chdr.ch_size = bfd_get_32 (ibfd, &echdr->ch_size); |
chdr.ch_addralign = bfd_get_32 (ibfd, &echdr->ch_addralign); |
ohdr_size = sizeof (Elf64_External_Chdr); |
use_memmove = FALSE; |
} |
else |
{ |
Elf64_External_Chdr *echdr = (Elf64_External_Chdr *) contents; |
chdr.ch_type = bfd_get_32 (ibfd, &echdr->ch_type); |
chdr.ch_size = bfd_get_64 (ibfd, &echdr->ch_size); |
chdr.ch_addralign = bfd_get_64 (ibfd, &echdr->ch_addralign); |
ohdr_size = sizeof (Elf32_External_Chdr); |
use_memmove = TRUE; |
} |
size = bfd_get_section_size (isec) - ihdr_size + ohdr_size; |
if (!use_memmove) |
{ |
contents = (bfd_byte *) bfd_malloc (size); |
if (contents == NULL) |
return FALSE; |
} |
/* Write out the output compression header. */ |
if (ohdr_size == sizeof (Elf32_External_Chdr)) |
{ |
Elf32_External_Chdr *echdr = (Elf32_External_Chdr *) contents; |
bfd_put_32 (obfd, ELFCOMPRESS_ZLIB, &echdr->ch_type); |
bfd_put_32 (obfd, chdr.ch_size, &echdr->ch_size); |
bfd_put_32 (obfd, chdr.ch_addralign, &echdr->ch_addralign); |
} |
else |
{ |
Elf64_External_Chdr *echdr = (Elf64_External_Chdr *) contents; |
bfd_put_32 (obfd, ELFCOMPRESS_ZLIB, &echdr->ch_type); |
bfd_put_32 (obfd, 0, &echdr->ch_reserved); |
bfd_put_64 (obfd, chdr.ch_size, &echdr->ch_size); |
bfd_put_64 (obfd, chdr.ch_addralign, &echdr->ch_addralign); |
} |
/* Copy the compressed contents. */ |
if (use_memmove) |
memmove (contents + ohdr_size, *ptr + ihdr_size, size - ohdr_size); |
else |
{ |
memcpy (contents + ohdr_size, *ptr + ihdr_size, size - ohdr_size); |
free (*ptr); |
*ptr = contents; |
} |
*ptr_size = size; |
return TRUE; |
} |
/contrib/toolchain/binutils/bfd/bfd.h |
---|
7,7 → 7,7 |
/* Main header file for the bfd library -- portable access to object files. |
Copyright 1990-2013 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Contributed by Cygnus Support. |
279,7 → 279,7 |
/* Object and core file sections. */ |
#define align_power(addr, align) \ |
(((addr) + ((bfd_vma) 1 << (align)) - 1) & ((bfd_vma) -1 << (align))) |
(((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align)))) |
typedef struct bfd_section *sec_ptr; |
299,13 → 299,13 |
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) |
#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE) |
#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE) |
#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE) |
#define bfd_get_section_limit_octets(bfd, sec) \ |
((bfd)->direction != write_direction && (sec)->rawsize != 0 \ |
? (sec)->rawsize : (sec)->size) |
/* Find the address one past the end of SEC. */ |
#define bfd_get_section_limit(bfd, sec) \ |
(((bfd)->direction != write_direction && (sec)->rawsize != 0 \ |
? (sec)->rawsize : (sec)->size) / bfd_octets_per_byte (bfd)) |
(bfd_get_section_limit_octets(bfd, sec) / bfd_octets_per_byte (bfd)) |
/* Return TRUE if input section SEC has been discarded. */ |
#define discarded_section(sec) \ |
444,6 → 444,16 |
this size. */ |
extern unsigned long bfd_hash_set_default_size (unsigned long); |
/* Types of compressed DWARF debug sections. We currently support |
zlib. */ |
enum compressed_debug_section_type |
{ |
COMPRESS_DEBUG_NONE = 0, |
COMPRESS_DEBUG = 1 << 0, |
COMPRESS_DEBUG_GNU_ZLIB = COMPRESS_DEBUG | 1 << 1, |
COMPRESS_DEBUG_GABI_ZLIB = COMPRESS_DEBUG | 1 << 2 |
}; |
/* This structure is used to keep track of stabs in sections |
information while linking. */ |
524,8 → 534,6 |
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) |
#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE) |
extern bfd_boolean bfd_cache_close |
(bfd *abfd); |
/* NB: This declaration should match the autogenerated one in libbfd.h. */ |
670,7 → 678,7 |
(bfd *); |
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_elf_discard_info |
extern int bfd_elf_discard_info |
(bfd *, struct bfd_link_info *); |
extern unsigned int _bfd_elf_default_action_discarded |
(struct bfd_section *); |
692,19 → 700,21 |
(bfd *abfd, void *phdrs); |
/* Create a new BFD as if by bfd_openr. Rather than opening a file, |
reconstruct an ELF file by reading the segments out of remote memory |
based on the ELF file header at EHDR_VMA and the ELF program headers it |
points to. If not null, *LOADBASEP is filled in with the difference |
between the VMAs from which the segments were read, and the VMAs the |
file headers (and hence BFD's idea of each section's VMA) put them at. |
reconstruct an ELF file by reading the segments out of remote |
memory based on the ELF file header at EHDR_VMA and the ELF program |
headers it points to. If non-zero, SIZE is the known extent of the |
object. If not null, *LOADBASEP is filled in with the difference |
between the VMAs from which the segments were read, and the VMAs |
the file headers (and hence BFD's idea of each section's VMA) put |
them at. |
The function TARGET_READ_MEMORY is called to copy LEN bytes from the |
remote memory at target address VMA into the local buffer at MYADDR; it |
should return zero on success or an `errno' code on failure. TEMPL must |
be a BFD for an ELF target with the word size and byte order found in |
the remote memory. */ |
The function TARGET_READ_MEMORY is called to copy LEN bytes from |
the remote memory at target address VMA into the local buffer at |
MYADDR; it should return zero on success or an `errno' code on |
failure. TEMPL must be a BFD for a target with the word size and |
byte order found in the remote memory. */ |
extern bfd *bfd_elf_bfd_from_remote_memory |
(bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, |
(bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep, |
int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, |
bfd_size_type len)); |
816,12 → 826,6 |
union internal_auxent; |
#endif |
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 *); |
extern bfd_boolean bfd_coff_set_symbol_class |
(bfd *, struct bfd_symbol *, unsigned int); |
852,6 → 856,23 |
extern void bfd_elf32_arm_vfp11_fix_veneer_locations |
(bfd *, struct bfd_link_info *); |
/* ARM STM STM32L4XX erratum workaround support. */ |
typedef enum |
{ |
BFD_ARM_STM32L4XX_FIX_NONE, |
BFD_ARM_STM32L4XX_FIX_DEFAULT, |
BFD_ARM_STM32L4XX_FIX_ALL |
} bfd_arm_stm32l4xx_fix; |
extern void bfd_elf32_arm_set_stm32l4xx_fix |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean bfd_elf32_arm_stm32l4xx_erratum_scan |
(bfd *, struct bfd_link_info *); |
extern void bfd_elf32_arm_stm32l4xx_fix_veneer_locations |
(bfd *, struct bfd_link_info *); |
/* ARM Interworking support. Called from linker. */ |
extern bfd_boolean bfd_arm_allocate_interworking_sections |
(struct bfd_link_info *); |
881,7 → 902,7 |
void bfd_elf32_arm_set_target_relocs |
(bfd *, struct bfd_link_info *, int, char *, int, int, bfd_arm_vfp11_fix, |
int, int, int, int, int); |
bfd_arm_stm32l4xx_fix, int, int, int, int, int); |
extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking |
(bfd *, struct bfd_link_info *); |
889,16 → 910,20 |
extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd |
(bfd *, struct bfd_link_info *); |
/* ELF ARM mapping symbol support */ |
/* ELF ARM mapping symbol support. */ |
#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0) |
#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1) |
#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2) |
#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0) |
extern bfd_boolean bfd_is_arm_special_symbol_name |
(const char * name, int type); |
(const char *, int); |
extern void bfd_elf32_arm_set_byteswap_code (struct bfd_link_info *, int); |
extern void bfd_elf32_arm_set_byteswap_code |
(struct bfd_link_info *, int); |
extern void bfd_elf32_arm_use_long_plt (void); |
/* ARM Note section processing. */ |
extern bfd_boolean bfd_arm_merge_machines |
(bfd *, bfd *); |
943,10 → 968,10 |
(bfd *); |
extern void bfd_elf64_aarch64_set_options |
(bfd *, struct bfd_link_info *, int, int, int); |
(bfd *, struct bfd_link_info *, int, int, int, int, int); |
extern void bfd_elf32_aarch64_set_options |
(bfd *, struct bfd_link_info *, int, int, int); |
(bfd *, struct bfd_link_info *, int, int, int, int, int); |
/* ELF AArch64 mapping symbol support. */ |
#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0) |
998,29 → 1023,17 |
extern void bfd_elf64_ia64_after_parse |
(int); |
/* 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. */ |
/* V850 Note manipulation routines. */ |
extern bfd_boolean v850_elf_create_sections |
(struct bfd_link_info *); |
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; |
}; |
extern struct coff_comdat_info * bfd_coff_get_comdat_section |
(bfd *, struct bfd_section *); |
extern bfd_boolean v850_elf_set_note |
(bfd *, unsigned int, unsigned int); |
/* Extracted from init.c. */ |
void bfd_init (void); |
/* Extracted from opncls.c. */ |
/* Set to N to open the next N BFDs using an alternate id space. */ |
extern unsigned int bfd_use_reserved_id; |
bfd *bfd_fopen (const char *filename, const char *target, |
const char *mode, int fd); |
1029,7 → 1042,7 |
bfd *bfd_fdopenr (const char *filename, const char *target, int fd); |
bfd *bfd_openstreamr (const char *, const char *, void *); |
bfd *bfd_openstreamr (const char * filename, const char * target, void * stream); |
bfd *bfd_openr_iovec (const char *filename, const char *target, |
void *(*open_func) (struct bfd *nbfd, |
1067,7 → 1080,9 |
char *bfd_get_debug_link_info (bfd *abfd, unsigned long *crc32_out); |
char *bfd_get_alt_debug_link_info (bfd *abfd, unsigned long *crc32_out); |
char *bfd_get_alt_debug_link_info (bfd * abfd, |
bfd_size_type *buildid_len, |
bfd_byte **buildid_out); |
char *bfd_follow_gnu_debuglink (bfd *abfd, const char *dir); |
1203,6 → 1218,7 |
/* Extracted from bfdwin.c. */ |
/* Extracted from section.c. */ |
typedef struct bfd_section |
{ |
/* The name of the section; the name isn't a copy, the pointer is |
1210,10 → 1226,10 |
const char *name; |
/* A unique sequence number. */ |
int id; |
unsigned int id; |
/* Which section in the bfd; 0..n-1 as sections are created in a bfd. */ |
int index; |
unsigned int index; |
/* The next section in the list belonging to the BFD, or NULL. */ |
struct bfd_section *next; |
1389,6 → 1405,10 |
executables or shared objects. This is for COFF only. */ |
#define SEC_COFF_SHARED 0x8000000 |
/* This section should be compressed. This is for ELF linker |
internal use only. */ |
#define SEC_ELF_COMPRESS 0x8000000 |
/* When a section with this flag is being linked, then if the size of |
the input section is less than a page, it should not cross a page |
boundary. If the size of the input section is one page or more, |
1396,11 → 1416,18 |
TMS320C54X only. */ |
#define SEC_TIC54X_BLOCK 0x10000000 |
/* This section should be renamed. This is for ELF linker |
internal use only. */ |
#define SEC_ELF_RENAME 0x10000000 |
/* Conditionally link this section; do not link if there are no |
references found to any symbol in the section. This is for TI |
TMS320C54X only. */ |
#define SEC_TIC54X_CLINK 0x20000000 |
/* This section contains vliw code. This is for Toshiba MeP only. */ |
#define SEC_MEP_VLIW 0x20000000 |
/* Indicate that section has the no read flag set. This happens |
when memory read flag isn't set. */ |
#define SEC_COFF_NOREAD 0x40000000 |
1440,6 → 1467,8 |
#define SEC_INFO_TYPE_MERGE 2 |
#define SEC_INFO_TYPE_EH_FRAME 3 |
#define SEC_INFO_TYPE_JUST_SYMS 4 |
#define SEC_INFO_TYPE_TARGET 5 |
#define SEC_INFO_TYPE_EH_FRAME_ENTRY 6 |
/* Nonzero if this section uses RELA relocations, rather than REL. */ |
unsigned int use_rela_p:1; |
1594,6 → 1623,32 |
int size; |
}; |
/* Note: the following are provided as inline functions rather than macros |
because not all callers use the return value. A macro implementation |
would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some |
compilers will complain about comma expressions that have no effect. */ |
static inline bfd_boolean |
bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val) |
{ |
ptr->userdata = val; |
return TRUE; |
} |
static inline bfd_boolean |
bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) |
{ |
ptr->vma = ptr->lma = val; |
ptr->user_set_vma = TRUE; |
return TRUE; |
} |
static inline bfd_boolean |
bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val) |
{ |
ptr->alignment_power = val; |
return TRUE; |
} |
/* These sections are global, and are managed by BFD. The application |
and target back end are not permitted to change the values in |
these sections. */ |
1755,7 → 1810,7 |
asection *bfd_get_section_by_name (bfd *abfd, const char *name); |
asection *bfd_get_next_section_by_name (asection *sec); |
asection *bfd_get_next_section_by_name (bfd *ibfd, asection *sec); |
asection *bfd_get_linker_section (bfd *abfd, const char *name); |
1780,6 → 1835,8 |
asection *bfd_make_section (bfd *, const char *name); |
int bfd_get_next_section_id (void); |
bfd_boolean bfd_set_section_flags |
(bfd *abfd, asection *sec, flagword flags); |
1876,7 → 1933,9 |
#define bfd_mach_i960_jx 7 |
#define bfd_mach_i960_hx 8 |
bfd_arch_or32, /* OpenRISC 32 */ |
bfd_arch_or1k, /* OpenRISC 1000 */ |
#define bfd_mach_or1k 1 |
#define bfd_mach_or1knd 2 |
bfd_arch_sparc, /* SPARC */ |
#define bfd_mach_sparc 1 |
1932,11 → 1991,18 |
#define bfd_mach_mips_octeon 6501 |
#define bfd_mach_mips_octeonp 6601 |
#define bfd_mach_mips_octeon2 6502 |
#define bfd_mach_mips_octeon3 6503 |
#define bfd_mach_mips_xlr 887682 /* decimal 'XLR' */ |
#define bfd_mach_mipsisa32 32 |
#define bfd_mach_mipsisa32r2 33 |
#define bfd_mach_mipsisa32r3 34 |
#define bfd_mach_mipsisa32r5 36 |
#define bfd_mach_mipsisa32r6 37 |
#define bfd_mach_mipsisa64 64 |
#define bfd_mach_mipsisa64r2 65 |
#define bfd_mach_mipsisa64r3 66 |
#define bfd_mach_mipsisa64r5 68 |
#define bfd_mach_mipsisa64r6 69 |
#define bfd_mach_mips_micromips 96 |
bfd_arch_i386, /* Intel 386 */ |
#define bfd_mach_i386_intel_syntax (1 << 0) |
1957,6 → 2023,10 |
#define bfd_mach_i386_i386_nacl (bfd_mach_i386_i386 | bfd_mach_i386_nacl) |
#define bfd_mach_x86_64_nacl (bfd_mach_x86_64 | bfd_mach_i386_nacl) |
#define bfd_mach_x64_32_nacl (bfd_mach_x64_32 | bfd_mach_i386_nacl) |
bfd_arch_iamcu, /* Intel MCU */ |
#define bfd_mach_iamcu (1 << 8) |
#define bfd_mach_i386_iamcu (bfd_mach_i386_i386 | bfd_mach_iamcu) |
#define bfd_mach_i386_iamcu_intel_syntax (bfd_mach_i386_iamcu | bfd_mach_i386_intel_syntax) |
bfd_arch_we32k, /* AT&T WE32xxx */ |
bfd_arch_tahoe, /* CCI/Harris Tahoe */ |
bfd_arch_i860, /* Intel 860 */ |
2071,6 → 2141,12 |
#define bfd_mach_arm_ep9312 11 |
#define bfd_mach_arm_iWMMXt 12 |
#define bfd_mach_arm_iWMMXt2 13 |
bfd_arch_nds32, /* Andes NDS32 */ |
#define bfd_mach_n1 1 |
#define bfd_mach_n1h 2 |
#define bfd_mach_n1h_v2 3 |
#define bfd_mach_n1h_v3 4 |
#define bfd_mach_n1h_v3m 5 |
bfd_arch_ns32k, /* National Semiconductors ns32000 */ |
bfd_arch_w65, /* WDC 65816 */ |
bfd_arch_tic30, /* Texas Instruments TMS320C30 */ |
2089,10 → 2165,12 |
#define bfd_mach_v850e2v3 0x45325633 |
#define bfd_mach_v850e3v5 0x45335635 /* ('E'|'3'|'V'|'5') */ |
bfd_arch_arc, /* ARC Cores */ |
#define bfd_mach_arc_5 5 |
#define bfd_mach_arc_6 6 |
#define bfd_mach_arc_7 7 |
#define bfd_mach_arc_8 8 |
#define bfd_mach_arc_a4 0 |
#define bfd_mach_arc_a5 1 |
#define bfd_mach_arc_arc600 2 |
#define bfd_mach_arc_arc601 4 |
#define bfd_mach_arc_arc700 3 |
#define bfd_mach_arc_arcv2 5 |
bfd_arch_m32c, /* Renesas M16C/M32C. */ |
#define bfd_mach_m16c 0x75 |
#define bfd_mach_m32c 0x78 |
2118,6 → 2196,8 |
#define bfd_mach_fr550 550 |
bfd_arch_moxie, /* The moxie processor */ |
#define bfd_mach_moxie 1 |
bfd_arch_ft32, /* The ft32 processor */ |
#define bfd_mach_ft32 1 |
bfd_arch_mcore, |
bfd_arch_mep, |
#define bfd_mach_mep 1 |
2153,6 → 2233,7 |
#define bfd_mach_avr5 5 |
#define bfd_mach_avr51 51 |
#define bfd_mach_avr6 6 |
#define bfd_mach_avrtiny 100 |
#define bfd_mach_avrxmega1 101 |
#define bfd_mach_avrxmega2 102 |
#define bfd_mach_avrxmega3 103 |
2182,7 → 2263,6 |
bfd_arch_score, /* Sunplus score */ |
#define bfd_mach_score3 3 |
#define bfd_mach_score7 7 |
bfd_arch_openrisc, /* OpenRISC */ |
bfd_arch_mmix, /* Donald Knuth's educational processor. */ |
bfd_arch_xstormy16, |
#define bfd_mach_xstormy16 1 |
2235,8 → 2315,12 |
bfd_arch_aarch64, /* AArch64 */ |
#define bfd_mach_aarch64 0 |
#define bfd_mach_aarch64_ilp32 32 |
bfd_arch_nios2, |
bfd_arch_nios2, /* Nios II */ |
#define bfd_mach_nios2 0 |
#define bfd_mach_nios2r1 1 |
#define bfd_mach_nios2r2 2 |
bfd_arch_visium, /* Visium */ |
#define bfd_mach_visium 1 |
bfd_arch_last |
}; |
2302,6 → 2386,7 |
(enum bfd_architecture arch, unsigned long machine); |
/* Extracted from reloc.c. */ |
typedef enum bfd_reloc_status |
{ |
/* No errors detected. */ |
2351,6 → 2436,7 |
} |
arelent; |
enum complain_overflow |
{ |
/* Do not complain on overflow. */ |
2369,6 → 2455,7 |
unsigned number. */ |
complain_overflow_unsigned |
}; |
struct bfd_symbol; /* Forward declaration. */ |
struct reloc_howto_struct |
{ |
2896,6 → 2983,12 |
BFD_RELOC_MICROMIPS_10_PCREL_S1, |
BFD_RELOC_MICROMIPS_16_PCREL_S1, |
/* MIPS PC-relative relocations. */ |
BFD_RELOC_MIPS_21_PCREL_S2, |
BFD_RELOC_MIPS_26_PCREL_S2, |
BFD_RELOC_MIPS_18_PCREL_S3, |
BFD_RELOC_MIPS_19_PCREL_S2, |
/* microMIPS versions of generic BFD relocs. */ |
BFD_RELOC_MICROMIPS_GPREL16, |
BFD_RELOC_MICROMIPS_HI16, |
2970,6 → 3063,13 |
BFD_RELOC_MOXIE_10_PCREL, |
/* FT32 ELF relocations. */ |
BFD_RELOC_FT32_10, |
BFD_RELOC_FT32_20, |
BFD_RELOC_FT32_17, |
BFD_RELOC_FT32_18, |
/* Fujitsu Frv Relocations. */ |
BFD_RELOC_FRV_LABEL16, |
BFD_RELOC_FRV_LABEL24, |
3094,6 → 3194,7 |
BFD_RELOC_386_TLS_DESC_CALL, |
BFD_RELOC_386_TLS_DESC, |
BFD_RELOC_386_IRELATIVE, |
BFD_RELOC_386_GOT32X, |
/* x86-64/elf relocations */ |
BFD_RELOC_X86_64_GOT32, |
3125,6 → 3226,8 |
BFD_RELOC_X86_64_IRELATIVE, |
BFD_RELOC_X86_64_PC32_BND, |
BFD_RELOC_X86_64_PLT32_BND, |
BFD_RELOC_X86_64_GOTPCRELX, |
BFD_RELOC_X86_64_REX_GOTPCRELX, |
/* ns32k relocations */ |
BFD_RELOC_NS32K_IMM_8, |
3200,6 → 3303,7 |
BFD_RELOC_PPC_VLE_SDAREL_HI16D, |
BFD_RELOC_PPC_VLE_SDAREL_HA16A, |
BFD_RELOC_PPC_VLE_SDAREL_HA16D, |
BFD_RELOC_PPC_REL16DX_HA, |
BFD_RELOC_PPC64_HIGHER, |
BFD_RELOC_PPC64_HIGHER_S, |
BFD_RELOC_PPC64_HIGHEST, |
3225,6 → 3329,8 |
BFD_RELOC_PPC64_PLTGOT16_LO_DS, |
BFD_RELOC_PPC64_ADDR16_HIGH, |
BFD_RELOC_PPC64_ADDR16_HIGHA, |
BFD_RELOC_PPC64_ADDR64_LOCAL, |
BFD_RELOC_PPC64_ENTRY, |
/* PowerPC and PowerPC64 thread-local storage relocations. */ |
BFD_RELOC_PPC_TLS, |
3538,17 → 3644,74 |
BFD_RELOC_SH_GOTOFFFUNCDESC20, |
BFD_RELOC_SH_FUNCDESC, |
/* ARC Cores relocs. |
ARC 22 bit pc-relative branch. The lowest two bits must be zero and are |
not stored in the instruction. The high 20 bits are installed in bits 26 |
through 7 of the instruction. */ |
BFD_RELOC_ARC_B22_PCREL, |
/* ARC relocs. */ |
BFD_RELOC_ARC_NONE, |
BFD_RELOC_ARC_8, |
BFD_RELOC_ARC_16, |
BFD_RELOC_ARC_24, |
BFD_RELOC_ARC_32, |
BFD_RELOC_ARC_N8, |
BFD_RELOC_ARC_N16, |
BFD_RELOC_ARC_N24, |
BFD_RELOC_ARC_N32, |
BFD_RELOC_ARC_SDA, |
BFD_RELOC_ARC_SECTOFF, |
BFD_RELOC_ARC_S21H_PCREL, |
BFD_RELOC_ARC_S21W_PCREL, |
BFD_RELOC_ARC_S25H_PCREL, |
BFD_RELOC_ARC_S25W_PCREL, |
BFD_RELOC_ARC_SDA32, |
BFD_RELOC_ARC_SDA_LDST, |
BFD_RELOC_ARC_SDA_LDST1, |
BFD_RELOC_ARC_SDA_LDST2, |
BFD_RELOC_ARC_SDA16_LD, |
BFD_RELOC_ARC_SDA16_LD1, |
BFD_RELOC_ARC_SDA16_LD2, |
BFD_RELOC_ARC_S13_PCREL, |
BFD_RELOC_ARC_W, |
BFD_RELOC_ARC_32_ME, |
BFD_RELOC_ARC_32_ME_S, |
BFD_RELOC_ARC_N32_ME, |
BFD_RELOC_ARC_SECTOFF_ME, |
BFD_RELOC_ARC_SDA32_ME, |
BFD_RELOC_ARC_W_ME, |
BFD_RELOC_AC_SECTOFF_U8, |
BFD_RELOC_AC_SECTOFF_U8_1, |
BFD_RELOC_AC_SECTOFF_U8_2, |
BFD_RELOC_AC_SECTFOFF_S9, |
BFD_RELOC_AC_SECTFOFF_S9_1, |
BFD_RELOC_AC_SECTFOFF_S9_2, |
BFD_RELOC_ARC_SECTOFF_ME_1, |
BFD_RELOC_ARC_SECTOFF_ME_2, |
BFD_RELOC_ARC_SECTOFF_1, |
BFD_RELOC_ARC_SECTOFF_2, |
BFD_RELOC_ARC_SDA16_ST2, |
BFD_RELOC_ARC_32_PCREL, |
BFD_RELOC_ARC_PC32, |
BFD_RELOC_ARC_GOT32, |
BFD_RELOC_ARC_GOTPC32, |
BFD_RELOC_ARC_PLT32, |
BFD_RELOC_ARC_COPY, |
BFD_RELOC_ARC_GLOB_DAT, |
BFD_RELOC_ARC_JMP_SLOT, |
BFD_RELOC_ARC_RELATIVE, |
BFD_RELOC_ARC_GOTOFF, |
BFD_RELOC_ARC_GOTPC, |
BFD_RELOC_ARC_S21W_PCREL_PLT, |
BFD_RELOC_ARC_S25H_PCREL_PLT, |
BFD_RELOC_ARC_TLS_DTPMOD, |
BFD_RELOC_ARC_TLS_TPOFF, |
BFD_RELOC_ARC_TLS_GD_GOT, |
BFD_RELOC_ARC_TLS_GD_LD, |
BFD_RELOC_ARC_TLS_GD_CALL, |
BFD_RELOC_ARC_TLS_IE_GOT, |
BFD_RELOC_ARC_TLS_DTPOFF, |
BFD_RELOC_ARC_TLS_DTPOFF_S9, |
BFD_RELOC_ARC_TLS_LE_S9, |
BFD_RELOC_ARC_TLS_LE_32, |
BFD_RELOC_ARC_S25W_PCREL_PLT, |
BFD_RELOC_ARC_S21H_PCREL_PLT, |
/* ARC 26 bit absolute branch. The lowest two bits must be zero and are not |
stored in the instruction. The high 24 bits are installed in bits 23 |
through 0. */ |
BFD_RELOC_ARC_B26, |
/* ADI Blackfin 16 bit immediate absolute reloc. */ |
BFD_RELOC_BFIN_16_IMM, |
3794,6 → 3957,205 |
BFD_RELOC_M32R_GOTPC_HI_SLO, |
BFD_RELOC_M32R_GOTPC_LO, |
/* NDS32 relocs. |
This is a 20 bit absolute address. */ |
BFD_RELOC_NDS32_20, |
/* This is a 9-bit pc-relative reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_9_PCREL, |
/* This is a 9-bit pc-relative reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_WORD_9_PCREL, |
/* This is an 15-bit reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_15_PCREL, |
/* This is an 17-bit reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_17_PCREL, |
/* This is a 25-bit reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_25_PCREL, |
/* This is a 20-bit reloc containing the high 20 bits of an address |
used with the lower 12 bits */ |
BFD_RELOC_NDS32_HI20, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift right by 3. This is used with ldi,sdi... */ |
BFD_RELOC_NDS32_LO12S3, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 2. This is used with lwi,swi... */ |
BFD_RELOC_NDS32_LO12S2, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 1. This is used with lhi,shi... */ |
BFD_RELOC_NDS32_LO12S1, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 0. This is used with lbisbi... */ |
BFD_RELOC_NDS32_LO12S0, |
/* This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 0. This is only used with branch relaxations */ |
BFD_RELOC_NDS32_LO12S0_ORI, |
/* This is a 15-bit reloc containing the small data area 18-bit signed offset |
and shift left by 3 for use in ldi, sdi... */ |
BFD_RELOC_NDS32_SDA15S3, |
/* This is a 15-bit reloc containing the small data area 17-bit signed offset |
and shift left by 2 for use in lwi, swi... */ |
BFD_RELOC_NDS32_SDA15S2, |
/* This is a 15-bit reloc containing the small data area 16-bit signed offset |
and shift left by 1 for use in lhi, shi... */ |
BFD_RELOC_NDS32_SDA15S1, |
/* This is a 15-bit reloc containing the small data area 15-bit signed offset |
and shift left by 0 for use in lbi, sbi... */ |
BFD_RELOC_NDS32_SDA15S0, |
/* This is a 16-bit reloc containing the small data area 16-bit signed offset |
and shift left by 3 */ |
BFD_RELOC_NDS32_SDA16S3, |
/* This is a 17-bit reloc containing the small data area 17-bit signed offset |
and shift left by 2 for use in lwi.gp, swi.gp... */ |
BFD_RELOC_NDS32_SDA17S2, |
/* This is a 18-bit reloc containing the small data area 18-bit signed offset |
and shift left by 1 for use in lhi.gp, shi.gp... */ |
BFD_RELOC_NDS32_SDA18S1, |
/* This is a 19-bit reloc containing the small data area 19-bit signed offset |
and shift left by 0 for use in lbi.gp, sbi.gp... */ |
BFD_RELOC_NDS32_SDA19S0, |
/* for PIC */ |
BFD_RELOC_NDS32_GOT20, |
BFD_RELOC_NDS32_9_PLTREL, |
BFD_RELOC_NDS32_25_PLTREL, |
BFD_RELOC_NDS32_COPY, |
BFD_RELOC_NDS32_GLOB_DAT, |
BFD_RELOC_NDS32_JMP_SLOT, |
BFD_RELOC_NDS32_RELATIVE, |
BFD_RELOC_NDS32_GOTOFF, |
BFD_RELOC_NDS32_GOTOFF_HI20, |
BFD_RELOC_NDS32_GOTOFF_LO12, |
BFD_RELOC_NDS32_GOTPC20, |
BFD_RELOC_NDS32_GOT_HI20, |
BFD_RELOC_NDS32_GOT_LO12, |
BFD_RELOC_NDS32_GOTPC_HI20, |
BFD_RELOC_NDS32_GOTPC_LO12, |
/* for relax */ |
BFD_RELOC_NDS32_INSN16, |
BFD_RELOC_NDS32_LABEL, |
BFD_RELOC_NDS32_LONGCALL1, |
BFD_RELOC_NDS32_LONGCALL2, |
BFD_RELOC_NDS32_LONGCALL3, |
BFD_RELOC_NDS32_LONGJUMP1, |
BFD_RELOC_NDS32_LONGJUMP2, |
BFD_RELOC_NDS32_LONGJUMP3, |
BFD_RELOC_NDS32_LOADSTORE, |
BFD_RELOC_NDS32_9_FIXED, |
BFD_RELOC_NDS32_15_FIXED, |
BFD_RELOC_NDS32_17_FIXED, |
BFD_RELOC_NDS32_25_FIXED, |
BFD_RELOC_NDS32_LONGCALL4, |
BFD_RELOC_NDS32_LONGCALL5, |
BFD_RELOC_NDS32_LONGCALL6, |
BFD_RELOC_NDS32_LONGJUMP4, |
BFD_RELOC_NDS32_LONGJUMP5, |
BFD_RELOC_NDS32_LONGJUMP6, |
BFD_RELOC_NDS32_LONGJUMP7, |
/* for PIC */ |
BFD_RELOC_NDS32_PLTREL_HI20, |
BFD_RELOC_NDS32_PLTREL_LO12, |
BFD_RELOC_NDS32_PLT_GOTREL_HI20, |
BFD_RELOC_NDS32_PLT_GOTREL_LO12, |
/* for floating point */ |
BFD_RELOC_NDS32_SDA12S2_DP, |
BFD_RELOC_NDS32_SDA12S2_SP, |
BFD_RELOC_NDS32_LO12S2_DP, |
BFD_RELOC_NDS32_LO12S2_SP, |
/* for dwarf2 debug_line. */ |
BFD_RELOC_NDS32_DWARF2_OP1, |
BFD_RELOC_NDS32_DWARF2_OP2, |
BFD_RELOC_NDS32_DWARF2_LEB, |
/* for eliminate 16-bit instructions */ |
BFD_RELOC_NDS32_UPDATE_TA, |
/* for PIC object relaxation */ |
BFD_RELOC_NDS32_PLT_GOTREL_LO20, |
BFD_RELOC_NDS32_PLT_GOTREL_LO15, |
BFD_RELOC_NDS32_PLT_GOTREL_LO19, |
BFD_RELOC_NDS32_GOT_LO15, |
BFD_RELOC_NDS32_GOT_LO19, |
BFD_RELOC_NDS32_GOTOFF_LO15, |
BFD_RELOC_NDS32_GOTOFF_LO19, |
BFD_RELOC_NDS32_GOT15S2, |
BFD_RELOC_NDS32_GOT17S2, |
/* NDS32 relocs. |
This is a 5 bit absolute address. */ |
BFD_RELOC_NDS32_5, |
/* This is a 10-bit unsigned pc-relative reloc with the right 1 bit assumed to be 0. */ |
BFD_RELOC_NDS32_10_UPCREL, |
/* If fp were omitted, fp can used as another gp. */ |
BFD_RELOC_NDS32_SDA_FP7U2_RELA, |
/* relaxation relative relocation types */ |
BFD_RELOC_NDS32_RELAX_ENTRY, |
BFD_RELOC_NDS32_GOT_SUFF, |
BFD_RELOC_NDS32_GOTOFF_SUFF, |
BFD_RELOC_NDS32_PLT_GOT_SUFF, |
BFD_RELOC_NDS32_MULCALL_SUFF, |
BFD_RELOC_NDS32_PTR, |
BFD_RELOC_NDS32_PTR_COUNT, |
BFD_RELOC_NDS32_PTR_RESOLVED, |
BFD_RELOC_NDS32_PLTBLOCK, |
BFD_RELOC_NDS32_RELAX_REGION_BEGIN, |
BFD_RELOC_NDS32_RELAX_REGION_END, |
BFD_RELOC_NDS32_MINUEND, |
BFD_RELOC_NDS32_SUBTRAHEND, |
BFD_RELOC_NDS32_DIFF8, |
BFD_RELOC_NDS32_DIFF16, |
BFD_RELOC_NDS32_DIFF32, |
BFD_RELOC_NDS32_DIFF_ULEB128, |
BFD_RELOC_NDS32_EMPTY, |
/* This is a 25 bit absolute address. */ |
BFD_RELOC_NDS32_25_ABS, |
/* For ex9 and ifc using. */ |
BFD_RELOC_NDS32_DATA, |
BFD_RELOC_NDS32_TRAN, |
BFD_RELOC_NDS32_17IFC_PCREL, |
BFD_RELOC_NDS32_10IFCU_PCREL, |
/* For TLS. */ |
BFD_RELOC_NDS32_TPOFF, |
BFD_RELOC_NDS32_TLS_LE_HI20, |
BFD_RELOC_NDS32_TLS_LE_LO12, |
BFD_RELOC_NDS32_TLS_LE_ADD, |
BFD_RELOC_NDS32_TLS_LE_LS, |
BFD_RELOC_NDS32_GOTTPOFF, |
BFD_RELOC_NDS32_TLS_IE_HI20, |
BFD_RELOC_NDS32_TLS_IE_LO12S2, |
BFD_RELOC_NDS32_TLS_TPOFF, |
BFD_RELOC_NDS32_TLS_LE_20, |
BFD_RELOC_NDS32_TLS_LE_15S0, |
BFD_RELOC_NDS32_TLS_LE_15S1, |
BFD_RELOC_NDS32_TLS_LE_15S2, |
/* This is a 9-bit reloc */ |
BFD_RELOC_V850_9_PCREL, |
4251,6 → 4613,28 |
in .byte hlo8(symbol) */ |
BFD_RELOC_AVR_8_HLO, |
/* AVR relocations to mark the difference of two local symbols. |
These are only needed to support linker relaxation and can be ignored |
when not relaxing. The field is set to the value of the difference |
assuming no relaxation. The relocation encodes the position of the |
second symbol so the linker can determine whether to adjust the field |
value. */ |
BFD_RELOC_AVR_DIFF8, |
BFD_RELOC_AVR_DIFF16, |
BFD_RELOC_AVR_DIFF32, |
/* This is a 7 bit reloc for the AVR that stores SRAM address for 16bit |
lds and sts instructions supported only tiny core. */ |
BFD_RELOC_AVR_LDS_STS_16, |
/* This is a 6 bit reloc for the AVR that stores an I/O register |
number for the IN and OUT instructions */ |
BFD_RELOC_AVR_PORT6, |
/* This is a 5 bit reloc for the AVR that stores an I/O register |
number for the SBIC, SBIS, SBI and CBI instructions */ |
BFD_RELOC_AVR_PORT5, |
/* Renesas RL78 Relocations. */ |
BFD_RELOC_RL78_NEG8, |
BFD_RELOC_RL78_NEG16, |
4285,6 → 4669,7 |
BFD_RELOC_RL78_HI8, |
BFD_RELOC_RL78_LO16, |
BFD_RELOC_RL78_CODE, |
BFD_RELOC_RL78_SADDR, |
/* Renesas RX Relocations. */ |
BFD_RELOC_RX_NEG8, |
4914,9 → 5299,31 |
BFD_RELOC_860_HIGOT, |
BFD_RELOC_860_HIGOTOFF, |
/* OpenRISC Relocations. */ |
BFD_RELOC_OPENRISC_ABS_26, |
BFD_RELOC_OPENRISC_REL_26, |
/* OpenRISC 1000 Relocations. */ |
BFD_RELOC_OR1K_REL_26, |
BFD_RELOC_OR1K_GOTPC_HI16, |
BFD_RELOC_OR1K_GOTPC_LO16, |
BFD_RELOC_OR1K_GOT16, |
BFD_RELOC_OR1K_PLT26, |
BFD_RELOC_OR1K_GOTOFF_HI16, |
BFD_RELOC_OR1K_GOTOFF_LO16, |
BFD_RELOC_OR1K_COPY, |
BFD_RELOC_OR1K_GLOB_DAT, |
BFD_RELOC_OR1K_JMP_SLOT, |
BFD_RELOC_OR1K_RELATIVE, |
BFD_RELOC_OR1K_TLS_GD_HI16, |
BFD_RELOC_OR1K_TLS_GD_LO16, |
BFD_RELOC_OR1K_TLS_LDM_HI16, |
BFD_RELOC_OR1K_TLS_LDM_LO16, |
BFD_RELOC_OR1K_TLS_LDO_HI16, |
BFD_RELOC_OR1K_TLS_LDO_LO16, |
BFD_RELOC_OR1K_TLS_IE_HI16, |
BFD_RELOC_OR1K_TLS_IE_LO16, |
BFD_RELOC_OR1K_TLS_LE_HI16, |
BFD_RELOC_OR1K_TLS_LE_LO16, |
BFD_RELOC_OR1K_TLS_TPOFF, |
BFD_RELOC_OR1K_TLS_DTPOFF, |
BFD_RELOC_OR1K_TLS_DTPMOD, |
/* H8 elf Relocations. */ |
BFD_RELOC_H8_DIR16A8, |
5024,6 → 5431,24 |
BFD_RELOC_NIOS2_JUMP_SLOT, |
BFD_RELOC_NIOS2_RELATIVE, |
BFD_RELOC_NIOS2_GOTOFF, |
BFD_RELOC_NIOS2_CALL26_NOAT, |
BFD_RELOC_NIOS2_GOT_LO, |
BFD_RELOC_NIOS2_GOT_HA, |
BFD_RELOC_NIOS2_CALL_LO, |
BFD_RELOC_NIOS2_CALL_HA, |
BFD_RELOC_NIOS2_R2_S12, |
BFD_RELOC_NIOS2_R2_I10_1_PCREL, |
BFD_RELOC_NIOS2_R2_T1I7_1_PCREL, |
BFD_RELOC_NIOS2_R2_T1I7_2, |
BFD_RELOC_NIOS2_R2_T2I4, |
BFD_RELOC_NIOS2_R2_T2I4_1, |
BFD_RELOC_NIOS2_R2_T2I4_2, |
BFD_RELOC_NIOS2_R2_X1I7_2, |
BFD_RELOC_NIOS2_R2_X2L5, |
BFD_RELOC_NIOS2_R2_F1I5_2, |
BFD_RELOC_NIOS2_R2_L5I4X1, |
BFD_RELOC_NIOS2_R2_T1X1I6, |
BFD_RELOC_NIOS2_R2_T1X1I6_2, |
/* IQ2000 Relocations. */ |
BFD_RELOC_IQ2000_OFFSET_16, |
5410,6 → 5835,24 |
BFD_RELOC_AARCH64_ADR_GOTPAGE. Valid in ILP32 ABI only. */ |
BFD_RELOC_AARCH64_LD32_GOT_LO12_NC, |
/* Unsigned 16 bit byte offset for 64 bit load/store from the GOT entry |
for this symbol. Valid in LP64 ABI only. */ |
BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC, |
/* Unsigned 16 bit byte higher offset for 64 bit load/store from the GOT entry |
for this symbol. Valid in LP64 ABI only. */ |
BFD_RELOC_AARCH64_MOVW_GOTOFF_G1, |
/* Unsigned 15 bit byte offset for 64 bit load/store from the page of |
the GOT entry for this symbol. Valid in LP64 ABI only. */ |
BFD_RELOC_AARCH64_LD64_GOTOFF_LO15, |
/* Scaled 14 bit byte offset to the page base of the global offset table. */ |
BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14, |
/* Scaled 15 bit byte offset to the page base of the global offset table. */ |
BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15, |
/* Get to the page base of the global offset table entry for a symbols |
tls_index structure as part of an adrp instruction using a 21 bit PC |
relative value. Used in conjunction with |
5416,16 → 5859,19 |
BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC. */ |
BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21, |
/* AArch64 TLS General Dynamic */ |
BFD_RELOC_AARCH64_TLSGD_ADR_PREL21, |
/* Unsigned 12 bit byte offset to global offset table entry for a symbols |
tls_index structure. Used in conjunction with |
BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21. */ |
BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1, |
/* AArch64 TLS General Dynamic relocation. */ |
BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC, |
/* AArch64 TLS General Dynamic relocation. */ |
BFD_RELOC_AARCH64_TLSGD_MOVW_G1, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21, |
5439,6 → 5885,76 |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC, |
/* AArch64 TLS INITIAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1, |
/* bit[23:12] of byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12, |
/* Unsigned 12 bit byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12, |
/* No overflow check version of BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12. */ |
BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC, |
/* Unsigned 12 bit byte offset to global offset table entry for a symbols |
tls_index structure. Used in conjunction with |
BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21. */ |
BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC, |
/* GOT entry page address for AArch64 TLS Local Dynamic, used with ADRP |
instruction. */ |
BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21, |
/* GOT entry address for AArch64 TLS Local Dynamic, used with ADR instruction. */ |
BFD_RELOC_AARCH64_TLSLD_ADR_PREL21, |
/* bit[11:1] of byte offset to module TLS base address, encoded in ldst |
instructions. */ |
BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, |
/* bit[11:2] of byte offset to module TLS base address, encoded in ldst |
instructions. */ |
BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, |
/* bit[11:3] of byte offset to module TLS base address, encoded in ldst |
instructions. */ |
BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, |
/* bit[11:0] of byte offset to module TLS base address, encoded in ldst |
instructions. */ |
BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC, |
/* bit[15:0] of byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0, |
/* No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0 */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, |
/* bit[31:16] of byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1, |
/* No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1 */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, |
/* bit[47:32] of byte offset to module TLS base address. */ |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2, |
/* AArch64 TLS LOCAL EXEC relocation. */ |
BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2, |
5538,6 → 6054,14 |
address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. */ |
BFD_RELOC_AARCH64_LDST_LO12, |
/* AArch64 pseudo relocation code for TLS local dynamic mode. It's to be |
used internally by the AArch64 assembler and not (currently) written to |
any object files. */ |
BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12, |
/* Similar as BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12, but no overflow check. */ |
BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12_NC, |
/* AArch64 pseudo relocation code to be used internally by the AArch64 |
assembler and not (currently) written to any object files. */ |
BFD_RELOC_AARCH64_LD_GOT_LO12_NC, |
5762,7 → 6286,17 |
/* Adapteva EPIPHANY - 8 bit immediate for 16 bit mov instruction. */ |
BFD_RELOC_EPIPHANY_IMM8, |
/* Visium Relocations. */ |
BFD_RELOC_VISIUM_HI16, |
BFD_RELOC_VISIUM_LO16, |
BFD_RELOC_VISIUM_IM16, |
BFD_RELOC_VISIUM_REL16, |
BFD_RELOC_VISIUM_HI16_PCREL, |
BFD_RELOC_VISIUM_LO16_PCREL, |
BFD_RELOC_VISIUM_IM16_PCREL, |
BFD_RELOC_UNUSED }; |
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; |
reloc_howto_type *bfd_reloc_type_lookup |
(bfd *abfd, bfd_reloc_code_real_type code); |
5960,6 → 6494,7 |
(ibfd, isymbol, obfd, osymbol)) |
/* Extracted from bfd.c. */ |
enum bfd_direction |
{ |
no_direction = 0, |
5968,11 → 6503,21 |
both_direction = 3 |
}; |
enum bfd_plugin_format |
{ |
bfd_plugin_uknown = 0, |
bfd_plugin_yes = 1, |
bfd_plugin_no = 2 |
}; |
struct bfd_build_id |
{ |
bfd_size_type size; |
bfd_byte data[1]; |
}; |
struct bfd |
{ |
/* A unique identifier of the BFD */ |
unsigned int id; |
/* The filename the application opened the BFD with. */ |
const char *filename; |
5995,17 → 6540,17 |
/* File modified time, if mtime_set is TRUE. */ |
long mtime; |
/* Reserved for an unimplemented file locking extension. */ |
int ifd; |
/* A unique identifier of the BFD */ |
unsigned int id; |
/* The format which belongs to the BFD. (object, core, etc.) */ |
bfd_format format; |
ENUM_BITFIELD (bfd_format) format : 3; |
/* The direction with which the BFD was opened. */ |
enum bfd_direction direction; |
ENUM_BITFIELD (bfd_direction) direction : 2; |
/* Format_specific flags. */ |
flagword flags; |
flagword flags : 18; |
/* Values that may appear in the flags field of a BFD. These also |
appear in the object_flags field of the bfd_target structure, where |
6064,36 → 6609,87 |
struct. */ |
#define BFD_IN_MEMORY 0x800 |
/* The sections in this BFD specify a memory page. */ |
#define HAS_LOAD_PAGE 0x1000 |
/* This BFD has been created by the linker and doesn't correspond |
to any input file. */ |
#define BFD_LINKER_CREATED 0x2000 |
#define BFD_LINKER_CREATED 0x1000 |
/* This may be set before writing out a BFD to request that it |
be written using values for UIDs, GIDs, timestamps, etc. that |
will be consistent from run to run. */ |
#define BFD_DETERMINISTIC_OUTPUT 0x4000 |
#define BFD_DETERMINISTIC_OUTPUT 0x2000 |
/* Compress sections in this BFD. */ |
#define BFD_COMPRESS 0x8000 |
#define BFD_COMPRESS 0x4000 |
/* Decompress sections in this BFD. */ |
#define BFD_DECOMPRESS 0x10000 |
#define BFD_DECOMPRESS 0x8000 |
/* BFD is a dummy, for plugins. */ |
#define BFD_PLUGIN 0x20000 |
#define BFD_PLUGIN 0x10000 |
/* Compress sections in this BFD with SHF_COMPRESSED from gABI. */ |
#define BFD_COMPRESS_GABI 0x20000 |
/* Flags bits to be saved in bfd_preserve_save. */ |
#define BFD_FLAGS_SAVED \ |
(BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_PLUGIN) |
(BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_PLUGIN \ |
| BFD_COMPRESS_GABI) |
/* Flags bits which are for BFD use only. */ |
#define BFD_FLAGS_FOR_BFD_USE_MASK \ |
(BFD_IN_MEMORY | BFD_COMPRESS | BFD_DECOMPRESS | BFD_LINKER_CREATED \ |
| BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT) |
| BFD_PLUGIN | BFD_TRADITIONAL_FORMAT | BFD_DETERMINISTIC_OUTPUT \ |
| BFD_COMPRESS_GABI) |
/* Is the file descriptor being cached? That is, can it be closed as |
needed, and re-opened when accessed later? */ |
unsigned int cacheable : 1; |
/* Marks whether there was a default target specified when the |
BFD was opened. This is used to select which matching algorithm |
to use to choose the back end. */ |
unsigned int target_defaulted : 1; |
/* ... and here: (``once'' means at least once). */ |
unsigned int opened_once : 1; |
/* Set if we have a locally maintained mtime value, rather than |
getting it from the file each time. */ |
unsigned int mtime_set : 1; |
/* Flag set if symbols from this BFD should not be exported. */ |
unsigned int no_export : 1; |
/* Remember when output has begun, to stop strange things |
from happening. */ |
unsigned int output_has_begun : 1; |
/* Have archive map. */ |
unsigned int has_armap : 1; |
/* Set if this is a thin archive. */ |
unsigned int is_thin_archive : 1; |
/* Set if only required symbols should be added in the link hash table for |
this object. Used by VMS linkers. */ |
unsigned int selective_search : 1; |
/* Set if this is the linker output BFD. */ |
unsigned int is_linker_output : 1; |
/* Set if this is the linker input BFD. */ |
unsigned int is_linker_input : 1; |
/* If this is an input for a compiler plug-in library. */ |
ENUM_BITFIELD (bfd_plugin_format) plugin_format : 2; |
/* Set if this is a plugin output file. */ |
unsigned int lto_output : 1; |
/* Set to dummy BFD created when claimed by a compiler plug-in |
library. */ |
bfd *plugin_dummy_bfd; |
/* Currently my_archive is tested before adding origin to |
anything. I believe that this can become always an add of |
origin, with origin set to 0 for non archive files. */ |
6118,17 → 6714,21 |
/* The number of sections. */ |
unsigned int section_count; |
/* A field used by _bfd_generic_link_add_archive_symbols. This will |
be used only for archive elements. */ |
int archive_pass; |
/* Stuff only useful for object files: |
The start address. */ |
bfd_vma start_address; |
/* Used for input and output. */ |
unsigned int symcount; |
/* Symbol table for output BFD (with symcount entries). |
Also used by the linker to cache input BFD symbols. */ |
struct bfd_symbol **outsymbols; |
/* Used for input and output. */ |
unsigned int symcount; |
/* Used for slurped dynamic symbol tables. */ |
unsigned int dynsymcount; |
6143,13 → 6743,13 |
struct bfd *nested_archives; /* List of nested archive in a flattened |
thin archive. */ |
/* A chain of BFD structures involved in a link. */ |
struct bfd *link_next; |
union { |
/* For input BFDs, a chain of BFDs involved in a link. */ |
struct bfd *next; |
/* For output BFD, the linker hash table. */ |
struct bfd_link_hash_table *hash; |
} link; |
/* A field used by _bfd_generic_link_add_archive_symbols. This will |
be used only for archive elements. */ |
int archive_pass; |
/* Used by the back end to hold private data. */ |
union |
{ |
6201,40 → 6801,19 |
of objalloc.h. */ |
void *memory; |
/* Is the file descriptor being cached? That is, can it be closed as |
needed, and re-opened when accessed later? */ |
unsigned int cacheable : 1; |
/* For input BFDs, the build ID, if the object has one. */ |
const struct bfd_build_id *build_id; |
}; |
/* Marks whether there was a default target specified when the |
BFD was opened. This is used to select which matching algorithm |
to use to choose the back end. */ |
unsigned int target_defaulted : 1; |
/* See note beside bfd_set_section_userdata. */ |
static inline bfd_boolean |
bfd_set_cacheable (bfd * abfd, bfd_boolean val) |
{ |
abfd->cacheable = val; |
return TRUE; |
} |
/* ... and here: (``once'' means at least once). */ |
unsigned int opened_once : 1; |
/* Set if we have a locally maintained mtime value, rather than |
getting it from the file each time. */ |
unsigned int mtime_set : 1; |
/* Flag set if symbols from this BFD should not be exported. */ |
unsigned int no_export : 1; |
/* Remember when output has begun, to stop strange things |
from happening. */ |
unsigned int output_has_begun : 1; |
/* Have archive map. */ |
unsigned int has_armap : 1; |
/* Set if this is a thin archive. */ |
unsigned int is_thin_archive : 1; |
/* Set if only required symbols should be added in the link hash table for |
this object. Used by VMS linkers. */ |
unsigned int selective_search : 1; |
}; |
typedef enum bfd_error |
{ |
bfd_error_no_error = 0, |
6270,6 → 6849,7 |
void bfd_perror (const char *message); |
typedef void (*bfd_error_handler_type) (const char *, ...); |
bfd_error_handler_type bfd_set_error_handler (bfd_error_handler_type); |
6278,6 → 6858,7 |
bfd_error_handler_type bfd_get_error_handler (void); |
typedef void (*bfd_assert_handler_type) (const char *bfd_formatmsg, |
const char *bfd_version, |
const char *bfd_file, |
6333,12 → 6914,12 |
#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ |
BFD_SEND (abfd, _bfd_find_nearest_line, \ |
(abfd, sec, syms, off, file, func, line)) |
(abfd, syms, sec, off, file, func, line, NULL)) |
#define bfd_find_nearest_line_discriminator(abfd, sec, syms, off, file, func, \ |
line, disc) \ |
BFD_SEND (abfd, _bfd_find_nearest_line_discriminator, \ |
(abfd, sec, syms, off, file, func, line, disc)) |
BFD_SEND (abfd, _bfd_find_nearest_line, \ |
(abfd, syms, sec, off, file, func, line, disc)) |
#define bfd_find_line(abfd, syms, sym, file, line) \ |
BFD_SEND (abfd, _bfd_find_line, \ |
6387,9 → 6968,6 |
#define bfd_link_hash_table_create(abfd) \ |
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd)) |
#define bfd_link_hash_table_free(abfd, hash) \ |
BFD_SEND (abfd, _bfd_link_hash_table_free, (hash)) |
#define bfd_link_add_symbols(abfd, info) \ |
BFD_SEND (abfd, _bfd_link_add_symbols, (abfd, info)) |
6437,6 → 7015,22 |
char *bfd_demangle (bfd *, const char *, int); |
void bfd_update_compression_header |
(bfd *abfd, bfd_byte *contents, asection *sec); |
bfd_boolean bfd_check_compression_header |
(bfd *abfd, bfd_byte *contents, asection *sec, |
bfd_size_type *uncompressed_size); |
int bfd_get_compression_header_size (bfd *abfd, asection *sec); |
bfd_size_type bfd_convert_section_size |
(bfd *ibfd, asection *isec, bfd *obfd, bfd_size_type size); |
bfd_boolean bfd_convert_section_contents |
(bfd *ibfd, asection *isec, bfd *obfd, |
bfd_byte **ptr, bfd_size_type *ptr_size); |
/* Extracted from archive.c. */ |
symindex bfd_get_next_mapent |
(bfd *abfd, symindex previous, carsym **sym); |
6482,6 → 7076,7 |
enum bfd_flavour |
{ |
/* N.B. Update bfd_flavour_name if you change this. */ |
bfd_target_unknown_flavour, |
bfd_target_aout_flavour, |
bfd_target_coff_flavour, |
6699,12 → 7294,12 |
NAME##_make_empty_symbol, \ |
NAME##_print_symbol, \ |
NAME##_get_symbol_info, \ |
NAME##_get_symbol_version_string, \ |
NAME##_bfd_is_local_label_name, \ |
NAME##_bfd_is_target_special_symbol, \ |
NAME##_get_lineno, \ |
NAME##_find_nearest_line, \ |
_bfd_generic_find_nearest_line_discriminator, \ |
_bfd_generic_find_line, \ |
NAME##_find_line, \ |
NAME##_find_inliner_info, \ |
NAME##_bfd_make_debug_symbol, \ |
NAME##_read_minisymbols, \ |
6721,14 → 7316,14 |
void (*_bfd_get_symbol_info) |
(bfd *, struct bfd_symbol *, symbol_info *); |
#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) |
const char *(*_bfd_get_symbol_version_string) |
(bfd *, struct bfd_symbol *, bfd_boolean *); |
#define bfd_get_symbol_version_string(b,s,h) BFD_SEND (b, _bfd_get_symbol_version_string, (b,s,h)) |
bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); |
bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); |
alent * (*_get_lineno) (bfd *, struct bfd_symbol *); |
bfd_boolean (*_bfd_find_nearest_line) |
(bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, |
const char **, const char **, unsigned int *); |
bfd_boolean (*_bfd_find_nearest_line_discriminator) |
(bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, |
(bfd *, struct bfd_symbol **, struct bfd_section *, bfd_vma, |
const char **, const char **, unsigned int *, unsigned int *); |
bfd_boolean (*_bfd_find_line) |
(bfd *, struct bfd_symbol **, struct bfd_symbol *, |
6782,7 → 7377,6 |
NAME##_bfd_get_relocated_section_contents, \ |
NAME##_bfd_relax_section, \ |
NAME##_bfd_link_hash_table_create, \ |
NAME##_bfd_link_hash_table_free, \ |
NAME##_bfd_link_add_symbols, \ |
NAME##_bfd_link_just_syms, \ |
NAME##_bfd_copy_link_hash_symbol_type, \ |
6809,9 → 7403,6 |
struct bfd_link_hash_table * |
(*_bfd_link_hash_table_create) (bfd *); |
/* Release the memory associated with the linker hash table. */ |
void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *); |
/* Add symbols from this object file into the hash table. */ |
bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); |
6818,7 → 7409,8 |
/* Indicate that we are only retrieving symbol values from this section. */ |
void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *); |
/* Copy the symbol type of a linker hash table entry. */ |
/* Copy the symbol type and other attributes for a linker script |
assignment of one symbol to another. */ |
#define bfd_copy_link_hash_symbol_type(b, t, f) \ |
BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f)) |
void (*_bfd_copy_link_hash_symbol_type) |
6904,6 → 7496,8 |
(int (*search_func) (const bfd_target *, void *), |
void *); |
const char *bfd_flavour_name (enum bfd_flavour flavour); |
/* Extracted from format.c. */ |
bfd_boolean bfd_check_format (bfd *abfd, bfd_format format); |
6946,10 → 7540,6 |
(bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table); |
/* Extracted from compress.c. */ |
bfd_boolean bfd_compress_section_contents |
(bfd *abfd, asection *section, bfd_byte *uncompressed_buffer, |
bfd_size_type uncompressed_size); |
bfd_boolean bfd_get_full_section_contents |
(bfd *abfd, asection *section, bfd_byte **ptr); |
6956,6 → 7546,11 |
void bfd_cache_section_contents |
(asection *sec, void *contents); |
bfd_boolean bfd_is_section_compressed_with_header |
(bfd *abfd, asection *section, |
int *compression_header_size_p, |
bfd_size_type *uncompressed_size_p); |
bfd_boolean bfd_is_section_compressed |
(bfd *abfd, asection *section); |
6965,6 → 7560,9 |
bfd_boolean bfd_init_section_compress_status |
(bfd *abfd, asection *section); |
bfd_boolean bfd_compress_section |
(bfd *abfd, asection *section, bfd_byte *uncompressed_buffer); |
#ifdef __cplusplus |
} |
#endif |
/contrib/toolchain/binutils/bfd/bfd_stdint.h |
---|
1,4 → 1,4 |
/* generated for gcc.exe (GCC) 4.8.1 */ |
/* generated for gcc.exe (GCC) 4.9.3 */ |
#ifndef GCC_GENERATED_STDINT_H |
#define GCC_GENERATED_STDINT_H 1 |
/contrib/toolchain/binutils/bfd/bfdio.c |
---|
1,6 → 1,6 |
/* Low-level I/O routines for BFDs. |
Copyright 1990-2013 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
/contrib/toolchain/binutils/bfd/bfdver.h |
---|
1,4 → 1,4 |
#define BFD_VERSION_DATE 20131202 |
#define BFD_VERSION 224000000 |
#define BFD_VERSION_STRING "(GNU Binutils) " "2.24" |
#define BFD_VERSION_DATE 20160125 |
#define BFD_VERSION 226000000 |
#define BFD_VERSION_STRING "(GNU Binutils) " "2.26.20160125" |
#define REPORT_BUGS_TO "<http://www.sourceware.org/bugzilla/>" |
/contrib/toolchain/binutils/bfd/binary.c |
---|
1,6 → 1,5 |
/* BFD back-end for binary objects. |
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, |
2004, 2005, 2006, 2007, 2009, 2011 Free Software Foundation, Inc. |
Copyright (C) 1994-2015 Free Software Foundation, Inc. |
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com> |
This file is part of BFD, the Binary File Descriptor library. |
191,6 → 190,8 |
#define binary_make_empty_symbol _bfd_generic_make_empty_symbol |
#define binary_print_symbol _bfd_nosymbols_print_symbol |
#define binary_get_symbol_version_string \ |
_bfd_nosymbols_get_symbol_version_string |
/* Get information about a symbol. */ |
205,6 → 206,7 |
#define binary_bfd_is_local_label_name bfd_generic_is_local_label_name |
#define binary_get_lineno _bfd_nosymbols_get_lineno |
#define binary_find_nearest_line _bfd_nosymbols_find_nearest_line |
#define binary_find_line _bfd_nosymbols_find_line |
#define binary_find_inliner_info _bfd_nosymbols_find_inliner_info |
#define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol |
#define binary_read_minisymbols _bfd_generic_read_minisymbols |
306,7 → 308,6 |
#define binary_section_already_linked _bfd_generic_section_already_linked |
#define binary_bfd_define_common_symbol bfd_generic_define_common_symbol |
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create |
#define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
#define binary_bfd_link_just_syms _bfd_generic_link_just_syms |
#define binary_bfd_copy_link_hash_symbol_type \ |
_bfd_generic_copy_link_hash_symbol_type |
/contrib/toolchain/binutils/bfd/cache.c |
---|
1,7 → 1,6 |
/* BFD library -- caching of file descriptors. |
Copyright 1990, 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002, |
2003, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com). |
296,7 → 295,7 |
if (nread == (file_ptr)-1) |
{ |
bfd_set_error (bfd_error_system_call); |
return -1; |
return nread; |
} |
#else |
nread = fread (buf, 1, nbytes, f); |
306,7 → 305,7 |
if (nread < nbytes && ferror (f)) |
{ |
bfd_set_error (bfd_error_system_call); |
return -1; |
return nread; |
} |
#endif |
if (nread < nbytes) |
/contrib/toolchain/binutils/bfd/coff-bfd.c |
---|
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; |
} |
/contrib/toolchain/binutils/bfd/coff-bfd.h |
---|
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 *); |
/contrib/toolchain/binutils/bfd/coff-i386.c |
---|
1,7 → 1,5 |
/* BFD back-end for Intel 386 COFF files. |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012 |
Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
342,6 → 340,8 |
PCRELOFFSET) /* pcrel_offset */ |
}; |
#define NUM_HOWTOS (sizeof (howto_table) / sizeof (howto_table[0])) |
/* Turn a howto into a reloc nunmber */ |
#define SELECT_RELOC(x,howto) { x.r_type = howto->type; } |
350,7 → 350,7 |
#define RTYPE2HOWTO(cache_ptr, dst) \ |
((cache_ptr)->howto = \ |
((dst)->r_type < sizeof (howto_table) / sizeof (howto_table[0]) \ |
((dst)->r_type < NUM_HOWTOS \ |
? howto_table + (dst)->r_type \ |
: NULL)) |
379,7 → 379,7 |
coffsym = (obj_symbols (abfd) \ |
+ (cache_ptr->sym_ptr_ptr - symbols)); \ |
else if (ptr) \ |
coffsym = coff_symbol_from (abfd, ptr); \ |
coffsym = coff_symbol_from (ptr); \ |
if (coffsym != (coff_symbol_type *) NULL \ |
&& coffsym->native->u.syment.n_scnum == 0) \ |
cache_ptr->addend = - coffsym->native->u.syment.n_value; \ |
388,7 → 388,8 |
cache_ptr->addend = - (ptr->section->vma + ptr->value); \ |
else \ |
cache_ptr->addend = 0; \ |
if (ptr && howto_table[reloc.r_type].pc_relative) \ |
if (ptr && reloc.r_type < NUM_HOWTOS \ |
&& howto_table[reloc.r_type].pc_relative) \ |
cache_ptr->addend += asect->vma; \ |
} |
416,7 → 417,7 |
struct internal_syment *syms, |
asection **sections) |
{ |
if (info->relocatable) |
if (bfd_link_relocatable (info)) |
return TRUE; |
return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd, |
440,7 → 441,7 |
{ |
reloc_howto_type *howto; |
if (rel->r_type >= sizeof (howto_table) / sizeof (howto_table[0])) |
if (rel->r_type >= NUM_HOWTOS) |
{ |
bfd_set_error (bfd_error_bad_value); |
return NULL; |
508,7 → 509,12 |
*addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase; |
} |
/* PR 17099 - Absolute R_PCRLONG relocations do not need a symbol. */ |
if (rel->r_type == R_PCRLONG && sym == NULL) |
*addendp -= rel->r_vaddr; |
else |
BFD_ASSERT (sym != NULL); |
if (rel->r_type == R_SECREL32 && sym != NULL) |
{ |
bfd_vma osect_vma; |
576,7 → 582,7 |
{ |
unsigned int i; |
for (i = 0; i < sizeof (howto_table) / sizeof (howto_table[0]); i++) |
for (i = 0; i < NUM_HOWTOS; i++) |
if (howto_table[i].name != NULL |
&& strcasecmp (howto_table[i].name, r_name) == 0) |
return &howto_table[i]; |
607,14 → 613,11 |
#include "coffcode.h" |
#define _bfd_generic_find_nearest_line_discriminator \ |
coff_find_nearest_line_discriminator |
const bfd_target |
#ifdef TARGET_SYM |
TARGET_SYM = |
#else |
i386coff_vec = |
i386_coff_vec = |
#endif |
{ |
#ifdef TARGET_NAME |
/contrib/toolchain/binutils/bfd/coffcode.h |
---|
1,5 → 1,5 |
/* Support for the generic parts of most COFF variants, for BFD. |
Copyright 1990-2013 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
337,6 → 337,9 |
. union internal_auxent auxent; |
. struct internal_syment syment; |
. } u; |
. |
. {* Selector for the union above. *} |
. bfd_boolean is_sym; |
.} combined_entry_type; |
. |
. |
928,12 → 931,7 |
bfd_coff_swap_sym_in (abfd, esym, & isym); |
if (sizeof (internal_s->s_name) > SYMNMLEN) |
{ |
/* This case implies that the matching |
symbol name will be in the string table. */ |
abort (); |
} |
BFD_ASSERT (sizeof (internal_s->s_name) <= SYMNMLEN); |
if (isym.n_scnum == section->target_index) |
{ |
964,8 → 962,12 |
/* All 3 branches use this. */ |
symname = _bfd_coff_internal_syment_name (abfd, &isym, buf); |
/* PR 17512 file: 078-11867-0.004 */ |
if (symname == NULL) |
abort (); |
{ |
_bfd_error_handler (_("%B: unable to load COMDAT section name"), abfd); |
break; |
} |
switch (seen_state) |
{ |
1007,6 → 1009,13 |
seen_state = 1; |
/* PR 17512: file: e2cfe54f. */ |
if (esym + bfd_coff_symesz (abfd) >= esymend) |
{ |
_bfd_error_handler (_("%B: warning: No symbol for section '%s' found"), |
abfd, symname); |
break; |
} |
/* This is the section symbol. */ |
bfd_coff_swap_aux_in (abfd, (esym + bfd_coff_symesz (abfd)), |
isym.n_type, isym.n_sclass, |
1160,7 → 1169,7 |
flagword *flags_ptr) |
{ |
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr; |
long styp_flags = internal_s->s_flags; |
unsigned long styp_flags = internal_s->s_flags; |
flagword sec_flags; |
bfd_boolean result = TRUE; |
bfd_boolean is_dbg = FALSE; |
1183,7 → 1192,7 |
/* Process each flag bit in styp_flags in turn. */ |
while (styp_flags) |
{ |
long flag = styp_flags & - styp_flags; |
unsigned long flag = styp_flags & - styp_flags; |
char * unhandled = NULL; |
styp_flags &= ~ flag; |
1343,6 → 1352,10 |
. COFF_SYMBOL_PE_SECTION |
.}; |
. |
.typedef asection * (*coff_gc_mark_hook_fn) |
. (asection *, struct bfd_link_info *, struct internal_reloc *, |
. struct coff_link_hash_entry *, struct internal_syment *); |
. |
Special entry points for gdb to swap in coff symbol table parts: |
.typedef struct |
.{ |
1393,6 → 1406,7 |
. unsigned int _bfd_coff_default_section_alignment_power; |
. bfd_boolean _bfd_coff_force_symnames_in_strings; |
. unsigned int _bfd_coff_debug_string_prefix_length; |
. unsigned int _bfd_coff_max_nscns; |
. |
. void (*_bfd_coff_swap_filehdr_in) |
. (bfd *, void *, void *); |
1530,6 → 1544,9 |
. ((coff_backend_info (abfd)->_bfd_coff_set_long_section_names) (abfd, enable)) |
.#define bfd_coff_default_section_alignment_power(abfd) \ |
. (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) |
.#define bfd_coff_max_nscns(abfd) \ |
. (coff_backend_info (abfd)->_bfd_coff_max_nscns) |
. |
.#define bfd_coff_swap_filehdr_in(abfd, i,o) \ |
. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) |
. |
1793,6 → 1810,7 |
in case this symbol winds up getting written out. The value 0 |
for n_numaux is already correct. */ |
native->is_sym = TRUE; |
native->u.syment.n_type = T_NULL; |
native->u.syment.n_sclass = sclass; |
2066,7 → 2084,11 |
#endif |
if ((internal_f->f_flags & F_GO32STUB) != 0) |
{ |
coff->go32stub = (char *) bfd_alloc (abfd, (bfd_size_type) GO32_STUBSIZE); |
if (coff->go32stub == NULL) |
return NULL; |
} |
if (coff->go32stub != NULL) |
memcpy (coff->go32stub, internal_f->go32stub, GO32_STUBSIZE); |
2092,12 → 2114,6 |
machine = 0; |
switch (internal_f->f_magic) |
{ |
#ifdef OR32_MAGIC_BIG |
case OR32_MAGIC_BIG: |
case OR32_MAGIC_LITTLE: |
arch = bfd_arch_or32; |
break; |
#endif |
#ifdef PPCMAGIC |
case PPCMAGIC: |
arch = bfd_arch_powerpc; |
2277,6 → 2293,8 |
bfd_size_type amt = bfd_coff_symesz (abfd); |
buf = bfd_malloc (amt); |
if (buf == NULL) |
return FALSE; |
if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 |
|| bfd_bread (buf, amt, abfd) != amt) |
{ |
2500,11 → 2518,13 |
unsigned int indaux, |
combined_entry_type *aux) |
{ |
BFD_ASSERT (symbol->is_sym); |
int n_sclass = symbol->u.syment.n_sclass; |
if (CSECT_SYM_P (n_sclass) |
&& indaux + 1 == symbol->u.syment.n_numaux) |
{ |
BFD_ASSERT (! aux->is_sym); |
if (SMTYP_SMTYP (aux->u.auxent.x_csect.x_smtyp) == XTY_LD) |
{ |
aux->u.auxent.x_csect.x_scnlen.p = |
2537,6 → 2557,7 |
/* Return TRUE if we don't want to pointerize this aux entry, which |
is the case for the lastfirst aux entry for a C_LEAFPROC symbol. */ |
return (indaux == 1 |
&& symbol->is_sym |
&& (symbol->u.syment.n_sclass == C_LEAFPROC |
|| symbol->u.syment.n_sclass == C_LEAFSTAT |
|| symbol->u.syment.n_sclass == C_LEAFEXT)); |
2559,6 → 2580,8 |
combined_entry_type *aux ATTRIBUTE_UNUSED, |
unsigned int indaux ATTRIBUTE_UNUSED) |
{ |
BFD_ASSERT (symbol->is_sym); |
BFD_ASSERT (! aux->is_sym); |
#ifdef RS6000COFF_C |
if (CSECT_SYM_P (symbol->u.syment.n_sclass) |
&& indaux + 1 == symbol->u.syment.n_numaux) |
2660,11 → 2683,17 |
amt = s->reloc_count; |
amt *= sizeof (arelent *); |
p = bfd_malloc (amt); |
if (p == NULL && s->reloc_count > 0) |
if (p == NULL) |
{ |
if (s->reloc_count > 0) |
return FALSE; |
} |
else |
{ |
memcpy (p, s->orelocation, (size_t) amt); |
qsort (p, s->reloc_count, sizeof (arelent *), compare_arelent_ptr); |
} |
} |
#endif |
if (bfd_seek (abfd, s->rel_filepos, SEEK_SET) != 0) |
3064,15 → 3093,6 |
return TRUE; |
#endif |
#ifdef OR32_MAGIC_BIG |
case bfd_arch_or32: |
if (bfd_big_endian (abfd)) |
* magicp = OR32_MAGIC_BIG; |
else |
* magicp = OR32_MAGIC_LITTLE; |
return TRUE; |
#endif |
default: /* Unknown architecture. */ |
/* Fall through to "return FALSE" below, to avoid |
"statement never reached" errors on the one below. */ |
3136,7 → 3156,7 |
asection *current; |
file_ptr sofar = bfd_coff_filhsz (abfd); |
bfd_boolean align_adjust; |
int target_index; |
unsigned int target_index; |
#ifdef ALIGN_SECTIONS_IN_FILE |
asection *previous = NULL; |
file_ptr old_sofar; |
3145,7 → 3165,8 |
#ifdef COFF_IMAGE_WITH_PE |
int page_size; |
if (coff_data (abfd)->link_info) |
if (coff_data (abfd)->link_info |
|| (pe_data (abfd) && pe_data (abfd)->pe_opthdr.FileAlignment)) |
{ |
page_size = pe_data (abfd)->pe_opthdr.FileAlignment; |
3153,7 → 3174,16 |
This repairs 'ld -r' for arm-wince-pe target. */ |
if (page_size == 0) |
page_size = 1; |
/* PR 17512: file: 0ac816d3. */ |
if (page_size < 0) |
{ |
bfd_set_error (bfd_error_file_too_big); |
(*_bfd_error_handler) |
(_("%B: page size is too large (0x%x)"), abfd, page_size); |
return FALSE; |
} |
} |
else |
page_size = PE_DEF_FILE_ALIGNMENT; |
#else |
3176,9 → 3206,10 |
{ |
coff_symbol_type *cf; |
cf = coff_symbol_from (abfd, *symp); |
cf = coff_symbol_from (*symp); |
if (cf != NULL |
&& cf->native != NULL |
&& cf->native->is_sym |
&& SYMNAME_IN_DEBUG (&cf->native->u.syment)) |
{ |
size_t len; |
3304,7 → 3335,7 |
} |
#endif /* ! COFF_IMAGE_WITH_PE */ |
if (target_index >= 32768) |
if (target_index >= bfd_coff_max_nscns (abfd)) |
{ |
bfd_set_error (bfd_error_file_too_big); |
(*_bfd_error_handler) |
3873,9 → 3904,10 |
/* See if this is the section symbol. */ |
if (strcmp ((*psym)->name, current->name) == 0) |
{ |
csym = coff_symbol_from (abfd, *psym); |
csym = coff_symbol_from (*psym); |
if (csym == NULL |
|| csym->native == NULL |
|| ! csym->native->is_sym |
|| csym->native->u.syment.n_numaux < 1 |
|| csym->native->u.syment.n_sclass != C_STAT |
|| csym->native->u.syment.n_type != T_NULL) |
3898,6 → 3930,7 |
x_associated field is not currently supported. */ |
aux = csym->native + 1; |
BFD_ASSERT (! aux->is_sym); |
switch (current->flags & SEC_LINK_DUPLICATES) |
{ |
case SEC_LINK_DUPLICATES_DISCARD: |
4043,8 → 4076,6 |
internal_f.f_flags |= F_DYNLOAD; |
#endif |
memset (&internal_a, 0, sizeof internal_a); |
/* Set up architecture-dependent stuff. */ |
{ |
unsigned int magic = 0; |
4154,11 → 4185,6 |
internal_a.magic = MIPS_PE_MAGIC; |
#endif |
#ifdef OR32 |
#define __A_MAGIC_SET__ |
internal_a.magic = NMAGIC; /* Assume separate i/d. */ |
#endif |
#ifndef __A_MAGIC_SET__ |
#include "Your aouthdr magic number is not being set!" |
#else |
4325,7 → 4351,18 |
} |
#endif |
/* Now write them. */ |
#ifdef COFF_WITH_PE |
{ |
/* After object contents are finalized so we can compute a reasonable hash, |
but before header is written so we can update it to point to debug directory. */ |
struct pe_tdata *pe = pe_data (abfd); |
if (pe->build_id.after_write_object_contents != NULL) |
(*pe->build_id.after_write_object_contents) (abfd); |
} |
#endif |
/* Now write header. */ |
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) |
return FALSE; |
4460,11 → 4497,11 |
void * area = bfd_alloc (abfd, size); |
if (!area) |
return (NULL); |
return NULL; |
if (bfd_seek (abfd, where, SEEK_SET) != 0 |
|| bfd_bread (area, size, abfd) != size) |
return (NULL); |
return (area); |
return NULL; |
return area; |
} |
/* |
4498,6 → 4535,8 |
const coff_symbol_type *s1 = (const coff_symbol_type *) (al1->u.sym); |
const coff_symbol_type *s2 = (const coff_symbol_type *) (al2->u.sym); |
if (s1 == NULL || s2 == NULL) |
return 0; |
if (s1->symbol.value < s2->symbol.value) |
return -1; |
else if (s1->symbol.value > s2->symbol.value) |
4515,9 → 4554,11 |
unsigned int counter; |
alent *cache_ptr; |
bfd_vma prev_offset = 0; |
int ordered = 1; |
bfd_boolean ordered = TRUE; |
unsigned int nbr_func; |
LINENO *src; |
bfd_boolean have_func; |
bfd_boolean ret = TRUE; |
BFD_ASSERT (asect->lineno == NULL); |
4540,40 → 4581,67 |
asect->lineno = lineno_cache; |
src = native_lineno; |
nbr_func = 0; |
have_func = FALSE; |
for (counter = 0; counter < asect->lineno_count; counter++) |
for (counter = 0; counter < asect->lineno_count; counter++, src++) |
{ |
struct internal_lineno dst; |
bfd_coff_swap_lineno_in (abfd, src, &dst); |
cache_ptr->line_number = dst.l_lnno; |
/* Appease memory checkers that get all excited about |
uninitialised memory when copying alents if u.offset is |
larger than u.sym. (64-bit BFD on 32-bit host.) */ |
memset (&cache_ptr->u, 0, sizeof (cache_ptr->u)); |
if (cache_ptr->line_number == 0) |
{ |
bfd_boolean warned; |
bfd_signed_vma symndx; |
combined_entry_type * ent; |
bfd_vma symndx; |
coff_symbol_type *sym; |
nbr_func++; |
warned = FALSE; |
have_func = FALSE; |
symndx = dst.l_addr.l_symndx; |
if (symndx < 0 |
|| (bfd_vma) symndx >= obj_raw_syment_count (abfd)) |
if (symndx >= obj_raw_syment_count (abfd)) |
{ |
(*_bfd_error_handler) |
(_("%B: warning: illegal symbol index %ld in line numbers"), |
abfd, (long) symndx); |
symndx = 0; |
warned = TRUE; |
(_("%B: warning: illegal symbol index 0x%lx in line number entry %d"), |
abfd, (long) symndx, counter); |
cache_ptr->line_number = -1; |
ret = FALSE; |
continue; |
} |
ent = obj_raw_syments (abfd) + symndx; |
/* FIXME: We should not be casting between ints and |
pointers like this. */ |
sym = ((coff_symbol_type *) |
((symndx + obj_raw_syments (abfd)) |
->u.syment._n._n_n._n_zeroes)); |
if (! ent->is_sym) |
{ |
(*_bfd_error_handler) |
(_("%B: warning: illegal symbol index 0x%lx in line number entry %d"), |
abfd, (long) symndx, counter); |
cache_ptr->line_number = -1; |
ret = FALSE; |
continue; |
} |
sym = (coff_symbol_type *) (ent->u.syment._n._n_n._n_zeroes); |
/* PR 17512 file: 078-10659-0.004 */ |
if (sym < obj_symbols (abfd) |
|| sym >= obj_symbols (abfd) + bfd_get_symcount (abfd)) |
{ |
(*_bfd_error_handler) |
(_("%B: warning: illegal symbol in line number entry %d"), |
abfd, counter); |
cache_ptr->line_number = -1; |
ret = FALSE; |
continue; |
} |
have_func = TRUE; |
nbr_func++; |
cache_ptr->u.sym = (asymbol *) sym; |
if (sym->lineno != NULL && ! warned) |
if (sym->lineno != NULL) |
(*_bfd_error_handler) |
(_("%B: warning: duplicate line number information for `%s'"), |
abfd, bfd_asymbol_name (&sym->symbol)); |
4580,17 → 4648,21 |
sym->lineno = cache_ptr; |
if (sym->symbol.value < prev_offset) |
ordered = 0; |
ordered = FALSE; |
prev_offset = sym->symbol.value; |
} |
else if (!have_func) |
/* Drop line information that has no associated function. |
PR 17521: file: 078-10659-0.004. */ |
continue; |
else |
cache_ptr->u.offset = dst.l_addr.l_paddr |
- bfd_section_vma (abfd, asect); |
cache_ptr->u.offset = (dst.l_addr.l_paddr |
- bfd_section_vma (abfd, asect)); |
cache_ptr++; |
src++; |
} |
cache_ptr->line_number = 0; |
asect->lineno_count = cache_ptr - lineno_cache; |
memset (cache_ptr, 0, sizeof (*cache_ptr)); |
bfd_release (abfd, native_lineno); |
/* On some systems (eg AIX5.3) the lineno table may not be sorted. */ |
4607,15 → 4679,17 |
alent **p = func_table; |
unsigned int i; |
for (i = 0; i < counter; i++) |
for (i = 0; i < asect->lineno_count; i++) |
if (lineno_cache[i].line_number == 0) |
*p++ = &lineno_cache[i]; |
BFD_ASSERT ((unsigned int) (p - func_table) == nbr_func); |
/* Sort by functions. */ |
qsort (func_table, nbr_func, sizeof (alent *), coff_sort_func_alent); |
/* Create the new sorted table. */ |
amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent); |
amt = (bfd_size_type) asect->lineno_count * sizeof (alent); |
n_lineno_cache = (alent *) bfd_alloc (abfd, amt); |
if (n_lineno_cache != NULL) |
{ |
4626,25 → 4700,29 |
coff_symbol_type *sym; |
alent *old_ptr = func_table[i]; |
/* Copy the function entry and update it. */ |
*n_cache_ptr = *old_ptr; |
sym = (coff_symbol_type *)n_cache_ptr->u.sym; |
sym->lineno = n_cache_ptr; |
n_cache_ptr++; |
old_ptr++; |
/* Copy the line number entries. */ |
while (old_ptr->line_number != 0) |
/* Update the function entry. */ |
sym = (coff_symbol_type *) old_ptr->u.sym; |
/* PR binutils/17512: Point the lineno to where |
this entry will be after the memcpy below. */ |
sym->lineno = lineno_cache + (n_cache_ptr - n_lineno_cache); |
/* Copy the function and line number entries. */ |
do |
*n_cache_ptr++ = *old_ptr++; |
while (old_ptr->line_number != 0); |
} |
n_cache_ptr->line_number = 0; |
BFD_ASSERT ((bfd_size_type) (n_cache_ptr - n_lineno_cache) == (amt / sizeof (alent))); |
memcpy (lineno_cache, n_lineno_cache, amt); |
} |
else |
ret = FALSE; |
bfd_release (abfd, func_table); |
} |
else |
ret = FALSE; |
} |
return TRUE; |
return ret; |
} |
/* Slurp in the symbol table, converting it to generic form. Note |
4659,6 → 4737,7 |
unsigned int *table_ptr; |
bfd_size_type amt; |
unsigned int number_of_symbols = 0; |
bfd_boolean ret = TRUE; |
if (obj_symbols (abfd)) |
return TRUE; |
4676,7 → 4755,7 |
amt = obj_raw_syment_count (abfd); |
amt *= sizeof (unsigned int); |
table_ptr = (unsigned int *) bfd_alloc (abfd, amt); |
table_ptr = (unsigned int *) bfd_zalloc (abfd, amt); |
if (table_ptr == NULL) |
return FALSE; |
4690,8 → 4769,9 |
{ |
combined_entry_type *src = native_symbols + this_index; |
table_ptr[this_index] = number_of_symbols; |
dst->symbol.the_bfd = abfd; |
BFD_ASSERT (src->is_sym); |
dst->symbol.name = (char *) (src->u.syment._n._n_n._n_offset); |
/* We use the native name field to point to the cached field. */ |
src->u.syment._n._n_n._n_zeroes = (bfd_hostptr_t) dst; |
4698,6 → 4778,8 |
dst->symbol.section = coff_section_from_bfd_index (abfd, |
src->u.syment.n_scnum); |
dst->symbol.flags = 0; |
/* PR 17512: file: 079-7098-0.001:0.1. */ |
dst->symbol.value = 0; |
dst->done_lineno = FALSE; |
switch (src->u.syment.n_sclass) |
4971,13 → 5053,14 |
#if defined(TIC80COFF) || defined(TICOFF) |
case C_UEXT: /* Tentative external definition. */ |
#endif |
case C_EXTLAB: /* External load time label. */ |
case C_HIDDEN: /* Ext symbol in dmert public lib. */ |
default: |
(*_bfd_error_handler) |
(_("%B: Unrecognized storage class %d for %s symbol `%s'"), |
abfd, src->u.syment.n_sclass, |
dst->symbol.section->name, dst->symbol.name); |
ret = FALSE; |
case C_EXTLAB: /* External load time label. */ |
case C_HIDDEN: /* Ext symbol in dmert public lib. */ |
dst->symbol.flags = BSF_DEBUGGING; |
dst->symbol.value = (src->u.syment.n_value); |
break; |
4984,9 → 5067,9 |
} |
dst->native = src; |
dst->symbol.udata.i = 0; |
dst->lineno = NULL; |
this_index += (src->u.syment.n_numaux) + 1; |
dst++; |
number_of_symbols++; |
5005,12 → 5088,13 |
p = abfd->sections; |
while (p) |
{ |
coff_slurp_line_table (abfd, p); |
if (! coff_slurp_line_table (abfd, p)) |
return FALSE; |
p = p->next; |
} |
} |
return TRUE; |
return ret; |
} |
/* Classify a COFF symbol. A couple of targets have globally visible |
5069,13 → 5153,13 |
if (syment->n_value == 0) |
{ |
asection *sec; |
char * name; |
char buf[SYMNMLEN + 1]; |
name = _bfd_coff_internal_syment_name (abfd, syment, buf) |
sec = coff_section_from_bfd_index (abfd, syment->n_scnum); |
if (sec != NULL |
&& (strcmp (bfd_get_section_name (abfd, sec), |
_bfd_coff_internal_syment_name (abfd, syment, buf)) |
== 0)) |
if (sec != NULL && name != NULL |
&& (strcmp (bfd_get_section_name (abfd, sec), name) == 0)) |
return COFF_SYMBOL_PE_SECTION; |
} |
#endif |
5144,8 → 5228,9 |
coffsym = (obj_symbols (abfd) \ |
+ (cache_ptr->sym_ptr_ptr - symbols)); \ |
else if (ptr) \ |
coffsym = coff_symbol_from (abfd, ptr); \ |
coffsym = coff_symbol_from (ptr); \ |
if (coffsym != NULL \ |
&& coffsym->native->is_sym \ |
&& coffsym->native->u.syment.n_scnum == 0) \ |
cache_ptr->addend = 0; \ |
else if (ptr && bfd_asymbol_bfd (ptr) == abfd \ |
5268,7 → 5353,7 |
static reloc_howto_type * |
coff_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, |
asection *sec ATTRIBUTE_UNUSED, |
struct internal_reloc *rel, |
struct internal_reloc *rel ATTRIBUTE_UNUSED, |
struct coff_link_hash_entry *h ATTRIBUTE_UNUSED, |
struct internal_syment *sym ATTRIBUTE_UNUSED, |
bfd_vma *addendp ATTRIBUTE_UNUSED) |
5360,10 → 5445,6 |
} |
#endif |
#ifndef coff_bfd_link_hash_table_free |
#define coff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
#endif |
/* If coff_relocate_section is defined, we can use the optimized COFF |
backend linker. Otherwise we must continue to use the old linker. */ |
5497,6 → 5578,7 |
#else |
2, |
#endif |
32768, |
coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, |
coff_SWAP_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook, |
coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, |
5537,6 → 5619,7 |
#else |
2, |
#endif |
32768, |
coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, |
coff_SWAP_reloc_in, ticoff0_bad_format_hook, coff_set_arch_mach_hook, |
coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, |
5578,6 → 5661,7 |
#else |
2, |
#endif |
32768, |
coff_SWAP_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, |
coff_SWAP_reloc_in, ticoff1_bad_format_hook, coff_set_arch_mach_hook, |
coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, |
5591,6 → 5675,253 |
}; |
#endif |
#ifdef COFF_WITH_PE_BIGOBJ |
/* The UID for bigobj files. */ |
static const char header_bigobj_classid[16] = |
{ |
0xC7, 0xA1, 0xBA, 0xD1, |
0xEE, 0xBA, |
0xa9, 0x4b, |
0xAF, 0x20, |
0xFA, 0xF6, 0x6A, 0xA4, 0xDC, 0xB8 |
}; |
/* Swap routines. */ |
static void |
coff_bigobj_swap_filehdr_in (bfd * abfd, void * src, void * dst) |
{ |
struct external_ANON_OBJECT_HEADER_BIGOBJ *filehdr_src = |
(struct external_ANON_OBJECT_HEADER_BIGOBJ *) src; |
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst; |
filehdr_dst->f_magic = H_GET_16 (abfd, filehdr_src->Machine); |
filehdr_dst->f_nscns = H_GET_32 (abfd, filehdr_src->NumberOfSections); |
filehdr_dst->f_timdat = H_GET_32 (abfd, filehdr_src->TimeDateStamp); |
filehdr_dst->f_symptr = |
GET_FILEHDR_SYMPTR (abfd, filehdr_src->PointerToSymbolTable); |
filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->NumberOfSymbols); |
filehdr_dst->f_opthdr = 0; |
filehdr_dst->f_flags = 0; |
/* Check other magic numbers. */ |
if (H_GET_16 (abfd, filehdr_src->Sig1) != IMAGE_FILE_MACHINE_UNKNOWN |
|| H_GET_16 (abfd, filehdr_src->Sig2) != 0xffff |
|| H_GET_16 (abfd, filehdr_src->Version) != 2 |
|| memcmp (filehdr_src->ClassID, header_bigobj_classid, 16) != 0) |
filehdr_dst->f_opthdr = 0xffff; |
/* Note that CLR metadata are ignored. */ |
} |
static unsigned int |
coff_bigobj_swap_filehdr_out (bfd *abfd, void * in, void * out) |
{ |
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in; |
struct external_ANON_OBJECT_HEADER_BIGOBJ *filehdr_out = |
(struct external_ANON_OBJECT_HEADER_BIGOBJ *) out; |
memset (filehdr_out, 0, sizeof (*filehdr_out)); |
H_PUT_16 (abfd, IMAGE_FILE_MACHINE_UNKNOWN, filehdr_out->Sig1); |
H_PUT_16 (abfd, 0xffff, filehdr_out->Sig2); |
H_PUT_16 (abfd, 2, filehdr_out->Version); |
memcpy (filehdr_out->ClassID, header_bigobj_classid, 16); |
H_PUT_16 (abfd, filehdr_in->f_magic, filehdr_out->Machine); |
H_PUT_32 (abfd, filehdr_in->f_nscns, filehdr_out->NumberOfSections); |
H_PUT_32 (abfd, filehdr_in->f_timdat, filehdr_out->TimeDateStamp); |
PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr, |
filehdr_out->PointerToSymbolTable); |
H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->NumberOfSymbols); |
return bfd_coff_filhsz (abfd); |
} |
static void |
coff_bigobj_swap_sym_in (bfd * abfd, void * ext1, void * in1) |
{ |
SYMENT_BIGOBJ *ext = (SYMENT_BIGOBJ *) ext1; |
struct internal_syment *in = (struct internal_syment *) in1; |
if (ext->e.e_name[0] == 0) |
{ |
in->_n._n_n._n_zeroes = 0; |
in->_n._n_n._n_offset = H_GET_32 (abfd, ext->e.e.e_offset); |
} |
else |
{ |
#if SYMNMLEN != E_SYMNMLEN |
#error we need to cope with truncating or extending SYMNMLEN |
#else |
memcpy (in->_n._n_name, ext->e.e_name, SYMNMLEN); |
#endif |
} |
in->n_value = H_GET_32 (abfd, ext->e_value); |
in->n_scnum = H_GET_32 (abfd, ext->e_scnum); |
in->n_type = H_GET_16 (abfd, ext->e_type); |
in->n_sclass = H_GET_8 (abfd, ext->e_sclass); |
in->n_numaux = H_GET_8 (abfd, ext->e_numaux); |
} |
static unsigned int |
coff_bigobj_swap_sym_out (bfd * abfd, void * inp, void * extp) |
{ |
struct internal_syment *in = (struct internal_syment *) inp; |
SYMENT_BIGOBJ *ext = (SYMENT_BIGOBJ *) extp; |
if (in->_n._n_name[0] == 0) |
{ |
H_PUT_32 (abfd, 0, ext->e.e.e_zeroes); |
H_PUT_32 (abfd, in->_n._n_n._n_offset, ext->e.e.e_offset); |
} |
else |
{ |
#if SYMNMLEN != E_SYMNMLEN |
#error we need to cope with truncating or extending SYMNMLEN |
#else |
memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN); |
#endif |
} |
H_PUT_32 (abfd, in->n_value, ext->e_value); |
H_PUT_32 (abfd, in->n_scnum, ext->e_scnum); |
H_PUT_16 (abfd, in->n_type, ext->e_type); |
H_PUT_8 (abfd, in->n_sclass, ext->e_sclass); |
H_PUT_8 (abfd, in->n_numaux, ext->e_numaux); |
return SYMESZ_BIGOBJ; |
} |
static void |
coff_bigobj_swap_aux_in (bfd *abfd, |
void * ext1, |
int type, |
int in_class, |
int indx, |
int numaux, |
void * in1) |
{ |
AUXENT_BIGOBJ *ext = (AUXENT_BIGOBJ *) ext1; |
union internal_auxent *in = (union internal_auxent *) in1; |
switch (in_class) |
{ |
case C_FILE: |
if (numaux > 1) |
{ |
if (indx == 0) |
memcpy (in->x_file.x_fname, ext->File.Name, |
numaux * sizeof (AUXENT_BIGOBJ)); |
} |
else |
memcpy (in->x_file.x_fname, ext->File.Name, sizeof (ext->File.Name)); |
break; |
case C_STAT: |
case C_LEAFSTAT: |
case C_HIDDEN: |
if (type == T_NULL) |
{ |
in->x_scn.x_scnlen = H_GET_32 (abfd, ext->Section.Length); |
in->x_scn.x_nreloc = |
H_GET_16 (abfd, ext->Section.NumberOfRelocations); |
in->x_scn.x_nlinno = |
H_GET_16 (abfd, ext->Section.NumberOfLinenumbers); |
in->x_scn.x_checksum = H_GET_32 (abfd, ext->Section.Checksum); |
in->x_scn.x_associated = H_GET_16 (abfd, ext->Section.Number) |
| (H_GET_16 (abfd, ext->Section.HighNumber) << 16); |
in->x_scn.x_comdat = H_GET_8 (abfd, ext->Section.Selection); |
return; |
} |
break; |
default: |
in->x_sym.x_tagndx.l = H_GET_32 (abfd, ext->Sym.WeakDefaultSymIndex); |
/* Characteristics is ignored. */ |
break; |
} |
} |
static unsigned int |
coff_bigobj_swap_aux_out (bfd * abfd, |
void * inp, |
int type, |
int in_class, |
int indx ATTRIBUTE_UNUSED, |
int numaux ATTRIBUTE_UNUSED, |
void * extp) |
{ |
union internal_auxent * in = (union internal_auxent *) inp; |
AUXENT_BIGOBJ *ext = (AUXENT_BIGOBJ *) extp; |
memset (ext, 0, AUXESZ); |
switch (in_class) |
{ |
case C_FILE: |
memcpy (ext->File.Name, in->x_file.x_fname, sizeof (ext->File.Name)); |
return AUXESZ; |
case C_STAT: |
case C_LEAFSTAT: |
case C_HIDDEN: |
if (type == T_NULL) |
{ |
H_PUT_32 (abfd, in->x_scn.x_scnlen, ext->Section.Length); |
H_PUT_16 (abfd, in->x_scn.x_nreloc, |
ext->Section.NumberOfRelocations); |
H_PUT_16 (abfd, in->x_scn.x_nlinno, |
ext->Section.NumberOfLinenumbers); |
H_PUT_32 (abfd, in->x_scn.x_checksum, ext->Section.Checksum); |
H_PUT_16 (abfd, in->x_scn.x_associated & 0xffff, |
ext->Section.Number); |
H_PUT_16 (abfd, (in->x_scn.x_associated >> 16), |
ext->Section.HighNumber); |
H_PUT_8 (abfd, in->x_scn.x_comdat, ext->Section.Selection); |
return AUXESZ; |
} |
break; |
} |
H_PUT_32 (abfd, in->x_sym.x_tagndx.l, ext->Sym.WeakDefaultSymIndex); |
H_PUT_32 (abfd, 1, ext->Sym.WeakSearchType); |
return AUXESZ; |
} |
static bfd_coff_backend_data bigobj_swap_table = |
{ |
coff_bigobj_swap_aux_in, coff_bigobj_swap_sym_in, coff_SWAP_lineno_in, |
coff_bigobj_swap_aux_out, coff_bigobj_swap_sym_out, |
coff_SWAP_lineno_out, coff_SWAP_reloc_out, |
coff_bigobj_swap_filehdr_out, coff_SWAP_aouthdr_out, |
coff_SWAP_scnhdr_out, |
FILHSZ_BIGOBJ, AOUTSZ, SCNHSZ, SYMESZ_BIGOBJ, AUXESZ_BIGOBJ, |
RELSZ, LINESZ, FILNMLEN_BIGOBJ, |
TRUE, |
COFF_DEFAULT_LONG_SECTION_NAMES, |
COFF_DEFAULT_SECTION_ALIGNMENT_POWER, |
FALSE, |
2, |
1U << 31, |
coff_bigobj_swap_filehdr_in, coff_SWAP_aouthdr_in, coff_SWAP_scnhdr_in, |
coff_SWAP_reloc_in, coff_bad_format_hook, coff_set_arch_mach_hook, |
coff_mkobject_hook, styp_to_sec_flags, coff_set_alignment_hook, |
coff_slurp_symbol_table, symname_in_debug_hook, coff_pointerize_aux_hook, |
coff_print_aux, coff_reloc16_extra_cases, coff_reloc16_estimate, |
coff_classify_symbol, coff_compute_section_file_positions, |
coff_start_final_link, coff_relocate_section, coff_rtype_to_howto, |
coff_adjust_symndx, coff_link_add_one_symbol, |
coff_link_output_has_begun, coff_final_link_postscript, |
bfd_pe_print_pdata /* huh */ |
}; |
#endif /* COFF_WITH_PE_BIGOBJ */ |
#ifndef coff_close_and_cleanup |
#define coff_close_and_cleanup _bfd_generic_close_and_cleanup |
#endif |
5666,7 → 5997,7 |
#endif |
#ifndef coff_bfd_gc_sections |
#define coff_bfd_gc_sections bfd_generic_gc_sections |
#define coff_bfd_gc_sections bfd_coff_gc_sections |
#endif |
#ifndef coff_bfd_lookup_section_flags |
/contrib/toolchain/binutils/bfd/coffgen.c |
---|
1,7 → 1,5 |
/* Support for the generic parts of COFF, for BFD. |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
86,9 → 84,8 |
strings = _bfd_coff_read_string_table (abfd); |
if (strings == NULL) |
return FALSE; |
/* FIXME: For extra safety, we should make sure that |
strindex does not run us past the end, but right now we |
don't know the length of the string table. */ |
if ((bfd_size_type)(strindex + 2) >= obj_coff_strings_len (abfd)) |
return FALSE; |
strings += strindex; |
name = (char *) bfd_alloc (abfd, |
(bfd_size_type) strlen (strings) + 1 + 1); |
149,8 → 146,9 |
/* Compress/decompress DWARF debug sections with names: .debug_* and |
.zdebug_*, after the section flags is set. */ |
if ((flags & SEC_DEBUGGING) |
&& strlen (name) > 7 |
&& ((name[1] == 'd' && name[6] == '_') |
|| (name[1] == 'z' && name[7] == '_'))) |
|| (strlen (name) > 8 && name[1] == 'z' && name[7] == '_'))) |
{ |
enum { nothing, compress, decompress } action = nothing; |
char *new_name = NULL; |
180,6 → 178,8 |
abfd, name); |
return FALSE; |
} |
if (return_section->compress_status == COMPRESS_SECTION_DONE) |
{ |
if (name[1] != 'z') |
{ |
unsigned int len = strlen (name); |
191,6 → 191,7 |
new_name[1] = 'z'; |
memcpy (new_name + 2, name + 1, len); |
} |
} |
break; |
case decompress: |
if (!bfd_init_section_decompress_status (abfd, return_section)) |
368,6 → 369,10 |
bfd_release (abfd, opthdr); |
return NULL; |
} |
/* PR 17512: file: 11056-1136-0.004. */ |
if (internal_f.f_opthdr < aoutsz) |
memset (((char *) opthdr) + internal_f.f_opthdr, 0, aoutsz - internal_f.f_opthdr); |
bfd_coff_swap_aouthdr_in (abfd, opthdr, (void *) &internal_a); |
bfd_release (abfd, opthdr); |
} |
466,6 → 471,11 |
if (strings == NULL) |
return NULL; |
} |
/* PR 17910: Only check for string overflow if the length has been set. |
Some DLLs, eg those produced by Visual Studio, may not set the length field. */ |
if (obj_coff_strings_len (abfd) > 0 |
&& sym->_n._n_n._n_offset >= obj_coff_strings_len (abfd)) |
return NULL; |
return strings + sym->_n._n_n._n_offset; |
} |
} |
629,22 → 639,6 |
return total; |
} |
/* Takes a bfd and a symbol, returns a pointer to the coff specific |
area of the symbol if there is one. */ |
coff_symbol_type * |
coff_symbol_from (bfd *ignore_abfd ATTRIBUTE_UNUSED, |
asymbol *symbol) |
{ |
if (!bfd_family_coff (bfd_asymbol_bfd (symbol))) |
return (coff_symbol_type *) NULL; |
if (bfd_asymbol_bfd (symbol)->tdata.coff_obj_data == (coff_data_type *) NULL) |
return (coff_symbol_type *) NULL; |
return (coff_symbol_type *) symbol; |
} |
static void |
fixup_symbol_value (bfd *abfd, |
coff_symbol_type *coff_symbol_ptr, |
761,7 → 755,9 |
for (symbol_index = 0; symbol_index < symbol_count; symbol_index++) |
{ |
coff_symbol_type *coff_symbol_ptr = coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]); |
coff_symbol_type *coff_symbol_ptr; |
coff_symbol_ptr = coff_symbol_from (symbol_ptr_ptr[symbol_index]); |
symbol_ptr_ptr[symbol_index]->udata.i = symbol_index; |
if (coff_symbol_ptr && coff_symbol_ptr->native) |
{ |
768,6 → 764,7 |
combined_entry_type *s = coff_symbol_ptr->native; |
int i; |
BFD_ASSERT (s->is_sym); |
if (s->u.syment.n_sclass == C_FILE) |
{ |
if (last_file != NULL) |
804,14 → 801,15 |
for (symbol_index = 0; symbol_index < symbol_count; symbol_index++) |
{ |
coff_symbol_type *coff_symbol_ptr = |
coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]); |
coff_symbol_type *coff_symbol_ptr; |
coff_symbol_ptr = coff_symbol_from (symbol_ptr_ptr[symbol_index]); |
if (coff_symbol_ptr && coff_symbol_ptr->native) |
{ |
int i; |
combined_entry_type *s = coff_symbol_ptr->native; |
BFD_ASSERT (s->is_sym); |
if (s->fix_value) |
{ |
/* FIXME: We should use a union here. */ |
835,6 → 833,8 |
for (i = 0; i < s->u.syment.n_numaux; i++) |
{ |
combined_entry_type *a = s + i + 1; |
BFD_ASSERT (! a->is_sym); |
if (a->fix_tag) |
{ |
a->u.auxent.x_sym.x_tagndx.l = |
878,6 → 878,7 |
} |
name_length = strlen (name); |
BFD_ASSERT (native->is_sym); |
if (native->u.syment.n_sclass == C_FILE |
&& native->u.syment.n_numaux > 0) |
{ |
893,6 → 894,7 |
else |
strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN); |
BFD_ASSERT (! (native + 1)->is_sym); |
auxent = &(native + 1)->u.auxent; |
filnmlen = bfd_coff_filnmlen (abfd); |
995,6 → 997,8 |
void * buf; |
bfd_size_type symesz; |
BFD_ASSERT (native->is_sym); |
if (native->u.syment.n_sclass == C_FILE) |
symbol->flags |= BSF_DEBUGGING; |
1035,6 → 1039,7 |
return FALSE; |
for (j = 0; j < native->u.syment.n_numaux; j++) |
{ |
BFD_ASSERT (! (native + j + 1)->is_sym); |
bfd_coff_swap_aux_out (abfd, |
&((native + j + 1)->u.auxent), |
type, n_sclass, (int) j, |
1084,6 → 1089,8 |
return TRUE; |
} |
native = dummy; |
native->is_sym = TRUE; |
native[1].is_sym = FALSE; |
native->u.syment.n_type = T_NULL; |
native->u.syment.n_flags = 0; |
native->u.syment.n_numaux = 0; |
1124,7 → 1131,7 |
/* Copy the any flags from the file header into the symbol. |
FIXME: Why? */ |
{ |
coff_symbol_type *c = coff_symbol_from (abfd, symbol); |
coff_symbol_type *c = coff_symbol_from (symbol); |
if (c != (coff_symbol_type *) NULL) |
native->u.syment.n_flags = bfd_asymbol_bfd (&c->symbol)->flags; |
} |
1169,6 → 1176,7 |
return TRUE; |
} |
BFD_ASSERT (native->is_sym); |
/* If this symbol has an associated line number, we must store the |
symbol index in the line number field. We also tag the auxent to |
point to the right place in the lineno table. */ |
1255,7 → 1263,7 |
for (p = abfd->outsymbols, i = 0; i < limit; i++, p++) |
{ |
asymbol *symbol = *p; |
coff_symbol_type *c_symbol = coff_symbol_from (abfd, symbol); |
coff_symbol_type *c_symbol = coff_symbol_from (symbol); |
if (c_symbol == (coff_symbol_type *) NULL |
|| c_symbol->native == (combined_entry_type *) NULL) |
1278,6 → 1286,7 |
symbol which has no associated section and we do not have to |
worry about this, all we need to know is that it is local. */ |
current_error_handler = bfd_set_error_handler (null_error_handler); |
BFD_ASSERT (c_symbol->native->is_sym); |
sym_class = bfd_coff_classify_symbol (abfd, |
&c_symbol->native->u.syment); |
(void) bfd_set_error_handler (current_error_handler); |
1354,7 → 1363,7 |
{ |
asymbol *q = *p; |
size_t name_length = strlen (q->name); |
coff_symbol_type *c_symbol = coff_symbol_from (abfd, q); |
coff_symbol_type *c_symbol = coff_symbol_from (q); |
size_t maxlen; |
/* Figure out whether the symbol name should go in the string |
1370,6 → 1379,9 |
file name, nor does it go in the .debug section. */ |
maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN; |
else if (! c_symbol->native->is_sym) |
maxlen = bfd_coff_force_symnames_in_strings (abfd) ? 0 : SYMNMLEN; |
else if (bfd_coff_symname_in_debug (abfd, |
&c_symbol->native->u.syment)) |
/* This symbol name is in the XCOFF .debug section. |
1460,6 → 1472,7 |
{ |
/* Found a linenumber entry, output. */ |
struct internal_lineno out; |
memset ((void *) & out, 0, sizeof (out)); |
out.l_lnno = 0; |
out.l_addr.l_symndx = l->u.offset; |
1507,6 → 1520,7 |
unsigned int type = symbol->u.syment.n_type; |
unsigned int n_sclass = symbol->u.syment.n_sclass; |
BFD_ASSERT (symbol->is_sym); |
if (coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook) |
{ |
if ((*coff_backend_info (abfd)->_bfd_coff_pointerize_aux_hook) |
1520,6 → 1534,7 |
if (n_sclass == C_FILE) |
return; |
BFD_ASSERT (! auxent->is_sym); |
/* Otherwise patch up. */ |
#define N_TMASK coff_data (abfd)->local_n_tmask |
#define N_BTSHFT coff_data (abfd)->local_n_btshft |
1547,7 → 1562,7 |
we didn't want to go to the trouble until someone needed it. */ |
static char * |
build_debug_section (bfd *abfd) |
build_debug_section (bfd *abfd, asection ** sect_return) |
{ |
char *debug_section; |
file_ptr position; |
1575,6 → 1590,8 |
|| bfd_bread (debug_section, sec_size, abfd) != sec_size |
|| bfd_seek (abfd, position, SEEK_SET) != 0) |
return NULL; |
* sect_return = sect; |
return debug_section; |
} |
1637,7 → 1654,9 |
/* Read in the external strings. The strings are not loaded until |
they are needed. This is because we have no simple way of |
detecting a missing string table in an archive. */ |
detecting a missing string table in an archive. If the strings |
are loaded then the STRINGS and STRINGS_LEN fields in the |
coff_tdata structure will be set. */ |
const char * |
_bfd_coff_read_string_table (bfd *abfd) |
1687,10 → 1706,16 |
return NULL; |
} |
strings = (char *) bfd_malloc (strsize); |
strings = (char *) bfd_malloc (strsize + 1); |
if (strings == NULL) |
return NULL; |
/* PR 17521 file: 079-54929-0.004. |
A corrupt file could contain an index that points into the first |
STRING_SIZE_SIZE bytes of the string table, so make sure that |
they are zero. */ |
memset (strings, 0, STRING_SIZE_SIZE); |
if (bfd_bread (strings + STRING_SIZE_SIZE, strsize - STRING_SIZE_SIZE, abfd) |
!= strsize - STRING_SIZE_SIZE) |
{ |
1699,7 → 1724,9 |
} |
obj_coff_strings (abfd) = strings; |
obj_coff_strings_len (abfd) = strsize; |
/* Terminate the string table, just in case. */ |
strings[strsize] = 0; |
return strings; |
} |
1719,6 → 1746,7 |
{ |
free (obj_coff_strings (abfd)); |
obj_coff_strings (abfd) = NULL; |
obj_coff_strings_len (abfd) = 0; |
} |
return TRUE; |
} |
1739,12 → 1767,16 |
char *raw_src; |
char *raw_end; |
const char *string_table = NULL; |
char *debug_section = NULL; |
asection * debug_sec = NULL; |
char *debug_sec_data = NULL; |
bfd_size_type size; |
if (obj_raw_syments (abfd) != NULL) |
return obj_raw_syments (abfd); |
if (! _bfd_coff_get_external_symbols (abfd)) |
return NULL; |
size = obj_raw_syment_count (abfd) * sizeof (combined_entry_type); |
internal = (combined_entry_type *) bfd_zalloc (abfd, size); |
if (internal == NULL && size != 0) |
1751,9 → 1783,6 |
return NULL; |
internal_end = internal + obj_raw_syment_count (abfd); |
if (! _bfd_coff_get_external_symbols (abfd)) |
return NULL; |
raw_src = (char *) obj_coff_external_syms (abfd); |
/* Mark the end of the symbols. */ |
1768,17 → 1797,35 |
raw_src < raw_end; |
raw_src += symesz, internal_ptr++) |
{ |
unsigned int i; |
unsigned int i; |
bfd_coff_swap_sym_in (abfd, (void *) raw_src, |
(void *) & internal_ptr->u.syment); |
symbol_ptr = internal_ptr; |
internal_ptr->is_sym = TRUE; |
/* PR 17512: file: 1353-1166-0.004. */ |
if (symbol_ptr->u.syment.n_sclass == C_FILE |
&& symbol_ptr->u.syment.n_numaux > 0 |
&& raw_src + symesz + symbol_ptr->u.syment.n_numaux |
* symesz > raw_end) |
{ |
bfd_release (abfd, internal); |
return NULL; |
} |
for (i = 0; |
i < symbol_ptr->u.syment.n_numaux; |
i++) |
{ |
internal_ptr++; |
/* PR 17512: Prevent buffer overrun. */ |
if (internal_ptr >= internal_end) |
{ |
bfd_release (abfd, internal); |
return NULL; |
} |
raw_src += symesz; |
bfd_coff_swap_aux_in (abfd, (void *) raw_src, |
symbol_ptr->u.syment.n_type, |
1785,6 → 1832,8 |
symbol_ptr->u.syment.n_sclass, |
(int) i, symbol_ptr->u.syment.n_numaux, |
&(internal_ptr->u.auxent)); |
internal_ptr->is_sym = FALSE; |
coff_pointerize_aux (abfd, internal, symbol_ptr, i, |
internal_ptr); |
} |
1798,12 → 1847,18 |
for (internal_ptr = internal; internal_ptr < internal_end; |
internal_ptr++) |
{ |
BFD_ASSERT (internal_ptr->is_sym); |
if (internal_ptr->u.syment.n_sclass == C_FILE |
&& internal_ptr->u.syment.n_numaux > 0) |
{ |
combined_entry_type * aux = internal_ptr + 1; |
/* Make a file symbol point to the name in the auxent, since |
the text ".file" is redundant. */ |
if ((internal_ptr + 1)->u.auxent.x_file.x_n.x_zeroes == 0) |
BFD_ASSERT (! aux->is_sym); |
if (aux->u.auxent.x_file.x_n.x_zeroes == 0) |
{ |
/* The filename is a long one, point into the string table. */ |
if (string_table == NULL) |
1813,10 → 1868,12 |
return NULL; |
} |
if ((bfd_size_type)(aux->u.auxent.x_file.x_n.x_offset) |
>= obj_coff_strings_len (abfd)) |
internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) _("<corrupt>"); |
else |
internal_ptr->u.syment._n._n_n._n_offset = |
((bfd_hostptr_t) |
(string_table |
+ (internal_ptr + 1)->u.auxent.x_file.x_n.x_offset)); |
(bfd_hostptr_t) (string_table + (aux->u.auxent.x_file.x_n.x_offset)); |
} |
else |
{ |
1826,15 → 1883,15 |
if (internal_ptr->u.syment.n_numaux > 1 |
&& coff_data (abfd)->pe) |
internal_ptr->u.syment._n._n_n._n_offset = |
((bfd_hostptr_t) |
(bfd_hostptr_t) |
copy_name (abfd, |
(internal_ptr + 1)->u.auxent.x_file.x_fname, |
internal_ptr->u.syment.n_numaux * symesz)); |
aux->u.auxent.x_file.x_fname, |
internal_ptr->u.syment.n_numaux * symesz); |
else |
internal_ptr->u.syment._n._n_n._n_offset = |
((bfd_hostptr_t) |
copy_name (abfd, |
(internal_ptr + 1)->u.auxent.x_file.x_fname, |
aux->u.auxent.x_file.x_fname, |
(size_t) bfd_coff_filnmlen (abfd))); |
} |
} |
1871,6 → 1928,10 |
if (string_table == NULL) |
return NULL; |
} |
if (internal_ptr->u.syment._n._n_n._n_offset >= obj_coff_strings_len (abfd) |
|| string_table + internal_ptr->u.syment._n._n_n._n_offset < string_table) |
internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) _("<corrupt>"); |
else |
internal_ptr->u.syment._n._n_n._n_offset = |
((bfd_hostptr_t) |
(string_table |
1879,12 → 1940,23 |
else |
{ |
/* Long name in debug section. Very similar. */ |
if (debug_section == NULL) |
debug_section = build_debug_section (abfd); |
if (debug_sec_data == NULL) |
debug_sec_data = build_debug_section (abfd, & debug_sec); |
if (debug_sec_data != NULL) |
{ |
BFD_ASSERT (debug_sec != NULL); |
/* PR binutils/17512: Catch out of range offsets into the debug data. */ |
if (internal_ptr->u.syment._n._n_n._n_offset > debug_sec->size |
|| debug_sec_data + internal_ptr->u.syment._n._n_n._n_offset < debug_sec_data) |
internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) _("<corrupt>"); |
else |
internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) |
(debug_section + internal_ptr->u.syment._n._n_n._n_offset); |
(debug_sec_data + internal_ptr->u.syment._n._n_n._n_offset); |
} |
else |
internal_ptr->u.syment._n._n_n._n_offset = (bfd_hostptr_t) ""; |
} |
} |
internal_ptr += internal_ptr->u.syment.n_numaux; |
} |
1915,7 → 1987,7 |
if (new_symbol == NULL) |
return NULL; |
new_symbol->symbol.section = 0; |
new_symbol->native = 0; |
new_symbol->native = NULL; |
new_symbol->lineno = NULL; |
new_symbol->done_lineno = FALSE; |
new_symbol->symbol.the_bfd = abfd; |
1941,6 → 2013,7 |
new_symbol->native = (combined_entry_type *) bfd_zalloc (abfd, amt); |
if (!new_symbol->native) |
return NULL; |
new_symbol->native->is_sym = TRUE; |
new_symbol->symbol.section = bfd_abs_section_ptr; |
new_symbol->symbol.flags = BSF_DEBUGGING; |
new_symbol->lineno = NULL; |
1956,81 → 2029,12 |
bfd_symbol_info (symbol, ret); |
if (coffsymbol (symbol)->native != NULL |
&& coffsymbol (symbol)->native->fix_value) |
&& coffsymbol (symbol)->native->fix_value |
&& coffsymbol (symbol)->native->is_sym) |
ret->value = coffsymbol (symbol)->native->u.syment.n_value - |
(bfd_hostptr_t) obj_raw_syments (abfd); |
} |
/* 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 (abfd, symbol); |
if (csym == NULL || csym->native == NULL) |
{ |
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 (abfd, symbol); |
if (csym == NULL |
|| csym->native == NULL |
|| indx >= csym->native->u.syment.n_numaux) |
{ |
bfd_set_error (bfd_error_invalid_operation); |
return FALSE; |
} |
ent = csym->native + indx + 1; |
*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; |
} |
/* Print out information about COFF symbol. */ |
void |
2064,6 → 2068,15 |
fprintf (file, "[%3ld]", (long) (combined - root)); |
/* PR 17512: file: 079-33786-0.001:0.1. */ |
if (combined < obj_raw_syments (abfd) |
|| combined >= obj_raw_syments (abfd) + obj_raw_syment_count (abfd)) |
{ |
fprintf (file, _("<corrupt info> %s"), symbol->name); |
break; |
} |
BFD_ASSERT (combined->is_sym); |
if (! combined->fix_value) |
val = (bfd_vma) combined->u.syment.n_value; |
else |
2083,6 → 2096,7 |
combined_entry_type *auxp = combined + aux + 1; |
long tagndx; |
BFD_ASSERT (! auxp->is_sym); |
if (auxp->fix_tag) |
tagndx = auxp->u.auxent.x_sym.x_tagndx.p - root; |
else |
2157,8 → 2171,11 |
l++; |
while (l->line_number) |
{ |
if (l->line_number > 0) |
{ |
fprintf (file, "\n%4d : ", l->line_number); |
bfd_fprintf_vma (abfd, file, l->u.offset + symbol->section->vma); |
} |
l++; |
} |
} |
2193,13 → 2210,13 |
bfd_boolean |
coff_find_nearest_line_with_names (bfd *abfd, |
const struct dwarf_debug_section *debug_sections, |
asymbol **symbols, |
asection *section, |
asymbol **symbols, |
bfd_vma offset, |
const char **filename_ptr, |
const char **functionname_ptr, |
unsigned int *line_ptr) |
unsigned int *line_ptr, |
const struct dwarf_debug_section *debug_sections) |
{ |
bfd_boolean found; |
unsigned int i; |
2224,13 → 2241,32 |
return TRUE; |
/* Also try examining DWARF2 debugging information. */ |
if (_bfd_dwarf2_find_nearest_line (abfd, debug_sections, |
section, symbols, offset, |
if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset, |
filename_ptr, functionname_ptr, |
line_ptr, NULL, 0, |
line_ptr, NULL, debug_sections, 0, |
&coff_data(abfd)->dwarf2_find_line_info)) |
return TRUE; |
/* If the DWARF lookup failed, but there is DWARF information available |
then the problem might be that the file has been rebased. This tool |
changes the VMAs of all the sections, but it does not update the DWARF |
information. So try again, using a bias against the address sought. */ |
if (coff_data (abfd)->dwarf2_find_line_info != NULL) |
{ |
bfd_signed_vma bias; |
bias = _bfd_dwarf2_find_symbol_bias (symbols, |
& coff_data (abfd)->dwarf2_find_line_info); |
if (bias |
&& _bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, |
offset + bias, |
filename_ptr, functionname_ptr, |
line_ptr, NULL, debug_sections, 0, |
&coff_data(abfd)->dwarf2_find_line_info)) |
return TRUE; |
} |
*filename_ptr = 0; |
*functionname_ptr = 0; |
*line_ptr = 0; |
2250,6 → 2286,7 |
pend = p + cof->raw_syment_count; |
while (p < pend) |
{ |
BFD_ASSERT (p->is_sym); |
if (p->u.syment.n_sclass == C_FILE) |
break; |
p += 1 + p->u.syment.n_numaux; |
2273,6 → 2310,7 |
p2 < pend; |
p2 += 1 + p2->u.syment.n_numaux) |
{ |
BFD_ASSERT (p2->is_sym); |
if (p2->u.syment.n_scnum > 0 |
&& (section |
== coff_section_from_bfd_index (abfd, |
2284,6 → 2322,8 |
break; |
} |
} |
if (p2 >= pend) |
break; |
file_addr = (bfd_vma) p2->u.syment.n_value; |
/* PR 11512: Include the section address of the function name symbol. */ |
2348,6 → 2388,8 |
if (coff->native) |
{ |
combined_entry_type *s = coff->native; |
BFD_ASSERT (s->is_sym); |
s = s + 1 + s->u.syment.n_numaux; |
/* In XCOFF a debugging symbol can follow the |
2360,6 → 2402,7 |
{ |
/* The linenumber is stored in the auxent. */ |
union internal_auxent *a = &((s + 1)->u.auxent); |
line_base = a->x_sym.x_misc.x_lnsz.x_lnno; |
*line_ptr = line_base; |
} |
2409,37 → 2452,21 |
bfd_boolean |
coff_find_nearest_line (bfd *abfd, |
asection *section, |
asymbol **symbols, |
bfd_vma offset, |
const char **filename_ptr, |
const char **functionname_ptr, |
unsigned int *line_ptr) |
{ |
return coff_find_nearest_line_with_names (abfd, dwarf_debug_sections, |
section, symbols, offset, |
filename_ptr, functionname_ptr, |
line_ptr); |
} |
bfd_boolean |
coff_find_nearest_line_discriminator (bfd *abfd, |
asection *section, |
asymbol **symbols, |
bfd_vma offset, |
const char **filename_ptr, |
const char **functionname_ptr, |
unsigned int *line_ptr, |
unsigned int *discriminator) |
unsigned int *discriminator_ptr) |
{ |
*discriminator = 0; |
return coff_find_nearest_line_with_names (abfd, dwarf_debug_sections, |
section, symbols, offset, |
if (discriminator_ptr) |
*discriminator_ptr = 0; |
return coff_find_nearest_line_with_names (abfd, symbols, section, offset, |
filename_ptr, functionname_ptr, |
line_ptr); |
line_ptr, dwarf_debug_sections); |
} |
bfd_boolean |
coff_find_inliner_info (bfd *abfd, |
const char **filename_ptr, |
2459,7 → 2486,7 |
{ |
size_t size; |
if (!info->relocatable) |
if (!bfd_link_relocatable (info)) |
size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd); |
else |
size = bfd_coff_filhsz (abfd); |
2477,7 → 2504,7 |
{ |
coff_symbol_type * csym; |
csym = coff_symbol_from (abfd, symbol); |
csym = coff_symbol_from (symbol); |
if (csym == NULL) |
{ |
bfd_set_error (bfd_error_invalid_operation); |
2497,6 → 2524,7 |
if (native == NULL) |
return FALSE; |
native->is_sym = TRUE; |
native->u.syment.n_type = T_NULL; |
native->u.syment.n_sclass = symbol_class; |
2532,16 → 2560,6 |
return TRUE; |
} |
struct coff_comdat_info * |
bfd_coff_get_comdat_section (bfd *abfd, struct bfd_section *sec) |
{ |
if (bfd_get_flavour (abfd) == bfd_target_coff_flavour |
&& coff_section_data (abfd, sec) != NULL) |
return coff_section_data (abfd, sec)->comdat; |
else |
return NULL; |
} |
bfd_boolean |
_bfd_coff_section_already_linked (bfd *abfd, |
asection *sec, |
2608,3 → 2626,431 |
info->callbacks->einfo (_("%F%P: already_linked_table: %E\n")); |
return FALSE; |
} |
/* Initialize COOKIE for input bfd ABFD. */ |
static bfd_boolean |
init_reloc_cookie (struct coff_reloc_cookie *cookie, |
struct bfd_link_info *info ATTRIBUTE_UNUSED, |
bfd *abfd) |
{ |
/* Sometimes the symbol table does not yet have been loaded here. */ |
bfd_coff_slurp_symbol_table (abfd); |
cookie->abfd = abfd; |
cookie->sym_hashes = obj_coff_sym_hashes (abfd); |
cookie->symbols = obj_symbols (abfd); |
return TRUE; |
} |
/* Free the memory allocated by init_reloc_cookie, if appropriate. */ |
static void |
fini_reloc_cookie (struct coff_reloc_cookie *cookie ATTRIBUTE_UNUSED, |
bfd *abfd ATTRIBUTE_UNUSED) |
{ |
/* Nothing to do. */ |
} |
/* Initialize the relocation information in COOKIE for input section SEC |
of input bfd ABFD. */ |
static bfd_boolean |
init_reloc_cookie_rels (struct coff_reloc_cookie *cookie, |
struct bfd_link_info *info ATTRIBUTE_UNUSED, |
bfd *abfd, |
asection *sec) |
{ |
if (sec->reloc_count == 0) |
{ |
cookie->rels = NULL; |
cookie->relend = NULL; |
cookie->rel = NULL; |
return TRUE; |
} |
cookie->rels = _bfd_coff_read_internal_relocs (abfd, sec, FALSE, NULL, 0, NULL); |
if (cookie->rels == NULL) |
return FALSE; |
cookie->rel = cookie->rels; |
cookie->relend = (cookie->rels + sec->reloc_count); |
return TRUE; |
} |
/* Free the memory allocated by init_reloc_cookie_rels, |
if appropriate. */ |
static void |
fini_reloc_cookie_rels (struct coff_reloc_cookie *cookie, |
asection *sec) |
{ |
if (cookie->rels && coff_section_data (NULL, sec)->relocs != cookie->rels) |
free (cookie->rels); |
} |
/* Initialize the whole of COOKIE for input section SEC. */ |
static bfd_boolean |
init_reloc_cookie_for_section (struct coff_reloc_cookie *cookie, |
struct bfd_link_info *info, |
asection *sec) |
{ |
if (!init_reloc_cookie (cookie, info, sec->owner)) |
return FALSE; |
if (!init_reloc_cookie_rels (cookie, info, sec->owner, sec)) |
{ |
fini_reloc_cookie (cookie, sec->owner); |
return FALSE; |
} |
return TRUE; |
} |
/* Free the memory allocated by init_reloc_cookie_for_section, |
if appropriate. */ |
static void |
fini_reloc_cookie_for_section (struct coff_reloc_cookie *cookie, |
asection *sec) |
{ |
fini_reloc_cookie_rels (cookie, sec); |
fini_reloc_cookie (cookie, sec->owner); |
} |
static asection * |
_bfd_coff_gc_mark_hook (asection *sec, |
struct bfd_link_info *info ATTRIBUTE_UNUSED, |
struct internal_reloc *rel ATTRIBUTE_UNUSED, |
struct coff_link_hash_entry *h, |
struct internal_syment *sym) |
{ |
if (h != NULL) |
{ |
switch (h->root.type) |
{ |
case bfd_link_hash_defined: |
case bfd_link_hash_defweak: |
return h->root.u.def.section; |
case bfd_link_hash_common: |
return h->root.u.c.p->section; |
case bfd_link_hash_undefined: |
case bfd_link_hash_undefweak: |
default: |
break; |
} |
return NULL; |
} |
return coff_section_from_bfd_index (sec->owner, sym->n_scnum); |
} |
/* COOKIE->rel describes a relocation against section SEC, which is |
a section we've decided to keep. Return the section that contains |
the relocation symbol, or NULL if no section contains it. */ |
static asection * |
_bfd_coff_gc_mark_rsec (struct bfd_link_info *info, asection *sec, |
coff_gc_mark_hook_fn gc_mark_hook, |
struct coff_reloc_cookie *cookie) |
{ |
struct coff_link_hash_entry *h; |
h = cookie->sym_hashes[cookie->rel->r_symndx]; |
if (h != NULL) |
{ |
while (h->root.type == bfd_link_hash_indirect |
|| h->root.type == bfd_link_hash_warning) |
h = (struct coff_link_hash_entry *) h->root.u.i.link; |
return (*gc_mark_hook) (sec, info, cookie->rel, h, NULL); |
} |
return (*gc_mark_hook) (sec, info, cookie->rel, NULL, |
&(cookie->symbols |
+ obj_convert (sec->owner)[cookie->rel->r_symndx])->native->u.syment); |
} |
static bfd_boolean _bfd_coff_gc_mark |
(struct bfd_link_info *, asection *, coff_gc_mark_hook_fn); |
/* COOKIE->rel describes a relocation against section SEC, which is |
a section we've decided to keep. Mark the section that contains |
the relocation symbol. */ |
static bfd_boolean |
_bfd_coff_gc_mark_reloc (struct bfd_link_info *info, |
asection *sec, |
coff_gc_mark_hook_fn gc_mark_hook, |
struct coff_reloc_cookie *cookie) |
{ |
asection *rsec; |
rsec = _bfd_coff_gc_mark_rsec (info, sec, gc_mark_hook, cookie); |
if (rsec && !rsec->gc_mark) |
{ |
if (bfd_get_flavour (rsec->owner) != bfd_target_coff_flavour) |
rsec->gc_mark = 1; |
else if (!_bfd_coff_gc_mark (info, rsec, gc_mark_hook)) |
return FALSE; |
} |
return TRUE; |
} |
/* The mark phase of garbage collection. For a given section, mark |
it and any sections in this section's group, and all the sections |
which define symbols to which it refers. */ |
static bfd_boolean |
_bfd_coff_gc_mark (struct bfd_link_info *info, |
asection *sec, |
coff_gc_mark_hook_fn gc_mark_hook) |
{ |
bfd_boolean ret = TRUE; |
sec->gc_mark = 1; |
/* Look through the section relocs. */ |
if ((sec->flags & SEC_RELOC) != 0 |
&& sec->reloc_count > 0) |
{ |
struct coff_reloc_cookie cookie; |
if (!init_reloc_cookie_for_section (&cookie, info, sec)) |
ret = FALSE; |
else |
{ |
for (; cookie.rel < cookie.relend; cookie.rel++) |
{ |
if (!_bfd_coff_gc_mark_reloc (info, sec, gc_mark_hook, &cookie)) |
{ |
ret = FALSE; |
break; |
} |
} |
fini_reloc_cookie_for_section (&cookie, sec); |
} |
} |
return ret; |
} |
static bfd_boolean |
_bfd_coff_gc_mark_extra_sections (struct bfd_link_info *info, |
coff_gc_mark_hook_fn mark_hook ATTRIBUTE_UNUSED) |
{ |
bfd *ibfd; |
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) |
{ |
asection *isec; |
bfd_boolean some_kept; |
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) |
continue; |
/* Ensure all linker created sections are kept, and see whether |
any other section is already marked. */ |
some_kept = FALSE; |
for (isec = ibfd->sections; isec != NULL; isec = isec->next) |
{ |
if ((isec->flags & SEC_LINKER_CREATED) != 0) |
isec->gc_mark = 1; |
else if (isec->gc_mark) |
some_kept = TRUE; |
} |
/* If no section in this file will be kept, then we can |
toss out debug sections. */ |
if (!some_kept) |
continue; |
/* Keep debug and special sections like .comment when they are |
not part of a group, or when we have single-member groups. */ |
for (isec = ibfd->sections; isec != NULL; isec = isec->next) |
if ((isec->flags & SEC_DEBUGGING) != 0 |
|| (isec->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0) |
isec->gc_mark = 1; |
} |
return TRUE; |
} |
/* Sweep symbols in swept sections. Called via coff_link_hash_traverse. */ |
static bfd_boolean |
coff_gc_sweep_symbol (struct coff_link_hash_entry *h, |
void *data ATTRIBUTE_UNUSED) |
{ |
if (h->root.type == bfd_link_hash_warning) |
h = (struct coff_link_hash_entry *) h->root.u.i.link; |
if ((h->root.type == bfd_link_hash_defined |
|| h->root.type == bfd_link_hash_defweak) |
&& !h->root.u.def.section->gc_mark |
&& !(h->root.u.def.section->owner->flags & DYNAMIC)) |
{ |
/* Do our best to hide the symbol. */ |
h->root.u.def.section = bfd_und_section_ptr; |
h->symbol_class = C_HIDDEN; |
} |
return TRUE; |
} |
/* The sweep phase of garbage collection. Remove all garbage sections. */ |
typedef bfd_boolean (*gc_sweep_hook_fn) |
(bfd *, struct bfd_link_info *, asection *, const struct internal_reloc *); |
static bfd_boolean |
coff_gc_sweep (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) |
{ |
bfd *sub; |
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next) |
{ |
asection *o; |
if (bfd_get_flavour (sub) != bfd_target_coff_flavour) |
continue; |
for (o = sub->sections; o != NULL; o = o->next) |
{ |
/* Keep debug and special sections. */ |
if ((o->flags & (SEC_DEBUGGING | SEC_LINKER_CREATED)) != 0 |
|| (o->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0) |
o->gc_mark = 1; |
else if (CONST_STRNEQ (o->name, ".idata") |
|| CONST_STRNEQ (o->name, ".pdata") |
|| CONST_STRNEQ (o->name, ".xdata") |
|| CONST_STRNEQ (o->name, ".rsrc")) |
o->gc_mark = 1; |
if (o->gc_mark) |
continue; |
/* Skip sweeping sections already excluded. */ |
if (o->flags & SEC_EXCLUDE) |
continue; |
/* Since this is early in the link process, it is simple |
to remove a section from the output. */ |
o->flags |= SEC_EXCLUDE; |
if (info->print_gc_sections && o->size != 0) |
_bfd_error_handler (_("Removing unused section '%s' in file '%B'"), sub, o->name); |
#if 0 |
/* But we also have to update some of the relocation |
info we collected before. */ |
if (gc_sweep_hook |
&& (o->flags & SEC_RELOC) != 0 |
&& o->reloc_count > 0 |
&& !bfd_is_abs_section (o->output_section)) |
{ |
struct internal_reloc *internal_relocs; |
bfd_boolean r; |
internal_relocs |
= _bfd_coff_link_read_relocs (o->owner, o, NULL, NULL, |
info->keep_memory); |
if (internal_relocs == NULL) |
return FALSE; |
r = (*gc_sweep_hook) (o->owner, info, o, internal_relocs); |
if (coff_section_data (o)->relocs != internal_relocs) |
free (internal_relocs); |
if (!r) |
return FALSE; |
} |
#endif |
} |
} |
/* Remove the symbols that were in the swept sections from the dynamic |
symbol table. */ |
coff_link_hash_traverse (coff_hash_table (info), coff_gc_sweep_symbol, |
NULL); |
return TRUE; |
} |
/* Keep all sections containing symbols undefined on the command-line, |
and the section containing the entry symbol. */ |
static void |
_bfd_coff_gc_keep (struct bfd_link_info *info) |
{ |
struct bfd_sym_chain *sym; |
for (sym = info->gc_sym_list; sym != NULL; sym = sym->next) |
{ |
struct coff_link_hash_entry *h; |
h = coff_link_hash_lookup (coff_hash_table (info), sym->name, |
FALSE, FALSE, FALSE); |
if (h != NULL |
&& (h->root.type == bfd_link_hash_defined |
|| h->root.type == bfd_link_hash_defweak) |
&& !bfd_is_abs_section (h->root.u.def.section)) |
h->root.u.def.section->flags |= SEC_KEEP; |
} |
} |
/* Do mark and sweep of unused sections. */ |
bfd_boolean |
bfd_coff_gc_sections (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) |
{ |
bfd *sub; |
/* FIXME: Should we implement this? */ |
#if 0 |
const bfd_coff_backend_data *bed = coff_backend_info (abfd); |
if (!bed->can_gc_sections |
|| !is_coff_hash_table (info->hash)) |
{ |
(*_bfd_error_handler)(_("Warning: gc-sections option ignored")); |
return TRUE; |
} |
#endif |
_bfd_coff_gc_keep (info); |
/* Grovel through relocs to find out who stays ... */ |
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next) |
{ |
asection *o; |
if (bfd_get_flavour (sub) != bfd_target_coff_flavour) |
continue; |
for (o = sub->sections; o != NULL; o = o->next) |
{ |
if (((o->flags & (SEC_EXCLUDE | SEC_KEEP)) == SEC_KEEP |
|| CONST_STRNEQ (o->name, ".vectors") |
|| CONST_STRNEQ (o->name, ".ctors") |
|| CONST_STRNEQ (o->name, ".dtors")) |
&& !o->gc_mark) |
{ |
if (!_bfd_coff_gc_mark (info, o, _bfd_coff_gc_mark_hook)) |
return FALSE; |
} |
} |
} |
/* Allow the backend to mark additional target specific sections. */ |
_bfd_coff_gc_mark_extra_sections (info, _bfd_coff_gc_mark_hook); |
/* ... and mark SEC_EXCLUDE for those that go. */ |
return coff_gc_sweep (abfd, info); |
} |
/contrib/toolchain/binutils/bfd/cofflink.c |
---|
1,6 → 1,5 |
/* COFF specific linker code. |
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, |
2004, 2005, 2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc. |
Copyright (C) 1994-2015 Free Software Foundation, Inc. |
Written by Ian Lance Taylor, Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
30,9 → 29,11 |
#include "libcoff.h" |
#include "safe-ctype.h" |
static bfd_boolean coff_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info); |
static bfd_boolean coff_link_check_archive_element (bfd *abfd, struct bfd_link_info *info, bfd_boolean *pneeded); |
static bfd_boolean coff_link_add_symbols (bfd *abfd, struct bfd_link_info *info); |
static bfd_boolean coff_link_add_object_symbols (bfd *, struct bfd_link_info *); |
static bfd_boolean coff_link_check_archive_element |
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, const char *, |
bfd_boolean *); |
static bfd_boolean coff_link_add_symbols (bfd *, struct bfd_link_info *); |
/* Return TRUE if SYM is a weak, external symbol. */ |
#define IS_WEAK_EXTERNAL(abfd, sym) \ |
191,74 → 192,6 |
return TRUE; |
} |
/* Look through the symbols to see if this object file should be |
included in the link. */ |
static bfd_boolean |
coff_link_check_ar_symbols (bfd *abfd, |
struct bfd_link_info *info, |
bfd_boolean *pneeded, |
bfd **subsbfd) |
{ |
bfd_size_type symesz; |
bfd_byte *esym; |
bfd_byte *esym_end; |
*pneeded = FALSE; |
symesz = bfd_coff_symesz (abfd); |
esym = (bfd_byte *) obj_coff_external_syms (abfd); |
esym_end = esym + obj_raw_syment_count (abfd) * symesz; |
while (esym < esym_end) |
{ |
struct internal_syment sym; |
enum coff_symbol_classification classification; |
bfd_coff_swap_sym_in (abfd, esym, &sym); |
classification = bfd_coff_classify_symbol (abfd, &sym); |
if (classification == COFF_SYMBOL_GLOBAL |
|| classification == COFF_SYMBOL_COMMON) |
{ |
const char *name; |
char buf[SYMNMLEN + 1]; |
struct bfd_link_hash_entry *h; |
/* This symbol is externally visible, and is defined by this |
object file. */ |
name = _bfd_coff_internal_syment_name (abfd, &sym, buf); |
if (name == NULL) |
return FALSE; |
h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); |
/* Auto import. */ |
if (!h |
&& info->pei386_auto_import |
&& CONST_STRNEQ (name, "__imp_")) |
h = bfd_link_hash_lookup (info->hash, name + 6, FALSE, FALSE, TRUE); |
/* We are only interested in symbols that are currently |
undefined. If a symbol is currently known to be common, |
COFF linkers do not bring in an object file which defines |
it. */ |
if (h != (struct bfd_link_hash_entry *) NULL |
&& h->type == bfd_link_hash_undefined) |
{ |
if (!(*info->callbacks |
->add_archive_element) (info, abfd, name, subsbfd)) |
return FALSE; |
*pneeded = TRUE; |
return TRUE; |
} |
} |
esym += (sym.n_numaux + 1) * symesz; |
} |
/* We do not need this object file. */ |
return TRUE; |
} |
/* Check a single archive element to see if we need to include it in |
the link. *PNEEDED is set according to whether this element is |
needed in the link or not. This is called via |
267,43 → 200,25 |
static bfd_boolean |
coff_link_check_archive_element (bfd *abfd, |
struct bfd_link_info *info, |
struct bfd_link_hash_entry *h, |
const char *name, |
bfd_boolean *pneeded) |
{ |
bfd *oldbfd; |
bfd_boolean needed; |
*pneeded = FALSE; |
if (!_bfd_coff_get_external_symbols (abfd)) |
return FALSE; |
/* We are only interested in symbols that are currently undefined. |
If a symbol is currently known to be common, COFF linkers do not |
bring in an object file which defines it. */ |
if (h->type != bfd_link_hash_undefined) |
return TRUE; |
oldbfd = abfd; |
if (!coff_link_check_ar_symbols (abfd, info, pneeded, &abfd)) |
if (!(*info->callbacks->add_archive_element) (info, abfd, name, &abfd)) |
return FALSE; |
*pneeded = TRUE; |
needed = *pneeded; |
if (needed) |
{ |
/* Potentially, the add_archive_element hook may have set a |
substitute BFD for us. */ |
if (abfd != oldbfd) |
{ |
if (!info->keep_memory |
&& !_bfd_coff_free_symbols (oldbfd)) |
return FALSE; |
if (!_bfd_coff_get_external_symbols (abfd)) |
return FALSE; |
return coff_link_add_object_symbols (abfd, info); |
} |
if (!coff_link_add_symbols (abfd, info)) |
return FALSE; |
} |
if (!info->keep_memory || !needed) |
{ |
if (!_bfd_coff_free_symbols (abfd)) |
return FALSE; |
} |
return TRUE; |
} |
/* Add all the symbols from an object file to the hash table. */ |
static bfd_boolean |
592,7 → 507,7 |
/* If this is a non-traditional, non-relocatable link, try to |
optimize the handling of any .stab/.stabstr sections. */ |
if (! info->relocatable |
if (! bfd_link_relocatable (info) |
&& ! info->traditional_format |
&& bfd_get_flavour (info->output_bfd) == bfd_get_flavour (abfd) |
&& (info->strip != strip_all && info->strip != strip_debugger)) |
737,7 → 652,7 |
|| info->strip == strip_some) |
o->lineno_count += sec->lineno_count; |
if (info->relocatable) |
if (bfd_link_relocatable (info)) |
o->reloc_count += sec->reloc_count; |
if (sec->rawsize > max_contents_size) |
749,7 → 664,7 |
if (sec->reloc_count > max_reloc_count) |
max_reloc_count = sec->reloc_count; |
} |
else if (info->relocatable |
else if (bfd_link_relocatable (info) |
&& (p->type == bfd_section_reloc_link_order |
|| p->type == bfd_symbol_reloc_link_order)) |
++o->reloc_count; |
784,7 → 699,7 |
/* If doing a relocatable link, allocate space for the pointers we |
need to keep. */ |
if (info->relocatable) |
if (bfd_link_relocatable (info)) |
{ |
unsigned int i; |
832,7 → 747,7 |
memory until the end of the link. This wastes memory, |
but only when doing a relocatable link, which is not the |
common case. */ |
BFD_ASSERT (info->relocatable); |
BFD_ASSERT (bfd_link_relocatable (info)); |
amt = o->reloc_count; |
amt *= sizeof (struct internal_reloc); |
flaginfo.section_info[o->target_index].relocs = |
861,7 → 776,7 |
the opportunity to clear the output_has_begun fields of all the |
input BFD's. */ |
max_sym_count = 0; |
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) |
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next) |
{ |
size_t sz; |
884,7 → 799,7 |
flaginfo.contents = (bfd_byte *) bfd_malloc (max_contents_size); |
amt = max_reloc_count * relsz; |
flaginfo.external_relocs = (bfd_byte *) bfd_malloc (amt); |
if (! info->relocatable) |
if (! bfd_link_relocatable (info)) |
{ |
amt = max_reloc_count * sizeof (struct internal_reloc); |
flaginfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt); |
896,7 → 811,7 |
|| (flaginfo.linenos == NULL && max_lineno_count > 0) |
|| (flaginfo.contents == NULL && max_contents_size > 0) |
|| (flaginfo.external_relocs == NULL && max_reloc_count > 0) |
|| (! info->relocatable |
|| (! bfd_link_relocatable (info) |
&& flaginfo.internal_relocs == NULL |
&& max_reloc_count > 0)) |
goto error_return; |
946,7 → 861,7 |
if (flaginfo.info->strip != strip_all && flaginfo.info->discard != discard_all) |
{ |
/* Add local symbols from foreign inputs. */ |
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) |
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next) |
{ |
unsigned int i; |
976,7 → 891,7 |
== NULL)) |
|| (((flaginfo.info->discard == discard_sec_merge |
&& (bfd_get_section (sym)->flags & SEC_MERGE) |
&& ! flaginfo.info->relocatable) |
&& ! bfd_link_relocatable (flaginfo.info)) |
|| flaginfo.info->discard == discard_l) |
&& bfd_is_local_label_name (sub, bfd_asymbol_name(sym)))) |
continue; |
1116,7 → 1031,7 |
flaginfo.outsyms = NULL; |
} |
if (info->relocatable && max_output_reloc_count > 0) |
if (bfd_link_relocatable (info) && max_output_reloc_count > 0) |
{ |
/* Now that we have written out all the global symbols, we know |
the symbol indices to use for relocs against them, and we can |
1435,8 → 1350,8 |
internal_relocs = _bfd_coff_read_internal_relocs |
(input_bfd, a, FALSE, |
flaginfo->external_relocs, |
flaginfo->info->relocatable, |
(flaginfo->info->relocatable |
bfd_link_relocatable (flaginfo->info), |
(bfd_link_relocatable (flaginfo->info) |
? (flaginfo->section_info[ a->output_section->target_index ].relocs + a->output_section->reloc_count) |
: flaginfo->internal_relocs) |
); |
1521,7 → 1436,7 |
symbols that are going to be involved in the relocations. */ |
if (( flaginfo->info->strip != strip_none |
|| flaginfo->info->discard != discard_none) |
&& flaginfo->info->relocatable) |
&& bfd_link_relocatable (flaginfo->info)) |
{ |
/* Mark the symbol array as 'not-used'. */ |
memset (indexp, 0, obj_raw_syment_count (input_bfd) * sizeof * indexp); |
1568,7 → 1483,7 |
relocation. */ |
if ((flaginfo->info->strip != strip_none |
|| flaginfo->info->discard != discard_none) |
&& flaginfo->info->relocatable) |
&& bfd_link_relocatable (flaginfo->info)) |
dont_skip_symbol = *indexp; |
else |
dont_skip_symbol = FALSE; |
2088,6 → 2003,9 |
if (strings == NULL) |
return FALSE; |
} |
if ((bfd_size_type) auxp->x_file.x_n.x_offset >= obj_coff_strings_len (input_bfd)) |
filename = _("<corrupt>"); |
else |
filename = strings + auxp->x_file.x_n.x_offset; |
indx = _bfd_stringtab_add (flaginfo->strtab, filename, |
hash, copy); |
2442,8 → 2360,8 |
target_index = o->output_section->target_index; |
internal_relocs = (_bfd_coff_read_internal_relocs |
(input_bfd, o, FALSE, flaginfo->external_relocs, |
flaginfo->info->relocatable, |
(flaginfo->info->relocatable |
bfd_link_relocatable (flaginfo->info), |
(bfd_link_relocatable (flaginfo->info) |
? (flaginfo->section_info[target_index].relocs |
+ o->output_section->reloc_count) |
: flaginfo->internal_relocs))); |
2490,7 → 2408,7 |
flaginfo->sec_ptrs)) |
return FALSE; |
if (flaginfo->info->relocatable) |
if (bfd_link_relocatable (flaginfo->info)) |
{ |
bfd_vma offset; |
struct internal_reloc *irelend; |
2718,8 → 2636,8 |
/* When a weak symbol is not overridden by a strong one, |
turn it into an external symbol when not building a |
shared or relocatable object. */ |
if (! flaginfo->info->shared |
&& ! flaginfo->info->relocatable |
if (! bfd_link_pic (flaginfo->info) |
&& ! bfd_link_relocatable (flaginfo->info) |
&& IS_WEAK_EXTERNAL (flaginfo->output_bfd, isym)) |
isym.n_sclass = C_EXT; |
2772,7 → 2690,7 |
not matter. FIXME: Why not? */ |
if (sec->reloc_count > 0xffff |
&& (! obj_pe (output_bfd) |
|| flaginfo->info->relocatable)) |
|| bfd_link_relocatable (flaginfo->info))) |
(*_bfd_error_handler) |
(_("%s: %s: reloc overflow: 0x%lx > 0xffff"), |
bfd_get_filename (output_bfd), |
2781,7 → 2699,7 |
if (sec->lineno_count > 0xffff |
&& (! obj_pe (output_bfd) |
|| flaginfo->info->relocatable)) |
|| bfd_link_relocatable (flaginfo->info))) |
(*_bfd_error_handler) |
(_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"), |
bfd_get_filename (output_bfd), |
2871,7 → 2789,7 |
size = bfd_get_reloc_size (howto); |
buf = (bfd_byte *) bfd_zmalloc (size); |
if (buf == NULL) |
if (buf == NULL && size != 0) |
return FALSE; |
rstat = _bfd_relocate_contents (howto, output_bfd, |
2997,6 → 2915,7 |
struct internal_syment *sym; |
bfd_vma addend; |
bfd_vma val; |
asection *sec; |
reloc_howto_type *howto; |
bfd_reloc_status_type rstat; |
3040,7 → 2959,7 |
then we should ignore the symbol value. */ |
if (howto->pc_relative && howto->pcrel_offset) |
{ |
if (info->relocatable) |
if (bfd_link_relocatable (info)) |
continue; |
if (sym != NULL && sym->n_scnum != 0) |
addend += sym->n_value; |
3047,11 → 2966,9 |
} |
val = 0; |
sec = NULL; |
if (h == NULL) |
{ |
asection *sec; |
if (symndx == -1) |
{ |
sec = bfd_abs_section_ptr; |
3073,8 → 2990,6 |
|| h->root.type == bfd_link_hash_defweak) |
{ |
/* Defined weak symbols are a GNU extension. */ |
asection *sec; |
sec = h->root.u.def.section; |
val = (h->root.u.def.value |
+ sec->output_section->vma |
3095,7 → 3010,6 |
will resolve a weak external only if a normal |
external causes the library member to be linked. |
See also linker.c: generic_link_check_archive_element. */ |
asection *sec; |
struct coff_link_hash_entry *h2 = |
h->auxbfd->tdata.coff_obj_data->sym_hashes[ |
h->aux->x_sym.x_tagndx.l]; |
3117,7 → 3031,7 |
val = 0; |
} |
else if (! info->relocatable) |
else if (! bfd_link_relocatable (info)) |
{ |
if (! ((*info->callbacks->undefined_symbol) |
(info, h->root.root.string, input_bfd, input_section, |
3126,6 → 3040,15 |
} |
} |
/* If the input section defining the symbol has been discarded |
then zero this reloc field. */ |
if (sec != NULL && discarded_section (sec)) |
{ |
_bfd_clear_contents (howto, input_bfd, input_section, |
contents + (rel->r_vaddr - input_section->vma)); |
continue; |
} |
if (info->base_file) |
{ |
/* Emit a reloc if the backend thinks it needs it. */ |
/contrib/toolchain/binutils/bfd/compress.c |
---|
1,6 → 1,5 |
/* Compressed section support (intended for debug sections). |
Copyright 2008, 2010, 2011, 2012 |
Free Software Foundation, Inc. |
Copyright (C) 2008-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
20,13 → 19,13 |
MA 02110-1301, USA. */ |
#include "sysdep.h" |
#include <zlib.h> |
#include "bfd.h" |
#include "libbfd.h" |
#ifdef HAVE_ZLIB_H |
#include <zlib.h> |
#endif |
#include "safe-ctype.h" |
#ifdef HAVE_ZLIB_H |
#define MAX_COMPRESSION_HEADER_SIZE 24 |
static bfd_boolean |
decompress_contents (bfd_byte *compressed_buffer, |
bfd_size_type compressed_size, |
38,11 → 37,14 |
/* It is possible the section consists of several compressed |
buffers concatenated together, so we uncompress in a loop. */ |
strm.zalloc = NULL; |
strm.zfree = NULL; |
strm.opaque = NULL; |
strm.avail_in = compressed_size - 12; |
strm.next_in = (Bytef*) compressed_buffer + 12; |
/* PR 18313: The state field in the z_stream structure is supposed |
to be invisible to the user (ie us), but some compilers will |
still complain about it being used without initialisation. So |
we first zero the entire z_stream structure and then set the fields |
that we need. */ |
memset (& strm, 0, sizeof strm); |
strm.avail_in = compressed_size; |
strm.next_in = (Bytef*) compressed_buffer; |
strm.avail_out = uncompressed_size; |
BFD_ASSERT (Z_OK == 0); |
61,81 → 63,142 |
rc |= inflateEnd (&strm); |
return rc == Z_OK && strm.avail_out == 0; |
} |
#endif |
/* |
FUNCTION |
bfd_compress_section_contents |
SYNOPSIS |
bfd_boolean bfd_compress_section_contents |
(bfd *abfd, asection *section, bfd_byte *uncompressed_buffer, |
bfd_size_type uncompressed_size); |
DESCRIPTION |
Compress data of the size specified in @var{uncompressed_size} |
/* Compress data of the size specified in @var{uncompressed_size} |
and pointed to by @var{uncompressed_buffer} using zlib and store |
as the contents field. This function assumes the contents |
field was allocated using bfd_malloc() or equivalent. If zlib |
is not installed on this machine, the input is unmodified. |
field was allocated using bfd_malloc() or equivalent. |
Return @code{TRUE} if the full section contents is compressed |
successfully. |
*/ |
Return the uncompressed size if the full section contents is |
compressed successfully. Otherwise return 0. */ |
bfd_boolean |
bfd_compress_section_contents (bfd *abfd ATTRIBUTE_UNUSED, |
sec_ptr sec ATTRIBUTE_UNUSED, |
bfd_byte *uncompressed_buffer ATTRIBUTE_UNUSED, |
bfd_size_type uncompressed_size ATTRIBUTE_UNUSED) |
static bfd_size_type |
bfd_compress_section_contents (bfd *abfd, sec_ptr sec, |
bfd_byte *uncompressed_buffer, |
bfd_size_type uncompressed_size) |
{ |
#ifndef HAVE_ZLIB_H |
bfd_set_error (bfd_error_invalid_operation); |
return FALSE; |
#else |
uLong compressed_size; |
bfd_byte *compressed_buffer; |
bfd_byte *buffer; |
bfd_size_type buffer_size; |
bfd_boolean decompress; |
int zlib_size = 0; |
int orig_compression_header_size; |
bfd_size_type orig_uncompressed_size; |
int header_size = bfd_get_compression_header_size (abfd, NULL); |
bfd_boolean compressed |
= bfd_is_section_compressed_with_header (abfd, sec, |
&orig_compression_header_size, |
&orig_uncompressed_size); |
compressed_size = compressBound (uncompressed_size) + 12; |
compressed_buffer = (bfd_byte *) bfd_malloc (compressed_size); |
/* Either ELF compression header or the 12-byte, "ZLIB" + 8-byte size, |
overhead in .zdebug* section. */ |
if (!header_size) |
header_size = 12; |
if (compressed_buffer == NULL) |
return FALSE; |
if (compressed) |
{ |
/* We shouldn't decompress unsupported compressed section. */ |
if (orig_compression_header_size < 0) |
abort (); |
if (compress ((Bytef*) compressed_buffer + 12, |
/* Different compression schemes. Just move the compressed section |
contents to the right position. */ |
if (orig_compression_header_size == 0) |
{ |
/* Convert it from .zdebug* section. Get the uncompressed |
size first. We need to substract the 12-byte overhead in |
.zdebug* section. Set orig_compression_header_size to |
the 12-bye overhead. */ |
orig_compression_header_size = 12; |
zlib_size = uncompressed_size - 12; |
} |
else |
{ |
/* Convert it to .zdebug* section. */ |
zlib_size = uncompressed_size - orig_compression_header_size; |
} |
/* Add the header size. */ |
compressed_size = zlib_size + header_size; |
} |
else |
compressed_size = compressBound (uncompressed_size) + header_size; |
/* Uncompress if it leads to smaller size. */ |
if (compressed && compressed_size > orig_uncompressed_size) |
{ |
decompress = TRUE; |
buffer_size = orig_uncompressed_size; |
} |
else |
{ |
decompress = FALSE; |
buffer_size = compressed_size; |
} |
buffer = (bfd_byte *) bfd_alloc (abfd, buffer_size); |
if (buffer == NULL) |
return 0; |
if (compressed) |
{ |
sec->size = orig_uncompressed_size; |
if (decompress) |
{ |
if (!decompress_contents (uncompressed_buffer |
+ orig_compression_header_size, |
zlib_size, buffer, buffer_size)) |
{ |
bfd_set_error (bfd_error_bad_value); |
bfd_release (abfd, buffer); |
return 0; |
} |
free (uncompressed_buffer); |
sec->contents = buffer; |
sec->compress_status = COMPRESS_SECTION_DONE; |
return orig_uncompressed_size; |
} |
else |
{ |
bfd_update_compression_header (abfd, buffer, sec); |
memmove (buffer + header_size, |
uncompressed_buffer + orig_compression_header_size, |
zlib_size); |
} |
} |
else |
{ |
if (compress ((Bytef*) buffer + header_size, |
&compressed_size, |
(const Bytef*) uncompressed_buffer, |
uncompressed_size) != Z_OK) |
{ |
free (compressed_buffer); |
bfd_release (abfd, buffer); |
bfd_set_error (bfd_error_bad_value); |
return FALSE; |
return 0; |
} |
/* Write the zlib header. In this case, it should be "ZLIB" followed |
by the uncompressed section size, 8 bytes in big-endian order. */ |
memcpy (compressed_buffer, "ZLIB", 4); |
compressed_buffer[11] = uncompressed_size; uncompressed_size >>= 8; |
compressed_buffer[10] = uncompressed_size; uncompressed_size >>= 8; |
compressed_buffer[9] = uncompressed_size; uncompressed_size >>= 8; |
compressed_buffer[8] = uncompressed_size; uncompressed_size >>= 8; |
compressed_buffer[7] = uncompressed_size; uncompressed_size >>= 8; |
compressed_buffer[6] = uncompressed_size; uncompressed_size >>= 8; |
compressed_buffer[5] = uncompressed_size; uncompressed_size >>= 8; |
compressed_buffer[4] = uncompressed_size; |
compressed_size += 12; |
compressed_size += header_size; |
/* PR binutils/18087: If compression didn't make the section smaller, |
just keep it uncompressed. */ |
if (compressed_size < uncompressed_size) |
bfd_update_compression_header (abfd, buffer, sec); |
else |
{ |
/* NOTE: There is a small memory leak here since |
uncompressed_buffer is malloced and won't be freed. */ |
bfd_release (abfd, buffer); |
sec->contents = uncompressed_buffer; |
sec->compress_status = COMPRESS_SECTION_NONE; |
return uncompressed_size; |
} |
} |
/* Free the uncompressed contents if we compress in place. */ |
if (uncompressed_buffer == sec->contents) |
free (uncompressed_buffer); |
sec->contents = compressed_buffer; |
sec->contents = buffer; |
sec->size = compressed_size; |
sec->compress_status = COMPRESS_SECTION_DONE; |
return TRUE; |
#endif /* HAVE_ZLIB_H */ |
return uncompressed_size; |
} |
/* |
152,7 → 215,8 |
return @var{*ptr} with memory malloc'd by this function. |
Return @code{TRUE} if the full section contents is retrieved |
successfully. |
successfully. If the section has no contents then this function |
returns @code{TRUE} but @var{*ptr} is set to NULL. |
*/ |
bfd_boolean |
160,12 → 224,11 |
{ |
bfd_size_type sz; |
bfd_byte *p = *ptr; |
#ifdef HAVE_ZLIB_H |
bfd_boolean ret; |
bfd_size_type save_size; |
bfd_size_type save_rawsize; |
bfd_byte *compressed_buffer; |
#endif |
unsigned int compression_header_size; |
if (abfd->direction != write_direction && sec->rawsize != 0) |
sz = sec->rawsize; |
172,7 → 235,10 |
else |
sz = sec->size; |
if (sz == 0) |
{ |
*ptr = NULL; |
return TRUE; |
} |
switch (sec->compress_status) |
{ |
183,6 → 249,7 |
if (p == NULL) |
return FALSE; |
} |
if (!bfd_get_section_contents (abfd, sec, p, 0, sz)) |
{ |
if (*ptr != p) |
193,10 → 260,6 |
return TRUE; |
case DECOMPRESS_SECTION_SIZED: |
#ifndef HAVE_ZLIB_H |
bfd_set_error (bfd_error_invalid_operation); |
return FALSE; |
#else |
/* Read in the full compressed section contents. */ |
compressed_buffer = (bfd_byte *) bfd_malloc (sec->compressed_size); |
if (compressed_buffer == NULL) |
223,7 → 286,13 |
if (p == NULL) |
goto fail_compressed; |
if (!decompress_contents (compressed_buffer, sec->compressed_size, p, sz)) |
compression_header_size = bfd_get_compression_header_size (abfd, sec); |
if (compression_header_size == 0) |
/* Set header size to the zlib header size if it is a |
SHF_COMPRESSED section. */ |
compression_header_size = 12; |
if (!decompress_contents (compressed_buffer + compression_header_size, |
sec->compressed_size, p, sz)) |
{ |
bfd_set_error (bfd_error_bad_value); |
if (p != *ptr) |
236,9 → 305,10 |
free (compressed_buffer); |
*ptr = p; |
return TRUE; |
#endif |
case COMPRESS_SECTION_DONE: |
if (sec->contents == NULL) |
return FALSE; |
if (p == NULL) |
{ |
p = (bfd_byte *) bfd_malloc (sz); |
246,6 → 316,8 |
return FALSE; |
*ptr = p; |
} |
/* PR 17512; file: 5bc29788. */ |
if (p != sec->contents) |
memcpy (p, sec->contents, sz); |
return TRUE; |
276,41 → 348,108 |
sec->flags |= SEC_IN_MEMORY; |
} |
/* |
FUNCTION |
bfd_is_section_compressed |
bfd_is_section_compressed_with_header |
SYNOPSIS |
bfd_boolean bfd_is_section_compressed |
(bfd *abfd, asection *section); |
bfd_boolean bfd_is_section_compressed_with_header |
(bfd *abfd, asection *section, |
int *compression_header_size_p, |
bfd_size_type *uncompressed_size_p); |
DESCRIPTION |
Return @code{TRUE} if @var{section} is compressed. |
Return @code{TRUE} if @var{section} is compressed. Compression |
header size is returned in @var{compression_header_size_p} and |
uncompressed size is returned in @var{uncompressed_size_p}. If |
compression is unsupported, compression header size is returned |
with -1 and uncompressed size is returned with 0. |
*/ |
bfd_boolean |
bfd_is_section_compressed (bfd *abfd, sec_ptr sec) |
bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec, |
int *compression_header_size_p, |
bfd_size_type *uncompressed_size_p) |
{ |
bfd_byte compressed_buffer [12]; |
bfd_byte header[MAX_COMPRESSION_HEADER_SIZE]; |
int compression_header_size; |
int header_size; |
unsigned int saved = sec->compress_status; |
bfd_boolean compressed; |
compression_header_size = bfd_get_compression_header_size (abfd, sec); |
if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE) |
abort (); |
header_size = compression_header_size ? compression_header_size : 12; |
/* Don't decompress the section. */ |
sec->compress_status = COMPRESS_SECTION_NONE; |
/* Read the zlib header. In this case, it should be "ZLIB" followed |
by the uncompressed section size, 8 bytes in big-endian order. */ |
compressed = (bfd_get_section_contents (abfd, sec, compressed_buffer, 0, 12) |
&& CONST_STRNEQ ((char*) compressed_buffer, "ZLIB")); |
/* Read the header. */ |
if (bfd_get_section_contents (abfd, sec, header, 0, header_size)) |
{ |
if (compression_header_size == 0) |
/* In this case, it should be "ZLIB" followed by the uncompressed |
section size, 8 bytes in big-endian order. */ |
compressed = CONST_STRNEQ ((char*) header , "ZLIB"); |
else |
compressed = TRUE; |
} |
else |
compressed = FALSE; |
*uncompressed_size_p = sec->size; |
if (compressed) |
{ |
if (compression_header_size != 0) |
{ |
if (!bfd_check_compression_header (abfd, header, sec, |
uncompressed_size_p)) |
compression_header_size = -1; |
} |
/* Check for the pathalogical case of a debug string section that |
contains the string ZLIB.... as the first entry. We assume that |
no uncompressed .debug_str section would ever be big enough to |
have the first byte of its (big-endian) size be non-zero. */ |
else if (strcmp (sec->name, ".debug_str") == 0 |
&& ISPRINT (header[4])) |
compressed = FALSE; |
else |
*uncompressed_size_p = bfd_getb64 (header + 4); |
} |
/* Restore compress_status. */ |
sec->compress_status = saved; |
*compression_header_size_p = compression_header_size; |
return compressed; |
} |
/* |
FUNCTION |
bfd_is_section_compressed |
SYNOPSIS |
bfd_boolean bfd_is_section_compressed |
(bfd *abfd, asection *section); |
DESCRIPTION |
Return @code{TRUE} if @var{section} is compressed. |
*/ |
bfd_boolean |
bfd_is_section_compressed (bfd *abfd, sec_ptr sec) |
{ |
int compression_header_size; |
bfd_size_type uncompressed_size; |
return (bfd_is_section_compressed_with_header (abfd, sec, |
&compression_header_size, |
&uncompressed_size) |
&& compression_header_size >= 0 |
&& uncompressed_size > 0); |
} |
/* |
FUNCTION |
bfd_init_section_decompress_status |
SYNOPSIS |
323,53 → 462,55 |
DECOMPRESS_SECTION_SIZED. |
Return @code{FALSE} if the section is not a valid compressed |
section or zlib is not installed on this machine. Otherwise, |
return @code{TRUE}. |
section. Otherwise, return @code{TRUE}. |
*/ |
bfd_boolean |
bfd_init_section_decompress_status (bfd *abfd ATTRIBUTE_UNUSED, |
sec_ptr sec ATTRIBUTE_UNUSED) |
bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec) |
{ |
#ifndef HAVE_ZLIB_H |
bfd_set_error (bfd_error_invalid_operation); |
return FALSE; |
#else |
bfd_byte compressed_buffer [12]; |
bfd_byte header[MAX_COMPRESSION_HEADER_SIZE]; |
int compression_header_size; |
int header_size; |
bfd_size_type uncompressed_size; |
compression_header_size = bfd_get_compression_header_size (abfd, sec); |
if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE) |
abort (); |
header_size = compression_header_size ? compression_header_size : 12; |
/* Read the header. */ |
if (sec->rawsize != 0 |
|| sec->contents != NULL |
|| sec->compress_status != COMPRESS_SECTION_NONE |
|| !bfd_get_section_contents (abfd, sec, compressed_buffer, 0, 12)) |
|| !bfd_get_section_contents (abfd, sec, header, 0, header_size)) |
{ |
bfd_set_error (bfd_error_invalid_operation); |
return FALSE; |
} |
/* Read the zlib header. In this case, it should be "ZLIB" followed |
by the uncompressed section size, 8 bytes in big-endian order. */ |
if (! CONST_STRNEQ ((char*) compressed_buffer, "ZLIB")) |
if (compression_header_size == 0) |
{ |
/* In this case, it should be "ZLIB" followed by the uncompressed |
section size, 8 bytes in big-endian order. */ |
if (! CONST_STRNEQ ((char*) header, "ZLIB")) |
{ |
bfd_set_error (bfd_error_wrong_format); |
return FALSE; |
} |
uncompressed_size = bfd_getb64 (header + 4); |
} |
else if (!bfd_check_compression_header (abfd, header, sec, |
&uncompressed_size)) |
{ |
bfd_set_error (bfd_error_wrong_format); |
return FALSE; |
} |
uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8; |
uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8; |
uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8; |
uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8; |
uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8; |
uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8; |
uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8; |
uncompressed_size += compressed_buffer[11]; |
sec->compressed_size = sec->size; |
sec->size = uncompressed_size; |
sec->compress_status = DECOMPRESS_SECTION_SIZED; |
return TRUE; |
#endif |
} |
/* |
385,18 → 526,12 |
compressed size and set compress_status to COMPRESS_SECTION_DONE. |
Return @code{FALSE} if the section is not a valid compressed |
section or zlib is not installed on this machine. Otherwise, |
return @code{TRUE}. |
section. Otherwise, return @code{TRUE}. |
*/ |
bfd_boolean |
bfd_init_section_compress_status (bfd *abfd ATTRIBUTE_UNUSED, |
sec_ptr sec ATTRIBUTE_UNUSED) |
bfd_init_section_compress_status (bfd *abfd, sec_ptr sec) |
{ |
#ifndef HAVE_ZLIB_H |
bfd_set_error (bfd_error_invalid_operation); |
return FALSE; |
#else |
bfd_size_type uncompressed_size; |
bfd_byte *uncompressed_buffer; |
bfd_boolean ret; |
419,11 → 554,50 |
0, uncompressed_size)) |
ret = FALSE; |
else |
ret = bfd_compress_section_contents (abfd, sec, |
{ |
uncompressed_size = bfd_compress_section_contents (abfd, sec, |
uncompressed_buffer, |
uncompressed_size); |
ret = uncompressed_size != 0; |
} |
free (uncompressed_buffer); |
return ret; |
#endif |
} |
/* |
FUNCTION |
bfd_compress_section |
SYNOPSIS |
bfd_boolean bfd_compress_section |
(bfd *abfd, asection *section, bfd_byte *uncompressed_buffer); |
DESCRIPTION |
If open for write, compress section, update section size with |
compressed size and set compress_status to COMPRESS_SECTION_DONE. |
Return @code{FALSE} if compression fail. Otherwise, return |
@code{TRUE}. |
*/ |
bfd_boolean |
bfd_compress_section (bfd *abfd, sec_ptr sec, bfd_byte *uncompressed_buffer) |
{ |
bfd_size_type uncompressed_size = sec->size; |
/* Error if not opened for write. */ |
if (abfd->direction != write_direction |
|| uncompressed_size == 0 |
|| uncompressed_buffer == NULL |
|| sec->contents != NULL |
|| sec->compressed_size != 0 |
|| sec->compress_status != COMPRESS_SECTION_NONE) |
{ |
bfd_set_error (bfd_error_invalid_operation); |
return FALSE; |
} |
/* Compress it. */ |
return bfd_compress_section_contents (abfd, sec, uncompressed_buffer, |
uncompressed_size) != 0; |
} |
/contrib/toolchain/binutils/bfd/config.h |
---|
1,5 → 1,5 |
/* config.h. Generated from config.in by configure. */ |
/* config.in. Generated from configure.in by autoheader. */ |
/* config.in. Generated from configure.ac by autoheader. */ |
/* Check that config.h is #included before system headers |
(this works only for glibc, but that should be enough). */ |
16,11 → 16,15 |
/* #undef ENABLE_NLS */ |
/* Define to 1 if you have the <alloca.h> header file. */ |
/* #undef HAVE_ALLOCA_H */ |
#define HAVE_ALLOCA_H 1 |
/* Define to 1 if you have the declaration of `asprintf', and to 0 if you |
don't. */ |
#define HAVE_DECL_ASPRINTF 0 |
/* Define to 1 if you have the declaration of `basename', and to 0 if you |
don't. */ |
#define HAVE_DECL_BASENAME 0 |
#define HAVE_DECL_BASENAME 1 |
/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */ |
#define HAVE_DECL_FFS 0 |
65,10 → 69,18 |
*/ |
#define HAVE_DECL_STPCPY 0 |
/* Define to 1 if you have the declaration of `strnlen', and to 0 if you |
don't. */ |
#define HAVE_DECL_STRNLEN 0 |
/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't. |
*/ |
#define HAVE_DECL_STRSTR 1 |
/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you |
don't. */ |
#define HAVE_DECL_VASPRINTF 0 |
/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you |
don't. */ |
#define HAVE_DECL_VSNPRINTF 1 |
279,7 → 291,7 |
#define PACKAGE_NAME "bfd" |
/* Define to the full name and version of this package. */ |
#define PACKAGE_STRING "bfd 2.24" |
#define PACKAGE_STRING "bfd 2.26" |
/* Define to the one symbol short name of this package. */ |
#define PACKAGE_TARNAME "bfd" |
288,7 → 300,7 |
#define PACKAGE_URL "" |
/* Define to the version of this package. */ |
#define PACKAGE_VERSION "2.24" |
#define PACKAGE_VERSION "2.26" |
/* The size of `char', as computed by sizeof. */ |
/* #undef SIZEOF_CHAR */ |
361,7 → 373,7 |
/* Version number of package */ |
#define VERSION "2.24" |
#define VERSION "2.26" |
/* Number of bits in a file offset, on hosts where this is settable. */ |
/* #undef _FILE_OFFSET_BITS */ |
/contrib/toolchain/binutils/bfd/corefile.c |
---|
1,6 → 1,5 |
/* Core file generic interface routines for BFD. |
Copyright 1990, 1991, 1992, 1993, 1994, 2000, 2001, 2002, 2003, 2005, |
2007 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
/contrib/toolchain/binutils/bfd/cpu-i386.c |
---|
1,7 → 1,5 |
/* BFD support for the Intel 386 architecture. |
Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004, 2005, |
2007, 2009, 2010, 2011, 2013 |
Free Software Foundation, Inc. |
Copyright (C) 1992-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
/contrib/toolchain/binutils/bfd/dwarf1.c |
---|
1,6 → 1,5 |
/* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line). |
Copyright 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2007, 2008, 2009, 2010 |
Free Software Foundation, Inc. |
Copyright (C) 1998-2015 Free Software Foundation, Inc. |
Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com). |
450,8 → 449,8 |
bfd_boolean |
_bfd_dwarf1_find_nearest_line (bfd *abfd, |
asymbol **symbols, |
asection *section, |
asymbol **symbols, |
bfd_vma offset, |
const char **filename_ptr, |
const char **functionname_ptr, |
/contrib/toolchain/binutils/bfd/dwarf2.c |
---|
1,5 → 1,5 |
/* DWARF 2 support. |
Copyright 1994-2013 Free Software Foundation, Inc. |
Copyright (C) 1994-2015 Free Software Foundation, Inc. |
Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions |
(gavin@cygnus.com). |
156,8 → 156,11 |
use. */ |
struct funcinfo *inliner_chain; |
/* Section VMAs at the time the stash was built. */ |
bfd_vma *sec_vma; |
/* Number of sections whose VMA we must adjust. */ |
unsigned int adjusted_section_count; |
int adjusted_section_count; |
/* Array of sections with adjusted VMA. */ |
struct adjusted_section *adjusted_sections; |
219,6 → 222,9 |
/* The abbrev hash table. */ |
struct abbrev_info **abbrevs; |
/* DW_AT_language. */ |
int lang; |
/* Note that an error was found by comp_unit_find_nearest_line. */ |
int error; |
550,39 → 556,45 |
return TRUE; |
} |
/* VERBATIM |
The following function up to the END VERBATIM mark are |
copied directly from dwarf2read.c. */ |
/* Read dwarf information from a buffer. */ |
static unsigned int |
read_1_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf) |
read_1_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf, bfd_byte *end) |
{ |
if (buf + 1 > end) |
return 0; |
return bfd_get_8 (abfd, buf); |
} |
static int |
read_1_signed_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf) |
read_1_signed_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf, bfd_byte *end) |
{ |
if (buf + 1 > end) |
return 0; |
return bfd_get_signed_8 (abfd, buf); |
} |
static unsigned int |
read_2_bytes (bfd *abfd, bfd_byte *buf) |
read_2_bytes (bfd *abfd, bfd_byte *buf, bfd_byte *end) |
{ |
if (buf + 2 > end) |
return 0; |
return bfd_get_16 (abfd, buf); |
} |
static unsigned int |
read_4_bytes (bfd *abfd, bfd_byte *buf) |
read_4_bytes (bfd *abfd, bfd_byte *buf, bfd_byte *end) |
{ |
if (buf + 4 > end) |
return 0; |
return bfd_get_32 (abfd, buf); |
} |
static bfd_uint64_t |
read_8_bytes (bfd *abfd, bfd_byte *buf) |
read_8_bytes (bfd *abfd, bfd_byte *buf, bfd_byte *end) |
{ |
if (buf + 8 > end) |
return 0; |
return bfd_get_64 (abfd, buf); |
} |
589,19 → 601,34 |
static bfd_byte * |
read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED, |
bfd_byte *buf, |
bfd_byte *end, |
unsigned int size ATTRIBUTE_UNUSED) |
{ |
if (buf + size > end) |
return NULL; |
return buf; |
} |
/* Scans a NUL terminated string starting at BUF, returning a pointer to it. |
Returns the number of characters in the string, *including* the NUL byte, |
in BYTES_READ_PTR. This value is set even if the function fails. Bytes |
at or beyond BUF_END will not be read. Returns NULL if there was a |
problem, or if the string is empty. */ |
static char * |
read_string (bfd *abfd ATTRIBUTE_UNUSED, |
bfd_byte *buf, |
bfd_byte * buf_end, |
unsigned int *bytes_read_ptr) |
{ |
/* Return a pointer to the embedded string. */ |
char *str = (char *) buf; |
bfd_byte *str = buf; |
if (buf >= buf_end) |
{ |
* bytes_read_ptr = 0; |
return NULL; |
} |
if (*str == '\0') |
{ |
*bytes_read_ptr = 1; |
608,15 → 635,29 |
return NULL; |
} |
*bytes_read_ptr = strlen (str) + 1; |
return str; |
while (buf < buf_end) |
if (* buf ++ == 0) |
{ |
* bytes_read_ptr = buf - str; |
return (char *) str; |
} |
/* END VERBATIM */ |
* bytes_read_ptr = buf - str; |
return NULL; |
} |
/* Reads an offset from BUF and then locates the string at this offset |
inside the debug string section. Returns a pointer to the string. |
Returns the number of bytes read from BUF, *not* the length of the string, |
in BYTES_READ_PTR. This value is set even if the function fails. Bytes |
at or beyond BUF_END will not be read from BUF. Returns NULL if there was |
a problem, or if the string is empty. Does not check for NUL termination |
of the string. */ |
static char * |
read_indirect_string (struct comp_unit * unit, |
bfd_byte * buf, |
bfd_byte * buf_end, |
unsigned int * bytes_read_ptr) |
{ |
bfd_uint64_t offset; |
623,10 → 664,16 |
struct dwarf2_debug *stash = unit->stash; |
char *str; |
if (buf + unit->offset_size > buf_end) |
{ |
* bytes_read_ptr = 0; |
return NULL; |
} |
if (unit->offset_size == 4) |
offset = read_4_bytes (unit->abfd, buf); |
offset = read_4_bytes (unit->abfd, buf, buf_end); |
else |
offset = read_8_bytes (unit->abfd, buf); |
offset = read_8_bytes (unit->abfd, buf, buf_end); |
*bytes_read_ptr = unit->offset_size; |
635,6 → 682,8 |
&stash->dwarf_str_buffer, &stash->dwarf_str_size)) |
return NULL; |
if (offset >= stash->dwarf_str_size) |
return NULL; |
str = (char *) stash->dwarf_str_buffer + offset; |
if (*str == '\0') |
return NULL; |
642,12 → 691,13 |
} |
/* Like read_indirect_string but uses a .debug_str located in |
an alternate filepointed to by the .gnu_debuglink section. |
an alternate file pointed to by the .gnu_debugaltlink section. |
Used to impement DW_FORM_GNU_strp_alt. */ |
static char * |
read_alt_indirect_string (struct comp_unit * unit, |
bfd_byte * buf, |
bfd_byte * buf_end, |
unsigned int * bytes_read_ptr) |
{ |
bfd_uint64_t offset; |
654,10 → 704,16 |
struct dwarf2_debug *stash = unit->stash; |
char *str; |
if (buf + unit->offset_size > buf_end) |
{ |
* bytes_read_ptr = 0; |
return NULL; |
} |
if (unit->offset_size == 4) |
offset = read_4_bytes (unit->abfd, buf); |
offset = read_4_bytes (unit->abfd, buf, buf_end); |
else |
offset = read_8_bytes (unit->abfd, buf); |
offset = read_8_bytes (unit->abfd, buf, buf_end); |
*bytes_read_ptr = unit->offset_size; |
690,6 → 746,8 |
&stash->alt_dwarf_str_size)) |
return NULL; |
if (offset >= stash->alt_dwarf_str_size) |
return NULL; |
str = (char *) stash->alt_dwarf_str_buffer + offset; |
if (*str == '\0') |
return NULL; |
736,14 → 794,22 |
&stash->alt_dwarf_info_size)) |
return NULL; |
if (offset >= stash->alt_dwarf_info_size) |
return NULL; |
return stash->alt_dwarf_info_buffer + offset; |
} |
static bfd_uint64_t |
read_address (struct comp_unit *unit, bfd_byte *buf) |
read_address (struct comp_unit *unit, bfd_byte *buf, bfd_byte * buf_end) |
{ |
int signed_vma = get_elf_backend_data (unit->abfd)->sign_extend_vma; |
int signed_vma = 0; |
if (bfd_get_flavour (unit->abfd) == bfd_target_elf_flavour) |
signed_vma = get_elf_backend_data (unit->abfd)->sign_extend_vma; |
if (buf + unit->addr_size > buf_end) |
return 0; |
if (signed_vma) |
{ |
switch (unit->addr_size) |
806,6 → 872,7 |
{ |
struct abbrev_info **abbrevs; |
bfd_byte *abbrev_ptr; |
bfd_byte *abbrev_end; |
struct abbrev_info *cur_abbrev; |
unsigned int abbrev_number, bytes_read, abbrev_name; |
unsigned int abbrev_form, hash_number; |
816,6 → 883,9 |
&stash->dwarf_abbrev_buffer, &stash->dwarf_abbrev_size)) |
return NULL; |
if (offset >= stash->dwarf_abbrev_size) |
return NULL; |
amt = sizeof (struct abbrev_info*) * ABBREV_HASH_SIZE; |
abbrevs = (struct abbrev_info **) bfd_zalloc (abfd, amt); |
if (abbrevs == NULL) |
822,7 → 892,8 |
return NULL; |
abbrev_ptr = stash->dwarf_abbrev_buffer + offset; |
abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); |
abbrev_end = stash->dwarf_abbrev_buffer + stash->dwarf_abbrev_size; |
abbrev_number = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); |
abbrev_ptr += bytes_read; |
/* Loop until we reach an abbrev number of 0. */ |
836,15 → 907,15 |
/* Read in abbrev header. */ |
cur_abbrev->number = abbrev_number; |
cur_abbrev->tag = (enum dwarf_tag) |
read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); |
safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); |
abbrev_ptr += bytes_read; |
cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr); |
cur_abbrev->has_children = read_1_byte (abfd, abbrev_ptr, abbrev_end); |
abbrev_ptr += 1; |
/* Now read in declarations. */ |
abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); |
abbrev_name = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); |
abbrev_ptr += bytes_read; |
abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); |
abbrev_form = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); |
abbrev_ptr += bytes_read; |
while (abbrev_name) |
879,9 → 950,9 |
= (enum dwarf_attribute) abbrev_name; |
cur_abbrev->attrs[cur_abbrev->num_attrs++].form |
= (enum dwarf_form) abbrev_form; |
abbrev_name = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); |
abbrev_name = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); |
abbrev_ptr += bytes_read; |
abbrev_form = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); |
abbrev_form = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); |
abbrev_ptr += bytes_read; |
} |
899,7 → 970,7 |
if ((unsigned int) (abbrev_ptr - stash->dwarf_abbrev_buffer) |
>= stash->dwarf_abbrev_size) |
break; |
abbrev_number = read_unsigned_leb128 (abfd, abbrev_ptr, &bytes_read); |
abbrev_number = safe_read_leb128 (abfd, abbrev_ptr, &bytes_read, FALSE, abbrev_end); |
abbrev_ptr += bytes_read; |
if (lookup_abbrev (abbrev_number,abbrevs) != NULL) |
break; |
908,13 → 979,24 |
return abbrevs; |
} |
/* Read an attribute value described by an attribute form. */ |
/* Returns true if the form is one which has a string value. */ |
static inline bfd_boolean |
is_str_attr (enum dwarf_form form) |
{ |
return form == DW_FORM_string || form == DW_FORM_strp || form == DW_FORM_GNU_strp_alt; |
} |
/* Read and fill in the value of attribute ATTR as described by FORM. |
Read data starting from INFO_PTR, but never at or beyond INFO_PTR_END. |
Returns an updated INFO_PTR taking into account the amount of data read. */ |
static bfd_byte * |
read_attribute_value (struct attribute *attr, |
unsigned form, |
struct comp_unit *unit, |
bfd_byte *info_ptr) |
bfd_byte * info_ptr, |
bfd_byte * info_ptr_end) |
{ |
bfd *abfd = unit->abfd; |
unsigned int bytes_read; |
921,6 → 1003,13 |
struct dwarf_block *blk; |
bfd_size_type amt; |
if (info_ptr >= info_ptr_end) |
{ |
(*_bfd_error_handler) (_("Dwarf Error: Info pointer extends beyond end of attributes")); |
bfd_set_error (bfd_error_bad_value); |
return info_ptr; |
} |
attr->form = (enum dwarf_form) form; |
switch (form) |
931,23 → 1020,23 |
if (unit->version == 3 || unit->version == 4) |
{ |
if (unit->offset_size == 4) |
attr->u.val = read_4_bytes (unit->abfd, info_ptr); |
attr->u.val = read_4_bytes (unit->abfd, info_ptr, info_ptr_end); |
else |
attr->u.val = read_8_bytes (unit->abfd, info_ptr); |
attr->u.val = read_8_bytes (unit->abfd, info_ptr, info_ptr_end); |
info_ptr += unit->offset_size; |
break; |
} |
/* FALLTHROUGH */ |
case DW_FORM_addr: |
attr->u.val = read_address (unit, info_ptr); |
attr->u.val = read_address (unit, info_ptr, info_ptr_end); |
info_ptr += unit->addr_size; |
break; |
case DW_FORM_GNU_ref_alt: |
case DW_FORM_sec_offset: |
if (unit->offset_size == 4) |
attr->u.val = read_4_bytes (unit->abfd, info_ptr); |
attr->u.val = read_4_bytes (unit->abfd, info_ptr, info_ptr_end); |
else |
attr->u.val = read_8_bytes (unit->abfd, info_ptr); |
attr->u.val = read_8_bytes (unit->abfd, info_ptr, info_ptr_end); |
info_ptr += unit->offset_size; |
break; |
case DW_FORM_block2: |
955,9 → 1044,9 |
blk = (struct dwarf_block *) bfd_alloc (abfd, amt); |
if (blk == NULL) |
return NULL; |
blk->size = read_2_bytes (abfd, info_ptr); |
blk->size = read_2_bytes (abfd, info_ptr, info_ptr_end); |
info_ptr += 2; |
blk->data = read_n_bytes (abfd, info_ptr, blk->size); |
blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size); |
info_ptr += blk->size; |
attr->u.blk = blk; |
break; |
966,34 → 1055,34 |
blk = (struct dwarf_block *) bfd_alloc (abfd, amt); |
if (blk == NULL) |
return NULL; |
blk->size = read_4_bytes (abfd, info_ptr); |
blk->size = read_4_bytes (abfd, info_ptr, info_ptr_end); |
info_ptr += 4; |
blk->data = read_n_bytes (abfd, info_ptr, blk->size); |
blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size); |
info_ptr += blk->size; |
attr->u.blk = blk; |
break; |
case DW_FORM_data2: |
attr->u.val = read_2_bytes (abfd, info_ptr); |
attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end); |
info_ptr += 2; |
break; |
case DW_FORM_data4: |
attr->u.val = read_4_bytes (abfd, info_ptr); |
attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); |
info_ptr += 4; |
break; |
case DW_FORM_data8: |
attr->u.val = read_8_bytes (abfd, info_ptr); |
attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end); |
info_ptr += 8; |
break; |
case DW_FORM_string: |
attr->u.str = read_string (abfd, info_ptr, &bytes_read); |
attr->u.str = read_string (abfd, info_ptr, info_ptr_end, &bytes_read); |
info_ptr += bytes_read; |
break; |
case DW_FORM_strp: |
attr->u.str = read_indirect_string (unit, info_ptr, &bytes_read); |
attr->u.str = read_indirect_string (unit, info_ptr, info_ptr_end, &bytes_read); |
info_ptr += bytes_read; |
break; |
case DW_FORM_GNU_strp_alt: |
attr->u.str = read_alt_indirect_string (unit, info_ptr, &bytes_read); |
attr->u.str = read_alt_indirect_string (unit, info_ptr, info_ptr_end, &bytes_read); |
info_ptr += bytes_read; |
break; |
case DW_FORM_exprloc: |
1002,9 → 1091,9 |
blk = (struct dwarf_block *) bfd_alloc (abfd, amt); |
if (blk == NULL) |
return NULL; |
blk->size = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); |
blk->size = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end); |
info_ptr += bytes_read; |
blk->data = read_n_bytes (abfd, info_ptr, blk->size); |
blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size); |
info_ptr += blk->size; |
attr->u.blk = blk; |
break; |
1013,18 → 1102,18 |
blk = (struct dwarf_block *) bfd_alloc (abfd, amt); |
if (blk == NULL) |
return NULL; |
blk->size = read_1_byte (abfd, info_ptr); |
blk->size = read_1_byte (abfd, info_ptr, info_ptr_end); |
info_ptr += 1; |
blk->data = read_n_bytes (abfd, info_ptr, blk->size); |
blk->data = read_n_bytes (abfd, info_ptr, info_ptr_end, blk->size); |
info_ptr += blk->size; |
attr->u.blk = blk; |
break; |
case DW_FORM_data1: |
attr->u.val = read_1_byte (abfd, info_ptr); |
attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); |
info_ptr += 1; |
break; |
case DW_FORM_flag: |
attr->u.val = read_1_byte (abfd, info_ptr); |
attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); |
info_ptr += 1; |
break; |
case DW_FORM_flag_present: |
1031,41 → 1120,41 |
attr->u.val = 1; |
break; |
case DW_FORM_sdata: |
attr->u.sval = read_signed_leb128 (abfd, info_ptr, &bytes_read); |
attr->u.sval = safe_read_leb128 (abfd, info_ptr, &bytes_read, TRUE, info_ptr_end); |
info_ptr += bytes_read; |
break; |
case DW_FORM_udata: |
attr->u.val = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); |
attr->u.val = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end); |
info_ptr += bytes_read; |
break; |
case DW_FORM_ref1: |
attr->u.val = read_1_byte (abfd, info_ptr); |
attr->u.val = read_1_byte (abfd, info_ptr, info_ptr_end); |
info_ptr += 1; |
break; |
case DW_FORM_ref2: |
attr->u.val = read_2_bytes (abfd, info_ptr); |
attr->u.val = read_2_bytes (abfd, info_ptr, info_ptr_end); |
info_ptr += 2; |
break; |
case DW_FORM_ref4: |
attr->u.val = read_4_bytes (abfd, info_ptr); |
attr->u.val = read_4_bytes (abfd, info_ptr, info_ptr_end); |
info_ptr += 4; |
break; |
case DW_FORM_ref8: |
attr->u.val = read_8_bytes (abfd, info_ptr); |
attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end); |
info_ptr += 8; |
break; |
case DW_FORM_ref_sig8: |
attr->u.val = read_8_bytes (abfd, info_ptr); |
attr->u.val = read_8_bytes (abfd, info_ptr, info_ptr_end); |
info_ptr += 8; |
break; |
case DW_FORM_ref_udata: |
attr->u.val = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); |
attr->u.val = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end); |
info_ptr += bytes_read; |
break; |
case DW_FORM_indirect: |
form = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); |
form = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end); |
info_ptr += bytes_read; |
info_ptr = read_attribute_value (attr, form, unit, info_ptr); |
info_ptr = read_attribute_value (attr, form, unit, info_ptr, info_ptr_end); |
break; |
default: |
(*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM value: %#x."), |
1082,13 → 1171,41 |
read_attribute (struct attribute *attr, |
struct attr_abbrev *abbrev, |
struct comp_unit *unit, |
bfd_byte *info_ptr) |
bfd_byte * info_ptr, |
bfd_byte * info_ptr_end) |
{ |
attr->name = abbrev->name; |
info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr); |
info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr, info_ptr_end); |
return info_ptr; |
} |
/* Return whether DW_AT_name will return the same as DW_AT_linkage_name |
for a function. */ |
static bfd_boolean |
non_mangled (int lang) |
{ |
switch (lang) |
{ |
default: |
return FALSE; |
case DW_LANG_C89: |
case DW_LANG_C: |
case DW_LANG_Ada83: |
case DW_LANG_Cobol74: |
case DW_LANG_Cobol85: |
case DW_LANG_Fortran77: |
case DW_LANG_Pascal83: |
case DW_LANG_C99: |
case DW_LANG_Ada95: |
case DW_LANG_PLI: |
case DW_LANG_UPC: |
case DW_LANG_C11: |
return TRUE; |
} |
} |
/* Source line information table routines. */ |
#define FILE_ALLOC_CHUNK 5 |
1147,14 → 1264,15 |
struct funcinfo *caller_func; |
/* Source location file name where caller_func inlines this func. */ |
char *caller_file; |
/* Source location file name. */ |
char *file; |
/* Source location line number where caller_func inlines this func. */ |
int caller_line; |
/* Source location file name. */ |
char *file; |
/* Source location line number. */ |
int line; |
int tag; |
char *name; |
bfd_boolean is_linkage; |
const char *name; |
struct arange arange; |
/* Where the symbol is defined. */ |
asection *sec; |
1342,7 → 1460,11 |
char *name; |
size_t len; |
if (table->files[file - 1].dir) |
if (table->files[file - 1].dir |
/* PR 17512: file: 0317e960. */ |
&& table->files[file - 1].dir <= table->num_dirs |
/* PR 17512: file: 7f3d2e4b. */ |
&& table->dirs != NULL) |
subdir_name = table->dirs[table->files[file - 1].dir - 1]; |
if (!subdir_name || !IS_ABSOLUTE_PATH (subdir_name)) |
1563,15 → 1685,24 |
table->lcl_head = NULL; |
if (stash->dwarf_line_size < 16) |
{ |
(*_bfd_error_handler) |
(_("Dwarf Error: Line info section is too small (%ld)"), |
(long) stash->dwarf_line_size); |
bfd_set_error (bfd_error_bad_value); |
return NULL; |
} |
line_ptr = stash->dwarf_line_buffer + unit->line_offset; |
line_end = stash->dwarf_line_buffer + stash->dwarf_line_size; |
/* Read in the prologue. */ |
lh.total_length = read_4_bytes (abfd, line_ptr); |
lh.total_length = read_4_bytes (abfd, line_ptr, line_end); |
line_ptr += 4; |
offset_size = 4; |
if (lh.total_length == 0xffffffff) |
{ |
lh.total_length = read_8_bytes (abfd, line_ptr); |
lh.total_length = read_8_bytes (abfd, line_ptr, line_end); |
line_ptr += 8; |
offset_size = 8; |
} |
1578,12 → 1709,23 |
else if (lh.total_length == 0 && unit->addr_size == 8) |
{ |
/* Handle (non-standard) 64-bit DWARF2 formats. */ |
lh.total_length = read_4_bytes (abfd, line_ptr); |
lh.total_length = read_4_bytes (abfd, line_ptr, line_end); |
line_ptr += 4; |
offset_size = 8; |
} |
if (lh.total_length > stash->dwarf_line_size) |
{ |
(*_bfd_error_handler) |
(_("Dwarf Error: Line info data is bigger (0x%lx) than the section (0x%lx)"), |
(long) lh.total_length, (long) stash->dwarf_line_size); |
bfd_set_error (bfd_error_bad_value); |
return NULL; |
} |
line_end = line_ptr + lh.total_length; |
lh.version = read_2_bytes (abfd, line_ptr); |
lh.version = read_2_bytes (abfd, line_ptr, line_end); |
if (lh.version < 2 || lh.version > 4) |
{ |
(*_bfd_error_handler) |
1592,20 → 1734,32 |
return NULL; |
} |
line_ptr += 2; |
if (line_ptr + offset_size + (lh.version >=4 ? 6 : 5) >= line_end) |
{ |
(*_bfd_error_handler) |
(_("Dwarf Error: Ran out of room reading prologue")); |
bfd_set_error (bfd_error_bad_value); |
return NULL; |
} |
if (offset_size == 4) |
lh.prologue_length = read_4_bytes (abfd, line_ptr); |
lh.prologue_length = read_4_bytes (abfd, line_ptr, line_end); |
else |
lh.prologue_length = read_8_bytes (abfd, line_ptr); |
lh.prologue_length = read_8_bytes (abfd, line_ptr, line_end); |
line_ptr += offset_size; |
lh.minimum_instruction_length = read_1_byte (abfd, line_ptr); |
lh.minimum_instruction_length = read_1_byte (abfd, line_ptr, line_end); |
line_ptr += 1; |
if (lh.version >= 4) |
{ |
lh.maximum_ops_per_insn = read_1_byte (abfd, line_ptr); |
lh.maximum_ops_per_insn = read_1_byte (abfd, line_ptr, line_end); |
line_ptr += 1; |
} |
else |
lh.maximum_ops_per_insn = 1; |
if (lh.maximum_ops_per_insn == 0) |
{ |
(*_bfd_error_handler) |
1613,14 → 1767,26 |
bfd_set_error (bfd_error_bad_value); |
return NULL; |
} |
lh.default_is_stmt = read_1_byte (abfd, line_ptr); |
lh.default_is_stmt = read_1_byte (abfd, line_ptr, line_end); |
line_ptr += 1; |
lh.line_base = read_1_signed_byte (abfd, line_ptr); |
lh.line_base = read_1_signed_byte (abfd, line_ptr, line_end); |
line_ptr += 1; |
lh.line_range = read_1_byte (abfd, line_ptr); |
lh.line_range = read_1_byte (abfd, line_ptr, line_end); |
line_ptr += 1; |
lh.opcode_base = read_1_byte (abfd, line_ptr); |
lh.opcode_base = read_1_byte (abfd, line_ptr, line_end); |
line_ptr += 1; |
if (line_ptr + (lh.opcode_base - 1) >= line_end) |
{ |
(*_bfd_error_handler) (_("Dwarf Error: Ran out of room reading opcodes")); |
bfd_set_error (bfd_error_bad_value); |
return NULL; |
} |
amt = lh.opcode_base * sizeof (unsigned char); |
lh.standard_opcode_lengths = (unsigned char *) bfd_alloc (abfd, amt); |
1628,12 → 1794,12 |
for (i = 1; i < lh.opcode_base; ++i) |
{ |
lh.standard_opcode_lengths[i] = read_1_byte (abfd, line_ptr); |
lh.standard_opcode_lengths[i] = read_1_byte (abfd, line_ptr, line_end); |
line_ptr += 1; |
} |
/* Read directory table. */ |
while ((cur_dir = read_string (abfd, line_ptr, &bytes_read)) != NULL) |
while ((cur_dir = read_string (abfd, line_ptr, line_end, &bytes_read)) != NULL) |
{ |
line_ptr += bytes_read; |
1656,7 → 1822,7 |
line_ptr += bytes_read; |
/* Read file name table. */ |
while ((cur_file = read_string (abfd, line_ptr, &bytes_read)) != NULL) |
while ((cur_file = read_string (abfd, line_ptr, line_end, &bytes_read)) != NULL) |
{ |
line_ptr += bytes_read; |
1675,13 → 1841,11 |
table->files[table->num_files].name = cur_file; |
table->files[table->num_files].dir = |
read_unsigned_leb128 (abfd, line_ptr, &bytes_read); |
safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); |
line_ptr += bytes_read; |
table->files[table->num_files].time = |
read_unsigned_leb128 (abfd, line_ptr, &bytes_read); |
table->files[table->num_files].time = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); |
line_ptr += bytes_read; |
table->files[table->num_files].size = |
read_unsigned_leb128 (abfd, line_ptr, &bytes_read); |
table->files[table->num_files].size = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); |
line_ptr += bytes_read; |
table->num_files++; |
} |
1711,7 → 1875,7 |
/* Decode the table. */ |
while (! end_sequence) |
{ |
op_code = read_1_byte (abfd, line_ptr); |
op_code = read_1_byte (abfd, line_ptr, line_end); |
line_ptr += 1; |
if (op_code >= lh.opcode_base) |
1718,6 → 1882,8 |
{ |
/* Special operand. */ |
adj_opcode = op_code - lh.opcode_base; |
if (lh.line_range == 0) |
goto line_fail; |
if (lh.maximum_ops_per_insn == 1) |
address += (adj_opcode / lh.line_range |
* lh.minimum_instruction_length); |
1743,9 → 1909,9 |
else switch (op_code) |
{ |
case DW_LNS_extended_op: |
exop_len = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); |
exop_len = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); |
line_ptr += bytes_read; |
extended_op = read_1_byte (abfd, line_ptr); |
extended_op = read_1_byte (abfd, line_ptr, line_end); |
line_ptr += 1; |
switch (extended_op) |
1764,12 → 1930,12 |
goto line_fail; |
break; |
case DW_LNE_set_address: |
address = read_address (unit, line_ptr); |
address = read_address (unit, line_ptr, line_end); |
op_index = 0; |
line_ptr += unit->addr_size; |
break; |
case DW_LNE_define_file: |
cur_file = read_string (abfd, line_ptr, &bytes_read); |
cur_file = read_string (abfd, line_ptr, line_end, &bytes_read); |
line_ptr += bytes_read; |
if ((table->num_files % FILE_ALLOC_CHUNK) == 0) |
{ |
1784,19 → 1950,19 |
} |
table->files[table->num_files].name = cur_file; |
table->files[table->num_files].dir = |
read_unsigned_leb128 (abfd, line_ptr, &bytes_read); |
safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); |
line_ptr += bytes_read; |
table->files[table->num_files].time = |
read_unsigned_leb128 (abfd, line_ptr, &bytes_read); |
safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); |
line_ptr += bytes_read; |
table->files[table->num_files].size = |
read_unsigned_leb128 (abfd, line_ptr, &bytes_read); |
safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); |
line_ptr += bytes_read; |
table->num_files++; |
break; |
case DW_LNE_set_discriminator: |
discriminator = |
read_unsigned_leb128 (abfd, line_ptr, &bytes_read); |
safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); |
line_ptr += bytes_read; |
break; |
case DW_LNE_HP_source_file_correlation: |
1825,12 → 1991,12 |
case DW_LNS_advance_pc: |
if (lh.maximum_ops_per_insn == 1) |
address += (lh.minimum_instruction_length |
* read_unsigned_leb128 (abfd, line_ptr, |
&bytes_read)); |
* safe_read_leb128 (abfd, line_ptr, &bytes_read, |
FALSE, line_end)); |
else |
{ |
bfd_vma adjust = read_unsigned_leb128 (abfd, line_ptr, |
&bytes_read); |
bfd_vma adjust = safe_read_leb128 (abfd, line_ptr, &bytes_read, |
FALSE, line_end); |
address = ((op_index + adjust) / lh.maximum_ops_per_insn |
* lh.minimum_instruction_length); |
op_index = (op_index + adjust) % lh.maximum_ops_per_insn; |
1838,7 → 2004,7 |
line_ptr += bytes_read; |
break; |
case DW_LNS_advance_line: |
line += read_signed_leb128 (abfd, line_ptr, &bytes_read); |
line += safe_read_leb128 (abfd, line_ptr, &bytes_read, TRUE, line_end); |
line_ptr += bytes_read; |
break; |
case DW_LNS_set_file: |
1847,7 → 2013,7 |
/* The file and directory tables are 0 |
based, the references are 1 based. */ |
file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); |
file = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); |
line_ptr += bytes_read; |
if (filename) |
free (filename); |
1855,7 → 2021,7 |
break; |
} |
case DW_LNS_set_column: |
column = read_unsigned_leb128 (abfd, line_ptr, &bytes_read); |
column = safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); |
line_ptr += bytes_read; |
break; |
case DW_LNS_negate_stmt: |
1877,7 → 2043,7 |
} |
break; |
case DW_LNS_fixed_advance_pc: |
address += read_2_bytes (abfd, line_ptr); |
address += read_2_bytes (abfd, line_ptr, line_end); |
op_index = 0; |
line_ptr += 2; |
break; |
1885,7 → 2051,7 |
/* Unknown standard opcode, ignore it. */ |
for (i = 0; i < lh.standard_opcode_lengths[op_code]; i++) |
{ |
(void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read); |
(void) safe_read_leb128 (abfd, line_ptr, &bytes_read, FALSE, line_end); |
line_ptr += bytes_read; |
} |
break; |
1909,11 → 2075,13 |
return NULL; |
} |
/* If ADDR is within TABLE set the output parameters and return TRUE, |
otherwise return FALSE. The output parameters, FILENAME_PTR and |
LINENUMBER_PTR, are pointers to the objects to be filled in. */ |
/* If ADDR is within TABLE set the output parameters and return the |
range of addresses covered by the entry used to fill them out. |
Otherwise set * FILENAME_PTR to NULL and return 0. |
The parameters FILENAME_PTR, LINENUMBER_PTR and DISCRIMINATOR_PTR |
are pointers to the objects to be filled in. */ |
static bfd_boolean |
static bfd_vma |
lookup_address_in_line_info_table (struct line_info_table *table, |
bfd_vma addr, |
const char **filename_ptr, |
1955,12 → 2123,12 |
*linenumber_ptr = each_line->line; |
if (discriminator_ptr) |
*discriminator_ptr = each_line->discriminator; |
return TRUE; |
return seq->last_line->address - seq->low_pc; |
} |
} |
*filename_ptr = NULL; |
return FALSE; |
return 0; |
} |
/* Read in the .debug_ranges section for future reference. */ |
1976,19 → 2144,19 |
/* Function table functions. */ |
/* If ADDR is within TABLE, set FUNCTIONNAME_PTR, and return TRUE. |
Note that we need to find the function that has the smallest |
range that contains ADDR, to handle inlined functions without |
depending upon them being ordered in TABLE by increasing range. */ |
/* If ADDR is within UNIT's function tables, set FUNCTION_PTR, and return |
TRUE. Note that we need to find the function that has the smallest range |
that contains ADDR, to handle inlined functions without depending upon |
them being ordered in TABLE by increasing range. */ |
static bfd_boolean |
lookup_address_in_function_table (struct comp_unit *unit, |
bfd_vma addr, |
struct funcinfo **function_ptr, |
const char **functionname_ptr) |
struct funcinfo **function_ptr) |
{ |
struct funcinfo* each_func; |
struct funcinfo* best_fit = NULL; |
bfd_vma best_fit_len = 0; |
struct arange *arange; |
for (each_func = unit->function_table; |
2002,24 → 2170,22 |
if (addr >= arange->low && addr < arange->high) |
{ |
if (!best_fit |
|| (arange->high - arange->low |
< best_fit->arange.high - best_fit->arange.low)) |
|| arange->high - arange->low < best_fit_len) |
{ |
best_fit = each_func; |
best_fit_len = arange->high - arange->low; |
} |
} |
} |
} |
if (best_fit) |
{ |
*functionname_ptr = best_fit->name; |
*function_ptr = best_fit; |
return TRUE; |
} |
else |
{ |
return FALSE; |
} |
} |
/* If SYM at ADDR is within function table of UNIT, set FILENAME_PTR |
and LINENUMBER_PTR, and return TRUE. */ |
2033,6 → 2199,7 |
{ |
struct funcinfo* each_func; |
struct funcinfo* best_fit = NULL; |
bfd_vma best_fit_len = 0; |
struct arange *arange; |
const char *name = bfd_asymbol_name (sym); |
asection *sec = bfd_get_section (sym); |
2051,11 → 2218,13 |
&& each_func->name |
&& strcmp (name, each_func->name) == 0 |
&& (!best_fit |
|| (arange->high - arange->low |
< best_fit->arange.high - best_fit->arange.low))) |
|| arange->high - arange->low < best_fit_len)) |
{ |
best_fit = each_func; |
best_fit_len = arange->high - arange->low; |
} |
} |
} |
if (best_fit) |
{ |
2106,10 → 2275,12 |
static char * |
find_abstract_instance_name (struct comp_unit *unit, |
struct attribute *attr_ptr) |
struct attribute *attr_ptr, |
bfd_boolean *is_linkage) |
{ |
bfd *abfd = unit->abfd; |
bfd_byte *info_ptr; |
bfd_byte *info_ptr_end; |
unsigned int abbrev_number, bytes_read, i; |
struct abbrev_info *abbrev; |
bfd_uint64_t die_ref = attr_ptr->u.val; |
2126,7 → 2297,30 |
abort (); |
info_ptr = unit->sec_info_ptr + die_ref; |
info_ptr_end = unit->end_ptr; |
/* Now find the CU containing this pointer. */ |
if (info_ptr >= unit->info_ptr_unit && info_ptr < unit->end_ptr) |
; |
else |
{ |
/* Check other CUs to see if they contain the abbrev. */ |
struct comp_unit * u; |
for (u = unit->prev_unit; u != NULL; u = u->prev_unit) |
if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr) |
break; |
if (u == NULL) |
for (u = unit->next_unit; u != NULL; u = u->next_unit) |
if (info_ptr >= u->info_ptr_unit && info_ptr < u->end_ptr) |
break; |
if (u) |
unit = u; |
/* else FIXME: What do we do now ? */ |
} |
} |
else if (attr_ptr->form == DW_FORM_GNU_ref_alt) |
{ |
info_ptr = read_alt_indirect_ref (unit, die_ref); |
2135,13 → 2329,20 |
(*_bfd_error_handler) |
(_("Dwarf Error: Unable to read alt ref %u."), die_ref); |
bfd_set_error (bfd_error_bad_value); |
return name; |
return NULL; |
} |
info_ptr_end = unit->stash->alt_dwarf_info_buffer + unit->stash->alt_dwarf_info_size; |
/* FIXME: Do we need to locate the correct CU, in a similar |
fashion to the code in the DW_FORM_ref_addr case above ? */ |
} |
else |
{ |
info_ptr = unit->info_ptr_unit + die_ref; |
info_ptr_end = unit->end_ptr; |
} |
abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); |
abbrev_number = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end); |
info_ptr += bytes_read; |
if (abbrev_number) |
2158,7 → 2359,7 |
for (i = 0; i < abbrev->num_attrs; ++i) |
{ |
info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, |
info_ptr); |
info_ptr, info_ptr_end); |
if (info_ptr == NULL) |
break; |
switch (attr.name) |
2166,15 → 2367,25 |
case DW_AT_name: |
/* Prefer DW_AT_MIPS_linkage_name or DW_AT_linkage_name |
over DW_AT_name. */ |
if (name == NULL) |
if (name == NULL && is_str_attr (attr.form)) |
{ |
name = attr.u.str; |
if (non_mangled (unit->lang)) |
*is_linkage = TRUE; |
} |
break; |
case DW_AT_specification: |
name = find_abstract_instance_name (unit, &attr); |
name = find_abstract_instance_name (unit, &attr, is_linkage); |
break; |
case DW_AT_linkage_name: |
case DW_AT_MIPS_linkage_name: |
/* PR 16949: Corrupt debug info can place |
non-string forms into these attributes. */ |
if (is_str_attr (attr.form)) |
{ |
name = attr.u.str; |
*is_linkage = TRUE; |
} |
break; |
default: |
break; |
2190,6 → 2401,7 |
bfd_uint64_t offset) |
{ |
bfd_byte *ranges_ptr; |
bfd_byte *ranges_end; |
bfd_vma base_address = unit->base_address; |
if (! unit->stash->dwarf_ranges_buffer) |
2197,7 → 2409,11 |
if (! read_debug_ranges (unit)) |
return FALSE; |
} |
ranges_ptr = unit->stash->dwarf_ranges_buffer + offset; |
if (ranges_ptr < unit->stash->dwarf_ranges_buffer) |
return FALSE; |
ranges_end = unit->stash->dwarf_ranges_buffer + unit->stash->dwarf_ranges_size; |
for (;;) |
{ |
2204,9 → 2420,13 |
bfd_vma low_pc; |
bfd_vma high_pc; |
low_pc = read_address (unit, ranges_ptr); |
/* PR 17512: file: 62cada7d. */ |
if (ranges_ptr + 2 * unit->addr_size > ranges_end) |
return FALSE; |
low_pc = read_address (unit, ranges_ptr, ranges_end); |
ranges_ptr += unit->addr_size; |
high_pc = read_address (unit, ranges_ptr); |
high_pc = read_address (unit, ranges_ptr, ranges_end); |
ranges_ptr += unit->addr_size; |
if (low_pc == 0 && high_pc == 0) |
2233,6 → 2453,7 |
{ |
bfd *abfd = unit->abfd; |
bfd_byte *info_ptr = unit->first_child_die_ptr; |
bfd_byte *info_ptr_end = unit->stash->info_ptr_end; |
int nesting_level = 1; |
struct funcinfo **nested_funcs; |
int nested_funcs_size; |
2257,7 → 2478,11 |
bfd_vma high_pc = 0; |
bfd_boolean high_pc_relative = FALSE; |
abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); |
/* PR 17512: file: 9f405d9d. */ |
if (info_ptr >= info_ptr_end) |
goto fail; |
abbrev_number = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, info_ptr_end); |
info_ptr += bytes_read; |
if (! abbrev_number) |
2321,7 → 2546,7 |
for (i = 0; i < abbrev->num_attrs; ++i) |
{ |
info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr); |
info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr, info_ptr_end); |
if (info_ptr == NULL) |
goto fail; |
2340,19 → 2565,30 |
case DW_AT_abstract_origin: |
case DW_AT_specification: |
func->name = find_abstract_instance_name (unit, &attr); |
func->name = find_abstract_instance_name (unit, &attr, |
&func->is_linkage); |
break; |
case DW_AT_name: |
/* Prefer DW_AT_MIPS_linkage_name or DW_AT_linkage_name |
over DW_AT_name. */ |
if (func->name == NULL) |
if (func->name == NULL && is_str_attr (attr.form)) |
{ |
func->name = attr.u.str; |
if (non_mangled (unit->lang)) |
func->is_linkage = TRUE; |
} |
break; |
case DW_AT_linkage_name: |
case DW_AT_MIPS_linkage_name: |
/* PR 16949: Corrupt debug info can place |
non-string forms into these attributes. */ |
if (is_str_attr (attr.form)) |
{ |
func->name = attr.u.str; |
func->is_linkage = TRUE; |
} |
break; |
case DW_AT_low_pc: |
2508,15 → 2744,15 |
bfd *abfd = stash->bfd_ptr; |
bfd_boolean high_pc_relative = FALSE; |
version = read_2_bytes (abfd, info_ptr); |
version = read_2_bytes (abfd, info_ptr, end_ptr); |
info_ptr += 2; |
BFD_ASSERT (offset_size == 4 || offset_size == 8); |
if (offset_size == 4) |
abbrev_offset = read_4_bytes (abfd, info_ptr); |
abbrev_offset = read_4_bytes (abfd, info_ptr, end_ptr); |
else |
abbrev_offset = read_8_bytes (abfd, info_ptr); |
abbrev_offset = read_8_bytes (abfd, info_ptr, end_ptr); |
info_ptr += offset_size; |
addr_size = read_1_byte (abfd, info_ptr); |
addr_size = read_1_byte (abfd, info_ptr, end_ptr); |
info_ptr += 1; |
if (version != 2 && version != 3 && version != 4) |
2553,7 → 2789,7 |
if (! abbrevs) |
return 0; |
abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); |
abbrev_number = safe_read_leb128 (abfd, info_ptr, &bytes_read, FALSE, end_ptr); |
info_ptr += bytes_read; |
if (! abbrev_number) |
{ |
2588,7 → 2824,7 |
for (i = 0; i < abbrev->num_attrs; ++i) |
{ |
info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr); |
info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr, end_ptr); |
if (info_ptr == NULL) |
return NULL; |
2627,6 → 2863,15 |
case DW_AT_comp_dir: |
{ |
char *comp_dir = attr.u.str; |
/* PR 17512: file: 1fe726be. */ |
if (! is_str_attr (attr.form)) |
{ |
(*_bfd_error_handler) |
(_("Dwarf Error: DW_AT_comp_dir attribute encountered with a non-string form.")); |
comp_dir = NULL; |
} |
if (comp_dir) |
{ |
/* Irix 6.2 native cc prepends <machine>.: to the compilation |
2640,6 → 2885,10 |
break; |
} |
case DW_AT_language: |
unit->lang = attr.u.val; |
break; |
default: |
break; |
} |
2684,24 → 2933,22 |
/* If UNIT contains ADDR, set the output parameters to the values for |
the line containing ADDR. The output parameters, FILENAME_PTR, |
FUNCTIONNAME_PTR, and LINENUMBER_PTR, are pointers to the objects |
FUNCTION_PTR, and LINENUMBER_PTR, are pointers to the objects |
to be filled in. |
Return TRUE if UNIT contains ADDR, and no errors were encountered; |
FALSE otherwise. */ |
Returns the range of addresses covered by the entry that was used |
to fill in *LINENUMBER_PTR or 0 if it was not filled in. */ |
static bfd_boolean |
static bfd_vma |
comp_unit_find_nearest_line (struct comp_unit *unit, |
bfd_vma addr, |
const char **filename_ptr, |
const char **functionname_ptr, |
struct funcinfo **function_ptr, |
unsigned int *linenumber_ptr, |
unsigned int *discriminator_ptr, |
struct dwarf2_debug *stash) |
{ |
bfd_boolean line_p; |
bfd_boolean func_p; |
struct funcinfo *function; |
if (unit->error) |
return FALSE; |
2730,16 → 2977,15 |
} |
} |
function = NULL; |
func_p = lookup_address_in_function_table (unit, addr, |
&function, functionname_ptr); |
if (func_p && (function->tag == DW_TAG_inlined_subroutine)) |
stash->inliner_chain = function; |
line_p = lookup_address_in_line_info_table (unit->line_table, addr, |
*function_ptr = NULL; |
func_p = lookup_address_in_function_table (unit, addr, function_ptr); |
if (func_p && (*function_ptr)->tag == DW_TAG_inlined_subroutine) |
stash->inliner_chain = *function_ptr; |
return lookup_address_in_line_info_table (unit->line_table, addr, |
filename_ptr, |
linenumber_ptr, |
discriminator_ptr); |
return line_p || func_p; |
} |
/* Check to see if line info is already decoded in a comp_unit. |
2962,12 → 3208,36 |
return NULL; |
} |
/* Transfer VMAs from object file to separate debug file. */ |
static void |
set_debug_vma (bfd *orig_bfd, bfd *debug_bfd) |
{ |
asection *s, *d; |
for (s = orig_bfd->sections, d = debug_bfd->sections; |
s != NULL && d != NULL; |
s = s->next, d = d->next) |
{ |
if ((d->flags & SEC_DEBUGGING) != 0) |
break; |
/* ??? Assumes 1-1 correspondence between sections in the |
two files. */ |
if (strcmp (s->name, d->name) == 0) |
{ |
d->output_section = s->output_section; |
d->output_offset = s->output_offset; |
d->vma = s->vma; |
} |
} |
} |
/* Unset vmas for adjusted sections in STASH. */ |
static void |
unset_sections (struct dwarf2_debug *stash) |
{ |
unsigned int i; |
int i; |
struct adjusted_section *p; |
i = stash->adjusted_section_count; |
2976,14 → 3246,23 |
p->section->vma = 0; |
} |
/* Set unique VMAs for loadable and DWARF sections in ABFD and save |
VMAs in STASH for unset_sections. */ |
/* Set VMAs for allocated and .debug_info sections in ORIG_BFD, a |
relocatable object file. VMAs are normally all zero in relocatable |
object files, so if we want to distinguish locations in sections by |
address we need to set VMAs so the sections do not overlap. We |
also set VMA on .debug_info so that when we have multiple |
.debug_info sections (or the linkonce variant) they also do not |
overlap. The multiple .debug_info sections make up a single |
logical section. ??? We should probably do the same for other |
debug sections. */ |
static bfd_boolean |
place_sections (bfd *abfd, struct dwarf2_debug *stash) |
place_sections (bfd *orig_bfd, struct dwarf2_debug *stash) |
{ |
bfd *abfd; |
struct adjusted_section *p; |
unsigned int i; |
int i; |
const char *debug_info_name; |
if (stash->adjusted_section_count != 0) |
{ |
2991,78 → 3270,79 |
p = stash->adjusted_sections; |
for (; i > 0; i--, p++) |
p->section->vma = p->adj_vma; |
return TRUE; |
} |
else |
debug_info_name = stash->debug_sections[debug_info].uncompressed_name; |
i = 0; |
abfd = orig_bfd; |
while (1) |
{ |
asection *sect; |
bfd_vma last_vma = 0, last_dwarf = 0; |
bfd_size_type amt; |
const char *debug_info_name; |
debug_info_name = stash->debug_sections[debug_info].uncompressed_name; |
i = 0; |
for (sect = abfd->sections; sect != NULL; sect = sect->next) |
{ |
bfd_size_type sz; |
int is_debug_info; |
if (sect->vma != 0) |
if ((sect->output_section != NULL |
&& sect->output_section != sect |
&& (sect->flags & SEC_DEBUGGING) == 0) |
|| sect->vma != 0) |
continue; |
/* We need to adjust the VMAs of any .debug_info sections. |
Skip compressed ones, since no relocations could target |
them - they should not appear in object files anyway. */ |
if (strcmp (sect->name, debug_info_name) == 0) |
is_debug_info = 1; |
else if (CONST_STRNEQ (sect->name, GNU_LINKONCE_INFO)) |
is_debug_info = 1; |
else |
is_debug_info = 0; |
is_debug_info = (strcmp (sect->name, debug_info_name) == 0 |
|| CONST_STRNEQ (sect->name, GNU_LINKONCE_INFO)); |
if (!is_debug_info && (sect->flags & SEC_LOAD) == 0) |
if (!((sect->flags & SEC_ALLOC) != 0 && abfd == orig_bfd) |
&& !is_debug_info) |
continue; |
sz = sect->rawsize ? sect->rawsize : sect->size; |
if (sz == 0) |
continue; |
i++; |
} |
if (abfd == stash->bfd_ptr) |
break; |
abfd = stash->bfd_ptr; |
} |
amt = i * sizeof (struct adjusted_section); |
p = (struct adjusted_section *) bfd_alloc (abfd, amt); |
if (! p) |
if (i <= 1) |
stash->adjusted_section_count = -1; |
else |
{ |
bfd_vma last_vma = 0, last_dwarf = 0; |
bfd_size_type amt = i * sizeof (struct adjusted_section); |
p = (struct adjusted_section *) bfd_malloc (amt); |
if (p == NULL) |
return FALSE; |
stash->adjusted_sections = p; |
stash->adjusted_section_count = i; |
abfd = orig_bfd; |
while (1) |
{ |
asection *sect; |
for (sect = abfd->sections; sect != NULL; sect = sect->next) |
{ |
bfd_size_type sz; |
int is_debug_info; |
if (sect->vma != 0) |
if ((sect->output_section != NULL |
&& sect->output_section != sect |
&& (sect->flags & SEC_DEBUGGING) == 0) |
|| sect->vma != 0) |
continue; |
/* We need to adjust the VMAs of any .debug_info sections. |
Skip compressed ones, since no relocations could target |
them - they should not appear in object files anyway. */ |
if (strcmp (sect->name, debug_info_name) == 0) |
is_debug_info = 1; |
else if (CONST_STRNEQ (sect->name, GNU_LINKONCE_INFO)) |
is_debug_info = 1; |
else |
is_debug_info = 0; |
is_debug_info = (strcmp (sect->name, debug_info_name) == 0 |
|| CONST_STRNEQ (sect->name, GNU_LINKONCE_INFO)); |
if (!is_debug_info && (sect->flags & SEC_LOAD) == 0) |
if (!((sect->flags & SEC_ALLOC) != 0 && abfd == orig_bfd) |
&& !is_debug_info) |
continue; |
sz = sect->rawsize ? sect->rawsize : sect->size; |
if (sz == 0) |
continue; |
p->section = sect; |
if (is_debug_info) |
{ |
BFD_ASSERT (sect->alignment_power == 0); |
3069,25 → 3349,30 |
sect->vma = last_dwarf; |
last_dwarf += sz; |
} |
else if (last_vma != 0) |
else |
{ |
/* Align the new address to the current section |
alignment. */ |
last_vma = ((last_vma |
+ ~((bfd_vma) -1 << sect->alignment_power)) |
& ((bfd_vma) -1 << sect->alignment_power)); |
+ ~(-((bfd_vma) 1 << sect->alignment_power))) |
& (-((bfd_vma) 1 << sect->alignment_power))); |
sect->vma = last_vma; |
last_vma += sect->vma + sz; |
last_vma += sz; |
} |
else |
last_vma += sect->vma + sz; |
p->section = sect; |
p->adj_vma = sect->vma; |
p++; |
} |
if (abfd == stash->bfd_ptr) |
break; |
abfd = stash->bfd_ptr; |
} |
} |
if (orig_bfd != stash->bfd_ptr) |
set_debug_vma (orig_bfd, stash->bfd_ptr); |
return TRUE; |
} |
3106,6 → 3391,7 |
{ |
struct funcinfo* each_func; |
struct funcinfo* best_fit = NULL; |
bfd_vma best_fit_len = 0; |
struct info_list_node *node; |
struct arange *arange; |
const char *name = bfd_asymbol_name (sym); |
3124,11 → 3410,13 |
&& addr >= arange->low |
&& addr < arange->high |
&& (!best_fit |
|| (arange->high - arange->low |
< best_fit->arange.high - best_fit->arange.low))) |
|| arange->high - arange->low < best_fit_len)) |
{ |
best_fit = each_func; |
best_fit_len = arange->high - arange->low; |
} |
} |
} |
if (best_fit) |
{ |
3316,6 → 3604,56 |
filename_ptr, linenumber_ptr); |
} |
/* Save current section VMAs. */ |
static bfd_boolean |
save_section_vma (const bfd *abfd, struct dwarf2_debug *stash) |
{ |
asection *s; |
unsigned int i; |
if (abfd->section_count == 0) |
return TRUE; |
stash->sec_vma = bfd_malloc (sizeof (*stash->sec_vma) * abfd->section_count); |
if (stash->sec_vma == NULL) |
return FALSE; |
for (i = 0, s = abfd->sections; i < abfd->section_count; i++, s = s->next) |
{ |
if (s->output_section != NULL) |
stash->sec_vma[i] = s->output_section->vma + s->output_offset; |
else |
stash->sec_vma[i] = s->vma; |
} |
return TRUE; |
} |
/* Compare current section VMAs against those at the time the stash |
was created. If find_nearest_line is used in linker warnings or |
errors early in the link process, the debug info stash will be |
invalid for later calls. This is because we relocate debug info |
sections, so the stashed section contents depend on symbol values, |
which in turn depend on section VMAs. */ |
static bfd_boolean |
section_vma_same (const bfd *abfd, const struct dwarf2_debug *stash) |
{ |
asection *s; |
unsigned int i; |
for (i = 0, s = abfd->sections; i < abfd->section_count; i++, s = s->next) |
{ |
bfd_vma vma; |
if (s->output_section != NULL) |
vma = s->output_section->vma + s->output_offset; |
else |
vma = s->vma; |
if (vma != stash->sec_vma[i]) |
return FALSE; |
} |
return TRUE; |
} |
/* Read debug information from DEBUG_BFD when DEBUG_BFD is specified. |
If DEBUG_BFD is not specified, we read debug information from ABFD |
or its gnu_debuglink. The results will be stored in PINFO. |
3325,7 → 3663,8 |
_bfd_dwarf2_slurp_debug_info (bfd *abfd, bfd *debug_bfd, |
const struct dwarf_debug_section *debug_sections, |
asymbol **symbols, |
void **pinfo) |
void **pinfo, |
bfd_boolean do_place) |
{ |
bfd_size_type amt = sizeof (struct dwarf2_debug); |
bfd_size_type total_size; |
3333,13 → 3672,22 |
struct dwarf2_debug *stash = (struct dwarf2_debug *) *pinfo; |
if (stash != NULL) |
{ |
if (section_vma_same (abfd, stash)) |
return TRUE; |
_bfd_dwarf2_cleanup_debug_info (abfd, pinfo); |
memset (stash, 0, amt); |
} |
else |
{ |
stash = (struct dwarf2_debug *) bfd_zalloc (abfd, amt); |
if (! stash) |
return FALSE; |
} |
stash->debug_sections = debug_sections; |
stash->syms = symbols; |
if (!save_section_vma (abfd, stash)) |
return FALSE; |
*pinfo = stash; |
3361,7 → 3709,8 |
if ((debug_bfd = bfd_openr (debug_filename, NULL)) == NULL |
|| ! bfd_check_format (debug_bfd, bfd_object) |
|| (msec = find_debug_info (debug_bfd, |
debug_sections, NULL)) == NULL) |
debug_sections, NULL)) == NULL |
|| !bfd_generic_link_read_symbols (debug_bfd)) |
{ |
if (debug_bfd) |
bfd_close (debug_bfd); |
3369,10 → 3718,17 |
free (debug_filename); |
return FALSE; |
} |
symbols = bfd_get_outsymbols (debug_bfd); |
stash->syms = symbols; |
stash->close_on_cleanup = TRUE; |
} |
stash->bfd_ptr = debug_bfd; |
if (do_place |
&& !place_sections (abfd, stash)) |
return FALSE; |
/* There can be more than one DWARF2 info section in a BFD these |
days. First handle the easy case when there's only one. If |
there's more than one, try case two: none of the sections is |
3432,6 → 3788,57 |
return TRUE; |
} |
/* Scan the debug information in PINFO looking for a DW_TAG_subprogram |
abbrev with a DW_AT_low_pc attached to it. Then lookup that same |
symbol in SYMBOLS and return the difference between the low_pc and |
the symbol's address. Returns 0 if no suitable symbol could be found. */ |
bfd_signed_vma |
_bfd_dwarf2_find_symbol_bias (asymbol ** symbols, void ** pinfo) |
{ |
struct dwarf2_debug *stash; |
struct comp_unit * unit; |
stash = (struct dwarf2_debug *) *pinfo; |
if (stash == NULL) |
return 0; |
for (unit = stash->all_comp_units; unit; unit = unit->next_unit) |
{ |
struct funcinfo * func; |
if (unit->function_table == NULL) |
{ |
if (unit->line_table == NULL) |
unit->line_table = decode_line_info (unit, stash); |
if (unit->line_table != NULL) |
scan_unit_for_symbols (unit); |
} |
for (func = unit->function_table; func != NULL; func = func->prev_func) |
if (func->name && func->arange.low) |
{ |
asymbol ** psym; |
/* FIXME: Do we need to scan the aranges looking for the lowest pc value ? */ |
for (psym = symbols; * psym != NULL; psym++) |
{ |
asymbol * sym = * psym; |
if (sym->flags & BSF_FUNCTION |
&& sym->section != NULL |
&& strcmp (sym->name, func->name) == 0) |
return ((bfd_signed_vma) func->arange.low) - |
((bfd_signed_vma) (sym->value + sym->section->vma)); |
} |
} |
} |
return 0; |
} |
/* Find the source code location of SYMBOL. If SYMBOL is NULL |
then find the nearest source code location corresponding to |
the address SECTION + OFFSET. |
3444,17 → 3851,17 |
field and in the abbreviation offset, or zero to indicate that the |
default value should be used. */ |
static bfd_boolean |
find_line (bfd *abfd, |
const struct dwarf_debug_section *debug_sections, |
bfd_boolean |
_bfd_dwarf2_find_nearest_line (bfd *abfd, |
asymbol **symbols, |
asymbol *symbol, |
asection *section, |
bfd_vma offset, |
asymbol *symbol, |
asymbol **symbols, |
const char **filename_ptr, |
const char **functionname_ptr, |
unsigned int *linenumber_ptr, |
unsigned int *discriminator_ptr, |
const struct dwarf_debug_section *debug_sections, |
unsigned int addr_size, |
void **pinfo) |
{ |
3470,7 → 3877,8 |
/* What address are we looking for? */ |
bfd_vma addr; |
struct comp_unit* each; |
bfd_vma found = FALSE; |
struct funcinfo *function = NULL; |
bfd_boolean found = FALSE; |
bfd_boolean do_line; |
*filename_ptr = NULL; |
3480,35 → 3888,25 |
if (discriminator_ptr) |
*discriminator_ptr = 0; |
if (! _bfd_dwarf2_slurp_debug_info (abfd, NULL, |
debug_sections, symbols, pinfo)) |
if (! _bfd_dwarf2_slurp_debug_info (abfd, NULL, debug_sections, |
symbols, pinfo, |
(abfd->flags & (EXEC_P | DYNAMIC)) == 0)) |
return FALSE; |
stash = (struct dwarf2_debug *) *pinfo; |
/* In a relocatable file, 2 functions may have the same address. |
We change the section vma so that they won't overlap. */ |
if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) |
{ |
if (! place_sections (abfd, stash)) |
return FALSE; |
} |
do_line = (section == NULL |
&& offset == 0 |
&& functionname_ptr == NULL |
&& symbol != NULL); |
do_line = symbol != NULL; |
if (do_line) |
{ |
BFD_ASSERT (section == NULL && offset == 0 && functionname_ptr == NULL); |
section = bfd_get_section (symbol); |
addr = symbol->value; |
section = bfd_get_section (symbol); |
} |
else if (section != NULL |
&& functionname_ptr != NULL |
&& symbol == NULL) |
else |
{ |
BFD_ASSERT (section != NULL && functionname_ptr != NULL); |
addr = offset; |
else |
abort (); |
} |
if (section->output_section) |
addr += section->output_section->vma + section->output_offset; |
3560,17 → 3958,55 |
} |
else |
{ |
bfd_vma min_range = (bfd_vma) -1; |
const char * local_filename = NULL; |
struct funcinfo *local_function = NULL; |
unsigned int local_linenumber = 0; |
unsigned int local_discriminator = 0; |
for (each = stash->all_comp_units; each; each = each->next_unit) |
{ |
bfd_vma range = (bfd_vma) -1; |
found = ((each->arange.high == 0 |
|| comp_unit_contains_address (each, addr)) |
&& comp_unit_find_nearest_line (each, addr, |
filename_ptr, |
functionname_ptr, |
linenumber_ptr, |
discriminator_ptr, |
stash)); |
&& (range = comp_unit_find_nearest_line (each, addr, |
& local_filename, |
& local_function, |
& local_linenumber, |
& local_discriminator, |
stash)) != 0); |
if (found) |
{ |
/* PRs 15935 15994: Bogus debug information may have provided us |
with an erroneous match. We attempt to counter this by |
selecting the match that has the smallest address range |
associated with it. (We are assuming that corrupt debug info |
will tend to result in extra large address ranges rather than |
extra small ranges). |
This does mean that we scan through all of the CUs associated |
with the bfd each time this function is called. But this does |
have the benefit of producing consistent results every time the |
function is called. */ |
if (range <= min_range) |
{ |
if (filename_ptr && local_filename) |
* filename_ptr = local_filename; |
if (local_function) |
function = local_function; |
if (discriminator_ptr && local_discriminator) |
* discriminator_ptr = local_discriminator; |
if (local_linenumber) |
* linenumber_ptr = local_linenumber; |
min_range = range; |
} |
} |
} |
if (* linenumber_ptr) |
{ |
found = TRUE; |
goto done; |
} |
} |
3589,13 → 4025,13 |
unsigned int offset_size = addr_size; |
bfd_byte *info_ptr_unit = stash->info_ptr; |
length = read_4_bytes (stash->bfd_ptr, stash->info_ptr); |
length = read_4_bytes (stash->bfd_ptr, stash->info_ptr, stash->info_ptr_end); |
/* A 0xffffff length is the DWARF3 way of indicating |
we use 64-bit offsets, instead of 32-bit offsets. */ |
if (length == 0xffffffff) |
{ |
offset_size = 8; |
length = read_8_bytes (stash->bfd_ptr, stash->info_ptr + 4); |
length = read_8_bytes (stash->bfd_ptr, stash->info_ptr + 4, stash->info_ptr_end); |
stash->info_ptr += 12; |
} |
/* A zero length is the IRIX way of indicating 64-bit offsets, |
3604,7 → 4040,7 |
else if (length == 0) |
{ |
offset_size = 8; |
length = read_4_bytes (stash->bfd_ptr, stash->info_ptr + 4); |
length = read_4_bytes (stash->bfd_ptr, stash->info_ptr + 4, stash->info_ptr_end); |
stash->info_ptr += 8; |
} |
/* In the absence of the hints above, we assume 32-bit DWARF2 |
3626,6 → 4062,8 |
if (length > 0) |
{ |
bfd_byte * new_ptr; |
each = parse_comp_unit (stash, length, info_ptr_unit, |
offset_size); |
if (!each) |
3632,8 → 4070,18 |
/* The dwarf information is damaged, don't trust it any |
more. */ |
break; |
stash->info_ptr += length; |
new_ptr = stash->info_ptr + length; |
/* PR 17512: file: 1500698c. */ |
if (new_ptr < stash->info_ptr) |
{ |
/* A corrupt length value - do not trust the info any more. */ |
found = FALSE; |
break; |
} |
else |
stash->info_ptr = new_ptr; |
if (stash->all_comp_units) |
stash->all_comp_units->prev_unit = each; |
else |
3660,10 → 4108,10 |
|| comp_unit_contains_address (each, addr)) |
&& comp_unit_find_nearest_line (each, addr, |
filename_ptr, |
functionname_ptr, |
&function, |
linenumber_ptr, |
discriminator_ptr, |
stash)); |
stash) != 0); |
if ((bfd_vma) (stash->info_ptr - stash->sec_info_ptr) |
== stash->sec->size) |
3679,6 → 4127,28 |
} |
done: |
if (function) |
{ |
if (!function->is_linkage) |
{ |
asymbol *fun; |
bfd_vma sec_vma; |
fun = _bfd_elf_find_function (abfd, symbols, section, offset, |
*filename_ptr ? NULL : filename_ptr, |
functionname_ptr); |
sec_vma = section->vma; |
if (section->output_section != NULL) |
sec_vma = section->output_section->vma + section->output_offset; |
if (fun != NULL |
&& fun->value + sec_vma == function->arange.low) |
function->name = *functionname_ptr; |
/* Even if we didn't find a linkage name, say that we have |
to stop a repeated search of symbols. */ |
function->is_linkage = TRUE; |
} |
*functionname_ptr = function->name; |
} |
if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0) |
unset_sections (stash); |
3685,46 → 4155,7 |
return found; |
} |
/* The DWARF2 version of find_nearest_line. |
Return TRUE if the line is found without error. */ |
bfd_boolean |
_bfd_dwarf2_find_nearest_line (bfd *abfd, |
const struct dwarf_debug_section *debug_sections, |
asection *section, |
asymbol **symbols, |
bfd_vma offset, |
const char **filename_ptr, |
const char **functionname_ptr, |
unsigned int *linenumber_ptr, |
unsigned int *discriminator_ptr, |
unsigned int addr_size, |
void **pinfo) |
{ |
return find_line (abfd, debug_sections, section, offset, NULL, symbols, |
filename_ptr, functionname_ptr, linenumber_ptr, |
discriminator_ptr, addr_size, pinfo); |
} |
/* The DWARF2 version of find_line. |
Return TRUE if the line is found without error. */ |
bfd_boolean |
_bfd_dwarf2_find_line (bfd *abfd, |
asymbol **symbols, |
asymbol *symbol, |
const char **filename_ptr, |
unsigned int *linenumber_ptr, |
unsigned int *discriminator_ptr, |
unsigned int addr_size, |
void **pinfo) |
{ |
return find_line (abfd, dwarf_debug_sections, NULL, 0, symbol, symbols, |
filename_ptr, NULL, linenumber_ptr, discriminator_ptr, |
addr_size, pinfo); |
} |
bfd_boolean |
_bfd_dwarf2_find_inliner_info (bfd *abfd ATTRIBUTE_UNUSED, |
const char **filename_ptr, |
const char **functionname_ptr, |
3828,6 → 4259,116 |
free (stash->alt_dwarf_str_buffer); |
if (stash->alt_dwarf_info_buffer) |
free (stash->alt_dwarf_info_buffer); |
if (stash->sec_vma) |
free (stash->sec_vma); |
if (stash->adjusted_sections) |
free (stash->adjusted_sections); |
if (stash->alt_bfd_ptr) |
bfd_close (stash->alt_bfd_ptr); |
} |
/* Find the function to a particular section and offset, |
for error reporting. */ |
asymbol * |
_bfd_elf_find_function (bfd *abfd, |
asymbol **symbols, |
asection *section, |
bfd_vma offset, |
const char **filename_ptr, |
const char **functionname_ptr) |
{ |
struct elf_find_function_cache |
{ |
asection *last_section; |
asymbol *func; |
const char *filename; |
bfd_size_type func_size; |
} *cache; |
if (symbols == NULL) |
return NULL; |
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) |
return NULL; |
cache = elf_tdata (abfd)->elf_find_function_cache; |
if (cache == NULL) |
{ |
cache = bfd_zalloc (abfd, sizeof (*cache)); |
elf_tdata (abfd)->elf_find_function_cache = cache; |
if (cache == NULL) |
return NULL; |
} |
if (cache->last_section != section |
|| cache->func == NULL |
|| offset < cache->func->value |
|| offset >= cache->func->value + cache->func_size) |
{ |
asymbol *file; |
bfd_vma low_func; |
asymbol **p; |
/* ??? Given multiple file symbols, it is impossible to reliably |
choose the right file name for global symbols. File symbols are |
local symbols, and thus all file symbols must sort before any |
global symbols. The ELF spec may be interpreted to say that a |
file symbol must sort before other local symbols, but currently |
ld -r doesn't do this. So, for ld -r output, it is possible to |
make a better choice of file name for local symbols by ignoring |
file symbols appearing after a given local symbol. */ |
enum { nothing_seen, symbol_seen, file_after_symbol_seen } state; |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
file = NULL; |
low_func = 0; |
state = nothing_seen; |
cache->filename = NULL; |
cache->func = NULL; |
cache->func_size = 0; |
cache->last_section = section; |
for (p = symbols; *p != NULL; p++) |
{ |
asymbol *sym = *p; |
bfd_vma code_off; |
bfd_size_type size; |
if ((sym->flags & BSF_FILE) != 0) |
{ |
file = sym; |
if (state == symbol_seen) |
state = file_after_symbol_seen; |
continue; |
} |
size = bed->maybe_function_sym (sym, section, &code_off); |
if (size != 0 |
&& code_off <= offset |
&& (code_off > low_func |
|| (code_off == low_func |
&& size > cache->func_size))) |
{ |
cache->func = sym; |
cache->func_size = size; |
cache->filename = NULL; |
low_func = code_off; |
if (file != NULL |
&& ((sym->flags & BSF_LOCAL) != 0 |
|| state != file_after_symbol_seen)) |
cache->filename = bfd_asymbol_name (file); |
} |
if (state == nothing_seen) |
state = symbol_seen; |
} |
} |
if (cache->func == NULL) |
return NULL; |
if (filename_ptr) |
*filename_ptr = cache->filename; |
if (functionname_ptr) |
*functionname_ptr = bfd_asymbol_name (cache->func); |
return cache->func; |
} |
/contrib/toolchain/binutils/bfd/elf-attrs.c |
---|
1,6 → 1,5 |
/* ELF attributes support (based on ARM EABI attributes). |
Copyright 2005, 2006, 2007, 2009, 2010, 2012 |
Free Software Foundation, Inc. |
Copyright (C) 2005-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
55,7 → 54,7 |
/* Return the size of a single attribute. */ |
static bfd_vma |
obj_attr_size (int tag, obj_attribute *attr) |
obj_attr_size (unsigned int tag, obj_attribute *attr) |
{ |
bfd_vma size; |
144,7 → 143,7 |
/* Write attribute ATTR to butter P, and return a pointer to the following |
byte. */ |
static bfd_byte * |
write_obj_attribute (bfd_byte *p, int tag, obj_attribute *attr) |
write_obj_attribute (bfd_byte *p, unsigned int tag, obj_attribute *attr) |
{ |
/* Suppress default entries. */ |
if (is_default_attr (attr)) |
190,7 → 189,7 |
attr = elf_known_obj_attributes (abfd)[vendor]; |
for (i = LEAST_KNOWN_OBJ_ATTRIBUTE; i < NUM_KNOWN_OBJ_ATTRIBUTES; i++) |
{ |
int tag = i; |
unsigned int tag = i; |
if (get_elf_backend_data (abfd)->obj_attrs_order) |
tag = get_elf_backend_data (abfd)->obj_attrs_order (i); |
p = write_obj_attribute (p, tag, &attr[tag]); |
228,7 → 227,7 |
/* Allocate/find an object attribute. */ |
static obj_attribute * |
elf_new_obj_attr (bfd *abfd, int vendor, int tag) |
elf_new_obj_attr (bfd *abfd, int vendor, unsigned int tag) |
{ |
obj_attribute *attr; |
obj_attribute_list *list; |
266,7 → 265,7 |
/* Return the value of an integer object attribute. */ |
int |
bfd_elf_get_obj_attr_int (bfd *abfd, int vendor, int tag) |
bfd_elf_get_obj_attr_int (bfd *abfd, int vendor, unsigned int tag) |
{ |
obj_attribute_list *p; |
292,7 → 291,7 |
/* Add an integer object attribute. */ |
void |
bfd_elf_add_obj_attr_int (bfd *abfd, int vendor, int tag, unsigned int i) |
bfd_elf_add_obj_attr_int (bfd *abfd, int vendor, unsigned int tag, unsigned int i) |
{ |
obj_attribute *attr; |
315,7 → 314,7 |
/* Add a string object attribute. */ |
void |
bfd_elf_add_obj_attr_string (bfd *abfd, int vendor, int tag, const char *s) |
bfd_elf_add_obj_attr_string (bfd *abfd, int vendor, unsigned int tag, const char *s) |
{ |
obj_attribute *attr; |
326,7 → 325,8 |
/* Add a int+string object attribute. */ |
void |
bfd_elf_add_obj_attr_int_string (bfd *abfd, int vendor, int tag, |
bfd_elf_add_obj_attr_int_string (bfd *abfd, int vendor, |
unsigned int tag, |
unsigned int i, const char *s) |
{ |
obj_attribute *attr; |
395,7 → 395,7 |
/* Determine whether a GNU object attribute tag takes an integer, a |
string or both. */ |
static int |
gnu_obj_attrs_arg_type (int tag) |
gnu_obj_attrs_arg_type (unsigned int tag) |
{ |
/* Except for Tag_compatibility, for GNU attributes we follow the |
same rule ARM ones > 32 follow: odd-numbered tags take strings |
410,7 → 410,7 |
/* Determine what arguments an attribute tag takes. */ |
int |
_bfd_elf_obj_attrs_arg_type (bfd *abfd, int vendor, int tag) |
_bfd_elf_obj_attrs_arg_type (bfd *abfd, int vendor, unsigned int tag) |
{ |
switch (vendor) |
{ |
431,9 → 431,13 |
{ |
bfd_byte *contents; |
bfd_byte *p; |
bfd_byte *p_end; |
bfd_vma len; |
const char *std_sec; |
/* PR 17512: file: 2844a11d. */ |
if (hdr->sh_size == 0) |
return; |
contents = (bfd_byte *) bfd_malloc (hdr->sh_size); |
if (!contents) |
return; |
444,23 → 448,31 |
return; |
} |
p = contents; |
p_end = p + hdr->sh_size; |
std_sec = get_elf_backend_data (abfd)->obj_attrs_vendor; |
if (*(p++) == 'A') |
{ |
len = hdr->sh_size - 1; |
while (len > 0) |
while (len > 0 && p < p_end - 4) |
{ |
int namelen; |
unsigned namelen; |
bfd_vma section_len; |
int vendor; |
section_len = bfd_get_32 (abfd, p); |
p += 4; |
if (section_len == 0) |
break; |
if (section_len > len) |
section_len = len; |
len -= section_len; |
namelen = strlen ((char *) p) + 1; |
section_len -= namelen + 4; |
section_len -= 4; |
namelen = strnlen ((char *) p, section_len) + 1; |
if (namelen == 0 || namelen >= section_len) |
break; |
section_len -= namelen; |
if (std_sec && strcmp ((char *) p, std_sec) == 0) |
vendor = OBJ_ATTR_PROC; |
else if (strcmp ((char *) p, "gnu") == 0) |
473,23 → 485,31 |
} |
p += namelen; |
while (section_len > 0) |
while (section_len > 0 && p < p_end) |
{ |
int tag; |
unsigned int tag; |
unsigned int n; |
unsigned int val; |
bfd_vma subsection_len; |
bfd_byte *end; |
tag = read_unsigned_leb128 (abfd, p, &n); |
tag = safe_read_leb128 (abfd, p, &n, FALSE, p_end); |
p += n; |
if (p < p_end - 4) |
subsection_len = bfd_get_32 (abfd, p); |
else |
subsection_len = 0; |
p += 4; |
if (subsection_len == 0) |
break; |
if (subsection_len > section_len) |
subsection_len = section_len; |
section_len -= subsection_len; |
subsection_len -= n + 4; |
end = p + subsection_len; |
/* PR 17512: file: 0e8c0c90. */ |
if (end > p_end) |
end = p_end; |
switch (tag) |
{ |
case Tag_File: |
497,13 → 517,13 |
{ |
int type; |
tag = read_unsigned_leb128 (abfd, p, &n); |
tag = safe_read_leb128 (abfd, p, &n, FALSE, end); |
p += n; |
type = _bfd_elf_obj_attrs_arg_type (abfd, vendor, tag); |
switch (type & (ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL)) |
{ |
case ATTR_TYPE_FLAG_INT_VAL | ATTR_TYPE_FLAG_STR_VAL: |
val = read_unsigned_leb128 (abfd, p, &n); |
val = safe_read_leb128 (abfd, p, &n, FALSE, end); |
p += n; |
bfd_elf_add_obj_attr_int_string (abfd, vendor, tag, |
val, (char *)p); |
515,7 → 535,7 |
p += strlen ((char *)p) + 1; |
break; |
case ATTR_TYPE_FLAG_INT_VAL: |
val = read_unsigned_leb128 (abfd, p, &n); |
val = safe_read_leb128 (abfd, p, &n, FALSE, end); |
p += n; |
bfd_elf_add_obj_attr_int (abfd, vendor, tag, val); |
break; |
647,7 → 667,7 |
for (; in_list || out_list; ) |
{ |
bfd *err_bfd = NULL; |
int err_tag = 0; |
unsigned int err_tag = 0; |
/* The tags for each list are in numerical order. */ |
/* If the tags are equal, then merge. */ |
/contrib/toolchain/binutils/bfd/elf-bfd.h |
---|
1,5 → 1,5 |
/* BFD back-end data structures for ELF files. |
Copyright 1992-2013 Free Software Foundation, Inc. |
Copyright (C) 1992-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
27,6 → 27,10 |
#include "elf/internal.h" |
#include "bfdlink.h" |
#ifdef __cplusplus |
extern "C" { |
#endif |
/* The number of entries in a section is its size divided by the size |
of a single entry. This is normally only applicable to reloc and |
symbol table sections. |
104,6 → 108,15 |
struct elf_link_hash_entry *parent; |
}; |
/* ELF symbol version. */ |
enum elf_symbol_version |
{ |
unknown = 0, |
unversioned, |
versioned, |
versioned_hidden |
}; |
/* ELF linker hash table entries. */ |
struct elf_link_hash_entry |
174,8 → 187,8 |
unsigned int needs_plt : 1; |
/* Symbol appears in a non-ELF input file. */ |
unsigned int non_elf : 1; |
/* Symbol should be marked as hidden in the version information. */ |
unsigned int hidden : 1; |
/* Symbol version information. */ |
ENUM_BITFIELD (elf_symbol_version) versioned : 2; |
/* Symbol was forced to local scope due to a version script file. */ |
unsigned int forced_local : 1; |
/* Symbol was forced to be dynamic due to a version script file. */ |
196,6 → 209,9 |
unsigned int pointer_equality_needed : 1; |
/* Symbol is a unique global symbol. */ |
unsigned int unique_global : 1; |
/* Symbol is defined by a shared library with non-default visibility |
in a read/write section. */ |
unsigned int protected_def : 1; |
/* String table index in .dynstr if this is a dynamic symbol. */ |
unsigned long dynstr_index; |
239,7 → 255,8 |
_bfd_elf_symbol_refs_local_p (H, INFO, 1) |
/* Common symbols that are turned into definitions don't have the |
DEF_REGULAR flag set, so they might appear to be undefined. */ |
DEF_REGULAR flag set, so they might appear to be undefined. |
Symbols defined in linker scripts also don't have DEF_REGULAR set. */ |
#define ELF_COMMON_DEF_P(H) \ |
(!(H)->def_regular \ |
&& !(H)->def_dynamic \ |
280,7 → 297,9 |
If REMOVED == 0, this is the CIE that we have chosen to use for |
the output FDE. The CIE's REMOVED field is also 0, but the CIE |
might belong to a different .eh_frame input section from the FDE. */ |
might belong to a different .eh_frame input section from the FDE. |
May be NULL to signify that the FDE should be discarded. */ |
struct eh_cie_fde *cie_inf; |
struct eh_cie_fde *next_for_section; |
} fde; |
372,27 → 391,49 |
struct eh_frame_array_ent |
{ |
bfd_vma initial_loc; |
bfd_size_type range; |
bfd_vma fde; |
}; |
struct htab; |
struct eh_frame_hdr_info |
#define DWARF2_EH_HDR 1 |
#define COMPACT_EH_HDR 2 |
/* Endian-neutral code indicating that a function cannot be unwound. */ |
#define COMPACT_EH_CANT_UNWIND_OPCODE 0x015d5d01 |
struct dwarf_eh_frame_hdr_info |
{ |
struct htab *cies; |
asection *hdr_sec; |
unsigned int fde_count, array_count; |
struct eh_frame_array_ent *array; |
/* TRUE if we should try to merge CIEs between input sections. */ |
bfd_boolean merge_cies; |
/* TRUE if all .eh_frames have been parsd. */ |
bfd_boolean parsed_eh_frames; |
unsigned int fde_count; |
/* TRUE if .eh_frame_hdr should contain the sorted search table. |
We build it if we successfully read all .eh_frame input sections |
and recognize them. */ |
bfd_boolean table; |
struct eh_frame_array_ent *array; |
}; |
struct compact_eh_frame_hdr_info |
{ |
unsigned int allocated_entries; |
/* eh_frame_entry fragments. */ |
asection **entries; |
}; |
struct eh_frame_hdr_info |
{ |
asection *hdr_sec; |
unsigned int array_count; |
bfd_boolean frame_hdr_is_compact; |
union |
{ |
struct dwarf_eh_frame_hdr_info dwarf; |
struct compact_eh_frame_hdr_info compact; |
} |
u; |
}; |
/* Enum used to identify target specific extensions to the elf_obj_tdata |
and elf_link_hash_table structures. Note the enums deliberately start |
from 1 so that we can detect an uninitialized field. The generic value |
419,7 → 460,9 |
MICROBLAZE_ELF_DATA, |
MIPS_ELF_DATA, |
MN10300_ELF_DATA, |
NDS32_ELF_DATA, |
NIOS2_ELF_DATA, |
OR1K_ELF_DATA, |
PPC32_ELF_DATA, |
PPC64_ELF_DATA, |
S390_ELF_DATA, |
435,6 → 478,13 |
GENERIC_ELF_DATA |
}; |
struct elf_sym_strtab |
{ |
Elf_Internal_Sym sym; |
unsigned long dest_index; |
unsigned long destshndx_index; |
}; |
/* ELF linker hash table. */ |
struct elf_link_hash_table |
478,6 → 528,17 |
section. */ |
struct elf_strtab_hash *dynstr; |
/* The number of symbol strings found in the link which must be put |
into the .strtab section. */ |
bfd_size_type strtabcount; |
/* The array size of the symbol string table, which becomes the |
.strtab section. */ |
bfd_size_type strtabsize; |
/* The array of strings, which becomes the .strtab section. */ |
struct elf_sym_strtab *strtab; |
/* The number of buckets in the hash table in the .hash section. |
This is based on the number of dynamic symbols. */ |
bfd_size_type bucketcount; |
534,6 → 595,7 |
asection *iplt; |
asection *irelplt; |
asection *irelifunc; |
asection *dynsym; |
}; |
/* Look up an entry in an ELF linker hash table. */ |
1108,6 → 1170,11 |
unsigned int (*elf_backend_count_relocs) |
(struct bfd_link_info *, asection *); |
/* Say whether to sort relocs output by ld -r and ld --emit-relocs, |
by r_offset. If NULL, default to true. */ |
bfd_boolean (*sort_relocs_p) |
(asection *); |
/* This function, if defined, is called when an NT_PRSTATUS note is found |
in a core file. */ |
bfd_boolean (*elf_backend_grok_prstatus) |
1190,7 → 1257,7 |
/* This function implements `bfd_elf_bfd_from_remote_memory'; |
see elf.c, elfcode.h. */ |
bfd *(*elf_backend_bfd_from_remote_memory) |
(bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, |
(bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep, |
int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, |
bfd_size_type len)); |
1225,6 → 1292,9 |
bfd_size_type (*maybe_function_sym) (const asymbol *sym, asection *sec, |
bfd_vma *code_off); |
/* Return the section which RELOC_SEC applies to. */ |
asection *(*get_reloc_section) (asection *reloc_sec); |
/* Used to handle bad SHF_LINK_ORDER input. */ |
bfd_error_handler_type link_order_error_handler; |
1274,6 → 1344,12 |
or give an error and return FALSE. */ |
bfd_boolean (*obj_attrs_handle_unknown) (bfd *, int); |
/* Encoding used for compact EH tables. */ |
int (*compact_eh_encoding) (struct bfd_link_info *); |
/* Opcode representing no unwind. */ |
int (*cant_unwind_opcode) (struct bfd_link_info *); |
/* This is non-zero if static TLS segments require a special alignment. */ |
unsigned static_tls_alignment; |
1341,6 → 1417,15 |
other file in the link needs to have a .note.GNU-stack section |
for a PT_GNU_STACK segment to be created. */ |
unsigned default_execstack : 1; |
/* True if elf_section_data(sec)->this_hdr.contents is sec->rawsize |
in length rather than sec->size in length, if sec->rawsize is |
non-zero and smaller than sec->size. */ |
unsigned caches_rawsize : 1; |
/* Address of protected data defined in the shared library may be |
external, i.e., due to copy relocation. */ |
unsigned extern_protected_data : 1; |
}; |
/* Information about reloc sections associated with a bfd_elf_section_data |
1419,6 → 1504,9 |
field acts as a chain pointer. */ |
struct eh_cie_fde *fde_list; |
/* Link from a text section to its .eh_frame_entry section. */ |
asection *eh_frame_entry; |
/* A pointer used for various section optimizations. */ |
void *sec_info; |
}; |
1432,6 → 1520,7 |
#define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group) |
#define elf_fde_list(sec) (elf_section_data(sec)->fde_list) |
#define elf_sec_group(sec) (elf_section_data(sec)->sec_group) |
#define elf_section_eh_frame_entry(sec) (elf_section_data(sec)->eh_frame_entry) |
#define xvec_get_elf_backend_data(xvec) \ |
((const struct elf_backend_data *) (xvec)->backend_data) |
1470,7 → 1559,7 |
typedef struct obj_attribute_list |
{ |
struct obj_attribute_list *next; |
int tag; |
unsigned int tag; |
obj_attribute attr; |
} obj_attribute_list; |
1502,13 → 1591,6 |
bfd_byte data[1]; |
}; |
/* NT_GNU_BUILD_ID note type info for input BFDs. */ |
struct elf_build_id |
{ |
size_t size; |
bfd_byte data[1]; |
}; |
/* tdata information grabbed from an elf core file. */ |
struct core_elf_obj_tdata |
{ |
1560,6 → 1642,26 |
bfd_boolean flags_init; |
}; |
/* Indicate if the bfd contains symbols that have the STT_GNU_IFUNC |
symbol type or STB_GNU_UNIQUE binding. Used to set the osabi |
field in the ELF header structure. */ |
enum elf_gnu_symbols |
{ |
elf_gnu_symbol_none = 0, |
elf_gnu_symbol_any = 1 << 0, |
elf_gnu_symbol_ifunc = (elf_gnu_symbol_any | 1 << 1), |
elf_gnu_symbol_unique = (elf_gnu_symbol_any | 1 << 2), |
elf_gnu_symbol_all = (elf_gnu_symbol_ifunc | elf_gnu_symbol_unique) |
}; |
typedef struct elf_section_list |
{ |
Elf_Internal_Shdr hdr; |
unsigned int ndx; |
struct elf_section_list * next; |
} elf_section_list; |
/* Some private data is stashed away for future use using the tdata pointer |
in the bfd structure. */ |
1576,7 → 1678,7 |
Elf_Internal_Shdr dynversym_hdr; |
Elf_Internal_Shdr dynverref_hdr; |
Elf_Internal_Shdr dynverdef_hdr; |
Elf_Internal_Shdr symtab_shndx_hdr; |
elf_section_list * symtab_shndx_list; |
bfd_vma gp; /* The gp value */ |
unsigned int gp_size; /* The gp size */ |
unsigned int num_elf_sections; /* elf_sect_ptr size */ |
1643,9 → 1745,6 |
obj_attribute known_obj_attributes[2][NUM_KNOWN_OBJ_ATTRIBUTES]; |
obj_attribute_list *other_obj_attributes[2]; |
/* NT_GNU_BUILD_ID note type. */ |
struct elf_build_id *build_id; |
/* Linked-list containing information about every Systemtap section |
found in the object file. Each section corresponds to one entry |
in the list. */ |
1654,7 → 1753,7 |
Elf_Internal_Shdr **group_sect_ptr; |
int num_group; |
unsigned int symtab_section, symtab_shndx_section, dynsymtab_section; |
unsigned int symtab_section, dynsymtab_section; |
unsigned int dynversym_section, dynverdef_section, dynverref_section; |
/* An identifier used to distinguish different target |
1673,10 → 1772,7 |
symbols. */ |
bfd_boolean bad_symtab; |
/* True if the bfd contains symbols that have the STT_GNU_IFUNC |
symbol type or STB_GNU_UNIQUE binding. Used to set the osabi |
field in the ELF header structure. */ |
bfd_boolean has_gnu_symbols; |
enum elf_gnu_symbols has_gnu_symbols; |
/* Information grabbed from an elf core file. */ |
struct core_elf_obj_tdata *core; |
1699,7 → 1795,7 |
#define elf_stack_flags(bfd) (elf_tdata(bfd) -> o->stack_flags) |
#define elf_shstrtab(bfd) (elf_tdata(bfd) -> o->strtab_ptr) |
#define elf_onesymtab(bfd) (elf_tdata(bfd) -> symtab_section) |
#define elf_symtab_shndx(bfd) (elf_tdata(bfd) -> symtab_shndx_section) |
#define elf_symtab_shndx_list(bfd) (elf_tdata(bfd) -> symtab_shndx_list) |
#define elf_strtab_sec(bfd) (elf_tdata(bfd) -> o->strtab_section) |
#define elf_shstrtab_sec(bfd) (elf_tdata(bfd) -> o->shstrtab_section) |
#define elf_symtab_hdr(bfd) (elf_tdata(bfd) -> symtab_hdr) |
1766,6 → 1862,8 |
(bfd *, bfd *); |
extern bfd_boolean _bfd_elf_print_private_bfd_data |
(bfd *, void *); |
const char * _bfd_elf_get_symbol_version_string |
(bfd *, asymbol *, bfd_boolean *); |
extern void bfd_elf_print_symbol |
(bfd *, void *, asymbol *, bfd_print_symbol_type); |
1809,7 → 1907,7 |
extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create |
(bfd *); |
extern void _bfd_elf_link_hash_table_free |
(struct bfd_link_hash_table *); |
(bfd *); |
extern void _bfd_elf_link_hash_copy_indirect |
(struct bfd_link_info *, struct elf_link_hash_entry *, |
struct elf_link_hash_entry *); |
1892,20 → 1990,14 |
extern bfd_boolean _bfd_elf_set_arch_mach |
(bfd *, enum bfd_architecture, unsigned long); |
extern bfd_boolean _bfd_elf_find_nearest_line |
(bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, |
unsigned int *); |
extern bfd_boolean _bfd_elf_find_nearest_line_discriminator |
(bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, |
unsigned int *, unsigned int *); |
(bfd *, asymbol **, asection *, bfd_vma, |
const char **, const char **, unsigned int *, unsigned int *); |
extern bfd_boolean _bfd_elf_find_line |
(bfd *, asymbol **, asymbol *, const char **, unsigned int *); |
extern bfd_boolean _bfd_elf_find_line_discriminator |
(bfd *, asymbol **, asymbol *, const char **, unsigned int *, unsigned int *); |
#define _bfd_generic_find_line _bfd_elf_find_line |
#define _bfd_generic_find_nearest_line_discriminator \ |
_bfd_elf_find_nearest_line_discriminator |
extern bfd_boolean _bfd_elf_find_inliner_info |
(bfd *, const char **, const char **, unsigned int *); |
extern asymbol *_bfd_elf_find_function |
(bfd *, asymbol **, asection *, bfd_vma, const char **, const char **); |
#define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols |
#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol |
extern int _bfd_elf_sizeof_headers |
1933,8 → 2025,6 |
(struct sym_cache *, bfd *, unsigned long); |
extern asection *bfd_section_from_elf_index |
(bfd *, unsigned int); |
extern struct bfd_strtab_hash *_bfd_elf_stringtab_init |
(void); |
extern struct elf_strtab_hash * _bfd_elf_strtab_init |
(void); |
1961,11 → 2051,13 |
extern void _bfd_elf_strtab_finalize |
(struct elf_strtab_hash *); |
extern void _bfd_elf_begin_eh_frame_parsing |
(struct bfd_link_info *info); |
extern bfd_boolean bfd_elf_parse_eh_frame_entries |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean _bfd_elf_parse_eh_frame_entry |
(struct bfd_link_info *, asection *, struct elf_reloc_cookie *); |
extern void _bfd_elf_parse_eh_frame |
(bfd *, struct bfd_link_info *, asection *, struct elf_reloc_cookie *); |
extern void _bfd_elf_end_eh_frame_parsing |
extern bfd_boolean _bfd_elf_end_eh_frame_parsing |
(struct bfd_link_info *info); |
extern bfd_boolean _bfd_elf_discard_section_eh_frame |
1977,10 → 2069,15 |
(bfd *, struct bfd_link_info *, asection *, bfd_vma); |
extern bfd_boolean _bfd_elf_write_section_eh_frame |
(bfd *, struct bfd_link_info *, asection *, bfd_byte *); |
bfd_boolean _bfd_elf_write_section_eh_frame_entry |
(bfd *, struct bfd_link_info *, asection *, bfd_byte *); |
extern bfd_boolean _bfd_elf_fixup_eh_frame_hdr (struct bfd_link_info *); |
extern bfd_boolean _bfd_elf_write_section_eh_frame_hdr |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean _bfd_elf_eh_frame_present |
(struct bfd_link_info *); |
extern bfd_boolean _bfd_elf_eh_frame_entry_present |
(struct bfd_link_info *); |
extern bfd_boolean _bfd_elf_maybe_strip_eh_frame_hdr |
(struct bfd_link_info *); |
1990,8 → 2087,6 |
(struct bfd_link_info *, bfd *, long); |
extern bfd_boolean _bfd_elf_compute_section_file_positions |
(bfd *, struct bfd_link_info *); |
extern void _bfd_elf_assign_file_positions_for_relocs |
(bfd *); |
extern file_ptr _bfd_elf_assign_file_position_for_section |
(Elf_Internal_Shdr *, file_ptr, bfd_boolean); |
2006,6 → 2101,8 |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean _bfd_elf_create_got_section |
(bfd *, struct bfd_link_info *); |
extern asection *_bfd_elf_section_for_symbol |
(struct elf_reloc_cookie *, unsigned long, bfd_boolean); |
extern struct elf_link_hash_entry *_bfd_elf_define_linkage_sym |
(bfd *, struct bfd_link_info *, asection *, const char *); |
extern void _bfd_elf_init_1_index_section |
2026,7 → 2123,7 |
struct elf_link_hash_entry **); |
extern bfd_boolean _bfd_elf_adjust_dynamic_copy |
(struct elf_link_hash_entry *, asection *); |
(struct bfd_link_info *, struct elf_link_hash_entry *, asection *); |
extern bfd_boolean _bfd_elf_dynamic_symbol_p |
(struct elf_link_hash_entry *, struct bfd_link_info *, bfd_boolean); |
2040,7 → 2137,7 |
extern bfd_boolean _bfd_elf_setup_sections |
(bfd *); |
extern void _bfd_elf_set_osabi (bfd * , struct bfd_link_info *); |
extern void _bfd_elf_post_process_headers (bfd * , struct bfd_link_info *); |
extern const bfd_target *bfd_elf32_object_p |
(bfd *); |
2199,7 → 2296,7 |
extern asection *_bfd_elf_gc_mark_rsec |
(struct bfd_link_info *, asection *, elf_gc_mark_hook_fn, |
struct elf_reloc_cookie *); |
struct elf_reloc_cookie *, bfd_boolean *); |
extern bfd_boolean _bfd_elf_gc_mark_reloc |
(struct bfd_link_info *, asection *, elf_gc_mark_hook_fn, |
2235,6 → 2332,8 |
extern bfd_size_type _bfd_elf_maybe_function_sym (const asymbol *, asection *, |
bfd_vma *); |
extern asection *_bfd_elf_get_reloc_section (asection *); |
extern int bfd_elf_get_default_section_type (flagword); |
extern bfd_boolean bfd_elf_lookup_section_flags |
2278,6 → 2377,10 |
(bfd *, char *, int *, const void *, int); |
extern char *elfcore_write_s390_tdb |
(bfd *, char *, int *, const void *, int); |
extern char *elfcore_write_s390_vxrs_low |
(bfd *, char *, int *, const void *, int); |
extern char *elfcore_write_s390_vxrs_high |
(bfd *, char *, int *, const void *, int); |
extern char *elfcore_write_arm_vfp |
(bfd *, char *, int *, const void *, int); |
extern char *elfcore_write_aarch_tls |
2328,23 → 2431,23 |
(bfd *, char *, int *, const struct elf_internal_linux_prpsinfo *); |
extern bfd *_bfd_elf32_bfd_from_remote_memory |
(bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, |
(bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep, |
int (*target_read_memory) (bfd_vma, bfd_byte *, bfd_size_type)); |
extern bfd *_bfd_elf64_bfd_from_remote_memory |
(bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, |
(bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep, |
int (*target_read_memory) (bfd_vma, bfd_byte *, bfd_size_type)); |
extern bfd_vma bfd_elf_obj_attr_size (bfd *); |
extern void bfd_elf_set_obj_attr_contents (bfd *, bfd_byte *, bfd_vma); |
extern int bfd_elf_get_obj_attr_int (bfd *, int, int); |
extern void bfd_elf_add_obj_attr_int (bfd *, int, int, unsigned int); |
extern int bfd_elf_get_obj_attr_int (bfd *, int, unsigned int); |
extern void bfd_elf_add_obj_attr_int (bfd *, int, unsigned int, unsigned int); |
#define bfd_elf_add_proc_attr_int(BFD, TAG, VALUE) \ |
bfd_elf_add_obj_attr_int ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE)) |
extern void bfd_elf_add_obj_attr_string (bfd *, int, int, const char *); |
extern void bfd_elf_add_obj_attr_string (bfd *, int, unsigned int, const char *); |
#define bfd_elf_add_proc_attr_string(BFD, TAG, VALUE) \ |
bfd_elf_add_obj_attr_string ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE)) |
extern void bfd_elf_add_obj_attr_int_string (bfd *, int, int, unsigned int, |
const char *); |
extern void bfd_elf_add_obj_attr_int_string (bfd *, int, unsigned int, |
unsigned int, const char *); |
#define bfd_elf_add_proc_attr_int_string(BFD, TAG, INTVAL, STRVAL) \ |
bfd_elf_add_obj_attr_int_string ((BFD), OBJ_ATTR_PROC, (TAG), \ |
(INTVAL), (STRVAL)) |
2351,7 → 2454,7 |
extern char *_bfd_elf_attr_strdup (bfd *, const char *); |
extern void _bfd_elf_copy_obj_attributes (bfd *, bfd *); |
extern int _bfd_elf_obj_attrs_arg_type (bfd *, int, int); |
extern int _bfd_elf_obj_attrs_arg_type (bfd *, int, unsigned int); |
extern void _bfd_elf_parse_attributes (bfd *, Elf_Internal_Shdr *); |
extern bfd_boolean _bfd_elf_merge_object_attributes (bfd *, bfd *); |
extern bfd_boolean _bfd_elf_merge_unknown_attribute_low (bfd *, bfd *, int); |
2383,6 → 2486,9 |
extern bfd_boolean _bfd_elf_allocate_ifunc_dyn_relocs |
(struct bfd_link_info *, struct elf_link_hash_entry *, |
struct elf_dyn_relocs **, unsigned int, unsigned int, unsigned int); |
extern long _bfd_elf_ifunc_get_synthetic_symtab |
(bfd *, long, asymbol **, long, asymbol **, asymbol **, asection *, |
bfd_vma *(*) (bfd *, asymbol **, asection *, asection *)); |
extern void elf_append_rela (bfd *, asection *, Elf_Internal_Rela *); |
extern void elf_append_rel (bfd *, asection *, Elf_Internal_Rela *); |
2414,7 → 2520,7 |
#define RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel, \ |
r_symndx, symtab_hdr, sym_hashes, \ |
h, sec, relocation, \ |
unresolved_reloc, warned) \ |
unresolved_reloc, warned, ignored) \ |
do \ |
{ \ |
/* It seems this can happen with erroneous or unsupported \ |
2424,11 → 2530,17 |
\ |
h = sym_hashes[r_symndx - symtab_hdr->sh_info]; \ |
\ |
if (info->wrap_hash != NULL \ |
&& (input_section->flags & SEC_DEBUGGING) != 0) \ |
h = ((struct elf_link_hash_entry *) \ |
unwrap_hash_lookup (info, input_bfd, &h->root)); \ |
\ |
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; \ |
\ |
warned = FALSE; \ |
ignored = FALSE; \ |
unresolved_reloc = FALSE; \ |
relocation = 0; \ |
if (h->root.type == bfd_link_hash_defined \ |
2451,8 → 2563,8 |
; \ |
else if (info->unresolved_syms_in_objects == RM_IGNORE \ |
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) \ |
; \ |
else if (!info->relocatable) \ |
ignored = TRUE; \ |
else if (!bfd_link_relocatable (info)) \ |
{ \ |
bfd_boolean err; \ |
err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR \ |
2467,6 → 2579,7 |
} \ |
(void) unresolved_reloc; \ |
(void) warned; \ |
(void) ignored; \ |
} \ |
while (0) |
2486,7 → 2599,7 |
_bfd_clear_contents (howto, input_bfd, input_section, \ |
contents + rel[index].r_offset); \ |
\ |
if (info->relocatable \ |
if (bfd_link_relocatable (info) \ |
&& (input_section->flags & SEC_DEBUGGING)) \ |
{ \ |
/* Only remove relocations in debug sections since other \ |
2527,4 → 2640,7 |
(!(H)->unique_global \ |
&& ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic))) |
#ifdef __cplusplus |
} |
#endif |
#endif /* _LIBELF_H_ */ |
/contrib/toolchain/binutils/bfd/elf-eh-frame.c |
---|
1,6 → 1,5 |
/* .eh_frame section optimization. |
Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, |
2012 Free Software Foundation, Inc. |
Copyright (C) 2001-2015 Free Software Foundation, Inc. |
Written by Jakub Jelinek <jakub@redhat.com>. |
This file is part of BFD, the Binary File Descriptor library. |
41,10 → 40,12 |
bfd_vma augmentation_size; |
union { |
struct elf_link_hash_entry *h; |
bfd_vma val; |
struct { |
unsigned int bfd_id; |
unsigned int index; |
} sym; |
unsigned int reloc_index; |
} personality; |
asection *output_sec; |
struct eh_cie_fde *cie_inf; |
unsigned char per_encoding; |
unsigned char lsda_encoding; |
230,11 → 231,13 |
&& c1->augmentation_size == c2->augmentation_size |
&& memcmp (&c1->personality, &c2->personality, |
sizeof (c1->personality)) == 0 |
&& c1->output_sec == c2->output_sec |
&& (c1->cie_inf->u.cie.u.sec->output_section |
== c2->cie_inf->u.cie.u.sec->output_section) |
&& c1->per_encoding == c2->per_encoding |
&& c1->lsda_encoding == c2->lsda_encoding |
&& c1->fde_encoding == c2->fde_encoding |
&& c1->initial_insn_length == c2->initial_insn_length |
&& c1->initial_insn_length <= sizeof (c1->initial_instructions) |
&& memcmp (c1->initial_instructions, |
c2->initial_instructions, |
c1->initial_insn_length) == 0) |
254,6 → 257,7 |
cie_compute_hash (struct cie *c) |
{ |
hashval_t h = 0; |
size_t len; |
h = iterative_hash_object (c->length, h); |
h = iterative_hash_object (c->version, h); |
h = iterative_hash (c->augmentation, strlen (c->augmentation) + 1, h); |
262,12 → 266,15 |
h = iterative_hash_object (c->ra_column, h); |
h = iterative_hash_object (c->augmentation_size, h); |
h = iterative_hash_object (c->personality, h); |
h = iterative_hash_object (c->output_sec, h); |
h = iterative_hash_object (c->cie_inf->u.cie.u.sec->output_section, h); |
h = iterative_hash_object (c->per_encoding, h); |
h = iterative_hash_object (c->lsda_encoding, h); |
h = iterative_hash_object (c->fde_encoding, h); |
h = iterative_hash_object (c->initial_insn_length, h); |
h = iterative_hash (c->initial_instructions, c->initial_insn_length, h); |
len = c->initial_insn_length; |
if (len > sizeof (c->initial_instructions)) |
len = sizeof (c->initial_instructions); |
h = iterative_hash (c->initial_instructions, len, h); |
c->hash = h; |
return h; |
} |
445,18 → 452,111 |
return encoding | DW_EH_PE_pcrel; |
} |
/* Called before calling _bfd_elf_parse_eh_frame on every input bfd's |
.eh_frame section. */ |
/* Examine each .eh_frame_entry section and discard those |
those that are marked SEC_EXCLUDE. */ |
void |
_bfd_elf_begin_eh_frame_parsing (struct bfd_link_info *info) |
static void |
bfd_elf_discard_eh_frame_entry (struct eh_frame_hdr_info *hdr_info) |
{ |
unsigned int i; |
for (i = 0; i < hdr_info->array_count; i++) |
{ |
if (hdr_info->u.compact.entries[i]->flags & SEC_EXCLUDE) |
{ |
unsigned int j; |
for (j = i + 1; j < hdr_info->array_count; j++) |
hdr_info->u.compact.entries[j-1] = hdr_info->u.compact.entries[j]; |
hdr_info->array_count--; |
hdr_info->u.compact.entries[hdr_info->array_count] = NULL; |
i--; |
} |
} |
} |
/* Add a .eh_frame_entry section. */ |
static void |
bfd_elf_record_eh_frame_entry (struct eh_frame_hdr_info *hdr_info, |
asection *sec) |
{ |
if (hdr_info->array_count == hdr_info->u.compact.allocated_entries) |
{ |
if (hdr_info->u.compact.allocated_entries == 0) |
{ |
hdr_info->frame_hdr_is_compact = TRUE; |
hdr_info->u.compact.allocated_entries = 2; |
hdr_info->u.compact.entries = |
bfd_malloc (hdr_info->u.compact.allocated_entries |
* sizeof (hdr_info->u.compact.entries[0])); |
} |
else |
{ |
hdr_info->u.compact.allocated_entries *= 2; |
hdr_info->u.compact.entries = |
bfd_realloc (hdr_info->u.compact.entries, |
hdr_info->u.compact.allocated_entries |
* sizeof (hdr_info->u.compact.entries[0])); |
} |
BFD_ASSERT (hdr_info->u.compact.entries); |
} |
hdr_info->u.compact.entries[hdr_info->array_count++] = sec; |
} |
/* Parse a .eh_frame_entry section. Figure out which text section it |
references. */ |
bfd_boolean |
_bfd_elf_parse_eh_frame_entry (struct bfd_link_info *info, |
asection *sec, struct elf_reloc_cookie *cookie) |
{ |
struct elf_link_hash_table *htab; |
struct eh_frame_hdr_info *hdr_info; |
unsigned long r_symndx; |
asection *text_sec; |
hdr_info = &elf_hash_table (info)->eh_info; |
hdr_info->merge_cies = !info->relocatable; |
htab = elf_hash_table (info); |
hdr_info = &htab->eh_info; |
if (sec->size == 0 |
|| sec->sec_info_type != SEC_INFO_TYPE_NONE) |
{ |
return TRUE; |
} |
if (sec->output_section && bfd_is_abs_section (sec->output_section)) |
{ |
/* At least one of the sections is being discarded from the |
link, so we should just ignore them. */ |
return TRUE; |
} |
if (cookie->rel == cookie->relend) |
return FALSE; |
/* The first relocation is the function start. */ |
r_symndx = cookie->rel->r_info >> cookie->r_sym_shift; |
if (r_symndx == STN_UNDEF) |
return FALSE; |
text_sec = _bfd_elf_section_for_symbol (cookie, r_symndx, FALSE); |
if (text_sec == NULL) |
return FALSE; |
elf_section_eh_frame_entry (text_sec) = sec; |
if (text_sec->output_section |
&& bfd_is_abs_section (text_sec->output_section)) |
sec->flags |= SEC_EXCLUDE; |
sec->sec_info_type = SEC_INFO_TYPE_EH_FRAME_ENTRY; |
elf_section_data (sec)->sec_info = text_sec; |
bfd_elf_record_eh_frame_entry (hdr_info, sec); |
return TRUE; |
} |
/* Try to parse .eh_frame section SEC, which belongs to ABFD. Store the |
information in the section's sec_info field on success. COOKIE |
describes the relocations in SEC. */ |
487,8 → 587,6 |
htab = elf_hash_table (info); |
hdr_info = &htab->eh_info; |
if (hdr_info->parsed_eh_frames) |
return; |
if (sec->size == 0 |
|| sec->sec_info_type != SEC_INFO_TYPE_NONE) |
563,10 → 661,13 |
/* FIXME: octets_per_byte. */ |
#define ENSURE_NO_RELOCS(buf) \ |
REQUIRE (!(cookie->rel < cookie->relend \ |
while (cookie->rel < cookie->relend \ |
&& (cookie->rel->r_offset \ |
< (bfd_size_type) ((buf) - ehbuf)) \ |
&& cookie->rel->r_info != 0)) |
< (bfd_size_type) ((buf) - ehbuf))) \ |
{ \ |
REQUIRE (cookie->rel->r_info == 0); \ |
cookie->rel++; \ |
} |
/* FIXME: octets_per_byte. */ |
#define SKIP_RELOCS(buf) \ |
632,7 → 733,6 |
cie->cie_inf = this_inf; |
cie->length = hdr_length; |
cie->output_sec = sec->output_section; |
start = buf; |
REQUIRE (read_byte (&buf, end, &cie->version)); |
733,7 → 833,7 |
/* For shared libraries, try to get rid of as many RELATIVE relocs |
as possible. */ |
if (info->shared |
if (bfd_link_pic (info) |
&& (get_elf_backend_data (abfd) |
->elf_backend_can_make_relative_eh_frame |
(abfd, info, sec))) |
762,20 → 862,22 |
cie->fde_encoding = DW_EH_PE_absptr; |
initial_insn_length = end - buf; |
if (initial_insn_length <= sizeof (cie->initial_instructions)) |
{ |
cie->initial_insn_length = initial_insn_length; |
memcpy (cie->initial_instructions, buf, initial_insn_length); |
} |
memcpy (cie->initial_instructions, buf, |
initial_insn_length <= sizeof (cie->initial_instructions) |
? initial_insn_length : sizeof (cie->initial_instructions)); |
insns = buf; |
buf += initial_insn_length; |
ENSURE_NO_RELOCS (buf); |
if (hdr_info->merge_cies) |
if (!bfd_link_relocatable (info)) |
{ |
/* Keep info for merging cies. */ |
this_inf->u.cie.u.full_cie = cie; |
this_inf->u.cie.per_encoding_relative |
= (cie->per_encoding & 0x70) == DW_EH_PE_pcrel; |
} |
} |
else |
{ |
/* Find the corresponding CIE. */ |
800,7 → 902,8 |
REQUIRE (GET_RELOC (buf)); |
/* Chain together the FDEs for each section. */ |
rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie); |
rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, |
cookie, NULL); |
/* RSEC will be NULL if FDE was cleared out as it was belonging to |
a discarded SHT_GROUP. */ |
if (rsec) |
816,6 → 919,16 |
length = get_DW_EH_PE_width (cie->fde_encoding, ptr_size); |
REQUIRE (skip_bytes (&buf, end, 2 * length)); |
SKIP_RELOCS (buf - length); |
if (!GET_RELOC (buf - length) |
&& read_value (abfd, buf - length, length, FALSE) == 0) |
{ |
(*info->callbacks->minfo) |
(_("discarding zero address range FDE in %B(%A).\n"), |
abfd, sec); |
this_inf->u.fde.cie_inf = NULL; |
} |
/* Skip the augmentation size, if present. */ |
if (cie->augmentation[0] == 'z') |
REQUIRE (read_uleb128 (&buf, end, &length)); |
905,8 → 1018,9 |
elf_section_data (sec)->sec_info = sec_info; |
sec->sec_info_type = SEC_INFO_TYPE_EH_FRAME; |
if (hdr_info->merge_cies) |
if (!bfd_link_relocatable (info)) |
{ |
/* Keep info for merging cies. */ |
sec_info->cies = local_cies; |
local_cies = NULL; |
} |
916,7 → 1030,7 |
(*info->callbacks->einfo) |
(_("%P: error in %B(%A); no .eh_frame_hdr table will be created.\n"), |
abfd, sec); |
hdr_info->table = FALSE; |
hdr_info->u.dwarf.table = FALSE; |
if (sec_info) |
free (sec_info); |
success: |
927,17 → 1041,89 |
#undef REQUIRE |
} |
/* Finish a pass over all .eh_frame sections. */ |
/* Order eh_frame_hdr entries by the VMA of their text section. */ |
void |
static int |
cmp_eh_frame_hdr (const void *a, const void *b) |
{ |
bfd_vma text_a; |
bfd_vma text_b; |
asection *sec; |
sec = *(asection *const *)a; |
sec = (asection *) elf_section_data (sec)->sec_info; |
text_a = sec->output_section->vma + sec->output_offset; |
sec = *(asection *const *)b; |
sec = (asection *) elf_section_data (sec)->sec_info; |
text_b = sec->output_section->vma + sec->output_offset; |
if (text_a < text_b) |
return -1; |
return text_a > text_b; |
} |
/* Add space for a CANTUNWIND terminator to SEC if the text sections |
referenced by it and NEXT are not contiguous, or NEXT is NULL. */ |
static void |
add_eh_frame_hdr_terminator (asection *sec, |
asection *next) |
{ |
bfd_vma end; |
bfd_vma next_start; |
asection *text_sec; |
if (next) |
{ |
/* See if there is a gap (presumably a text section without unwind info) |
between these two entries. */ |
text_sec = (asection *) elf_section_data (sec)->sec_info; |
end = text_sec->output_section->vma + text_sec->output_offset |
+ text_sec->size; |
text_sec = (asection *) elf_section_data (next)->sec_info; |
next_start = text_sec->output_section->vma + text_sec->output_offset; |
if (end == next_start) |
return; |
} |
/* Add space for a CANTUNWIND terminator. */ |
if (!sec->rawsize) |
sec->rawsize = sec->size; |
bfd_set_section_size (sec->owner, sec, sec->size + 8); |
} |
/* Finish a pass over all .eh_frame_entry sections. */ |
bfd_boolean |
_bfd_elf_end_eh_frame_parsing (struct bfd_link_info *info) |
{ |
struct eh_frame_hdr_info *hdr_info; |
unsigned int i; |
hdr_info = &elf_hash_table (info)->eh_info; |
hdr_info->parsed_eh_frames = TRUE; |
if (info->eh_frame_hdr_type != COMPACT_EH_HDR |
|| hdr_info->array_count == 0) |
return FALSE; |
bfd_elf_discard_eh_frame_entry (hdr_info); |
qsort (hdr_info->u.compact.entries, hdr_info->array_count, |
sizeof (asection *), cmp_eh_frame_hdr); |
for (i = 0; i < hdr_info->array_count - 1; i++) |
{ |
add_eh_frame_hdr_terminator (hdr_info->u.compact.entries[i], |
hdr_info->u.compact.entries[i + 1]); |
} |
/* Add a CANTUNWIND terminator after the last entry. */ |
add_eh_frame_hdr_terminator (hdr_info->u.compact.entries[i], NULL); |
return TRUE; |
} |
/* Mark all relocations against CIE or FDE ENT, which occurs in |
.eh_frame section SEC. COOKIE describes the relocations in SEC; |
its "rel" field can be changed freely. */ |
977,7 → 1163,7 |
/* At this stage, all cie_inf fields point to local CIEs, so we |
can use the same cookie to refer to them. */ |
cie = fde->u.fde.cie_inf; |
if (!cie->u.cie.gc_mark) |
if (cie != NULL && !cie->u.cie.gc_mark) |
{ |
cie->u.cie.gc_mark = 1; |
if (!mark_entry (info, eh_frame, cie, gc_mark_hook, cookie)) |
1027,8 → 1213,12 |
{ |
bfd_boolean per_binds_local; |
/* Work out the address of personality routine, either as an absolute |
value or as a symbol. */ |
/* Work out the address of personality routine, or at least |
enough info that we could calculate the address had we made a |
final section layout. The symbol on the reloc is enough, |
either the hash for a global, or (bfd id, index) pair for a |
local. The assumption here is that no one uses addends on |
the reloc. */ |
rel = cookie->rels + cie->personality.reloc_index; |
memset (&cie->personality, 0, sizeof (cie->personality)); |
#ifdef BFD64 |
1068,14 → 1258,13 |
return cie_inf; |
cie->local_personality = 1; |
cie->personality.val = (sym->st_value |
+ sym_sec->output_offset |
+ sym_sec->output_section->vma); |
cie->personality.sym.bfd_id = abfd->id; |
cie->personality.sym.index = r_symndx; |
per_binds_local = TRUE; |
} |
if (per_binds_local |
&& info->shared |
&& bfd_link_pic (info) |
&& (cie->per_encoding & 0x70) == DW_EH_PE_absptr |
&& (get_elf_backend_data (abfd) |
->elf_backend_can_make_relative_eh_frame (abfd, info, sec))) |
1086,15 → 1275,15 |
} |
/* See if we can merge this CIE with an earlier one. */ |
cie->output_sec = sec->output_section; |
cie_compute_hash (cie); |
if (hdr_info->cies == NULL) |
if (hdr_info->u.dwarf.cies == NULL) |
{ |
hdr_info->cies = htab_try_create (1, cie_hash, cie_eq, free); |
if (hdr_info->cies == NULL) |
hdr_info->u.dwarf.cies = htab_try_create (1, cie_hash, cie_eq, free); |
if (hdr_info->u.dwarf.cies == NULL) |
return cie_inf; |
} |
loc = htab_find_slot_with_hash (hdr_info->cies, cie, cie->hash, INSERT); |
loc = htab_find_slot_with_hash (hdr_info->u.dwarf.cies, cie, |
cie->hash, INSERT); |
if (loc == NULL) |
return cie_inf; |
1153,7 → 1342,7 |
/* There should only be one zero terminator, on the last input |
file supplying .eh_frame (crtend.o). Remove any others. */ |
ent->removed = sec->map_head.s != NULL; |
else if (!ent->cie) |
else if (!ent->cie && ent->u.fde.cie_inf != NULL) |
{ |
bfd_boolean keep; |
if ((sec->flags & SEC_LINKER_CREATED) != 0 && cookie->rels == NULL) |
1175,7 → 1364,7 |
} |
if (keep) |
{ |
if (info->shared |
if (bfd_link_pic (info) |
&& (((ent->fde_encoding & 0x70) == DW_EH_PE_absptr |
&& ent->make_relative == 0) |
|| (ent->fde_encoding & 0x70) == DW_EH_PE_aligned)) |
1184,13 → 1373,13 |
which we cannot turn into PC relative, |
don't create the binary search table, |
since it is affected by runtime relocations. */ |
hdr_info->table = FALSE; |
hdr_info->u.dwarf.table = FALSE; |
(*info->callbacks->einfo) |
(_("%P: fde encoding in %B(%A) prevents .eh_frame_hdr" |
(_("%P: FDE encoding in %B(%A) prevents .eh_frame_hdr" |
" table being created.\n"), abfd, sec); |
} |
ent->removed = 0; |
hdr_info->fde_count++; |
hdr_info->u.dwarf.fde_count++; |
ent->u.fde.cie_inf = find_merged_cie (abfd, info, sec, hdr_info, |
cookie, ent->u.fde.cie_inf); |
} |
1229,10 → 1418,10 |
htab = elf_hash_table (info); |
hdr_info = &htab->eh_info; |
if (hdr_info->cies != NULL) |
if (!hdr_info->frame_hdr_is_compact && hdr_info->u.dwarf.cies != NULL) |
{ |
htab_delete (hdr_info->cies); |
hdr_info->cies = NULL; |
htab_delete (hdr_info->u.dwarf.cies); |
hdr_info->u.dwarf.cies = NULL; |
} |
sec = hdr_info->hdr_sec; |
1239,9 → 1428,18 |
if (sec == NULL) |
return FALSE; |
if (info->eh_frame_hdr_type == COMPACT_EH_HDR) |
{ |
/* For compact frames we only add the header. The actual table comes |
from the .eh_frame_entry sections. */ |
sec->size = 8; |
} |
else |
{ |
sec->size = EH_FRAME_HDR_SIZE; |
if (hdr_info->table) |
sec->size += 4 + hdr_info->fde_count * 8; |
if (hdr_info->u.dwarf.table) |
sec->size += 4 + hdr_info->u.dwarf.fde_count * 8; |
} |
elf_eh_frame_hdr (abfd) = sec; |
return TRUE; |
1250,6 → 1448,7 |
/* Return true if there is at least one non-empty .eh_frame section in |
input files. Can only be called after ld has mapped input to |
output sections, and before sections are stripped. */ |
bfd_boolean |
_bfd_elf_eh_frame_present (struct bfd_link_info *info) |
{ |
1267,6 → 1466,29 |
return FALSE; |
} |
/* Return true if there is at least one .eh_frame_entry section in |
input files. */ |
bfd_boolean |
_bfd_elf_eh_frame_entry_present (struct bfd_link_info *info) |
{ |
asection *o; |
bfd *abfd; |
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next) |
{ |
for (o = abfd->sections; o; o = o->next) |
{ |
const char *name = bfd_get_section_name (abfd, o); |
if (strcmp (name, ".eh_frame_entry") |
&& !bfd_is_abs_section (o->output_section)) |
return TRUE; |
} |
} |
return FALSE; |
} |
/* This function is called from size_dynamic_sections. |
It needs to decide whether .eh_frame_hdr should be output or not, |
because when the dynamic symbol table has been sized it is too late |
1277,6 → 1499,8 |
{ |
struct elf_link_hash_table *htab; |
struct eh_frame_hdr_info *hdr_info; |
struct bfd_link_hash_entry *bh = NULL; |
struct elf_link_hash_entry *h; |
htab = elf_hash_table (info); |
hdr_info = &htab->eh_info; |
1284,8 → 1508,11 |
return TRUE; |
if (bfd_is_abs_section (hdr_info->hdr_sec->output_section) |
|| !info->eh_frame_hdr |
|| !_bfd_elf_eh_frame_present (info)) |
|| info->eh_frame_hdr_type == 0 |
|| (info->eh_frame_hdr_type == DWARF2_EH_HDR |
&& !_bfd_elf_eh_frame_present (info)) |
|| (info->eh_frame_hdr_type == COMPACT_EH_HDR |
&& !_bfd_elf_eh_frame_entry_present (info))) |
{ |
hdr_info->hdr_sec->flags |= SEC_EXCLUDE; |
hdr_info->hdr_sec = NULL; |
1292,7 → 1519,21 |
return TRUE; |
} |
hdr_info->table = TRUE; |
/* Add a hidden symbol so that systems without access to PHDRs can |
find the table. */ |
if (! (_bfd_generic_link_add_one_symbol |
(info, info->output_bfd, "__GNU_EH_FRAME_HDR", BSF_LOCAL, |
hdr_info->hdr_sec, 0, NULL, FALSE, FALSE, &bh))) |
return FALSE; |
h = (struct elf_link_hash_entry *) bh; |
h->def_regular = 1; |
h->other = STV_HIDDEN; |
get_elf_backend_data |
(info->output_bfd)->elf_backend_hide_symbol (info, h, TRUE); |
if (!hdr_info->frame_hdr_is_compact) |
hdr_info->u.dwarf.table = TRUE; |
return TRUE; |
} |
1383,6 → 1624,83 |
+ extra_augmentation_data_bytes (sec_info->entry + mid)); |
} |
/* Write out .eh_frame_entry section. Add CANTUNWIND terminator if needed. |
Also check that the contents look sane. */ |
bfd_boolean |
_bfd_elf_write_section_eh_frame_entry (bfd *abfd, struct bfd_link_info *info, |
asection *sec, bfd_byte *contents) |
{ |
const struct elf_backend_data *bed; |
bfd_byte cantunwind[8]; |
bfd_vma addr; |
bfd_vma last_addr; |
bfd_vma offset; |
asection *text_sec = (asection *) elf_section_data (sec)->sec_info; |
if (!sec->rawsize) |
sec->rawsize = sec->size; |
BFD_ASSERT (sec->sec_info_type == SEC_INFO_TYPE_EH_FRAME_ENTRY); |
/* Check to make sure that the text section corresponding to this eh_frame_entry |
section has not been excluded. In particular, mips16 stub entries will be |
excluded outside of the normal process. */ |
if (sec->flags & SEC_EXCLUDE |
|| text_sec->flags & SEC_EXCLUDE) |
return TRUE; |
if (!bfd_set_section_contents (abfd, sec->output_section, contents, |
sec->output_offset, sec->rawsize)) |
return FALSE; |
last_addr = bfd_get_signed_32 (abfd, contents); |
/* Check that all the entries are in order. */ |
for (offset = 8; offset < sec->rawsize; offset += 8) |
{ |
addr = bfd_get_signed_32 (abfd, contents + offset) + offset; |
if (addr <= last_addr) |
{ |
(*_bfd_error_handler) (_("%B: %s not in order"), sec->owner, sec->name); |
return FALSE; |
} |
last_addr = addr; |
} |
addr = text_sec->output_section->vma + text_sec->output_offset |
+ text_sec->size; |
addr &= ~1; |
addr -= (sec->output_section->vma + sec->output_offset + sec->rawsize); |
if (addr & 1) |
{ |
(*_bfd_error_handler) (_("%B: %s invalid input section size"), |
sec->owner, sec->name); |
bfd_set_error (bfd_error_bad_value); |
return FALSE; |
} |
if (last_addr >= addr + sec->rawsize) |
{ |
(*_bfd_error_handler) (_("%B: %s points past end of text section"), |
sec->owner, sec->name); |
bfd_set_error (bfd_error_bad_value); |
return FALSE; |
} |
if (sec->size == sec->rawsize) |
return TRUE; |
bed = get_elf_backend_data (abfd); |
BFD_ASSERT (sec->size == sec->rawsize + 8); |
BFD_ASSERT ((addr & 1) == 0); |
BFD_ASSERT (bed->cant_unwind_opcode); |
bfd_put_32 (abfd, addr, cantunwind); |
bfd_put_32 (abfd, (*bed->cant_unwind_opcode) (info), cantunwind + 4); |
return bfd_set_section_contents (abfd, sec->output_section, cantunwind, |
sec->output_offset + sec->rawsize, 8); |
} |
/* Write out .eh_frame section. This is called with the relocated |
contents. */ |
1397,6 → 1715,7 |
struct eh_frame_hdr_info *hdr_info; |
unsigned int ptr_size; |
struct eh_cie_fde *ent; |
bfd_size_type sec_size; |
if (sec->sec_info_type != SEC_INFO_TYPE_EH_FRAME) |
/* FIXME: octets_per_byte. */ |
1411,10 → 1730,14 |
htab = elf_hash_table (info); |
hdr_info = &htab->eh_info; |
if (hdr_info->table && hdr_info->array == NULL) |
hdr_info->array = (struct eh_frame_array_ent *) |
bfd_malloc (hdr_info->fde_count * sizeof(*hdr_info->array)); |
if (hdr_info->array == NULL) |
if (hdr_info->u.dwarf.table && hdr_info->u.dwarf.array == NULL) |
{ |
hdr_info->frame_hdr_is_compact = FALSE; |
hdr_info->u.dwarf.array = (struct eh_frame_array_ent *) |
bfd_malloc (hdr_info->u.dwarf.fde_count |
* sizeof (*hdr_info->u.dwarf.array)); |
} |
if (hdr_info->u.dwarf.array == NULL) |
hdr_info = NULL; |
/* The new offsets can be bigger or smaller than the original offsets. |
1583,6 → 1906,8 |
value = ((ent->new_offset + sec->output_offset + 4) |
- (cie->new_offset + cie->u.cie.u.sec->output_offset)); |
bfd_put_32 (abfd, value, buf); |
if (bfd_link_relocatable (info)) |
continue; |
buf += 4; |
width = get_DW_EH_PE_width (ent->fde_encoding, ptr_size); |
value = read_value (abfd, buf, width, |
1647,8 → 1972,11 |
dwarf_vma is 64-bit. */ |
if (sizeof (address) > 4 && ptr_size == 4) |
address &= 0xffffffff; |
hdr_info->array[hdr_info->array_count].initial_loc = address; |
hdr_info->array[hdr_info->array_count++].fde |
hdr_info->u.dwarf.array[hdr_info->array_count].initial_loc |
= address; |
hdr_info->u.dwarf.array[hdr_info->array_count].range |
= read_value (abfd, buf + width, width, FALSE); |
hdr_info->u.dwarf.array[hdr_info->array_count++].fde |
= (sec->output_section->vma |
+ sec->output_offset |
+ ent->new_offset); |
1718,7 → 2046,11 |
the pointer size. _bfd_elf_discard_section_eh_frame should |
have padded CIE/FDE records to multiple of pointer size with |
size_of_output_cie_fde. */ |
if ((sec->size % ptr_size) != 0) |
sec_size = sec->size; |
if (sec_info->count != 0 |
&& sec_info->entry[sec_info->count - 1].size == 4) |
sec_size -= 4; |
if ((sec_size % ptr_size) != 0) |
abort (); |
/* FIXME: octets_per_byte. */ |
1739,13 → 2071,118 |
return 1; |
if (p->initial_loc < q->initial_loc) |
return -1; |
if (p->range > q->range) |
return 1; |
if (p->range < q->range) |
return -1; |
return 0; |
} |
/* Write out .eh_frame_hdr section. This must be called after |
_bfd_elf_write_section_eh_frame has been called on all input |
.eh_frame sections. |
.eh_frame_hdr format: |
/* Reorder .eh_frame_entry sections to match the associated text sections. |
This routine is called during the final linking step, just before writing |
the contents. At this stage, sections in the eh_frame_hdr_info are already |
sorted in order of increasing text section address and so we simply need |
to make the .eh_frame_entrys follow that same order. Note that it is |
invalid for a linker script to try to force a particular order of |
.eh_frame_entry sections. */ |
bfd_boolean |
_bfd_elf_fixup_eh_frame_hdr (struct bfd_link_info *info) |
{ |
asection *sec = NULL; |
asection *osec; |
struct eh_frame_hdr_info *hdr_info; |
unsigned int i; |
bfd_vma offset; |
struct bfd_link_order *p; |
hdr_info = &elf_hash_table (info)->eh_info; |
if (hdr_info->hdr_sec == NULL |
|| info->eh_frame_hdr_type != COMPACT_EH_HDR |
|| hdr_info->array_count == 0) |
return TRUE; |
/* Change section output offsets to be in text section order. */ |
offset = 8; |
osec = hdr_info->u.compact.entries[0]->output_section; |
for (i = 0; i < hdr_info->array_count; i++) |
{ |
sec = hdr_info->u.compact.entries[i]; |
if (sec->output_section != osec) |
{ |
(*_bfd_error_handler) |
(_("Invalid output section for .eh_frame_entry: %s"), |
sec->output_section->name); |
return FALSE; |
} |
sec->output_offset = offset; |
offset += sec->size; |
} |
/* Fix the link_order to match. */ |
for (p = sec->output_section->map_head.link_order; p != NULL; p = p->next) |
{ |
if (p->type != bfd_indirect_link_order) |
abort(); |
p->offset = p->u.indirect.section->output_offset; |
if (p->next != NULL) |
i--; |
} |
if (i != 0) |
{ |
(*_bfd_error_handler) |
(_("Invalid contents in %s section"), osec->name); |
return FALSE; |
} |
return TRUE; |
} |
/* The .eh_frame_hdr format for Compact EH frames: |
ubyte version (2) |
ubyte eh_ref_enc (DW_EH_PE_* encoding of typinfo references) |
uint32_t count (Number of entries in table) |
[array from .eh_frame_entry sections] */ |
static bfd_boolean |
write_compact_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) |
{ |
struct elf_link_hash_table *htab; |
struct eh_frame_hdr_info *hdr_info; |
asection *sec; |
const struct elf_backend_data *bed; |
bfd_vma count; |
bfd_byte contents[8]; |
unsigned int i; |
htab = elf_hash_table (info); |
hdr_info = &htab->eh_info; |
sec = hdr_info->hdr_sec; |
if (sec->size != 8) |
abort(); |
for (i = 0; i < sizeof (contents); i++) |
contents[i] = 0; |
contents[0] = COMPACT_EH_HDR; |
bed = get_elf_backend_data (abfd); |
BFD_ASSERT (bed->compact_eh_encoding); |
contents[1] = (*bed->compact_eh_encoding) (info); |
count = (sec->output_section->size - 8) / 8; |
bfd_put_32 (abfd, count, contents + 4); |
return bfd_set_section_contents (abfd, sec->output_section, contents, |
(file_ptr) sec->output_offset, sec->size); |
} |
/* The .eh_frame_hdr format for DWARF frames: |
ubyte version (currently 1) |
ubyte eh_frame_ptr_enc (DW_EH_PE_* encoding of pointer to start of |
.eh_frame section) |
1764,8 → 2201,8 |
FDE initial_location field and FDE address, |
sorted by increasing initial_loc). */ |
bfd_boolean |
_bfd_elf_write_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) |
static bfd_boolean |
write_dwarf_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) |
{ |
struct elf_link_hash_table *htab; |
struct eh_frame_hdr_info *hdr_info; |
1775,9 → 2212,6 |
htab = elf_hash_table (info); |
hdr_info = &htab->eh_info; |
sec = hdr_info->hdr_sec; |
if (info->eh_frame_hdr && sec != NULL) |
{ |
bfd_byte *contents; |
asection *eh_frame_sec; |
bfd_size_type size; |
1784,8 → 2218,9 |
bfd_vma encoded_eh_frame; |
size = EH_FRAME_HDR_SIZE; |
if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count) |
size += 4 + hdr_info->fde_count * 8; |
if (hdr_info->u.dwarf.array |
&& hdr_info->array_count == hdr_info->u.dwarf.fde_count) |
size += 4 + hdr_info->u.dwarf.fde_count * 8; |
contents = (bfd_byte *) bfd_malloc (size); |
if (contents == NULL) |
return FALSE; |
1804,7 → 2239,8 |
contents[1] = get_elf_backend_data (abfd)->elf_backend_encode_eh_address |
(abfd, info, eh_frame_sec, 0, sec, 4, &encoded_eh_frame); |
if (hdr_info->array && hdr_info->array_count == hdr_info->fde_count) |
if (hdr_info->u.dwarf.array |
&& hdr_info->array_count == hdr_info->u.dwarf.fde_count) |
{ |
/* FDE count encoding. */ |
contents[2] = DW_EH_PE_udata4; |
1821,33 → 2257,87 |
if (contents[2] != DW_EH_PE_omit) |
{ |
unsigned int i; |
bfd_boolean overlap, overflow; |
bfd_put_32 (abfd, hdr_info->fde_count, contents + EH_FRAME_HDR_SIZE); |
qsort (hdr_info->array, hdr_info->fde_count, |
sizeof (*hdr_info->array), vma_compare); |
for (i = 0; i < hdr_info->fde_count; i++) |
bfd_put_32 (abfd, hdr_info->u.dwarf.fde_count, |
contents + EH_FRAME_HDR_SIZE); |
qsort (hdr_info->u.dwarf.array, hdr_info->u.dwarf.fde_count, |
sizeof (*hdr_info->u.dwarf.array), vma_compare); |
overlap = FALSE; |
overflow = FALSE; |
for (i = 0; i < hdr_info->u.dwarf.fde_count; i++) |
{ |
bfd_put_32 (abfd, |
hdr_info->array[i].initial_loc |
- sec->output_section->vma, |
contents + EH_FRAME_HDR_SIZE + i * 8 + 4); |
bfd_put_32 (abfd, |
hdr_info->array[i].fde - sec->output_section->vma, |
contents + EH_FRAME_HDR_SIZE + i * 8 + 8); |
bfd_vma val; |
val = hdr_info->u.dwarf.array[i].initial_loc |
- sec->output_section->vma; |
val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000; |
if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64 |
&& (hdr_info->u.dwarf.array[i].initial_loc |
!= sec->output_section->vma + val)) |
overflow = TRUE; |
bfd_put_32 (abfd, val, contents + EH_FRAME_HDR_SIZE + i * 8 + 4); |
val = hdr_info->u.dwarf.array[i].fde - sec->output_section->vma; |
val = ((val & 0xffffffff) ^ 0x80000000) - 0x80000000; |
if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64 |
&& (hdr_info->u.dwarf.array[i].fde |
!= sec->output_section->vma + val)) |
overflow = TRUE; |
bfd_put_32 (abfd, val, contents + EH_FRAME_HDR_SIZE + i * 8 + 8); |
if (i != 0 |
&& (hdr_info->u.dwarf.array[i].initial_loc |
< (hdr_info->u.dwarf.array[i - 1].initial_loc |
+ hdr_info->u.dwarf.array[i - 1].range))) |
overlap = TRUE; |
} |
if (overflow) |
(*info->callbacks->einfo) (_("%P: .eh_frame_hdr entry overflow.\n")); |
if (overlap) |
(*info->callbacks->einfo) |
(_("%P: .eh_frame_hdr refers to overlapping FDEs.\n")); |
if (overflow || overlap) |
{ |
bfd_set_error (bfd_error_bad_value); |
retval = FALSE; |
} |
} |
/* FIXME: octets_per_byte. */ |
retval = bfd_set_section_contents (abfd, sec->output_section, contents, |
if (!bfd_set_section_contents (abfd, sec->output_section, contents, |
(file_ptr) sec->output_offset, |
sec->size); |
sec->size)) |
retval = FALSE; |
free (contents); |
} |
if (hdr_info->array != NULL) |
free (hdr_info->array); |
if (hdr_info->u.dwarf.array != NULL) |
free (hdr_info->u.dwarf.array); |
return retval; |
} |
/* Write out .eh_frame_hdr section. This must be called after |
_bfd_elf_write_section_eh_frame has been called on all input |
.eh_frame sections. */ |
bfd_boolean |
_bfd_elf_write_section_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info) |
{ |
struct elf_link_hash_table *htab; |
struct eh_frame_hdr_info *hdr_info; |
asection *sec; |
htab = elf_hash_table (info); |
hdr_info = &htab->eh_info; |
sec = hdr_info->hdr_sec; |
if (info->eh_frame_hdr_type == 0 || sec == NULL) |
return TRUE; |
if (info->eh_frame_hdr_type == COMPACT_EH_HDR) |
return write_compact_eh_frame_hdr (abfd, info); |
else |
return write_dwarf_eh_frame_hdr (abfd, info); |
} |
/* Return the width of FDE addresses. This is the default implementation. */ |
unsigned int |
/contrib/toolchain/binutils/bfd/elf-ifunc.c |
---|
1,6 → 1,5 |
/* ELF STT_GNU_IFUNC support. |
Copyright 2009-2013 |
Free Software Foundation, Inc. |
Copyright (C) 2009-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
54,7 → 53,7 |
if (bed->plt_readonly) |
pltflags |= SEC_READONLY; |
if (info->shared) |
if (bfd_link_pic (info)) |
{ |
/* We need to create .rel[a].ifunc for shared objects. */ |
const char *rel_sec = (bed->rela_plts_and_copies_p |
126,7 → 125,7 |
But in non-shared executable, the address of its .plt slot may |
be used. Pointer equality may not work correctly. PIE should |
be used if pointer equality is required here. */ |
if (!info->shared |
if (!bfd_link_pic (info) |
&& (h->dynindx != -1 |
|| info->export_dynamic) |
&& h->pointer_equality_needed) |
146,7 → 145,7 |
/* When building shared library, we need to handle the case where it is |
marked with regular reference, but not non-GOT reference since the |
non-GOT reference bit may not be set here. */ |
if (info->shared && !h->non_got_ref && h->ref_regular) |
if (bfd_link_pic (info) && !h->non_got_ref && h->ref_regular) |
for (p = *head; p != NULL; p = p->next) |
if (p->count) |
{ |
221,7 → 220,7 |
/* We need dynamic relocation for STT_GNU_IFUNC symbol only when |
there is a non-GOT reference in a shared object. */ |
if (!info->shared |
if (!bfd_link_pic (info) |
|| !h->non_got_ref) |
*head = NULL; |
253,12 → 252,12 |
objects at run-time. |
We only need to relocate .got entry in shared object. */ |
if (h->got.refcount <= 0 |
|| (info->shared |
|| (bfd_link_pic (info) |
&& (h->dynindx == -1 |
|| h->forced_local)) |
|| (!info->shared |
|| (!bfd_link_pic (info) |
&& !h->pointer_equality_needed) |
|| (info->executable && info->shared) |
|| bfd_link_pie (info) |
|| htab->sgot == NULL) |
{ |
/* Use .got.plt. */ |
268,9 → 267,134 |
{ |
h->got.offset = htab->sgot->size; |
htab->sgot->size += got_entry_size; |
if (info->shared) |
if (bfd_link_pic (info)) |
htab->srelgot->size += sizeof_reloc; |
} |
return TRUE; |
} |
/* Similar to _bfd_elf_get_synthetic_symtab, optimized for unsorted PLT |
entries. PLT is the PLT section. PLT_SYM_VAL is a function pointer |
which returns an array of PLT entry symbol values. */ |
long |
_bfd_elf_ifunc_get_synthetic_symtab |
(bfd *abfd, long symcount ATTRIBUTE_UNUSED, |
asymbol **syms ATTRIBUTE_UNUSED, long dynsymcount, asymbol **dynsyms, |
asymbol **ret, asection *plt, |
bfd_vma *(*get_plt_sym_val) (bfd *, asymbol **, asection *, asection *)) |
{ |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
asection *relplt; |
asymbol *s; |
const char *relplt_name; |
bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean); |
arelent *p; |
long count, i, n; |
size_t size; |
Elf_Internal_Shdr *hdr; |
char *names; |
bfd_vma *plt_sym_val; |
*ret = NULL; |
if (plt == NULL) |
return 0; |
if ((abfd->flags & (DYNAMIC | EXEC_P)) == 0) |
return 0; |
if (dynsymcount <= 0) |
return 0; |
relplt_name = bed->relplt_name; |
if (relplt_name == NULL) |
relplt_name = bed->rela_plts_and_copies_p ? ".rela.plt" : ".rel.plt"; |
relplt = bfd_get_section_by_name (abfd, relplt_name); |
if (relplt == NULL) |
return 0; |
hdr = &elf_section_data (relplt)->this_hdr; |
if (hdr->sh_link != elf_dynsymtab (abfd) |
|| (hdr->sh_type != SHT_REL && hdr->sh_type != SHT_RELA)) |
return 0; |
slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table; |
if (! (*slurp_relocs) (abfd, relplt, dynsyms, TRUE)) |
return -1; |
count = relplt->size / hdr->sh_entsize; |
size = count * sizeof (asymbol); |
p = relplt->relocation; |
for (i = 0; i < count; i++, p += bed->s->int_rels_per_ext_rel) |
{ |
size += strlen ((*p->sym_ptr_ptr)->name) + sizeof ("@plt"); |
if (p->addend != 0) |
{ |
#ifdef BFD64 |
size += sizeof ("+0x") - 1 + 8 + 8 * (bed->s->elfclass == ELFCLASS64); |
#else |
size += sizeof ("+0x") - 1 + 8; |
#endif |
} |
} |
plt_sym_val = get_plt_sym_val (abfd, dynsyms, plt, relplt); |
if (plt_sym_val == NULL) |
return -1; |
s = *ret = (asymbol *) bfd_malloc (size); |
if (s == NULL) |
{ |
free (plt_sym_val); |
return -1; |
} |
names = (char *) (s + count); |
p = relplt->relocation; |
n = 0; |
for (i = 0; i < count; i++, p += bed->s->int_rels_per_ext_rel) |
{ |
size_t len; |
bfd_vma addr; |
addr = plt_sym_val[i]; |
if (addr == (bfd_vma) -1) |
continue; |
*s = **p->sym_ptr_ptr; |
/* Undefined syms won't have BSF_LOCAL or BSF_GLOBAL set. Since |
we are defining a symbol, ensure one of them is set. */ |
if ((s->flags & BSF_LOCAL) == 0) |
s->flags |= BSF_GLOBAL; |
s->flags |= BSF_SYNTHETIC; |
s->section = plt; |
s->value = addr - plt->vma; |
s->name = names; |
s->udata.p = NULL; |
len = strlen ((*p->sym_ptr_ptr)->name); |
memcpy (names, (*p->sym_ptr_ptr)->name, len); |
names += len; |
if (p->addend != 0) |
{ |
char buf[30], *a; |
memcpy (names, "+0x", sizeof ("+0x") - 1); |
names += sizeof ("+0x") - 1; |
bfd_sprintf_vma (abfd, buf, p->addend); |
for (a = buf; *a == '0'; ++a) |
; |
len = strlen (a); |
memcpy (names, a, len); |
names += len; |
} |
memcpy (names, "@plt", sizeof ("@plt")); |
names += sizeof ("@plt"); |
++s, ++n; |
} |
free (plt_sym_val); |
return n; |
} |
/contrib/toolchain/binutils/bfd/elf-linux-psinfo.h |
---|
1,5 → 1,5 |
/* Definitions for PRPSINFO structures under ELF on GNU/Linux. |
Copyright 2013 Free Software Foundation, Inc. |
Copyright (C) 2013-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
/contrib/toolchain/binutils/bfd/elf-nacl.c |
---|
1,5 → 1,5 |
/* Native Client support for ELF |
Copyright 2012, 2013 Free Software Foundation, Inc. |
Copyright (C) 2012-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
/contrib/toolchain/binutils/bfd/elf-nacl.h |
---|
1,5 → 1,5 |
/* Native Client support for ELF |
Copyright 2012, 2013 Free Software Foundation, Inc. |
Copyright (C) 2012-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
/contrib/toolchain/binutils/bfd/elf-strtab.c |
---|
1,6 → 1,5 |
/* ELF strtab with GC and suffix merging support. |
Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2008 |
Free Software Foundation, Inc. |
Copyright (C) 2001-2015 Free Software Foundation, Inc. |
Written by Jakub Jelinek <jakub@redhat.com>. |
This file is part of BFD, the Binary File Descriptor library. |
/contrib/toolchain/binutils/bfd/elf-vxworks.c |
---|
1,5 → 1,5 |
/* VxWorks support for ELF |
Copyright 2005, 2006, 2007, 2009, 2012 Free Software Foundation, Inc. |
Copyright (C) 2005-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
64,7 → 64,7 |
give the symbol weak binding to get the desired samantics. |
This transformation will be undone in |
elf_i386_vxworks_link_output_symbol_hook. */ |
if ((info->shared || abfd->flags & DYNAMIC) |
if ((bfd_link_pic (info) || abfd->flags & DYNAMIC) |
&& elf_vxworks_gott_symbol_p (abfd, *namep)) |
{ |
sym->st_info = ELF_ST_INFO (STB_WEAK, ELF_ST_TYPE (sym->st_info)); |
89,7 → 89,7 |
htab = elf_hash_table (info); |
bed = get_elf_backend_data (dynobj); |
if (!info->shared) |
if (!bfd_link_pic (info)) |
{ |
s = bfd_make_section_anyway_with_flags (dynobj, |
bed->default_use_rela_p |
/contrib/toolchain/binutils/bfd/elf-vxworks.h |
---|
1,5 → 1,5 |
/* VxWorks support for ELF |
Copyright 2005, 2006, 2007 Free Software Foundation, Inc. |
Copyright (C) 2005-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
/contrib/toolchain/binutils/bfd/elf.c |
---|
1,6 → 1,6 |
/* ELF executable support for BFD. |
Copyright 1993-2013 Free Software Foundation, Inc. |
Copyright (C) 1993-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
51,7 → 51,7 |
static int elf_sort_sections (const void *, const void *); |
static bfd_boolean assign_file_positions_except_relocs (bfd *, struct bfd_link_info *); |
static bfd_boolean prep_headers (bfd *); |
static bfd_boolean swap_out_syms (bfd *, struct bfd_strtab_hash **, int) ; |
static bfd_boolean swap_out_syms (bfd *, struct elf_strtab_hash **, int) ; |
static bfd_boolean elf_read_notes (bfd *, file_ptr, bfd_size_type) ; |
static bfd_boolean elf_parse_notes (bfd *abfd, char *buf, size_t size, |
file_ptr offset); |
297,13 → 297,14 |
/* Allocate and clear an extra byte at the end, to prevent crashes |
in case the string table is not terminated. */ |
if (shstrtabsize + 1 <= 1 |
|| (shstrtab = (bfd_byte *) bfd_alloc (abfd, shstrtabsize + 1)) == NULL |
|| bfd_seek (abfd, offset, SEEK_SET) != 0) |
|| bfd_seek (abfd, offset, SEEK_SET) != 0 |
|| (shstrtab = (bfd_byte *) bfd_alloc (abfd, shstrtabsize + 1)) == NULL) |
shstrtab = NULL; |
else if (bfd_bread (shstrtab, shstrtabsize, abfd) != shstrtabsize) |
{ |
if (bfd_get_error () != bfd_error_system_call) |
bfd_set_error (bfd_error_file_truncated); |
bfd_release (abfd, shstrtab); |
shstrtab = NULL; |
/* Once we've failed to read it, make sure we don't keep |
trying. Otherwise, we'll keep allocating space for |
332,10 → 333,20 |
hdr = elf_elfsections (abfd)[shindex]; |
if (hdr->contents == NULL |
&& bfd_elf_get_str_section (abfd, shindex) == NULL) |
if (hdr->contents == NULL) |
{ |
if (hdr->sh_type != SHT_STRTAB && hdr->sh_type < SHT_LOOS) |
{ |
/* PR 17512: file: f057ec89. */ |
_bfd_error_handler (_("%B: attempt to load strings from a non-string section (number %d)"), |
abfd, shindex); |
return NULL; |
} |
if (bfd_elf_get_str_section (abfd, shindex) == NULL) |
return NULL; |
} |
if (strindex >= hdr->sh_size) |
{ |
unsigned int shstrndx = elf_elfheader(abfd)->e_shstrndx; |
389,9 → 400,29 |
/* Normal syms might have section extension entries. */ |
shndx_hdr = NULL; |
if (symtab_hdr == &elf_tdata (ibfd)->symtab_hdr) |
shndx_hdr = &elf_tdata (ibfd)->symtab_shndx_hdr; |
if (elf_symtab_shndx_list (ibfd) != NULL) |
{ |
elf_section_list * entry; |
Elf_Internal_Shdr **sections = elf_elfsections (ibfd); |
/* Find an index section that is linked to this symtab section. */ |
for (entry = elf_symtab_shndx_list (ibfd); entry != NULL; entry = entry->next) |
if (sections[entry->hdr.sh_link] == symtab_hdr) |
{ |
shndx_hdr = & entry->hdr; |
break; |
}; |
if (shndx_hdr == NULL) |
{ |
if (symtab_hdr == & elf_symtab_hdr (ibfd)) |
/* Not really accurate, but this was how the old code used to work. */ |
shndx_hdr = & elf_symtab_shndx_list (ibfd)->hdr; |
/* Otherwise we do nothing. The assumption is that |
the index table will not be needed. */ |
} |
} |
/* Read the symbols. */ |
alloc_ext = NULL; |
alloc_extshndx = NULL; |
608,9 → 639,10 |
if (shdr->contents == NULL) |
{ |
_bfd_error_handler |
(_("%B: Corrupt size field in group section header: 0x%lx"), abfd, shdr->sh_size); |
(_("%B: corrupt size field in group section header: 0x%lx"), abfd, shdr->sh_size); |
bfd_set_error (bfd_error_bad_value); |
return FALSE; |
-- num_group; |
continue; |
} |
memset (shdr->contents, 0, amt); |
618,7 → 650,16 |
if (bfd_seek (abfd, shdr->sh_offset, SEEK_SET) != 0 |
|| (bfd_bread (shdr->contents, shdr->sh_size, abfd) |
!= shdr->sh_size)) |
return FALSE; |
{ |
_bfd_error_handler |
(_("%B: invalid size field in group section header: 0x%lx"), abfd, shdr->sh_size); |
bfd_set_error (bfd_error_bad_value); |
-- num_group; |
/* PR 17510: If the group contents are even partially |
corrupt, do not allow any of the contents to be used. */ |
memset (shdr->contents, 0, amt); |
continue; |
} |
/* Translate raw contents, a flag word followed by an |
array of elf section indices all in target byte order, |
626,6 → 667,7 |
pointers. */ |
src = shdr->contents + shdr->sh_size; |
dest = (Elf_Internal_Group *) (shdr->contents + amt); |
while (1) |
{ |
unsigned int idx; |
651,8 → 693,23 |
} |
} |
} |
/* PR 17510: Corrupt binaries might contain invalid groups. */ |
if (num_group != (unsigned) elf_tdata (abfd)->num_group) |
{ |
elf_tdata (abfd)->num_group = num_group; |
/* If all groups are invalid then fail. */ |
if (num_group == 0) |
{ |
elf_tdata (abfd)->group_sect_ptr = NULL; |
elf_tdata (abfd)->num_group = num_group = -1; |
(*_bfd_error_handler) (_("%B: no valid group sections found"), abfd); |
bfd_set_error (bfd_error_bad_value); |
} |
} |
} |
} |
if (num_group != (unsigned) -1) |
{ |
716,6 → 773,7 |
{ |
(*_bfd_error_handler) (_("%B: no group info for section %A"), |
abfd, newsect); |
return FALSE; |
} |
return TRUE; |
} |
779,9 → 837,22 |
for (i = 0; i < num_group; i++) |
{ |
Elf_Internal_Shdr *shdr = elf_tdata (abfd)->group_sect_ptr[i]; |
Elf_Internal_Group *idx = (Elf_Internal_Group *) shdr->contents; |
unsigned int n_elt = shdr->sh_size / 4; |
Elf_Internal_Group *idx; |
unsigned int n_elt; |
/* PR binutils/18758: Beware of corrupt binaries with invalid group data. */ |
if (shdr == NULL || shdr->bfd_section == NULL || shdr->contents == NULL) |
{ |
(*_bfd_error_handler) |
(_("%B: section group entry number %u is corrupt"), |
abfd, i); |
result = FALSE; |
continue; |
} |
idx = (Elf_Internal_Group *) shdr->contents; |
n_elt = shdr->sh_size / 4; |
while (--n_elt != 0) |
if ((++idx)->shdr->bfd_section) |
elf_sec_group (idx->shdr->bfd_section) = shdr->bfd_section; |
817,6 → 888,31 |
return elf_next_in_group (sec) != NULL; |
} |
static char * |
convert_debug_to_zdebug (bfd *abfd, const char *name) |
{ |
unsigned int len = strlen (name); |
char *new_name = bfd_alloc (abfd, len + 2); |
if (new_name == NULL) |
return NULL; |
new_name[0] = '.'; |
new_name[1] = 'z'; |
memcpy (new_name + 2, name + 1, len); |
return new_name; |
} |
static char * |
convert_zdebug_to_debug (bfd *abfd, const char *name) |
{ |
unsigned int len = strlen (name); |
char *new_name = bfd_alloc (abfd, len); |
if (new_name == NULL) |
return NULL; |
new_name[0] = '.'; |
memcpy (new_name + 1, name + 2, len - 1); |
return new_name; |
} |
/* Make a BFD section from an ELF section. We store a pointer to the |
BFD section in the bfd_section field of the header. */ |
1003,27 → 1099,38 |
|| (name[1] == 'z' && name[7] == '_'))) |
{ |
enum { nothing, compress, decompress } action = nothing; |
char *new_name; |
int compression_header_size; |
bfd_size_type uncompressed_size; |
bfd_boolean compressed |
= bfd_is_section_compressed_with_header (abfd, newsect, |
&compression_header_size, |
&uncompressed_size); |
if (bfd_is_section_compressed (abfd, newsect)) |
if (compressed) |
{ |
/* Compressed section. Check if we should decompress. */ |
if ((abfd->flags & BFD_DECOMPRESS)) |
action = decompress; |
} |
else |
/* Compress the uncompressed section or convert from/to .zdebug* |
section. Check if we should compress. */ |
if (action == nothing) |
{ |
/* Normal section. Check if we should compress. */ |
if ((abfd->flags & BFD_COMPRESS) && newsect->size != 0) |
if (newsect->size != 0 |
&& (abfd->flags & BFD_COMPRESS) |
&& compression_header_size >= 0 |
&& uncompressed_size > 0 |
&& (!compressed |
|| ((compression_header_size > 0) |
!= ((abfd->flags & BFD_COMPRESS_GABI) != 0)))) |
action = compress; |
else |
return TRUE; |
} |
new_name = NULL; |
switch (action) |
if (action == compress) |
{ |
case nothing: |
break; |
case compress: |
if (!bfd_init_section_compress_status (abfd, newsect)) |
{ |
(*_bfd_error_handler) |
1031,19 → 1138,9 |
abfd, name); |
return FALSE; |
} |
if (name[1] != 'z') |
} |
else |
{ |
unsigned int len = strlen (name); |
new_name = bfd_alloc (abfd, len + 2); |
if (new_name == NULL) |
return FALSE; |
new_name[0] = '.'; |
new_name[1] = 'z'; |
memcpy (new_name + 2, name + 1, len); |
} |
break; |
case decompress: |
if (!bfd_init_section_decompress_status (abfd, newsect)) |
{ |
(*_bfd_error_handler) |
1051,20 → 1148,28 |
abfd, name); |
return FALSE; |
} |
if (name[1] == 'z') |
} |
if (abfd->is_linker_input) |
{ |
unsigned int len = strlen (name); |
new_name = bfd_alloc (abfd, len); |
if (name[1] == 'z' |
&& (action == decompress |
|| (action == compress |
&& (abfd->flags & BFD_COMPRESS_GABI) != 0))) |
{ |
/* Convert section name from .zdebug_* to .debug_* so |
that linker will consider this section as a debug |
section. */ |
char *new_name = convert_zdebug_to_debug (abfd, name); |
if (new_name == NULL) |
return FALSE; |
new_name[0] = '.'; |
memcpy (new_name + 1, name + 2, len - 1); |
bfd_rename_section (abfd, newsect, new_name); |
} |
break; |
} |
if (new_name != NULL) |
bfd_rename_section (abfd, newsect, new_name); |
else |
/* For objdump, don't rename the section. For objcopy, delay |
section rename to elf_fake_sections. */ |
newsect->flags |= SEC_ELF_RENAME; |
} |
return TRUE; |
1117,16 → 1222,84 |
|| 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_gp (obfd) = elf_gp (ibfd); |
if (!elf_flags_init (obfd)) |
{ |
elf_elfheader (obfd)->e_flags = elf_elfheader (ibfd)->e_flags; |
elf_flags_init (obfd) = TRUE; |
} |
elf_gp (obfd) = elf_gp (ibfd); |
/* Also copy the EI_OSABI field. */ |
elf_elfheader (obfd)->e_ident[EI_OSABI] = |
elf_elfheader (ibfd)->e_ident[EI_OSABI]; |
/* Copy object attributes. */ |
_bfd_elf_copy_obj_attributes (ibfd, obfd); |
/* This is an feature for objcopy --only-keep-debug: When a section's type |
is changed to NOBITS, we preserve the sh_link and sh_info fields so that |
they can be matched up with the original. */ |
Elf_Internal_Shdr ** iheaders = elf_elfsections (ibfd); |
Elf_Internal_Shdr ** oheaders = elf_elfsections (obfd); |
if (iheaders != NULL && oheaders != NULL) |
{ |
unsigned int i; |
for (i = 0; i < elf_numsections (obfd); i++) |
{ |
unsigned int j; |
Elf_Internal_Shdr * oheader = oheaders[i]; |
if (oheader == NULL |
|| oheader->sh_type != SHT_NOBITS |
|| oheader->sh_size == 0 |
|| (oheader->sh_info != 0 && oheader->sh_link != 0)) |
continue; |
/* Scan for the matching section in the input bfd. |
FIXME: We could use something better than a linear scan here. |
Unfortunately we cannot compare names as the output string table |
is empty, so instead we check size, address and type. */ |
for (j = 0; j < elf_numsections (ibfd); j++) |
{ |
Elf_Internal_Shdr * iheader = iheaders[j]; |
/* Since --only-keep-debug turns all non-debug sections |
into SHT_NOBITS sections, the output SHT_NOBITS type |
matches any input type. */ |
if ((oheader->sh_type == SHT_NOBITS |
|| iheader->sh_type == oheader->sh_type) |
&& iheader->sh_flags == oheader->sh_flags |
&& iheader->sh_addralign == oheader->sh_addralign |
&& iheader->sh_entsize == oheader->sh_entsize |
&& iheader->sh_size == oheader->sh_size |
&& iheader->sh_addr == oheader->sh_addr |
&& (iheader->sh_info != oheader->sh_info |
|| iheader->sh_link != oheader->sh_link)) |
{ |
/* Note: Strictly speaking these assignments are wrong. |
The sh_link and sh_info fields should point to the |
relevent sections in the output BFD, which may not be in |
the same location as they were in the input BFD. But the |
whole point of this action is to preserve the original |
values of the sh_link and sh_info fields, so that they |
can be matched up with the section headers in the |
original file. So strictly speaking we may be creating |
an invalid ELF file, but it is only for a file that just |
contains debug info and only for sections without any |
contents. */ |
if (oheader->sh_link == 0) |
oheader->sh_link = iheader->sh_link; |
if (oheader->sh_info == 0) |
oheader->sh_info = iheader->sh_info; |
break; |
} |
} |
} |
} |
return TRUE; |
} |
1223,8 → 1396,13 |
swap_dyn_in = get_elf_backend_data (abfd)->s->swap_dyn_in; |
extdyn = dynbuf; |
/* PR 17512: file: 6f427532. */ |
if (s->size < extdynsize) |
goto error_return; |
extdynend = extdyn + s->size; |
for (; extdyn < extdynend; extdyn += extdynsize) |
/* PR 17512: file: id:000006,sig:06,src:000000,op:flip4,pos:5664. |
Fix range check. */ |
for (; extdyn <= (extdynend - extdynsize); extdyn += extdynsize) |
{ |
Elf_Internal_Dyn dyn; |
const char *name = ""; |
1392,6 → 1570,53 |
return FALSE; |
} |
/* Get version string. */ |
const char * |
_bfd_elf_get_symbol_version_string (bfd *abfd, asymbol *symbol, |
bfd_boolean *hidden) |
{ |
const char *version_string = NULL; |
if (elf_dynversym (abfd) != 0 |
&& (elf_dynverdef (abfd) != 0 || elf_dynverref (abfd) != 0)) |
{ |
unsigned int vernum = ((elf_symbol_type *) symbol)->version; |
*hidden = (vernum & VERSYM_HIDDEN) != 0; |
vernum &= VERSYM_VERSION; |
if (vernum == 0) |
version_string = ""; |
else if (vernum == 1) |
version_string = "Base"; |
else if (vernum <= elf_tdata (abfd)->cverdefs) |
version_string = |
elf_tdata (abfd)->verdef[vernum - 1].vd_nodename; |
else |
{ |
Elf_Internal_Verneed *t; |
version_string = ""; |
for (t = elf_tdata (abfd)->verref; |
t != NULL; |
t = t->vn_nextref) |
{ |
Elf_Internal_Vernaux *a; |
for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) |
{ |
if (a->vna_other == vernum) |
{ |
version_string = a->vna_nodename; |
break; |
} |
} |
} |
} |
} |
return version_string; |
} |
/* Display ELF-specific fields of a symbol. */ |
void |
1418,6 → 1643,8 |
const struct elf_backend_data *bed; |
unsigned char st_other; |
bfd_vma val; |
const char *version_string; |
bfd_boolean hidden; |
section_name = symbol->section ? symbol->section->name : "(*none*)"; |
1443,45 → 1670,12 |
bfd_fprintf_vma (abfd, file, val); |
/* If we have version information, print it. */ |
if (elf_dynversym (abfd) != 0 |
&& (elf_dynverdef (abfd) != 0 |
|| elf_dynverref (abfd) != 0)) |
version_string = _bfd_elf_get_symbol_version_string (abfd, |
symbol, |
&hidden); |
if (version_string) |
{ |
unsigned int vernum; |
const char *version_string; |
vernum = ((elf_symbol_type *) symbol)->version & VERSYM_VERSION; |
if (vernum == 0) |
version_string = ""; |
else if (vernum == 1) |
version_string = "Base"; |
else if (vernum <= elf_tdata (abfd)->cverdefs) |
version_string = |
elf_tdata (abfd)->verdef[vernum - 1].vd_nodename; |
else |
{ |
Elf_Internal_Verneed *t; |
version_string = ""; |
for (t = elf_tdata (abfd)->verref; |
t != NULL; |
t = t->vn_nextref) |
{ |
Elf_Internal_Vernaux *a; |
for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr) |
{ |
if (a->vna_other == vernum) |
{ |
version_string = a->vna_nodename; |
break; |
} |
} |
} |
} |
if ((((elf_symbol_type *) symbol)->version & VERSYM_HIDDEN) == 0) |
if (!hidden) |
fprintf (file, " %-11s", version_string); |
else |
{ |
1514,29 → 1708,6 |
} |
} |
/* Allocate an ELF string table--force the first byte to be zero. */ |
struct bfd_strtab_hash * |
_bfd_elf_stringtab_init (void) |
{ |
struct bfd_strtab_hash *ret; |
ret = _bfd_stringtab_init (); |
if (ret != NULL) |
{ |
bfd_size_type loc; |
loc = _bfd_stringtab_add (ret, "", TRUE, FALSE); |
BFD_ASSERT (loc == 0 || loc == (bfd_size_type) -1); |
if (loc == (bfd_size_type) -1) |
{ |
_bfd_stringtab_free (ret); |
ret = NULL; |
} |
} |
return ret; |
} |
/* ELF .o/exec file reading */ |
/* Create a new bfd section from an ELF section header. */ |
1548,16 → 1719,50 |
Elf_Internal_Ehdr *ehdr; |
const struct elf_backend_data *bed; |
const char *name; |
bfd_boolean ret = TRUE; |
static bfd_boolean * sections_being_created = NULL; |
static bfd * sections_being_created_abfd = NULL; |
static unsigned int nesting = 0; |
if (shindex >= elf_numsections (abfd)) |
return FALSE; |
if (++ nesting > 3) |
{ |
/* PR17512: A corrupt ELF binary might contain a recursive group of |
sections, with each the string indicies pointing to the next in the |
loop. Detect this here, by refusing to load a section that we are |
already in the process of loading. We only trigger this test if |
we have nested at least three sections deep as normal ELF binaries |
can expect to recurse at least once. |
FIXME: It would be better if this array was attached to the bfd, |
rather than being held in a static pointer. */ |
if (sections_being_created_abfd != abfd) |
sections_being_created = NULL; |
if (sections_being_created == NULL) |
{ |
/* FIXME: It would be more efficient to attach this array to the bfd somehow. */ |
sections_being_created = (bfd_boolean *) |
bfd_zalloc (abfd, elf_numsections (abfd) * sizeof (bfd_boolean)); |
sections_being_created_abfd = abfd; |
} |
if (sections_being_created [shindex]) |
{ |
(*_bfd_error_handler) |
(_("%B: warning: loop in section dependencies detected"), abfd); |
return FALSE; |
} |
sections_being_created [shindex] = TRUE; |
} |
hdr = elf_elfsections (abfd)[shindex]; |
ehdr = elf_elfheader (abfd); |
name = bfd_elf_string_from_elf_section (abfd, ehdr->e_shstrndx, |
hdr->sh_name); |
if (name == NULL) |
return FALSE; |
goto fail; |
bed = get_elf_backend_data (abfd); |
switch (hdr->sh_type) |
1564,7 → 1769,7 |
{ |
case SHT_NULL: |
/* Inactive section. Throw it away. */ |
return TRUE; |
goto success; |
case SHT_PROGBITS: /* Normal section with contents. */ |
case SHT_NOBITS: /* .bss section. */ |
1575,11 → 1780,13 |
case SHT_PREINIT_ARRAY: /* .preinit_array section. */ |
case SHT_GNU_LIBLIST: /* .gnu.liblist section. */ |
case SHT_GNU_HASH: /* .gnu.hash section. */ |
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
goto success; |
case SHT_DYNAMIC: /* Dynamic linking information. */ |
if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) |
return FALSE; |
goto fail; |
if (hdr->sh_link > elf_numsections (abfd)) |
{ |
/* PR 10478: Accept Solaris binaries with a sh_link |
1593,11 → 1800,11 |
break; |
/* Otherwise fall through. */ |
default: |
return FALSE; |
goto fail; |
} |
} |
else if (elf_elfsections (abfd)[hdr->sh_link] == NULL) |
return FALSE; |
goto fail; |
else if (elf_elfsections (abfd)[hdr->sh_link]->sh_type != SHT_STRTAB) |
{ |
Elf_Internal_Shdr *dynsymhdr; |
1626,28 → 1833,38 |
} |
} |
} |
break; |
goto success; |
case SHT_SYMTAB: /* A symbol table */ |
case SHT_SYMTAB: /* A symbol table. */ |
if (elf_onesymtab (abfd) == shindex) |
return TRUE; |
goto success; |
if (hdr->sh_entsize != bed->s->sizeof_sym) |
return FALSE; |
goto fail; |
if (hdr->sh_info * hdr->sh_entsize > hdr->sh_size) |
{ |
if (hdr->sh_size != 0) |
return FALSE; |
goto fail; |
/* Some assemblers erroneously set sh_info to one with a |
zero sh_size. ld sees this as a global symbol count |
of (unsigned) -1. Fix it here. */ |
hdr->sh_info = 0; |
return TRUE; |
goto success; |
} |
BFD_ASSERT (elf_onesymtab (abfd) == 0); |
/* PR 18854: A binary might contain more than one symbol table. |
Unusual, but possible. Warn, but continue. */ |
if (elf_onesymtab (abfd) != 0) |
{ |
(*_bfd_error_handler) |
(_("%B: warning: multiple symbol tables detected - ignoring the table in section %u"), |
abfd, shindex); |
goto success; |
} |
elf_onesymtab (abfd) = shindex; |
elf_tdata (abfd)->symtab_hdr = *hdr; |
elf_elfsections (abfd)[shindex] = hdr = &elf_tdata (abfd)->symtab_hdr; |
elf_symtab_hdr (abfd) = *hdr; |
elf_elfsections (abfd)[shindex] = hdr = & elf_symtab_hdr (abfd); |
abfd->flags |= HAS_SYMS; |
/* Sometimes a shared object will map in the symbol table. If |
1660,53 → 1877,73 |
&& (abfd->flags & DYNAMIC) != 0 |
&& ! _bfd_elf_make_section_from_shdr (abfd, hdr, name, |
shindex)) |
return FALSE; |
goto fail; |
/* Go looking for SHT_SYMTAB_SHNDX too, since if there is one we |
can't read symbols without that section loaded as well. It |
is most likely specified by the next section header. */ |
if (elf_elfsections (abfd)[elf_symtab_shndx (abfd)]->sh_link != shindex) |
{ |
elf_section_list * entry; |
unsigned int i, num_sec; |
for (entry = elf_symtab_shndx_list (abfd); entry != NULL; entry = entry->next) |
if (entry->hdr.sh_link == shindex) |
goto success; |
num_sec = elf_numsections (abfd); |
for (i = shindex + 1; i < num_sec; i++) |
{ |
Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i]; |
if (hdr2->sh_type == SHT_SYMTAB_SHNDX |
&& hdr2->sh_link == shindex) |
break; |
} |
if (i == num_sec) |
for (i = 1; i < shindex; i++) |
{ |
Elf_Internal_Shdr *hdr2 = elf_elfsections (abfd)[i]; |
if (hdr2->sh_type == SHT_SYMTAB_SHNDX |
&& hdr2->sh_link == shindex) |
break; |
} |
if (i != shindex) |
return bfd_section_from_shdr (abfd, i); |
ret = bfd_section_from_shdr (abfd, i); |
/* else FIXME: we have failed to find the symbol table - should we issue an error ? */ |
goto success; |
} |
return TRUE; |
case SHT_DYNSYM: /* A dynamic symbol table */ |
case SHT_DYNSYM: /* A dynamic symbol table. */ |
if (elf_dynsymtab (abfd) == shindex) |
return TRUE; |
goto success; |
if (hdr->sh_entsize != bed->s->sizeof_sym) |
return FALSE; |
goto fail; |
if (hdr->sh_info * hdr->sh_entsize > hdr->sh_size) |
{ |
if (hdr->sh_size != 0) |
return FALSE; |
goto fail; |
/* Some linkers erroneously set sh_info to one with a |
zero sh_size. ld sees this as a global symbol count |
of (unsigned) -1. Fix it here. */ |
hdr->sh_info = 0; |
return TRUE; |
goto success; |
} |
BFD_ASSERT (elf_dynsymtab (abfd) == 0); |
/* PR 18854: A binary might contain more than one dynamic symbol table. |
Unusual, but possible. Warn, but continue. */ |
if (elf_dynsymtab (abfd) != 0) |
{ |
(*_bfd_error_handler) |
(_("%B: warning: multiple dynamic symbol tables detected - ignoring the table in section %u"), |
abfd, shindex); |
goto success; |
} |
elf_dynsymtab (abfd) = shindex; |
elf_tdata (abfd)->dynsymtab_hdr = *hdr; |
elf_elfsections (abfd)[shindex] = hdr = &elf_tdata (abfd)->dynsymtab_hdr; |
1714,34 → 1951,47 |
/* Besides being a symbol table, we also treat this as a regular |
section, so that objcopy can handle it. */ |
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
goto success; |
case SHT_SYMTAB_SHNDX: /* Symbol section indices when >64k sections */ |
if (elf_symtab_shndx (abfd) == shindex) |
return TRUE; |
case SHT_SYMTAB_SHNDX: /* Symbol section indices when >64k sections. */ |
{ |
elf_section_list * entry; |
BFD_ASSERT (elf_symtab_shndx (abfd) == 0); |
elf_symtab_shndx (abfd) = shindex; |
elf_tdata (abfd)->symtab_shndx_hdr = *hdr; |
elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->symtab_shndx_hdr; |
return TRUE; |
for (entry = elf_symtab_shndx_list (abfd); entry != NULL; entry = entry->next) |
if (entry->ndx == shindex) |
goto success; |
case SHT_STRTAB: /* A string table */ |
entry = bfd_alloc (abfd, sizeof * entry); |
if (entry == NULL) |
goto fail; |
entry->ndx = shindex; |
entry->hdr = * hdr; |
entry->next = elf_symtab_shndx_list (abfd); |
elf_symtab_shndx_list (abfd) = entry; |
elf_elfsections (abfd)[shindex] = & entry->hdr; |
goto success; |
} |
case SHT_STRTAB: /* A string table. */ |
if (hdr->bfd_section != NULL) |
return TRUE; |
goto success; |
if (ehdr->e_shstrndx == shindex) |
{ |
elf_tdata (abfd)->shstrtab_hdr = *hdr; |
elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->shstrtab_hdr; |
return TRUE; |
goto success; |
} |
if (elf_elfsections (abfd)[elf_onesymtab (abfd)]->sh_link == shindex) |
{ |
symtab_strtab: |
elf_tdata (abfd)->strtab_hdr = *hdr; |
elf_elfsections (abfd)[shindex] = &elf_tdata (abfd)->strtab_hdr; |
return TRUE; |
goto success; |
} |
if (elf_elfsections (abfd)[elf_dynsymtab (abfd)]->sh_link == shindex) |
{ |
dynsymtab_strtab: |
1750,8 → 2000,9 |
elf_elfsections (abfd)[shindex] = hdr; |
/* We also treat this as a regular section, so that objcopy |
can handle it. */ |
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, |
ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, |
shindex); |
goto success; |
} |
/* If the string table isn't one of the above, then treat it as a |
1769,9 → 2020,9 |
{ |
/* Prevent endless recursion on broken objects. */ |
if (i == shindex) |
return FALSE; |
goto fail; |
if (! bfd_section_from_shdr (abfd, i)) |
return FALSE; |
goto fail; |
if (elf_onesymtab (abfd) == i) |
goto symtab_strtab; |
if (elf_dynsymtab (abfd) == i) |
1779,7 → 2030,8 |
} |
} |
} |
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
goto success; |
case SHT_REL: |
case SHT_RELA: |
1794,7 → 2046,7 |
if (hdr->sh_entsize |
!= (bfd_size_type) (hdr->sh_type == SHT_REL |
? bed->s->sizeof_rel : bed->s->sizeof_rela)) |
return FALSE; |
goto fail; |
/* Check for a bogus link to avoid crashing. */ |
if (hdr->sh_link >= num_sec) |
1802,8 → 2054,9 |
((*_bfd_error_handler) |
(_("%B: invalid link %lu for reloc section %s (index %u)"), |
abfd, hdr->sh_link, name, shindex)); |
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, |
ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, |
shindex); |
goto success; |
} |
/* For some incomprehensible reason Oracle distributes |
1844,7 → 2097,7 |
if ((elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_SYMTAB |
|| elf_elfsections (abfd)[hdr->sh_link]->sh_type == SHT_DYNSYM) |
&& ! bfd_section_from_shdr (abfd, hdr->sh_link)) |
return FALSE; |
goto fail; |
/* If this reloc section does not use the main symbol table we |
don't treat it as a reloc section. BFD can't adequately |
1859,14 → 2112,18 |
|| hdr->sh_info >= num_sec |
|| elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_REL |
|| elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_RELA) |
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, |
{ |
ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, |
shindex); |
goto success; |
} |
if (! bfd_section_from_shdr (abfd, hdr->sh_info)) |
return FALSE; |
goto fail; |
target_sect = bfd_section_from_elf_index (abfd, hdr->sh_info); |
if (target_sect == NULL) |
return FALSE; |
goto fail; |
esdt = elf_section_data (target_sect); |
if (hdr->sh_type == SHT_RELA) |
1874,11 → 2131,13 |
else |
p_hdr = &esdt->rel.hdr; |
BFD_ASSERT (*p_hdr == NULL); |
/* PR 17512: file: 0b4f81b7. */ |
if (*p_hdr != NULL) |
goto fail; |
amt = sizeof (*hdr2); |
hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt); |
if (hdr2 == NULL) |
return FALSE; |
goto fail; |
*hdr2 = *hdr; |
*p_hdr = hdr2; |
elf_elfsections (abfd)[shindex] = hdr2; |
1894,40 → 2153,48 |
target_sect->use_rela_p = 1; |
} |
abfd->flags |= HAS_RELOC; |
return TRUE; |
goto success; |
} |
case SHT_GNU_verdef: |
elf_dynverdef (abfd) = shindex; |
elf_tdata (abfd)->dynverdef_hdr = *hdr; |
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
goto success; |
case SHT_GNU_versym: |
if (hdr->sh_entsize != sizeof (Elf_External_Versym)) |
return FALSE; |
goto fail; |
elf_dynversym (abfd) = shindex; |
elf_tdata (abfd)->dynversym_hdr = *hdr; |
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
goto success; |
case SHT_GNU_verneed: |
elf_dynverref (abfd) = shindex; |
elf_tdata (abfd)->dynverref_hdr = *hdr; |
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
goto success; |
case SHT_SHLIB: |
return TRUE; |
goto success; |
case SHT_GROUP: |
if (! IS_VALID_GROUP_SECTION_HEADER (hdr, GRP_ENTRY_SIZE)) |
return FALSE; |
goto fail; |
if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) |
return FALSE; |
goto fail; |
if (hdr->contents != NULL) |
{ |
Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents; |
unsigned int n_elt = hdr->sh_size / GRP_ENTRY_SIZE; |
unsigned int n_elt = hdr->sh_size / sizeof (* idx); |
asection *s; |
if (n_elt == 0) |
goto fail; |
if (idx->flags & GRP_COMDAT) |
hdr->bfd_section->flags |
|= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; |
1934,6 → 2201,7 |
/* We try to keep the same section order as it comes in. */ |
idx += n_elt; |
while (--n_elt != 0) |
{ |
--idx; |
1947,7 → 2215,7 |
} |
} |
} |
break; |
goto success; |
default: |
/* Possibly an attributes section. */ |
1955,14 → 2223,14 |
|| hdr->sh_type == bed->obj_attrs_section_type) |
{ |
if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex)) |
return FALSE; |
goto fail; |
_bfd_elf_parse_attributes (abfd, hdr); |
return TRUE; |
goto success; |
} |
/* Check for any processor-specific section types. */ |
if (bed->elf_backend_section_from_shdr (abfd, hdr, name, shindex)) |
return TRUE; |
goto success; |
if (hdr->sh_type >= SHT_LOUSER && hdr->sh_type <= SHT_HIUSER) |
{ |
1974,10 → 2242,13 |
"specific section `%s' [0x%8x]"), |
abfd, name, hdr->sh_type); |
else |
{ |
/* Allow sections reserved for applications. */ |
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, |
ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, |
shindex); |
goto success; |
} |
} |
else if (hdr->sh_type >= SHT_LOPROC |
&& hdr->sh_type <= SHT_HIPROC) |
/* FIXME: We should handle this section. */ |
1997,9 → 2268,12 |
"`%s' [0x%8x]"), |
abfd, name, hdr->sh_type); |
else |
{ |
/* Otherwise it should be processed. */ |
return _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); |
goto success; |
} |
} |
else |
/* FIXME: We should handle this section. */ |
(*_bfd_error_handler) |
2006,11 → 2280,21 |
(_("%B: don't know how to handle section `%s' [0x%8x]"), |
abfd, name, hdr->sh_type); |
return FALSE; |
goto fail; |
} |
return TRUE; |
fail: |
ret = FALSE; |
success: |
if (sections_being_created && sections_being_created_abfd == abfd) |
sections_being_created [shindex] = FALSE; |
if (-- nesting == 0) |
{ |
sections_being_created = NULL; |
sections_being_created_abfd = abfd; |
} |
return ret; |
} |
/* Return the local symbol specified by ABFD, R_SYMNDX. */ |
2516,6 → 2800,27 |
return elf_section_data (sec)->rela.hdr; |
} |
static bfd_boolean |
_bfd_elf_set_reloc_sh_name (bfd *abfd, |
Elf_Internal_Shdr *rel_hdr, |
const char *sec_name, |
bfd_boolean use_rela_p) |
{ |
char *name = (char *) bfd_alloc (abfd, |
sizeof ".rela" + strlen (sec_name)); |
if (name == NULL) |
return FALSE; |
sprintf (name, "%s%s", use_rela_p ? ".rela" : ".rel", sec_name); |
rel_hdr->sh_name = |
(unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd), name, |
FALSE); |
if (rel_hdr->sh_name == (unsigned int) -1) |
return FALSE; |
return TRUE; |
} |
/* Allocate and initialize a section-header for a new reloc section, |
containing relocations against ASECT. It is stored in RELDATA. If |
USE_RELA_P is TRUE, we use RELA relocations; otherwise, we use REL |
2524,11 → 2829,11 |
static bfd_boolean |
_bfd_elf_init_reloc_shdr (bfd *abfd, |
struct bfd_elf_section_reloc_data *reldata, |
asection *asect, |
bfd_boolean use_rela_p) |
const char *sec_name, |
bfd_boolean use_rela_p, |
bfd_boolean delay_st_name_p) |
{ |
Elf_Internal_Shdr *rel_hdr; |
char *name; |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
bfd_size_type amt; |
2537,16 → 2842,11 |
rel_hdr = bfd_zalloc (abfd, amt); |
reldata->hdr = rel_hdr; |
amt = sizeof ".rela" + strlen (asect->name); |
name = (char *) bfd_alloc (abfd, amt); |
if (name == NULL) |
if (delay_st_name_p) |
rel_hdr->sh_name = (unsigned int) -1; |
else if (!_bfd_elf_set_reloc_sh_name (abfd, rel_hdr, sec_name, |
use_rela_p)) |
return FALSE; |
sprintf (name, "%s%s", use_rela_p ? ".rela" : ".rel", asect->name); |
rel_hdr->sh_name = |
(unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd), name, |
FALSE); |
if (rel_hdr->sh_name == (unsigned int) -1) |
return FALSE; |
rel_hdr->sh_type = use_rela_p ? SHT_RELA : SHT_REL; |
rel_hdr->sh_entsize = (use_rela_p |
? bed->s->sizeof_rela |
2587,6 → 2887,8 |
struct bfd_elf_section_data *esd = elf_section_data (asect); |
Elf_Internal_Shdr *this_hdr; |
unsigned int sh_type; |
const char *name = asect->name; |
bfd_boolean delay_st_name_p = FALSE; |
if (arg->failed) |
{ |
2597,13 → 2899,73 |
this_hdr = &esd->this_hdr; |
this_hdr->sh_name = (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd), |
asect->name, FALSE); |
if (arg->link_info) |
{ |
/* ld: compress DWARF debug sections with names: .debug_*. */ |
if ((arg->link_info->compress_debug & COMPRESS_DEBUG) |
&& (asect->flags & SEC_DEBUGGING) |
&& name[1] == 'd' |
&& name[6] == '_') |
{ |
/* Set SEC_ELF_COMPRESS to indicate this section should be |
compressed. */ |
asect->flags |= SEC_ELF_COMPRESS; |
/* If this section will be compressed, delay adding setion |
name to section name section after it is compressed in |
_bfd_elf_assign_file_positions_for_non_load. */ |
delay_st_name_p = TRUE; |
} |
} |
else if ((asect->flags & SEC_ELF_RENAME)) |
{ |
/* objcopy: rename output DWARF debug section. */ |
if ((abfd->flags & (BFD_DECOMPRESS | BFD_COMPRESS_GABI))) |
{ |
/* When we decompress or compress with SHF_COMPRESSED, |
convert section name from .zdebug_* to .debug_* if |
needed. */ |
if (name[1] == 'z') |
{ |
char *new_name = convert_zdebug_to_debug (abfd, name); |
if (new_name == NULL) |
{ |
arg->failed = TRUE; |
return; |
} |
name = new_name; |
} |
} |
else if (asect->compress_status == COMPRESS_SECTION_DONE) |
{ |
/* PR binutils/18087: Compression does not always make a |
section smaller. So only rename the section when |
compression has actually taken place. If input section |
name is .zdebug_*, we should never compress it again. */ |
char *new_name = convert_debug_to_zdebug (abfd, name); |
if (new_name == NULL) |
{ |
arg->failed = TRUE; |
return; |
} |
BFD_ASSERT (name[1] != 'z'); |
name = new_name; |
} |
} |
if (delay_st_name_p) |
this_hdr->sh_name = (unsigned int) -1; |
else |
{ |
this_hdr->sh_name |
= (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd), |
name, FALSE); |
if (this_hdr->sh_name == (unsigned int) -1) |
{ |
arg->failed = TRUE; |
return; |
} |
} |
/* Don't clear sh_flags. Assembler may set additional bits. */ |
2616,6 → 2978,15 |
this_hdr->sh_offset = 0; |
this_hdr->sh_size = asect->size; |
this_hdr->sh_link = 0; |
/* PR 17512: file: 0eb809fe, 8b0535ee. */ |
if (asect->alignment_power >= (sizeof (bfd_vma) * 8) - 1) |
{ |
(*_bfd_error_handler) |
(_("%B: error: Alignment power %d of section `%A' is too big"), |
abfd, asect, asect->alignment_power); |
arg->failed = TRUE; |
return; |
} |
this_hdr->sh_addralign = (bfd_vma) 1 << asect->alignment_power; |
/* The sh_entsize and sh_info fields may have been set already by |
copy_private_section_data. */ |
2764,16 → 3135,19 |
if (arg->link_info |
/* Do the normal setup if we wouldn't create any sections here. */ |
&& esd->rel.count + esd->rela.count > 0 |
&& (arg->link_info->relocatable || arg->link_info->emitrelocations)) |
&& (bfd_link_relocatable (arg->link_info) |
|| arg->link_info->emitrelocations)) |
{ |
if (esd->rel.count && esd->rel.hdr == NULL |
&& !_bfd_elf_init_reloc_shdr (abfd, &esd->rel, asect, FALSE)) |
&& !_bfd_elf_init_reloc_shdr (abfd, &esd->rel, name, FALSE, |
delay_st_name_p)) |
{ |
arg->failed = TRUE; |
return; |
} |
if (esd->rela.count && esd->rela.hdr == NULL |
&& !_bfd_elf_init_reloc_shdr (abfd, &esd->rela, asect, TRUE)) |
&& !_bfd_elf_init_reloc_shdr (abfd, &esd->rela, name, TRUE, |
delay_st_name_p)) |
{ |
arg->failed = TRUE; |
return; |
2782,8 → 3156,9 |
else if (!_bfd_elf_init_reloc_shdr (abfd, |
(asect->use_rela_p |
? &esd->rela : &esd->rel), |
asect, |
asect->use_rela_p)) |
name, |
asect->use_rela_p, |
delay_st_name_p)) |
arg->failed = TRUE; |
} |
2917,6 → 3292,48 |
H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc); |
} |
/* Return the section which RELOC_SEC applies to. */ |
asection * |
_bfd_elf_get_reloc_section (asection *reloc_sec) |
{ |
const char *name; |
unsigned int type; |
bfd *abfd; |
if (reloc_sec == NULL) |
return NULL; |
type = elf_section_data (reloc_sec)->this_hdr.sh_type; |
if (type != SHT_REL && type != SHT_RELA) |
return NULL; |
/* We look up the section the relocs apply to by name. */ |
name = reloc_sec->name; |
if (type == SHT_REL) |
name += 4; |
else |
name += 5; |
/* If a target needs .got.plt section, relocations in rela.plt/rel.plt |
section apply to .got.plt section. */ |
abfd = reloc_sec->owner; |
if (get_elf_backend_data (abfd)->want_got_plt |
&& strcmp (name, ".plt") == 0) |
{ |
/* .got.plt is a linker created input section. It may be mapped |
to some other output section. Try two likely sections. */ |
name = ".got.plt"; |
reloc_sec = bfd_get_section_by_name (abfd, name); |
if (reloc_sec != NULL) |
return reloc_sec; |
name = ".got"; |
} |
reloc_sec = bfd_get_section_by_name (abfd, name); |
return reloc_sec; |
} |
/* Assign all ELF section numbers. The dummy first section is handled here |
too. The link/info pointers for the standard section types are filled |
in here too, while we're at it. */ |
2926,7 → 3343,7 |
{ |
struct elf_obj_tdata *t = elf_tdata (abfd); |
asection *sec; |
unsigned int section_number, secn; |
unsigned int section_number; |
Elf_Internal_Shdr **i_shdrp; |
struct bfd_elf_section_data *d; |
bfd_boolean need_symtab; |
2936,7 → 3353,7 |
_bfd_elf_strtab_clear_all_refs (elf_shstrtab (abfd)); |
/* SHT_GROUP sections are in relocatable files only. */ |
if (link_info == NULL || link_info->relocatable) |
if (link_info == NULL || bfd_link_relocatable (link_info)) |
{ |
/* Put SHT_GROUP sections first. */ |
for (sec = abfd->sections; sec != NULL; sec = sec->next) |
2963,10 → 3380,12 |
if (d->this_hdr.sh_type != SHT_GROUP) |
d->this_idx = section_number++; |
if (d->this_hdr.sh_name != (unsigned int) -1) |
_bfd_elf_strtab_addref (elf_shstrtab (abfd), d->this_hdr.sh_name); |
if (d->rel.hdr) |
{ |
d->rel.idx = section_number++; |
if (d->rel.hdr->sh_name != (unsigned int) -1) |
_bfd_elf_strtab_addref (elf_shstrtab (abfd), d->rel.hdr->sh_name); |
} |
else |
2975,6 → 3394,7 |
if (d->rela.hdr) |
{ |
d->rela.idx = section_number++; |
if (d->rela.hdr->sh_name != (unsigned int) -1) |
_bfd_elf_strtab_addref (elf_shstrtab (abfd), d->rela.hdr->sh_name); |
} |
else |
2995,11 → 3415,17 |
_bfd_elf_strtab_addref (elf_shstrtab (abfd), t->symtab_hdr.sh_name); |
if (section_number > ((SHN_LORESERVE - 2) & 0xFFFF)) |
{ |
elf_symtab_shndx (abfd) = section_number++; |
t->symtab_shndx_hdr.sh_name |
elf_section_list * entry; |
BFD_ASSERT (elf_symtab_shndx_list (abfd) == NULL); |
entry = bfd_zalloc (abfd, sizeof * entry); |
entry->ndx = section_number++; |
elf_symtab_shndx_list (abfd) = entry; |
entry->hdr.sh_name |
= (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd), |
".symtab_shndx", FALSE); |
if (t->symtab_shndx_hdr.sh_name == (unsigned int) -1) |
if (entry->hdr.sh_name == (unsigned int) -1) |
return FALSE; |
} |
elf_strtab_sec (abfd) = section_number++; |
3013,9 → 3439,6 |
return FALSE; |
} |
_bfd_elf_strtab_finalize (elf_shstrtab (abfd)); |
t->shstrtab_hdr.sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd)); |
elf_numsections (abfd) = section_number; |
elf_elfheader (abfd)->e_shnum = section_number; |
3042,8 → 3465,10 |
i_shdrp[elf_onesymtab (abfd)] = &t->symtab_hdr; |
if (elf_numsections (abfd) > (SHN_LORESERVE & 0xFFFF)) |
{ |
i_shdrp[elf_symtab_shndx (abfd)] = &t->symtab_shndx_hdr; |
t->symtab_shndx_hdr.sh_link = elf_onesymtab (abfd); |
elf_section_list * entry = elf_symtab_shndx_list (abfd); |
BFD_ASSERT (entry != NULL); |
i_shdrp[entry->ndx] = & entry->hdr; |
entry->hdr.sh_link = elf_onesymtab (abfd); |
} |
i_shdrp[elf_strtab_sec (abfd)] = &t->strtab_hdr; |
t->symtab_hdr.sh_link = elf_strtab_sec (abfd); |
3052,7 → 3477,6 |
for (sec = abfd->sections; sec; sec = sec->next) |
{ |
asection *s; |
const char *name; |
d = elf_section_data (sec); |
3071,11 → 3495,13 |
{ |
d->rel.hdr->sh_link = elf_onesymtab (abfd); |
d->rel.hdr->sh_info = d->this_idx; |
d->rel.hdr->sh_flags |= SHF_INFO_LINK; |
} |
if (d->rela.idx != 0) |
{ |
d->rela.hdr->sh_link = elf_onesymtab (abfd); |
d->rela.hdr->sh_info = d->this_idx; |
d->rela.hdr->sh_flags |= SHF_INFO_LINK; |
} |
/* We need to set up sh_link for SHF_LINK_ORDER. */ |
3154,15 → 3580,12 |
if (s != NULL) |
d->this_hdr.sh_link = elf_section_data (s)->this_idx; |
/* We look up the section the relocs apply to by name. */ |
name = sec->name; |
if (d->this_hdr.sh_type == SHT_REL) |
name += 4; |
else |
name += 5; |
s = bfd_get_section_by_name (abfd, name); |
s = get_elf_backend_data (abfd)->get_reloc_section (sec); |
if (s != NULL) |
{ |
d->this_hdr.sh_info = elf_section_data (s)->this_idx; |
d->this_hdr.sh_flags |= SHF_INFO_LINK; |
} |
break; |
case SHT_STRTAB: |
3233,12 → 3656,10 |
} |
} |
for (secn = 1; secn < section_number; ++secn) |
if (i_shdrp[secn] == NULL) |
i_shdrp[secn] = i_shdrp[0]; |
else |
i_shdrp[secn]->sh_name = _bfd_elf_strtab_offset (elf_shstrtab (abfd), |
i_shdrp[secn]->sh_name); |
/* Delay setting sh_name to _bfd_elf_write_object_contents so that |
_bfd_elf_assign_file_positions_for_non_load can convert DWARF |
debug section name from .debug_* to .zdebug_* if needed. */ |
return TRUE; |
} |
3289,7 → 3710,7 |
unsigned int num_globals = 0; |
unsigned int num_locals2 = 0; |
unsigned int num_globals2 = 0; |
int max_index = 0; |
unsigned int max_index = 0; |
unsigned int idx; |
asection *asect; |
asymbol **new_syms; |
3438,7 → 3859,7 |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
struct fake_section_arg fsargs; |
bfd_boolean failed; |
struct bfd_strtab_hash *strtab = NULL; |
struct elf_strtab_hash *strtab = NULL; |
Elf_Internal_Shdr *shstrtab_hdr; |
bfd_boolean need_symtab; |
3453,7 → 3874,6 |
return FALSE; |
/* Post process the headers if necessary. */ |
if (bed->elf_backend_post_process_headers) |
(*bed->elf_backend_post_process_headers) (abfd, link_info); |
fsargs.failed = FALSE; |
3492,11 → 3912,11 |
shstrtab_hdr->sh_type = SHT_STRTAB; |
shstrtab_hdr->sh_flags = 0; |
shstrtab_hdr->sh_addr = 0; |
shstrtab_hdr->sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd)); |
/* sh_size is set in _bfd_elf_assign_file_positions_for_non_load. */ |
shstrtab_hdr->sh_entsize = 0; |
shstrtab_hdr->sh_link = 0; |
shstrtab_hdr->sh_info = 0; |
/* sh_offset is set in assign_file_positions_except_relocs. */ |
/* sh_offset is set in _bfd_elf_assign_file_positions_for_non_load. */ |
shstrtab_hdr->sh_addralign = 1; |
if (!assign_file_positions_except_relocs (abfd, link_info)) |
3509,12 → 3929,16 |
off = elf_next_file_pos (abfd); |
hdr = &elf_tdata (abfd)->symtab_hdr; |
hdr = & elf_symtab_hdr (abfd); |
off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE); |
hdr = &elf_tdata (abfd)->symtab_shndx_hdr; |
if (elf_symtab_shndx_list (abfd) != NULL) |
{ |
hdr = & elf_symtab_shndx_list (abfd)->hdr; |
if (hdr->sh_size != 0) |
off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE); |
/* FIXME: What about other symtab_shndx sections in the list ? */ |
} |
hdr = &elf_tdata (abfd)->strtab_hdr; |
off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE); |
3524,9 → 3948,9 |
/* Now that we know where the .strtab section goes, write it |
out. */ |
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 |
|| ! _bfd_stringtab_emit (abfd, strtab)) |
|| ! _bfd_elf_strtab_emit (abfd, strtab)) |
return FALSE; |
_bfd_stringtab_free (strtab); |
_bfd_elf_strtab_free (strtab); |
} |
abfd->output_has_begun = TRUE; |
3865,6 → 4289,11 |
last_size = 0; |
phdr_index = 0; |
maxpagesize = bed->maxpagesize; |
/* PR 17512: file: c8455299. |
Avoid divide-by-zero errors later on. |
FIXME: Should we abort if the maxpagesize is zero ? */ |
if (maxpagesize == 0) |
maxpagesize = 1; |
writable = FALSE; |
dynsec = bfd_get_section_by_name (abfd, ".dynamic"); |
if (dynsec != NULL |
3935,11 → 4364,18 |
new_segment = TRUE; |
} |
else if ((last_hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) == 0 |
&& (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0) |
&& (hdr->flags & (SEC_LOAD | SEC_THREAD_LOCAL)) != 0 |
&& ((abfd->flags & D_PAGED) == 0 |
|| (((last_hdr->lma + last_size - 1) & -maxpagesize) |
!= (hdr->lma & -maxpagesize)))) |
{ |
/* We don't want to put a loadable section after a |
nonloadable section in the same segment. |
Consider .tbss sections as loadable for this purpose. */ |
/* We don't want to put a loaded section after a |
nonloaded (ie. bss style) section in the same segment |
as that will force the non-loaded section to be loaded. |
Consider .tbss sections as loaded for this purpose. |
However, like the writable/non-writable case below, |
if they are on the same page then they must be put |
in the same segment. */ |
new_segment = TRUE; |
} |
else if ((abfd->flags & D_PAGED) == 0) |
4109,12 → 4545,32 |
/* Mandated PF_R. */ |
m->p_flags = PF_R; |
m->p_flags_valid = 1; |
s = first_tls; |
for (i = 0; i < (unsigned int) tls_count; ++i) |
{ |
BFD_ASSERT (first_tls->flags & SEC_THREAD_LOCAL); |
m->sections[i] = first_tls; |
first_tls = first_tls->next; |
if ((s->flags & SEC_THREAD_LOCAL) == 0) |
{ |
_bfd_error_handler |
(_("%B: TLS sections are not adjacent:"), abfd); |
s = first_tls; |
i = 0; |
while (i < (unsigned int) tls_count) |
{ |
if ((s->flags & SEC_THREAD_LOCAL) != 0) |
{ |
_bfd_error_handler (_(" TLS: %A"), s); |
i++; |
} |
else |
_bfd_error_handler (_(" non-TLS: %A"), s); |
s = s->next; |
} |
bfd_set_error (bfd_error_bad_value); |
goto error_return; |
} |
m->sections[i] = s; |
s = s->next; |
} |
*pm = m; |
pm = &m->next; |
4176,11 → 4632,7 |
== (SEC_LOAD | SEC_HAS_CONTENTS)) |
break; |
if (i == (unsigned) -1) |
continue; |
if (m->sections[i]->vma + m->sections[i]->size |
>= info->relro_end) |
if (i != (unsigned) -1) |
break; |
} |
} |
4194,9 → 4646,6 |
goto error_return; |
m->next = NULL; |
m->p_type = PT_GNU_RELRO; |
m->p_flags = PF_R; |
m->p_flags_valid = 1; |
*pm = m; |
pm = &m->next; |
} |
4305,6 → 4754,9 |
static file_ptr |
vma_page_aligned_bias (bfd_vma vma, ufile_ptr off, bfd_vma maxpagesize) |
{ |
/* PR binutils/16199: Handle an alignment of zero. */ |
if (maxpagesize == 0) |
maxpagesize = 1; |
return ((vma - off) % maxpagesize); |
} |
4781,6 → 5233,7 |
p->p_flags |= PF_W; |
} |
} |
off -= off_adjust; |
/* Check that all sections are in a PT_LOAD segment. |
4832,7 → 5285,7 |
{ |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
Elf_Internal_Shdr **i_shdrpp; |
Elf_Internal_Shdr **hdrpp; |
Elf_Internal_Shdr **hdrpp, **end_hdrpp; |
Elf_Internal_Phdr *phdrs; |
Elf_Internal_Phdr *p; |
struct elf_segment_map *m; |
4840,14 → 5293,12 |
bfd_vma filehdr_vaddr, filehdr_paddr; |
bfd_vma phdrs_vaddr, phdrs_paddr; |
file_ptr off; |
unsigned int num_sec; |
unsigned int i; |
unsigned int count; |
i_shdrpp = elf_elfsections (abfd); |
num_sec = elf_numsections (abfd); |
end_hdrpp = i_shdrpp + elf_numsections (abfd); |
off = elf_next_file_pos (abfd); |
for (i = 1, hdrpp = i_shdrpp + 1; i < num_sec; i++, hdrpp++) |
for (hdrpp = i_shdrpp + 1; hdrpp < end_hdrpp; hdrpp++) |
{ |
Elf_Internal_Shdr *hdr; |
4878,9 → 5329,14 |
} |
else if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA) |
&& hdr->bfd_section == NULL) |
|| (hdr->bfd_section != NULL |
&& (hdr->bfd_section->flags & SEC_ELF_COMPRESS)) |
/* Compress DWARF debug sections. */ |
|| hdr == i_shdrpp[elf_onesymtab (abfd)] |
|| hdr == i_shdrpp[elf_symtab_shndx (abfd)] |
|| hdr == i_shdrpp[elf_strtab_sec (abfd)]) |
|| (elf_symtab_shndx_list (abfd) != NULL |
&& hdr == i_shdrpp[elf_symtab_shndx_list (abfd)->ndx]) |
|| hdr == i_shdrpp[elf_strtab_sec (abfd)] |
|| hdr == i_shdrpp[elf_shstrtab_sec (abfd)]) |
hdr->sh_offset = -1; |
else |
off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE); |
4982,14 → 5438,11 |
{ |
if (lp->p_type == PT_LOAD |
&& lp->p_vaddr < link_info->relro_end |
&& lp->p_vaddr + lp->p_filesz >= link_info->relro_end |
&& lm->count != 0 |
&& lm->sections[0]->vma >= link_info->relro_start) |
break; |
} |
/* PR ld/14207. If the RELRO segment doesn't fit in the |
LOAD segment, it should be removed. */ |
BFD_ASSERT (lm != NULL); |
} |
else |
5024,7 → 5477,7 |
if (!m->p_align_valid) |
p->p_align = 1; |
if (!m->p_flags_valid) |
p->p_flags = (lp->p_flags & ~PF_W); |
p->p_flags = PF_R; |
} |
else |
{ |
5039,11 → 5492,19 |
} |
else if (m->count != 0) |
{ |
unsigned int i; |
if (p->p_type != PT_LOAD |
&& (p->p_type != PT_NOTE |
|| bfd_get_format (abfd) != bfd_core)) |
{ |
BFD_ASSERT (!m->includes_filehdr && !m->includes_phdrs); |
if (m->includes_filehdr || m->includes_phdrs) |
{ |
/* PR 17512: file: 2195325e. */ |
(*_bfd_error_handler) |
(_("%B: warning: non-load segment includes file header and/or program header"), |
abfd); |
return FALSE; |
} |
p->p_filesz = 0; |
p->p_offset = m->sections[0]->filepos; |
5079,6 → 5540,15 |
return TRUE; |
} |
static elf_section_list * |
find_section_in_list (unsigned int i, elf_section_list * list) |
{ |
for (;list != NULL; list = list->next) |
if (list->ndx == i) |
break; |
return list; |
} |
/* Work out the file positions of all the sections. This is called by |
_bfd_elf_compute_section_file_positions. All the section sizes and |
VMAs must be known before this is called. |
5099,7 → 5569,6 |
{ |
struct elf_obj_tdata *tdata = elf_tdata (abfd); |
Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd); |
file_ptr off; |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0 |
5109,6 → 5578,7 |
unsigned int num_sec = elf_numsections (abfd); |
Elf_Internal_Shdr **hdrpp; |
unsigned int i; |
file_ptr off; |
/* Start after the ELF header. */ |
off = i_ehdrp->e_ehsize; |
5123,9 → 5593,14 |
hdr = *hdrpp; |
if (((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA) |
&& hdr->bfd_section == NULL) |
|| (hdr->bfd_section != NULL |
&& (hdr->bfd_section->flags & SEC_ELF_COMPRESS)) |
/* Compress DWARF debug sections. */ |
|| i == elf_onesymtab (abfd) |
|| i == elf_symtab_shndx (abfd) |
|| i == elf_strtab_sec (abfd)) |
|| (elf_symtab_shndx_list (abfd) != NULL |
&& hdr == i_shdrpp[elf_symtab_shndx_list (abfd)->ndx]) |
|| i == elf_strtab_sec (abfd) |
|| i == elf_shstrtab_sec (abfd)) |
{ |
hdr->sh_offset = -1; |
} |
5132,6 → 5607,8 |
else |
off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE); |
} |
elf_next_file_pos (abfd) = off; |
} |
else |
{ |
5152,22 → 5629,32 |
return FALSE; |
} |
/* Set e_type in ELF header to ET_EXEC for -pie -Ttext-segment=. */ |
if (link_info != NULL && bfd_link_pie (link_info)) |
{ |
unsigned int num_segments = elf_elfheader (abfd)->e_phnum; |
Elf_Internal_Phdr *segment = elf_tdata (abfd)->phdr; |
Elf_Internal_Phdr *end_segment = &segment[num_segments]; |
/* Find the lowest p_vaddr in PT_LOAD segments. */ |
bfd_vma p_vaddr = (bfd_vma) -1; |
for (; segment < end_segment; segment++) |
if (segment->p_type == PT_LOAD && p_vaddr > segment->p_vaddr) |
p_vaddr = segment->p_vaddr; |
/* Set e_type to ET_EXEC if the lowest p_vaddr in PT_LOAD |
segments is non-zero. */ |
if (p_vaddr) |
i_ehdrp->e_type = ET_EXEC; |
} |
/* Write out the program headers. */ |
alloc = elf_program_header_size (abfd) / bed->s->sizeof_phdr; |
if (bfd_seek (abfd, (bfd_signed_vma) bed->s->sizeof_ehdr, SEEK_SET) != 0 |
|| bed->s->write_out_phdrs (abfd, tdata->phdr, alloc) != 0) |
return FALSE; |
off = elf_next_file_pos (abfd); |
} |
/* Place the section headers. */ |
off = align_file_position (off, 1 << bed->s->log_file_align); |
i_ehdrp->e_shoff = off; |
off += i_ehdrp->e_shnum * i_ehdrp->e_shentsize; |
elf_next_file_pos (abfd) = off; |
return TRUE; |
} |
5252,7 → 5739,7 |
elf_tdata (abfd)->shstrtab_hdr.sh_name = |
(unsigned int) _bfd_elf_strtab_add (shstrtab, ".shstrtab", FALSE); |
if (elf_tdata (abfd)->symtab_hdr.sh_name == (unsigned int) -1 |
|| elf_tdata (abfd)->symtab_hdr.sh_name == (unsigned int) -1 |
|| elf_tdata (abfd)->strtab_hdr.sh_name == (unsigned int) -1 |
|| elf_tdata (abfd)->shstrtab_hdr.sh_name == (unsigned int) -1) |
return FALSE; |
5260,29 → 5747,101 |
} |
/* Assign file positions for all the reloc sections which are not part |
of the loadable file image. */ |
of the loadable file image, and the file position of section headers. */ |
void |
_bfd_elf_assign_file_positions_for_relocs (bfd *abfd) |
static bfd_boolean |
_bfd_elf_assign_file_positions_for_non_load (bfd *abfd) |
{ |
file_ptr off; |
unsigned int i, num_sec; |
Elf_Internal_Shdr **shdrpp; |
Elf_Internal_Shdr **shdrpp, **end_shdrpp; |
Elf_Internal_Shdr *shdrp; |
Elf_Internal_Ehdr *i_ehdrp; |
const struct elf_backend_data *bed; |
off = elf_next_file_pos (abfd); |
num_sec = elf_numsections (abfd); |
for (i = 1, shdrpp = elf_elfsections (abfd) + 1; i < num_sec; i++, shdrpp++) |
shdrpp = elf_elfsections (abfd); |
end_shdrpp = shdrpp + elf_numsections (abfd); |
for (shdrpp++; shdrpp < end_shdrpp; shdrpp++) |
{ |
Elf_Internal_Shdr *shdrp; |
shdrp = *shdrpp; |
if (shdrp->sh_offset == -1) |
{ |
asection *sec = shdrp->bfd_section; |
bfd_boolean is_rel = (shdrp->sh_type == SHT_REL |
|| shdrp->sh_type == SHT_RELA); |
if (is_rel |
|| (sec != NULL && (sec->flags & SEC_ELF_COMPRESS))) |
{ |
if (!is_rel) |
{ |
const char *name = sec->name; |
struct bfd_elf_section_data *d; |
shdrp = *shdrpp; |
if ((shdrp->sh_type == SHT_REL || shdrp->sh_type == SHT_RELA) |
&& shdrp->sh_offset == -1) |
off = _bfd_elf_assign_file_position_for_section (shdrp, off, TRUE); |
/* Compress DWARF debug sections. */ |
if (!bfd_compress_section (abfd, sec, |
shdrp->contents)) |
return FALSE; |
if (sec->compress_status == COMPRESS_SECTION_DONE |
&& (abfd->flags & BFD_COMPRESS_GABI) == 0) |
{ |
/* If section is compressed with zlib-gnu, convert |
section name from .debug_* to .zdebug_*. */ |
char *new_name |
= convert_debug_to_zdebug (abfd, name); |
if (new_name == NULL) |
return FALSE; |
name = new_name; |
} |
/* Add setion name to section name section. */ |
if (shdrp->sh_name != (unsigned int) -1) |
abort (); |
shdrp->sh_name |
= (unsigned int) _bfd_elf_strtab_add (elf_shstrtab (abfd), |
name, FALSE); |
d = elf_section_data (sec); |
/* Add reloc setion name to section name section. */ |
if (d->rel.hdr |
&& !_bfd_elf_set_reloc_sh_name (abfd, |
d->rel.hdr, |
name, FALSE)) |
return FALSE; |
if (d->rela.hdr |
&& !_bfd_elf_set_reloc_sh_name (abfd, |
d->rela.hdr, |
name, TRUE)) |
return FALSE; |
/* Update section size and contents. */ |
shdrp->sh_size = sec->size; |
shdrp->contents = sec->contents; |
shdrp->bfd_section->contents = NULL; |
} |
off = _bfd_elf_assign_file_position_for_section (shdrp, |
off, |
TRUE); |
} |
} |
} |
/* Place section name section after DWARF debug sections have been |
compressed. */ |
_bfd_elf_strtab_finalize (elf_shstrtab (abfd)); |
shdrp = &elf_tdata (abfd)->shstrtab_hdr; |
shdrp->sh_size = _bfd_elf_strtab_size (elf_shstrtab (abfd)); |
off = _bfd_elf_assign_file_position_for_section (shdrp, off, TRUE); |
/* Place the section headers. */ |
i_ehdrp = elf_elfheader (abfd); |
bed = get_elf_backend_data (abfd); |
off = align_file_position (off, 1 << bed->s->log_file_align); |
i_ehdrp->e_shoff = off; |
off += i_ehdrp->e_shnum * i_ehdrp->e_shentsize; |
elf_next_file_pos (abfd) = off; |
return TRUE; |
} |
bfd_boolean |
5305,12 → 5864,16 |
if (failed) |
return FALSE; |
_bfd_elf_assign_file_positions_for_relocs (abfd); |
if (!_bfd_elf_assign_file_positions_for_non_load (abfd)) |
return FALSE; |
/* After writing the headers, we need to write the sections too... */ |
num_sec = elf_numsections (abfd); |
for (count = 1; count < num_sec; count++) |
{ |
i_shdrp[count]->sh_name |
= _bfd_elf_strtab_offset (elf_shstrtab (abfd), |
i_shdrp[count]->sh_name); |
if (bed->elf_backend_section_processing) |
(*bed->elf_backend_section_processing) (abfd, i_shdrp[count]); |
if (i_shdrp[count]->contents) |
5762,8 → 6325,8 |
something. They are allowed by the ELF spec however, so only |
a warning is produced. */ |
if (segment->p_type == PT_LOAD) |
(*_bfd_error_handler) (_("%B: warning: Empty loadable segment" |
" detected, is this intentional ?\n"), |
(*_bfd_error_handler) (_("\ |
%B: warning: Empty loadable segment detected, is this intentional ?"), |
ibfd); |
map->count = 0; |
6213,7 → 6776,7 |
phdr_included = TRUE; |
} |
lowest_section = first_section; |
lowest_section = NULL; |
if (section_count != 0) |
{ |
unsigned int isec = 0; |
6230,7 → 6793,8 |
{ |
bfd_vma seg_off; |
if (section->lma < lowest_section->lma) |
if (lowest_section == NULL |
|| section->lma < lowest_section->lma) |
lowest_section = section; |
/* Section lmas are set up from PT_LOAD header |
6375,7 → 6939,15 |
i++, segment++) |
if (segment->p_type == PT_LOAD |
&& maxpagesize < segment->p_align) |
{ |
/* PR 17512: file: f17299af. */ |
if (segment->p_align > (bfd_vma) 1 << ((sizeof (bfd_vma) * 8) - 2)) |
(*_bfd_error_handler) (_("\ |
%B: warning: segment alignment of 0x%llx is too large"), |
ibfd, (long long) segment->p_align); |
else |
maxpagesize = segment->p_align; |
} |
if (maxpagesize != get_elf_backend_data (obfd)->maxpagesize) |
bfd_emul_set_maxpagesize (bfd_get_target (obfd), maxpagesize); |
6395,7 → 6967,8 |
{ |
Elf_Internal_Shdr *ihdr, *ohdr; |
bfd_boolean final_link = link_info != NULL && !link_info->relocatable; |
bfd_boolean final_link = (link_info != NULL |
&& !bfd_link_relocatable (link_info)); |
if (ibfd->xvec->flavour != bfd_target_elf_flavour |
|| obfd->xvec->flavour != bfd_target_elf_flavour) |
6432,6 → 7005,11 |
elf_next_in_group (osec) = elf_next_in_group (isec); |
elf_section_data (osec)->group = elf_section_data (isec)->group; |
} |
/* If not decompress, preserve SHF_COMPRESSED. */ |
if ((ibfd->flags & BFD_DECOMPRESS) == 0) |
elf_section_flags (osec) |= (elf_section_flags (isec) |
& SHF_COMPRESSED); |
} |
ihdr = &elf_section_data (isec)->this_hdr; |
6610,7 → 7188,7 |
shndx = MAP_STRTAB; |
else if (shndx == elf_shstrtab_sec (ibfd)) |
shndx = MAP_SHSTRTAB; |
else if (shndx == elf_symtab_shndx (ibfd)) |
else if (find_section_in_list (shndx, elf_symtab_shndx_list (ibfd))) |
shndx = MAP_SYM_SHNDX; |
osym->internal_elf_sym.st_shndx = shndx; |
} |
6622,18 → 7200,21 |
static bfd_boolean |
swap_out_syms (bfd *abfd, |
struct bfd_strtab_hash **sttp, |
struct elf_strtab_hash **sttp, |
int relocatable_p) |
{ |
const struct elf_backend_data *bed; |
int symcount; |
asymbol **syms; |
struct bfd_strtab_hash *stt; |
struct elf_strtab_hash *stt; |
Elf_Internal_Shdr *symtab_hdr; |
Elf_Internal_Shdr *symtab_shndx_hdr; |
Elf_Internal_Shdr *symstrtab_hdr; |
struct elf_sym_strtab *symstrtab; |
bfd_byte *outbound_syms; |
bfd_byte *outbound_shndx; |
unsigned long outbound_syms_index; |
unsigned long outbound_shndx_index; |
int idx; |
unsigned int num_locals; |
bfd_size_type amt; |
6643,7 → 7224,7 |
return FALSE; |
/* Dump out the symtabs. */ |
stt = _bfd_elf_stringtab_init (); |
stt = _bfd_elf_strtab_init (); |
if (stt == NULL) |
return FALSE; |
6659,17 → 7240,33 |
symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr; |
symstrtab_hdr->sh_type = SHT_STRTAB; |
/* Allocate buffer to swap out the .strtab section. */ |
symstrtab = (struct elf_sym_strtab *) bfd_malloc ((symcount + 1) |
* sizeof (*symstrtab)); |
if (symstrtab == NULL) |
{ |
_bfd_elf_strtab_free (stt); |
return FALSE; |
} |
outbound_syms = (bfd_byte *) bfd_alloc2 (abfd, 1 + symcount, |
bed->s->sizeof_sym); |
if (outbound_syms == NULL) |
{ |
_bfd_stringtab_free (stt); |
error_return: |
_bfd_elf_strtab_free (stt); |
free (symstrtab); |
return FALSE; |
} |
symtab_hdr->contents = outbound_syms; |
outbound_syms_index = 0; |
outbound_shndx = NULL; |
symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; |
outbound_shndx_index = 0; |
if (elf_symtab_shndx_list (abfd)) |
{ |
symtab_shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr; |
if (symtab_shndx_hdr->sh_name != 0) |
{ |
amt = (bfd_size_type) (1 + symcount) * sizeof (Elf_External_Sym_Shndx); |
6676,10 → 7273,7 |
outbound_shndx = (bfd_byte *) |
bfd_zalloc2 (abfd, 1 + symcount, sizeof (Elf_External_Sym_Shndx)); |
if (outbound_shndx == NULL) |
{ |
_bfd_stringtab_free (stt); |
return FALSE; |
} |
goto error_return; |
symtab_shndx_hdr->contents = outbound_shndx; |
symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX; |
6687,6 → 7281,8 |
symtab_shndx_hdr->sh_addralign = sizeof (Elf_External_Sym_Shndx); |
symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx); |
} |
/* FIXME: What about any other headers in the list ? */ |
} |
/* Now generate the data (for "contents"). */ |
{ |
6699,10 → 7295,12 |
sym.st_other = 0; |
sym.st_shndx = SHN_UNDEF; |
sym.st_target_internal = 0; |
bed->s->swap_symbol_out (abfd, &sym, outbound_syms, outbound_shndx); |
outbound_syms += bed->s->sizeof_sym; |
symstrtab[0].sym = sym; |
symstrtab[0].dest_index = outbound_syms_index; |
symstrtab[0].destshndx_index = outbound_shndx_index; |
outbound_syms_index++; |
if (outbound_shndx != NULL) |
outbound_shndx += sizeof (Elf_External_Sym_Shndx); |
outbound_shndx_index++; |
} |
name_local_sections |
6710,7 → 7308,7 |
&& bed->elf_backend_name_local_section_symbols (abfd)); |
syms = bfd_get_outsymbols (abfd); |
for (idx = 0; idx < symcount; idx++) |
for (idx = 0; idx < symcount;) |
{ |
Elf_Internal_Sym sym; |
bfd_vma value = syms[idx]->value; |
6722,19 → 7320,18 |
&& (flags & (BSF_SECTION_SYM | BSF_GLOBAL)) == BSF_SECTION_SYM) |
{ |
/* Local section symbols have no name. */ |
sym.st_name = 0; |
sym.st_name = (unsigned long) -1; |
} |
else |
{ |
sym.st_name = (unsigned long) _bfd_stringtab_add (stt, |
syms[idx]->name, |
TRUE, FALSE); |
/* Call _bfd_elf_strtab_offset after _bfd_elf_strtab_finalize |
to get the final offset for st_name. */ |
sym.st_name |
= (unsigned long) _bfd_elf_strtab_add (stt, syms[idx]->name, |
FALSE); |
if (sym.st_name == (unsigned long) -1) |
{ |
_bfd_stringtab_free (stt); |
return FALSE; |
goto error_return; |
} |
} |
type_ptr = elf_symbol_from (abfd, syms[idx]); |
6793,7 → 7390,8 |
shndx = elf_shstrtab_sec (abfd); |
break; |
case MAP_SYM_SHNDX: |
shndx = elf_symtab_shndx (abfd); |
if (elf_symtab_shndx_list (abfd)) |
shndx = elf_symtab_shndx_list (abfd)->ndx; |
break; |
default: |
shndx = SHN_ABS; |
6823,8 → 7421,7 |
syms[idx]->name ? syms[idx]->name : "<Local sym>", |
sec->name); |
bfd_set_error (bfd_error_invalid_operation); |
_bfd_stringtab_free (stt); |
return FALSE; |
goto error_return; |
} |
shndx = _bfd_elf_section_from_bfd_section (abfd, sec2); |
6910,14 → 7507,40 |
sym.st_target_internal = 0; |
} |
bed->s->swap_symbol_out (abfd, &sym, outbound_syms, outbound_shndx); |
outbound_syms += bed->s->sizeof_sym; |
idx++; |
symstrtab[idx].sym = sym; |
symstrtab[idx].dest_index = outbound_syms_index; |
symstrtab[idx].destshndx_index = outbound_shndx_index; |
outbound_syms_index++; |
if (outbound_shndx != NULL) |
outbound_shndx += sizeof (Elf_External_Sym_Shndx); |
outbound_shndx_index++; |
} |
/* Finalize the .strtab section. */ |
_bfd_elf_strtab_finalize (stt); |
/* Swap out the .strtab section. */ |
for (idx = 0; idx <= symcount; idx++) |
{ |
struct elf_sym_strtab *elfsym = &symstrtab[idx]; |
if (elfsym->sym.st_name == (unsigned long) -1) |
elfsym->sym.st_name = 0; |
else |
elfsym->sym.st_name = _bfd_elf_strtab_offset (stt, |
elfsym->sym.st_name); |
bed->s->swap_symbol_out (abfd, &elfsym->sym, |
(outbound_syms |
+ (elfsym->dest_index |
* bed->s->sizeof_sym)), |
(outbound_shndx |
+ (elfsym->destshndx_index |
* sizeof (Elf_External_Sym_Shndx)))); |
} |
free (symstrtab); |
*sttp = stt; |
symstrtab_hdr->sh_size = _bfd_stringtab_size (stt); |
symstrtab_hdr->sh_size = _bfd_elf_strtab_size (stt); |
symstrtab_hdr->sh_type = SHT_STRTAB; |
symstrtab_hdr->sh_flags = 0; |
7121,26 → 7744,30 |
hdr = &elf_tdata (abfd)->dynverref_hdr; |
elf_tdata (abfd)->verref = (Elf_Internal_Verneed *) |
bfd_zalloc2 (abfd, hdr->sh_info, sizeof (Elf_Internal_Verneed)); |
if (elf_tdata (abfd)->verref == NULL) |
goto error_return; |
elf_tdata (abfd)->cverrefs = hdr->sh_info; |
contents = (bfd_byte *) bfd_malloc (hdr->sh_size); |
if (contents == NULL) |
if (hdr->sh_info == 0 || hdr->sh_size < sizeof (Elf_External_Verneed)) |
{ |
error_return_bad_verref: |
(*_bfd_error_handler) |
(_("%B: .gnu.version_r invalid entry"), abfd); |
bfd_set_error (bfd_error_bad_value); |
error_return_verref: |
elf_tdata (abfd)->verref = NULL; |
elf_tdata (abfd)->cverrefs = 0; |
goto error_return; |
} |
contents = (bfd_byte *) bfd_malloc (hdr->sh_size); |
if (contents == NULL) |
goto error_return_verref; |
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 |
|| bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size) |
goto error_return_verref; |
if (hdr->sh_info && hdr->sh_size < sizeof (Elf_External_Verneed)) |
elf_tdata (abfd)->verref = (Elf_Internal_Verneed *) |
bfd_zalloc2 (abfd, hdr->sh_info, sizeof (Elf_Internal_Verneed)); |
if (elf_tdata (abfd)->verref == NULL) |
goto error_return_verref; |
BFD_ASSERT (sizeof (Elf_External_Verneed) |
7162,7 → 7789,7 |
bfd_elf_string_from_elf_section (abfd, hdr->sh_link, |
iverneed->vn_file); |
if (iverneed->vn_filename == NULL) |
goto error_return_verref; |
goto error_return_bad_verref; |
if (iverneed->vn_cnt == 0) |
iverneed->vn_auxptr = NULL; |
7177,7 → 7804,7 |
if (iverneed->vn_aux |
> (size_t) (contents_end - (bfd_byte *) everneed)) |
goto error_return_verref; |
goto error_return_bad_verref; |
evernaux = ((Elf_External_Vernaux *) |
((bfd_byte *) everneed + iverneed->vn_aux)); |
7190,36 → 7817,42 |
bfd_elf_string_from_elf_section (abfd, hdr->sh_link, |
ivernaux->vna_name); |
if (ivernaux->vna_nodename == NULL) |
goto error_return_verref; |
goto error_return_bad_verref; |
if (ivernaux->vna_other > freeidx) |
freeidx = ivernaux->vna_other; |
ivernaux->vna_nextptr = NULL; |
if (ivernaux->vna_next == 0) |
{ |
iverneed->vn_cnt = j + 1; |
break; |
} |
if (j + 1 < iverneed->vn_cnt) |
ivernaux->vna_nextptr = ivernaux + 1; |
else |
ivernaux->vna_nextptr = NULL; |
if (ivernaux->vna_next |
> (size_t) (contents_end - (bfd_byte *) evernaux)) |
goto error_return_verref; |
goto error_return_bad_verref; |
evernaux = ((Elf_External_Vernaux *) |
((bfd_byte *) evernaux + ivernaux->vna_next)); |
if (ivernaux->vna_other > freeidx) |
freeidx = ivernaux->vna_other; |
} |
iverneed->vn_nextref = NULL; |
if (iverneed->vn_next == 0) |
break; |
if (i + 1 < hdr->sh_info) |
iverneed->vn_nextref = iverneed + 1; |
else |
iverneed->vn_nextref = NULL; |
if (iverneed->vn_next |
> (size_t) (contents_end - (bfd_byte *) everneed)) |
goto error_return_verref; |
goto error_return_bad_verref; |
everneed = ((Elf_External_Verneed *) |
((bfd_byte *) everneed + iverneed->vn_next)); |
} |
elf_tdata (abfd)->cverrefs = i; |
free (contents); |
contents = NULL; |
7238,16 → 7871,25 |
hdr = &elf_tdata (abfd)->dynverdef_hdr; |
if (hdr->sh_info == 0 || hdr->sh_size < sizeof (Elf_External_Verdef)) |
{ |
error_return_bad_verdef: |
(*_bfd_error_handler) |
(_("%B: .gnu.version_d invalid entry"), abfd); |
bfd_set_error (bfd_error_bad_value); |
error_return_verdef: |
elf_tdata (abfd)->verdef = NULL; |
elf_tdata (abfd)->cverdefs = 0; |
goto error_return; |
} |
contents = (bfd_byte *) bfd_malloc (hdr->sh_size); |
if (contents == NULL) |
goto error_return; |
goto error_return_verdef; |
if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 |
|| bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size) |
goto error_return; |
goto error_return_verdef; |
if (hdr->sh_info && hdr->sh_size < sizeof (Elf_External_Verdef)) |
goto error_return; |
BFD_ASSERT (sizeof (Elf_External_Verdef) |
>= sizeof (Elf_External_Verdaux)); |
contents_end_def = contents + hdr->sh_size |
7264,12 → 7906,17 |
{ |
_bfd_elf_swap_verdef_in (abfd, everdef, &iverdefmem); |
if ((iverdefmem.vd_ndx & ((unsigned) VERSYM_VERSION)) == 0) |
goto error_return_bad_verdef; |
if ((iverdefmem.vd_ndx & ((unsigned) VERSYM_VERSION)) > maxidx) |
maxidx = iverdefmem.vd_ndx & ((unsigned) VERSYM_VERSION); |
if (iverdefmem.vd_next == 0) |
break; |
if (iverdefmem.vd_next |
> (size_t) (contents_end_def - (bfd_byte *) everdef)) |
goto error_return; |
goto error_return_bad_verdef; |
everdef = ((Elf_External_Verdef *) |
((bfd_byte *) everdef + iverdefmem.vd_next)); |
7282,10 → 7929,11 |
else |
freeidx = ++maxidx; |
} |
elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) |
bfd_zalloc2 (abfd, maxidx, sizeof (Elf_Internal_Verdef)); |
if (elf_tdata (abfd)->verdef == NULL) |
goto error_return; |
goto error_return_verdef; |
elf_tdata (abfd)->cverdefs = maxidx; |
7300,15 → 7948,10 |
_bfd_elf_swap_verdef_in (abfd, everdef, &iverdefmem); |
if ((iverdefmem.vd_ndx & VERSYM_VERSION) == 0) |
{ |
error_return_verdef: |
elf_tdata (abfd)->verdef = NULL; |
elf_tdata (abfd)->cverdefs = 0; |
goto error_return; |
} |
goto error_return_bad_verdef; |
iverdef = &iverdefarr[(iverdefmem.vd_ndx & VERSYM_VERSION) - 1]; |
memcpy (iverdef, &iverdefmem, sizeof (Elf_Internal_Verdef)); |
memcpy (iverdef, &iverdefmem, offsetof (Elf_Internal_Verdef, vd_bfd)); |
iverdef->vd_bfd = abfd; |
7325,7 → 7968,7 |
if (iverdef->vd_aux |
> (size_t) (contents_end_aux - (bfd_byte *) everdef)) |
goto error_return_verdef; |
goto error_return_bad_verdef; |
everdaux = ((Elf_External_Verdaux *) |
((bfd_byte *) everdef + iverdef->vd_aux)); |
7338,28 → 7981,34 |
bfd_elf_string_from_elf_section (abfd, hdr->sh_link, |
iverdaux->vda_name); |
if (iverdaux->vda_nodename == NULL) |
goto error_return_verdef; |
goto error_return_bad_verdef; |
iverdaux->vda_nextptr = NULL; |
if (iverdaux->vda_next == 0) |
{ |
iverdef->vd_cnt = j + 1; |
break; |
} |
if (j + 1 < iverdef->vd_cnt) |
iverdaux->vda_nextptr = iverdaux + 1; |
else |
iverdaux->vda_nextptr = NULL; |
if (iverdaux->vda_next |
> (size_t) (contents_end_aux - (bfd_byte *) everdaux)) |
goto error_return_verdef; |
goto error_return_bad_verdef; |
everdaux = ((Elf_External_Verdaux *) |
((bfd_byte *) everdaux + iverdaux->vda_next)); |
} |
iverdef->vd_nodename = NULL; |
if (iverdef->vd_cnt) |
iverdef->vd_nodename = iverdef->vd_auxptr->vda_nodename; |
iverdef->vd_nextdef = NULL; |
if (iverdef->vd_next == 0) |
break; |
if ((size_t) (iverdef - iverdefarr) + 1 < maxidx) |
iverdef->vd_nextdef = iverdef + 1; |
else |
iverdef->vd_nextdef = NULL; |
everdef = ((Elf_External_Verdef *) |
((bfd_byte *) everdef + iverdef->vd_next)); |
7402,14 → 8051,13 |
if (iverdef->vd_nodename == NULL) |
goto error_return_verdef; |
iverdef->vd_nextdef = NULL; |
iverdef->vd_auxptr = (struct elf_internal_verdaux *) |
bfd_alloc (abfd, sizeof (Elf_Internal_Verdaux)); |
iverdef->vd_auxptr = ((struct elf_internal_verdaux *) |
bfd_zalloc (abfd, sizeof (Elf_Internal_Verdaux))); |
if (iverdef->vd_auxptr == NULL) |
goto error_return_verdef; |
iverdaux = iverdef->vd_auxptr; |
iverdaux->vda_nodename = iverdef->vd_nodename; |
iverdaux->vda_nextptr = NULL; |
} |
return TRUE; |
7424,17 → 8072,13 |
_bfd_elf_make_empty_symbol (bfd *abfd) |
{ |
elf_symbol_type *newsym; |
bfd_size_type amt = sizeof (elf_symbol_type); |
newsym = (elf_symbol_type *) bfd_zalloc (abfd, amt); |
newsym = (elf_symbol_type *) bfd_zalloc (abfd, sizeof * newsym); |
if (!newsym) |
return NULL; |
else |
{ |
newsym->symbol.the_bfd = abfd; |
return &newsym->symbol; |
} |
} |
void |
_bfd_elf_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED, |
7470,6 → 8114,47 |
if (name[0] == '_' && name[1] == '.' && name[2] == 'L' && name[3] == '_') |
return TRUE; |
/* Treat assembler generated fake symbols, dollar local labels and |
forward-backward labels (aka local labels) as locals. |
These labels have the form: |
L0^A.* (fake symbols) |
[.]?L[0123456789]+{^A|^B}[0123456789]* (local labels) |
Versions which start with .L will have already been matched above, |
so we only need to match the rest. */ |
if (name[0] == 'L' && ISDIGIT (name[1])) |
{ |
bfd_boolean ret = FALSE; |
const char * p; |
char c; |
for (p = name + 2; (c = *p); p++) |
{ |
if (c == 1 || c == 2) |
{ |
if (c == 1 && p == name + 2) |
/* A fake symbol. */ |
return TRUE; |
/* FIXME: We are being paranoid here and treating symbols like |
L0^Bfoo as if there were non-local, on the grounds that the |
assembler will never generate them. But can any symbol |
containing an ASCII value in the range 1-31 ever be anything |
other than some kind of local ? */ |
ret = TRUE; |
} |
if (! ISDIGIT (c)) |
{ |
ret = FALSE; |
break; |
} |
} |
return ret; |
} |
return FALSE; |
} |
7496,132 → 8181,13 |
return bfd_default_set_arch_mach (abfd, arch, machine); |
} |
/* Find the function to a particular section and offset, |
for error reporting. */ |
static bfd_boolean |
elf_find_function (bfd *abfd, |
asection *section, |
asymbol **symbols, |
bfd_vma offset, |
const char **filename_ptr, |
const char **functionname_ptr) |
{ |
struct elf_find_function_cache |
{ |
asection *last_section; |
asymbol *func; |
const char *filename; |
bfd_size_type func_size; |
} *cache; |
if (symbols == NULL) |
return FALSE; |
cache = elf_tdata (abfd)->elf_find_function_cache; |
if (cache == NULL) |
{ |
cache = bfd_zalloc (abfd, sizeof (*cache)); |
elf_tdata (abfd)->elf_find_function_cache = cache; |
if (cache == NULL) |
return FALSE; |
} |
if (cache->last_section != section |
|| cache->func == NULL |
|| offset < cache->func->value |
|| offset >= cache->func->value + cache->func_size) |
{ |
asymbol *file; |
bfd_vma low_func; |
asymbol **p; |
/* ??? Given multiple file symbols, it is impossible to reliably |
choose the right file name for global symbols. File symbols are |
local symbols, and thus all file symbols must sort before any |
global symbols. The ELF spec may be interpreted to say that a |
file symbol must sort before other local symbols, but currently |
ld -r doesn't do this. So, for ld -r output, it is possible to |
make a better choice of file name for local symbols by ignoring |
file symbols appearing after a given local symbol. */ |
enum { nothing_seen, symbol_seen, file_after_symbol_seen } state; |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
file = NULL; |
low_func = 0; |
state = nothing_seen; |
cache->filename = NULL; |
cache->func = NULL; |
cache->func_size = 0; |
cache->last_section = section; |
for (p = symbols; *p != NULL; p++) |
{ |
asymbol *sym = *p; |
bfd_vma code_off; |
bfd_size_type size; |
if ((sym->flags & BSF_FILE) != 0) |
{ |
file = sym; |
if (state == symbol_seen) |
state = file_after_symbol_seen; |
continue; |
} |
size = bed->maybe_function_sym (sym, section, &code_off); |
if (size != 0 |
&& code_off <= offset |
&& (code_off > low_func |
|| (code_off == low_func |
&& size > cache->func_size))) |
{ |
cache->func = sym; |
cache->func_size = size; |
cache->filename = NULL; |
low_func = code_off; |
if (file != NULL |
&& ((sym->flags & BSF_LOCAL) != 0 |
|| state != file_after_symbol_seen)) |
cache->filename = bfd_asymbol_name (file); |
} |
if (state == nothing_seen) |
state = symbol_seen; |
} |
} |
if (cache->func == NULL) |
return FALSE; |
if (filename_ptr) |
*filename_ptr = cache->filename; |
if (functionname_ptr) |
*functionname_ptr = bfd_asymbol_name (cache->func); |
return TRUE; |
} |
/* Find the nearest line to a particular section and offset, |
for error reporting. */ |
bfd_boolean |
_bfd_elf_find_nearest_line (bfd *abfd, |
asection *section, |
asymbol **symbols, |
bfd_vma offset, |
const char **filename_ptr, |
const char **functionname_ptr, |
unsigned int *line_ptr) |
{ |
return _bfd_elf_find_nearest_line_discriminator (abfd, section, symbols, |
offset, filename_ptr, |
functionname_ptr, |
line_ptr, |
NULL); |
} |
bfd_boolean |
_bfd_elf_find_nearest_line_discriminator (bfd *abfd, |
asection *section, |
asymbol **symbols, |
bfd_vma offset, |
const char **filename_ptr, |
const char **functionname_ptr, |
7630,32 → 8196,22 |
{ |
bfd_boolean found; |
if (_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset, |
if (_bfd_dwarf2_find_nearest_line (abfd, symbols, NULL, section, offset, |
filename_ptr, functionname_ptr, |
line_ptr, discriminator_ptr, |
dwarf_debug_sections, 0, |
&elf_tdata (abfd)->dwarf2_find_line_info) |
|| _bfd_dwarf1_find_nearest_line (abfd, symbols, section, offset, |
filename_ptr, functionname_ptr, |
line_ptr)) |
{ |
if (!*functionname_ptr) |
elf_find_function (abfd, section, symbols, offset, |
_bfd_elf_find_function (abfd, symbols, section, offset, |
*filename_ptr ? NULL : filename_ptr, |
functionname_ptr); |
return TRUE; |
} |
if (_bfd_dwarf2_find_nearest_line (abfd, dwarf_debug_sections, |
section, symbols, offset, |
filename_ptr, functionname_ptr, |
line_ptr, discriminator_ptr, 0, |
&elf_tdata (abfd)->dwarf2_find_line_info)) |
{ |
if (!*functionname_ptr) |
elf_find_function (abfd, section, symbols, offset, |
*filename_ptr ? NULL : filename_ptr, |
functionname_ptr); |
return TRUE; |
} |
if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset, |
&found, filename_ptr, |
functionname_ptr, line_ptr, |
7667,7 → 8223,7 |
if (symbols == NULL) |
return FALSE; |
if (! elf_find_function (abfd, section, symbols, offset, |
if (! _bfd_elf_find_function (abfd, symbols, section, offset, |
filename_ptr, functionname_ptr)) |
return FALSE; |
7681,19 → 8237,9 |
_bfd_elf_find_line (bfd *abfd, asymbol **symbols, asymbol *symbol, |
const char **filename_ptr, unsigned int *line_ptr) |
{ |
return _bfd_elf_find_line_discriminator (abfd, symbols, symbol, |
filename_ptr, line_ptr, |
NULL); |
} |
bfd_boolean |
_bfd_elf_find_line_discriminator (bfd *abfd, asymbol **symbols, asymbol *symbol, |
const char **filename_ptr, |
unsigned int *line_ptr, |
unsigned int *discriminator_ptr) |
{ |
return _bfd_dwarf2_find_line (abfd, symbols, symbol, |
filename_ptr, line_ptr, discriminator_ptr, 0, |
return _bfd_dwarf2_find_nearest_line (abfd, symbols, symbol, NULL, 0, |
filename_ptr, NULL, line_ptr, NULL, |
dwarf_debug_sections, 0, |
&elf_tdata (abfd)->dwarf2_find_line_info); |
} |
7722,7 → 8268,7 |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
int ret = bed->s->sizeof_ehdr; |
if (!info->relocatable) |
if (!bfd_link_relocatable (info)) |
{ |
bfd_size_type phdr_size = elf_program_header_size (abfd); |
7753,13 → 8299,27 |
bfd_size_type count) |
{ |
Elf_Internal_Shdr *hdr; |
bfd_signed_vma pos; |
file_ptr pos; |
if (! abfd->output_has_begun |
&& ! _bfd_elf_compute_section_file_positions (abfd, NULL)) |
return FALSE; |
if (!count) |
return TRUE; |
hdr = &elf_section_data (section)->this_hdr; |
if (hdr->sh_offset == (file_ptr) -1) |
{ |
/* We must compress this section. Write output to the buffer. */ |
unsigned char *contents = hdr->contents; |
if ((offset + count) > hdr->sh_size |
|| (section->flags & SEC_ELF_COMPRESS) == 0 |
|| contents == NULL) |
abort (); |
memcpy (contents + offset, location, count); |
return TRUE; |
} |
pos = hdr->sh_offset + offset; |
if (bfd_seek (abfd, pos, SEEK_SET) != 0 |
|| bfd_bwrite (location, count, abfd) != count) |
8179,6 → 8739,18 |
} |
static bfd_boolean |
elfcore_grok_s390_vxrs_low (bfd *abfd, Elf_Internal_Note *note) |
{ |
return elfcore_make_note_pseudosection (abfd, ".reg-s390-vxrs-low", note); |
} |
static bfd_boolean |
elfcore_grok_s390_vxrs_high (bfd *abfd, Elf_Internal_Note *note) |
{ |
return elfcore_make_note_pseudosection (abfd, ".reg-s390-vxrs-high", note); |
} |
static bfd_boolean |
elfcore_grok_arm_vfp (bfd *abfd, Elf_Internal_Note *note) |
{ |
return elfcore_make_note_pseudosection (abfd, ".reg-arm-vfp", note); |
8562,6 → 9134,9 |
if (note->namesz == 6 |
&& strcmp (note->namedata, "LINUX") == 0) |
return elfcore_grok_xstatereg (abfd, note); |
else if (note->namesz == 8 |
&& strcmp (note->namedata, "FreeBSD") == 0) |
return elfcore_grok_xstatereg (abfd, note); |
else |
return TRUE; |
8642,6 → 9217,20 |
else |
return TRUE; |
case NT_S390_VXRS_LOW: |
if (note->namesz == 6 |
&& strcmp (note->namedata, "LINUX") == 0) |
return elfcore_grok_s390_vxrs_low (abfd, note); |
else |
return TRUE; |
case NT_S390_VXRS_HIGH: |
if (note->namesz == 6 |
&& strcmp (note->namedata, "LINUX") == 0) |
return elfcore_grok_s390_vxrs_high (abfd, note); |
else |
return TRUE; |
case NT_ARM_VFP: |
if (note->namesz == 6 |
&& strcmp (note->namedata, "LINUX") == 0) |
8708,18 → 9297,18 |
static bfd_boolean |
elfobj_grok_gnu_build_id (bfd *abfd, Elf_Internal_Note *note) |
{ |
struct elf_obj_tdata *t; |
struct bfd_build_id* build_id; |
if (note->descsz == 0) |
return FALSE; |
t = elf_tdata (abfd); |
t->build_id = bfd_alloc (abfd, sizeof (*t->build_id) - 1 + note->descsz); |
if (t->build_id == NULL) |
build_id = bfd_alloc (abfd, sizeof (struct bfd_build_id) - 1 + note->descsz); |
if (build_id == NULL) |
return FALSE; |
t->build_id->size = note->descsz; |
memcpy (t->build_id->data, note->descdata, note->descsz); |
build_id->size = note->descsz; |
memcpy (build_id->data, note->descdata, note->descsz); |
abfd->build_id = build_id; |
return TRUE; |
} |
9287,7 → 9876,7 |
lwpstat.pr_lwpid = pid >> 16; |
lwpstat.pr_cursig = cursig; |
#if defined (HAVE_LWPSTATUS_T_PR_REG) |
memcpy (lwpstat.pr_reg, gregs, sizeof (lwpstat.pr_reg)); |
memcpy (&lwpstat.pr_reg, gregs, sizeof (lwpstat.pr_reg)); |
#elif defined (HAVE_LWPSTATUS_T_PR_CONTEXT) |
#if !defined(gregs) |
memcpy (lwpstat.pr_context.uc_mcontext.gregs, |
9367,7 → 9956,11 |
elfcore_write_xstatereg (bfd *abfd, char *buf, int *bufsiz, |
const void *xfpregs, int size) |
{ |
char *note_name = "LINUX"; |
char *note_name; |
if (get_elf_backend_data (abfd)->elf_osabi == ELFOSABI_FREEBSD) |
note_name = "FreeBSD"; |
else |
note_name = "LINUX"; |
return elfcore_write_note (abfd, buf, bufsiz, |
note_name, NT_X86_XSTATE, xfpregs, size); |
} |
9508,6 → 10101,31 |
} |
char * |
elfcore_write_s390_vxrs_low (bfd *abfd, |
char *buf, |
int *bufsiz, |
const void *s390_vxrs_low, |
int size) |
{ |
char *note_name = "LINUX"; |
return elfcore_write_note (abfd, buf, bufsiz, |
note_name, NT_S390_VXRS_LOW, s390_vxrs_low, size); |
} |
char * |
elfcore_write_s390_vxrs_high (bfd *abfd, |
char *buf, |
int *bufsiz, |
const void *s390_vxrs_high, |
int size) |
{ |
char *note_name = "LINUX"; |
return elfcore_write_note (abfd, buf, bufsiz, |
note_name, NT_S390_VXRS_HIGH, |
s390_vxrs_high, size); |
} |
char * |
elfcore_write_arm_vfp (bfd *abfd, |
char *buf, |
int *bufsiz, |
9591,6 → 10209,10 |
return elfcore_write_s390_system_call (abfd, buf, bufsiz, data, size); |
if (strcmp (section, ".reg-s390-tdb") == 0) |
return elfcore_write_s390_tdb (abfd, buf, bufsiz, data, size); |
if (strcmp (section, ".reg-s390-vxrs-low") == 0) |
return elfcore_write_s390_vxrs_low (abfd, buf, bufsiz, data, size); |
if (strcmp (section, ".reg-s390-vxrs-high") == 0) |
return elfcore_write_s390_vxrs_high (abfd, buf, bufsiz, data, size); |
if (strcmp (section, ".reg-arm-vfp") == 0) |
return elfcore_write_arm_vfp (abfd, buf, bufsiz, data, size); |
if (strcmp (section, ".reg-aarch-tls") == 0) |
9638,32 → 10260,38 |
return TRUE; |
case bfd_core: |
if (CONST_STRNEQ (in.namedata, "NetBSD-CORE")) |
{ |
if (! elfcore_grok_netbsd_note (abfd, &in)) |
return FALSE; |
} |
else if (CONST_STRNEQ (in.namedata, "OpenBSD")) |
#define GROKER_ELEMENT(S,F) {S, sizeof (S) - 1, F} |
struct |
{ |
if (! elfcore_grok_openbsd_note (abfd, &in)) |
return FALSE; |
const char * string; |
size_t len; |
bfd_boolean (* func)(bfd *, Elf_Internal_Note *); |
} |
else if (CONST_STRNEQ (in.namedata, "QNX")) |
grokers[] = |
{ |
if (! elfcore_grok_nto_note (abfd, &in)) |
return FALSE; |
} |
else if (CONST_STRNEQ (in.namedata, "SPU/")) |
GROKER_ELEMENT ("", elfcore_grok_note), |
GROKER_ELEMENT ("NetBSD-CORE", elfcore_grok_netbsd_note), |
GROKER_ELEMENT ( "OpenBSD", elfcore_grok_openbsd_note), |
GROKER_ELEMENT ("QNX", elfcore_grok_nto_note), |
GROKER_ELEMENT ("SPU/", elfcore_grok_spu_note) |
}; |
#undef GROKER_ELEMENT |
int i; |
for (i = ARRAY_SIZE (grokers); i--;) |
{ |
if (! elfcore_grok_spu_note (abfd, &in)) |
return FALSE; |
} |
else |
if (in.namesz >= grokers[i].len |
&& strncmp (in.namedata, grokers[i].string, |
grokers[i].len) == 0) |
{ |
if (! elfcore_grok_note (abfd, &in)) |
if (! grokers[i].func (abfd, & in)) |
return FALSE; |
break; |
} |
} |
break; |
} |
case bfd_object: |
if (in.namesz == sizeof "GNU" && strcmp (in.namedata, "GNU") == 0) |
9697,10 → 10325,14 |
if (bfd_seek (abfd, offset, SEEK_SET) != 0) |
return FALSE; |
buf = (char *) bfd_malloc (size); |
buf = (char *) bfd_malloc (size + 1); |
if (buf == NULL) |
return FALSE; |
/* PR 17512: file: ec08f814 |
0-termintate the buffer so that string searches will not overflow. */ |
buf[size] = 0; |
if (bfd_bread (buf, size, abfd) != size |
|| !elf_parse_notes (abfd, buf, size, offset)) |
{ |
9861,11 → 10493,12 |
bfd_elf_bfd_from_remote_memory |
(bfd *templ, |
bfd_vma ehdr_vma, |
bfd_size_type size, |
bfd_vma *loadbasep, |
int (*target_read_memory) (bfd_vma, bfd_byte *, bfd_size_type)) |
{ |
return (*get_elf_backend_data (templ)->elf_backend_bfd_from_remote_memory) |
(templ, ehdr_vma, loadbasep, target_read_memory); |
(templ, ehdr_vma, size, loadbasep, target_read_memory); |
} |
long |
9991,7 → 10624,7 |
SEC_IS_COMMON, NULL, "LARGE_COMMON", 0); |
void |
_bfd_elf_set_osabi (bfd * abfd, |
_bfd_elf_post_process_headers (bfd * abfd, |
struct bfd_link_info * link_info ATTRIBUTE_UNUSED) |
{ |
Elf_Internal_Ehdr * i_ehdrp; /* ELF file header, internal form. */ |
/contrib/toolchain/binutils/bfd/elf32-gen.c |
---|
1,6 → 1,5 |
/* Generic support for 32-bit ELF |
Copyright 1993, 1995, 1998, 1999, 2001, 2002, 2004, 2005, 2007 |
Free Software Foundation, Inc. |
Copyright (C) 1993-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
87,9 → 86,9 |
return bfd_elf_link_add_symbols (abfd, info); |
} |
#define TARGET_LITTLE_SYM bfd_elf32_little_generic_vec |
#define TARGET_LITTLE_SYM elf32_le_vec |
#define TARGET_LITTLE_NAME "elf32-little" |
#define TARGET_BIG_SYM bfd_elf32_big_generic_vec |
#define TARGET_BIG_SYM elf32_be_vec |
#define TARGET_BIG_NAME "elf32-big" |
#define ELF_ARCH bfd_arch_unknown |
#define ELF_MACHINE_CODE EM_NONE |
/contrib/toolchain/binutils/bfd/elf32-i386.c |
---|
1,7 → 1,5 |
/* Intel 80386/80486-specific support for 32-bit ELF |
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 |
Free Software Foundation, Inc. |
Copyright (C) 1993-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
31,6 → 29,7 |
#include "objalloc.h" |
#include "hashtab.h" |
#include "dwarf2.h" |
#include "opcode/i386.h" |
/* 386 uses REL relocations instead of RELA. */ |
#define USE_REL 1 |
39,7 → 38,7 |
static reloc_howto_type elf_howto_table[]= |
{ |
HOWTO(R_386_NONE, 0, 0, 0, FALSE, 0, complain_overflow_bitfield, |
HOWTO(R_386_NONE, 0, 3, 0, FALSE, 0, complain_overflow_dont, |
bfd_elf_generic_reloc, "R_386_NONE", |
TRUE, 0x00000000, 0x00000000, FALSE), |
HOWTO(R_386_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, |
148,10 → 147,13 |
HOWTO(R_386_IRELATIVE, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, |
bfd_elf_generic_reloc, "R_386_IRELATIVE", |
TRUE, 0xffffffff, 0xffffffff, FALSE), |
HOWTO(R_386_GOT32X, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, |
bfd_elf_generic_reloc, "R_386_GOT32X", |
TRUE, 0xffffffff, 0xffffffff, FALSE), |
/* Another gap. */ |
#define R_386_irelative (R_386_IRELATIVE + 1 - R_386_tls_offset) |
#define R_386_vt_offset (R_386_GNU_VTINHERIT - R_386_irelative) |
#define R_386_ext2 (R_386_GOT32X + 1 - R_386_tls_offset) |
#define R_386_vt_offset (R_386_GNU_VTINHERIT - R_386_ext2) |
/* GNU extension to record C++ vtable hierarchy. */ |
HOWTO (R_386_GNU_VTINHERIT, /* type */ |
334,6 → 336,10 |
TRACE ("BFD_RELOC_386_IRELATIVE"); |
return &elf_howto_table[R_386_IRELATIVE - R_386_tls_offset]; |
case BFD_RELOC_386_GOT32X: |
TRACE ("BFD_RELOC_386_GOT32X"); |
return &elf_howto_table[R_386_GOT32X - R_386_tls_offset]; |
case BFD_RELOC_VTABLE_INHERIT: |
TRACE ("BFD_RELOC_VTABLE_INHERIT"); |
return &elf_howto_table[R_386_GNU_VTINHERIT - R_386_vt_offset]; |
373,15 → 379,17 |
&& ((indx = r_type - R_386_ext_offset) - R_386_standard |
>= R_386_ext - R_386_standard) |
&& ((indx = r_type - R_386_tls_offset) - R_386_ext |
>= R_386_irelative - R_386_ext) |
&& ((indx = r_type - R_386_vt_offset) - R_386_irelative |
>= R_386_vt - R_386_irelative)) |
>= R_386_ext2 - R_386_ext) |
&& ((indx = r_type - R_386_vt_offset) - R_386_ext2 |
>= R_386_vt - R_386_ext2)) |
{ |
(*_bfd_error_handler) (_("%B: invalid relocation type %d"), |
abfd, (int) r_type); |
indx = R_386_NONE; |
} |
BFD_ASSERT (elf_howto_table [indx].type == r_type); |
/* PR 17512: file: 0f67f69d. */ |
if (elf_howto_table [indx].type != r_type) |
return NULL; |
return &elf_howto_table[indx]; |
} |
582,6 → 590,24 |
0, 0, 0, 0 /* replaced with offset to start of .plt. */ |
}; |
/* Entries in the GOT procedure linkage table look like this. */ |
static const bfd_byte elf_i386_got_plt_entry[8] = |
{ |
0xff, 0x25, /* jmp indirect */ |
0, 0, 0, 0, /* replaced with offset of this symbol in .got. */ |
0x66, 0x90 /* xchg %ax,%ax */ |
}; |
/* Entries in the PIC GOT procedure linkage table look like this. */ |
static const bfd_byte elf_i386_pic_got_plt_entry[8] = |
{ |
0xff, 0xa3, /* jmp *offset(%ebx) */ |
0, 0, 0, 0, /* replaced with offset of this symbol in .got. */ |
0x66, 0x90 /* xchg %ax,%ax */ |
}; |
/* .eh_frame covering the .plt section. */ |
static const bfd_byte elf_i386_eh_frame_plt[] = |
738,6 → 764,17 |
(GOT_TLS_GD_P (type) || GOT_TLS_GDESC_P (type)) |
unsigned char tls_type; |
/* Symbol is referenced by R_386_GOTOFF relocation. */ |
unsigned int gotoff_ref : 1; |
/* Reference count of C/C++ function pointer relocations in read-write |
section which can be resolved at run-time. */ |
bfd_signed_vma func_pointer_refcount; |
/* Information about the GOT PLT entry. Filled when there are both |
GOT and PLT relocations against the same function. */ |
union gotplt_union plt_got; |
/* Offset of the GOTPLT entry reserved for the TLS descriptor, |
starting at the end of the jump table. */ |
bfd_vma tlsdesc_got; |
787,6 → 824,7 |
asection *sdynbss; |
asection *srelbss; |
asection *plt_eh_frame; |
asection *plt_got; |
union |
{ |
828,7 → 866,7 |
== I386_ELF_DATA ? ((struct elf_i386_link_hash_table *) ((p)->hash)) : NULL) |
#define elf_i386_compute_jump_table_size(htab) \ |
((htab)->next_tls_desc_index * 4) |
((htab)->elf.srelplt->reloc_count * 4) |
/* Create an entry in an i386 ELF linker hash table. */ |
856,6 → 894,9 |
eh = (struct elf_i386_link_hash_entry *) entry; |
eh->dyn_relocs = NULL; |
eh->tls_type = GOT_UNKNOWN; |
eh->gotoff_ref = 0; |
eh->func_pointer_refcount = 0; |
eh->plt_got.offset = (bfd_vma) -1; |
eh->tlsdesc_got = (bfd_vma) -1; |
} |
924,11 → 965,28 |
ret->elf.indx = sec->id; |
ret->elf.dynstr_index = ELF32_R_SYM (rel->r_info); |
ret->elf.dynindx = -1; |
ret->func_pointer_refcount = 0; |
ret->plt_got.offset = (bfd_vma) -1; |
*slot = ret; |
} |
return &ret->elf; |
} |
/* Destroy an i386 ELF linker hash table. */ |
static void |
elf_i386_link_hash_table_free (bfd *obfd) |
{ |
struct elf_i386_link_hash_table *htab |
= (struct elf_i386_link_hash_table *) obfd->link.hash; |
if (htab->loc_hash_table) |
htab_delete (htab->loc_hash_table); |
if (htab->loc_hash_memory) |
objalloc_free ((struct objalloc *) htab->loc_hash_memory); |
_bfd_elf_link_hash_table_free (obfd); |
} |
/* Create an i386 ELF linker hash table. */ |
static struct bfd_link_hash_table * |
957,28 → 1015,14 |
ret->loc_hash_memory = objalloc_create (); |
if (!ret->loc_hash_table || !ret->loc_hash_memory) |
{ |
free (ret); |
elf_i386_link_hash_table_free (abfd); |
return NULL; |
} |
ret->elf.root.hash_table_free = elf_i386_link_hash_table_free; |
return &ret->elf.root; |
} |
/* Destroy an i386 ELF linker hash table. */ |
static void |
elf_i386_link_hash_table_free (struct bfd_link_hash_table *hash) |
{ |
struct elf_i386_link_hash_table *htab |
= (struct elf_i386_link_hash_table *) hash; |
if (htab->loc_hash_table) |
htab_delete (htab->loc_hash_table); |
if (htab->loc_hash_memory) |
objalloc_free ((struct objalloc *) htab->loc_hash_memory); |
_bfd_elf_link_hash_table_free (hash); |
} |
/* Create .plt, .rel.plt, .got, .got.plt, .rel.got, .dynbss, and |
.rel.bss sections in DYNOBJ, and set up shortcuts to them in our |
hash table. */ |
996,13 → 1040,28 |
return FALSE; |
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss"); |
if (!info->shared) |
htab->srelbss = bfd_get_linker_section (dynobj, ".rel.bss"); |
if (!htab->sdynbss |
|| (!info->shared && !htab->srelbss)) |
if (!htab->sdynbss) |
abort (); |
if (bfd_link_executable (info)) |
{ |
/* Always allow copy relocs for building executables. */ |
asection *s = bfd_get_linker_section (dynobj, ".rel.bss"); |
if (s == NULL) |
{ |
const struct elf_backend_data *bed = get_elf_backend_data (dynobj); |
s = bfd_make_section_anyway_with_flags (dynobj, |
".rel.bss", |
(bed->dynamic_sec_flags |
| SEC_READONLY)); |
if (s == NULL |
|| ! bfd_set_section_alignment (dynobj, s, |
bed->s->log_file_align)) |
return FALSE; |
} |
htab->srelbss = s; |
} |
if (get_elf_i386_backend_data (dynobj)->is_vxworks |
&& !elf_vxworks_create_dynamic_sections (dynobj, info, |
&htab->srelplt2)) |
1075,6 → 1134,10 |
eind->tls_type = GOT_UNKNOWN; |
} |
/* Copy gotoff_ref so that elf_i386_adjust_dynamic_symbol will |
generate a R_386_COPY reloc. */ |
edir->gotoff_ref |= eind->gotoff_ref; |
if (ELIMINATE_COPY_RELOCS |
&& ind->root.type != bfd_link_hash_indirect |
&& dir->dynamic_adjusted) |
1089,8 → 1152,16 |
dir->pointer_equality_needed |= ind->pointer_equality_needed; |
} |
else |
{ |
if (eind->func_pointer_refcount > 0) |
{ |
edir->func_pointer_refcount += eind->func_pointer_refcount; |
eind->func_pointer_refcount = 0; |
} |
_bfd_elf_link_hash_copy_indirect (info, dir, ind); |
} |
} |
/* Return TRUE if the TLS access code sequence support transition |
from R_TYPE. */ |
1305,7 → 1376,7 |
case R_386_TLS_IE_32: |
case R_386_TLS_IE: |
case R_386_TLS_GOTIE: |
if (info->executable) |
if (bfd_link_executable (info)) |
{ |
if (h == NULL) |
to_type = R_386_TLS_LE_32; |
1321,7 → 1392,7 |
{ |
unsigned int new_to_type = to_type; |
if (info->executable |
if (bfd_link_executable (info) |
&& h != NULL |
&& h->dynindx == -1 |
&& (tls_type & GOT_TLS_IE)) |
1347,7 → 1418,7 |
break; |
case R_386_TLS_LDM: |
if (info->executable) |
if (bfd_link_executable (info)) |
to_type = R_386_TLS_LE_32; |
break; |
1403,6 → 1474,10 |
return TRUE; |
} |
/* Rename some of the generic section flags to better document how they |
are used here. */ |
#define need_convert_load sec_flg0 |
/* Look through the relocs for a section during the first phase, and |
calculate needed space in the global offset table, procedure linkage |
table, and dynamic reloc sections. */ |
1419,8 → 1494,9 |
const Elf_Internal_Rela *rel; |
const Elf_Internal_Rela *rel_end; |
asection *sreloc; |
bfd_boolean use_plt_got; |
if (info->relocatable) |
if (bfd_link_relocatable (info)) |
return TRUE; |
BFD_ASSERT (is_i386_elf (abfd)); |
1429,6 → 1505,10 |
if (htab == NULL) |
return FALSE; |
use_plt_got = (!get_elf_i386_backend_data (abfd)->is_vxworks |
&& (get_elf_i386_backend_data (abfd) |
== &elf_i386_arch_bed)); |
symtab_hdr = &elf_symtab_hdr (abfd); |
sym_hashes = elf_sym_hashes (abfd); |
1440,6 → 1520,7 |
unsigned int r_type; |
unsigned long r_symndx; |
struct elf_link_hash_entry *h; |
struct elf_i386_link_hash_entry *eh; |
Elf_Internal_Sym *isym; |
const char *name; |
bfd_boolean size_reloc; |
1489,6 → 1570,7 |
h = (struct elf_link_hash_entry *) h->root.u.i.link; |
} |
eh = (struct elf_i386_link_hash_entry *) h; |
if (h != NULL) |
{ |
/* Create the ifunc sections for static executables. If we |
1500,11 → 1582,13 |
default: |
break; |
case R_386_GOTOFF: |
eh->gotoff_ref = 1; |
case R_386_32: |
case R_386_PC32: |
case R_386_PLT32: |
case R_386_GOT32: |
case R_386_GOTOFF: |
case R_386_GOT32X: |
if (htab->elf.dynobj == NULL) |
htab->elf.dynobj = abfd; |
if (!_bfd_elf_create_ifunc_sections (htab->elf.dynobj, info)) |
1515,6 → 1599,10 |
/* It is referenced by a non-shared object. */ |
h->ref_regular = 1; |
h->root.non_ir_ref = 1; |
if (h->type == STT_GNU_IFUNC) |
elf_tdata (info->output_bfd)->has_gnu_symbols |
|= elf_gnu_symbol_ifunc; |
} |
if (! elf_i386_tls_transition (info, abfd, sec, NULL, |
1553,11 → 1641,12 |
case R_386_TLS_IE_32: |
case R_386_TLS_IE: |
case R_386_TLS_GOTIE: |
if (!info->executable) |
if (!bfd_link_executable (info)) |
info->flags |= DF_STATIC_TLS; |
/* Fall through */ |
case R_386_GOT32: |
case R_386_GOT32X: |
case R_386_TLS_GD: |
case R_386_TLS_GOTDESC: |
case R_386_TLS_DESC_CALL: |
1568,7 → 1657,10 |
switch (r_type) |
{ |
default: |
case R_386_GOT32: tls_type = GOT_NORMAL; break; |
case R_386_GOT32: |
case R_386_GOT32X: |
tls_type = GOT_NORMAL; |
break; |
case R_386_TLS_GD: tls_type = GOT_TLS_GD; break; |
case R_386_TLS_GOTDESC: |
case R_386_TLS_DESC_CALL: |
1673,7 → 1765,7 |
case R_386_TLS_LE_32: |
case R_386_TLS_LE: |
if (info->executable) |
if (bfd_link_executable (info)) |
break; |
info->flags |= DF_STATIC_TLS; |
/* Fall through */ |
1680,7 → 1772,7 |
case R_386_32: |
case R_386_PC32: |
if (h != NULL && info->executable) |
if (h != NULL && bfd_link_executable (info)) |
{ |
/* If this reloc is in a read-only section, we might |
need a copy reloc. We can't check reliably at this |
1693,9 → 1785,23 |
/* We may need a .plt entry if the function this reloc |
refers to is in a shared lib. */ |
h->plt.refcount += 1; |
if (r_type != R_386_PC32) |
if (r_type == R_386_PC32) |
{ |
/* Since something like ".long foo - ." may be used |
as pointer, make sure that PLT is used if foo is |
a function defined in a shared library. */ |
if ((sec->flags & SEC_CODE) == 0) |
h->pointer_equality_needed = 1; |
} |
else |
{ |
h->pointer_equality_needed = 1; |
/* R_386_32 can be resolved at run-time. */ |
if (r_type == R_386_32 |
&& (sec->flags & SEC_READONLY) == 0) |
eh->func_pointer_refcount += 1; |
} |
} |
size_reloc = FALSE; |
do_size: |
1720,7 → 1826,7 |
may need to keep relocations for symbols satisfied by a |
dynamic library if we manage to avoid copy relocs for the |
symbol. */ |
if ((info->shared |
if ((bfd_link_pic (info) |
&& (sec->flags & SEC_ALLOC) != 0 |
&& (r_type != R_386_PC32 |
|| (h != NULL |
1728,7 → 1834,7 |
|| h->root.type == bfd_link_hash_defweak |
|| !h->def_regular)))) |
|| (ELIMINATE_COPY_RELOCS |
&& !info->shared |
&& !bfd_link_pic (info) |
&& (sec->flags & SEC_ALLOC) != 0 |
&& h != NULL |
&& (h->root.type == bfd_link_hash_defweak |
1756,7 → 1862,7 |
relocations we need for this symbol. */ |
if (h != NULL) |
{ |
head = &((struct elf_i386_link_hash_entry *) h)->dyn_relocs; |
head = &eh->dyn_relocs; |
} |
else |
{ |
1820,8 → 1926,46 |
default: |
break; |
} |
if (use_plt_got |
&& h != NULL |
&& h->plt.refcount > 0 |
&& (((info->flags & DF_BIND_NOW) && !h->pointer_equality_needed) |
|| h->got.refcount > 0) |
&& htab->plt_got == NULL) |
{ |
/* Create the GOT procedure linkage table. */ |
unsigned int plt_got_align; |
const struct elf_backend_data *bed; |
bed = get_elf_backend_data (info->output_bfd); |
BFD_ASSERT (sizeof (elf_i386_got_plt_entry) == 8 |
&& (sizeof (elf_i386_got_plt_entry) |
== sizeof (elf_i386_pic_got_plt_entry))); |
plt_got_align = 3; |
if (htab->elf.dynobj == NULL) |
htab->elf.dynobj = abfd; |
htab->plt_got |
= bfd_make_section_anyway_with_flags (htab->elf.dynobj, |
".plt.got", |
(bed->dynamic_sec_flags |
| SEC_ALLOC |
| SEC_CODE |
| SEC_LOAD |
| SEC_READONLY)); |
if (htab->plt_got == NULL |
|| !bfd_set_section_alignment (htab->elf.dynobj, |
htab->plt_got, |
plt_got_align)) |
return FALSE; |
} |
if ((r_type == R_386_GOT32 || r_type == R_386_GOT32X) |
&& (h == NULL || h->type != STT_GNU_IFUNC)) |
sec->need_convert_load = 1; |
} |
return TRUE; |
} |
1860,7 → 2004,7 |
bfd_signed_vma *local_got_refcounts; |
const Elf_Internal_Rela *rel, *relend; |
if (info->relocatable) |
if (bfd_link_relocatable (info)) |
return TRUE; |
htab = elf_i386_hash_table (info); |
1943,6 → 2087,7 |
case R_386_TLS_IE: |
case R_386_TLS_GOTIE: |
case R_386_GOT32: |
case R_386_GOT32X: |
if (h != NULL) |
{ |
if (h->got.refcount > 0) |
1963,7 → 2108,7 |
case R_386_32: |
case R_386_PC32: |
case R_386_SIZE32: |
if (info->shared |
if (bfd_link_pic (info) |
&& (h == NULL || h->type != STT_GNU_IFUNC)) |
break; |
/* Fall through */ |
1973,7 → 2118,15 |
{ |
if (h->plt.refcount > 0) |
h->plt.refcount -= 1; |
if (r_type == R_386_32 |
&& (sec->flags & SEC_READONLY) == 0) |
{ |
struct elf_i386_link_hash_entry *eh |
= (struct elf_i386_link_hash_entry *) h; |
if (eh->func_pointer_refcount > 0) |
eh->func_pointer_refcount -= 1; |
} |
} |
break; |
case R_386_GOTOFF: |
2103,12 → 2256,14 |
only references to the symbol are via the global offset table. |
For such cases we need not do anything here; the relocations will |
be handled correctly by relocate_section. */ |
if (info->shared) |
if (!bfd_link_executable (info)) |
return TRUE; |
/* If there are no references to this symbol that do not use the |
GOT, we don't need to generate a copy reloc. */ |
if (!h->non_got_ref) |
GOT nor R_386_GOTOFF relocation, we don't need to generate a copy |
reloc. */ |
eh = (struct elf_i386_link_hash_entry *) h; |
if (!h->non_got_ref && !eh->gotoff_ref) |
return TRUE; |
/* If -z nocopyreloc was given, we won't generate them either. */ |
2122,14 → 2277,15 |
if (htab == NULL) |
return FALSE; |
/* If there aren't any dynamic relocs in read-only sections, then |
we can keep the dynamic relocs and avoid the copy reloc. This |
doesn't work on VxWorks, where we can not have dynamic relocations |
(other than copy and jump slot relocations) in an executable. */ |
/* If there aren't any dynamic relocs in read-only sections nor |
R_386_GOTOFF relocation, then we can keep the dynamic relocs and |
avoid the copy reloc. This doesn't work on VxWorks, where we can |
not have dynamic relocations (other than copy and jump slot |
relocations) in an executable. */ |
if (ELIMINATE_COPY_RELOCS |
&& !eh->gotoff_ref |
&& !get_elf_i386_backend_data (info->output_bfd)->is_vxworks) |
{ |
eh = (struct elf_i386_link_hash_entry *) h; |
for (p = eh->dyn_relocs; p != NULL; p = p->next) |
{ |
s = p->sec->output_section; |
2165,7 → 2321,7 |
s = htab->sdynbss; |
return _bfd_elf_adjust_dynamic_copy (h, s); |
return _bfd_elf_adjust_dynamic_copy (info, h, s); |
} |
/* Allocate space in .plt, .got and associated reloc sections for |
2192,6 → 2348,29 |
plt_entry_size = GET_PLT_ENTRY_SIZE (info->output_bfd); |
/* Clear the reference count of function pointer relocations if |
symbol isn't a normal function. */ |
if (h->type != STT_FUNC) |
eh->func_pointer_refcount = 0; |
/* We can't use the GOT PLT if pointer equality is needed since |
finish_dynamic_symbol won't clear symbol value and the dynamic |
linker won't update the GOT slot. We will get into an infinite |
loop at run-time. */ |
if (htab->plt_got != NULL |
&& h->type != STT_GNU_IFUNC |
&& !h->pointer_equality_needed |
&& h->plt.refcount > 0 |
&& h->got.refcount > 0) |
{ |
/* Don't use the regular PLT if there are both GOT and GOTPLT |
reloctions. */ |
h->plt.offset = (bfd_vma) -1; |
/* Use the GOT PLT. */ |
eh->plt_got.refcount = 1; |
} |
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle it |
here if it is defined and referenced in a non-shared object. */ |
if (h->type == STT_GNU_IFUNC |
2199,9 → 2378,30 |
return _bfd_elf_allocate_ifunc_dyn_relocs (info, h, &eh->dyn_relocs, |
plt_entry_size, |
plt_entry_size, 4); |
/* Don't create the PLT entry if there are only function pointer |
relocations which can be resolved at run-time. */ |
else if (htab->elf.dynamic_sections_created |
&& h->plt.refcount > 0) |
&& (h->plt.refcount > eh->func_pointer_refcount |
|| eh->plt_got.refcount > 0)) |
{ |
bfd_boolean use_plt_got; |
/* Clear the reference count of function pointer relocations |
if PLT is used. */ |
eh->func_pointer_refcount = 0; |
if ((info->flags & DF_BIND_NOW) && !h->pointer_equality_needed) |
{ |
/* Don't use the regular PLT for DF_BIND_NOW. */ |
h->plt.offset = (bfd_vma) -1; |
/* Use the GOT PLT. */ |
h->got.refcount = 1; |
eh->plt_got.refcount = 1; |
} |
use_plt_got = eh->plt_got.refcount > 0; |
/* Make sure this symbol is output as a dynamic symbol. |
Undefined weak syms won't yet be marked as dynamic. */ |
if (h->dynindx == -1 |
2211,16 → 2411,21 |
return FALSE; |
} |
if (info->shared |
if (bfd_link_pic (info) |
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)) |
{ |
asection *s = htab->elf.splt; |
asection *got_s = htab->plt_got; |
/* If this is the first .plt entry, make room for the special |
first entry. */ |
first entry. The .plt section is used by prelink to undo |
prelinking for dynamic relocations. */ |
if (s->size == 0) |
s->size += plt_entry_size; |
s->size = plt_entry_size; |
if (use_plt_got) |
eh->plt_got.offset = got_s->size; |
else |
h->plt.offset = s->size; |
/* If this symbol is not defined in a regular file, and we are |
2228,26 → 2433,42 |
location in the .plt. This is required to make function |
pointers compare as equal between the normal executable and |
the shared library. */ |
if (! info->shared |
if (! bfd_link_pic (info) |
&& !h->def_regular) |
{ |
if (use_plt_got) |
{ |
/* We need to make a call to the entry of the GOT PLT |
instead of regular PLT entry. */ |
h->root.u.def.section = got_s; |
h->root.u.def.value = eh->plt_got.offset; |
} |
else |
{ |
h->root.u.def.section = s; |
h->root.u.def.value = h->plt.offset; |
} |
} |
/* Make room for this entry. */ |
if (use_plt_got) |
got_s->size += sizeof (elf_i386_got_plt_entry); |
else |
{ |
s->size += plt_entry_size; |
/* We also need to make an entry in the .got.plt section, which |
will be placed in the .got section by the linker script. */ |
/* We also need to make an entry in the .got.plt section, |
which will be placed in the .got section by the linker |
script. */ |
htab->elf.sgotplt->size += 4; |
/* We also need to make an entry in the .rel.plt section. */ |
htab->elf.srelplt->size += sizeof (Elf32_External_Rel); |
htab->elf.srelplt->reloc_count++; |
} |
if (get_elf_i386_backend_data (info->output_bfd)->is_vxworks |
&& !info->shared) |
&& !bfd_link_pic (info)) |
{ |
/* VxWorks has a second set of relocations for each PLT entry |
in executables. They go in a separate relocation section, |
2284,7 → 2505,7 |
/* If R_386_TLS_{IE_32,IE,GOTIE} symbol is now local to the binary, |
make it a R_386_TLS_LE_32 requiring no TLS entry. */ |
if (h->got.refcount > 0 |
&& info->executable |
&& bfd_link_executable (info) |
&& h->dynindx == -1 |
&& (elf_i386_hash_entry(h)->tls_type & GOT_TLS_IE)) |
h->got.offset = (bfd_vma) -1; |
2336,7 → 2557,7 |
else if (! GOT_TLS_GDESC_P (tls_type) |
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT |
|| h->root.type != bfd_link_hash_undefweak) |
&& (info->shared |
&& (bfd_link_pic (info) |
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) |
htab->elf.srelgot->size += sizeof (Elf32_External_Rel); |
if (GOT_TLS_GDESC_P (tls_type)) |
2354,7 → 2575,7 |
space for pc-relative relocs that have become local due to symbol |
visibility changes. */ |
if (info->shared) |
if (bfd_link_pic (info)) |
{ |
/* The only reloc that uses pc_count is R_386_PC32, which will |
appear on a call or on something like ".long foo - .". We |
2411,9 → 2632,10 |
{ |
/* For the non-shared case, discard space for relocs against |
symbols which turn out to need copy relocs or are not |
dynamic. */ |
dynamic. Keep dynamic relocations for run-time function |
pointer initialization. */ |
if (!h->non_got_ref |
if ((!h->non_got_ref || eh->func_pointer_refcount > 0) |
&& ((h->def_dynamic |
&& !h->def_regular) |
|| (htab->elf.dynamic_sections_created |
2436,6 → 2658,7 |
} |
eh->dyn_relocs = NULL; |
eh->func_pointer_refcount = 0; |
keep: ; |
} |
2496,8 → 2719,9 |
info->flags |= DF_TEXTREL; |
if (info->warn_shared_textrel && info->shared) |
info->callbacks->einfo (_("%P: %B: warning: relocation against `%s' in readonly section `%A'.\n"), |
if ((info->warn_shared_textrel && bfd_link_pic (info)) |
|| info->error_textrel) |
info->callbacks->einfo (_("%P: %B: warning: relocation against `%s' in readonly section `%A'\n"), |
p->sec->owner, h->root.root.string, |
p->sec); |
2508,14 → 2732,27 |
return TRUE; |
} |
/* Convert |
mov foo@GOT(%reg), %reg |
/* With the local symbol, foo, we convert |
mov foo@GOT[(%reg1)], %reg2 |
to |
lea foo@GOTOFF(%reg), %reg |
with the local symbol, foo. */ |
lea foo[@GOTOFF(%reg1)], %reg2 |
and convert |
call/jmp *foo@GOT[(%reg)] |
to |
nop call foo/jmp foo nop |
When PIC is false, convert |
test %reg1, foo@GOT[(%reg2)] |
to |
test $foo, %reg1 |
and convert |
binop foo@GOT[(%reg1)], %reg2 |
to |
binop $foo, %reg2 |
where binop is one of adc, add, and, cmp, or, sbb, sub, xor |
instructions. */ |
static bfd_boolean |
elf_i386_convert_mov_to_lea (bfd *abfd, asection *sec, |
elf_i386_convert_load (bfd *abfd, asection *sec, |
struct bfd_link_info *link_info) |
{ |
Elf_Internal_Shdr *symtab_hdr; |
2531,10 → 2768,10 |
if (!is_elf_hash_table (link_info->hash)) |
return FALSE; |
/* Nothing to do if there are no codes, no relocations or no output. */ |
/* Nothing to do if there is no need or no output. */ |
if ((sec->flags & (SEC_CODE | SEC_RELOC)) != (SEC_CODE | SEC_RELOC) |
|| sec->reloc_count == 0 |
|| discarded_section (sec)) |
|| sec->need_convert_load == 0 |
|| bfd_is_abs_section (sec->output_section)) |
return TRUE; |
symtab_hdr = &elf_tdata (abfd)->symtab_hdr; |
2567,33 → 2804,97 |
unsigned int r_symndx = ELF32_R_SYM (irel->r_info); |
unsigned int indx; |
struct elf_link_hash_entry *h; |
unsigned int opcode; |
unsigned int modrm; |
bfd_vma roff; |
bfd_boolean baseless; |
Elf_Internal_Sym *isym; |
unsigned int addend; |
unsigned int nop; |
bfd_vma nop_offset; |
if (r_type != R_386_GOT32) |
if (r_type != R_386_GOT32 && r_type != R_386_GOT32X) |
continue; |
/* Get the symbol referred to by the reloc. */ |
roff = irel->r_offset; |
if (roff < 2) |
continue; |
/* Addend for R_386_GOT32 and R_386_GOT32X relocations must be 0. */ |
addend = bfd_get_32 (abfd, contents + roff); |
if (addend != 0) |
continue; |
modrm = bfd_get_8 (abfd, contents + roff - 1); |
baseless = (modrm & 0xc7) == 0x5; |
if (r_type == R_386_GOT32X |
&& baseless |
&& bfd_link_pic (link_info)) |
{ |
/* For PIC, disallow R_386_GOT32X without a base register |
since we don't know what the GOT base is. Allow |
R_386_GOT32 for existing object files. */ |
const char *name; |
if (r_symndx < symtab_hdr->sh_info) |
{ |
Elf_Internal_Sym *isym; |
isym = bfd_sym_from_r_symndx (&htab->sym_cache, abfd, |
r_symndx); |
name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL); |
} |
else |
{ |
indx = r_symndx - symtab_hdr->sh_info; |
h = elf_sym_hashes (abfd)[indx]; |
BFD_ASSERT (h != NULL); |
name = h->root.root.string; |
} |
(*_bfd_error_handler) |
(_("%B: direct GOT relocation R_386_GOT32X against `%s' without base register can not be used when making a shared object"), |
abfd, name); |
goto error_return; |
} |
opcode = bfd_get_8 (abfd, contents + roff - 2); |
/* It is OK to convert mov to lea. */ |
if (opcode != 0x8b) |
{ |
/* Only convert R_386_GOT32X relocation for call, jmp or |
one of adc, add, and, cmp, or, sbb, sub, test, xor |
instructions. */ |
if (r_type != R_386_GOT32X) |
continue; |
/* It is OK to convert indirect branch to direct branch. It |
is OK to convert adc, add, and, cmp, or, sbb, sub, test, |
xor only when PIC is false. */ |
if (opcode != 0xff && bfd_link_pic (link_info)) |
continue; |
} |
/* Try to convert R_386_GOT32 and R_386_GOT32X. Get the symbol |
referred to by the reloc. */ |
if (r_symndx < symtab_hdr->sh_info) |
{ |
isym = bfd_sym_from_r_symndx (&htab->sym_cache, |
abfd, r_symndx); |
/* STT_GNU_IFUNC must keep R_386_GOT32 relocation. */ |
if (ELF_ST_TYPE (isym->st_info) != STT_GNU_IFUNC |
&& bfd_get_8 (input_bfd, |
contents + irel->r_offset - 2) == 0x8b) |
{ |
bfd_put_8 (output_bfd, 0x8d, |
contents + irel->r_offset - 2); |
irel->r_info = ELF32_R_INFO (r_symndx, R_386_GOTOFF); |
if (local_got_refcounts != NULL |
&& local_got_refcounts[r_symndx] > 0) |
local_got_refcounts[r_symndx] -= 1; |
changed_contents = TRUE; |
changed_relocs = TRUE; |
} |
/* STT_GNU_IFUNC must keep GOT32 relocations. */ |
if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC) |
continue; |
h = NULL; |
if (opcode == 0x0ff) |
/* Convert "call/jmp *foo@GOT[(%reg)]". */ |
goto convert_branch; |
else |
/* Convert "mov foo@GOT[(%reg1)], %reg2", |
"test %reg1, foo@GOT(%reg2)" and |
"binop foo@GOT[(%reg1)], %reg2". */ |
goto convert_load; |
} |
indx = r_symndx - symtab_hdr->sh_info; |
2604,25 → 2905,149 |
|| h->root.type == bfd_link_hash_warning) |
h = (struct elf_link_hash_entry *) h->root.u.i.link; |
/* STT_GNU_IFUNC must keep R_386_GOT32 relocation. We also avoid |
optimizing _DYNAMIC since ld.so may use its link-time address. */ |
if (h->def_regular |
&& h->type != STT_GNU_IFUNC |
&& h != htab->elf.hdynamic |
&& SYMBOL_REFERENCES_LOCAL (link_info, h) |
&& bfd_get_8 (input_bfd, |
contents + irel->r_offset - 2) == 0x8b) |
/* STT_GNU_IFUNC must keep GOT32 relocations. */ |
if (h->type == STT_GNU_IFUNC) |
continue; |
if (opcode == 0xff) |
{ |
bfd_put_8 (output_bfd, 0x8d, |
contents + irel->r_offset - 2); |
irel->r_info = ELF32_R_INFO (r_symndx, R_386_GOTOFF); |
/* We have "call/jmp *foo@GOT[(%reg)]". */ |
if ((h->root.type == bfd_link_hash_defined |
|| h->root.type == bfd_link_hash_defweak) |
&& SYMBOL_REFERENCES_LOCAL (link_info, h)) |
{ |
/* The function is locally defined. */ |
convert_branch: |
/* Convert R_386_GOT32X to R_386_PC32. */ |
if (modrm == 0x15 || (modrm & 0xf8) == 0x90) |
{ |
/* Convert to "nop call foo". ADDR_PREFIX_OPCODE |
is a nop prefix. */ |
modrm = 0xe8; |
nop = link_info->call_nop_byte; |
if (link_info->call_nop_as_suffix) |
{ |
nop_offset = roff + 3; |
irel->r_offset -= 1; |
} |
else |
nop_offset = roff - 2; |
} |
else |
{ |
/* Convert to "jmp foo nop". */ |
modrm = 0xe9; |
nop = NOP_OPCODE; |
nop_offset = roff + 3; |
irel->r_offset -= 1; |
} |
bfd_put_8 (abfd, nop, contents + nop_offset); |
bfd_put_8 (abfd, modrm, contents + irel->r_offset - 1); |
/* When converting to PC-relative relocation, we |
need to adjust addend by -4. */ |
bfd_put_32 (abfd, -4, contents + irel->r_offset); |
irel->r_info = ELF32_R_INFO (r_symndx, R_386_PC32); |
if (h) |
{ |
if (h->got.refcount > 0) |
h->got.refcount -= 1; |
} |
else |
{ |
if (local_got_refcounts != NULL |
&& local_got_refcounts[r_symndx] > 0) |
local_got_refcounts[r_symndx] -= 1; |
} |
changed_contents = TRUE; |
changed_relocs = TRUE; |
} |
} |
else |
{ |
/* We have "mov foo@GOT[(%re1g)], %reg2", |
"test %reg1, foo@GOT(%reg2)" and |
"binop foo@GOT[(%reg1)], %reg2". |
Avoid optimizing _DYNAMIC since ld.so may use its |
link-time address. */ |
if (h == htab->elf.hdynamic) |
continue; |
/* def_regular is set by an assignment in a linker script in |
bfd_elf_record_link_assignment. */ |
if ((h->def_regular |
|| h->root.type == bfd_link_hash_defined |
|| h->root.type == bfd_link_hash_defweak) |
&& SYMBOL_REFERENCES_LOCAL (link_info, h)) |
{ |
convert_load: |
if (opcode == 0x8b) |
{ |
/* Convert "mov foo@GOT(%reg1), %reg2" to |
"lea foo@GOTOFF(%reg1), %reg2". */ |
if (r_type == R_386_GOT32X |
&& (baseless || !bfd_link_pic (link_info))) |
{ |
r_type = R_386_32; |
/* For R_386_32, convert |
"lea foo@GOTOFF(%reg1), %reg2" to |
"lea foo@GOT, %reg2". */ |
if (!baseless) |
{ |
modrm = 0x5 | (modrm & 0x38); |
bfd_put_8 (abfd, modrm, contents + roff - 1); |
} |
} |
else |
r_type = R_386_GOTOFF; |
opcode = 0x8d; |
} |
else |
{ |
if (opcode == 0x85) |
{ |
/* Convert "test %reg1, foo@GOT(%reg2)" to |
"test $foo, %reg1". */ |
modrm = 0xc0 | (modrm & 0x38) >> 3; |
opcode = 0xf7; |
} |
else |
{ |
/* Convert "binop foo@GOT(%reg1), %reg2" to |
"binop $foo, %reg2". */ |
modrm = (0xc0 |
| (modrm & 0x38) >> 3 |
| (opcode & 0x3c)); |
opcode = 0x81; |
} |
bfd_put_8 (abfd, modrm, contents + roff - 1); |
r_type = R_386_32; |
} |
bfd_put_8 (abfd, opcode, contents + roff - 2); |
irel->r_info = ELF32_R_INFO (r_symndx, r_type); |
if (h) |
{ |
if (h->got.refcount > 0) |
h->got.refcount -= 1; |
} |
else |
{ |
if (local_got_refcounts != NULL |
&& local_got_refcounts[r_symndx] > 0) |
local_got_refcounts[r_symndx] -= 1; |
} |
changed_contents = TRUE; |
changed_relocs = TRUE; |
} |
} |
} |
if (contents != NULL |
&& elf_section_data (sec)->this_hdr.contents != contents) |
{ |
2676,7 → 3101,7 |
if (htab->elf.dynamic_sections_created) |
{ |
/* Set the contents of the .interp section to the interpreter. */ |
if (info->executable) |
if (bfd_link_executable (info) && !info->nointerp) |
{ |
s = bfd_get_linker_section (dynobj, ".interp"); |
if (s == NULL) |
2688,7 → 3113,7 |
/* Set up .got offsets for local syms, and space for local dynamic |
relocs. */ |
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) |
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) |
{ |
bfd_signed_vma *local_got; |
bfd_signed_vma *end_local_got; |
2705,7 → 3130,7 |
{ |
struct elf_dyn_relocs *p; |
if (!elf_i386_convert_mov_to_lea (ibfd, s, info)) |
if (!elf_i386_convert_load (ibfd, s, info)) |
return FALSE; |
for (p = ((struct elf_dyn_relocs *) |
2736,8 → 3161,9 |
&& (info->flags & DF_TEXTREL) == 0) |
{ |
info->flags |= DF_TEXTREL; |
if (info->warn_shared_textrel && info->shared) |
info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'.\n"), |
if ((info->warn_shared_textrel && bfd_link_pic (info)) |
|| info->error_textrel) |
info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'\n"), |
p->sec->owner, p->sec); |
} |
} |
2777,7 → 3203,7 |
|| *local_tls_type == GOT_TLS_IE_BOTH) |
s->size += 4; |
} |
if (info->shared |
if (bfd_link_pic (info) |
|| GOT_TLS_GD_ANY_P (*local_tls_type) |
|| (*local_tls_type & GOT_TLS_IE)) |
{ |
2885,6 → 3311,7 |
else if (s == htab->elf.sgotplt |
|| s == htab->elf.iplt |
|| s == htab->elf.igotplt |
|| s == htab->plt_got |
|| s == htab->plt_eh_frame |
|| s == htab->sdynbss) |
{ |
2955,7 → 3382,7 |
#define add_dynamic_entry(TAG, VAL) \ |
_bfd_elf_add_dynamic_entry (info, TAG, VAL) |
if (info->executable) |
if (bfd_link_executable (info)) |
{ |
if (!add_dynamic_entry (DT_DEBUG, 0)) |
return FALSE; |
2963,12 → 3390,19 |
if (htab->elf.splt->size != 0) |
{ |
if (!add_dynamic_entry (DT_PLTGOT, 0) |
|| !add_dynamic_entry (DT_PLTRELSZ, 0) |
/* DT_PLTGOT is used by prelink even if there is no PLT |
relocation. */ |
if (!add_dynamic_entry (DT_PLTGOT, 0)) |
return FALSE; |
if (htab->elf.srelplt->size != 0) |
{ |
if (!add_dynamic_entry (DT_PLTRELSZ, 0) |
|| !add_dynamic_entry (DT_PLTREL, DT_REL) |
|| !add_dynamic_entry (DT_JMPREL, 0)) |
return FALSE; |
} |
} |
if (relocs) |
{ |
2985,6 → 3419,15 |
if ((info->flags & DF_TEXTREL) != 0) |
{ |
if ((elf_tdata (output_bfd)->has_gnu_symbols |
& elf_gnu_symbol_ifunc) == elf_gnu_symbol_ifunc) |
{ |
info->callbacks->einfo |
(_("%P%X: read-only segment has dynamic IFUNC relocations; recompile with -fPIC\n")); |
bfd_set_error (bfd_error_bad_value); |
return FALSE; |
} |
if (!add_dynamic_entry (DT_TEXTREL, 0)) |
return FALSE; |
} |
3034,6 → 3477,7 |
tlsbase = (struct elf_link_hash_entry *)bh; |
tlsbase->def_regular = 1; |
tlsbase->other = STV_HIDDEN; |
tlsbase->root.linker_def = 1; |
(*bed->elf_backend_hide_symbol) (info, tlsbase, TRUE); |
} |
} |
3086,7 → 3530,7 |
struct elf_i386_link_hash_table *htab; |
struct bfd_link_hash_entry *base; |
if (!info->executable) |
if (!bfd_link_executable (info)) |
return; |
htab = elf_i386_hash_table (info); |
3150,6 → 3594,7 |
bfd_vma *local_got_offsets; |
bfd_vma *local_tlsdesc_gotents; |
Elf_Internal_Rela *rel; |
Elf_Internal_Rela *wrel; |
Elf_Internal_Rela *relend; |
bfd_boolean is_vxworks_tls; |
unsigned plt_entry_size; |
3166,7 → 3611,7 |
/* We have to handle relocations in vxworks .tls_vars sections |
specially, because the dynamic loader is 'weird'. */ |
is_vxworks_tls = (get_elf_i386_backend_data (output_bfd)->is_vxworks |
&& info->shared |
&& bfd_link_pic (info) |
&& !strcmp (input_section->output_section->name, |
".tls_vars")); |
3174,17 → 3619,18 |
plt_entry_size = GET_PLT_ENTRY_SIZE (output_bfd); |
rel = relocs; |
rel = wrel = relocs; |
relend = relocs + input_section->reloc_count; |
for (; rel < relend; rel++) |
for (; rel < relend; wrel++, rel++) |
{ |
unsigned int r_type; |
reloc_howto_type *howto; |
unsigned long r_symndx; |
struct elf_link_hash_entry *h; |
struct elf_i386_link_hash_entry *eh; |
Elf_Internal_Sym *sym; |
asection *sec; |
bfd_vma off, offplt; |
bfd_vma off, offplt, plt_offset; |
bfd_vma relocation; |
bfd_boolean unresolved_reloc; |
bfd_reloc_status_type r; |
3191,17 → 3637,22 |
unsigned int indx; |
int tls_type; |
bfd_vma st_size; |
asection *resolved_plt; |
r_type = ELF32_R_TYPE (rel->r_info); |
if (r_type == R_386_GNU_VTINHERIT |
|| r_type == R_386_GNU_VTENTRY) |
{ |
if (wrel != rel) |
*wrel = *rel; |
continue; |
} |
if ((indx = r_type) >= R_386_standard |
&& ((indx = r_type - R_386_ext_offset) - R_386_standard |
>= R_386_ext - R_386_standard) |
&& ((indx = r_type - R_386_tls_offset) - R_386_ext |
>= R_386_irelative - R_386_ext)) |
>= R_386_ext2 - R_386_ext)) |
{ |
(*_bfd_error_handler) |
(_("%B: unrecognized relocation (0x%x) in section `%A'"), |
3227,7 → 3678,7 |
if (ELF_ST_TYPE (sym->st_info) == STT_SECTION |
&& ((sec->flags & SEC_MERGE) != 0 |
|| (info->relocatable |
|| (bfd_link_relocatable (info) |
&& sec->output_offset != 0))) |
{ |
bfd_vma addend; |
3263,7 → 3714,7 |
abort (); |
} |
if (info->relocatable) |
if (bfd_link_relocatable (info)) |
addend += sec->output_offset; |
else |
{ |
3294,7 → 3745,7 |
break; |
} |
} |
else if (!info->relocatable |
else if (!bfd_link_relocatable (info) |
&& ELF32_ST_TYPE (sym->st_info) == STT_GNU_IFUNC) |
{ |
/* Relocate against local STT_GNU_IFUNC symbol. */ |
3311,21 → 3762,40 |
else |
{ |
bfd_boolean warned ATTRIBUTE_UNUSED; |
bfd_boolean ignored ATTRIBUTE_UNUSED; |
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, |
r_symndx, symtab_hdr, sym_hashes, |
h, sec, relocation, |
unresolved_reloc, warned); |
unresolved_reloc, warned, ignored); |
st_size = h->size; |
} |
if (sec != NULL && discarded_section (sec)) |
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, |
rel, 1, relend, howto, 0, contents); |
{ |
_bfd_clear_contents (howto, input_bfd, input_section, |
contents + rel->r_offset); |
wrel->r_offset = rel->r_offset; |
wrel->r_info = 0; |
wrel->r_addend = 0; |
if (info->relocatable) |
/* For ld -r, remove relocations in debug sections against |
sections defined in discarded sections. Not done for |
eh_frame editing code expects to be present. */ |
if (bfd_link_relocatable (info) |
&& (input_section->flags & SEC_DEBUGGING)) |
wrel--; |
continue; |
} |
if (bfd_link_relocatable (info)) |
{ |
if (wrel != rel) |
*wrel = *rel; |
continue; |
} |
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle |
it here if it is defined in a non-shared object. */ |
if (h != NULL |
3336,9 → 3806,17 |
bfd_vma plt_index; |
const char *name; |
if ((input_section->flags & SEC_ALLOC) == 0 |
|| h->plt.offset == (bfd_vma) -1) |
if ((input_section->flags & SEC_ALLOC) == 0) |
{ |
/* Dynamic relocs are not propagated for SEC_DEBUGGING |
sections because such sections are not SEC_ALLOC and |
thus ld.so will not process them. */ |
if ((input_section->flags & SEC_DEBUGGING) != 0) |
continue; |
abort (); |
} |
else if (h->plt.offset == (bfd_vma) -1) |
abort (); |
/* STT_GNU_IFUNC symbol must go through PLT. */ |
if (htab->elf.splt != NULL) |
3374,7 → 3852,7 |
case R_386_32: |
/* Generate dynamic relcoation only when there is a |
non-GOT reference in a shared object. */ |
if (info->shared && h->non_got_ref) |
if (bfd_link_pic (info) && h->non_got_ref) |
{ |
Elf_Internal_Rela outrel; |
asection *sreloc; |
3396,7 → 3874,7 |
if (h->dynindx == -1 |
|| h->forced_local |
|| info->executable) |
|| bfd_link_executable (info)) |
{ |
/* This symbol is resolved locally. */ |
outrel.r_info = ELF32_R_INFO (0, R_386_IRELATIVE); |
3425,6 → 3903,7 |
goto do_relocation; |
case R_386_GOT32: |
case R_386_GOT32X: |
base_got = htab->elf.sgot; |
off = h->got.offset; |
3499,9 → 3978,67 |
} |
} |
eh = (struct elf_i386_link_hash_entry *) h; |
switch (r_type) |
{ |
case R_386_GOT32X: |
/* Avoid optimizing _DYNAMIC since ld.so may use its |
link-time address. */ |
if (h == htab->elf.hdynamic) |
goto r_386_got32; |
if (bfd_link_pic (info)) |
{ |
/* It is OK to convert mov to lea and convert indirect |
branch to direct branch. It is OK to convert adc, |
add, and, cmp, or, sbb, sub, test, xor only when PIC |
is false. */ |
unsigned int opcode, addend; |
addend = bfd_get_32 (input_bfd, contents + rel->r_offset); |
if (addend != 0) |
goto r_386_got32; |
opcode = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); |
if (opcode != 0x8b && opcode != 0xff) |
goto r_386_got32; |
} |
/* Resolve "mov GOT[(%reg)], %reg", |
"call/jmp *GOT[(%reg)]", "test %reg, foo@GOT[(%reg)]" |
and "binop foo@GOT[(%reg)], %reg". */ |
if (h == NULL |
|| (h->plt.offset == (bfd_vma) -1 |
&& h->got.offset == (bfd_vma) -1) |
|| htab->elf.sgotplt == NULL) |
abort (); |
offplt = (htab->elf.sgotplt->output_section->vma |
+ htab->elf.sgotplt->output_offset); |
/* It is relative to .got.plt section. */ |
if (h->got.offset != (bfd_vma) -1) |
/* Use GOT entry. */ |
relocation = (htab->elf.sgot->output_section->vma |
+ htab->elf.sgot->output_offset |
+ h->got.offset - offplt); |
else |
/* Use GOTPLT entry. */ |
relocation = (h->plt.offset / plt_entry_size - 1 + 3) * 4; |
if (!bfd_link_pic (info)) |
{ |
/* If not PIC, add the .got.plt section address for |
baseless addressing. */ |
unsigned int modrm; |
modrm = bfd_get_8 (input_bfd, contents + rel->r_offset - 1); |
if ((modrm & 0xc7) == 0x5) |
relocation += offplt; |
} |
unresolved_reloc = FALSE; |
break; |
case R_386_GOT32: |
r_386_got32: |
/* Relocation is to the entry for this symbol in the global |
offset table. */ |
if (htab->elf.sgot == NULL) |
3513,8 → 4050,10 |
off = h->got.offset; |
dyn = htab->elf.dynamic_sections_created; |
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h) |
|| (info->shared |
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, |
bfd_link_pic (info), |
h) |
|| (bfd_link_pic (info) |
&& SYMBOL_REFERENCES_LOCAL (info, h)) |
|| (ELF_ST_VISIBILITY (h->other) |
&& h->root.type == bfd_link_hash_undefweak)) |
3560,7 → 4099,7 |
bfd_put_32 (output_bfd, relocation, |
htab->elf.sgot->contents + off); |
if (info->shared) |
if (bfd_link_pic (info)) |
{ |
asection *s; |
Elf_Internal_Rela outrel; |
3593,11 → 4132,11 |
/* Relocation is relative to the start of the global offset |
table. */ |
/* Check to make sure it isn't a protected function symbol |
for shared library since it may not be local when used |
as function address. We also need to make sure that a |
symbol is defined locally. */ |
if (info->shared && h) |
/* Check to make sure it isn't a protected function or data |
symbol for shared library since it may not be local when |
used as function address or with copy relocation. We also |
need to make sure that a symbol is referenced locally. */ |
if (!bfd_link_executable (info) && h) |
{ |
if (!h->def_regular) |
{ |
3625,14 → 4164,16 |
bfd_set_error (bfd_error_bad_value); |
return FALSE; |
} |
else if (!info->executable |
&& !SYMBOLIC_BIND (info, h) |
&& h->type == STT_FUNC |
else if (!SYMBOL_REFERENCES_LOCAL (info, h) |
&& (h->type == STT_FUNC |
|| h->type == STT_OBJECT) |
&& ELF_ST_VISIBILITY (h->other) == STV_PROTECTED) |
{ |
(*_bfd_error_handler) |
(_("%B: relocation R_386_GOTOFF against protected function `%s' can not be used when making a shared object"), |
input_bfd, h->root.root.string); |
(_("%B: relocation R_386_GOTOFF against protected %s `%s' can not be used when making a shared object"), |
input_bfd, |
h->type == STT_FUNC ? "function" : "data", |
h->root.root.string); |
bfd_set_error (bfd_error_bad_value); |
return FALSE; |
} |
3663,7 → 4204,8 |
if (h == NULL) |
break; |
if (h->plt.offset == (bfd_vma) -1 |
if ((h->plt.offset == (bfd_vma) -1 |
&& eh->plt_got.offset == (bfd_vma) -1) |
|| htab->elf.splt == NULL) |
{ |
/* We didn't make a PLT entry for this symbol. This |
3672,9 → 4214,20 |
break; |
} |
relocation = (htab->elf.splt->output_section->vma |
+ htab->elf.splt->output_offset |
+ h->plt.offset); |
if (h->plt.offset != (bfd_vma) -1) |
{ |
resolved_plt = htab->elf.splt; |
plt_offset = h->plt.offset; |
} |
else |
{ |
resolved_plt = htab->plt_got; |
plt_offset = eh->plt_got.offset; |
} |
relocation = (resolved_plt->output_section->vma |
+ resolved_plt->output_offset |
+ plt_offset); |
unresolved_reloc = FALSE; |
break; |
3689,7 → 4242,8 |
|| is_vxworks_tls) |
break; |
if ((info->shared |
/* Copy dynamic function pointer relocations. */ |
if ((bfd_link_pic (info) |
&& (h == NULL |
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT |
|| h->root.type != bfd_link_hash_undefweak) |
3696,10 → 4250,10 |
&& ((r_type != R_386_PC32 && r_type != R_386_SIZE32) |
|| !SYMBOL_CALLS_LOCAL (info, h))) |
|| (ELIMINATE_COPY_RELOCS |
&& !info->shared |
&& !bfd_link_pic (info) |
&& h != NULL |
&& h->dynindx != -1 |
&& !h->non_got_ref |
&& (!h->non_got_ref || eh->func_pointer_refcount > 0) |
&& ((h->def_dynamic |
&& !h->def_regular) |
|| h->root.type == bfd_link_hash_undefweak |
3731,7 → 4285,7 |
else if (h != NULL |
&& h->dynindx != -1 |
&& (r_type == R_386_PC32 |
|| !info->shared |
|| !bfd_link_pic (info) |
|| !SYMBOLIC_BIND (info, h) |
|| !h->def_regular)) |
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type); |
3762,7 → 4316,7 |
break; |
case R_386_TLS_IE: |
if (!info->executable) |
if (!bfd_link_executable (info)) |
{ |
Elf_Internal_Rela outrel; |
asection *sreloc; |
3832,6 → 4386,7 |
contents + roff); |
/* Skip R_386_PC32/R_386_PLT32. */ |
rel++; |
wrel++; |
continue; |
} |
else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GOTDESC) |
4171,6 → 4726,7 |
contents + roff + 8); |
/* Skip R_386_PLT32. */ |
rel++; |
wrel++; |
continue; |
} |
else if (ELF32_R_TYPE (rel->r_info) == R_386_TLS_GOTDESC) |
4268,6 → 4824,7 |
"\x65\xa1\0\0\0\0\x90\x8d\x74\x26", 11); |
/* Skip R_386_PC32/R_386_PLT32. */ |
rel++; |
wrel++; |
continue; |
} |
4303,7 → 4860,8 |
break; |
case R_386_TLS_LDO_32: |
if (!info->executable || (input_section->flags & SEC_CODE) == 0) |
if (!bfd_link_executable (info) |
|| (input_section->flags & SEC_CODE) == 0) |
relocation -= elf_i386_dtpoff_base (info); |
else |
/* When converting LDO to LE, we must negate. */ |
4312,7 → 4870,7 |
case R_386_TLS_LE_32: |
case R_386_TLS_LE: |
if (!info->executable) |
if (!bfd_link_executable (info)) |
{ |
Elf_Internal_Rela outrel; |
asection *sreloc; |
4408,8 → 4966,31 |
return FALSE; |
} |
} |
if (wrel != rel) |
*wrel = *rel; |
} |
if (wrel != rel) |
{ |
Elf_Internal_Shdr *rel_hdr; |
size_t deleted = rel - wrel; |
rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); |
rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; |
if (rel_hdr->sh_size == 0) |
{ |
/* It is too late to remove an empty reloc section. Leave |
one NONE reloc. |
??? What is wrong with an empty section??? */ |
rel_hdr->sh_size = rel_hdr->sh_entsize; |
deleted -= 1; |
} |
rel_hdr = _bfd_elf_single_rel_hdr (input_section); |
rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; |
input_section->reloc_count -= deleted; |
} |
return TRUE; |
} |
4425,6 → 5006,7 |
struct elf_i386_link_hash_table *htab; |
unsigned plt_entry_size; |
const struct elf_i386_backend_data *abed; |
struct elf_i386_link_hash_entry *eh; |
htab = elf_i386_hash_table (info); |
if (htab == NULL) |
4433,6 → 5015,8 |
abed = get_elf_i386_backend_data (output_bfd); |
plt_entry_size = GET_PLT_ENTRY_SIZE (output_bfd); |
eh = (struct elf_i386_link_hash_entry *) h; |
if (h->plt.offset != (bfd_vma) -1) |
{ |
bfd_vma plt_index; |
4460,7 → 5044,7 |
it up. */ |
if ((h->dynindx == -1 |
&& !((h->forced_local || info->executable) |
&& !((h->forced_local || bfd_link_executable (info)) |
&& h->def_regular |
&& h->type == STT_GNU_IFUNC)) |
|| plt == NULL |
4491,7 → 5075,7 |
} |
/* Fill in the entry in the procedure linkage table. */ |
if (! info->shared) |
if (! bfd_link_pic (info)) |
{ |
memcpy (plt->contents + h->plt.offset, abed->plt->plt_entry, |
abed->plt->plt_entry_size); |
4513,7 → 5097,7 |
s = ((h->plt.offset - abed->plt->plt_entry_size) |
/ abed->plt->plt_entry_size); |
/* K: Number of relocations for PLTResolve. */ |
if (info->shared) |
if (bfd_link_pic (info)) |
k = PLTRESOLVE_RELOCS_SHLIB; |
else |
k = PLTRESOLVE_RELOCS; |
4561,7 → 5145,7 |
+ gotplt->output_offset |
+ got_offset); |
if (h->dynindx == -1 |
|| ((info->executable |
|| ((bfd_link_executable (info) |
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) |
&& h->def_regular |
&& h->type == STT_GNU_IFUNC)) |
4597,9 → 5181,54 |
plt->contents + h->plt.offset |
+ abed->plt->plt_plt_offset); |
} |
} |
else if (eh->plt_got.offset != (bfd_vma) -1) |
{ |
bfd_vma got_offset, plt_offset; |
asection *plt, *got, *gotplt; |
const bfd_byte *got_plt_entry; |
if (!h->def_regular) |
/* Offset of displacement of the indirect jump. */ |
bfd_vma plt_got_offset = 2; |
/* Set the entry in the GOT procedure linkage table. */ |
plt = htab->plt_got; |
got = htab->elf.sgot; |
gotplt = htab->elf.sgotplt; |
got_offset = h->got.offset; |
if (got_offset == (bfd_vma) -1 |
|| plt == NULL |
|| got == NULL |
|| gotplt == NULL) |
abort (); |
/* Fill in the entry in the GOT procedure linkage table. */ |
if (! bfd_link_pic (info)) |
{ |
got_plt_entry = elf_i386_got_plt_entry; |
got_offset += got->output_section->vma + got->output_offset; |
} |
else |
{ |
got_plt_entry = elf_i386_pic_got_plt_entry; |
got_offset += (got->output_section->vma |
+ got->output_offset |
- gotplt->output_section->vma |
- gotplt->output_offset); |
} |
plt_offset = eh->plt_got.offset; |
memcpy (plt->contents + plt_offset, got_plt_entry, |
sizeof (elf_i386_got_plt_entry)); |
bfd_put_32 (output_bfd, got_offset, |
plt->contents + plt_offset + plt_got_offset); |
} |
if (!h->def_regular |
&& (h->plt.offset != (bfd_vma) -1 |
|| eh->plt_got.offset != (bfd_vma) -1)) |
{ |
/* Mark the symbol as undefined, rather than as defined in |
the .plt section. Leave the value if there were any |
relocations where pointer equality matters (this is a clue |
4612,7 → 5241,6 |
if (!h->pointer_equality_needed) |
sym->st_value = 0; |
} |
} |
if (h->got.offset != (bfd_vma) -1 |
&& ! GOT_TLS_GD_ANY_P (elf_i386_hash_entry(h)->tls_type) |
4638,7 → 5266,7 |
if (h->def_regular |
&& h->type == STT_GNU_IFUNC) |
{ |
if (info->shared) |
if (bfd_link_pic (info)) |
{ |
/* Generate R_386_GLOB_DAT. */ |
goto do_glob_dat; |
4661,7 → 5289,7 |
return TRUE; |
} |
} |
else if (info->shared |
else if (bfd_link_pic (info) |
&& SYMBOL_REFERENCES_LOCAL (info, h)) |
{ |
BFD_ASSERT((h->got.offset & 1) != 0); |
4720,10 → 5348,27 |
dynamic linker, before writing them out. */ |
static enum elf_reloc_type_class |
elf_i386_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, |
elf_i386_reloc_type_class (const struct bfd_link_info *info, |
const asection *rel_sec ATTRIBUTE_UNUSED, |
const Elf_Internal_Rela *rela) |
{ |
bfd *abfd = info->output_bfd; |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
struct elf_link_hash_table *htab = elf_hash_table (info); |
unsigned long r_symndx = ELF32_R_SYM (rela->r_info); |
Elf_Internal_Sym sym; |
if (htab->dynsym == NULL |
|| !bed->s->swap_symbol_in (abfd, |
(htab->dynsym->contents |
+ r_symndx * sizeof (Elf32_External_Sym)), |
0, &sym)) |
abort (); |
/* Check relocation against STT_GNU_IFUNC symbol. */ |
if (ELF32_ST_TYPE (sym.st_info) == STT_GNU_IFUNC) |
return reloc_class_ifunc; |
switch (ELF32_R_TYPE (rela->r_info)) |
{ |
case R_386_RELATIVE: |
4827,7 → 5472,7 |
/* Fill in the first entry in the procedure linkage table. */ |
if (htab->elf.splt && htab->elf.splt->size > 0) |
{ |
if (info->shared) |
if (bfd_link_pic (info)) |
{ |
memcpy (htab->elf.splt->contents, abed->plt->pic_plt0_entry, |
abed->plt->plt0_entry_size); |
4885,7 → 5530,7 |
->this_hdr.sh_entsize = 4; |
/* Correct the .rel.plt.unloaded relocations. */ |
if (abed->is_vxworks && !info->shared) |
if (abed->is_vxworks && !bfd_link_pic (info)) |
{ |
int num_plts = (htab->elf.splt->size |
/ abed->plt->plt_entry_size) - 1; |
4892,7 → 5537,7 |
unsigned char *p; |
p = htab->srelplt2->contents; |
if (info->shared) |
if (bfd_link_pic (info)) |
p += PLTRESOLVE_RELOCS_SHLIB * sizeof (Elf32_External_Rel); |
else |
p += PLTRESOLVE_RELOCS * sizeof (Elf32_External_Rel); |
4976,16 → 5621,98 |
return TRUE; |
} |
/* Return address for Ith PLT stub in section PLT, for relocation REL |
or (bfd_vma) -1 if it should not be included. */ |
/* Return an array of PLT entry symbol values. */ |
static bfd_vma |
elf_i386_plt_sym_val (bfd_vma i, const asection *plt, |
const arelent *rel ATTRIBUTE_UNUSED) |
static bfd_vma * |
elf_i386_get_plt_sym_val (bfd *abfd, asymbol **dynsyms, asection *plt, |
asection *relplt) |
{ |
return plt->vma + (i + 1) * GET_PLT_ENTRY_SIZE (plt->owner); |
bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean); |
arelent *p; |
long count, i; |
bfd_vma *plt_sym_val; |
bfd_vma plt_offset; |
bfd_byte *plt_contents; |
const struct elf_i386_backend_data *bed |
= get_elf_i386_backend_data (abfd); |
Elf_Internal_Shdr *hdr; |
/* Get the .plt section contents. */ |
plt_contents = (bfd_byte *) bfd_malloc (plt->size); |
if (plt_contents == NULL) |
return NULL; |
if (!bfd_get_section_contents (abfd, (asection *) plt, |
plt_contents, 0, plt->size)) |
{ |
bad_return: |
free (plt_contents); |
return NULL; |
} |
slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table; |
if (! (*slurp_relocs) (abfd, relplt, dynsyms, TRUE)) |
goto bad_return; |
hdr = &elf_section_data (relplt)->this_hdr; |
count = relplt->size / hdr->sh_entsize; |
plt_sym_val = (bfd_vma *) bfd_malloc (sizeof (bfd_vma) * count); |
if (plt_sym_val == NULL) |
goto bad_return; |
for (i = 0; i < count; i++) |
plt_sym_val[i] = -1; |
plt_offset = bed->plt->plt_entry_size; |
p = relplt->relocation; |
for (i = 0; i < count; i++, p++) |
{ |
long reloc_index; |
/* Skip unknown relocation. PR 17512: file: bc9d6cf5. */ |
if (p->howto == NULL) |
continue; |
if (p->howto->type != R_386_JUMP_SLOT |
&& p->howto->type != R_386_IRELATIVE) |
continue; |
reloc_index = H_GET_32 (abfd, (plt_contents + plt_offset |
+ bed->plt->plt_reloc_offset)); |
reloc_index /= sizeof (Elf32_External_Rel); |
if (reloc_index >= count) |
abort (); |
plt_sym_val[reloc_index] = plt->vma + plt_offset; |
plt_offset += bed->plt->plt_entry_size; |
/* PR binutils/18437: Skip extra relocations in the .rel.plt |
section. */ |
if (plt_offset >= plt->size) |
break; |
} |
free (plt_contents); |
return plt_sym_val; |
} |
/* Similar to _bfd_elf_get_synthetic_symtab. */ |
static long |
elf_i386_get_synthetic_symtab (bfd *abfd, |
long symcount, |
asymbol **syms, |
long dynsymcount, |
asymbol **dynsyms, |
asymbol **ret) |
{ |
asection *plt = bfd_get_section_by_name (abfd, ".plt"); |
return _bfd_elf_ifunc_get_synthetic_symtab (abfd, symcount, syms, |
dynsymcount, dynsyms, ret, |
plt, |
elf_i386_get_plt_sym_val); |
} |
/* Return TRUE if symbol should be hashed in the `.gnu.hash' section. */ |
static bfd_boolean |
5004,7 → 5731,7 |
static bfd_boolean |
elf_i386_add_symbol_hook (bfd * abfd, |
struct bfd_link_info * info ATTRIBUTE_UNUSED, |
struct bfd_link_info * info, |
Elf_Internal_Sym * sym, |
const char ** namep ATTRIBUTE_UNUSED, |
flagword * flagsp ATTRIBUTE_UNUSED, |
5011,15 → 5738,16 |
asection ** secp ATTRIBUTE_UNUSED, |
bfd_vma * valp ATTRIBUTE_UNUSED) |
{ |
if ((abfd->flags & DYNAMIC) == 0 |
&& (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC |
|| ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE)) |
elf_tdata (info->output_bfd)->has_gnu_symbols = TRUE; |
if (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_unique; |
return TRUE; |
} |
#define TARGET_LITTLE_SYM bfd_elf32_i386_vec |
#define TARGET_LITTLE_SYM i386_elf32_vec |
#define TARGET_LITTLE_NAME "elf32-i386" |
#define ELF_ARCH bfd_arch_i386 |
#define ELF_TARGET_ID I386_ELF_DATA |
5033,6 → 5761,7 |
#define elf_backend_want_plt_sym 0 |
#define elf_backend_got_header_size 12 |
#define elf_backend_plt_alignment 4 |
#define elf_backend_extern_protected_data 1 |
/* Support RELA for objdump of prelink objects. */ |
#define elf_info_to_howto elf_i386_info_to_howto_rel |
5042,9 → 5771,9 |
#define bfd_elf32_bfd_is_local_label_name elf_i386_is_local_label_name |
#define bfd_elf32_bfd_link_hash_table_create elf_i386_link_hash_table_create |
#define bfd_elf32_bfd_link_hash_table_free elf_i386_link_hash_table_free |
#define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup |
#define bfd_elf32_bfd_reloc_name_lookup elf_i386_reloc_name_lookup |
#define bfd_elf32_get_synthetic_symtab elf_i386_get_synthetic_symtab |
#define elf_backend_adjust_dynamic_symbol elf_i386_adjust_dynamic_symbol |
#define elf_backend_relocs_compatible _bfd_elf_relocs_compatible |
5064,11 → 5793,8 |
#define elf_backend_always_size_sections elf_i386_always_size_sections |
#define elf_backend_omit_section_dynsym \ |
((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true) |
#define elf_backend_plt_sym_val elf_i386_plt_sym_val |
#define elf_backend_hash_symbol elf_i386_hash_symbol |
#define elf_backend_add_symbol_hook elf_i386_add_symbol_hook |
#undef elf_backend_post_process_headers |
#define elf_backend_post_process_headers _bfd_elf_set_osabi |
#include "elf32-target.h" |
5075,7 → 5801,7 |
/* FreeBSD support. */ |
#undef TARGET_LITTLE_SYM |
#define TARGET_LITTLE_SYM bfd_elf32_i386_freebsd_vec |
#define TARGET_LITTLE_SYM i386_elf32_fbsd_vec |
#undef TARGET_LITTLE_NAME |
#define TARGET_LITTLE_NAME "elf32-i386-freebsd" |
#undef ELF_OSABI |
5088,11 → 5814,14 |
static void |
elf_i386_fbsd_post_process_headers (bfd *abfd, struct bfd_link_info *info) |
{ |
_bfd_elf_set_osabi (abfd, info); |
_bfd_elf_post_process_headers (abfd, info); |
#ifdef OLD_FREEBSD_ABI_LABEL |
{ |
/* The ABI label supported by FreeBSD <= 4.0 is quite nonstandard. */ |
Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd); |
memcpy (&i_ehdrp->e_ident[EI_ABIVERSION], "FreeBSD", 8); |
} |
#endif |
} |
5108,10 → 5837,12 |
/* Solaris 2. */ |
#undef TARGET_LITTLE_SYM |
#define TARGET_LITTLE_SYM bfd_elf32_i386_sol2_vec |
#define TARGET_LITTLE_SYM i386_elf32_sol2_vec |
#undef TARGET_LITTLE_NAME |
#define TARGET_LITTLE_NAME "elf32-i386-sol2" |
#undef elf_backend_post_process_headers |
/* Restore default: we cannot use ELFOSABI_SOLARIS, otherwise ELFOSABI_NONE |
objects won't be recognized. */ |
#undef ELF_OSABI |
5133,10 → 5864,51 |
#include "elf32-target.h" |
/* Intel MCU support. */ |
static bfd_boolean |
elf32_iamcu_elf_object_p (bfd *abfd) |
{ |
/* Set the right machine number for an IAMCU elf32 file. */ |
bfd_default_set_arch_mach (abfd, bfd_arch_iamcu, bfd_mach_i386_iamcu); |
return TRUE; |
} |
#undef TARGET_LITTLE_SYM |
#define TARGET_LITTLE_SYM iamcu_elf32_vec |
#undef TARGET_LITTLE_NAME |
#define TARGET_LITTLE_NAME "elf32-iamcu" |
#undef ELF_ARCH |
#define ELF_ARCH bfd_arch_iamcu |
#undef ELF_MACHINE_CODE |
#define ELF_MACHINE_CODE EM_IAMCU |
#undef ELF_OSABI |
#undef elf32_bed |
#define elf32_bed elf32_iamcu_bed |
#undef elf_backend_object_p |
#define elf_backend_object_p elf32_iamcu_elf_object_p |
#undef elf_backend_static_tls_alignment |
#undef elf_backend_want_plt_sym |
#define elf_backend_want_plt_sym 0 |
#include "elf32-target.h" |
/* Restore defaults. */ |
#undef ELF_ARCH |
#define ELF_ARCH bfd_arch_i386 |
#undef ELF_MACHINE_CODE |
#define ELF_MACHINE_CODE EM_386 |
/* Native Client support. */ |
#undef TARGET_LITTLE_SYM |
#define TARGET_LITTLE_SYM bfd_elf32_i386_nacl_vec |
#define TARGET_LITTLE_SYM i386_elf32_nacl_vec |
#undef TARGET_LITTLE_NAME |
#define TARGET_LITTLE_NAME "elf32-i386-nacl" |
#undef elf32_bed |
5150,7 → 5922,6 |
#undef elf_backend_want_plt_sym |
#define elf_backend_want_plt_sym 0 |
#undef elf_backend_post_process_headers |
#define elf_backend_post_process_headers _bfd_elf_set_osabi |
#undef elf_backend_static_tls_alignment |
/* NaCl uses substantially different PLT entries for the same effects. */ |
5326,7 → 6097,7 |
/* VxWorks support. */ |
#undef TARGET_LITTLE_SYM |
#define TARGET_LITTLE_SYM bfd_elf32_i386_vxworks_vec |
#define TARGET_LITTLE_SYM i386_elf32_vxworks_vec |
#undef TARGET_LITTLE_NAME |
#define TARGET_LITTLE_NAME "elf32-i386-vxworks" |
#undef ELF_OSABI |
5344,7 → 6115,6 |
#define elf_backend_arch_data &elf_i386_vxworks_arch_bed |
#undef elf_backend_relocs_compatible |
#undef elf_backend_post_process_headers |
#undef elf_backend_add_symbol_hook |
#define elf_backend_add_symbol_hook \ |
elf_vxworks_add_symbol_hook |
/contrib/toolchain/binutils/bfd/elf32-target.h |
---|
1,7 → 1,5 |
/* Target definitions for 32-bit ELF |
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 |
Free Software Foundation, Inc. |
Copyright (C) 1993-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
51,6 → 49,9 |
#ifndef bfd_elf32_find_nearest_line |
#define bfd_elf32_find_nearest_line _bfd_elf_find_nearest_line |
#endif |
#ifndef bfd_elf32_find_line |
#define bfd_elf32_find_line _bfd_elf_find_line |
#endif |
#ifndef bfd_elf32_find_inliner_info |
#define bfd_elf32_find_inliner_info _bfd_elf_find_inliner_info |
#endif |
65,6 → 66,10 |
#ifndef bfd_elf32_get_symbol_info |
#define bfd_elf32_get_symbol_info _bfd_elf_get_symbol_info |
#endif |
#ifndef bfd_elf32_get_symbol_version_string |
#define bfd_elf32_get_symbol_version_string \ |
_bfd_elf_get_symbol_version_string |
#endif |
#define bfd_elf32_canonicalize_symtab _bfd_elf_canonicalize_symtab |
#define bfd_elf32_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound |
#define bfd_elf32_make_empty_symbol _bfd_elf_make_empty_symbol |
109,6 → 114,12 |
#ifndef elf_backend_default_execstack |
#define elf_backend_default_execstack 1 |
#endif |
#ifndef elf_backend_caches_rawsize |
#define elf_backend_caches_rawsize 0 |
#endif |
#ifndef elf_backend_extern_protected_data |
#define elf_backend_extern_protected_data 0 |
#endif |
#ifndef elf_backend_stack_align |
#define elf_backend_stack_align 16 |
#endif |
236,9 → 247,6 |
#ifndef bfd_elf32_bfd_link_hash_table_create |
#define bfd_elf32_bfd_link_hash_table_create _bfd_elf_link_hash_table_create |
#endif |
#ifndef bfd_elf32_bfd_link_hash_table_free |
#define bfd_elf32_bfd_link_hash_table_free _bfd_elf_link_hash_table_free |
#endif |
#ifndef bfd_elf32_bfd_link_add_symbols |
#define bfd_elf32_bfd_link_add_symbols bfd_elf_link_add_symbols |
#endif |
255,9 → 263,6 |
#define bfd_elf32_bfd_link_hash_table_create \ |
_bfd_generic_link_hash_table_create |
#endif |
#ifndef bfd_elf32_bfd_link_hash_table_free |
#define bfd_elf32_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
#endif |
#ifndef bfd_elf32_bfd_link_add_symbols |
#define bfd_elf32_bfd_link_add_symbols _bfd_generic_link_add_symbols |
#endif |
498,7 → 503,7 |
#define elf_backend_static_tls_alignment 1 |
#endif |
#ifndef elf_backend_post_process_headers |
#define elf_backend_post_process_headers NULL |
#define elf_backend_post_process_headers _bfd_elf_post_process_headers |
#endif |
#ifndef elf_backend_print_symbol_all |
#define elf_backend_print_symbol_all NULL |
533,6 → 538,9 |
#ifndef elf_backend_count_relocs |
#define elf_backend_count_relocs NULL |
#endif |
#ifndef elf_backend_sort_relocs_p |
#define elf_backend_sort_relocs_p NULL |
#endif |
#ifndef elf_backend_grok_prstatus |
#define elf_backend_grok_prstatus NULL |
#endif |
664,6 → 672,18 |
#define elf_backend_maybe_function_sym _bfd_elf_maybe_function_sym |
#endif |
#ifndef elf_backend_get_reloc_section |
#define elf_backend_get_reloc_section _bfd_elf_get_reloc_section |
#endif |
#ifndef elf_backend_compact_eh_encoding |
#define elf_backend_compact_eh_encoding NULL |
#endif |
#ifndef elf_backend_cant_unwind_opcode |
#define elf_backend_cant_unwind_opcode 0 |
#endif |
#ifndef elf_match_priority |
#define elf_match_priority \ |
(ELF_ARCH == bfd_arch_unknown ? 2 : ELF_OSABI == ELFOSABI_NONE ? 1 : 0) |
735,6 → 755,7 |
elf_backend_ignore_undef_symbol, |
elf_backend_emit_relocs, |
elf_backend_count_relocs, |
elf_backend_sort_relocs_p, |
elf_backend_grok_prstatus, |
elf_backend_grok_psinfo, |
elf_backend_write_core_note, |
760,6 → 781,7 |
elf_backend_hash_symbol, |
elf_backend_is_function_type, |
elf_backend_maybe_function_sym, |
elf_backend_get_reloc_section, |
elf_backend_link_order_error_handler, |
elf_backend_relplt_name, |
ELF_MACHINE_ALT1, |
774,6 → 796,8 |
elf_backend_obj_attrs_section_type, |
elf_backend_obj_attrs_order, |
elf_backend_obj_attrs_handle_unknown, |
elf_backend_compact_eh_encoding, |
elf_backend_cant_unwind_opcode, |
elf_backend_static_tls_alignment, |
elf_backend_stack_align, |
elf_backend_collect, |
794,7 → 818,9 |
elf_backend_want_got_sym, |
elf_backend_want_dynbss, |
elf_backend_want_p_paddr_set_to_zero, |
elf_backend_default_execstack |
elf_backend_default_execstack, |
elf_backend_caches_rawsize, |
elf_backend_extern_protected_data |
}; |
/* Forward declaration for use when initialising alternative_target field. */ |
819,7 → 845,8 |
/* object_flags: mask of all file flags */ |
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
| DYNAMIC | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS), |
| DYNAMIC | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS |
| BFD_COMPRESS_GABI), |
/* section_flags: mask of all section flags */ |
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
917,7 → 944,8 |
/* object_flags: mask of all file flags */ |
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
| DYNAMIC | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS), |
| DYNAMIC | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS |
| BFD_COMPRESS_GABI), |
/* section_flags: mask of all section flags */ |
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
/contrib/toolchain/binutils/bfd/elf32.c |
---|
1,6 → 1,5 |
/* ELF 32-bit executable support for BFD. |
Copyright 1993, 2001, 2004, 2005, 2006, 2007, 2008, 2009 |
Free Software Foundation, Inc. |
Copyright (C) 1993-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
/contrib/toolchain/binutils/bfd/elf64-target.h |
---|
1,7 → 1,5 |
/* Target definitions for 64-bit ELF |
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 |
Free Software Foundation, Inc. |
Copyright (C) 1993-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
51,6 → 49,9 |
#ifndef bfd_elf64_find_nearest_line |
#define bfd_elf64_find_nearest_line _bfd_elf_find_nearest_line |
#endif |
#ifndef bfd_elf64_find_line |
#define bfd_elf64_find_line _bfd_elf_find_line |
#endif |
#ifndef bfd_elf64_find_inliner_info |
#define bfd_elf64_find_inliner_info _bfd_elf_find_inliner_info |
#endif |
65,6 → 66,10 |
#ifndef bfd_elf64_get_symbol_info |
#define bfd_elf64_get_symbol_info _bfd_elf_get_symbol_info |
#endif |
#ifndef bfd_elf64_get_symbol_version_string |
#define bfd_elf64_get_symbol_version_string \ |
_bfd_elf_get_symbol_version_string |
#endif |
#define bfd_elf64_canonicalize_symtab _bfd_elf_canonicalize_symtab |
#define bfd_elf64_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound |
#define bfd_elf64_make_empty_symbol _bfd_elf_make_empty_symbol |
109,6 → 114,12 |
#ifndef elf_backend_default_execstack |
#define elf_backend_default_execstack 1 |
#endif |
#ifndef elf_backend_caches_rawsize |
#define elf_backend_caches_rawsize 0 |
#endif |
#ifndef elf_backend_extern_protected_data |
#define elf_backend_extern_protected_data 0 |
#endif |
#ifndef elf_backend_stack_align |
#define elf_backend_stack_align 16 |
#endif |
236,9 → 247,6 |
#ifndef bfd_elf64_bfd_link_hash_table_create |
#define bfd_elf64_bfd_link_hash_table_create _bfd_elf_link_hash_table_create |
#endif |
#ifndef bfd_elf64_bfd_link_hash_table_free |
#define bfd_elf64_bfd_link_hash_table_free _bfd_elf_link_hash_table_free |
#endif |
#ifndef bfd_elf64_bfd_link_add_symbols |
#define bfd_elf64_bfd_link_add_symbols bfd_elf_link_add_symbols |
#endif |
255,9 → 263,6 |
#define bfd_elf64_bfd_link_hash_table_create \ |
_bfd_generic_link_hash_table_create |
#endif |
#ifndef bfd_elf64_bfd_link_hash_table_free |
#define bfd_elf64_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
#endif |
#ifndef bfd_elf64_bfd_link_add_symbols |
#define bfd_elf64_bfd_link_add_symbols _bfd_generic_link_add_symbols |
#endif |
498,7 → 503,7 |
#define elf_backend_static_tls_alignment 1 |
#endif |
#ifndef elf_backend_post_process_headers |
#define elf_backend_post_process_headers NULL |
#define elf_backend_post_process_headers _bfd_elf_post_process_headers |
#endif |
#ifndef elf_backend_print_symbol_all |
#define elf_backend_print_symbol_all NULL |
533,6 → 538,9 |
#ifndef elf_backend_count_relocs |
#define elf_backend_count_relocs NULL |
#endif |
#ifndef elf_backend_sort_relocs_p |
#define elf_backend_sort_relocs_p NULL |
#endif |
#ifndef elf_backend_grok_prstatus |
#define elf_backend_grok_prstatus NULL |
#endif |
664,6 → 672,18 |
#define elf_backend_maybe_function_sym _bfd_elf_maybe_function_sym |
#endif |
#ifndef elf_backend_get_reloc_section |
#define elf_backend_get_reloc_section _bfd_elf_get_reloc_section |
#endif |
#ifndef elf_backend_compact_eh_encoding |
#define elf_backend_compact_eh_encoding NULL |
#endif |
#ifndef elf_backend_cant_unwind_opcode |
#define elf_backend_cant_unwind_opcode 0 |
#endif |
#ifndef elf_match_priority |
#define elf_match_priority \ |
(ELF_ARCH == bfd_arch_unknown ? 2 : ELF_OSABI == ELFOSABI_NONE ? 1 : 0) |
735,6 → 755,7 |
elf_backend_ignore_undef_symbol, |
elf_backend_emit_relocs, |
elf_backend_count_relocs, |
elf_backend_sort_relocs_p, |
elf_backend_grok_prstatus, |
elf_backend_grok_psinfo, |
elf_backend_write_core_note, |
760,6 → 781,7 |
elf_backend_hash_symbol, |
elf_backend_is_function_type, |
elf_backend_maybe_function_sym, |
elf_backend_get_reloc_section, |
elf_backend_link_order_error_handler, |
elf_backend_relplt_name, |
ELF_MACHINE_ALT1, |
774,6 → 796,8 |
elf_backend_obj_attrs_section_type, |
elf_backend_obj_attrs_order, |
elf_backend_obj_attrs_handle_unknown, |
elf_backend_compact_eh_encoding, |
elf_backend_cant_unwind_opcode, |
elf_backend_static_tls_alignment, |
elf_backend_stack_align, |
elf_backend_collect, |
794,7 → 818,9 |
elf_backend_want_got_sym, |
elf_backend_want_dynbss, |
elf_backend_want_p_paddr_set_to_zero, |
elf_backend_default_execstack |
elf_backend_default_execstack, |
elf_backend_caches_rawsize, |
elf_backend_extern_protected_data |
}; |
/* Forward declaration for use when initialising alternative_target field. */ |
819,7 → 845,8 |
/* object_flags: mask of all file flags */ |
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
| DYNAMIC | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS), |
| DYNAMIC | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS |
| BFD_COMPRESS_GABI), |
/* section_flags: mask of all section flags */ |
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
917,7 → 944,8 |
/* object_flags: mask of all file flags */ |
(HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
| DYNAMIC | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS), |
| DYNAMIC | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS |
| BFD_COMPRESS_GABI), |
/* section_flags: mask of all section flags */ |
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
/contrib/toolchain/binutils/bfd/elfcode.h |
---|
1,7 → 1,5 |
/* ELF executable support for BFD. |
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, |
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 |
Free Software Foundation, Inc. |
Copyright (C) 1991-2015 Free Software Foundation, Inc. |
Written by Fred Fish @ Cygnus Support, from information published |
in "UNIX System V Release 4, Programmers Guide: ANSI C and |
73,6 → 71,7 |
#include "bfdlink.h" |
#include "libbfd.h" |
#include "elf-bfd.h" |
#include "libiberty.h" |
/* Renaming structures, typedefs, macros and functions to be size-specific. */ |
#define Elf_External_Ehdr NAME(Elf,External_Ehdr) |
606,13 → 605,10 |
if (i_ehdrp->e_shoff != 0) |
{ |
bfd_signed_vma where = i_ehdrp->e_shoff; |
file_ptr where = (file_ptr) i_ehdrp->e_shoff; |
if (where != (file_ptr) where) |
goto got_wrong_format_error; |
/* Seek to the section header table in the file. */ |
if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0) |
if (bfd_seek (abfd, where, SEEK_SET) != 0) |
goto got_no_match; |
/* Read the first section header at index 0, and convert to internal |
658,12 → 654,10 |
goto got_wrong_format_error; |
where += (i_ehdrp->e_shnum - 1) * sizeof (x_shdr); |
if (where != (file_ptr) where) |
goto got_wrong_format_error; |
if ((bfd_size_type) where <= i_ehdrp->e_shoff) |
goto got_wrong_format_error; |
if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0) |
if (bfd_seek (abfd, where, SEEK_SET) != 0) |
goto got_no_match; |
if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr)) |
goto got_no_match; |
670,7 → 664,7 |
/* Back to where we were. */ |
where = i_ehdrp->e_shoff + sizeof (x_shdr); |
if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0) |
if (bfd_seek (abfd, where, SEEK_SET) != 0) |
goto got_no_match; |
} |
} |
682,6 → 676,10 |
Elf_Internal_Shdr *shdrp; |
unsigned int num_sec; |
#ifndef BFD64 |
if (i_ehdrp->e_shnum > ((bfd_size_type) -1) / sizeof (*i_shdrp)) |
goto got_wrong_format_error; |
#endif |
amt = sizeof (*i_shdrp) * i_ehdrp->e_shnum; |
i_shdrp = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt); |
if (!i_shdrp) |
713,7 → 711,7 |
switch (ebd->elf_machine_code) |
{ |
case EM_386: |
case EM_486: |
case EM_IAMCU: |
case EM_X86_64: |
case EM_OLD_SPARCV9: |
case EM_SPARC32PLUS: |
772,7 → 770,11 |
Elf_Internal_Phdr *i_phdr; |
unsigned int i; |
amt = i_ehdrp->e_phnum * sizeof (Elf_Internal_Phdr); |
#ifndef BFD64 |
if (i_ehdrp->e_phnum > ((bfd_size_type) -1) / sizeof (*i_phdr)) |
goto got_wrong_format_error; |
#endif |
amt = i_ehdrp->e_phnum * sizeof (*i_phdr); |
elf_tdata (abfd)->phdr = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt); |
if (elf_tdata (abfd)->phdr == NULL) |
goto got_no_match; |
1215,10 → 1217,9 |
for (isym = isymbuf + 1, sym = symbase; isym < isymend; isym++, sym++) |
{ |
memcpy (&sym->internal_elf_sym, isym, sizeof (Elf_Internal_Sym)); |
sym->symbol.the_bfd = abfd; |
sym->symbol.name = bfd_elf_sym_name (abfd, hdr, isym, NULL); |
sym->symbol.value = isym->st_value; |
if (isym->st_shndx == SHN_UNDEF) |
1502,7 → 1503,9 |
rel_hdr2 = d->rela.hdr; |
reloc_count2 = rel_hdr2 ? NUM_SHDR_ENTRIES (rel_hdr2) : 0; |
BFD_ASSERT (asect->reloc_count == reloc_count + reloc_count2); |
/* PR 17512: file: 0b4f81b7. */ |
if (asect->reloc_count != reloc_count + reloc_count2) |
return FALSE; |
BFD_ASSERT ((rel_hdr && asect->rel_filepos == rel_hdr->sh_offset) |
|| (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset)); |
1588,22 → 1591,25 |
#endif |
/* Create a new BFD as if by bfd_openr. Rather than opening a file, |
reconstruct an ELF file by reading the segments out of remote memory |
based on the ELF file header at EHDR_VMA and the ELF program headers it |
points to. If not null, *LOADBASEP is filled in with the difference |
between the VMAs from which the segments were read, and the VMAs the |
file headers (and hence BFD's idea of each section's VMA) put them at. |
reconstruct an ELF file by reading the segments out of remote |
memory based on the ELF file header at EHDR_VMA and the ELF program |
headers it points to. If non-zero, SIZE is the known extent of the |
object. If not null, *LOADBASEP is filled in with the difference |
between the VMAs from which the segments were read, and the VMAs |
the file headers (and hence BFD's idea of each section's VMA) put |
them at. |
The function TARGET_READ_MEMORY is called to copy LEN bytes from the |
remote memory at target address VMA into the local buffer at MYADDR; it |
should return zero on success or an `errno' code on failure. TEMPL must |
be a BFD for a target with the word size and byte order found in the |
remote memory. */ |
The function TARGET_READ_MEMORY is called to copy LEN bytes from |
the remote memory at target address VMA into the local buffer at |
MYADDR; it should return zero on success or an `errno' code on |
failure. TEMPL must be a BFD for a target with the word size and |
byte order found in the remote memory. */ |
bfd * |
NAME(_bfd_elf,bfd_from_remote_memory) |
(bfd *templ, |
bfd_vma ehdr_vma, |
bfd_size_type size, |
bfd_vma *loadbasep, |
int (*target_read_memory) (bfd_vma, bfd_byte *, bfd_size_type)) |
{ |
1610,15 → 1616,15 |
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */ |
Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */ |
Elf_External_Phdr *x_phdrs; |
Elf_Internal_Phdr *i_phdrs, *last_phdr; |
Elf_Internal_Phdr *i_phdrs, *last_phdr, *first_phdr; |
bfd *nbfd; |
struct bfd_in_memory *bim; |
int contents_size; |
bfd_byte *contents; |
int err; |
unsigned int i; |
bfd_vma high_offset; |
bfd_vma shdr_end; |
bfd_vma loadbase; |
bfd_boolean loadbase_set; |
/* Read in the ELF header in external format. */ |
err = target_read_memory (ehdr_vma, (bfd_byte *) &x_ehdr, sizeof x_ehdr); |
1678,10 → 1684,7 |
x_phdrs = (Elf_External_Phdr *) |
bfd_malloc (i_ehdr.e_phnum * (sizeof *x_phdrs + sizeof *i_phdrs)); |
if (x_phdrs == NULL) |
{ |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
} |
err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (bfd_byte *) x_phdrs, |
i_ehdr.e_phnum * sizeof x_phdrs[0]); |
if (err) |
1693,34 → 1696,44 |
} |
i_phdrs = (Elf_Internal_Phdr *) &x_phdrs[i_ehdr.e_phnum]; |
contents_size = 0; |
high_offset = 0; |
loadbase = 0; |
first_phdr = NULL; |
last_phdr = NULL; |
loadbase = ehdr_vma; |
loadbase_set = FALSE; |
for (i = 0; i < i_ehdr.e_phnum; ++i) |
{ |
elf_swap_phdr_in (templ, &x_phdrs[i], &i_phdrs[i]); |
if (i_phdrs[i].p_type == PT_LOAD) |
{ |
bfd_vma segment_end; |
segment_end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz |
+ i_phdrs[i].p_align - 1) & -i_phdrs[i].p_align; |
if (segment_end > (bfd_vma) contents_size) |
contents_size = segment_end; |
bfd_vma segment_end = i_phdrs[i].p_offset + i_phdrs[i].p_filesz; |
/* LOADADDR is the `Base address' from the gELF specification: |
`lowest p_vaddr value for a PT_LOAD segment' is P_VADDR from the |
first PT_LOAD as PT_LOADs are ordered by P_VADDR. */ |
if (!loadbase_set && (i_phdrs[i].p_offset & -i_phdrs[i].p_align) == 0) |
if (segment_end > high_offset) |
{ |
loadbase = ehdr_vma - (i_phdrs[i].p_vaddr & -i_phdrs[i].p_align); |
loadbase_set = TRUE; |
high_offset = segment_end; |
last_phdr = &i_phdrs[i]; |
} |
last_phdr = &i_phdrs[i]; |
/* If this program header covers offset zero, where the file |
header sits, then we can figure out the loadbase. */ |
if (first_phdr == NULL) |
{ |
bfd_vma p_offset = i_phdrs[i].p_offset; |
bfd_vma p_vaddr = i_phdrs[i].p_vaddr; |
if (i_phdrs[i].p_align > 1) |
{ |
p_offset &= -i_phdrs[i].p_align; |
p_vaddr &= -i_phdrs[i].p_align; |
} |
if (p_offset == 0) |
{ |
loadbase = ehdr_vma - p_vaddr; |
first_phdr = &i_phdrs[i]; |
} |
if (last_phdr == NULL) |
} |
} |
} |
if (high_offset == 0) |
{ |
/* There were no PT_LOAD segments, so we don't have anything to read. */ |
free (x_phdrs); |
1728,27 → 1741,42 |
return NULL; |
} |
/* Trim the last segment so we don't bother with zeros in the last page |
that are off the end of the file. However, if the extra bit in that |
page includes the section headers, keep them. */ |
if ((bfd_vma) contents_size > last_phdr->p_offset + last_phdr->p_filesz |
&& (bfd_vma) contents_size >= (i_ehdr.e_shoff |
+ i_ehdr.e_shnum * i_ehdr.e_shentsize)) |
shdr_end = 0; |
if (i_ehdr.e_shoff != 0 && i_ehdr.e_shnum != 0 && i_ehdr.e_shentsize != 0) |
{ |
contents_size = last_phdr->p_offset + last_phdr->p_filesz; |
if ((bfd_vma) contents_size < (i_ehdr.e_shoff |
+ i_ehdr.e_shnum * i_ehdr.e_shentsize)) |
contents_size = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize; |
shdr_end = i_ehdr.e_shoff + i_ehdr.e_shnum * i_ehdr.e_shentsize; |
if (last_phdr->p_filesz != last_phdr->p_memsz) |
{ |
/* If the last PT_LOAD header has a bss area then ld.so will |
have cleared anything past p_filesz, zapping the section |
headers. */ |
} |
else if (size >= shdr_end) |
high_offset = size; |
else |
contents_size = last_phdr->p_offset + last_phdr->p_filesz; |
{ |
bfd_vma page_size = get_elf_backend_data (templ)->minpagesize; |
bfd_vma segment_end = last_phdr->p_offset + last_phdr->p_filesz; |
/* Assume we loaded full pages, allowing us to sometimes see |
section headers. */ |
if (page_size > 1 && shdr_end > segment_end) |
{ |
bfd_vma page_end = (segment_end + page_size - 1) & -page_size; |
if (page_end >= shdr_end) |
/* Whee, section headers covered. */ |
high_offset = shdr_end; |
} |
} |
} |
/* Now we know the size of the whole image we want read in. */ |
contents = (bfd_byte *) bfd_zmalloc (contents_size); |
contents = (bfd_byte *) bfd_zmalloc (high_offset); |
if (contents == NULL) |
{ |
free (x_phdrs); |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
} |
1755,13 → 1783,22 |
for (i = 0; i < i_ehdr.e_phnum; ++i) |
if (i_phdrs[i].p_type == PT_LOAD) |
{ |
bfd_vma start = i_phdrs[i].p_offset & -i_phdrs[i].p_align; |
bfd_vma end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz |
+ i_phdrs[i].p_align - 1) & -i_phdrs[i].p_align; |
if (end > (bfd_vma) contents_size) |
end = contents_size; |
err = target_read_memory ((loadbase + i_phdrs[i].p_vaddr) |
& -i_phdrs[i].p_align, |
bfd_vma start = i_phdrs[i].p_offset; |
bfd_vma end = start + i_phdrs[i].p_filesz; |
bfd_vma vaddr = i_phdrs[i].p_vaddr; |
/* Extend the beginning of the first pt_load to cover file |
header and program headers, if we proved earlier that its |
aligned offset is 0. */ |
if (first_phdr == &i_phdrs[i]) |
{ |
vaddr -= start; |
start = 0; |
} |
/* Extend the end of the last pt_load to cover section headers. */ |
if (last_phdr == &i_phdrs[i]) |
end = high_offset; |
err = target_read_memory (loadbase + vaddr, |
contents + start, end - start); |
if (err) |
{ |
1776,8 → 1813,7 |
/* If the segments visible in memory didn't include the section headers, |
then clear them from the file header. */ |
if ((bfd_vma) contents_size < (i_ehdr.e_shoff |
+ i_ehdr.e_shnum * i_ehdr.e_shentsize)) |
if (high_offset < shdr_end) |
{ |
memset (&x_ehdr.e_shoff, 0, sizeof x_ehdr.e_shoff); |
memset (&x_ehdr.e_shnum, 0, sizeof x_ehdr.e_shnum); |
1793,7 → 1829,6 |
if (bim == NULL) |
{ |
free (contents); |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
} |
nbfd = _bfd_new_bfd (); |
1801,12 → 1836,11 |
{ |
free (bim); |
free (contents); |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
} |
nbfd->filename = "<in-memory>"; |
nbfd->filename = xstrdup ("<in-memory>"); |
nbfd->xvec = templ->xvec; |
bim->size = contents_size; |
bim->size = high_offset; |
bim->buffer = contents; |
nbfd->iostream = bim; |
nbfd->flags = BFD_IN_MEMORY; |
/contrib/toolchain/binutils/bfd/elfcore.h |
---|
1,6 → 1,5 |
/* ELF core file support for BFD. |
Copyright 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007, |
2008, 2010 Free Software Foundation, Inc. |
Copyright (C) 1995-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
189,13 → 188,10 |
{ |
Elf_External_Shdr x_shdr; |
Elf_Internal_Shdr i_shdr; |
bfd_signed_vma where = i_ehdrp->e_shoff; |
file_ptr where = (file_ptr) i_ehdrp->e_shoff; |
if (where != (file_ptr) where) |
goto wrong; |
/* Seek to the section header table in the file. */ |
if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0) |
if (bfd_seek (abfd, where, SEEK_SET) != 0) |
goto fail; |
/* Read the first section header at index 0, and convert to internal |
218,7 → 214,7 |
{ |
Elf_External_Phdr x_phdr; |
Elf_Internal_Phdr i_phdr; |
bfd_signed_vma where; |
file_ptr where; |
/* Check that we don't have a totally silly number of |
program headers. */ |
226,13 → 222,11 |
|| i_ehdrp->e_phnum > (unsigned int) -1 / sizeof (i_phdr)) |
goto wrong; |
where = i_ehdrp->e_phoff + (i_ehdrp->e_phnum - 1) * sizeof (x_phdr); |
if (where != (file_ptr) where) |
goto wrong; |
where = (file_ptr)(i_ehdrp->e_phoff + (i_ehdrp->e_phnum - 1) * sizeof (x_phdr)); |
if ((bfd_size_type) where <= i_ehdrp->e_phoff) |
goto wrong; |
if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0) |
if (bfd_seek (abfd, where, SEEK_SET) != 0) |
goto fail; |
if (bfd_bread (&x_phdr, sizeof (x_phdr), abfd) != sizeof (x_phdr)) |
goto fail; |
/contrib/toolchain/binutils/bfd/elflink.c |
---|
1,5 → 1,5 |
/* ELF linking support for BFD. |
Copyright 1995-2013 Free Software Foundation, Inc. |
Copyright (C) 1995-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
20,6 → 20,7 |
#include "sysdep.h" |
#include "bfd.h" |
#include "bfd_stdint.h" |
#include "bfdlink.h" |
#include "libbfd.h" |
#define ARCH_SIZE 0 |
53,6 → 54,47 |
static bfd_boolean _bfd_elf_fix_symbol_flags |
(struct elf_link_hash_entry *, struct elf_info_failed *); |
asection * |
_bfd_elf_section_for_symbol (struct elf_reloc_cookie *cookie, |
unsigned long r_symndx, |
bfd_boolean discard) |
{ |
if (r_symndx >= cookie->locsymcount |
|| ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL) |
{ |
struct elf_link_hash_entry *h; |
h = cookie->sym_hashes[r_symndx - cookie->extsymoff]; |
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; |
if ((h->root.type == bfd_link_hash_defined |
|| h->root.type == bfd_link_hash_defweak) |
&& discarded_section (h->root.u.def.section)) |
return h->root.u.def.section; |
else |
return NULL; |
} |
else |
{ |
/* It's not a relocation against a global symbol, |
but it could be a relocation against a local |
symbol for a discarded section. */ |
asection *isec; |
Elf_Internal_Sym *isym; |
/* Need to: get the symbol; get the section. */ |
isym = &cookie->locsyms[r_symndx]; |
isec = bfd_section_from_elf_index (cookie->abfd, isym->st_shndx); |
if (isec != NULL |
&& discard ? discarded_section (isec) : 1) |
return isec; |
} |
return NULL; |
} |
/* Define a symbol in a dynamic linkage section. */ |
struct elf_link_hash_entry * |
76,19 → 118,19 |
} |
bh = &h->root; |
bed = get_elf_backend_data (abfd); |
if (!_bfd_generic_link_add_one_symbol (info, abfd, name, BSF_GLOBAL, |
sec, 0, NULL, FALSE, |
get_elf_backend_data (abfd)->collect, |
sec, 0, NULL, FALSE, bed->collect, |
&bh)) |
return NULL; |
h = (struct elf_link_hash_entry *) bh; |
h->def_regular = 1; |
h->non_elf = 0; |
h->root.linker_def = 1; |
h->type = STT_OBJECT; |
if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL) |
h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN; |
bed = get_elf_backend_data (abfd); |
(*bed->elf_backend_hide_symbol) (info, h, TRUE); |
return h; |
} |
204,7 → 246,7 |
/* A dynamically linked executable has a .interp section, but a |
shared library does not. */ |
if (info->executable) |
if (bfd_link_executable (info) && !info->nointerp) |
{ |
s = bfd_make_section_anyway_with_flags (abfd, ".interp", |
flags | SEC_READONLY); |
237,6 → 279,7 |
if (s == NULL |
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) |
return FALSE; |
elf_hash_table (info)->dynsym = s; |
s = bfd_make_section_anyway_with_flags (abfd, ".dynstr", |
flags | SEC_READONLY); |
376,7 → 419,7 |
be needed, we can discard it later. We will never need this |
section when generating a shared object, since they do not use |
copy relocs. */ |
if (! info->shared) |
if (! bfd_link_pic (info)) |
{ |
s = bfd_make_section_anyway_with_flags (abfd, |
(bed->rela_plts_and_copies_p |
477,7 → 520,7 |
struct bfd_elf_dynamic_list *d = info->dynamic_list; |
/* It may be called more than once on the same H. */ |
if(h->dynamic || info->relocatable) |
if(h->dynamic || bfd_link_relocatable (info)) |
return; |
if ((info->dynamic_data |
581,7 → 624,7 |
/* STV_HIDDEN and STV_INTERNAL symbols must be STB_LOCAL in shared objects |
and executables. */ |
if (!info->relocatable |
if (!bfd_link_relocatable (info) |
&& h->dynindx != -1 |
&& (ELF_ST_VISIBILITY (h->other) == STV_HIDDEN |
|| ELF_ST_VISIBILITY (h->other) == STV_INTERNAL)) |
589,8 → 632,9 |
if ((h->def_dynamic |
|| h->ref_dynamic |
|| info->shared |
|| (info->executable && elf_hash_table (info)->is_relocatable_executable)) |
|| bfd_link_pic (info) |
|| (bfd_link_pde (info) |
&& elf_hash_table (info)->is_relocatable_executable)) |
&& h->dynindx == -1) |
{ |
if (! bfd_elf_link_record_dynamic_symbol (info, h)) |
760,6 → 804,7 |
asection *p) |
{ |
struct elf_link_hash_table *htab; |
asection *ip; |
switch (elf_section_data (p)->this_hdr.sh_type) |
{ |
775,18 → 820,9 |
if (htab->text_index_section != NULL) |
return p != htab->text_index_section && p != htab->data_index_section; |
if (strcmp (p->name, ".got") == 0 |
|| strcmp (p->name, ".got.plt") == 0 |
|| strcmp (p->name, ".plt") == 0) |
{ |
asection *ip; |
if (htab->dynobj != NULL |
return (htab->dynobj != NULL |
&& (ip = bfd_get_linker_section (htab->dynobj, p->name)) != NULL |
&& ip->output_section == p) |
return TRUE; |
} |
return FALSE; |
&& ip->output_section == p); |
/* There shouldn't be section relative relocations |
against any other section. */ |
808,7 → 844,8 |
{ |
unsigned long dynsymcount = 0; |
if (info->shared || elf_hash_table (info)->is_relocatable_executable) |
if (bfd_link_pic (info) |
|| elf_hash_table (info)->is_relocatable_executable) |
{ |
const struct elf_backend_data *bed = get_elf_backend_data (output_bfd); |
asection *p; |
851,48 → 888,31 |
static void |
elf_merge_st_other (bfd *abfd, struct elf_link_hash_entry *h, |
Elf_Internal_Sym *isym, bfd_boolean definition, |
bfd_boolean dynamic) |
const Elf_Internal_Sym *isym, asection *sec, |
bfd_boolean definition, bfd_boolean dynamic) |
{ |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
/* If st_other has a processor-specific meaning, specific |
code might be needed here. We never merge the visibility |
attribute with the one from a dynamic object. */ |
code might be needed here. */ |
if (bed->elf_backend_merge_symbol_attribute) |
(*bed->elf_backend_merge_symbol_attribute) (h, isym, definition, |
dynamic); |
/* If this symbol has default visibility and the user has requested |
we not re-export it, then mark it as hidden. */ |
if (definition |
&& !dynamic |
&& (abfd->no_export |
|| (abfd->my_archive && abfd->my_archive->no_export)) |
&& ELF_ST_VISIBILITY (isym->st_other) != STV_INTERNAL) |
isym->st_other = (STV_HIDDEN |
| (isym->st_other & ~ELF_ST_VISIBILITY (-1))); |
if (!dynamic && ELF_ST_VISIBILITY (isym->st_other) != 0) |
if (!dynamic) |
{ |
unsigned char hvis, symvis, other, nvis; |
unsigned symvis = ELF_ST_VISIBILITY (isym->st_other); |
unsigned hvis = ELF_ST_VISIBILITY (h->other); |
/* Only merge the visibility. Leave the remainder of the |
st_other field to elf_backend_merge_symbol_attribute. */ |
other = h->other & ~ELF_ST_VISIBILITY (-1); |
/* Combine visibilities, using the most constraining one. */ |
hvis = ELF_ST_VISIBILITY (h->other); |
symvis = ELF_ST_VISIBILITY (isym->st_other); |
if (! hvis) |
nvis = symvis; |
else if (! symvis) |
nvis = hvis; |
else |
nvis = hvis < symvis ? hvis : symvis; |
h->other = other | nvis; |
/* Keep the most constraining visibility. Leave the remainder |
of the st_other field to elf_backend_merge_symbol_attribute. */ |
if (symvis - 1 < hvis - 1) |
h->other = symvis | (h->other & ~ELF_ST_VISIBILITY (-1)); |
} |
else if (definition |
&& ELF_ST_VISIBILITY (isym->st_other) != STV_DEFAULT |
&& (sec->flags & SEC_READONLY) == 0) |
h->protected_def = 1; |
} |
/* This function is called when we want to merge a new symbol with an |
922,7 → 942,8 |
bfd_boolean *skip, |
bfd_boolean *override, |
bfd_boolean *type_change_ok, |
bfd_boolean *size_change_ok) |
bfd_boolean *size_change_ok, |
bfd_boolean *matched) |
{ |
asection *sec, *oldsec; |
struct elf_link_hash_entry *h; |
933,6 → 954,7 |
bfd_boolean newdyn, olddyn, olddef, newdef, newdyncommon, olddyncommon; |
bfd_boolean newweak, oldweak, newfunc, oldfunc; |
const struct elf_backend_data *bed; |
char *new_version; |
*skip = FALSE; |
*override = FALSE; |
951,6 → 973,30 |
bed = get_elf_backend_data (abfd); |
/* NEW_VERSION is the symbol version of the new symbol. */ |
if (h->versioned != unversioned) |
{ |
/* Symbol version is unknown or versioned. */ |
new_version = strrchr (name, ELF_VER_CHR); |
if (new_version) |
{ |
if (h->versioned == unknown) |
{ |
if (new_version > name && new_version[-1] != ELF_VER_CHR) |
h->versioned = versioned_hidden; |
else |
h->versioned = versioned; |
} |
new_version += 1; |
if (new_version[0] == '\0') |
new_version = NULL; |
} |
else |
h->versioned = unversioned; |
} |
else |
new_version = NULL; |
/* For merging, we only care about real symbols. But we need to make |
sure that indirect symbol dynamic flags are updated. */ |
hi = h; |
958,6 → 1004,44 |
|| h->root.type == bfd_link_hash_warning) |
h = (struct elf_link_hash_entry *) h->root.u.i.link; |
if (!*matched) |
{ |
if (hi == h || h->root.type == bfd_link_hash_new) |
*matched = TRUE; |
else |
{ |
/* OLD_HIDDEN is true if the existing symbol is only visible |
to the symbol with the same symbol version. NEW_HIDDEN is |
true if the new symbol is only visible to the symbol with |
the same symbol version. */ |
bfd_boolean old_hidden = h->versioned == versioned_hidden; |
bfd_boolean new_hidden = hi->versioned == versioned_hidden; |
if (!old_hidden && !new_hidden) |
/* The new symbol matches the existing symbol if both |
aren't hidden. */ |
*matched = TRUE; |
else |
{ |
/* OLD_VERSION is the symbol version of the existing |
symbol. */ |
char *old_version; |
if (h->versioned >= versioned) |
old_version = strrchr (h->root.root.string, |
ELF_VER_CHR) + 1; |
else |
old_version = NULL; |
/* The new symbol matches the existing symbol if they |
have the same symbol version. */ |
*matched = (old_version == new_version |
|| (old_version != NULL |
&& new_version != NULL |
&& strcmp (old_version, new_version) == 0)); |
} |
} |
} |
/* OLDBFD and OLDSEC are a BFD and an ASECTION associated with the |
existing symbol. */ |
1030,6 → 1114,8 |
} |
else |
{ |
/* Update the existing symbol only if they match. */ |
if (*matched) |
h->dynamic_def = 1; |
hi->dynamic_def = 1; |
} |
1087,32 → 1173,30 |
/* When we try to create a default indirect symbol from the dynamic |
definition with the default version, we skip it if its type and |
the type of existing regular definition mismatch. We only do it |
if the existing regular definition won't be dynamic. */ |
the type of existing regular definition mismatch. */ |
if (pold_alignment == NULL |
&& !info->shared |
&& !info->export_dynamic |
&& !h->ref_dynamic |
&& newdyn |
&& newdef |
&& !olddyn |
&& (olddef || h->root.type == bfd_link_hash_common) |
&& (((olddef || h->root.type == bfd_link_hash_common) |
&& ELF_ST_TYPE (sym->st_info) != h->type |
&& ELF_ST_TYPE (sym->st_info) != STT_NOTYPE |
&& h->type != STT_NOTYPE |
&& !(newfunc && oldfunc)) |
|| (olddef |
&& ((h->type == STT_GNU_IFUNC) |
!= (ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC))))) |
{ |
*skip = TRUE; |
return TRUE; |
} |
/* Plugin symbol type isn't currently set. Stop bogus errors. */ |
if (oldbfd != NULL && (oldbfd->flags & BFD_PLUGIN) != 0) |
*type_change_ok = TRUE; |
/* Check TLS symbol. We don't check undefined symbol introduced by |
"ld -u". */ |
else if (oldbfd != NULL |
/* Check TLS symbols. We don't check undefined symbols introduced |
by "ld -u" which have no type (and oldbfd NULL), and we don't |
check symbols from plugins because they also have no type. */ |
if (oldbfd != NULL |
&& (oldbfd->flags & BFD_PLUGIN) == 0 |
&& (abfd->flags & BFD_PLUGIN) == 0 |
&& ELF_ST_TYPE (sym->st_info) != h->type |
&& (ELF_ST_TYPE (sym->st_info) == STT_TLS || h->type == STT_TLS)) |
{ |
1437,12 → 1521,15 |
if (!(oldbfd != NULL |
&& (oldbfd->flags & BFD_PLUGIN) != 0 |
&& (abfd->flags & BFD_PLUGIN) == 0)) |
{ |
newdef = FALSE; |
*skip = TRUE; |
} |
/* Merge st_other. If the symbol already has a dynamic index, |
but visibility says it should not be visible, turn it into a |
local symbol. */ |
elf_merge_st_other (abfd, h, sym, newdef, newdyn); |
elf_merge_st_other (abfd, h, sym, sec, newdef, newdyn); |
if (h->dynindx != -1) |
switch (ELF_ST_VISIBILITY (h->other)) |
{ |
1600,14 → 1687,41 |
char *p; |
size_t len, shortlen; |
asection *tmp_sec; |
bfd_boolean matched; |
if (h->versioned == unversioned || h->versioned == versioned_hidden) |
return TRUE; |
/* If this symbol has a version, and it is the default version, we |
create an indirect symbol from the default name to the fully |
decorated name. This will cause external references which do not |
specify a version to be bound to this version of the symbol. */ |
p = strchr (name, ELF_VER_CHR); |
if (p == NULL || p[1] != ELF_VER_CHR) |
if (h->versioned == unknown) |
{ |
if (p == NULL) |
{ |
h->versioned = unversioned; |
return TRUE; |
} |
else |
{ |
if (p[1] != ELF_VER_CHR) |
{ |
h->versioned = versioned_hidden; |
return TRUE; |
} |
else |
h->versioned = versioned; |
} |
} |
else |
{ |
/* PR ld/19073: We may see an unversioned definition after the |
default version. */ |
if (p == NULL) |
return TRUE; |
} |
bed = get_elf_backend_data (abfd); |
collect = bed->collect; |
1626,10 → 1740,11 |
actually going to define an indirect symbol. */ |
type_change_ok = FALSE; |
size_change_ok = FALSE; |
matched = TRUE; |
tmp_sec = sec; |
if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &tmp_sec, &value, |
&hi, poldbfd, NULL, NULL, &skip, &override, |
&type_change_ok, &size_change_ok)) |
&type_change_ok, &size_change_ok, &matched)) |
return FALSE; |
if (skip) |
1637,13 → 1752,18 |
if (! override) |
{ |
/* Add the default symbol if not performing a relocatable link. */ |
if (! bfd_link_relocatable (info)) |
{ |
bh = &hi->root; |
if (! (_bfd_generic_link_add_one_symbol |
(info, abfd, shortname, BSF_INDIRECT, bfd_ind_section_ptr, |
(info, abfd, shortname, BSF_INDIRECT, |
bfd_ind_section_ptr, |
0, name, FALSE, collect, &bh))) |
return FALSE; |
hi = (struct elf_link_hash_entry *) bh; |
} |
} |
else |
{ |
/* In this case the symbol named SHORTNAME is overriding the |
1702,6 → 1822,12 |
ht = (struct elf_link_hash_entry *) hi->root.u.i.link; |
(*bed->elf_backend_copy_indirect_symbol) (info, ht, hi); |
/* A reference to the SHORTNAME symbol from a dynamic library |
will be satisfied by the versioned symbol at runtime. In |
effect, we have a reference to the versioned symbol. */ |
ht->ref_dynamic_nonweak |= hi->ref_dynamic_nonweak; |
hi->dynamic_def |= ht->dynamic_def; |
/* See if the new flags lead us to realize that the symbol must |
be dynamic. */ |
if (! *dynsym) |
1708,7 → 1834,7 |
{ |
if (! dynamic) |
{ |
if (! info->executable |
if (! bfd_link_executable (info) |
|| hi->def_dynamic |
|| hi->ref_dynamic) |
*dynsym = TRUE; |
1737,8 → 1863,8 |
size_change_ok = FALSE; |
tmp_sec = sec; |
if (!_bfd_elf_merge_symbol (abfd, info, shortname, sym, &tmp_sec, &value, |
&hi, NULL, NULL, NULL, &skip, &override, |
&type_change_ok, &size_change_ok)) |
&hi, poldbfd, NULL, NULL, &skip, &override, |
&type_change_ok, &size_change_ok, &matched)) |
return FALSE; |
if (skip) |
1771,6 → 1897,8 |
if (hi->root.type == bfd_link_hash_indirect) |
{ |
(*bed->elf_backend_copy_indirect_symbol) (info, h, hi); |
h->ref_dynamic_nonweak |= hi->ref_dynamic_nonweak; |
hi->dynamic_def |= h->dynamic_def; |
/* See if the new flags lead us to realize that the symbol |
must be dynamic. */ |
1778,7 → 1906,7 |
{ |
if (! dynamic) |
{ |
if (! info->executable |
if (! bfd_link_executable (info) |
|| hi->ref_dynamic) |
*dynsym = TRUE; |
} |
1844,7 → 1972,9 |
if (!h->def_dynamic |
|| h->def_regular |
|| h->dynindx == -1 |
|| h->verinfo.verdef == NULL) |
|| h->verinfo.verdef == NULL |
|| (elf_dyn_lib_class (h->verinfo.verdef->vd_bfd) |
& (DYN_AS_NEEDED | DYN_DT_NEEDED | DYN_NO_NEEDED))) |
return TRUE; |
/* See if we already know about this version. */ |
1944,26 → 2074,14 |
if (p != NULL && h->verinfo.vertree == NULL) |
{ |
struct bfd_elf_version_tree *t; |
bfd_boolean hidden; |
hidden = TRUE; |
/* There are two consecutive ELF_VER_CHR characters if this is |
not a hidden symbol. */ |
++p; |
if (*p == ELF_VER_CHR) |
{ |
hidden = FALSE; |
++p; |
} |
/* If there is no version string, we can just return out. */ |
if (*p == '\0') |
{ |
if (hidden) |
h->hidden = 1; |
return TRUE; |
} |
/* Look for the version. If we find it, it is no longer weak. */ |
for (t = sinfo->info->version_info; t != NULL; t = t->next) |
2011,7 → 2129,7 |
/* If we are building an application, we need to create a |
version node for this version. */ |
if (t == NULL && info->executable) |
if (t == NULL && bfd_link_executable (info)) |
{ |
struct bfd_elf_version_tree **pp; |
int version_index; |
2059,9 → 2177,6 |
sinfo->failed = TRUE; |
return FALSE; |
} |
if (hidden) |
h->hidden = 1; |
} |
/* If we don't have a version for this symbol, see if we can find |
2295,8 → 2410,8 |
{ |
struct elf_link_hash_entry **p; |
p = (struct elf_link_hash_entry **) |
bfd_zmalloc (reldata->count * sizeof (struct elf_link_hash_entry *)); |
p = ((struct elf_link_hash_entry **) |
bfd_zmalloc (reldata->count * sizeof (*p))); |
if (p == NULL) |
return FALSE; |
2376,7 → 2491,7 |
_bfd_elf_link_hash_fixup_symbol (struct bfd_link_info *info, |
struct elf_link_hash_entry *h) |
{ |
if (info->pie |
if (bfd_link_pie (info) |
&& h->dynindx == -1 |
&& h->root.type == bfd_link_hash_undefweak) |
return bfd_elf_link_record_dynamic_symbol (info, h); |
2479,7 → 2594,7 |
visibility. If the symbol has hidden or internal visibility, we |
will force it local. */ |
if (h->needs_plt |
&& eif->info->shared |
&& bfd_link_pic (eif->info) |
&& is_elf_hash_table (eif->info->hash) |
&& (SYMBOLIC_BIND (eif->info, h) |
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) |
2646,7 → 2761,8 |
DYNBSS. */ |
bfd_boolean |
_bfd_elf_adjust_dynamic_copy (struct elf_link_hash_entry *h, |
_bfd_elf_adjust_dynamic_copy (struct bfd_link_info *info, |
struct elf_link_hash_entry *h, |
asection *dynbss) |
{ |
unsigned int power_of_two; |
2685,6 → 2801,15 |
/* Increment the size of DYNBSS to make room for the symbol. */ |
dynbss->size += h->size; |
/* No error if extern_protected_data is true. */ |
if (h->protected_def |
&& (!info->extern_protected_data |
|| (info->extern_protected_data < 0 |
&& !get_elf_backend_data (dynbss->owner)->extern_protected_data))) |
info->callbacks->einfo |
(_("%P: copy reloc against protected `%T' is dangerous\n"), |
h->root.root.string); |
return TRUE; |
} |
2741,7 → 2866,8 |
/* Identify the cases where name binding rules say that a |
visible symbol resolves locally. */ |
binding_stays_local_p = info->executable || SYMBOLIC_BIND (info, h); |
binding_stays_local_p = (bfd_link_executable (info) |
|| SYMBOLIC_BIND (info, h)); |
switch (ELF_ST_VISIBILITY (h->other)) |
{ |
2826,7 → 2952,7 |
/* At this point, we know the symbol is defined and dynamic. In an |
executable it must resolve locally, likewise when building symbolic |
shared libraries. */ |
if (info->executable || SYMBOLIC_BIND (info, h)) |
if (bfd_link_executable (info) || SYMBOLIC_BIND (info, h)) |
return TRUE; |
/* Now deal with defined dynamic symbols in shared libraries. Ones |
2840,8 → 2966,12 |
bed = get_elf_backend_data (hash_table->dynobj); |
/* STV_PROTECTED non-function symbols are local. */ |
if (!bed->is_function_type (h->type)) |
/* If extern_protected_data is false, STV_PROTECTED non-function |
symbols are local. */ |
if ((!info->extern_protected_data |
|| (info->extern_protected_data < 0 |
&& !bed->extern_protected_data)) |
&& !bed->is_function_type (h->type)) |
return TRUE; |
/* Function pointer equality tests may require that STV_PROTECTED |
2940,14 → 3070,11 |
if (abfd == NULL) |
return FALSE; |
if (! bfd_check_format (abfd, bfd_object)) |
/* Return FALSE if the object has been claimed by plugin. */ |
if (abfd->plugin_format == bfd_plugin_yes) |
return FALSE; |
/* If we have already included the element containing this symbol in the |
link then we do not need to include it again. Just claim that any symbol |
it contains is not a definition, so that our caller will not decide to |
(re)include this element. */ |
if (abfd->archive_pass) |
if (! bfd_check_format (abfd, bfd_object)) |
return FALSE; |
/* Select the appropriate symbol table. */ |
3105,7 → 3232,8 |
on_needed_list (const char *soname, struct bfd_link_needed_list *needed) |
{ |
for (; needed != NULL; needed = needed->next) |
if (strcmp (soname, needed->name) == 0) |
if ((elf_dyn_lib_class (needed->by) & DYN_AS_NEEDED) == 0 |
&& strcmp (soname, needed->name) == 0) |
return TRUE; |
return FALSE; |
3126,7 → 3254,7 |
return vdiff > 0 ? 1 : -1; |
else |
{ |
long sdiff = h1->root.u.def.section->id - h2->root.u.def.section->id; |
int sdiff = h1->root.u.def.section->id - h2->root.u.def.section->id; |
if (sdiff != 0) |
return sdiff > 0 ? 1 : -1; |
} |
3318,7 → 3446,7 |
struct bfd_link_info *info, |
enum notice_asneeded_action act) |
{ |
return (*info->callbacks->notice) (info, NULL, ibfd, NULL, act, 0, NULL); |
return (*info->callbacks->notice) (info, NULL, NULL, ibfd, NULL, act, 0); |
} |
/* Add symbols from an ELF object file to the linker hash table. */ |
3357,6 → 3485,7 |
bfd_size_type old_dynstr_size = 0; |
size_t tabsize = 0; |
asection *s; |
bfd_boolean just_syms; |
htab = elf_hash_table (info); |
bed = get_elf_backend_data (abfd); |
3370,11 → 3499,11 |
/* You can't use -r against a dynamic object. Also, there's no |
hope of using a dynamic object which does not exactly match |
the format of the output file. */ |
if (info->relocatable |
if (bfd_link_relocatable (info) |
|| !is_elf_hash_table (htab) |
|| info->output_bfd->xvec != abfd->xvec) |
{ |
if (info->relocatable) |
if (bfd_link_relocatable (info)) |
bfd_set_error (bfd_error_invalid_operation); |
else |
bfd_set_error (bfd_error_wrong_format); |
3447,7 → 3576,7 |
FALSE, bed->collect, NULL))) |
goto error_return; |
if (!info->relocatable && info->executable) |
if (bfd_link_executable (info)) |
{ |
/* Clobber the section size so that the warning does |
not get copied into the output file. */ |
3460,6 → 3589,9 |
} |
} |
just_syms = ((s = abfd->sections) != NULL |
&& s->sec_info_type == SEC_INFO_TYPE_JUST_SYMS); |
add_needed = TRUE; |
if (! dynamic) |
{ |
3466,9 → 3598,11 |
/* If we are creating a shared library, create all the dynamic |
sections immediately. We need to attach them to something, |
so we attach them to this BFD, provided it is the right |
format. FIXME: If there are no input BFD's of the same |
format as the output, we can't make a shared library. */ |
if (info->shared |
format and is not from ld --just-symbols. FIXME: If there |
are no input BFD's of the same format as the output, we can't |
make a shared library. */ |
if (!just_syms |
&& bfd_link_pic (info) |
&& is_elf_hash_table (htab) |
&& info->output_bfd->xvec == abfd->xvec |
&& !htab->dynamic_sections_created) |
3488,8 → 3622,7 |
/* ld --just-symbols and dynamic objects don't mix very well. |
ld shouldn't allow it. */ |
if ((s = abfd->sections) != NULL |
&& s->sec_info_type == SEC_INFO_TYPE_JUST_SYMS) |
if (just_syms) |
abort (); |
/* If this dynamic lib was specified on the command line with |
3835,6 → 3968,7 |
bfd_boolean common; |
unsigned int old_alignment; |
bfd *old_bfd; |
bfd_boolean matched; |
override = FALSE; |
3920,7 → 4054,7 |
} |
else if (isym->st_shndx == SHN_COMMON |
&& ELF_ST_TYPE (isym->st_info) == STT_TLS |
&& !info->relocatable) |
&& !bfd_link_relocatable (info)) |
{ |
asection *tcomm = bfd_get_section_by_name (abfd, ".tcommon"); |
3969,6 → 4103,7 |
size_change_ok = FALSE; |
type_change_ok = bed->type_change_ok; |
old_weak = FALSE; |
matched = FALSE; |
old_alignment = 0; |
old_bfd = NULL; |
new_sec = sec; |
4086,16 → 4221,28 |
name = newname; |
} |
/* If this symbol has default visibility and the user has |
requested we not re-export it, then mark it as hidden. */ |
if (!bfd_is_und_section (sec) |
&& !dynamic |
&& abfd->no_export |
&& ELF_ST_VISIBILITY (isym->st_other) != STV_INTERNAL) |
isym->st_other = (STV_HIDDEN |
| (isym->st_other & ~ELF_ST_VISIBILITY (-1))); |
if (!_bfd_elf_merge_symbol (abfd, info, name, isym, &sec, &value, |
sym_hash, &old_bfd, &old_weak, |
&old_alignment, &skip, &override, |
&type_change_ok, &size_change_ok)) |
&type_change_ok, &size_change_ok, |
&matched)) |
goto error_free_vers; |
if (skip) |
continue; |
if (override) |
/* Override a definition only if the new symbol matches the |
existing one. */ |
if (override && matched) |
definition = FALSE; |
h = *sym_hash; |
4203,7 → 4350,7 |
/* If the indirect symbol has been forced local, don't |
make the real symbol dynamic. */ |
if ((h == hi || !hi->forced_local) |
&& (! info->executable |
&& (bfd_link_dll (info) |
|| h->def_dynamic |
|| h->ref_dynamic)) |
dynsym = TRUE; |
4352,10 → 4499,12 |
} |
/* Merge st_other field. */ |
elf_merge_st_other (abfd, h, isym, definition, dynamic); |
elf_merge_st_other (abfd, h, isym, sec, definition, dynamic); |
/* We don't want to make debug symbol dynamic. */ |
if (definition && (sec->flags & SEC_DEBUGGING) && !info->relocatable) |
if (definition |
&& (sec->flags & SEC_DEBUGGING) |
&& !bfd_link_relocatable (info)) |
dynsym = FALSE; |
/* Nor should we make plugin symbols dynamic. */ |
4379,8 → 4528,8 |
{ |
amt = ((isymend - isym + 1) |
* sizeof (struct elf_link_hash_entry *)); |
nondeflt_vers = |
(struct elf_link_hash_entry **) bfd_malloc (amt); |
nondeflt_vers |
= (struct elf_link_hash_entry **) bfd_malloc (amt); |
if (!nondeflt_vers) |
goto error_free_vers; |
} |
4427,6 → 4576,9 |
int ret; |
const char *soname = elf_dt_name (abfd); |
info->callbacks->minfo ("%!", soname, old_bfd, |
h->root.root.string); |
/* A symbol from a library loaded via DT_NEEDED of some |
other library is referenced by a regular object. |
Add a DT_NEEDED entry for it. Issue an error if |
4552,9 → 4704,10 |
old_tab = NULL; |
} |
/* Now that all the symbols from this input file are created, handle |
.symver foo, foo@BAR such that any relocs against foo become foo@BAR. */ |
if (nondeflt_vers != NULL) |
/* Now that all the symbols from this input file are created, if |
not performing a relocatable link, handle .symver foo, foo@BAR |
such that any relocs against foo become foo@BAR. */ |
if (!bfd_link_relocatable (info) && nondeflt_vers != NULL) |
{ |
bfd_size_type cnt, symidx; |
4684,7 → 4837,7 |
i = idx + 1; |
else |
{ |
long sdiff = slook->id - h->root.u.def.section->id; |
int sdiff = slook->id - h->root.u.def.section->id; |
if (sdiff < 0) |
j = idx; |
else if (sdiff > 0) |
4852,8 → 5005,7 |
/* Add this bfd to the loaded list. */ |
struct elf_link_loaded_list *n; |
n = (struct elf_link_loaded_list *) |
bfd_alloc (abfd, sizeof (struct elf_link_loaded_list)); |
n = (struct elf_link_loaded_list *) bfd_alloc (abfd, sizeof (*n)); |
if (n == NULL) |
goto error_return; |
n->abfd = abfd; |
4927,20 → 5079,8 |
} |
/* Add symbols from an ELF archive file to the linker hash table. We |
don't use _bfd_generic_link_add_archive_symbols because of a |
problem which arises on UnixWare. The UnixWare libc.so is an |
archive which includes an entry libc.so.1 which defines a bunch of |
symbols. The libc.so archive also includes a number of other |
object files, which also define symbols, some of which are the same |
as those defined in libc.so.1. Correct linking requires that we |
consider each object file in turn, and include it if it defines any |
symbols we need. _bfd_generic_link_add_archive_symbols does not do |
this; it looks through the list of undefined symbols, and includes |
any object file which defines them. When this algorithm is used on |
UnixWare, it winds up pulling in libc.so.1 early and defining a |
bunch of symbols. This means that some of the other objects in the |
archive are not included in the link, which is incorrect since they |
precede libc.so.1 in the archive. |
don't use _bfd_generic_link_add_archive_symbols because we need to |
handle versioned symbols. |
Fortunately, ELF archive handling is simpler than that done by |
_bfd_generic_link_add_archive_symbols, which has to allow for a.out |
4955,8 → 5095,7 |
elf_link_add_archive_symbols (bfd *abfd, struct bfd_link_info *info) |
{ |
symindex c; |
bfd_boolean *defined = NULL; |
bfd_boolean *included = NULL; |
unsigned char *included = NULL; |
carsym *symdefs; |
bfd_boolean loop; |
bfd_size_type amt; |
4980,11 → 5119,10 |
if (c == 0) |
return TRUE; |
amt = c; |
amt *= sizeof (bfd_boolean); |
defined = (bfd_boolean *) bfd_zmalloc (amt); |
included = (bfd_boolean *) bfd_zmalloc (amt); |
if (defined == NULL || included == NULL) |
goto error_return; |
amt *= sizeof (*included); |
included = (unsigned char *) bfd_zmalloc (amt); |
if (included == NULL) |
return FALSE; |
symdefs = bfd_ardata (abfd)->symdefs; |
bed = get_elf_backend_data (abfd); |
5009,7 → 5147,7 |
struct bfd_link_hash_entry *undefs_tail; |
symindex mark; |
if (defined[i] || included[i]) |
if (included[i]) |
continue; |
if (symdef->file_offset == last) |
{ |
5044,7 → 5182,8 |
else if (h->root.type != bfd_link_hash_undefined) |
{ |
if (h->root.type != bfd_link_hash_undefweak) |
defined[i] = TRUE; |
/* Symbol must be defined. Don't check it again. */ |
included[i] = TRUE; |
continue; |
} |
5056,16 → 5195,6 |
if (! bfd_check_format (element, bfd_object)) |
goto error_return; |
/* Doublecheck that we have not included this object |
already--it should be impossible, but there may be |
something wrong with the archive. */ |
if (element->archive_pass != 0) |
{ |
bfd_set_error (bfd_error_bad_value); |
goto error_return; |
} |
element->archive_pass = 1; |
undefs_tail = info->hash->undefs_tail; |
if (!(*info->callbacks |
5103,14 → 5232,11 |
} |
while (loop); |
free (defined); |
free (included); |
return TRUE; |
error_return: |
if (defined != NULL) |
free (defined); |
if (included != NULL) |
free (included); |
return FALSE; |
5148,7 → 5274,6 |
{ |
struct hash_codes_info *inf = (struct hash_codes_info *) data; |
const char *name; |
char *p; |
unsigned long ha; |
char *alc = NULL; |
5157,7 → 5282,9 |
return TRUE; |
name = h->root.root.string; |
p = strchr (name, ELF_VER_CHR); |
if (h->versioned >= versioned) |
{ |
char *p = strchr (name, ELF_VER_CHR); |
if (p != NULL) |
{ |
alc = (char *) bfd_malloc (p - name + 1); |
5170,6 → 5297,7 |
alc[p - name] = '\0'; |
name = alc; |
} |
} |
/* Compute the hash value. */ |
ha = bfd_elf_hash (name); |
5216,7 → 5344,6 |
{ |
struct collect_gnu_hash_codes *s = (struct collect_gnu_hash_codes *) data; |
const char *name; |
char *p; |
unsigned long ha; |
char *alc = NULL; |
5229,7 → 5356,9 |
return TRUE; |
name = h->root.root.string; |
p = strchr (name, ELF_VER_CHR); |
if (h->versioned >= versioned) |
{ |
char *p = strchr (name, ELF_VER_CHR); |
if (p != NULL) |
{ |
alc = (char *) bfd_malloc (p - name + 1); |
5242,6 → 5371,7 |
alc[p - name] = '\0'; |
name = alc; |
} |
} |
/* Compute the hash value. */ |
ha = bfd_elf_gnu_hash (name); |
5476,7 → 5606,7 |
{ |
bfd *ibfd; |
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) |
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) |
if (bfd_get_flavour (ibfd) == bfd_target_elf_flavour |
&& !_bfd_elf_fixup_group_sections (ibfd, bfd_abs_section_ptr)) |
return FALSE; |
5579,7 → 5709,7 |
elf_hash_table (info)->init_plt_refcount |
= elf_hash_table (info)->init_plt_offset; |
if (info->relocatable |
if (bfd_link_relocatable (info) |
&& !_bfd_elf_size_group_sections (info)) |
return FALSE; |
5603,7 → 5733,7 |
for (inputobj = info->input_bfds; |
inputobj; |
inputobj = inputobj->link_next) |
inputobj = inputobj->link.next) |
{ |
asection *s; |
5622,7 → 5752,7 |
} |
if (notesec || info->stacksize > 0) |
elf_stack_flags (output_bfd) = PF_R | PF_W | exec; |
if (notesec && exec && info->relocatable |
if (notesec && exec && bfd_link_relocatable (info) |
&& notesec->output_section != bfd_abs_section_ptr) |
notesec->output_section->flags |= SEC_CODE; |
} |
5640,7 → 5770,7 |
bfd_boolean all_defined; |
*sinterpptr = bfd_get_linker_section (dynobj, ".interp"); |
BFD_ASSERT (*sinterpptr != NULL || !info->executable); |
BFD_ASSERT (*sinterpptr != NULL || !bfd_link_executable (info) || info->nointerp); |
if (soname != NULL) |
{ |
5728,7 → 5858,7 |
/* If we are supposed to export all symbols into the dynamic symbol |
table (this is not the normal case), then do so. */ |
if (info->export_dynamic |
|| (info->executable && info->dynamic)) |
|| (bfd_link_executable (info) && info->dynamic)) |
{ |
elf_link_hash_traverse (elf_hash_table (info), |
_bfd_elf_export_symbol, |
5863,13 → 5993,13 |
if (s != NULL && s->linker_has_input) |
{ |
/* DT_PREINIT_ARRAY is not allowed in shared library. */ |
if (! info->executable) |
if (! bfd_link_executable (info)) |
{ |
bfd *sub; |
asection *o; |
for (sub = info->input_bfds; sub != NULL; |
sub = sub->link_next) |
sub = sub->link.next) |
if (bfd_get_flavour (sub) == bfd_target_elf_flavour) |
for (o = sub->sections; o != NULL; o = o->next) |
if (elf_section_data (o)->this_hdr.sh_type |
5927,6 → 6057,9 |
} |
} |
if (! _bfd_elf_maybe_strip_eh_frame_hdr (info)) |
return FALSE; |
/* The backend must work out the sizes of all the other dynamic |
sections. */ |
if (dynobj != NULL |
5934,9 → 6067,6 |
&& ! (*bed->elf_backend_size_dynamic_sections) (output_bfd, info)) |
return FALSE; |
if (! _bfd_elf_maybe_strip_eh_frame_hdr (info)) |
return FALSE; |
if (dynobj != NULL && elf_hash_table (info)->dynamic_sections_created) |
{ |
unsigned long section_sym_count; |
6197,7 → 6327,7 |
if (info->flags_1) |
{ |
if (info->executable) |
if (bfd_link_executable (info)) |
info->flags_1 &= ~ (DF_1_INITFIRST |
| DF_1_NODELETE |
| DF_1_NOOPEN); |
6423,7 → 6553,7 |
the final symbol table, because until then we do not know the |
correct value to give the symbols. We built the .dynstr |
section as we went along in elf_link_add_object_symbols. */ |
s = bfd_get_linker_section (dynobj, ".dynsym"); |
s = elf_hash_table (info)->dynsym; |
BFD_ASSERT (s != NULL); |
s->size = dynsymcount * bed->s->sizeof_sym; |
6691,7 → 6821,7 |
/* Finish SHF_MERGE section merging. */ |
bfd_boolean |
_bfd_elf_merge_sections (bfd *abfd, struct bfd_link_info *info) |
_bfd_elf_merge_sections (bfd *obfd, struct bfd_link_info *info) |
{ |
bfd *ibfd; |
asection *sec; |
6699,8 → 6829,11 |
if (!is_elf_hash_table (info->hash)) |
return FALSE; |
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) |
if ((ibfd->flags & DYNAMIC) == 0) |
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) |
if ((ibfd->flags & DYNAMIC) == 0 |
&& bfd_get_flavour (ibfd) == bfd_target_elf_flavour |
&& (elf_elfheader (ibfd)->e_ident[EI_CLASS] |
== get_elf_backend_data (obfd)->s->elfclass)) |
for (sec = ibfd->sections; sec != NULL; sec = sec->next) |
if ((sec->flags & SEC_MERGE) != 0 |
&& !bfd_is_abs_section (sec->output_section)) |
6708,7 → 6841,7 |
struct bfd_elf_section_data *secdata; |
secdata = elf_section_data (sec); |
if (! _bfd_add_merge_section (abfd, |
if (! _bfd_add_merge_section (obfd, |
&elf_hash_table (info)->merge_info, |
sec, &secdata->sec_info)) |
return FALSE; |
6717,7 → 6850,7 |
} |
if (elf_hash_table (info)->merge_info != NULL) |
_bfd_merge_sections (abfd, info, elf_hash_table (info)->merge_info, |
_bfd_merge_sections (obfd, info, elf_hash_table (info)->merge_info, |
merge_sections_remove_hook); |
return TRUE; |
} |
6774,8 → 6907,11 |
struct elf_link_hash_table *htab; |
/* Copy down any references that we may have already seen to the |
symbol which just became indirect. */ |
symbol which just became indirect if DIR isn't a hidden versioned |
symbol. */ |
if (dir->versioned != versioned_hidden) |
{ |
dir->ref_dynamic |= ind->ref_dynamic; |
dir->ref_regular |= ind->ref_regular; |
dir->ref_regular_nonweak |= ind->ref_regular_nonweak; |
6782,6 → 6918,7 |
dir->non_got_ref |= ind->non_got_ref; |
dir->needs_plt |= ind->needs_plt; |
dir->pointer_equality_needed |= ind->pointer_equality_needed; |
} |
if (ind->root.type != bfd_link_hash_indirect) |
return; |
6889,6 → 7026,7 |
free (ret); |
return NULL; |
} |
ret->root.hash_table_free = _bfd_elf_link_hash_table_free; |
return &ret->root; |
} |
6896,13 → 7034,15 |
/* Destroy an ELF linker hash table. */ |
void |
_bfd_elf_link_hash_table_free (struct bfd_link_hash_table *hash) |
_bfd_elf_link_hash_table_free (bfd *obfd) |
{ |
struct elf_link_hash_table *htab = (struct elf_link_hash_table *) hash; |
struct elf_link_hash_table *htab; |
htab = (struct elf_link_hash_table *) obfd->link.hash; |
if (htab->dynstr != NULL) |
_bfd_elf_strtab_free (htab->dynstr); |
_bfd_merge_sections_free (htab->merge_info); |
_bfd_generic_link_hash_table_free (hash); |
_bfd_generic_link_hash_table_free (obfd); |
} |
/* This is a hook for the ELF emulation code in the generic linker to |
7282,10 → 7422,10 |
if (count1 == 0 || count2 == 0 || count1 != count2) |
goto done; |
symtable1 = (struct elf_symbol *) |
bfd_malloc (count1 * sizeof (struct elf_symbol)); |
symtable2 = (struct elf_symbol *) |
bfd_malloc (count2 * sizeof (struct elf_symbol)); |
symtable1 |
= (struct elf_symbol *) bfd_malloc (count1 * sizeof (*symtable1)); |
symtable2 |
= (struct elf_symbol *) bfd_malloc (count2 * sizeof (*symtable2)); |
if (symtable1 == NULL || symtable2 == NULL) |
goto done; |
7411,9 → 7551,7 |
/* Output BFD. */ |
bfd *output_bfd; |
/* Symbol string table. */ |
struct bfd_strtab_hash *symstrtab; |
/* .dynsym section. */ |
asection *dynsym_sec; |
struct elf_strtab_hash *symstrtab; |
/* .hash section. */ |
asection *hash_sec; |
/* symbol version section (.gnu.version). */ |
7438,16 → 7576,8 |
/* Array large enough to hold a section pointer for each local |
symbol of any input BFD. */ |
asection **sections; |
/* Buffer to hold swapped out symbols. */ |
bfd_byte *symbuf; |
/* And one for symbol section indices. */ |
/* Buffer for SHT_SYMTAB_SHNDX section. */ |
Elf_External_Sym_Shndx *symshndxbuf; |
/* Number of swapped out symbols in buffer. */ |
size_t symbuf_count; |
/* Number of symbols which fit in symbuf. */ |
size_t symbuf_size; |
/* And same for symshndxbuf. */ |
size_t shndxbuf_size; |
/* Number of STT_FILE syms seen. */ |
size_t filesym_count; |
}; |
7458,8 → 7588,7 |
{ |
bfd_boolean failed; |
bfd_boolean localsyms; |
bfd_boolean need_second_pass; |
bfd_boolean second_pass; |
bfd_boolean file_sym_done; |
struct elf_final_link_info *flinfo; |
}; |
7809,28 → 7938,34 |
{ |
location += (size - chunksz); |
for (; size; size -= chunksz, location -= chunksz, x >>= (chunksz * 8)) |
for (; size; size -= chunksz, location -= chunksz) |
{ |
switch (chunksz) |
{ |
default: |
case 0: |
abort (); |
case 1: |
bfd_put_8 (input_bfd, x, location); |
x >>= 8; |
break; |
case 2: |
bfd_put_16 (input_bfd, x, location); |
x >>= 16; |
break; |
case 4: |
bfd_put_32 (input_bfd, x, location); |
/* Computed this way because x >>= 32 is undefined if x is a 32-bit value. */ |
x >>= 16; |
x >>= 16; |
break; |
#ifdef BFD64 |
case 8: |
#ifdef BFD64 |
bfd_put_64 (input_bfd, x, location); |
#else |
/* Computed this way because x >>= 64 is undefined if x is a 64-bit value. */ |
x >>= 32; |
x >>= 32; |
break; |
#endif |
default: |
abort (); |
#endif |
break; |
} |
} |
7977,14 → 8112,101 |
return r; |
} |
/* Functions to read r_offset from external (target order) reloc |
entry. Faster than bfd_getl32 et al, because we let the compiler |
know the value is aligned. */ |
static bfd_vma |
ext32l_r_offset (const void *p) |
{ |
union aligned32 |
{ |
uint32_t v; |
unsigned char c[4]; |
}; |
const union aligned32 *a |
= (const union aligned32 *) &((const Elf32_External_Rel *) p)->r_offset; |
uint32_t aval = ( (uint32_t) a->c[0] |
| (uint32_t) a->c[1] << 8 |
| (uint32_t) a->c[2] << 16 |
| (uint32_t) a->c[3] << 24); |
return aval; |
} |
static bfd_vma |
ext32b_r_offset (const void *p) |
{ |
union aligned32 |
{ |
uint32_t v; |
unsigned char c[4]; |
}; |
const union aligned32 *a |
= (const union aligned32 *) &((const Elf32_External_Rel *) p)->r_offset; |
uint32_t aval = ( (uint32_t) a->c[0] << 24 |
| (uint32_t) a->c[1] << 16 |
| (uint32_t) a->c[2] << 8 |
| (uint32_t) a->c[3]); |
return aval; |
} |
#ifdef BFD_HOST_64_BIT |
static bfd_vma |
ext64l_r_offset (const void *p) |
{ |
union aligned64 |
{ |
uint64_t v; |
unsigned char c[8]; |
}; |
const union aligned64 *a |
= (const union aligned64 *) &((const Elf64_External_Rel *) p)->r_offset; |
uint64_t aval = ( (uint64_t) a->c[0] |
| (uint64_t) a->c[1] << 8 |
| (uint64_t) a->c[2] << 16 |
| (uint64_t) a->c[3] << 24 |
| (uint64_t) a->c[4] << 32 |
| (uint64_t) a->c[5] << 40 |
| (uint64_t) a->c[6] << 48 |
| (uint64_t) a->c[7] << 56); |
return aval; |
} |
static bfd_vma |
ext64b_r_offset (const void *p) |
{ |
union aligned64 |
{ |
uint64_t v; |
unsigned char c[8]; |
}; |
const union aligned64 *a |
= (const union aligned64 *) &((const Elf64_External_Rel *) p)->r_offset; |
uint64_t aval = ( (uint64_t) a->c[0] << 56 |
| (uint64_t) a->c[1] << 48 |
| (uint64_t) a->c[2] << 40 |
| (uint64_t) a->c[3] << 32 |
| (uint64_t) a->c[4] << 24 |
| (uint64_t) a->c[5] << 16 |
| (uint64_t) a->c[6] << 8 |
| (uint64_t) a->c[7]); |
return aval; |
} |
#endif |
/* When performing a relocatable link, the input relocations are |
preserved. But, if they reference global symbols, the indices |
referenced must be updated. Update all the relocations found in |
RELDATA. */ |
static void |
static bfd_boolean |
elf_link_adjust_relocs (bfd *abfd, |
struct bfd_elf_section_reloc_data *reldata) |
struct bfd_elf_section_reloc_data *reldata, |
bfd_boolean sort) |
{ |
unsigned int i; |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
8040,8 → 8262,120 |
| (irela[j].r_info & r_type_mask)); |
(*swap_out) (abfd, irela, erela); |
} |
if (sort && count != 0) |
{ |
bfd_vma (*ext_r_off) (const void *); |
bfd_vma r_off; |
size_t elt_size; |
bfd_byte *base, *end, *p, *loc; |
bfd_byte *buf = NULL; |
if (bed->s->arch_size == 32) |
{ |
if (abfd->xvec->header_byteorder == BFD_ENDIAN_LITTLE) |
ext_r_off = ext32l_r_offset; |
else if (abfd->xvec->header_byteorder == BFD_ENDIAN_BIG) |
ext_r_off = ext32b_r_offset; |
else |
abort (); |
} |
else |
{ |
#ifdef BFD_HOST_64_BIT |
if (abfd->xvec->header_byteorder == BFD_ENDIAN_LITTLE) |
ext_r_off = ext64l_r_offset; |
else if (abfd->xvec->header_byteorder == BFD_ENDIAN_BIG) |
ext_r_off = ext64b_r_offset; |
else |
#endif |
abort (); |
} |
/* Must use a stable sort here. A modified insertion sort, |
since the relocs are mostly sorted already. */ |
elt_size = reldata->hdr->sh_entsize; |
base = reldata->hdr->contents; |
end = base + count * elt_size; |
if (elt_size > sizeof (Elf64_External_Rela)) |
abort (); |
/* Ensure the first element is lowest. This acts as a sentinel, |
speeding the main loop below. */ |
r_off = (*ext_r_off) (base); |
for (p = loc = base; (p += elt_size) < end; ) |
{ |
bfd_vma r_off2 = (*ext_r_off) (p); |
if (r_off > r_off2) |
{ |
r_off = r_off2; |
loc = p; |
} |
} |
if (loc != base) |
{ |
/* Don't just swap *base and *loc as that changes the order |
of the original base[0] and base[1] if they happen to |
have the same r_offset. */ |
bfd_byte onebuf[sizeof (Elf64_External_Rela)]; |
memcpy (onebuf, loc, elt_size); |
memmove (base + elt_size, base, loc - base); |
memcpy (base, onebuf, elt_size); |
} |
for (p = base + elt_size; (p += elt_size) < end; ) |
{ |
/* base to p is sorted, *p is next to insert. */ |
r_off = (*ext_r_off) (p); |
/* Search the sorted region for location to insert. */ |
loc = p - elt_size; |
while (r_off < (*ext_r_off) (loc)) |
loc -= elt_size; |
loc += elt_size; |
if (loc != p) |
{ |
/* Chances are there is a run of relocs to insert here, |
from one of more input files. Files are not always |
linked in order due to the way elf_link_input_bfd is |
called. See pr17666. */ |
size_t sortlen = p - loc; |
bfd_vma r_off2 = (*ext_r_off) (loc); |
size_t runlen = elt_size; |
size_t buf_size = 96 * 1024; |
while (p + runlen < end |
&& (sortlen <= buf_size |
|| runlen + elt_size <= buf_size) |
&& r_off2 > (*ext_r_off) (p + runlen)) |
runlen += elt_size; |
if (buf == NULL) |
{ |
buf = bfd_malloc (buf_size); |
if (buf == NULL) |
return FALSE; |
} |
if (runlen < sortlen) |
{ |
memcpy (buf, p, runlen); |
memmove (loc + runlen, loc, sortlen); |
memcpy (loc, buf, runlen); |
} |
else |
{ |
memcpy (buf, loc, sortlen); |
memmove (loc, p, runlen); |
memcpy (loc + runlen, buf, sortlen); |
} |
p += runlen - elt_size; |
} |
} |
/* Hashes are no longer valid. */ |
free (reldata->hashes); |
reldata->hashes = NULL; |
free (buf); |
} |
return TRUE; |
} |
struct elf_link_sort_rela |
{ |
union { |
8370,48 → 8704,24 |
return ret; |
} |
/* Flush the output symbols to the file. */ |
/* Add a symbol to the output symbol string table. */ |
static bfd_boolean |
elf_link_flush_output_syms (struct elf_final_link_info *flinfo, |
const struct elf_backend_data *bed) |
{ |
if (flinfo->symbuf_count > 0) |
{ |
Elf_Internal_Shdr *hdr; |
file_ptr pos; |
bfd_size_type amt; |
hdr = &elf_tdata (flinfo->output_bfd)->symtab_hdr; |
pos = hdr->sh_offset + hdr->sh_size; |
amt = flinfo->symbuf_count * bed->s->sizeof_sym; |
if (bfd_seek (flinfo->output_bfd, pos, SEEK_SET) != 0 |
|| bfd_bwrite (flinfo->symbuf, amt, flinfo->output_bfd) != amt) |
return FALSE; |
hdr->sh_size += amt; |
flinfo->symbuf_count = 0; |
} |
return TRUE; |
} |
/* Add a symbol to the output symbol table. */ |
static int |
elf_link_output_sym (struct elf_final_link_info *flinfo, |
elf_link_output_symstrtab (struct elf_final_link_info *flinfo, |
const char *name, |
Elf_Internal_Sym *elfsym, |
asection *input_sec, |
struct elf_link_hash_entry *h) |
{ |
bfd_byte *dest; |
Elf_External_Sym_Shndx *destshndx; |
int (*output_symbol_hook) |
(struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, |
struct elf_link_hash_entry *); |
struct elf_link_hash_table *hash_table; |
const struct elf_backend_data *bed; |
bfd_size_type strtabsize; |
BFD_ASSERT (elf_onesymtab (flinfo->output_bfd)); |
bed = get_elf_backend_data (flinfo->output_bfd); |
output_symbol_hook = bed->elf_backend_link_output_symbol_hook; |
if (output_symbol_hook != NULL) |
8421,49 → 8731,119 |
return ret; |
} |
if (name == NULL || *name == '\0') |
elfsym->st_name = 0; |
else if (input_sec->flags & SEC_EXCLUDE) |
elfsym->st_name = 0; |
if (name == NULL |
|| *name == '\0' |
|| (input_sec->flags & SEC_EXCLUDE)) |
elfsym->st_name = (unsigned long) -1; |
else |
{ |
elfsym->st_name = (unsigned long) _bfd_stringtab_add (flinfo->symstrtab, |
name, TRUE, FALSE); |
/* Call _bfd_elf_strtab_offset after _bfd_elf_strtab_finalize |
to get the final offset for st_name. */ |
elfsym->st_name |
= (unsigned long) _bfd_elf_strtab_add (flinfo->symstrtab, |
name, FALSE); |
if (elfsym->st_name == (unsigned long) -1) |
return 0; |
} |
if (flinfo->symbuf_count >= flinfo->symbuf_size) |
hash_table = elf_hash_table (flinfo->info); |
strtabsize = hash_table->strtabsize; |
if (strtabsize <= hash_table->strtabcount) |
{ |
if (! elf_link_flush_output_syms (flinfo, bed)) |
strtabsize += strtabsize; |
hash_table->strtabsize = strtabsize; |
strtabsize *= sizeof (*hash_table->strtab); |
hash_table->strtab |
= (struct elf_sym_strtab *) bfd_realloc (hash_table->strtab, |
strtabsize); |
if (hash_table->strtab == NULL) |
return 0; |
} |
hash_table->strtab[hash_table->strtabcount].sym = *elfsym; |
hash_table->strtab[hash_table->strtabcount].dest_index |
= hash_table->strtabcount; |
hash_table->strtab[hash_table->strtabcount].destshndx_index |
= flinfo->symshndxbuf ? bfd_get_symcount (flinfo->output_bfd) : 0; |
dest = flinfo->symbuf + flinfo->symbuf_count * bed->s->sizeof_sym; |
destshndx = flinfo->symshndxbuf; |
if (destshndx != NULL) |
bfd_get_symcount (flinfo->output_bfd) += 1; |
hash_table->strtabcount += 1; |
return 1; |
} |
/* Swap symbols out to the symbol table and flush the output symbols to |
the file. */ |
static bfd_boolean |
elf_link_swap_symbols_out (struct elf_final_link_info *flinfo) |
{ |
if (bfd_get_symcount (flinfo->output_bfd) >= flinfo->shndxbuf_size) |
struct elf_link_hash_table *hash_table = elf_hash_table (flinfo->info); |
bfd_size_type amt, i; |
const struct elf_backend_data *bed; |
bfd_byte *symbuf; |
Elf_Internal_Shdr *hdr; |
file_ptr pos; |
bfd_boolean ret; |
if (!hash_table->strtabcount) |
return TRUE; |
BFD_ASSERT (elf_onesymtab (flinfo->output_bfd)); |
bed = get_elf_backend_data (flinfo->output_bfd); |
amt = bed->s->sizeof_sym * hash_table->strtabcount; |
symbuf = (bfd_byte *) bfd_malloc (amt); |
if (symbuf == NULL) |
return FALSE; |
if (flinfo->symshndxbuf) |
{ |
bfd_size_type amt; |
amt = (sizeof (Elf_External_Sym_Shndx) |
* (bfd_get_symcount (flinfo->output_bfd))); |
flinfo->symshndxbuf = (Elf_External_Sym_Shndx *) bfd_zmalloc (amt); |
if (flinfo->symshndxbuf == NULL) |
{ |
free (symbuf); |
return FALSE; |
} |
} |
amt = flinfo->shndxbuf_size * sizeof (Elf_External_Sym_Shndx); |
destshndx = (Elf_External_Sym_Shndx *) bfd_realloc (destshndx, |
amt * 2); |
if (destshndx == NULL) |
return 0; |
flinfo->symshndxbuf = destshndx; |
memset ((char *) destshndx + amt, 0, amt); |
flinfo->shndxbuf_size *= 2; |
for (i = 0; i < hash_table->strtabcount; i++) |
{ |
struct elf_sym_strtab *elfsym = &hash_table->strtab[i]; |
if (elfsym->sym.st_name == (unsigned long) -1) |
elfsym->sym.st_name = 0; |
else |
elfsym->sym.st_name |
= (unsigned long) _bfd_elf_strtab_offset (flinfo->symstrtab, |
elfsym->sym.st_name); |
bed->s->swap_symbol_out (flinfo->output_bfd, &elfsym->sym, |
((bfd_byte *) symbuf |
+ (elfsym->dest_index |
* bed->s->sizeof_sym)), |
(flinfo->symshndxbuf |
+ elfsym->destshndx_index)); |
} |
destshndx += bfd_get_symcount (flinfo->output_bfd); |
hdr = &elf_tdata (flinfo->output_bfd)->symtab_hdr; |
pos = hdr->sh_offset + hdr->sh_size; |
amt = hash_table->strtabcount * bed->s->sizeof_sym; |
if (bfd_seek (flinfo->output_bfd, pos, SEEK_SET) == 0 |
&& bfd_bwrite (symbuf, amt, flinfo->output_bfd) == amt) |
{ |
hdr->sh_size += amt; |
ret = TRUE; |
} |
else |
ret = FALSE; |
bed->s->swap_symbol_out (flinfo->output_bfd, elfsym, dest, destshndx); |
flinfo->symbuf_count += 1; |
bfd_get_symcount (flinfo->output_bfd) += 1; |
free (symbuf); |
return 1; |
free (hash_table->strtab); |
hash_table->strtab = NULL; |
return ret; |
} |
/* Return TRUE if the dynamic symbol SYM in ABFD is supported. */ |
8660,6 → 9040,16 |
const struct elf_backend_data *bed; |
long indx; |
int ret; |
/* A symbol is bound locally if it is forced local or it is locally |
defined, hidden versioned, not referenced by shared library and |
not exported when linking executable. */ |
bfd_boolean local_bind = (h->forced_local |
|| (bfd_link_executable (flinfo->info) |
&& !flinfo->info->export_dynamic |
&& !h->dynamic |
&& !h->ref_dynamic |
&& h->def_regular |
&& h->versioned == versioned_hidden)); |
if (h->root.type == bfd_link_hash_warning) |
{ |
8671,17 → 9061,12 |
/* Decide whether to output this symbol in this pass. */ |
if (eoinfo->localsyms) |
{ |
if (!h->forced_local) |
if (!local_bind) |
return TRUE; |
if (eoinfo->second_pass |
&& !((h->root.type == bfd_link_hash_defined |
|| h->root.type == bfd_link_hash_defweak) |
&& h->root.u.def.section->output_section != NULL)) |
return TRUE; |
} |
else |
{ |
if (h->forced_local) |
if (local_bind) |
return TRUE; |
} |
8724,8 → 9109,7 |
/* We should also warn if a forced local symbol is referenced from |
shared libraries. */ |
if (!flinfo->info->relocatable |
&& flinfo->info->executable |
if (bfd_link_executable (flinfo->info) |
&& h->forced_local |
&& h->ref_dynamic |
&& h->def_regular |
8779,7 → 9163,8 |
|| h->root.type == bfd_link_hash_defweak) |
&& ((flinfo->info->strip_discarded |
&& discarded_section (h->root.u.def.section)) |
|| (h->root.u.def.section->owner != NULL |
|| ((h->root.u.def.section->flags & SEC_LINKER_CREATED) == 0 |
&& h->root.u.def.section->owner != NULL |
&& (h->root.u.def.section->owner->flags & BFD_PLUGIN) != 0))) |
strip = TRUE; |
else if ((h->root.type == bfd_link_hash_undefined |
8802,7 → 9187,7 |
sym.st_value = 0; |
sym.st_size = h->size; |
sym.st_other = h->other; |
if (h->forced_local) |
if (local_bind) |
{ |
sym.st_info = ELF_ST_INFO (STB_LOCAL, h->type); |
/* Turn off visibility on local symbol. */ |
8838,19 → 9223,6 |
input_sec = h->root.u.def.section; |
if (input_sec->output_section != NULL) |
{ |
if (eoinfo->localsyms && flinfo->filesym_count == 1) |
{ |
bfd_boolean second_pass_sym |
= (input_sec->owner == flinfo->output_bfd |
|| input_sec->owner == NULL |
|| (input_sec->flags & SEC_LINKER_CREATED) != 0 |
|| (input_sec->owner->flags & BFD_LINKER_CREATED) != 0); |
eoinfo->need_second_pass |= second_pass_sym; |
if (eoinfo->second_pass != second_pass_sym) |
return TRUE; |
} |
sym.st_shndx = |
_bfd_elf_section_from_bfd_section (flinfo->output_bfd, |
input_sec->output_section); |
8868,7 → 9240,7 |
but in nonrelocatable files they are virtual |
addresses. */ |
sym.st_value = h->root.u.def.value + input_sec->output_offset; |
if (!flinfo->info->relocatable) |
if (!bfd_link_relocatable (flinfo->info)) |
{ |
sym.st_value += input_sec->output_section->vma; |
if (h->type == STT_TLS) |
8876,15 → 9248,9 |
asection *tls_sec = elf_hash_table (flinfo->info)->tls_sec; |
if (tls_sec != NULL) |
sym.st_value -= tls_sec->vma; |
else |
{ |
/* The TLS section may have been garbage collected. */ |
BFD_ASSERT (flinfo->info->gc_sections |
&& !input_sec->gc_mark); |
} |
} |
} |
} |
else |
{ |
BFD_ASSERT (input_sec->owner == NULL |
8918,10 → 9284,10 |
STT_GNU_IFUNC symbol must go through PLT. */ |
if ((h->type == STT_GNU_IFUNC |
&& h->def_regular |
&& !flinfo->info->relocatable) |
&& !bfd_link_relocatable (flinfo->info)) |
|| ((h->dynindx != -1 |
|| h->forced_local) |
&& ((flinfo->info->shared |
&& ((bfd_link_pic (flinfo->info) |
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT |
|| h->root.type != bfd_link_hash_undefweak)) |
|| !h->forced_local) |
8971,7 → 9337,7 |
/* If a non-weak symbol with non-default visibility is not defined |
locally, it is a fatal error. */ |
if (!flinfo->info->relocatable |
if (!bfd_link_relocatable (flinfo->info) |
&& ELF_ST_VISIBILITY (sym.st_other) != STV_DEFAULT |
&& ELF_ST_BIND (sym.st_info) != STB_WEAK |
&& h->root.type == bfd_link_hash_undefined |
8994,7 → 9360,7 |
/* If this symbol should be put in the .dynsym section, then put it |
there now. We already know the symbol index. We also fill in |
the entry in the .hash section. */ |
if (flinfo->dynsym_sec != NULL |
if (elf_hash_table (flinfo->info)->dynsym != NULL |
&& h->dynindx != -1 |
&& elf_hash_table (flinfo->info)->dynamic_sections_created) |
{ |
9002,8 → 9368,14 |
/* Since there is no version information in the dynamic string, |
if there is no version info in symbol version section, we will |
have a run-time problem. */ |
if (h->verinfo.verdef == NULL) |
have a run-time problem if not linking executable, referenced |
by shared library, not locally defined, or not bound locally. |
*/ |
if (h->verinfo.verdef == NULL |
&& !local_bind |
&& (!bfd_link_executable (flinfo->info) |
|| h->ref_dynamic |
|| !h->def_regular)) |
{ |
char *p = strrchr (h->root.root.string, ELF_VER_CHR); |
9018,7 → 9390,8 |
} |
sym.st_name = h->dynstr_index; |
esym = flinfo->dynsym_sec->contents + h->dynindx * bed->s->sizeof_sym; |
esym = (elf_hash_table (flinfo->info)->dynsym->contents |
+ h->dynindx * bed->s->sizeof_sym); |
if (!check_dynsym (flinfo->output_bfd, &sym)) |
{ |
eoinfo->failed = TRUE; |
9056,7 → 9429,9 |
if (!h->def_regular) |
{ |
if (h->verinfo.verdef == NULL) |
if (h->verinfo.verdef == NULL |
|| (elf_dyn_lib_class (h->verinfo.verdef->vd_bfd) |
& (DYN_AS_NEEDED | DYN_DT_NEEDED | DYN_NO_NEEDED))) |
iversym.vs_vers = 0; |
else |
iversym.vs_vers = h->verinfo.verdef->vd_exp_refno + 1; |
9071,7 → 9446,9 |
iversym.vs_vers++; |
} |
if (h->hidden) |
/* Turn on VERSYM_HIDDEN only if the hidden versioned symbol is |
defined locally. */ |
if (h->versioned == versioned_hidden && h->def_regular) |
iversym.vs_vers |= VERSYM_HIDDEN; |
eversym = (Elf_External_Versym *) flinfo->symver_sec->contents; |
9085,8 → 9462,32 |
if (strip || (input_sec->flags & SEC_EXCLUDE) != 0) |
return TRUE; |
/* Output a FILE symbol so that following locals are not associated |
with the wrong input file. We need one for forced local symbols |
if we've seen more than one FILE symbol or when we have exactly |
one FILE symbol but global symbols are present in a file other |
than the one with the FILE symbol. We also need one if linker |
defined symbols are present. In practice these conditions are |
always met, so just emit the FILE symbol unconditionally. */ |
if (eoinfo->localsyms |
&& !eoinfo->file_sym_done |
&& eoinfo->flinfo->filesym_count != 0) |
{ |
Elf_Internal_Sym fsym; |
memset (&fsym, 0, sizeof (fsym)); |
fsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE); |
fsym.st_shndx = SHN_ABS; |
if (!elf_link_output_symstrtab (eoinfo->flinfo, NULL, &fsym, |
bfd_und_section_ptr, NULL)) |
return FALSE; |
eoinfo->file_sym_done = TRUE; |
} |
indx = bfd_get_symcount (flinfo->output_bfd); |
ret = elf_link_output_sym (flinfo, h->root.root.string, &sym, input_sec, h); |
ret = elf_link_output_symstrtab (flinfo, h->root.root.string, &sym, |
input_sec, h); |
if (ret == 0) |
{ |
eoinfo->failed = TRUE; |
9112,6 → 9513,7 |
{ |
case SEC_INFO_TYPE_STABS: |
case SEC_INFO_TYPE_EH_FRAME: |
case SEC_INFO_TYPE_EH_FRAME_ENTRY: |
return TRUE; |
default: |
break; |
9351,7 → 9753,8 |
&& (bfd_hash_lookup (flinfo->info->keep_hash, name, FALSE, FALSE) |
== NULL)) |
|| (((flinfo->info->discard == discard_sec_merge |
&& (isec->flags & SEC_MERGE) && !flinfo->info->relocatable) |
&& (isec->flags & SEC_MERGE) |
&& !bfd_link_relocatable (flinfo->info)) |
|| flinfo->info->discard == discard_l) |
&& bfd_is_local_label_name (input_bfd, name))) |
continue; |
9358,6 → 9761,10 |
if (ELF_ST_TYPE (isym->st_info) == STT_FILE) |
{ |
if (input_bfd->lto_output) |
/* -flto puts a temp file name here. This means builds |
are not reproducible. Discard the symbol. */ |
continue; |
have_file_sym = TRUE; |
flinfo->filesym_count += 1; |
} |
9374,8 → 9781,11 |
memset (&osym, 0, sizeof (osym)); |
osym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE); |
osym.st_shndx = SHN_ABS; |
if (!elf_link_output_sym (flinfo, input_bfd->filename, &osym, |
bfd_abs_section_ptr, NULL)) |
if (!elf_link_output_symstrtab (flinfo, |
(input_bfd->lto_output ? NULL |
: input_bfd->filename), |
&osym, bfd_abs_section_ptr, |
NULL)) |
return FALSE; |
} |
9395,7 → 9805,7 |
output_section. Any special sections must be set up to meet |
these requirements. */ |
osym.st_value += isec->output_offset; |
if (!flinfo->info->relocatable) |
if (!bfd_link_relocatable (flinfo->info)) |
{ |
osym.st_value += isec->output_section->vma; |
if (ELF_ST_TYPE (osym.st_info) == STT_TLS) |
9407,7 → 9817,7 |
} |
indx = bfd_get_symcount (output_bfd); |
ret = elf_link_output_sym (flinfo, name, &osym, isec, NULL); |
ret = elf_link_output_symstrtab (flinfo, name, &osym, isec, NULL); |
if (ret == 0) |
return FALSE; |
else if (ret == 1) |
9439,7 → 9849,7 |
continue; |
} |
if (flinfo->info->relocatable |
if (bfd_link_relocatable (flinfo->info) |
&& (o->flags & (SEC_LINKER_CREATED | SEC_GROUP)) == SEC_GROUP) |
{ |
/* Deal with the group signature symbol. */ |
9490,7 → 9900,8 |
sym.st_value += o->output_offset; |
indx = bfd_get_symcount (output_bfd); |
ret = elf_link_output_sym (flinfo, name, &sym, o, NULL); |
ret = elf_link_output_symstrtab (flinfo, name, &sym, o, |
NULL); |
if (ret == 0) |
return FALSE; |
else if (ret == 1) |
9519,7 → 9930,16 |
file, so the contents field will not have been set by any of |
the routines which work on output files. */ |
if (elf_section_data (o)->this_hdr.contents != NULL) |
{ |
contents = elf_section_data (o)->this_hdr.contents; |
if (bed->caches_rawsize |
&& o->rawsize != 0 |
&& o->rawsize < o->size) |
{ |
memcpy (flinfo->contents, contents, o->rawsize); |
contents = flinfo->contents; |
} |
} |
else |
{ |
contents = flinfo->contents; |
9616,6 → 10036,24 |
s_type = h->type; |
/* If a plugin symbol is referenced from a non-IR file, |
mark the symbol as undefined. Note that the |
linker may attach linker created dynamic sections |
to the plugin bfd. Symbols defined in linker |
created sections are not plugin symbols. */ |
if (h->root.non_ir_ref |
&& (h->root.type == bfd_link_hash_defined |
|| h->root.type == bfd_link_hash_defweak) |
&& (h->root.u.def.section->flags |
& SEC_LINKER_CREATED) == 0 |
&& h->root.u.def.section->owner != NULL |
&& (h->root.u.def.section->owner->flags |
& BFD_PLUGIN) != 0) |
{ |
h->root.type = bfd_link_hash_undefined; |
h->root.u.undef.abfd = h->root.u.def.section->owner; |
} |
ps = NULL; |
if (h->root.type == bfd_link_hash_defined |
|| h->root.type == bfd_link_hash_defweak) |
9634,7 → 10072,7 |
} |
if ((s_type == STT_RELC || s_type == STT_SRELC) |
&& !flinfo->info->relocatable) |
&& !bfd_link_relocatable (flinfo->info)) |
{ |
bfd_vma val; |
bfd_vma dot = (rel->r_offset |
9724,7 → 10162,7 |
return FALSE; |
if (ret == 2 |
|| flinfo->info->relocatable |
|| bfd_link_relocatable (flinfo->info) |
|| flinfo->info->emitrelocations) |
{ |
Elf_Internal_Rela *irela; |
9755,7 → 10193,7 |
rel_hash_list = rel_hash; |
rela_hash_list = NULL; |
last_offset = o->output_offset; |
if (!flinfo->info->relocatable) |
if (!bfd_link_relocatable (flinfo->info)) |
last_offset += o->output_section->vma; |
for (next_erel = 0; irela < irelaend; irela++, next_erel++) |
{ |
9795,7 → 10233,7 |
irela->r_offset += o->output_offset; |
/* Relocs in an executable have to be virtual addresses. */ |
if (!flinfo->info->relocatable) |
if (!bfd_link_relocatable (flinfo->info)) |
irela->r_offset += o->output_section->vma; |
last_offset = irela->r_offset; |
9923,7 → 10361,7 |
return FALSE; |
sym.st_value += sec->output_offset; |
if (!flinfo->info->relocatable) |
if (!bfd_link_relocatable (flinfo->info)) |
{ |
sym.st_value += osec->vma; |
if (ELF_ST_TYPE (sym.st_info) == STT_TLS) |
9938,7 → 10376,8 |
} |
indx = bfd_get_symcount (output_bfd); |
ret = elf_link_output_sym (flinfo, name, &sym, sec, |
ret = elf_link_output_symstrtab (flinfo, name, |
&sym, sec, |
NULL); |
if (ret == 0) |
return FALSE; |
10009,6 → 10448,14 |
return FALSE; |
} |
break; |
case SEC_INFO_TYPE_EH_FRAME_ENTRY: |
{ |
if (! _bfd_elf_write_section_eh_frame_entry (output_bfd, |
flinfo->info, |
o, contents)) |
return FALSE; |
} |
break; |
default: |
{ |
/* FIXME: octets_per_byte. */ |
10152,7 → 10599,7 |
size = (bfd_size_type) bfd_get_reloc_size (howto); |
buf = (bfd_byte *) bfd_zmalloc (size); |
if (buf == NULL) |
if (buf == NULL && size != 0) |
return FALSE; |
rstat = _bfd_relocate_contents (howto, output_bfd, addend, buf); |
switch (rstat) |
10190,7 → 10637,7 |
relocatable file, and is a virtual address in an executable |
file. */ |
offset = link_order->offset; |
if (! info->relocatable) |
if (! bfd_link_relocatable (info)) |
offset += output_section->vma; |
for (i = 0; i < bed->s->int_rels_per_ext_rel; i++) |
10378,7 → 10825,7 |
asection *o; |
if (flinfo->symstrtab != NULL) |
_bfd_stringtab_free (flinfo->symstrtab); |
_bfd_elf_strtab_free (flinfo->symstrtab); |
if (flinfo->contents != NULL) |
free (flinfo->contents); |
if (flinfo->external_relocs != NULL) |
10395,8 → 10842,6 |
free (flinfo->indices); |
if (flinfo->sections != NULL) |
free (flinfo->sections); |
if (flinfo->symbuf != NULL) |
free (flinfo->symbuf); |
if (flinfo->symshndxbuf != NULL) |
free (flinfo->symshndxbuf); |
for (o = obfd->sections; o != NULL; o = o->next) |
10426,12 → 10871,10 |
bfd_size_type max_internal_reloc_count; |
bfd_size_type max_sym_count; |
bfd_size_type max_sym_shndx_count; |
file_ptr off; |
Elf_Internal_Sym elfsym; |
unsigned int i; |
Elf_Internal_Shdr *symtab_hdr; |
Elf_Internal_Shdr *symtab_shndx_hdr; |
Elf_Internal_Shdr *symstrtab_hdr; |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
struct elf_outext_info eoinfo; |
bfd_boolean merged; |
10445,30 → 10888,28 |
if (! is_elf_hash_table (info->hash)) |
return FALSE; |
if (info->shared) |
if (bfd_link_pic (info)) |
abfd->flags |= DYNAMIC; |
dynamic = elf_hash_table (info)->dynamic_sections_created; |
dynobj = elf_hash_table (info)->dynobj; |
emit_relocs = (info->relocatable |
emit_relocs = (bfd_link_relocatable (info) |
|| info->emitrelocations); |
flinfo.info = info; |
flinfo.output_bfd = abfd; |
flinfo.symstrtab = _bfd_elf_stringtab_init (); |
flinfo.symstrtab = _bfd_elf_strtab_init (); |
if (flinfo.symstrtab == NULL) |
return FALSE; |
if (! dynamic) |
{ |
flinfo.dynsym_sec = NULL; |
flinfo.hash_sec = NULL; |
flinfo.symver_sec = NULL; |
} |
else |
{ |
flinfo.dynsym_sec = bfd_get_linker_section (dynobj, ".dynsym"); |
flinfo.hash_sec = bfd_get_linker_section (dynobj, ".hash"); |
/* Note that dynsym_sec can be NULL (on VMS). */ |
flinfo.symver_sec = bfd_get_linker_section (dynobj, ".gnu.version"); |
10483,10 → 10924,7 |
flinfo.internal_syms = NULL; |
flinfo.indices = NULL; |
flinfo.sections = NULL; |
flinfo.symbuf = NULL; |
flinfo.symshndxbuf = NULL; |
flinfo.symbuf_count = 0; |
flinfo.shndxbuf_size = 0; |
flinfo.filesym_count = 0; |
/* The object attributes have been merged. Remove the input |
10567,7 → 11005,7 |
to count particular types of relocs. Of course, |
reloc sections themselves can't have relocations. */ |
reloc_count = 0; |
else if (info->relocatable || info->emitrelocations) |
else if (emit_relocs) |
reloc_count = sec->reloc_count; |
else if (bed->elf_backend_count_relocs) |
reloc_count = (*bed->elf_backend_count_relocs) (info, sec); |
10594,7 → 11032,7 |
max_sym_count = sym_count; |
if (sym_count > max_sym_shndx_count |
&& elf_symtab_shndx (sec->owner) != 0) |
&& elf_symtab_shndx_list (sec->owner) != NULL) |
max_sym_shndx_count = sym_count; |
if ((sec->flags & SEC_RELOC) != 0) |
10619,8 → 11057,7 |
o->reloc_count += reloc_count; |
if (p->type == bfd_indirect_link_order |
&& (info->relocatable || info->emitrelocations)) |
if (p->type == bfd_indirect_link_order && emit_relocs) |
{ |
if (esdi->rel.hdr) |
esdo->rel.count += NUM_SHDR_ENTRIES (esdi->rel.hdr); |
10655,7 → 11092,7 |
o->vma = 0; |
} |
if (! info->relocatable && merged) |
if (! bfd_link_relocatable (info) && merged) |
elf_link_hash_traverse (elf_hash_table (info), |
_bfd_elf_link_sec_merge_syms, abfd); |
10662,7 → 11099,7 |
/* Figure out the file positions for everything but the symbol table |
and the relocs. We set symcount to force assign_section_numbers |
to create a symbol table. */ |
bfd_get_symcount (abfd) = info->strip == strip_all ? 0 : 1; |
bfd_get_symcount (abfd) = info->strip != strip_all || emit_relocs; |
BFD_ASSERT (! abfd->output_has_begun); |
if (! _bfd_elf_compute_section_file_positions (abfd, info)) |
goto error_return; |
10686,14 → 11123,27 |
to count upwards while actually outputting the relocations. */ |
esdo->rel.count = 0; |
esdo->rela.count = 0; |
if (esdo->this_hdr.sh_offset == (file_ptr) -1) |
{ |
/* Cache the section contents so that they can be compressed |
later. Use bfd_malloc since it will be freed by |
bfd_compress_section_contents. */ |
unsigned char *contents = esdo->this_hdr.contents; |
if ((o->flags & SEC_ELF_COMPRESS) == 0 || contents != NULL) |
abort (); |
contents |
= (unsigned char *) bfd_malloc (esdo->this_hdr.sh_size); |
if (contents == NULL) |
goto error_return; |
esdo->this_hdr.contents = contents; |
} |
} |
_bfd_elf_assign_file_positions_for_relocs (abfd); |
/* We have now assigned file positions for all the sections except |
.symtab and .strtab. We start the .symtab section at the current |
file position, and write directly to it. We build the .strtab |
section in memory. */ |
.symtab, .strtab, and non-loaded reloc sections. We start the |
.symtab section at the current file position, and write directly |
to it. We build the .strtab section in memory. */ |
bfd_get_symcount (abfd) = 0; |
symtab_hdr = &elf_tdata (abfd)->symtab_hdr; |
/* sh_name is set in prep_headers. */ |
10705,40 → 11155,31 |
/* sh_offset is set just below. */ |
symtab_hdr->sh_addralign = (bfd_vma) 1 << bed->s->log_file_align; |
off = elf_next_file_pos (abfd); |
off = _bfd_elf_assign_file_position_for_section (symtab_hdr, off, TRUE); |
if (max_sym_count < 20) |
max_sym_count = 20; |
elf_hash_table (info)->strtabsize = max_sym_count; |
amt = max_sym_count * sizeof (struct elf_sym_strtab); |
elf_hash_table (info)->strtab |
= (struct elf_sym_strtab *) bfd_malloc (amt); |
if (elf_hash_table (info)->strtab == NULL) |
goto error_return; |
/* The real buffer will be allocated in elf_link_swap_symbols_out. */ |
flinfo.symshndxbuf |
= (elf_numsections (abfd) > (SHN_LORESERVE & 0xFFFF) |
? (Elf_External_Sym_Shndx *) -1 : NULL); |
if (info->strip != strip_all || emit_relocs) |
{ |
file_ptr off = elf_next_file_pos (abfd); |
_bfd_elf_assign_file_position_for_section (symtab_hdr, off, TRUE); |
/* Note that at this point elf_next_file_pos (abfd) is |
incorrect. We do not yet know the size of the .symtab section. |
We correct next_file_pos below, after we do know the size. */ |
/* Allocate a buffer to hold swapped out symbols. This is to avoid |
continuously seeking to the right position in the file. */ |
if (! info->keep_memory || max_sym_count < 20) |
flinfo.symbuf_size = 20; |
else |
flinfo.symbuf_size = max_sym_count; |
amt = flinfo.symbuf_size; |
amt *= bed->s->sizeof_sym; |
flinfo.symbuf = (bfd_byte *) bfd_malloc (amt); |
if (flinfo.symbuf == NULL) |
goto error_return; |
if (elf_numsections (abfd) > (SHN_LORESERVE & 0xFFFF)) |
{ |
/* Wild guess at number of output symbols. realloc'd as needed. */ |
amt = 2 * max_sym_count + elf_numsections (abfd) + 1000; |
flinfo.shndxbuf_size = amt; |
amt *= sizeof (Elf_External_Sym_Shndx); |
flinfo.symshndxbuf = (Elf_External_Sym_Shndx *) bfd_zmalloc (amt); |
if (flinfo.symshndxbuf == NULL) |
goto error_return; |
} |
/* Start writing out the symbol table. The first symbol is always a |
dummy symbol. */ |
if (info->strip != strip_all |
|| emit_relocs) |
{ |
elfsym.st_value = 0; |
elfsym.st_size = 0; |
elfsym.st_info = 0; |
10745,10 → 11186,9 |
elfsym.st_other = 0; |
elfsym.st_shndx = SHN_UNDEF; |
elfsym.st_target_internal = 0; |
if (elf_link_output_sym (&flinfo, NULL, &elfsym, bfd_und_section_ptr, |
NULL) != 1) |
if (elf_link_output_symstrtab (&flinfo, NULL, &elfsym, |
bfd_und_section_ptr, NULL) != 1) |
goto error_return; |
} |
/* Output a symbol for each section. We output these even if we are |
discarding local symbols, since they are used for relocs. These |
10755,9 → 11195,7 |
symbols have no names. We store the index of each one in the |
index field of the section, so that we can find it again when |
outputting relocs. */ |
if (info->strip != strip_all |
|| emit_relocs) |
{ |
elfsym.st_size = 0; |
elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION); |
elfsym.st_other = 0; |
10770,9 → 11208,10 |
{ |
o->target_index = bfd_get_symcount (abfd); |
elfsym.st_shndx = i; |
if (!info->relocatable) |
if (!bfd_link_relocatable (info)) |
elfsym.st_value = o->vma; |
if (elf_link_output_sym (&flinfo, NULL, &elfsym, o, NULL) != 1) |
if (elf_link_output_symstrtab (&flinfo, NULL, &elfsym, o, |
NULL) != 1) |
goto error_return; |
} |
} |
10871,6 → 11310,9 |
return FALSE; |
} |
if (!_bfd_elf_fixup_eh_frame_hdr (info)) |
return FALSE; |
/* Since ELF permits relocations to be against local symbols, we |
must have the local symbols available when we do the relocations. |
Since we would rather only read the local symbols once, and we |
10891,7 → 11333,7 |
we could write the relocs out and then read them again; I don't |
know how bad the memory loss will be. */ |
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) |
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next) |
sub->output_has_begun = FALSE; |
for (o = abfd->sections; o != NULL; o = o->next) |
{ |
10953,7 → 11395,7 |
/* Free symbol buffer if needed. */ |
if (!info->reduce_memory_overheads) |
{ |
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) |
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next) |
if (bfd_get_flavour (sub) == bfd_target_elf_flavour |
&& elf_tdata (sub)->symbuf) |
{ |
10962,17 → 11404,6 |
} |
} |
/* Output a FILE symbol so that following locals are not associated |
with the wrong input file. */ |
memset (&elfsym, 0, sizeof (elfsym)); |
elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE); |
elfsym.st_shndx = SHN_ABS; |
if (flinfo.filesym_count > 1 |
&& !elf_link_output_sym (&flinfo, NULL, &elfsym, |
bfd_und_section_ptr, NULL)) |
return FALSE; |
/* Output any global symbols that got converted to local in a |
version script or due to symbol visibility. We do this in a |
separate step since ELF requires all local symbols to appear |
10982,28 → 11413,15 |
eoinfo.failed = FALSE; |
eoinfo.flinfo = &flinfo; |
eoinfo.localsyms = TRUE; |
eoinfo.need_second_pass = FALSE; |
eoinfo.second_pass = FALSE; |
eoinfo.file_sym_done = FALSE; |
bfd_hash_traverse (&info->hash->table, elf_link_output_extsym, &eoinfo); |
if (eoinfo.failed) |
return FALSE; |
if (flinfo.filesym_count == 1 |
&& !elf_link_output_sym (&flinfo, NULL, &elfsym, |
bfd_und_section_ptr, NULL)) |
return FALSE; |
if (eoinfo.need_second_pass) |
{ |
eoinfo.second_pass = TRUE; |
bfd_hash_traverse (&info->hash->table, elf_link_output_extsym, &eoinfo); |
if (eoinfo.failed) |
return FALSE; |
} |
/* If backend needs to output some local symbols not present in the hash |
table, do it now. */ |
if (bed->elf_backend_output_arch_local_syms) |
if (bed->elf_backend_output_arch_local_syms |
&& (info->strip != strip_all || emit_relocs)) |
{ |
typedef int (*out_sym_func) |
(void *, const char *, Elf_Internal_Sym *, asection *, |
11010,7 → 11428,8 |
struct elf_link_hash_entry *); |
if (! ((*bed->elf_backend_output_arch_local_syms) |
(abfd, info, &flinfo, (out_sym_func) elf_link_output_sym))) |
(abfd, info, &flinfo, |
(out_sym_func) elf_link_output_symstrtab))) |
return FALSE; |
} |
11023,15 → 11442,17 |
symtab_hdr->sh_info = bfd_get_symcount (abfd); |
if (dynamic |
&& flinfo.dynsym_sec != NULL |
&& flinfo.dynsym_sec->output_section != bfd_abs_section_ptr) |
&& elf_hash_table (info)->dynsym != NULL |
&& (elf_hash_table (info)->dynsym->output_section |
!= bfd_abs_section_ptr)) |
{ |
Elf_Internal_Sym sym; |
bfd_byte *dynsym = flinfo.dynsym_sec->contents; |
bfd_byte *dynsym = elf_hash_table (info)->dynsym->contents; |
long last_local = 0; |
/* Write out the section symbols for the output sections. */ |
if (info->shared || elf_hash_table (info)->is_relocatable_executable) |
if (bfd_link_pic (info) |
|| elf_hash_table (info)->is_relocatable_executable) |
{ |
asection *s; |
11099,7 → 11520,7 |
} |
} |
elf_section_data (flinfo.dynsym_sec->output_section)->this_hdr.sh_info = |
elf_section_data (elf_hash_table (info)->dynsym->output_section)->this_hdr.sh_info = |
last_local + 1; |
} |
11113,7 → 11534,8 |
/* If backend needs to output some symbols not present in the hash |
table, do it now. */ |
if (bed->elf_backend_output_arch_syms) |
if (bed->elf_backend_output_arch_syms |
&& (info->strip != strip_all || emit_relocs)) |
{ |
typedef int (*out_sym_func) |
(void *, const char *, Elf_Internal_Sym *, asection *, |
11120,19 → 11542,28 |
struct elf_link_hash_entry *); |
if (! ((*bed->elf_backend_output_arch_syms) |
(abfd, info, &flinfo, (out_sym_func) elf_link_output_sym))) |
(abfd, info, &flinfo, |
(out_sym_func) elf_link_output_symstrtab))) |
return FALSE; |
} |
/* Flush all symbols to the file. */ |
if (! elf_link_flush_output_syms (&flinfo, bed)) |
/* Finalize the .strtab section. */ |
_bfd_elf_strtab_finalize (flinfo.symstrtab); |
/* Swap out the .strtab section. */ |
if (!elf_link_swap_symbols_out (&flinfo)) |
return FALSE; |
/* Now we know the size of the symtab section. */ |
off += symtab_hdr->sh_size; |
if (bfd_get_symcount (abfd) > 0) |
{ |
/* Finish up and write out the symbol string table (.strtab) |
section. */ |
Elf_Internal_Shdr *symstrtab_hdr; |
file_ptr off = symtab_hdr->sh_offset + symtab_hdr->sh_size; |
symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; |
if (symtab_shndx_hdr->sh_name != 0) |
symtab_shndx_hdr = & elf_symtab_shndx_list (abfd)->hdr; |
if (symtab_shndx_hdr != NULL && symtab_shndx_hdr->sh_name != 0) |
{ |
symtab_shndx_hdr->sh_type = SHT_SYMTAB_SHNDX; |
symtab_shndx_hdr->sh_entsize = sizeof (Elf_External_Sym_Shndx); |
11148,15 → 11579,12 |
return FALSE; |
} |
/* Finish up and write out the symbol string table (.strtab) |
section. */ |
symstrtab_hdr = &elf_tdata (abfd)->strtab_hdr; |
/* sh_name was set in prep_headers. */ |
symstrtab_hdr->sh_type = SHT_STRTAB; |
symstrtab_hdr->sh_flags = 0; |
symstrtab_hdr->sh_addr = 0; |
symstrtab_hdr->sh_size = _bfd_stringtab_size (flinfo.symstrtab); |
symstrtab_hdr->sh_size = _bfd_elf_strtab_size (flinfo.symstrtab); |
symstrtab_hdr->sh_entsize = 0; |
symstrtab_hdr->sh_link = 0; |
symstrtab_hdr->sh_info = 0; |
11163,13 → 11591,12 |
/* sh_offset is set just below. */ |
symstrtab_hdr->sh_addralign = 1; |
off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, off, TRUE); |
off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, |
off, TRUE); |
elf_next_file_pos (abfd) = off; |
if (bfd_get_symcount (abfd) > 0) |
{ |
if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0 |
|| ! _bfd_stringtab_emit (abfd, flinfo.symstrtab)) |
|| ! _bfd_elf_strtab_emit (abfd, flinfo.symstrtab)) |
return FALSE; |
} |
11177,13 → 11604,17 |
for (o = abfd->sections; o != NULL; o = o->next) |
{ |
struct bfd_elf_section_data *esdo = elf_section_data (o); |
bfd_boolean sort; |
if ((o->flags & SEC_RELOC) == 0) |
continue; |
if (esdo->rel.hdr != NULL) |
elf_link_adjust_relocs (abfd, &esdo->rel); |
if (esdo->rela.hdr != NULL) |
elf_link_adjust_relocs (abfd, &esdo->rela); |
sort = bed->sort_relocs_p == NULL || (*bed->sort_relocs_p) (o); |
if (esdo->rel.hdr != NULL |
&& !elf_link_adjust_relocs (abfd, &esdo->rel, sort)) |
return FALSE; |
if (esdo->rela.hdr != NULL |
&& !elf_link_adjust_relocs (abfd, &esdo->rela, sort)) |
return FALSE; |
/* Set the reloc_count field to 0 to prevent write_relocs from |
trying to swap the relocs out itself. */ |
11374,7 → 11805,7 |
goto error_return; |
/* Check for DT_TEXTREL (late, in case the backend removes it). */ |
if (((info->warn_shared_textrel && info->shared) |
if (((info->warn_shared_textrel && bfd_link_pic (info)) |
|| info->error_textrel) |
&& (o = bfd_get_linker_section (dynobj, ".dynamic")) != NULL) |
{ |
11430,6 → 11861,8 |
{ |
/* The contents of the .dynstr section are actually in a |
stringtab. */ |
file_ptr off; |
off = elf_section_data (o->output_section)->this_hdr.sh_offset; |
if (bfd_seek (abfd, off, SEEK_SET) != 0 |
|| ! _bfd_elf_strtab_emit (abfd, |
11439,7 → 11872,7 |
} |
} |
if (info->relocatable) |
if (bfd_link_relocatable (info)) |
{ |
bfd_boolean failed = FALSE; |
11623,8 → 12056,6 |
struct elf_link_hash_entry *h, |
Elf_Internal_Sym *sym) |
{ |
const char *sec_name; |
if (h != NULL) |
{ |
switch (h->root.type) |
11636,33 → 12067,6 |
case bfd_link_hash_common: |
return h->root.u.c.p->section; |
case bfd_link_hash_undefined: |
case bfd_link_hash_undefweak: |
/* To work around a glibc bug, keep all XXX input sections |
when there is an as yet undefined reference to __start_XXX |
or __stop_XXX symbols. The linker will later define such |
symbols for orphan input sections that have a name |
representable as a C identifier. */ |
if (strncmp (h->root.root.string, "__start_", 8) == 0) |
sec_name = h->root.root.string + 8; |
else if (strncmp (h->root.root.string, "__stop_", 7) == 0) |
sec_name = h->root.root.string + 7; |
else |
sec_name = NULL; |
if (sec_name && *sec_name != '\0') |
{ |
bfd *i; |
for (i = info->input_bfds; i; i = i->link_next) |
{ |
sec = bfd_get_section_by_name (i, sec_name); |
if (sec) |
sec->flags |= SEC_KEEP; |
} |
} |
break; |
default: |
break; |
} |
11680,7 → 12084,8 |
asection * |
_bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec, |
elf_gc_mark_hook_fn gc_mark_hook, |
struct elf_reloc_cookie *cookie) |
struct elf_reloc_cookie *cookie, |
bfd_boolean *start_stop) |
{ |
unsigned long r_symndx; |
struct elf_link_hash_entry *h; |
11693,6 → 12098,12 |
|| ELF_ST_BIND (cookie->locsyms[r_symndx].st_info) != STB_LOCAL) |
{ |
h = cookie->sym_hashes[r_symndx - cookie->extsymoff]; |
if (h == NULL) |
{ |
info->callbacks->einfo (_("%F%P: corrupt input: %B\n"), |
sec->owner); |
return NULL; |
} |
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; |
11703,6 → 12114,38 |
handling copy relocs. */ |
if (h->u.weakdef != NULL) |
h->u.weakdef->mark = 1; |
if (start_stop != NULL |
&& (h->root.type == bfd_link_hash_undefined |
|| h->root.type == bfd_link_hash_undefweak)) |
{ |
/* To work around a glibc bug, mark all XXX input sections |
when there is an as yet undefined reference to __start_XXX |
or __stop_XXX symbols. The linker will later define such |
symbols for orphan input sections that have a name |
representable as a C identifier. */ |
const char *sec_name = NULL; |
if (strncmp (h->root.root.string, "__start_", 8) == 0) |
sec_name = h->root.root.string + 8; |
else if (strncmp (h->root.root.string, "__stop_", 7) == 0) |
sec_name = h->root.root.string + 7; |
if (sec_name != NULL && *sec_name != '\0') |
{ |
bfd *i; |
for (i = info->input_bfds; i != NULL; i = i->link.next) |
{ |
asection *s = bfd_get_section_by_name (i, sec_name); |
if (s != NULL && !s->gc_mark) |
{ |
*start_stop = TRUE; |
return s; |
} |
} |
} |
} |
return (*gc_mark_hook) (sec, info, cookie->rel, h, NULL); |
} |
11721,10 → 12164,13 |
struct elf_reloc_cookie *cookie) |
{ |
asection *rsec; |
bfd_boolean start_stop = FALSE; |
rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie); |
if (rsec && !rsec->gc_mark) |
rsec = _bfd_elf_gc_mark_rsec (info, sec, gc_mark_hook, cookie, &start_stop); |
while (rsec != NULL) |
{ |
if (!rsec->gc_mark) |
{ |
if (bfd_get_flavour (rsec->owner) != bfd_target_elf_flavour |
|| (rsec->owner->flags & DYNAMIC) != 0) |
rsec->gc_mark = 1; |
11731,6 → 12177,10 |
else if (!_bfd_elf_gc_mark (info, rsec, gc_mark_hook)) |
return FALSE; |
} |
if (!start_stop) |
break; |
rsec = bfd_get_next_section_by_name (rsec->owner, rsec); |
} |
return TRUE; |
} |
11792,9 → 12242,55 |
} |
} |
eh_frame = elf_section_eh_frame_entry (sec); |
if (ret && eh_frame && !eh_frame->gc_mark) |
if (!_bfd_elf_gc_mark (info, eh_frame, gc_mark_hook)) |
ret = FALSE; |
return ret; |
} |
/* Scan and mark sections in a special or debug section group. */ |
static void |
_bfd_elf_gc_mark_debug_special_section_group (asection *grp) |
{ |
/* Point to first section of section group. */ |
asection *ssec; |
/* Used to iterate the section group. */ |
asection *msec; |
bfd_boolean is_special_grp = TRUE; |
bfd_boolean is_debug_grp = TRUE; |
/* First scan to see if group contains any section other than debug |
and special section. */ |
ssec = msec = elf_next_in_group (grp); |
do |
{ |
if ((msec->flags & SEC_DEBUGGING) == 0) |
is_debug_grp = FALSE; |
if ((msec->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) != 0) |
is_special_grp = FALSE; |
msec = elf_next_in_group (msec); |
} |
while (msec != ssec); |
/* If this is a pure debug section group or pure special section group, |
keep all sections in this group. */ |
if (is_debug_grp || is_special_grp) |
{ |
do |
{ |
msec->gc_mark = 1; |
msec = elf_next_in_group (msec); |
} |
while (msec != ssec); |
} |
} |
/* Keep debug and special sections. */ |
bfd_boolean |
11803,7 → 12299,7 |
{ |
bfd *ibfd; |
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next) |
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) |
{ |
asection *isec; |
bfd_boolean some_kept; |
11835,13 → 12331,17 |
continue; |
/* Keep debug and special sections like .comment when they are |
not part of a group, or when we have single-member groups. */ |
not part of a group. Also keep section groups that contain |
just debug sections or special sections. */ |
for (isec = ibfd->sections; isec != NULL; isec = isec->next) |
if ((elf_next_in_group (isec) == NULL |
|| elf_next_in_group (isec) == isec) |
&& ((isec->flags & SEC_DEBUGGING) != 0 |
|| (isec->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0)) |
{ |
if ((isec->flags & SEC_GROUP) != 0) |
_bfd_elf_gc_mark_debug_special_section_group (isec); |
else if (((isec->flags & SEC_DEBUGGING) != 0 |
|| (isec->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0) |
&& elf_next_in_group (isec) == NULL) |
isec->gc_mark = 1; |
} |
if (! debug_frag_seen) |
continue; |
11877,7 → 12377,6 |
isec->name, ilen) == 0) |
{ |
dsec->gc_mark = 0; |
break; |
} |
} |
} |
11900,7 → 12399,7 |
if (!h->mark |
&& (((h->root.type == bfd_link_hash_defined |
|| h->root.type == bfd_link_hash_defweak) |
&& !(h->def_regular |
&& !((h->def_regular || ELF_COMMON_DEF_P (h)) |
&& h->root.u.def.section->gc_mark)) |
|| h->root.type == bfd_link_hash_undefined |
|| h->root.type == bfd_link_hash_undefweak)) |
11931,11 → 12430,12 |
unsigned long section_sym_count; |
struct elf_gc_sweep_symbol_info sweep_info; |
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) |
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next) |
{ |
asection *o; |
if (bfd_get_flavour (sub) != bfd_target_elf_flavour) |
if (bfd_get_flavour (sub) != bfd_target_elf_flavour |
|| !(*bed->relocs_compatible) (sub->xvec, abfd->xvec)) |
continue; |
for (o = sub->sections; o != NULL; o = o->next) |
11968,7 → 12468,9 |
info we collected before. */ |
if (gc_sweep_hook |
&& (o->flags & SEC_RELOC) != 0 |
&& o->reloc_count > 0 |
&& o->reloc_count != 0 |
&& !((info->strip == strip_all || info->strip == strip_debugger) |
&& (o->flags & SEC_DEBUGGING) != 0) |
&& !bfd_is_abs_section (o->output_section)) |
{ |
Elf_Internal_Rela *internal_relocs; |
12116,15 → 12618,20 |
bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf) |
{ |
struct bfd_link_info *info = (struct bfd_link_info *) inf; |
struct bfd_elf_dynamic_list *d = info->dynamic_list; |
if ((h->root.type == bfd_link_hash_defined |
|| h->root.type == bfd_link_hash_defweak) |
&& (h->ref_dynamic |
|| ((!info->executable || info->export_dynamic) |
&& h->def_regular |
|| ((h->def_regular || ELF_COMMON_DEF_P (h)) |
&& ELF_ST_VISIBILITY (h->other) != STV_INTERNAL |
&& ELF_ST_VISIBILITY (h->other) != STV_HIDDEN |
&& (strchr (h->root.root.string, ELF_VER_CHR) != NULL |
&& (!bfd_link_executable (info) |
|| info->export_dynamic |
|| (h->dynamic |
&& d != NULL |
&& (*d->match) (&d->head, NULL, h->root.root.string))) |
&& (h->versioned >= versioned |
|| !bfd_hide_sym_by_version (info->version_info, |
h->root.root.string))))) |
h->root.u.def.section->flags |= SEC_KEEP; |
12155,6 → 12662,36 |
} |
} |
bfd_boolean |
bfd_elf_parse_eh_frame_entries (bfd *abfd ATTRIBUTE_UNUSED, |
struct bfd_link_info *info) |
{ |
bfd *ibfd = info->input_bfds; |
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) |
{ |
asection *sec; |
struct elf_reloc_cookie cookie; |
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour) |
continue; |
if (!init_reloc_cookie (&cookie, info, ibfd)) |
return FALSE; |
for (sec = ibfd->sections; sec; sec = sec->next) |
{ |
if (CONST_STRNEQ (bfd_section_name (ibfd, sec), ".eh_frame_entry") |
&& init_reloc_cookie_rels (&cookie, info, ibfd, sec)) |
{ |
_bfd_elf_parse_eh_frame_entry (info, sec, &cookie); |
fini_reloc_cookie_rels (&cookie, sec); |
} |
} |
} |
return TRUE; |
} |
/* Do mark and sweep of unused sections. */ |
bfd_boolean |
12164,6 → 12701,7 |
bfd *sub; |
elf_gc_mark_hook_fn gc_mark_hook; |
const struct elf_backend_data *bed = get_elf_backend_data (abfd); |
struct elf_link_hash_table *htab; |
if (!bed->can_gc_sections |
|| !is_elf_hash_table (info->hash)) |
12173,11 → 12711,13 |
} |
bed->gc_keep (info); |
htab = elf_hash_table (info); |
/* Try to parse each bfd's .eh_frame section. Point elf_eh_frame_section |
at the .eh_frame section if we can mark the FDEs individually. */ |
_bfd_elf_begin_eh_frame_parsing (info); |
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) |
for (sub = info->input_bfds; |
info->eh_frame_hdr_type != COMPACT_EH_HDR && sub != NULL; |
sub = sub->link.next) |
{ |
asection *sec; |
struct elf_reloc_cookie cookie; |
12190,38 → 12730,32 |
&& (sec->flags & SEC_LINKER_CREATED) == 0) |
elf_eh_frame_section (sub) = sec; |
fini_reloc_cookie_for_section (&cookie, sec); |
sec = bfd_get_next_section_by_name (sec); |
sec = bfd_get_next_section_by_name (NULL, sec); |
} |
} |
_bfd_elf_end_eh_frame_parsing (info); |
/* Apply transitive closure to the vtable entry usage info. */ |
elf_link_hash_traverse (elf_hash_table (info), |
elf_gc_propagate_vtable_entries_used, |
&ok); |
elf_link_hash_traverse (htab, elf_gc_propagate_vtable_entries_used, &ok); |
if (!ok) |
return FALSE; |
/* Kill the vtable relocations that were not used. */ |
elf_link_hash_traverse (elf_hash_table (info), |
elf_gc_smash_unused_vtentry_relocs, |
&ok); |
elf_link_hash_traverse (htab, elf_gc_smash_unused_vtentry_relocs, &ok); |
if (!ok) |
return FALSE; |
/* Mark dynamically referenced symbols. */ |
if (elf_hash_table (info)->dynamic_sections_created) |
elf_link_hash_traverse (elf_hash_table (info), |
bed->gc_mark_dynamic_ref, |
info); |
if (htab->dynamic_sections_created) |
elf_link_hash_traverse (htab, bed->gc_mark_dynamic_ref, info); |
/* Grovel through relocs to find out who stays ... */ |
gc_mark_hook = bed->gc_mark_hook; |
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) |
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next) |
{ |
asection *o; |
if (bfd_get_flavour (sub) != bfd_target_elf_flavour) |
if (bfd_get_flavour (sub) != bfd_target_elf_flavour |
|| !(*bed->relocs_compatible) (sub->xvec, abfd->xvec)) |
continue; |
/* Start at sections marked with SEC_KEEP (ref _bfd_elf_gc_keep). |
12289,8 → 12823,8 |
win: |
if (!child->vtable) |
{ |
child->vtable = (struct elf_link_virtual_table_entry *) |
bfd_zalloc (abfd, sizeof (*child->vtable)); |
child->vtable = ((struct elf_link_virtual_table_entry *) |
bfd_zalloc (abfd, sizeof (*child->vtable))); |
if (!child->vtable) |
return FALSE; |
} |
12322,8 → 12856,8 |
if (!h->vtable) |
{ |
h->vtable = (struct elf_link_virtual_table_entry *) |
bfd_zalloc (abfd, sizeof (*h->vtable)); |
h->vtable = ((struct elf_link_virtual_table_entry *) |
bfd_zalloc (abfd, sizeof (*h->vtable))); |
if (!h->vtable) |
return FALSE; |
} |
12526,7 → 13060,7 |
gotoff = bed->got_header_size; |
/* Do the local .got entries first. */ |
for (i = info->input_bfds; i; i = i->link_next) |
for (i = info->input_bfds; i; i = i->link.next) |
{ |
bfd_signed_vma *local_got; |
bfd_size_type j, locsymcount; |
12615,10 → 13149,10 |
if ((h->root.type == bfd_link_hash_defined |
|| h->root.type == bfd_link_hash_defweak) |
&& discarded_section (h->root.u.def.section)) |
&& (h->root.u.def.section->owner != rcookie->abfd |
|| h->root.u.def.section->kept_section != NULL |
|| discarded_section (h->root.u.def.section))) |
return TRUE; |
else |
return FALSE; |
} |
else |
{ |
12631,7 → 13165,9 |
/* Need to: get the symbol; get the section. */ |
isym = &rcookie->locsyms[r_symndx]; |
isec = bfd_section_from_elf_index (rcookie->abfd, isym->st_shndx); |
if (isec != NULL && discarded_section (isec)) |
if (isec != NULL |
&& (isec->kept_section != NULL |
|| discarded_section (isec))) |
return TRUE; |
} |
return FALSE; |
12640,94 → 13176,110 |
} |
/* Discard unneeded references to discarded sections. |
Returns TRUE if any section's size was changed. */ |
/* This function assumes that the relocations are in sorted order, |
which is true for all known assemblers. */ |
Returns -1 on error, 1 if any section's size was changed, 0 if |
nothing changed. This function assumes that the relocations are in |
sorted order, which is true for all known assemblers. */ |
bfd_boolean |
int |
bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) |
{ |
struct elf_reloc_cookie cookie; |
asection *stab, *eh; |
const struct elf_backend_data *bed; |
asection *o; |
bfd *abfd; |
bfd_boolean ret = FALSE; |
int changed = 0; |
if (info->traditional_format |
|| !is_elf_hash_table (info->hash)) |
return FALSE; |
return 0; |
_bfd_elf_begin_eh_frame_parsing (info); |
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next) |
o = bfd_get_section_by_name (output_bfd, ".stab"); |
if (o != NULL) |
{ |
asection *i; |
for (i = o->map_head.s; i != NULL; i = i->map_head.s) |
{ |
if (i->size == 0 |
|| i->reloc_count == 0 |
|| i->sec_info_type != SEC_INFO_TYPE_STABS) |
continue; |
abfd = i->owner; |
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) |
continue; |
bed = get_elf_backend_data (abfd); |
if (!init_reloc_cookie_for_section (&cookie, info, i)) |
return -1; |
eh = NULL; |
if (!info->relocatable) |
{ |
eh = bfd_get_section_by_name (abfd, ".eh_frame"); |
while (eh != NULL |
&& (eh->size == 0 |
|| bfd_is_abs_section (eh->output_section))) |
eh = bfd_get_next_section_by_name (eh); |
if (_bfd_discard_section_stabs (abfd, i, |
elf_section_data (i)->sec_info, |
bfd_elf_reloc_symbol_deleted_p, |
&cookie)) |
changed = 1; |
fini_reloc_cookie_for_section (&cookie, i); |
} |
} |
stab = bfd_get_section_by_name (abfd, ".stab"); |
if (stab != NULL |
&& (stab->size == 0 |
|| bfd_is_abs_section (stab->output_section) |
|| stab->sec_info_type != SEC_INFO_TYPE_STABS)) |
stab = NULL; |
o = NULL; |
if (info->eh_frame_hdr_type != COMPACT_EH_HDR) |
o = bfd_get_section_by_name (output_bfd, ".eh_frame"); |
if (o != NULL) |
{ |
asection *i; |
if (stab == NULL |
&& eh == NULL |
&& bed->elf_backend_discard_info == NULL) |
for (i = o->map_head.s; i != NULL; i = i->map_head.s) |
{ |
if (i->size == 0) |
continue; |
if (!init_reloc_cookie (&cookie, info, abfd)) |
return FALSE; |
abfd = i->owner; |
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) |
continue; |
if (stab != NULL |
&& stab->reloc_count > 0 |
&& init_reloc_cookie_rels (&cookie, info, abfd, stab)) |
{ |
if (_bfd_discard_section_stabs (abfd, stab, |
elf_section_data (stab)->sec_info, |
if (!init_reloc_cookie_for_section (&cookie, info, i)) |
return -1; |
_bfd_elf_parse_eh_frame (abfd, info, i, &cookie); |
if (_bfd_elf_discard_section_eh_frame (abfd, info, i, |
bfd_elf_reloc_symbol_deleted_p, |
&cookie)) |
ret = TRUE; |
fini_reloc_cookie_rels (&cookie, stab); |
changed = 1; |
fini_reloc_cookie_for_section (&cookie, i); |
} |
} |
while (eh != NULL |
&& init_reloc_cookie_rels (&cookie, info, abfd, eh)) |
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next) |
{ |
_bfd_elf_parse_eh_frame (abfd, info, eh, &cookie); |
if (_bfd_elf_discard_section_eh_frame (abfd, info, eh, |
bfd_elf_reloc_symbol_deleted_p, |
&cookie)) |
ret = TRUE; |
fini_reloc_cookie_rels (&cookie, eh); |
eh = bfd_get_next_section_by_name (eh); |
} |
const struct elf_backend_data *bed; |
if (bed->elf_backend_discard_info != NULL |
&& (*bed->elf_backend_discard_info) (abfd, &cookie, info)) |
ret = TRUE; |
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour) |
continue; |
bed = get_elf_backend_data (abfd); |
if (bed->elf_backend_discard_info != NULL) |
{ |
if (!init_reloc_cookie (&cookie, info, abfd)) |
return -1; |
if ((*bed->elf_backend_discard_info) (abfd, &cookie, info)) |
changed = 1; |
fini_reloc_cookie (&cookie, abfd); |
} |
} |
if (info->eh_frame_hdr_type == COMPACT_EH_HDR) |
_bfd_elf_end_eh_frame_parsing (info); |
if (info->eh_frame_hdr |
&& !info->relocatable |
if (info->eh_frame_hdr_type |
&& !bfd_link_relocatable (info) |
&& _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info)) |
ret = TRUE; |
changed = 1; |
return ret; |
return changed; |
} |
bfd_boolean |
13011,17 → 13563,24 |
return reloc_sec; |
} |
/* Copy the ELF symbol type associated with a linker hash entry. */ |
/* Copy the ELF symbol type and other attributes for a linker script |
assignment from HSRC to HDEST. Generally this should be treated as |
if we found a strong non-dynamic definition for HDEST (except that |
ld ignores multiple definition errors). */ |
void |
_bfd_elf_copy_link_hash_symbol_type (bfd *abfd ATTRIBUTE_UNUSED, |
_bfd_elf_copy_link_hash_symbol_type (bfd *abfd, |
struct bfd_link_hash_entry * hdest, |
struct bfd_link_hash_entry * hsrc) |
{ |
struct elf_link_hash_entry *ehdest = (struct elf_link_hash_entry *)hdest; |
struct elf_link_hash_entry *ehsrc = (struct elf_link_hash_entry *)hsrc; |
Elf_Internal_Sym isym; |
ehdest->type = ehsrc->type; |
ehdest->target_internal = ehsrc->target_internal; |
isym.st_other = ehsrc->other; |
elf_merge_st_other (abfd, ehdest, &isym, NULL, TRUE, FALSE); |
} |
/* Append a RELA relocation REL to section S in BFD. */ |
/contrib/toolchain/binutils/bfd/format.c |
---|
1,6 → 1,5 |
/* Generic BFD support for file formats. |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, |
2003, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
403,7 → 402,7 |
/* We still have more than one equally good match, and at least some |
of the targets support match priority. Choose the first of the |
best matches. */ |
if (match_count > 1 && best_count != match_count) |
if (matching_vector && match_count > 1 && best_count != match_count) |
{ |
int i; |
/contrib/toolchain/binutils/bfd/genlink.h |
---|
1,5 → 1,5 |
/* genlink.h -- interface to the BFD generic linker |
Copyright 1993, 1994, 1996, 2002, 2005, 2007 Free Software Foundation, Inc. |
Copyright (C) 1993-2015 Free Software Foundation, Inc. |
Written by Ian Lance Taylor, Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
/contrib/toolchain/binutils/bfd/hash.c |
---|
1,6 → 1,5 |
/* hash.c -- hash table routines for BFD |
Copyright 1993, 1994, 1995, 1997, 1999, 2001, 2002, 2003, 2004, 2005, |
2006, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. |
Copyright (C) 1993-2015 Free Software Foundation, Inc. |
Written by Steve Chamberlain <sac@cygnus.com> |
This file is part of BFD, the Binary File Descriptor library. |
393,6 → 392,7 |
objalloc_alloc ((struct objalloc *) table->memory, alloc); |
if (table->table == NULL) |
{ |
bfd_hash_table_free (table); |
bfd_set_error (bfd_error_no_memory); |
return FALSE; |
} |
/contrib/toolchain/binutils/bfd/ihex.c |
---|
1,6 → 1,5 |
/* BFD back-end for Intel Hex objects. |
Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
2006, 2007, 2009, 2011 Free Software Foundation, Inc. |
Copyright (C) 1995-2015 Free Software Foundation, Inc. |
Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>. |
This file is part of BFD, the Binary File Descriptor library. |
220,7 → 219,7 |
char buf[10]; |
if (! ISPRINT (c)) |
sprintf (buf, "\\%03o", (unsigned int) c); |
sprintf (buf, "\\%03o", (unsigned int) c & 0xff); |
else |
{ |
buf[0] = c; |
277,7 → 276,7 |
else |
{ |
file_ptr pos; |
char hdr[8]; |
unsigned char hdr[8]; |
unsigned int i; |
unsigned int len; |
bfd_vma addr; |
322,7 → 321,7 |
{ |
if (! ISHEX (buf[i])) |
{ |
ihex_bad_byte (abfd, lineno, hdr[i], error); |
ihex_bad_byte (abfd, lineno, buf[i], error); |
goto error_return; |
} |
} |
554,7 → 553,7 |
error = FALSE; |
while ((c = ihex_get_byte (abfd, &error)) != EOF) |
{ |
char hdr[8]; |
unsigned char hdr[8]; |
unsigned int len; |
unsigned int type; |
unsigned int i; |
919,10 → 918,12 |
#define ihex_make_empty_symbol _bfd_generic_make_empty_symbol |
#define ihex_print_symbol _bfd_nosymbols_print_symbol |
#define ihex_get_symbol_info _bfd_nosymbols_get_symbol_info |
#define ihex_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string |
#define ihex_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) |
#define ihex_bfd_is_local_label_name _bfd_nosymbols_bfd_is_local_label_name |
#define ihex_get_lineno _bfd_nosymbols_get_lineno |
#define ihex_find_nearest_line _bfd_nosymbols_find_nearest_line |
#define ihex_find_line _bfd_nosymbols_find_line |
#define ihex_find_inliner_info _bfd_nosymbols_find_inliner_info |
#define ihex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol |
#define ihex_read_minisymbols _bfd_nosymbols_read_minisymbols |
937,7 → 938,6 |
#define ihex_section_already_linked _bfd_generic_section_already_linked |
#define ihex_bfd_define_common_symbol bfd_generic_define_common_symbol |
#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create |
#define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols |
#define ihex_bfd_link_just_syms _bfd_generic_link_just_syms |
#define ihex_bfd_copy_link_hash_symbol_type \ |
/contrib/toolchain/binutils/bfd/init.c |
---|
1,6 → 1,5 |
/* bfd initialization stuff |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 2003, 2005, 2007 |
Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Steve Chamberlain of Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
/contrib/toolchain/binutils/bfd/libaout.h |
---|
1,7 → 1,5 |
/* BFD back-end data structures for a.out (and similar) files. |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 |
Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
553,8 → 551,8 |
(bfd *, asymbol *, symbol_info *); |
extern bfd_boolean NAME (aout, find_nearest_line) |
(bfd *, asection *, asymbol **, bfd_vma, const char **, |
const char **, unsigned int *); |
(bfd *, asymbol **, asection *, bfd_vma, |
const char **, const char **, unsigned int *, unsigned int *); |
extern long NAME (aout, read_minisymbols) |
(bfd *, bfd_boolean, void * *, unsigned int *); |
/contrib/toolchain/binutils/bfd/libbfd.c |
---|
1,7 → 1,5 |
/* Assorted BFD support routines, only used internally. |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 |
Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
173,15 → 171,18 |
bfd_malloc (bfd_size_type size) |
{ |
void *ptr; |
size_t sz = (size_t) size; |
if (size != (size_t) size) |
if (size != sz |
/* This is to pacify memory checkers like valgrind. */ |
|| ((signed long) sz) < 0) |
{ |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
} |
ptr = malloc ((size_t) size); |
if (ptr == NULL && (size_t) size != 0) |
ptr = malloc (sz); |
if (ptr == NULL && sz != 0) |
bfd_set_error (bfd_error_no_memory); |
return ptr; |
192,8 → 193,6 |
void * |
bfd_malloc2 (bfd_size_type nmemb, bfd_size_type size) |
{ |
void *ptr; |
if ((nmemb | size) >= HALF_BFD_SIZE_TYPE |
&& size != 0 |
&& nmemb > ~(bfd_size_type) 0 / size) |
202,21 → 201,9 |
return NULL; |
} |
size *= nmemb; |
if (size != (size_t) size) |
{ |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
return bfd_malloc (size * nmemb); |
} |
ptr = malloc ((size_t) size); |
if (ptr == NULL && (size_t) size != 0) |
bfd_set_error (bfd_error_no_memory); |
return ptr; |
} |
/* Reallocate memory using realloc. */ |
void * |
223,19 → 210,22 |
bfd_realloc (void *ptr, bfd_size_type size) |
{ |
void *ret; |
size_t sz = (size_t) size; |
if (size != (size_t) size) |
if (ptr == NULL) |
return bfd_malloc (size); |
if (size != sz |
/* This is to pacify memory checkers like valgrind. */ |
|| ((signed long) sz) < 0) |
{ |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
} |
if (ptr == NULL) |
ret = malloc ((size_t) size); |
else |
ret = realloc (ptr, (size_t) size); |
ret = realloc (ptr, sz); |
if (ret == NULL && (size_t) size != 0) |
if (ret == NULL && sz != 0) |
bfd_set_error (bfd_error_no_memory); |
return ret; |
246,8 → 236,6 |
void * |
bfd_realloc2 (void *ptr, bfd_size_type nmemb, bfd_size_type size) |
{ |
void *ret; |
if ((nmemb | size) >= HALF_BFD_SIZE_TYPE |
&& size != 0 |
&& nmemb > ~(bfd_size_type) 0 / size) |
256,25 → 244,9 |
return NULL; |
} |
size *= nmemb; |
if (size != (size_t) size) |
{ |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
return bfd_realloc (ptr, size * nmemb); |
} |
if (ptr == NULL) |
ret = malloc ((size_t) size); |
else |
ret = realloc (ptr, (size_t) size); |
if (ret == NULL && (size_t) size != 0) |
bfd_set_error (bfd_error_no_memory); |
return ret; |
} |
/* Reallocate memory using realloc. |
If this fails the pointer is freed before returning. */ |
281,24 → 253,10 |
void * |
bfd_realloc_or_free (void *ptr, bfd_size_type size) |
{ |
size_t amount = (size_t) size; |
void *ret; |
void *ret = bfd_realloc (ptr, size); |
if (size != amount) |
ret = NULL; |
else if (ptr == NULL) |
ret = malloc (amount); |
else |
ret = realloc (ptr, amount); |
if (ret == NULL) |
{ |
if (amount > 0) |
bfd_set_error (bfd_error_no_memory); |
if (ptr != NULL) |
if (ret == NULL && ptr != NULL) |
free (ptr); |
} |
return ret; |
} |
308,23 → 266,10 |
void * |
bfd_zmalloc (bfd_size_type size) |
{ |
void *ptr; |
void *ptr = bfd_malloc (size); |
if (size != (size_t) size) |
{ |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
} |
ptr = malloc ((size_t) size); |
if ((size_t) size != 0) |
{ |
if (ptr == NULL) |
bfd_set_error (bfd_error_no_memory); |
else |
if (ptr != NULL && size > 0) |
memset (ptr, 0, (size_t) size); |
} |
return ptr; |
} |
335,34 → 280,16 |
void * |
bfd_zmalloc2 (bfd_size_type nmemb, bfd_size_type size) |
{ |
void *ptr; |
void *ptr = bfd_malloc2 (nmemb, size); |
if ((nmemb | size) >= HALF_BFD_SIZE_TYPE |
&& size != 0 |
&& nmemb > ~(bfd_size_type) 0 / size) |
if (ptr != NULL) |
{ |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
} |
size_t sz = nmemb * size; |
size *= nmemb; |
if (size != (size_t) size) |
{ |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
if (sz > 0) |
memset (ptr, 0, sz); |
} |
ptr = malloc ((size_t) size); |
if ((size_t) size != 0) |
{ |
if (ptr == NULL) |
bfd_set_error (bfd_error_no_memory); |
else |
memset (ptr, 0, (size_t) size); |
} |
return ptr; |
} |
550,11 → 477,10 |
.*/ |
/* Sign extension to bfd_signed_vma. */ |
#define COERCE16(x) (((bfd_signed_vma) (x) ^ 0x8000) - 0x8000) |
#define COERCE32(x) (((bfd_signed_vma) (x) ^ 0x80000000) - 0x80000000) |
#define EIGHT_GAZILLION ((bfd_int64_t) 1 << 63) |
#define COERCE16(x) (((bfd_vma) (x) ^ 0x8000) - 0x8000) |
#define COERCE32(x) (((bfd_vma) (x) ^ 0x80000000) - 0x80000000) |
#define COERCE64(x) \ |
(((bfd_int64_t) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION) |
(((bfd_uint64_t) (x) ^ ((bfd_uint64_t) 1 << 63)) - ((bfd_uint64_t) 1 << 63)) |
bfd_vma |
bfd_getb16 (const void *p) |
1077,6 → 1003,45 |
return result; |
} |
/* Read in a LEB128 encoded value from ABFD starting at DATA. |
If SIGN is true, return a signed LEB128 value. |
If LENGTH_RETURN is not NULL, return in it the number of bytes read. |
No bytes will be read at address END or beyond. */ |
bfd_vma |
safe_read_leb128 (bfd *abfd ATTRIBUTE_UNUSED, |
bfd_byte *data, |
unsigned int *length_return, |
bfd_boolean sign, |
const bfd_byte * const end) |
{ |
bfd_vma result = 0; |
unsigned int num_read = 0; |
unsigned int shift = 0; |
unsigned char byte = 0; |
while (data < end) |
{ |
byte = bfd_get_8 (abfd, data); |
data++; |
num_read++; |
result |= ((bfd_vma) (byte & 0x7f)) << shift; |
shift += 7; |
if ((byte & 0x80) == 0) |
break; |
} |
if (length_return != NULL) |
*length_return = num_read; |
if (sign && (shift < 8 * sizeof (result)) && (byte & 0x40)) |
result |= -((bfd_vma) 1 << shift); |
return result; |
} |
/* Helper function for reading sleb128 encoded data. */ |
bfd_signed_vma |
1108,29 → 1073,6 |
} |
bfd_boolean |
_bfd_generic_find_line (bfd *abfd ATTRIBUTE_UNUSED, |
asymbol **symbols ATTRIBUTE_UNUSED, |
asymbol *symbol ATTRIBUTE_UNUSED, |
const char **filename_ptr ATTRIBUTE_UNUSED, |
unsigned int *linenumber_ptr ATTRIBUTE_UNUSED) |
{ |
return FALSE; |
} |
bfd_boolean |
_bfd_generic_find_nearest_line_discriminator (bfd *abfd ATTRIBUTE_UNUSED, |
asection *section ATTRIBUTE_UNUSED, |
asymbol **symbols ATTRIBUTE_UNUSED, |
bfd_vma offset ATTRIBUTE_UNUSED, |
const char **filename_ptr ATTRIBUTE_UNUSED, |
const char **functionname_ptr ATTRIBUTE_UNUSED, |
unsigned int *line_ptr ATTRIBUTE_UNUSED, |
unsigned int *discriminator_ptr ATTRIBUTE_UNUSED) |
{ |
return FALSE; |
} |
bfd_boolean |
_bfd_generic_init_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED, |
asection *isec ATTRIBUTE_UNUSED, |
bfd *obfd ATTRIBUTE_UNUSED, |
/contrib/toolchain/binutils/bfd/libbfd.h |
---|
6,10 → 6,7 |
/* libbfd.h -- Declarations used by bfd library *implementation*. |
(This include file is not for users of the library.) |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, |
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, |
2010, 2011, 2012 |
Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
32,6 → 29,10 |
#include "hashtab.h" |
#ifdef __cplusplus |
extern "C" { |
#endif |
/* Align an address upward to a boundary, expressed as a number of bytes. |
E.g. align to an 8-byte boundary with argument of 8. Take care never |
to wrap around if the address is within boundary-1 of the end of the |
400,6 → 401,8 |
((void (*) (bfd *, void *, asymbol *, bfd_print_symbol_type)) bfd_void) |
#define _bfd_nosymbols_get_symbol_info \ |
((void (*) (bfd *, asymbol *, symbol_info *)) bfd_void) |
#define _bfd_nosymbols_get_symbol_version_string \ |
((const char *(*) (bfd *, asymbol *, bfd_boolean *)) bfd_nullvoidptr) |
#define _bfd_nosymbols_bfd_is_local_label_name \ |
((bfd_boolean (*) (bfd *, const char *)) bfd_false) |
#define _bfd_nosymbols_bfd_is_target_special_symbol \ |
407,7 → 410,12 |
#define _bfd_nosymbols_get_lineno \ |
((alent *(*) (bfd *, asymbol *)) bfd_nullvoidptr) |
#define _bfd_nosymbols_find_nearest_line \ |
((bfd_boolean (*) (bfd *, asection *, asymbol **, bfd_vma, const char **, \ |
((bfd_boolean (*) (bfd *, asymbol **, asection *, bfd_vma, \ |
const char **, const char **, unsigned int *, \ |
unsigned int *)) \ |
bfd_false) |
#define _bfd_nosymbols_find_line \ |
((bfd_boolean (*) (bfd *, asymbol **, asymbol *, \ |
const char **, unsigned int *)) \ |
bfd_false) |
#define _bfd_nosymbols_find_inliner_info \ |
479,8 → 487,6 |
bfd_false) |
#define _bfd_nolink_bfd_link_hash_table_create \ |
((struct bfd_link_hash_table *(*) (bfd *)) bfd_nullvoidptr) |
#define _bfd_nolink_bfd_link_hash_table_free \ |
((void (*) (struct bfd_link_hash_table *)) bfd_void) |
#define _bfd_nolink_bfd_link_add_symbols \ |
((bfd_boolean (*) (bfd *, struct bfd_link_info *)) bfd_false) |
#define _bfd_nolink_bfd_link_just_syms \ |
530,8 → 536,8 |
/* Find the nearest line using DWARF 1 debugging information. */ |
extern bfd_boolean _bfd_dwarf1_find_nearest_line |
(bfd *, asection *, asymbol **, bfd_vma, const char **, |
const char **, unsigned int *); |
(bfd *, asymbol **, asection *, bfd_vma, |
const char **, const char **, unsigned int *); |
struct dwarf_debug_section |
{ |
546,22 → 552,14 |
/* Find the nearest line using DWARF 2 debugging information. */ |
extern bfd_boolean _bfd_dwarf2_find_nearest_line |
(bfd *, const struct dwarf_debug_section *, asection *, asymbol **, bfd_vma, |
const char **, const char **, unsigned int *, unsigned int *, unsigned int, |
void **); |
(bfd *, asymbol **, asymbol *, asection *, bfd_vma, |
const char **, const char **, unsigned int *, unsigned int *, |
const struct dwarf_debug_section *, unsigned int, void **); |
/* Find the line using DWARF 2 debugging information. */ |
extern bfd_boolean _bfd_dwarf2_find_line |
(bfd *, asymbol **, asymbol *, const char **, |
unsigned int *, unsigned int *, unsigned int, void **); |
/* Find the bias between DWARF addresses and real addresses. */ |
extern bfd_signed_vma _bfd_dwarf2_find_symbol_bias |
(asymbol **, void **); |
bfd_boolean _bfd_generic_find_line |
(bfd *, asymbol **, asymbol *, const char **, unsigned int *); |
bfd_boolean _bfd_generic_find_nearest_line_discriminator |
(bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, |
unsigned int *, unsigned int *); |
/* Find inliner info after calling bfd_find_nearest_line. */ |
extern bfd_boolean _bfd_dwarf2_find_inliner_info |
(bfd *, const char **, const char **, unsigned int *, void **); |
568,7 → 566,8 |
/* Read DWARF 2 debugging information. */ |
extern bfd_boolean _bfd_dwarf2_slurp_debug_info |
(bfd *, bfd *, const struct dwarf_debug_section *, asymbol **, void **); |
(bfd *, bfd *, const struct dwarf_debug_section *, asymbol **, void **, |
bfd_boolean); |
/* Clean up the data used to handle DWARF 2 debugging information. */ |
extern void _bfd_dwarf2_cleanup_debug_info |
597,7 → 596,7 |
/* Generic link hash table destruction routine. */ |
extern void _bfd_generic_link_hash_table_free |
(struct bfd_link_hash_table *); |
(bfd *); |
/* Generic add symbol routine. */ |
extern bfd_boolean _bfd_generic_link_add_symbols |
612,7 → 611,9 |
/* Generic archive add symbol routine. */ |
extern bfd_boolean _bfd_generic_link_add_archive_symbols |
(bfd *, struct bfd_link_info *, |
bfd_boolean (*) (bfd *, struct bfd_link_info *, bfd_boolean *)); |
bfd_boolean (*) (bfd *, struct bfd_link_info *, |
struct bfd_link_hash_entry *, const char *, |
bfd_boolean *)); |
/* Forward declaration to avoid prototype errors. */ |
typedef struct bfd_link_hash_entry _bfd_link_hash_entry; |
851,6 → 852,8 |
extern bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *); |
extern bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *); |
extern bfd_vma safe_read_leb128 (bfd *, bfd_byte *, unsigned int *, |
bfd_boolean, const bfd_byte * const); |
/* Extracted from init.c. */ |
/* Extracted from libbfd.c. */ |
bfd_boolean bfd_write_bigendian_4byte_int (bfd *, unsigned int); |
1128,6 → 1131,10 |
"BFD_RELOC_MICROMIPS_7_PCREL_S1", |
"BFD_RELOC_MICROMIPS_10_PCREL_S1", |
"BFD_RELOC_MICROMIPS_16_PCREL_S1", |
"BFD_RELOC_MIPS_21_PCREL_S2", |
"BFD_RELOC_MIPS_26_PCREL_S2", |
"BFD_RELOC_MIPS_18_PCREL_S3", |
"BFD_RELOC_MIPS_19_PCREL_S2", |
"BFD_RELOC_MICROMIPS_GPREL16", |
"BFD_RELOC_MICROMIPS_HI16", |
"BFD_RELOC_MICROMIPS_HI16_S", |
1194,6 → 1201,11 |
"BFD_RELOC_MOXIE_10_PCREL", |
"BFD_RELOC_FT32_10", |
"BFD_RELOC_FT32_20", |
"BFD_RELOC_FT32_17", |
"BFD_RELOC_FT32_18", |
"BFD_RELOC_FRV_LABEL16", |
"BFD_RELOC_FRV_LABEL24", |
"BFD_RELOC_FRV_LO16", |
1280,6 → 1292,7 |
"BFD_RELOC_386_TLS_DESC_CALL", |
"BFD_RELOC_386_TLS_DESC", |
"BFD_RELOC_386_IRELATIVE", |
"BFD_RELOC_386_GOT32X", |
"BFD_RELOC_X86_64_GOT32", |
"BFD_RELOC_X86_64_PLT32", |
"BFD_RELOC_X86_64_COPY", |
1309,6 → 1322,8 |
"BFD_RELOC_X86_64_IRELATIVE", |
"BFD_RELOC_X86_64_PC32_BND", |
"BFD_RELOC_X86_64_PLT32_BND", |
"BFD_RELOC_X86_64_GOTPCRELX", |
"BFD_RELOC_X86_64_REX_GOTPCRELX", |
"BFD_RELOC_NS32K_IMM_8", |
"BFD_RELOC_NS32K_IMM_16", |
"BFD_RELOC_NS32K_IMM_32", |
1376,6 → 1391,7 |
"BFD_RELOC_PPC_VLE_SDAREL_HI16D", |
"BFD_RELOC_PPC_VLE_SDAREL_HA16A", |
"BFD_RELOC_PPC_VLE_SDAREL_HA16D", |
"BFD_RELOC_PPC_REL16DX_HA", |
"BFD_RELOC_PPC64_HIGHER", |
"BFD_RELOC_PPC64_HIGHER_S", |
"BFD_RELOC_PPC64_HIGHEST", |
1401,6 → 1417,8 |
"BFD_RELOC_PPC64_PLTGOT16_LO_DS", |
"BFD_RELOC_PPC64_ADDR16_HIGH", |
"BFD_RELOC_PPC64_ADDR16_HIGHA", |
"BFD_RELOC_PPC64_ADDR64_LOCAL", |
"BFD_RELOC_PPC64_ENTRY", |
"BFD_RELOC_PPC_TLS", |
"BFD_RELOC_PPC_TLSGD", |
"BFD_RELOC_PPC_TLSLD", |
1650,8 → 1668,72 |
"BFD_RELOC_SH_GOTOFFFUNCDESC", |
"BFD_RELOC_SH_GOTOFFFUNCDESC20", |
"BFD_RELOC_SH_FUNCDESC", |
"BFD_RELOC_ARC_B22_PCREL", |
"BFD_RELOC_ARC_B26", |
"BFD_RELOC_ARC_NONE", |
"BFD_RELOC_ARC_8", |
"BFD_RELOC_ARC_16", |
"BFD_RELOC_ARC_24", |
"BFD_RELOC_ARC_32", |
"BFD_RELOC_ARC_N8", |
"BFD_RELOC_ARC_N16", |
"BFD_RELOC_ARC_N24", |
"BFD_RELOC_ARC_N32", |
"BFD_RELOC_ARC_SDA", |
"BFD_RELOC_ARC_SECTOFF", |
"BFD_RELOC_ARC_S21H_PCREL", |
"BFD_RELOC_ARC_S21W_PCREL", |
"BFD_RELOC_ARC_S25H_PCREL", |
"BFD_RELOC_ARC_S25W_PCREL", |
"BFD_RELOC_ARC_SDA32", |
"BFD_RELOC_ARC_SDA_LDST", |
"BFD_RELOC_ARC_SDA_LDST1", |
"BFD_RELOC_ARC_SDA_LDST2", |
"BFD_RELOC_ARC_SDA16_LD", |
"BFD_RELOC_ARC_SDA16_LD1", |
"BFD_RELOC_ARC_SDA16_LD2", |
"BFD_RELOC_ARC_S13_PCREL", |
"BFD_RELOC_ARC_W", |
"BFD_RELOC_ARC_32_ME", |
"BFD_RELOC_ARC_32_ME_S", |
"BFD_RELOC_ARC_N32_ME", |
"BFD_RELOC_ARC_SECTOFF_ME", |
"BFD_RELOC_ARC_SDA32_ME", |
"BFD_RELOC_ARC_W_ME", |
"BFD_RELOC_AC_SECTOFF_U8", |
"BFD_RELOC_AC_SECTOFF_U8_1", |
"BFD_RELOC_AC_SECTOFF_U8_2", |
"BFD_RELOC_AC_SECTFOFF_S9", |
"BFD_RELOC_AC_SECTFOFF_S9_1", |
"BFD_RELOC_AC_SECTFOFF_S9_2", |
"BFD_RELOC_ARC_SECTOFF_ME_1", |
"BFD_RELOC_ARC_SECTOFF_ME_2", |
"BFD_RELOC_ARC_SECTOFF_1", |
"BFD_RELOC_ARC_SECTOFF_2", |
"BFD_RELOC_ARC_SDA16_ST2", |
"BFD_RELOC_ARC_32_PCREL", |
"BFD_RELOC_ARC_PC32", |
"BFD_RELOC_ARC_GOT32", |
"BFD_RELOC_ARC_GOTPC32", |
"BFD_RELOC_ARC_PLT32", |
"BFD_RELOC_ARC_COPY", |
"BFD_RELOC_ARC_GLOB_DAT", |
"BFD_RELOC_ARC_JMP_SLOT", |
"BFD_RELOC_ARC_RELATIVE", |
"BFD_RELOC_ARC_GOTOFF", |
"BFD_RELOC_ARC_GOTPC", |
"BFD_RELOC_ARC_S21W_PCREL_PLT", |
"BFD_RELOC_ARC_S25H_PCREL_PLT", |
"BFD_RELOC_ARC_TLS_DTPMOD", |
"BFD_RELOC_ARC_TLS_TPOFF", |
"BFD_RELOC_ARC_TLS_GD_GOT", |
"BFD_RELOC_ARC_TLS_GD_LD", |
"BFD_RELOC_ARC_TLS_GD_CALL", |
"BFD_RELOC_ARC_TLS_IE_GOT", |
"BFD_RELOC_ARC_TLS_DTPOFF", |
"BFD_RELOC_ARC_TLS_DTPOFF_S9", |
"BFD_RELOC_ARC_TLS_LE_S9", |
"BFD_RELOC_ARC_TLS_LE_32", |
"BFD_RELOC_ARC_S25W_PCREL_PLT", |
"BFD_RELOC_ARC_S21H_PCREL_PLT", |
"BFD_RELOC_BFIN_16_IMM", |
"BFD_RELOC_BFIN_16_HIGH", |
"BFD_RELOC_BFIN_4_PCREL", |
1746,6 → 1828,121 |
"BFD_RELOC_M32R_GOTPC_HI_ULO", |
"BFD_RELOC_M32R_GOTPC_HI_SLO", |
"BFD_RELOC_M32R_GOTPC_LO", |
"BFD_RELOC_NDS32_20", |
"BFD_RELOC_NDS32_9_PCREL", |
"BFD_RELOC_NDS32_WORD_9_PCREL", |
"BFD_RELOC_NDS32_15_PCREL", |
"BFD_RELOC_NDS32_17_PCREL", |
"BFD_RELOC_NDS32_25_PCREL", |
"BFD_RELOC_NDS32_HI20", |
"BFD_RELOC_NDS32_LO12S3", |
"BFD_RELOC_NDS32_LO12S2", |
"BFD_RELOC_NDS32_LO12S1", |
"BFD_RELOC_NDS32_LO12S0", |
"BFD_RELOC_NDS32_LO12S0_ORI", |
"BFD_RELOC_NDS32_SDA15S3", |
"BFD_RELOC_NDS32_SDA15S2", |
"BFD_RELOC_NDS32_SDA15S1", |
"BFD_RELOC_NDS32_SDA15S0", |
"BFD_RELOC_NDS32_SDA16S3", |
"BFD_RELOC_NDS32_SDA17S2", |
"BFD_RELOC_NDS32_SDA18S1", |
"BFD_RELOC_NDS32_SDA19S0", |
"BFD_RELOC_NDS32_GOT20", |
"BFD_RELOC_NDS32_9_PLTREL", |
"BFD_RELOC_NDS32_25_PLTREL", |
"BFD_RELOC_NDS32_COPY", |
"BFD_RELOC_NDS32_GLOB_DAT", |
"BFD_RELOC_NDS32_JMP_SLOT", |
"BFD_RELOC_NDS32_RELATIVE", |
"BFD_RELOC_NDS32_GOTOFF", |
"BFD_RELOC_NDS32_GOTOFF_HI20", |
"BFD_RELOC_NDS32_GOTOFF_LO12", |
"BFD_RELOC_NDS32_GOTPC20", |
"BFD_RELOC_NDS32_GOT_HI20", |
"BFD_RELOC_NDS32_GOT_LO12", |
"BFD_RELOC_NDS32_GOTPC_HI20", |
"BFD_RELOC_NDS32_GOTPC_LO12", |
"BFD_RELOC_NDS32_INSN16", |
"BFD_RELOC_NDS32_LABEL", |
"BFD_RELOC_NDS32_LONGCALL1", |
"BFD_RELOC_NDS32_LONGCALL2", |
"BFD_RELOC_NDS32_LONGCALL3", |
"BFD_RELOC_NDS32_LONGJUMP1", |
"BFD_RELOC_NDS32_LONGJUMP2", |
"BFD_RELOC_NDS32_LONGJUMP3", |
"BFD_RELOC_NDS32_LOADSTORE", |
"BFD_RELOC_NDS32_9_FIXED", |
"BFD_RELOC_NDS32_15_FIXED", |
"BFD_RELOC_NDS32_17_FIXED", |
"BFD_RELOC_NDS32_25_FIXED", |
"BFD_RELOC_NDS32_LONGCALL4", |
"BFD_RELOC_NDS32_LONGCALL5", |
"BFD_RELOC_NDS32_LONGCALL6", |
"BFD_RELOC_NDS32_LONGJUMP4", |
"BFD_RELOC_NDS32_LONGJUMP5", |
"BFD_RELOC_NDS32_LONGJUMP6", |
"BFD_RELOC_NDS32_LONGJUMP7", |
"BFD_RELOC_NDS32_PLTREL_HI20", |
"BFD_RELOC_NDS32_PLTREL_LO12", |
"BFD_RELOC_NDS32_PLT_GOTREL_HI20", |
"BFD_RELOC_NDS32_PLT_GOTREL_LO12", |
"BFD_RELOC_NDS32_SDA12S2_DP", |
"BFD_RELOC_NDS32_SDA12S2_SP", |
"BFD_RELOC_NDS32_LO12S2_DP", |
"BFD_RELOC_NDS32_LO12S2_SP", |
"BFD_RELOC_NDS32_DWARF2_OP1", |
"BFD_RELOC_NDS32_DWARF2_OP2", |
"BFD_RELOC_NDS32_DWARF2_LEB", |
"BFD_RELOC_NDS32_UPDATE_TA", |
"BFD_RELOC_NDS32_PLT_GOTREL_LO20", |
"BFD_RELOC_NDS32_PLT_GOTREL_LO15", |
"BFD_RELOC_NDS32_PLT_GOTREL_LO19", |
"BFD_RELOC_NDS32_GOT_LO15", |
"BFD_RELOC_NDS32_GOT_LO19", |
"BFD_RELOC_NDS32_GOTOFF_LO15", |
"BFD_RELOC_NDS32_GOTOFF_LO19", |
"BFD_RELOC_NDS32_GOT15S2", |
"BFD_RELOC_NDS32_GOT17S2", |
"BFD_RELOC_NDS32_5", |
"BFD_RELOC_NDS32_10_UPCREL", |
"BFD_RELOC_NDS32_SDA_FP7U2_RELA", |
"BFD_RELOC_NDS32_RELAX_ENTRY", |
"BFD_RELOC_NDS32_GOT_SUFF", |
"BFD_RELOC_NDS32_GOTOFF_SUFF", |
"BFD_RELOC_NDS32_PLT_GOT_SUFF", |
"BFD_RELOC_NDS32_MULCALL_SUFF", |
"BFD_RELOC_NDS32_PTR", |
"BFD_RELOC_NDS32_PTR_COUNT", |
"BFD_RELOC_NDS32_PTR_RESOLVED", |
"BFD_RELOC_NDS32_PLTBLOCK", |
"BFD_RELOC_NDS32_RELAX_REGION_BEGIN", |
"BFD_RELOC_NDS32_RELAX_REGION_END", |
"BFD_RELOC_NDS32_MINUEND", |
"BFD_RELOC_NDS32_SUBTRAHEND", |
"BFD_RELOC_NDS32_DIFF8", |
"BFD_RELOC_NDS32_DIFF16", |
"BFD_RELOC_NDS32_DIFF32", |
"BFD_RELOC_NDS32_DIFF_ULEB128", |
"BFD_RELOC_NDS32_EMPTY", |
"BFD_RELOC_NDS32_25_ABS", |
"BFD_RELOC_NDS32_DATA", |
"BFD_RELOC_NDS32_TRAN", |
"BFD_RELOC_NDS32_17IFC_PCREL", |
"BFD_RELOC_NDS32_10IFCU_PCREL", |
"BFD_RELOC_NDS32_TPOFF", |
"BFD_RELOC_NDS32_TLS_LE_HI20", |
"BFD_RELOC_NDS32_TLS_LE_LO12", |
"BFD_RELOC_NDS32_TLS_LE_ADD", |
"BFD_RELOC_NDS32_TLS_LE_LS", |
"BFD_RELOC_NDS32_GOTTPOFF", |
"BFD_RELOC_NDS32_TLS_IE_HI20", |
"BFD_RELOC_NDS32_TLS_IE_LO12S2", |
"BFD_RELOC_NDS32_TLS_TPOFF", |
"BFD_RELOC_NDS32_TLS_LE_20", |
"BFD_RELOC_NDS32_TLS_LE_15S0", |
"BFD_RELOC_NDS32_TLS_LE_15S1", |
"BFD_RELOC_NDS32_TLS_LE_15S2", |
"BFD_RELOC_V850_9_PCREL", |
"BFD_RELOC_V850_22_PCREL", |
"BFD_RELOC_V850_SDA_16_16_OFFSET", |
1947,6 → 2144,12 |
"BFD_RELOC_AVR_8_LO", |
"BFD_RELOC_AVR_8_HI", |
"BFD_RELOC_AVR_8_HLO", |
"BFD_RELOC_AVR_DIFF8", |
"BFD_RELOC_AVR_DIFF16", |
"BFD_RELOC_AVR_DIFF32", |
"BFD_RELOC_AVR_LDS_STS_16", |
"BFD_RELOC_AVR_PORT6", |
"BFD_RELOC_AVR_PORT5", |
"BFD_RELOC_RL78_NEG8", |
"BFD_RELOC_RL78_NEG16", |
"BFD_RELOC_RL78_NEG24", |
1980,6 → 2183,7 |
"BFD_RELOC_RL78_HI8", |
"BFD_RELOC_RL78_LO16", |
"BFD_RELOC_RL78_CODE", |
"BFD_RELOC_RL78_SADDR", |
"BFD_RELOC_RX_NEG8", |
"BFD_RELOC_RX_NEG16", |
"BFD_RELOC_RX_NEG24", |
2355,8 → 2559,30 |
"BFD_RELOC_860_HIGH", |
"BFD_RELOC_860_HIGOT", |
"BFD_RELOC_860_HIGOTOFF", |
"BFD_RELOC_OPENRISC_ABS_26", |
"BFD_RELOC_OPENRISC_REL_26", |
"BFD_RELOC_OR1K_REL_26", |
"BFD_RELOC_OR1K_GOTPC_HI16", |
"BFD_RELOC_OR1K_GOTPC_LO16", |
"BFD_RELOC_OR1K_GOT16", |
"BFD_RELOC_OR1K_PLT26", |
"BFD_RELOC_OR1K_GOTOFF_HI16", |
"BFD_RELOC_OR1K_GOTOFF_LO16", |
"BFD_RELOC_OR1K_COPY", |
"BFD_RELOC_OR1K_GLOB_DAT", |
"BFD_RELOC_OR1K_JMP_SLOT", |
"BFD_RELOC_OR1K_RELATIVE", |
"BFD_RELOC_OR1K_TLS_GD_HI16", |
"BFD_RELOC_OR1K_TLS_GD_LO16", |
"BFD_RELOC_OR1K_TLS_LDM_HI16", |
"BFD_RELOC_OR1K_TLS_LDM_LO16", |
"BFD_RELOC_OR1K_TLS_LDO_HI16", |
"BFD_RELOC_OR1K_TLS_LDO_LO16", |
"BFD_RELOC_OR1K_TLS_IE_HI16", |
"BFD_RELOC_OR1K_TLS_IE_LO16", |
"BFD_RELOC_OR1K_TLS_LE_HI16", |
"BFD_RELOC_OR1K_TLS_LE_LO16", |
"BFD_RELOC_OR1K_TLS_TPOFF", |
"BFD_RELOC_OR1K_TLS_DTPOFF", |
"BFD_RELOC_OR1K_TLS_DTPMOD", |
"BFD_RELOC_H8_DIR16A8", |
"BFD_RELOC_H8_DIR16R8", |
"BFD_RELOC_H8_DIR24A8", |
2438,6 → 2664,24 |
"BFD_RELOC_NIOS2_JUMP_SLOT", |
"BFD_RELOC_NIOS2_RELATIVE", |
"BFD_RELOC_NIOS2_GOTOFF", |
"BFD_RELOC_NIOS2_CALL26_NOAT", |
"BFD_RELOC_NIOS2_GOT_LO", |
"BFD_RELOC_NIOS2_GOT_HA", |
"BFD_RELOC_NIOS2_CALL_LO", |
"BFD_RELOC_NIOS2_CALL_HA", |
"BFD_RELOC_NIOS2_R2_S12", |
"BFD_RELOC_NIOS2_R2_I10_1_PCREL", |
"BFD_RELOC_NIOS2_R2_T1I7_1_PCREL", |
"BFD_RELOC_NIOS2_R2_T1I7_2", |
"BFD_RELOC_NIOS2_R2_T2I4", |
"BFD_RELOC_NIOS2_R2_T2I4_1", |
"BFD_RELOC_NIOS2_R2_T2I4_2", |
"BFD_RELOC_NIOS2_R2_X1I7_2", |
"BFD_RELOC_NIOS2_R2_X2L5", |
"BFD_RELOC_NIOS2_R2_F1I5_2", |
"BFD_RELOC_NIOS2_R2_L5I4X1", |
"BFD_RELOC_NIOS2_R2_T1X1I6", |
"BFD_RELOC_NIOS2_R2_T1X1I6_2", |
"BFD_RELOC_IQ2000_OFFSET_16", |
"BFD_RELOC_IQ2000_OFFSET_21", |
"BFD_RELOC_IQ2000_UHI16", |
2572,14 → 2816,41 |
"BFD_RELOC_AARCH64_ADR_GOT_PAGE", |
"BFD_RELOC_AARCH64_LD64_GOT_LO12_NC", |
"BFD_RELOC_AARCH64_LD32_GOT_LO12_NC", |
"BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC", |
"BFD_RELOC_AARCH64_MOVW_GOTOFF_G1", |
"BFD_RELOC_AARCH64_LD64_GOTOFF_LO15", |
"BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14", |
"BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15", |
"BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21", |
"BFD_RELOC_AARCH64_TLSGD_ADR_PREL21", |
"BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC", |
"BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1", |
"BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC", |
"BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC", |
"BFD_RELOC_AARCH64_TLSGD_MOVW_G1", |
"BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21", |
"BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC", |
"BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC", |
"BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19", |
"BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC", |
"BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1", |
"BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12", |
"BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12", |
"BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC", |
"BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC", |
"BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21", |
"BFD_RELOC_AARCH64_TLSLD_ADR_PREL21", |
"BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12", |
"BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC", |
"BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12", |
"BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC", |
"BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12", |
"BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC", |
"BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12", |
"BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC", |
"BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0", |
"BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC", |
"BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1", |
"BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC", |
"BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2", |
"BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2", |
"BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1", |
"BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G1_NC", |
2611,6 → 2882,8 |
"BFD_RELOC_AARCH64_RELOC_END", |
"BFD_RELOC_AARCH64_GAS_INTERNAL_FIXUP", |
"BFD_RELOC_AARCH64_LDST_LO12", |
"BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12", |
"BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12_NC", |
"BFD_RELOC_AARCH64_LD_GOT_LO12_NC", |
"BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_LO12_NC", |
"BFD_RELOC_AARCH64_TLSDESC_LD_LO12_NC", |
2809,6 → 3082,13 |
"BFD_RELOC_EPIPHANY_SIMM11", |
"BFD_RELOC_EPIPHANY_IMM11", |
"BFD_RELOC_EPIPHANY_IMM8", |
"BFD_RELOC_VISIUM_HI16", |
"BFD_RELOC_VISIUM_LO16", |
"BFD_RELOC_VISIUM_IM16", |
"BFD_RELOC_VISIUM_REL16", |
"BFD_RELOC_VISIUM_HI16_PCREL", |
"BFD_RELOC_VISIUM_LO16_PCREL", |
"BFD_RELOC_VISIUM_IM16_PCREL", |
"@@overflow: BFD_RELOC_UNUSED@@", |
}; |
#endif |
2855,3 → 3135,6 |
bfd_boolean code); |
/* Extracted from elf.c. */ |
#ifdef __cplusplus |
} |
#endif |
/contrib/toolchain/binutils/bfd/libcoff.h |
---|
3,7 → 3,7 |
Run "make headers" in your build bfd/ to regenerate. */ |
/* BFD COFF object file private structure. |
Copyright 1990-2013 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
24,7 → 24,12 |
MA 02110-1301, USA. */ |
#include "bfdlink.h" |
#include "coff-bfd.h" |
#ifdef __cplusplus |
extern "C" { |
#endif |
/* Object file tdata; access macros. */ |
#define coff_data(bfd) ((bfd)->tdata.coff_obj_data) |
39,6 → 44,7 |
#define obj_coff_external_syms(bfd) (coff_data (bfd)->external_syms) |
#define obj_coff_keep_syms(bfd) (coff_data (bfd)->keep_syms) |
#define obj_coff_strings(bfd) (coff_data (bfd)->strings) |
#define obj_coff_strings_len(bfd) (coff_data (bfd)->strings_len) |
#define obj_coff_keep_strings(bfd) (coff_data (bfd)->keep_strings) |
#define obj_coff_sym_hashes(bfd) (coff_data (bfd)->sym_hashes) |
#define obj_coff_strings_written(bfd) (coff_data (bfd)->strings_written) |
57,7 → 63,7 |
unsigned long raw_syment_count; |
/* These are only valid once writing has begun. */ |
long int relocbase; |
unsigned long int relocbase; |
/* These members communicate important constants about the symbol table |
to GDB's symbol-reading code. These `constants' unfortunately vary |
79,6 → 85,8 |
/* The string table. May be NULL. Read by |
_bfd_coff_read_string_table. */ |
char *strings; |
/* The length of the strings table. For error checking. */ |
bfd_size_type strings_len; |
/* If this is TRUE, the strings may not be freed. */ |
bfd_boolean keep_strings; |
/* If this is TRUE, the strings have been written out already. */ |
123,6 → 131,14 |
bfd_boolean insert_timestamp; |
bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *); |
flagword real_flags; |
/* Build-id info. */ |
struct |
{ |
bfd_boolean (*after_write_object_contents) (bfd *); |
const char *style; |
asection *sec; |
} build_id; |
} pe_data_type; |
#define pe_data(bfd) ((bfd)->tdata.pe_obj_data) |
180,36 → 196,6 |
macro is only ever applied to an asymbol. */ |
#define coffsymbol(asymbol) ((coff_symbol_type *)(&((asymbol)->the_bfd))) |
/* 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) |
/* Tdata for sections in XCOFF files. This is used by the linker. */ |
struct xcoff_section_tdata |
283,6 → 269,16 |
struct stab_info stab_info; |
}; |
struct coff_reloc_cookie |
{ |
struct internal_reloc * rels; |
struct internal_reloc * rel; |
struct internal_reloc * relend; |
struct coff_symbol_struct * symbols; /* Symtab for input bfd. */ |
bfd * abfd; |
struct coff_link_hash_entry ** sym_hashes; |
}; |
/* Look up an entry in a COFF linker hash table. */ |
#define coff_link_hash_lookup(table, string, create, copy, follow) \ |
313,8 → 309,6 |
(bfd *, asymbol **); |
extern int coff_count_linenumbers |
(bfd *); |
extern struct coff_symbol_struct *coff_symbol_from |
(bfd *, asymbol *); |
extern bfd_boolean coff_renumber_symbols |
(bfd *, int *); |
extern void coff_mangle_symbols |
346,20 → 340,20 |
(bfd *, void * filep, asymbol *, bfd_print_symbol_type); |
extern void coff_get_symbol_info |
(bfd *, asymbol *, symbol_info *ret); |
#define coff_get_symbol_version_string \ |
_bfd_nosymbols_get_symbol_version_string |
extern bfd_boolean _bfd_coff_is_local_label_name |
(bfd *, const char *); |
extern asymbol *coff_bfd_make_debug_symbol |
(bfd *, void *, unsigned long); |
extern bfd_boolean coff_find_nearest_line |
(bfd *, asection *, asymbol **, bfd_vma, const char **, |
const char **, unsigned int *); |
extern bfd_boolean coff_find_nearest_line_discriminator |
(bfd *, asection *, asymbol **, bfd_vma, const char **, |
const char **, unsigned int *, unsigned int *); |
(bfd *, asymbol **, asection *, bfd_vma, |
const char **, const char **, unsigned int *, unsigned int *); |
#define coff_find_line _bfd_nosymbols_find_line |
struct dwarf_debug_section; |
extern bfd_boolean coff_find_nearest_line_with_names |
(bfd *, const struct dwarf_debug_section *, asection *, asymbol **, |
bfd_vma, const char **, const char **, unsigned int *); |
(bfd *, asymbol **, asection *, bfd_vma, const char **, const char **, |
unsigned int *, const struct dwarf_debug_section *); |
extern bfd_boolean coff_find_inliner_info |
(bfd *, const char **, const char **, unsigned int *); |
extern int coff_sizeof_headers |
582,6 → 576,8 |
extern bfd_boolean _bfd_coff_reloc_link_order |
(bfd *, struct coff_final_link_info *, asection *, |
struct bfd_link_order *); |
extern bfd_boolean bfd_coff_gc_sections |
(bfd *, struct bfd_link_info *); |
#define coff_get_section_contents_in_window \ |
599,8 → 595,6 |
(bfd *, arelent **, asymbol **); |
extern struct bfd_link_hash_table *_bfd_xcoff_bfd_link_hash_table_create |
(bfd *); |
extern void _bfd_xcoff_bfd_link_hash_table_free |
(struct bfd_link_hash_table *); |
extern bfd_boolean _bfd_xcoff_bfd_link_add_symbols |
(bfd *, struct bfd_link_info *); |
extern bfd_boolean _bfd_xcoff_bfd_final_link |
619,6 → 613,7 |
extern bfd_boolean ppc_process_before_allocation |
(bfd *, struct bfd_link_info *); |
/* Extracted from coffcode.h. */ |
typedef struct coff_ptr_struct |
{ |
/* Remembers the offset from the first symbol in the file for |
652,6 → 647,9 |
union internal_auxent auxent; |
struct internal_syment syment; |
} u; |
/* Selector for the union above. */ |
bfd_boolean is_sym; |
} combined_entry_type; |
687,6 → 685,10 |
COFF_SYMBOL_PE_SECTION |
}; |
typedef asection * (*coff_gc_mark_hook_fn) |
(asection *, struct bfd_link_info *, struct internal_reloc *, |
struct coff_link_hash_entry *, struct internal_syment *); |
typedef struct |
{ |
void (*_bfd_coff_swap_aux_in) |
736,6 → 738,7 |
unsigned int _bfd_coff_default_section_alignment_power; |
bfd_boolean _bfd_coff_force_symnames_in_strings; |
unsigned int _bfd_coff_debug_string_prefix_length; |
unsigned int _bfd_coff_max_nscns; |
void (*_bfd_coff_swap_filehdr_in) |
(bfd *, void *, void *); |
873,6 → 876,9 |
((coff_backend_info (abfd)->_bfd_coff_set_long_section_names) (abfd, enable)) |
#define bfd_coff_default_section_alignment_power(abfd) \ |
(coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power) |
#define bfd_coff_max_nscns(abfd) \ |
(coff_backend_info (abfd)->_bfd_coff_max_nscns) |
#define bfd_coff_swap_filehdr_in(abfd, i,o) \ |
((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o)) |
965,3 → 971,6 |
PE object file. */ |
#define bfd_pei_p(abfd) \ |
(CONST_STRNEQ ((abfd)->xvec->name, "pei-")) |
#ifdef __cplusplus |
} |
#endif |
/contrib/toolchain/binutils/bfd/libecoff.h |
---|
1,7 → 1,5 |
/* BFD ECOFF object file private structure. |
Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003, 2004, |
2005, 2006, 2007, 2008, 2009, 2010 |
Free Software Foundation, Inc. |
Copyright (C) 1993-2015 Free Software Foundation, Inc. |
Written by Ian Lance Taylor, Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
287,12 → 285,15 |
(bfd *, void *, asymbol *, bfd_print_symbol_type); |
extern void _bfd_ecoff_get_symbol_info |
(bfd *, asymbol *, symbol_info *); |
#define _bfd_ecoff_get_symbol_version_string \ |
_bfd_nosymbols_get_symbol_version_string |
extern bfd_boolean _bfd_ecoff_bfd_is_local_label_name |
(bfd *, const char *); |
#define _bfd_ecoff_get_lineno _bfd_nosymbols_get_lineno |
extern bfd_boolean _bfd_ecoff_find_nearest_line |
(bfd *, asection *, asymbol **, bfd_vma, const char **, const char **, |
unsigned int *); |
(bfd *, asymbol **, asection *, bfd_vma, |
const char **, const char **, unsigned int *, unsigned int *); |
#define _bfd_ecoff_find_line _bfd_nosymbols_find_line |
#define _bfd_ecoff_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol |
#define _bfd_ecoff_read_minisymbols _bfd_generic_read_minisymbols |
#define _bfd_ecoff_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol |
313,7 → 314,6 |
/* ecoff_bfd_relax_section defined by backend. */ |
extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create |
(bfd *); |
#define _bfd_ecoff_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
extern bfd_boolean _bfd_ecoff_bfd_link_add_symbols |
(bfd *, struct bfd_link_info *); |
#define _bfd_ecoff_bfd_link_just_syms _bfd_generic_link_just_syms |
/contrib/toolchain/binutils/bfd/libpei.h |
---|
1,6 → 1,5 |
/* Support for the generic parts of PE/PEI; common header information. |
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, |
2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
Copyright (C) 1995-2015 Free Software Foundation, Inc. |
Written by Cygnus Solutions. |
This file is part of BFD, the Binary File Descriptor library. |
236,6 → 235,10 |
#define _bfd_XXi_swap_scnhdr_out _bfd_pex64i_swap_scnhdr_out |
#define _bfd_XXi_swap_sym_in _bfd_pex64i_swap_sym_in |
#define _bfd_XXi_swap_sym_out _bfd_pex64i_swap_sym_out |
#define _bfd_XXi_swap_debugdir_in _bfd_pex64i_swap_debugdir_in |
#define _bfd_XXi_swap_debugdir_out _bfd_pex64i_swap_debugdir_out |
#define _bfd_XXi_write_codeview_record _bfd_pex64i_write_codeview_record |
#define _bfd_XXi_slurp_codeview_record _bfd_pex64i_slurp_codeview_record |
#elif defined COFF_WITH_pep |
267,6 → 270,10 |
#define _bfd_XXi_swap_scnhdr_out _bfd_pepi_swap_scnhdr_out |
#define _bfd_XXi_swap_sym_in _bfd_pepi_swap_sym_in |
#define _bfd_XXi_swap_sym_out _bfd_pepi_swap_sym_out |
#define _bfd_XXi_swap_debugdir_in _bfd_pepi_swap_debugdir_in |
#define _bfd_XXi_swap_debugdir_out _bfd_pepi_swap_debugdir_out |
#define _bfd_XXi_write_codeview_record _bfd_pepi_write_codeview_record |
#define _bfd_XXi_slurp_codeview_record _bfd_pepi_slurp_codeview_record |
#else /* !COFF_WITH_pep */ |
298,6 → 305,10 |
#define _bfd_XXi_swap_scnhdr_out _bfd_pei_swap_scnhdr_out |
#define _bfd_XXi_swap_sym_in _bfd_pei_swap_sym_in |
#define _bfd_XXi_swap_sym_out _bfd_pei_swap_sym_out |
#define _bfd_XXi_swap_debugdir_in _bfd_pei_swap_debugdir_in |
#define _bfd_XXi_swap_debugdir_out _bfd_pei_swap_debugdir_out |
#define _bfd_XXi_write_codeview_record _bfd_pei_write_codeview_record |
#define _bfd_XXi_slurp_codeview_record _bfd_pei_slurp_codeview_record |
#endif /* !COFF_WITH_pep */ |
340,6 → 351,10 |
bfd_boolean _bfd_XX_bfd_copy_private_bfd_data_common (bfd *, bfd *); |
void _bfd_XX_get_symbol_info (bfd *, asymbol *, symbol_info *); |
bfd_boolean _bfd_XXi_final_link_postscript (bfd *, struct coff_final_link_info *); |
void _bfd_XXi_swap_debugdir_in (bfd *, void *, void *); |
unsigned _bfd_XXi_swap_debugdir_out (bfd *, void *, void *); |
unsigned _bfd_XXi_write_codeview_record (bfd *, file_ptr, CODEVIEW_INFO *); |
CODEVIEW_INFO * _bfd_XXi_slurp_codeview_record (bfd * abfd, file_ptr where, unsigned long length, CODEVIEW_INFO *cvinfo); |
/* The following are needed only for ONE of pe or pei, but don't |
otherwise vary; peicode.h fixes up ifdefs but we provide the |
/contrib/toolchain/binutils/bfd/linker.c |
---|
1,7 → 1,5 |
/* linker.c -- BFD linker routines |
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 |
Free Software Foundation, Inc. |
Copyright (C) 1993-2015 Free Software Foundation, Inc. |
Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support |
This file is part of BFD, the Binary File Descriptor library. |
231,28 → 229,16 |
@findex _bfd_generic_link_add_archive_symbols |
In most cases the work of looking through the symbols in the |
archive should be done by the |
<<_bfd_generic_link_add_archive_symbols>> function. This |
function builds a hash table from the archive symbol table and |
looks through the list of undefined symbols to see which |
elements should be included. |
<<_bfd_generic_link_add_archive_symbols>> function. |
<<_bfd_generic_link_add_archive_symbols>> is passed a function |
to call to make the final decision about adding an archive |
element to the link and to do the actual work of adding the |
symbols to the linker hash table. |
The function passed to |
<<_bfd_generic_link_add_archive_symbols>> must read the |
symbols of the archive element and decide whether the archive |
element should be included in the link. If the element is to |
symbols to the linker hash table. If the element is to |
be included, the <<add_archive_element>> linker callback |
routine must be called with the element as an argument, and |
the element's symbols must be added to the linker hash table |
just as though the element had itself been passed to the |
<<_bfd_link_add_symbols>> function. The <<add_archive_element>> |
callback has the option to indicate that it would like to |
replace the element archive with a substitute BFD, in which |
case it is the symbols of that substitute BFD that must be |
added to the linker hash table instead. |
<<_bfd_link_add_symbols>> function. |
When the a.out <<_bfd_link_add_symbols>> function receives an |
archive, it calls <<_bfd_generic_link_add_archive_symbols>> |
315,7 → 301,7 |
The <<input_bfds>> field of the <<bfd_link_info>> structure |
will point to a list of all the input files included in the |
link. These files are linked through the <<link_next>> field |
link. These files are linked through the <<link.next>> field |
of the <<bfd>> structure. |
Each section in the output file will have a list of |
421,11 → 407,14 |
static bfd_boolean generic_link_add_symbols |
(bfd *, struct bfd_link_info *, bfd_boolean); |
static bfd_boolean generic_link_check_archive_element_no_collect |
(bfd *, struct bfd_link_info *, bfd_boolean *); |
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, const char *, |
bfd_boolean *); |
static bfd_boolean generic_link_check_archive_element_collect |
(bfd *, struct bfd_link_info *, bfd_boolean *); |
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, const char *, |
bfd_boolean *); |
static bfd_boolean generic_link_check_archive_element |
(bfd *, struct bfd_link_info *, bfd_boolean *, bfd_boolean); |
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, const char *, |
bfd_boolean *, bfd_boolean); |
static bfd_boolean generic_link_add_symbol_list |
(bfd *, struct bfd_link_info *, bfd_size_type count, asymbol **, |
bfd_boolean); |
484,12 → 473,23 |
const char *), |
unsigned int entsize) |
{ |
bfd_boolean ret; |
BFD_ASSERT (!abfd->is_linker_output && !abfd->link.hash); |
table->undefs = NULL; |
table->undefs_tail = NULL; |
table->type = bfd_link_generic_hash_table; |
return bfd_hash_table_init (&table->table, newfunc, entsize); |
ret = bfd_hash_table_init (&table->table, newfunc, entsize); |
if (ret) |
{ |
/* Arrange for destruction of this hash table on closing ABFD. */ |
table->hash_table_free = _bfd_generic_link_hash_table_free; |
abfd->link.hash = table; |
abfd->is_linker_output = TRUE; |
} |
return ret; |
} |
/* Look up a symbol in a link hash table. If follow is TRUE, we |
follow bfd_link_hash_indirect and bfd_link_hash_warning links to |
568,8 → 568,6 |
return h; |
} |
#undef WRAP |
#undef REAL |
#define REAL "__real_" |
604,6 → 602,42 |
return bfd_link_hash_lookup (info->hash, string, create, copy, follow); |
} |
/* If H is a wrapped symbol, ie. the symbol name starts with "__wrap_" |
and the remainder is found in wrap_hash, return the real symbol. */ |
struct bfd_link_hash_entry * |
unwrap_hash_lookup (struct bfd_link_info *info, |
bfd *input_bfd, |
struct bfd_link_hash_entry *h) |
{ |
const char *l = h->root.string; |
if (*l == bfd_get_symbol_leading_char (input_bfd) |
|| *l == info->wrap_char) |
++l; |
if (CONST_STRNEQ (l, WRAP)) |
{ |
l += sizeof WRAP - 1; |
if (bfd_hash_lookup (info->wrap_hash, l, FALSE, FALSE) != NULL) |
{ |
char save = 0; |
if (l - (sizeof WRAP - 1) != h->root.string) |
{ |
--l; |
save = *l; |
*(char *) l = *h->root.string; |
} |
h = bfd_link_hash_lookup (info->hash, l, FALSE, FALSE, FALSE); |
if (save) |
*(char *) l = save; |
} |
} |
return h; |
} |
#undef WRAP |
/* Traverse a generic link hash table. Differs from bfd_hash_traverse |
in the treatment of warning symbols. When warning symbols are |
created they replace the real symbol, so you don't get to see the |
739,13 → 773,16 |
} |
void |
_bfd_generic_link_hash_table_free (struct bfd_link_hash_table *hash) |
_bfd_generic_link_hash_table_free (bfd *obfd) |
{ |
struct generic_link_hash_table *ret |
= (struct generic_link_hash_table *) hash; |
struct generic_link_hash_table *ret; |
BFD_ASSERT (obfd->is_linker_output && obfd->link.hash); |
ret = (struct generic_link_hash_table *) obfd->link.hash; |
bfd_hash_table_free (&ret->root.table); |
free (ret); |
obfd->link.hash = NULL; |
obfd->is_linker_output = FALSE; |
} |
/* Grab the symbols for an object file when doing a generic link. We |
815,9 → 852,8 |
sec->output_offset = sec->vma; |
} |
/* Copy the type of a symbol assiciated with a linker hast table entry. |
Override this so that symbols created in linker scripts get their |
type from the RHS of the assignment. |
/* Copy the symbol type and other attributes for a linker script |
assignment from HSRC to HDEST. |
The default implementation does nothing. */ |
void |
_bfd_generic_copy_link_hash_symbol_type (bfd *abfd ATTRIBUTE_UNUSED, |
872,138 → 908,32 |
return generic_link_add_symbol_list (abfd, info, symcount, outsyms, collect); |
} |
/* We build a hash table of all symbols defined in an archive. */ |
/* An archive symbol may be defined by multiple archive elements. |
This linked list is used to hold the elements. */ |
struct archive_list |
{ |
struct archive_list *next; |
unsigned int indx; |
}; |
/* An entry in an archive hash table. */ |
struct archive_hash_entry |
{ |
struct bfd_hash_entry root; |
/* Where the symbol is defined. */ |
struct archive_list *defs; |
}; |
/* An archive hash table itself. */ |
struct archive_hash_table |
{ |
struct bfd_hash_table table; |
}; |
/* Create a new entry for an archive hash table. */ |
static struct bfd_hash_entry * |
archive_hash_newfunc (struct bfd_hash_entry *entry, |
struct bfd_hash_table *table, |
const char *string) |
{ |
struct archive_hash_entry *ret = (struct archive_hash_entry *) entry; |
/* Allocate the structure if it has not already been allocated by a |
subclass. */ |
if (ret == NULL) |
ret = (struct archive_hash_entry *) |
bfd_hash_allocate (table, sizeof (struct archive_hash_entry)); |
if (ret == NULL) |
return NULL; |
/* Call the allocation method of the superclass. */ |
ret = ((struct archive_hash_entry *) |
bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); |
if (ret) |
{ |
/* Initialize the local fields. */ |
ret->defs = NULL; |
} |
return &ret->root; |
} |
/* Initialize an archive hash table. */ |
static bfd_boolean |
archive_hash_table_init |
(struct archive_hash_table *table, |
struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *, |
struct bfd_hash_table *, |
const char *), |
unsigned int entsize) |
{ |
return bfd_hash_table_init (&table->table, newfunc, entsize); |
} |
/* Look up an entry in an archive hash table. */ |
#define archive_hash_lookup(t, string, create, copy) \ |
((struct archive_hash_entry *) \ |
bfd_hash_lookup (&(t)->table, (string), (create), (copy))) |
/* Allocate space in an archive hash table. */ |
#define archive_hash_allocate(t, size) bfd_hash_allocate (&(t)->table, (size)) |
/* Free an archive hash table. */ |
#define archive_hash_table_free(t) bfd_hash_table_free (&(t)->table) |
/* Generic function to add symbols from an archive file to the global |
hash file. This function presumes that the archive symbol table |
has already been read in (this is normally done by the |
bfd_check_format entry point). It looks through the undefined and |
common symbols and searches the archive symbol table for them. If |
it finds an entry, it includes the associated object file in the |
link. |
bfd_check_format entry point). It looks through the archive symbol |
table for symbols that are undefined or common in the linker global |
symbol hash table. When one is found, the CHECKFN argument is used |
to see if an object file should be included. This allows targets |
to customize common symbol behaviour. CHECKFN should set *PNEEDED |
to TRUE if the object file should be included, and must also call |
the bfd_link_info add_archive_element callback function and handle |
adding the symbols to the global hash table. CHECKFN must notice |
if the callback indicates a substitute BFD, and arrange to add |
those symbols instead if it does so. CHECKFN should only return |
FALSE if some sort of error occurs. */ |
The old linker looked through the archive symbol table for |
undefined symbols. We do it the other way around, looking through |
undefined symbols for symbols defined in the archive. The |
advantage of the newer scheme is that we only have to look through |
the list of undefined symbols once, whereas the old method had to |
re-search the symbol table each time a new object file was added. |
The CHECKFN argument is used to see if an object file should be |
included. CHECKFN should set *PNEEDED to TRUE if the object file |
should be included, and must also call the bfd_link_info |
add_archive_element callback function and handle adding the symbols |
to the global hash table. CHECKFN must notice if the callback |
indicates a substitute BFD, and arrange to add those symbols instead |
if it does so. CHECKFN should only return FALSE if some sort of |
error occurs. |
For some formats, such as a.out, it is possible to look through an |
object file but not actually include it in the link. The |
archive_pass field in a BFD is used to avoid checking the symbols |
of an object files too many times. When an object is included in |
the link, archive_pass is set to -1. If an object is scanned but |
not included, archive_pass is set to the pass number. The pass |
number is incremented each time a new object file is included. The |
pass number is used because when a new object file is included it |
may create new undefined symbols which cause a previously examined |
object file to be included. */ |
bfd_boolean |
_bfd_generic_link_add_archive_symbols |
(bfd *abfd, |
struct bfd_link_info *info, |
bfd_boolean (*checkfn) (bfd *, struct bfd_link_info *, bfd_boolean *)) |
bfd_boolean (*checkfn) (bfd *, struct bfd_link_info *, |
struct bfd_link_hash_entry *, const char *, |
bfd_boolean *)) |
{ |
carsym *arsyms; |
carsym *arsym_end; |
register carsym *arsym; |
int pass; |
struct archive_hash_table arsym_hash; |
unsigned int indx; |
struct bfd_link_hash_entry **pundef; |
bfd_boolean loop; |
bfd_size_type amt; |
unsigned char *included; |
if (! bfd_has_map (abfd)) |
{ |
1014,148 → 944,103 |
return FALSE; |
} |
amt = bfd_ardata (abfd)->symdef_count; |
if (amt == 0) |
return TRUE; |
amt *= sizeof (*included); |
included = (unsigned char *) bfd_zmalloc (amt); |
if (included == NULL) |
return FALSE; |
do |
{ |
carsym *arsyms; |
carsym *arsym_end; |
carsym *arsym; |
unsigned int indx; |
file_ptr last_ar_offset = -1; |
bfd_boolean needed = FALSE; |
bfd *element = NULL; |
loop = FALSE; |
arsyms = bfd_ardata (abfd)->symdefs; |
arsym_end = arsyms + bfd_ardata (abfd)->symdef_count; |
/* In order to quickly determine whether an symbol is defined in |
this archive, we build a hash table of the symbols. */ |
if (! archive_hash_table_init (&arsym_hash, archive_hash_newfunc, |
sizeof (struct archive_hash_entry))) |
return FALSE; |
for (arsym = arsyms, indx = 0; arsym < arsym_end; arsym++, indx++) |
{ |
struct archive_hash_entry *arh; |
struct archive_list *l, **pp; |
arh = archive_hash_lookup (&arsym_hash, arsym->name, TRUE, FALSE); |
if (arh == NULL) |
goto error_return; |
l = ((struct archive_list *) |
archive_hash_allocate (&arsym_hash, sizeof (struct archive_list))); |
if (l == NULL) |
goto error_return; |
l->indx = indx; |
for (pp = &arh->defs; *pp != NULL; pp = &(*pp)->next) |
; |
*pp = l; |
l->next = NULL; |
} |
/* The archive_pass field in the archive itself is used to |
initialize PASS, sine we may search the same archive multiple |
times. */ |
pass = abfd->archive_pass + 1; |
/* New undefined symbols are added to the end of the list, so we |
only need to look through it once. */ |
pundef = &info->hash->undefs; |
while (*pundef != NULL) |
{ |
struct bfd_link_hash_entry *h; |
struct archive_hash_entry *arh; |
struct archive_list *l; |
struct bfd_link_hash_entry *undefs_tail; |
h = *pundef; |
/* When a symbol is defined, it is not necessarily removed from |
the list. */ |
if (h->type != bfd_link_hash_undefined |
&& h->type != bfd_link_hash_common) |
if (included[indx]) |
continue; |
if (needed && arsym->file_offset == last_ar_offset) |
{ |
/* Remove this entry from the list, for general cleanliness |
and because we are going to look through the list again |
if we search any more libraries. We can't remove the |
entry if it is the tail, because that would lose any |
entries we add to the list later on (it would also cause |
us to lose track of whether the symbol has been |
referenced). */ |
if (*pundef != info->hash->undefs_tail) |
*pundef = (*pundef)->u.undef.next; |
else |
pundef = &(*pundef)->u.undef.next; |
included[indx] = 1; |
continue; |
} |
/* Look for this symbol in the archive symbol map. */ |
arh = archive_hash_lookup (&arsym_hash, h->root.string, FALSE, FALSE); |
if (arh == NULL) |
{ |
/* If we haven't found the exact symbol we're looking for, |
let's look for its import thunk */ |
if (info->pei386_auto_import) |
{ |
bfd_size_type amt = strlen (h->root.string) + 10; |
char *buf = (char *) bfd_malloc (amt); |
if (buf == NULL) |
return FALSE; |
h = bfd_link_hash_lookup (info->hash, arsym->name, |
FALSE, FALSE, TRUE); |
sprintf (buf, "__imp_%s", h->root.string); |
arh = archive_hash_lookup (&arsym_hash, buf, FALSE, FALSE); |
free(buf); |
} |
if (arh == NULL) |
{ |
pundef = &(*pundef)->u.undef.next; |
if (h == NULL |
&& info->pei386_auto_import |
&& CONST_STRNEQ (arsym->name, "__imp_")) |
h = bfd_link_hash_lookup (info->hash, arsym->name + 6, |
FALSE, FALSE, TRUE); |
if (h == NULL) |
continue; |
} |
} |
/* Look at all the objects which define this symbol. */ |
for (l = arh->defs; l != NULL; l = l->next) |
{ |
bfd *element; |
bfd_boolean needed; |
/* If the symbol has gotten defined along the way, quit. */ |
if (h->type != bfd_link_hash_undefined |
&& h->type != bfd_link_hash_common) |
break; |
element = bfd_get_elt_at_index (abfd, l->indx); |
if (element == NULL) |
goto error_return; |
/* If we've already included this element, or if we've |
already checked it on this pass, continue. */ |
if (element->archive_pass == -1 |
|| element->archive_pass == pass) |
{ |
if (h->type != bfd_link_hash_undefweak) |
/* Symbol must be defined. Don't check it again. */ |
included[indx] = 1; |
continue; |
} |
/* If we can't figure this element out, just ignore it. */ |
if (! bfd_check_format (element, bfd_object)) |
if (last_ar_offset != arsym->file_offset) |
{ |
element->archive_pass = -1; |
continue; |
last_ar_offset = arsym->file_offset; |
element = _bfd_get_elt_at_filepos (abfd, last_ar_offset); |
if (element == NULL |
|| !bfd_check_format (element, bfd_object)) |
goto error_return; |
} |
undefs_tail = info->hash->undefs_tail; |
/* CHECKFN will see if this element should be included, and |
go ahead and include it if appropriate. */ |
if (! (*checkfn) (element, info, &needed)) |
if (! (*checkfn) (element, info, h, arsym->name, &needed)) |
goto error_return; |
if (! needed) |
element->archive_pass = pass; |
else |
if (needed) |
{ |
element->archive_pass = -1; |
unsigned int mark; |
/* Increment the pass count to show that we may need to |
recheck object files which were already checked. */ |
++pass; |
/* Look backward to mark all symbols from this object file |
which we have already seen in this pass. */ |
mark = indx; |
do |
{ |
included[mark] = 1; |
if (mark == 0) |
break; |
--mark; |
} |
} |
while (arsyms[mark].file_offset == last_ar_offset); |
pundef = &(*pundef)->u.undef.next; |
if (undefs_tail != info->hash->undefs_tail) |
loop = TRUE; |
} |
} |
} while (loop); |
archive_hash_table_free (&arsym_hash); |
/* Save PASS in case we are called again. */ |
abfd->archive_pass = pass; |
free (included); |
return TRUE; |
error_return: |
archive_hash_table_free (&arsym_hash); |
free (included); |
return FALSE; |
} |
1165,12 → 1050,14 |
for finding them. */ |
static bfd_boolean |
generic_link_check_archive_element_no_collect ( |
bfd *abfd, |
generic_link_check_archive_element_no_collect (bfd *abfd, |
struct bfd_link_info *info, |
struct bfd_link_hash_entry *h, |
const char *name, |
bfd_boolean *pneeded) |
{ |
return generic_link_check_archive_element (abfd, info, pneeded, FALSE); |
return generic_link_check_archive_element (abfd, info, h, name, pneeded, |
FALSE); |
} |
/* See if we should include an archive element. This version is used |
1180,9 → 1067,12 |
static bfd_boolean |
generic_link_check_archive_element_collect (bfd *abfd, |
struct bfd_link_info *info, |
struct bfd_link_hash_entry *h, |
const char *name, |
bfd_boolean *pneeded) |
{ |
return generic_link_check_archive_element (abfd, info, pneeded, TRUE); |
return generic_link_check_archive_element (abfd, info, h, name, pneeded, |
TRUE); |
} |
/* See if we should include an archive element. Optionally collect |
1191,6 → 1081,8 |
static bfd_boolean |
generic_link_check_archive_element (bfd *abfd, |
struct bfd_link_info *info, |
struct bfd_link_hash_entry *h, |
const char *name ATTRIBUTE_UNUSED, |
bfd_boolean *pneeded, |
bfd_boolean collect) |
{ |
1206,7 → 1098,6 |
for (; pp < ppend; pp++) |
{ |
asymbol *p; |
struct bfd_link_hash_entry *h; |
p = *pp; |
1229,13 → 1120,14 |
/* P is a symbol we are looking for. */ |
if (! bfd_is_com_section (p->section)) |
if (! bfd_is_com_section (p->section) |
|| (h->type == bfd_link_hash_undefined |
&& h->u.undef.abfd == NULL)) |
{ |
bfd_size_type symcount; |
asymbol **symbols; |
bfd *oldbfd = abfd; |
/* This object file defines this symbol, so pull it in. */ |
/* P is not a common symbol, or an undefined reference was |
created from outside BFD such as from a linker -u option. |
This object file defines the symbol, so pull it in. */ |
*pneeded = TRUE; |
if (!(*info->callbacks |
->add_archive_element) (info, abfd, bfd_asymbol_name (p), |
&abfd)) |
1242,16 → 1134,7 |
return FALSE; |
/* Potentially, the add_archive_element hook may have set a |
substitute BFD for us. */ |
if (abfd != oldbfd |
&& !bfd_generic_link_read_symbols (abfd)) |
return FALSE; |
symcount = _bfd_generic_link_get_symcount (abfd); |
symbols = _bfd_generic_link_get_symbols (abfd); |
if (! generic_link_add_symbol_list (abfd, info, symcount, |
symbols, collect)) |
return FALSE; |
*pneeded = TRUE; |
return TRUE; |
return generic_link_add_object_symbols (abfd, info, collect); |
} |
/* P is a common symbol. */ |
1262,23 → 1145,6 |
bfd_vma size; |
unsigned int power; |
symbfd = h->u.undef.abfd; |
if (symbfd == NULL) |
{ |
/* This symbol was created as undefined from outside |
BFD. We assume that we should link in the object |
file. This is for the -u option in the linker. */ |
if (!(*info->callbacks |
->add_archive_element) (info, abfd, bfd_asymbol_name (p), |
&abfd)) |
return FALSE; |
/* Potentially, the add_archive_element hook may have set a |
substitute BFD for us. But no symbols are going to get |
registered by anything we're returning to from here. */ |
*pneeded = TRUE; |
return TRUE; |
} |
/* Turn the symbol into a common symbol but do not link in |
the object file. This is how a.out works. Object |
formats that require different semantics must implement |
1286,6 → 1152,7 |
undefs list. We add the section to a common section |
attached to symbfd to ensure that it is in a BFD which |
will be linked in. */ |
symbfd = h->u.undef.abfd; |
h->type = bfd_link_hash_common; |
h->u.c.p = (struct bfd_link_hash_common_entry *) |
bfd_hash_allocate (&info->hash->table, |
1475,8 → 1342,7 |
CIND, /* Make indirect symbol from existing common symbol. */ |
SET, /* Add value to set. */ |
MWARN, /* Make warning symbol. */ |
WARN, /* Issue warning. */ |
CWARN, /* Warn if referenced, else MWARN. */ |
WARN, /* Warn if referenced, else MWARN. */ |
CYCLE, /* Repeat with symbol pointed to. */ |
REFC, /* Mark indirect symbol referenced and then CYCLE. */ |
WARNC /* Issue warning and then CYCLE. */ |
1494,7 → 1360,7 |
/* DEFW_ROW */ {DEFW, DEFW, DEFW, NOACT, NOACT, NOACT, NOACT, CYCLE }, |
/* COMMON_ROW */ {COM, COM, COM, CREF, COM, BIG, REFC, WARNC }, |
/* INDR_ROW */ {IND, IND, IND, MDEF, IND, CIND, MIND, CYCLE }, |
/* WARN_ROW */ {MWARN, WARN, WARN, CWARN, CWARN, WARN, CWARN, NOACT }, |
/* WARN_ROW */ {MWARN, WARN, WARN, WARN, WARN, WARN, WARN, NOACT }, |
/* SET_ROW */ {SET, SET, SET, SET, SET, SET, CYCLE, CYCLE } |
}; |
1576,6 → 1442,7 |
{ |
enum link_row row; |
struct bfd_link_hash_entry *h; |
struct bfd_link_hash_entry *inh = NULL; |
bfd_boolean cycle; |
BFD_ASSERT (section != NULL); |
1582,7 → 1449,16 |
if (bfd_is_ind_section (section) |
|| (flags & BSF_INDIRECT) != 0) |
{ |
row = INDR_ROW; |
/* Create the indirect symbol here. This is for the benefit of |
the plugin "notice" function. |
STRING is the name of the symbol we want to indirect to. */ |
inh = bfd_wrapped_link_hash_lookup (abfd, info, string, TRUE, |
copy, FALSE); |
if (inh == NULL) |
return FALSE; |
} |
else if ((flags & BSF_WARNING) != 0) |
row = WARN_ROW; |
else if ((flags & BSF_CONSTRUCTOR) != 0) |
1597,7 → 1473,13 |
else if ((flags & BSF_WEAK) != 0) |
row = DEFW_ROW; |
else if (bfd_is_com_section (section)) |
{ |
row = COMMON_ROW; |
if (strcmp (name, "__gnu_lto_slim") == 0) |
(*_bfd_error_handler) |
(_("%s: plugin needed to handle lto object"), |
bfd_get_filename (abfd)); |
} |
else |
row = DEF_ROW; |
1621,8 → 1503,8 |
|| (info->notice_hash != NULL |
&& bfd_hash_lookup (info->notice_hash, name, FALSE, FALSE) != NULL)) |
{ |
if (! (*info->callbacks->notice) (info, h, |
abfd, section, value, flags, string)) |
if (! (*info->callbacks->notice) (info, h, inh, |
abfd, section, value, flags)) |
return FALSE; |
} |
1678,6 → 1560,7 |
h->type = bfd_link_hash_defined; |
h->u.def.section = section; |
h->u.def.value = value; |
h->linker_def = 0; |
/* If we have been asked to, we act like collect2 and |
identify all functions that might be global |
1777,6 → 1660,7 |
} |
else |
h->u.c.p->section = section; |
h->linker_def = 0; |
break; |
case REF: |
1856,16 → 1740,6 |
return FALSE; |
/* Fall through. */ |
case IND: |
/* Create an indirect symbol. */ |
{ |
struct bfd_link_hash_entry *inh; |
/* STRING is the name of the symbol we want to indirect |
to. */ |
inh = bfd_wrapped_link_hash_lookup (abfd, info, string, TRUE, |
copy, FALSE); |
if (inh == NULL) |
return FALSE; |
if (inh->type == bfd_link_hash_indirect |
&& inh->u.i.link == h) |
{ |
1883,10 → 1757,11 |
} |
/* If the indirect symbol has been referenced, we need to |
push the reference down to the symbol we are |
referencing. */ |
push the reference down to the symbol we are referencing. */ |
if (h->type != bfd_link_hash_new) |
{ |
/* ??? If inh->type == bfd_link_hash_undefweak this |
converts inh to bfd_link_hash_undefined. */ |
row = UNDEF_ROW; |
cycle = TRUE; |
} |
1893,7 → 1768,12 |
h->type = bfd_link_hash_indirect; |
h->u.i.link = inh; |
} |
/* Not setting h = h->u.i.link here means that when cycle is |
set above we'll always go to REFC, and then cycle again |
to the indirected symbol. This means that any successful |
change of an existing symbol to indirect counts as a |
reference. ??? That may not be correct when the existing |
symbol was defweak. */ |
break; |
case SET: |
1904,8 → 1784,10 |
break; |
case WARNC: |
/* Issue a warning and cycle. */ |
if (h->u.i.warning != NULL) |
/* Issue a warning and cycle, except when the reference is |
in LTO IR. */ |
if (h->u.i.warning != NULL |
&& (abfd->flags & BFD_PLUGIN) == 0) |
{ |
if (! (*info->callbacks->warning) (info, h->u.i.warning, |
h->root.string, abfd, |
1930,19 → 1812,11 |
break; |
case WARN: |
/* Issue a warning. */ |
if (! (*info->callbacks->warning) (info, string, h->root.string, |
hash_entry_bfd (h), NULL, 0)) |
return FALSE; |
break; |
case CWARN: |
/* Warn if this symbol has been referenced already, |
otherwise add a warning. A symbol has been referenced if |
the u.undef.next field is not NULL, or it is the tail of the |
undefined symbol list. The REF case above helps to |
ensure this. */ |
if (h->u.undef.next != NULL || info->hash->undefs_tail == h) |
/* Warn if this symbol has been referenced already from non-IR, |
otherwise add a warning. */ |
if ((!info->lto_plugin_active |
&& (h->u.undef.next != NULL || info->hash->undefs_tail == h)) |
|| h->non_ir_ref) |
{ |
if (! (*info->callbacks->warning) (info, string, h->root.string, |
hash_entry_bfd (h), NULL, 0)) |
2014,7 → 1888,7 |
p->u.indirect.section->linker_mark = TRUE; |
/* Build the output symbol table. */ |
for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) |
for (sub = info->input_bfds; sub != NULL; sub = sub->link.next) |
if (! _bfd_generic_link_output_symbols (abfd, sub, info, &outsymalloc)) |
return FALSE; |
2032,7 → 1906,7 |
if (! generic_add_output_symbol (abfd, &outsymalloc, NULL)) |
return FALSE; |
if (info->relocatable) |
if (bfd_link_relocatable (info)) |
{ |
/* Allocate space for the output relocs for each section. */ |
for (o = abfd->sections; o != NULL; o = o->next) |
2262,7 → 2136,7 |
/* fall through */ |
case bfd_link_hash_defined: |
sym->flags |= BSF_GLOBAL; |
sym->flags &=~ BSF_CONSTRUCTOR; |
sym->flags &=~ (BSF_WEAK | BSF_CONSTRUCTOR); |
sym->value = h->root.u.def.value; |
sym->section = h->root.u.def.section; |
break; |
2336,7 → 2210,7 |
break; |
case discard_sec_merge: |
output = TRUE; |
if (info->relocatable |
if (bfd_link_relocatable (info) |
|| ! (sym->section->flags & SEC_MERGE)) |
break; |
/* FALLTHROUGH */ |
2506,7 → 2380,7 |
{ |
arelent *r; |
if (! info->relocatable) |
if (! bfd_link_relocatable (info)) |
abort (); |
if (sec->orelocation == NULL) |
abort (); |
2560,7 → 2434,7 |
size = bfd_get_reloc_size (r->howto); |
buf = (bfd_byte *) bfd_zmalloc (size); |
if (buf == NULL) |
if (buf == NULL && size != 0) |
return FALSE; |
rstat = _bfd_relocate_contents (r->howto, abfd, |
(bfd_vma) link_order->u.reloc.p->addend, |
2737,7 → 2611,7 |
BFD_ASSERT (input_section->output_offset == link_order->offset); |
BFD_ASSERT (input_section->size == link_order->size); |
if (info->relocatable |
if (bfd_link_relocatable (info) |
&& input_section->reloc_count > 0 |
&& output_section->orelocation == NULL) |
{ |
2831,7 → 2705,7 |
goto error_return; |
new_contents = (bfd_get_relocated_section_contents |
(output_bfd, info, link_order, contents, |
info->relocatable, |
bfd_link_relocatable (info), |
_bfd_generic_link_get_symbols (input_bfd))); |
if (!new_contents) |
goto error_return; |
3022,7 → 2896,7 |
files over IR because the first pass may contain a |
mix of LTO and normal objects and we must keep the |
first match, be it IR or real. */ |
if (info->loading_lto_outputs |
if (sec->owner->lto_output |
&& (l->sec->owner->flags & BFD_PLUGIN) != 0) |
{ |
l->sec = sec; |
/contrib/toolchain/binutils/bfd/merge.c |
---|
1,6 → 1,5 |
/* SEC_MERGE support. |
Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
Free Software Foundation, Inc. |
Copyright (C) 2001-2015 Free Software Foundation, Inc. |
Written by Jakub Jelinek <jakub@redhat.com>. |
This file is part of BFD, the Binary File Descriptor library. |
26,6 → 25,7 |
#include "sysdep.h" |
#include "bfd.h" |
#include "elf-bfd.h" |
#include "libbfd.h" |
#include "hashtab.h" |
#include "libiberty.h" |
284,7 → 284,8 |
} |
static bfd_boolean |
sec_merge_emit (bfd *abfd, struct sec_merge_hash_entry *entry) |
sec_merge_emit (bfd *abfd, struct sec_merge_hash_entry *entry, |
unsigned char *contents, file_ptr offset) |
{ |
struct sec_merge_sec_info *secinfo = entry->secinfo; |
asection *sec = secinfo->sec; |
307,7 → 308,12 |
len = -off & (entry->alignment - 1); |
if (len != 0) |
{ |
if (bfd_bwrite (pad, len, abfd) != len) |
if (contents) |
{ |
memcpy (contents + offset, pad, len); |
offset += len; |
} |
else if (bfd_bwrite (pad, len, abfd) != len) |
goto err; |
off += len; |
} |
315,7 → 321,12 |
str = entry->root.string; |
len = entry->len; |
if (bfd_bwrite (str, len, abfd) != len) |
if (contents) |
{ |
memcpy (contents + offset, str, len); |
offset += len; |
} |
else if (bfd_bwrite (str, len, abfd) != len) |
goto err; |
off += len; |
323,9 → 334,13 |
/* Trailing alignment needed? */ |
off = sec->size - off; |
if (off != 0 |
&& bfd_bwrite (pad, off, abfd) != off) |
if (off != 0) |
{ |
if (contents) |
memcpy (contents + offset, pad, off); |
else if (bfd_bwrite (pad, off, abfd) != off) |
goto err; |
} |
if (pad != NULL) |
free (pad); |
786,6 → 801,8 |
{ |
struct sec_merge_sec_info *secinfo; |
file_ptr pos; |
unsigned char *contents; |
Elf_Internal_Shdr *hdr; |
secinfo = (struct sec_merge_sec_info *) psecinfo; |
796,11 → 813,26 |
return TRUE; |
/* FIXME: octets_per_byte. */ |
hdr = &elf_section_data (sec->output_section)->this_hdr; |
if (hdr->sh_offset == (file_ptr) -1) |
{ |
/* We must compress this section. Write output to the |
buffer. */ |
contents = hdr->contents; |
if ((sec->output_section->flags & SEC_ELF_COMPRESS) == 0 |
|| contents == NULL) |
abort (); |
} |
else |
{ |
contents = NULL; |
pos = sec->output_section->filepos + sec->output_offset; |
if (bfd_seek (output_bfd, pos, SEEK_SET) != 0) |
return FALSE; |
} |
if (! sec_merge_emit (output_bfd, secinfo->first_str)) |
if (! sec_merge_emit (output_bfd, secinfo->first_str, contents, |
sec->output_offset)) |
return FALSE; |
return TRUE; |
/contrib/toolchain/binutils/bfd/opncls.c |
---|
1,5 → 1,5 |
/* opncls.c -- open and close a BFD. |
Copyright 1990-2013 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
80,9 → 80,6 |
nbfd->arch_info = &bfd_default_arch_struct; |
nbfd->direction = no_direction; |
nbfd->iostream = NULL; |
nbfd->where = 0; |
if (!bfd_hash_table_init_n (& nbfd->section_htab, bfd_section_hash_newfunc, |
sizeof (struct section_hash_entry), 13)) |
{ |
89,18 → 86,6 |
free (nbfd); |
return NULL; |
} |
nbfd->sections = NULL; |
nbfd->section_last = NULL; |
nbfd->format = bfd_unknown; |
nbfd->my_archive = NULL; |
nbfd->origin = 0; |
nbfd->opened_once = FALSE; |
nbfd->output_has_begun = FALSE; |
nbfd->section_count = 0; |
nbfd->usrdata = NULL; |
nbfd->cacheable = FALSE; |
nbfd->flags = BFD_NO_FLAGS; |
nbfd->mtime_set = FALSE; |
return nbfd; |
} |
124,6 → 109,8 |
nbfd->my_archive = obfd; |
nbfd->direction = read_direction; |
nbfd->target_defaulted = obfd->target_defaulted; |
nbfd->lto_output = obfd->lto_output; |
nbfd->no_export = obfd->no_export; |
return nbfd; |
} |
138,6 → 125,8 |
objalloc_free ((struct objalloc *) abfd->memory); |
} |
if (abfd->filename) |
free ((char *) abfd->filename); |
free (abfd->arelt_data); |
free (abfd); |
} |
196,6 → 185,9 |
<<system_call>> error. |
On error, @var{fd} is always closed. |
A copy of the @var{filename} argument is stored in the newly created |
BFD. It can be accessed via the bfd_get_filename() macro. |
*/ |
bfd * |
235,8 → 227,11 |
} |
/* OK, put everything where it belongs. */ |
nbfd->filename = filename; |
/* PR 11983: Do not cache the original filename, but |
rather make a copy - the original might go away. */ |
nbfd->filename = xstrdup (filename); |
/* Figure out whether the user is opening the file for reading, |
writing, or both, by looking at the MODE argument. */ |
if ((mode[0] == 'r' || mode[0] == 'w' || mode[0] == 'a') |
281,6 → 276,9 |
If <<NULL>> is returned then an error has occured. Possible errors |
are <<bfd_error_no_memory>>, <<bfd_error_invalid_target>> or |
<<system_call>> error. |
A copy of the @var{filename} argument is stored in the newly created |
BFD. It can be accessed via the bfd_get_filename() macro. |
*/ |
bfd * |
322,6 → 320,9 |
<<bfd_error_invalid_target>> and <<bfd_error_system_call>>. |
On error, @var{fd} is closed. |
A copy of the @var{filename} argument is stored in the newly created |
BFD. It can be accessed via the bfd_get_filename() macro. |
*/ |
bfd * |
364,12 → 365,15 |
bfd_openstreamr |
SYNOPSIS |
bfd *bfd_openstreamr (const char *, const char *, void *); |
bfd *bfd_openstreamr (const char * filename, const char * target, void * stream); |
DESCRIPTION |
Open a BFD for read access on an existing stdio stream. When |
the BFD is passed to <<bfd_close>>, the stream will be closed. |
A copy of the @var{filename} argument is stored in the newly created |
BFD. It can be accessed via the bfd_get_filename() macro. |
*/ |
bfd * |
391,7 → 395,9 |
} |
nbfd->iostream = stream; |
nbfd->filename = filename; |
/* PR 11983: Do not cache the original filename, but |
rather make a copy - the original might go away. */ |
nbfd->filename = xstrdup (filename); |
nbfd->direction = read_direction; |
if (! bfd_cache_init (nbfd)) |
456,6 → 462,8 |
occurred. Possible errors are <<bfd_error_no_memory>>, |
<<bfd_error_invalid_target>> and <<bfd_error_system_call>>. |
A copy of the @var{filename} argument is stored in the newly created |
BFD. It can be accessed via the bfd_get_filename() macro. |
*/ |
struct opncls |
581,7 → 589,9 |
return NULL; |
} |
nbfd->filename = filename; |
/* PR 11983: Do not cache the original filename, but |
rather make a copy - the original might go away. */ |
nbfd->filename = xstrdup (filename); |
nbfd->direction = read_direction; |
/* `open_p (...)' would get expanded by an the open(2) syscall macro. */ |
622,6 → 632,9 |
Possible errors are <<bfd_error_system_call>>, <<bfd_error_no_memory>>, |
<<bfd_error_invalid_target>>. |
A copy of the @var{filename} argument is stored in the newly created |
BFD. It can be accessed via the bfd_get_filename() macro. |
*/ |
bfd * |
643,7 → 656,9 |
return NULL; |
} |
nbfd->filename = filename; |
/* PR 11983: Do not cache the original filename, but |
rather make a copy - the original might go away. */ |
nbfd->filename = xstrdup (filename); |
nbfd->direction = write_direction; |
if (bfd_open_file (nbfd) == NULL) |
782,6 → 797,9 |
Create a new BFD in the manner of <<bfd_openw>>, but without |
opening a file. The new BFD takes the target from the target |
used by @var{templ}. The format is always set to <<bfd_object>>. |
A copy of the @var{filename} argument is stored in the newly created |
BFD. It can be accessed via the bfd_get_filename() macro. |
*/ |
bfd * |
792,7 → 810,9 |
nbfd = _bfd_new_bfd (); |
if (nbfd == NULL) |
return NULL; |
nbfd->filename = filename; |
/* PR 11983: Do not cache the original filename, but |
rather make a copy - the original might go away. */ |
nbfd->filename = xstrdup (filename); |
if (templ) |
nbfd->xvec = templ->xvec; |
nbfd->direction = no_direction; |
921,14 → 941,23 |
bfd_alloc (bfd *abfd, bfd_size_type size) |
{ |
void *ret; |
unsigned long ul_size = (unsigned long) size; |
if (size != (unsigned long) size) |
if (size != ul_size |
/* Note - although objalloc_alloc takes an unsigned long as its |
argument, internally the size is treated as a signed long. This can |
lead to problems where, for example, a request to allocate -1 bytes |
can result in just 1 byte being allocated, rather than |
((unsigned long) -1) bytes. Also memory checkers will often |
complain about attempts to allocate a negative amount of memory. |
So to stop these problems we fail if the size is negative. */ |
|| ((signed long) ul_size) < 0) |
{ |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
} |
ret = objalloc_alloc ((struct objalloc *) abfd->memory, (unsigned long) size); |
ret = objalloc_alloc ((struct objalloc *) abfd->memory, ul_size); |
if (ret == NULL) |
bfd_set_error (bfd_error_no_memory); |
return ret; |
949,8 → 978,6 |
void * |
bfd_alloc2 (bfd *abfd, bfd_size_type nmemb, bfd_size_type size) |
{ |
void *ret; |
if ((nmemb | size) >= HALF_BFD_SIZE_TYPE |
&& size != 0 |
&& nmemb > ~(bfd_size_type) 0 / size) |
959,20 → 986,9 |
return NULL; |
} |
size *= nmemb; |
if (size != (unsigned long) size) |
{ |
bfd_set_error (bfd_error_no_memory); |
return NULL; |
return bfd_alloc (abfd, size * nmemb); |
} |
ret = objalloc_alloc ((struct objalloc *) abfd->memory, (unsigned long) size); |
if (ret == NULL) |
bfd_set_error (bfd_error_no_memory); |
return ret; |
} |
/* |
FUNCTION |
bfd_zalloc |
1149,7 → 1165,7 |
char *bfd_get_debug_link_info (bfd *abfd, unsigned long *crc32_out); |
DESCRIPTION |
fetch the filename and CRC32 value for any separate debuginfo |
Fetch the filename and CRC32 value for any separate debuginfo |
associated with @var{abfd}. Return NULL if no such info found, |
otherwise return filename and update @var{crc32_out}. The |
returned filename is allocated with @code{malloc}; freeing it |
1162,7 → 1178,7 |
asection *sect; |
unsigned long crc32; |
bfd_byte *contents; |
int crc_offset; |
unsigned int crc_offset; |
char *name; |
BFD_ASSERT (abfd); |
1180,10 → 1196,13 |
return NULL; |
} |
/* Crc value is stored after the filename, aligned up to 4 bytes. */ |
/* CRC value is stored after the filename, aligned up to 4 bytes. */ |
name = (char *) contents; |
crc_offset = strlen (name) + 1; |
/* PR 17597: avoid reading off the end of the buffer. */ |
crc_offset = strnlen (name, bfd_get_section_size (sect)) + 1; |
crc_offset = (crc_offset + 3) & ~3; |
if (crc_offset >= bfd_get_section_size (sect)) |
return NULL; |
crc32 = bfd_get_32 (abfd, contents + crc_offset); |
1196,25 → 1215,30 |
bfd_get_alt_debug_link_info |
SYNOPSIS |
char *bfd_get_alt_debug_link_info (bfd *abfd, unsigned long *crc32_out); |
char *bfd_get_alt_debug_link_info (bfd * abfd, |
bfd_size_type *buildid_len, |
bfd_byte **buildid_out); |
DESCRIPTION |
Fetch the filename and BuildID value for any alternate debuginfo |
associated with @var{abfd}. Return NULL if no such info found, |
otherwise return filename and update @var{buildid_out}. The |
returned filename is allocated with @code{malloc}; freeing it |
is the responsibility of the caller. |
otherwise return filename and update @var{buildid_len} and |
@var{buildid_out}. The returned filename and build_id are |
allocated with @code{malloc}; freeing them is the |
responsibility of the caller. |
*/ |
char * |
bfd_get_alt_debug_link_info (bfd * abfd, unsigned long * buildid_out) |
bfd_get_alt_debug_link_info (bfd * abfd, bfd_size_type *buildid_len, |
bfd_byte **buildid_out) |
{ |
asection *sect; |
bfd_byte *contents; |
int buildid_offset; |
unsigned int buildid_offset; |
char *name; |
BFD_ASSERT (abfd); |
BFD_ASSERT (buildid_len); |
BFD_ASSERT (buildid_out); |
sect = bfd_get_section_by_name (abfd, GNU_DEBUGALTLINK); |
1229,12 → 1253,15 |
return NULL; |
} |
/* BuildID value is stored after the filename, aligned up to 4 bytes. */ |
/* BuildID value is stored after the filename. */ |
name = (char *) contents; |
buildid_offset = strlen (name) + 1; |
buildid_offset = (buildid_offset + 3) & ~3; |
buildid_offset = strnlen (name, bfd_get_section_size (sect)) + 1; |
if (buildid_offset >= bfd_get_section_size (sect)) |
return NULL; |
* buildid_out = bfd_get_32 (abfd, contents + buildid_offset); |
*buildid_len = bfd_get_section_size (sect) - buildid_offset; |
*buildid_out = bfd_malloc (*buildid_len); |
memcpy (*buildid_out, contents + buildid_offset, *buildid_len); |
return name; |
} |
1468,6 → 1495,24 |
separate_debug_file_exists); |
} |
/* Helper for bfd_follow_gnu_debugaltlink. It just pretends to return |
a CRC. .gnu_debugaltlink supplies a build-id, which is different, |
but this is ok because separate_alt_debug_file_exists ignores the |
CRC anyway. */ |
static char * |
get_alt_debug_link_info_shim (bfd * abfd, unsigned long *crc32_out) |
{ |
bfd_size_type len; |
bfd_byte *buildid = NULL; |
char *result = bfd_get_alt_debug_link_info (abfd, &len, &buildid); |
*crc32_out = 0; |
free (buildid); |
return result; |
} |
/* |
FUNCTION |
bfd_follow_gnu_debugaltlink |
1498,7 → 1543,7 |
bfd_follow_gnu_debugaltlink (bfd *abfd, const char *dir) |
{ |
return find_separate_debug_file (abfd, dir, |
bfd_get_alt_debug_link_info, |
get_alt_debug_link_info_shim, |
separate_alt_debug_file_exists); |
} |
/contrib/toolchain/binutils/bfd/pe-i386.c |
---|
1,6 → 1,5 |
/* BFD back-end for Intel 386 PECOFF files. |
Copyright 1995, 1996, 1999, 2001, 2002, 2004, 2005, 2006, 2007 |
Free Software Foundation, Inc. |
Copyright (C) 1995-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
22,7 → 21,7 |
#include "sysdep.h" |
#include "bfd.h" |
#define TARGET_SYM i386pe_vec |
#define TARGET_SYM i386_pe_vec |
#define TARGET_NAME "pe-i386" |
#define COFF_WITH_PE |
#define PCRELOFFSET TRUE |
/contrib/toolchain/binutils/bfd/pei-i386.c |
---|
1,6 → 1,5 |
/* BFD back-end for Intel 386 PE IMAGE COFF files. |
Copyright 1995, 1996, 1999, 2002, 2004, 2005, 2006, 2007, 2009 |
Free Software Foundation, Inc. |
Copyright (C) 1995-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
22,7 → 21,7 |
#include "sysdep.h" |
#include "bfd.h" |
#define TARGET_SYM i386pei_vec |
#define TARGET_SYM i386_pei_vec |
#define TARGET_NAME "pei-i386" |
#define COFF_IMAGE_WITH_PE |
#define COFF_WITH_PE |
/contrib/toolchain/binutils/bfd/peicode.h |
---|
1,5 → 1,5 |
/* Support for the generic parts of PE/PEI, for BFD. |
Copyright 1995-2013 Free Software Foundation, Inc. |
Copyright (C) 1995-2015 Free Software Foundation, Inc. |
Written by Cygnus Solutions. |
This file is part of BFD, the Binary File Descriptor library. |
271,6 → 271,7 |
/* in_reloc_p is architecture dependent. */ |
pe->in_reloc_p = in_reloc_p; |
memset (& pe->pe_opthdr, 0, sizeof pe->pe_opthdr); |
return TRUE; |
} |
567,6 → 568,7 |
ent->u.syment.n_sclass = sclass; |
ent->u.syment.n_scnum = section->target_index; |
ent->u.syment._n._n_n._n_offset = (bfd_hostptr_t) sym; |
ent->is_sym = TRUE; |
sym->symbol.the_bfd = vars->abfd; |
sym->symbol.name = vars->string_ptr; |
629,6 → 631,20 |
if (size & 1) |
vars->data --; |
# if (GCC_VERSION >= 3000) |
/* PR 18758: See note in pe_ILF_buid_a_bfd. We must make sure that we |
preserve host alignment requirements. We test 'size' rather than |
vars.data as we cannot perform binary arithmetic on pointers. We assume |
that vars.data was sufficiently aligned upon entry to this function. |
The BFD_ASSERTs in this functions will warn us if we run out of room, |
but we should already have enough padding built in to ILF_DATA_SIZE. */ |
{ |
unsigned int alignment = __alignof__ (struct coff_section_tdata); |
if (size & (alignment - 1)) |
vars->data += alignment - (size & (alignment - 1)); |
} |
#endif |
/* Create a coff_section_tdata structure for our use. */ |
sec->used_by_bfd = (struct coff_section_tdata *) vars->data; |
vars->data += sizeof (struct coff_section_tdata); |
834,6 → 850,24 |
/* The remaining space in bim->buffer is used |
by the pe_ILF_make_a_section() function. */ |
# if (GCC_VERSION >= 3000) |
/* PR 18758: Make sure that the data area is sufficiently aligned for |
pointers on the host. __alignof__ is a gcc extension, hence the test |
above. For other compilers we will have to assume that the alignment is |
unimportant, or else extra code can be added here and in |
pe_ILF_make_a_section. |
Note - we cannot test 'ptr' directly as it is illegal to perform binary |
arithmetic on pointers, but we know that the strings section is the only |
one that might end on an unaligned boundary. */ |
{ |
unsigned int alignment = __alignof__ (char *); |
if (SIZEOF_ILF_STRINGS & (alignment - 1)) |
ptr += alignment - (SIZEOF_ILF_STRINGS & (alignment - 1)); |
} |
#endif |
vars.data = ptr; |
vars.abfd = abfd; |
vars.sec_index = 0; |
971,7 → 1005,16 |
} |
else |
#endif |
#ifdef AMD64MAGIC |
if (magic == AMD64MAGIC) |
{ |
pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) jtab[i].offset, |
BFD_RELOC_32_PCREL, (asymbol **) imp_sym, |
imp_index); |
} |
else |
#endif |
pe_ILF_make_a_symbol_reloc (&vars, (bfd_vma) jtab[i].offset, |
BFD_RELOC_32, (asymbol **) imp_sym, |
imp_index); |
1077,7 → 1120,7 |
static const bfd_target * |
pe_ILF_object_p (bfd * abfd) |
{ |
bfd_byte buffer[16]; |
bfd_byte buffer[14]; |
bfd_byte * ptr; |
char * symbol_name; |
char * source_dll; |
1087,17 → 1130,13 |
unsigned int types; |
unsigned int magic; |
/* Upon entry the first four buyes of the ILF header have |
/* Upon entry the first six bytes of the ILF header have |
already been read. Now read the rest of the header. */ |
if (bfd_bread (buffer, (bfd_size_type) 16, abfd) != 16) |
if (bfd_bread (buffer, (bfd_size_type) 14, abfd) != 14) |
return NULL; |
ptr = buffer; |
/* We do not bother to check the version number. |
version = H_GET_16 (abfd, ptr); */ |
ptr += 2; |
machine = H_GET_16 (abfd, ptr); |
ptr += 2; |
1248,10 → 1287,91 |
return abfd->xvec; |
} |
static void |
pe_bfd_read_buildid(bfd *abfd) |
{ |
pe_data_type *pe = pe_data (abfd); |
struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr; |
asection *section; |
bfd_byte *data = 0; |
bfd_size_type dataoff; |
unsigned int i; |
bfd_vma addr = extra->DataDirectory[PE_DEBUG_DATA].VirtualAddress; |
bfd_size_type size = extra->DataDirectory[PE_DEBUG_DATA].Size; |
if (size == 0) |
return; |
addr += extra->ImageBase; |
/* Search for the section containing the DebugDirectory */ |
for (section = abfd->sections; section != NULL; section = section->next) |
{ |
if ((addr >= section->vma) && (addr < (section->vma + section->size))) |
break; |
} |
if (section == NULL) |
{ |
return; |
} |
else if (!(section->flags & SEC_HAS_CONTENTS)) |
{ |
return; |
} |
dataoff = addr - section->vma; |
/* Read the whole section. */ |
if (!bfd_malloc_and_get_section (abfd, section, &data)) |
{ |
if (data != NULL) |
free (data); |
return; |
} |
/* Search for a CodeView entry in the DebugDirectory */ |
for (i = 0; i < size / sizeof (struct external_IMAGE_DEBUG_DIRECTORY); i++) |
{ |
struct external_IMAGE_DEBUG_DIRECTORY *ext |
= &((struct external_IMAGE_DEBUG_DIRECTORY *)(data + dataoff))[i]; |
struct internal_IMAGE_DEBUG_DIRECTORY idd; |
_bfd_XXi_swap_debugdir_in (abfd, ext, &idd); |
if (idd.Type == PE_IMAGE_DEBUG_TYPE_CODEVIEW) |
{ |
char buffer[256 + 1]; |
CODEVIEW_INFO *cvinfo = (CODEVIEW_INFO *) buffer; |
/* |
The debug entry doesn't have to have to be in a section, in which |
case AddressOfRawData is 0, so always use PointerToRawData. |
*/ |
if (_bfd_XXi_slurp_codeview_record (abfd, |
(file_ptr) idd.PointerToRawData, |
idd.SizeOfData, cvinfo)) |
{ |
struct bfd_build_id* build_id = bfd_alloc(abfd, |
sizeof(struct bfd_build_id) + cvinfo->SignatureLength); |
if (build_id) |
{ |
build_id->size = cvinfo->SignatureLength; |
memcpy(build_id->data, cvinfo->Signature, |
cvinfo->SignatureLength); |
abfd->build_id = build_id; |
} |
} |
break; |
} |
} |
} |
static const bfd_target * |
pe_bfd_object_p (bfd * abfd) |
{ |
bfd_byte buffer[4]; |
bfd_byte buffer[6]; |
struct external_PEI_DOS_hdr dos_hdr; |
struct external_PEI_IMAGE_hdr image_hdr; |
struct internal_filehdr internal_f; |
1258,10 → 1378,12 |
struct internal_aouthdr internal_a; |
file_ptr opt_hdr_size; |
file_ptr offset; |
const bfd_target *result; |
/* Detect if this a Microsoft Import Library Format element. */ |
/* First read the beginning of the header. */ |
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 |
|| bfd_bread (buffer, (bfd_size_type) 4, abfd) != 4) |
|| bfd_bread (buffer, (bfd_size_type) 6, abfd) != 6) |
{ |
if (bfd_get_error () != bfd_error_system_call) |
bfd_set_error (bfd_error_wrong_format); |
1268,7 → 1390,9 |
return NULL; |
} |
if (H_GET_32 (abfd, buffer) == 0xffff0000) |
/* Then check the magic and the version (only 0 is supported). */ |
if (H_GET_32 (abfd, buffer) == 0xffff0000 |
&& H_GET_16 (abfd, buffer + 4) == 0) |
return pe_ILF_object_p (abfd); |
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 |
1314,7 → 1438,7 |
/* Swap file header, so that we get the location for calling |
real_object_p. */ |
bfd_coff_swap_filehdr_in (abfd, (PTR)&image_hdr, &internal_f); |
bfd_coff_swap_filehdr_in (abfd, &image_hdr, &internal_f); |
if (! bfd_coff_bad_format_hook (abfd, &internal_f) |
|| internal_f.f_opthdr > bfd_coff_aoutsz (abfd)) |
1328,9 → 1452,14 |
if (opt_hdr_size != 0) |
{ |
PTR opthdr; |
bfd_size_type amt = opt_hdr_size; |
void * opthdr; |
opthdr = bfd_alloc (abfd, opt_hdr_size); |
/* PR 17521 file: 230-131433-0.004. */ |
if (amt < sizeof (PEAOUTHDR)) |
amt = sizeof (PEAOUTHDR); |
opthdr = bfd_zalloc (abfd, amt); |
if (opthdr == NULL) |
return NULL; |
if (bfd_bread (opthdr, opt_hdr_size, abfd) |
1337,14 → 1466,27 |
!= (bfd_size_type) opt_hdr_size) |
return NULL; |
bfd_coff_swap_aouthdr_in (abfd, opthdr, (PTR) & internal_a); |
bfd_set_error (bfd_error_no_error); |
bfd_coff_swap_aouthdr_in (abfd, opthdr, & internal_a); |
if (bfd_get_error () != bfd_error_no_error) |
return NULL; |
} |
return coff_real_object_p (abfd, internal_f.f_nscns, &internal_f, |
result = coff_real_object_p (abfd, internal_f.f_nscns, &internal_f, |
(opt_hdr_size != 0 |
? &internal_a |
: (struct internal_aouthdr *) NULL)); |
if (result) |
{ |
/* Now the whole header has been processed, see if there is a build-id */ |
pe_bfd_read_buildid(abfd); |
} |
return result; |
} |
#define coff_object_p pe_bfd_object_p |
#endif /* COFF_IMAGE_WITH_PE */ |
/contrib/toolchain/binutils/bfd/peigen.c |
---|
1,5 → 1,5 |
/* Support for the generic parts of PE/PEI; the common executable parts. |
Copyright 1995-2013 Free Software Foundation, Inc. |
Copyright (C) 1995-2015 Free Software Foundation, Inc. |
Written by Cygnus Solutions. |
This file is part of BFD, the Binary File Descriptor library. |
80,6 → 80,7 |
#include "coff/pe.h" |
#include "libcoff.h" |
#include "libpei.h" |
#include "safe-ctype.h" |
#if defined COFF_WITH_pep || defined COFF_WITH_pex64 |
# undef AOUTSZ |
87,6 → 88,10 |
# define PEAOUTHDR PEPAOUTHDR |
#endif |
#define HighBitSet(val) ((val) & 0x80000000) |
#define SetHighBit(val) ((val) | 0x80000000) |
#define WithoutHighBit(val) ((val) & 0x7fffffff) |
/* FIXME: This file has various tests of POWERPC_LE_PE. Those tests |
worked when the code was in peicode.h, but no longer work now that |
the code is in peigen.c. PowerPC NT is said to be dead. If |
141,8 → 146,13 |
name = _bfd_coff_internal_syment_name (abfd, in, namebuf); |
if (name == NULL) |
/* FIXME: Return error. */ |
abort (); |
{ |
_bfd_error_handler (_("%B: unable to find name for empty section"), |
abfd); |
bfd_set_error (bfd_error_invalid_target); |
return; |
} |
sec = bfd_get_section_by_name (abfd, name); |
if (sec != NULL) |
in->n_scnum = sec->target_index; |
162,15 → 172,22 |
{ |
name = (const char *) bfd_alloc (abfd, strlen (namebuf) + 1); |
if (name == NULL) |
/* FIXME: Return error. */ |
abort (); |
{ |
_bfd_error_handler (_("%B: out of memory creating name for empty section"), |
abfd); |
return; |
} |
strcpy ((char *) name, namebuf); |
} |
flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD; |
sec = bfd_make_section_anyway_with_flags (abfd, name, flags); |
if (sec == NULL) |
/* FIXME: Return error. */ |
abort (); |
{ |
_bfd_error_handler (_("%B: unable to create fake empty section"), |
abfd); |
return; |
} |
sec->vma = 0; |
sec->lma = 0; |
199,6 → 216,14 |
#endif |
} |
static bfd_boolean |
abs_finder (bfd * abfd ATTRIBUTE_UNUSED, asection * sec, void * data) |
{ |
bfd_vma abs_val = * (bfd_vma *) data; |
return (sec->vma <= abs_val) && ((sec->vma + (1ULL << 32)) > abs_val); |
} |
unsigned int |
_bfd_pei_swap_sym_out (bfd * abfd, void * inp, void * extp) |
{ |
213,6 → 238,34 |
else |
memcpy (ext->e.e_name, in->_n._n_name, SYMNMLEN); |
/* The PE32 and PE32+ formats only use 4 bytes to hold the value of a |
symbol. This is a problem on 64-bit targets where we can generate |
absolute symbols with values >= 1^32. We try to work around this |
problem by finding a section whose base address is sufficient to |
reduce the absolute value to < 1^32, and then transforming the |
symbol into a section relative symbol. This of course is a hack. */ |
if (sizeof (in->n_value) > 4 |
/* The strange computation of the shift amount is here in order to |
avoid a compile time warning about the comparison always being |
false. It does not matter if this test fails to work as expected |
as the worst that can happen is that some absolute symbols are |
needlessly converted into section relative symbols. */ |
&& in->n_value > ((1ULL << (sizeof (in->n_value) > 4 ? 32 : 31)) - 1) |
&& in->n_scnum == -1) |
{ |
asection * sec; |
sec = bfd_sections_find_if (abfd, abs_finder, & in->n_value); |
if (sec) |
{ |
in->n_value -= sec->vma; |
in->n_scnum = sec->target_index; |
} |
/* else: FIXME: The value is outside the range of any section. This |
happens for __image_base__ and __ImageBase and maybe some other |
symbols as well. We should find a way to handle these values. */ |
} |
H_PUT_32 (abfd, in->n_value, ext->e_value); |
H_PUT_16 (abfd, in->n_scnum, ext->e_scnum); |
239,6 → 292,9 |
AUXENT *ext = (AUXENT *) ext1; |
union internal_auxent *in = (union internal_auxent *) in1; |
/* PR 17521: Make sure that all fields in the aux structure |
are initialised. */ |
memset (in, 0, sizeof * in); |
switch (in_class) |
{ |
case C_FILE: |
414,6 → 470,7 |
aouthdr_int->entry = GET_AOUTHDR_ENTRY (abfd, aouthdr_ext->entry); |
aouthdr_int->text_start = |
GET_AOUTHDR_TEXT_START (abfd, aouthdr_ext->text_start); |
#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64) |
/* PE32+ does not have data_start member! */ |
aouthdr_int->data_start = |
460,6 → 517,19 |
{ |
int idx; |
/* PR 17512: Corrupt PE binaries can cause seg-faults. */ |
if (a->NumberOfRvaAndSizes > IMAGE_NUMBEROF_DIRECTORY_ENTRIES) |
{ |
(*_bfd_error_handler) |
(_("%B: aout header specifies an invalid number of data-directory entries: %d"), |
abfd, a->NumberOfRvaAndSizes); |
bfd_set_error (bfd_error_bad_value); |
/* Paranoia: If the number is corrupt, then assume that the |
actual entries themselves might be corrupt as well. */ |
a->NumberOfRvaAndSizes = 0; |
} |
for (idx = 0; idx < a->NumberOfRvaAndSizes; idx++) |
{ |
/* If data directory is empty, rva also should be 0. */ |
474,7 → 544,14 |
else |
a->DataDirectory[idx].VirtualAddress = 0; |
} |
while (idx < IMAGE_NUMBEROF_DIRECTORY_ENTRIES) |
{ |
a->DataDirectory[idx].Size = 0; |
a->DataDirectory[idx].VirtualAddress = 0; |
idx ++; |
} |
} |
if (aouthdr_int->entry) |
{ |
717,7 → 794,7 |
{ |
int idx; |
for (idx = 0; idx < 16; idx++) |
for (idx = 0; idx < IMAGE_NUMBEROF_DIRECTORY_ENTRIES; idx++) |
{ |
H_PUT_32 (abfd, extra->DataDirectory[idx].VirtualAddress, |
aouthdr_out->DataDirectory[idx][0]); |
977,8 → 1054,8 |
} |
if (coff_data (abfd)->link_info |
&& ! coff_data (abfd)->link_info->relocatable |
&& ! coff_data (abfd)->link_info->shared |
&& ! bfd_link_relocatable (coff_data (abfd)->link_info) |
&& ! bfd_link_pic (coff_data (abfd)->link_info) |
&& strcmp (scnhdr_int->s_name, ".text") == 0) |
{ |
/* By inference from looking at MS output, the 32 bit field |
1023,6 → 1100,121 |
return ret; |
} |
void |
_bfd_pei_swap_debugdir_in (bfd * abfd, void * ext1, void * in1) |
{ |
struct external_IMAGE_DEBUG_DIRECTORY *ext = (struct external_IMAGE_DEBUG_DIRECTORY *) ext1; |
struct internal_IMAGE_DEBUG_DIRECTORY *in = (struct internal_IMAGE_DEBUG_DIRECTORY *) in1; |
in->Characteristics = H_GET_32(abfd, ext->Characteristics); |
in->TimeDateStamp = H_GET_32(abfd, ext->TimeDateStamp); |
in->MajorVersion = H_GET_16(abfd, ext->MajorVersion); |
in->MinorVersion = H_GET_16(abfd, ext->MinorVersion); |
in->Type = H_GET_32(abfd, ext->Type); |
in->SizeOfData = H_GET_32(abfd, ext->SizeOfData); |
in->AddressOfRawData = H_GET_32(abfd, ext->AddressOfRawData); |
in->PointerToRawData = H_GET_32(abfd, ext->PointerToRawData); |
} |
unsigned int |
_bfd_pei_swap_debugdir_out (bfd * abfd, void * inp, void * extp) |
{ |
struct external_IMAGE_DEBUG_DIRECTORY *ext = (struct external_IMAGE_DEBUG_DIRECTORY *) extp; |
struct internal_IMAGE_DEBUG_DIRECTORY *in = (struct internal_IMAGE_DEBUG_DIRECTORY *) inp; |
H_PUT_32(abfd, in->Characteristics, ext->Characteristics); |
H_PUT_32(abfd, in->TimeDateStamp, ext->TimeDateStamp); |
H_PUT_16(abfd, in->MajorVersion, ext->MajorVersion); |
H_PUT_16(abfd, in->MinorVersion, ext->MinorVersion); |
H_PUT_32(abfd, in->Type, ext->Type); |
H_PUT_32(abfd, in->SizeOfData, ext->SizeOfData); |
H_PUT_32(abfd, in->AddressOfRawData, ext->AddressOfRawData); |
H_PUT_32(abfd, in->PointerToRawData, ext->PointerToRawData); |
return sizeof (struct external_IMAGE_DEBUG_DIRECTORY); |
} |
CODEVIEW_INFO * |
_bfd_pei_slurp_codeview_record (bfd * abfd, file_ptr where, unsigned long length, CODEVIEW_INFO *cvinfo) |
{ |
char buffer[256+1]; |
if (bfd_seek (abfd, where, SEEK_SET) != 0) |
return NULL; |
if (bfd_bread (buffer, 256, abfd) < 4) |
return NULL; |
/* Ensure null termination of filename. */ |
buffer[256] = '\0'; |
cvinfo->CVSignature = H_GET_32 (abfd, buffer); |
cvinfo->Age = 0; |
if ((cvinfo->CVSignature == CVINFO_PDB70_CVSIGNATURE) |
&& (length > sizeof (CV_INFO_PDB70))) |
{ |
CV_INFO_PDB70 *cvinfo70 = (CV_INFO_PDB70 *)(buffer); |
cvinfo->Age = H_GET_32(abfd, cvinfo70->Age); |
/* A GUID consists of 4,2,2 byte values in little-endian order, followed |
by 8 single bytes. Byte swap them so we can conveniently treat the GUID |
as 16 bytes in big-endian order. */ |
bfd_putb32 (bfd_getl32 (cvinfo70->Signature), cvinfo->Signature); |
bfd_putb16 (bfd_getl16 (&(cvinfo70->Signature[4])), &(cvinfo->Signature[4])); |
bfd_putb16 (bfd_getl16 (&(cvinfo70->Signature[6])), &(cvinfo->Signature[6])); |
memcpy (&(cvinfo->Signature[8]), &(cvinfo70->Signature[8]), 8); |
cvinfo->SignatureLength = CV_INFO_SIGNATURE_LENGTH; |
// cvinfo->PdbFileName = cvinfo70->PdbFileName; |
return cvinfo; |
} |
else if ((cvinfo->CVSignature == CVINFO_PDB20_CVSIGNATURE) |
&& (length > sizeof (CV_INFO_PDB20))) |
{ |
CV_INFO_PDB20 *cvinfo20 = (CV_INFO_PDB20 *)(buffer); |
cvinfo->Age = H_GET_32(abfd, cvinfo20->Age); |
memcpy (cvinfo->Signature, cvinfo20->Signature, 4); |
cvinfo->SignatureLength = 4; |
// cvinfo->PdbFileName = cvinfo20->PdbFileName; |
return cvinfo; |
} |
return NULL; |
} |
unsigned int |
_bfd_pei_write_codeview_record (bfd * abfd, file_ptr where, CODEVIEW_INFO *cvinfo) |
{ |
unsigned int size = sizeof (CV_INFO_PDB70) + 1; |
CV_INFO_PDB70 *cvinfo70; |
char buffer[size]; |
if (bfd_seek (abfd, where, SEEK_SET) != 0) |
return 0; |
cvinfo70 = (CV_INFO_PDB70 *) buffer; |
H_PUT_32 (abfd, CVINFO_PDB70_CVSIGNATURE, cvinfo70->CvSignature); |
/* Byte swap the GUID from 16 bytes in big-endian order to 4,2,2 byte values |
in little-endian order, followed by 8 single bytes. */ |
bfd_putl32 (bfd_getb32 (cvinfo->Signature), cvinfo70->Signature); |
bfd_putl16 (bfd_getb16 (&(cvinfo->Signature[4])), &(cvinfo70->Signature[4])); |
bfd_putl16 (bfd_getb16 (&(cvinfo->Signature[6])), &(cvinfo70->Signature[6])); |
memcpy (&(cvinfo70->Signature[8]), &(cvinfo->Signature[8]), 8); |
H_PUT_32 (abfd, cvinfo->Age, cvinfo70->Age); |
cvinfo70->PdbFileName[0] = '\0'; |
if (bfd_bwrite (buffer, size, abfd) != size) |
return 0; |
return size; |
} |
static char * dir_names[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] = |
{ |
N_("Export Directory [.edata (or where ever we found it)]"), |
1103,7 → 1295,14 |
_("\nThere is an import table, but the section containing it could not be found\n")); |
return TRUE; |
} |
else if (!(section->flags & SEC_HAS_CONTENTS)) |
{ |
fprintf (file, |
_("\nThere is an import table in %s, but that section has no contents\n"), |
section->name); |
return TRUE; |
} |
} |
fprintf (file, _("\nThere is an import table in %s at 0x%lx\n"), |
section->name, (unsigned long) addr); |
1214,7 → 1413,9 |
break; |
dll = (char *) data + dll_name - adj; |
fprintf (file, _("\n\tDLL Name: %s\n"), dll); |
/* PR 17512 file: 078-12277-0.004. */ |
bfd_size_type maxlen = (char *)(data + datasize) - dll - 1; |
fprintf (file, _("\n\tDLL Name: %.*s\n"), (int) maxlen, dll); |
if (hint_addr != 0) |
{ |
1279,6 → 1480,7 |
#ifdef COFF_WITH_pex64 |
for (j = 0; idx + j + 8 <= datasize; j += 8) |
{ |
bfd_size_type amt; |
unsigned long member = bfd_get_32 (abfd, data + idx + j); |
unsigned long member_high = bfd_get_32 (abfd, data + idx + j + 4); |
1285,17 → 1487,24 |
if (!member && !member_high) |
break; |
if (member_high & 0x80000000) |
amt = member - adj; |
if (HighBitSet (member_high)) |
fprintf (file, "\t%lx%08lx\t %4lx%08lx <none>", |
member_high,member, member_high & 0x7fffffff, member); |
member_high, member, |
WithoutHighBit (member_high), member); |
/* PR binutils/17512: Handle corrupt PE data. */ |
else if (amt + 2 >= datasize) |
fprintf (file, _("\t<corrupt: 0x%04lx>"), member); |
else |
{ |
int ordinal; |
char *member_name; |
ordinal = bfd_get_16 (abfd, data + member - adj); |
member_name = (char *) data + member - adj + 2; |
fprintf (file, "\t%04lx\t %4d %s",member, ordinal, member_name); |
ordinal = bfd_get_16 (abfd, data + amt); |
member_name = (char *) data + amt + 2; |
fprintf (file, "\t%04lx\t %4d %.*s",member, ordinal, |
(int) (datasize - (amt + 2)), member_name); |
} |
/* If the time stamp is not zero, the import address |
1311,6 → 1520,7 |
#else |
for (j = 0; idx + j + 4 <= datasize; j += 4) |
{ |
bfd_size_type amt; |
unsigned long member = bfd_get_32 (abfd, data + idx + j); |
/* Print single IMAGE_IMPORT_BY_NAME vector. */ |
1317,18 → 1527,23 |
if (member == 0) |
break; |
if (member & 0x80000000) |
amt = member - adj; |
if (HighBitSet (member)) |
fprintf (file, "\t%04lx\t %4lu <none>", |
member, member & 0x7fffffff); |
member, WithoutHighBit (member)); |
/* PR binutils/17512: Handle corrupt PE data. */ |
else if (amt + 2 >= datasize) |
fprintf (file, _("\t<corrupt: 0x%04lx>"), member); |
else |
{ |
int ordinal; |
char *member_name; |
ordinal = bfd_get_16 (abfd, data + member - adj); |
member_name = (char *) data + member - adj + 2; |
fprintf (file, "\t%04lx\t %4d %s", |
member, ordinal, member_name); |
ordinal = bfd_get_16 (abfd, data + amt); |
member_name = (char *) data + amt + 2; |
fprintf (file, "\t%04lx\t %4d %.*s", |
member, ordinal, |
(int) (datasize - (amt + 2)), member_name); |
} |
/* If the time stamp is not zero, the import address |
1364,7 → 1579,7 |
bfd_size_type datasize = 0; |
bfd_size_type dataoff; |
bfd_size_type i; |
bfd_signed_vma adj; |
bfd_vma adj; |
struct EDT_type |
{ |
long export_flags; /* Reserved - should be zero. */ |
1414,6 → 1629,13 |
_("\nThere is an export table, but the section containing it could not be found\n")); |
return TRUE; |
} |
else if (!(section->flags & SEC_HAS_CONTENTS)) |
{ |
fprintf (file, |
_("\nThere is an export table in %s, but that section has no contents\n"), |
section->name); |
return TRUE; |
} |
dataoff = addr - section->vma; |
datasize = extra->DataDirectory[PE_EXPORT_TABLE].Size; |
1426,6 → 1648,15 |
} |
} |
/* PR 17512: Handle corrupt PE binaries. */ |
if (datasize < 36) |
{ |
fprintf (file, |
_("\nThere is an export table in %s, but it is too small (%d)\n"), |
section->name, (int) datasize); |
return TRUE; |
} |
fprintf (file, _("\nThere is an export table in %s at 0x%lx\n"), |
section->name, (unsigned long) addr); |
1469,9 → 1700,14 |
fprintf (file, |
_("Name \t\t\t\t")); |
bfd_fprintf_vma (abfd, file, edt.name); |
fprintf (file, |
" %s\n", data + edt.name - adj); |
if ((edt.name >= adj) && (edt.name < adj + datasize)) |
fprintf (file, " %.*s\n", |
(int) (datasize - (edt.name - adj)), |
data + edt.name - adj); |
else |
fprintf (file, "(outside .edata section)\n"); |
fprintf (file, |
_("Ordinal Base \t\t\t%ld\n"), edt.base); |
1516,7 → 1752,16 |
_("\nExport Address Table -- Ordinal Base %ld\n"), |
edt.base); |
for (i = 0; i < edt.num_functions; ++i) |
/* PR 17512: Handle corrupt PE binaries. */ |
if (edt.eat_addr + (edt.num_functions * 4) - adj >= datasize |
/* PR 17512: file: 092b1829 */ |
|| (edt.num_functions * 4) < edt.num_functions |
/* PR 17512 file: 140-165018-0.004. */ |
|| data + edt.eat_addr - adj < data) |
fprintf (file, _("\tInvalid Export Address Table rva (0x%lx) or entry count (0x%lx)\n"), |
(long) edt.eat_addr, |
(long) edt.num_functions); |
else for (i = 0; i < edt.num_functions; ++i) |
{ |
bfd_vma eat_member = bfd_get_32 (abfd, |
data + edt.eat_addr + (i * 4) - adj); |
1528,11 → 1773,12 |
/* This rva is to a name (forwarding function) in our section. */ |
/* Should locate a function descriptor. */ |
fprintf (file, |
"\t[%4ld] +base[%4ld] %04lx %s -- %s\n", |
"\t[%4ld] +base[%4ld] %04lx %s -- %.*s\n", |
(long) i, |
(long) (i + edt.base), |
(unsigned long) eat_member, |
_("Forwarder RVA"), |
(int)(datasize - (eat_member - adj)), |
data + eat_member - adj); |
} |
else |
1552,22 → 1798,41 |
fprintf (file, |
_("\n[Ordinal/Name Pointer] Table\n")); |
for (i = 0; i < edt.num_names; ++i) |
/* PR 17512: Handle corrupt PE binaries. */ |
if (edt.npt_addr + (edt.num_names * 4) - adj >= datasize |
/* PR 17512: file: bb68816e. */ |
|| edt.num_names * 4 < edt.num_names |
|| (data + edt.npt_addr - adj) < data) |
fprintf (file, _("\tInvalid Name Pointer Table rva (0x%lx) or entry count (0x%lx)\n"), |
(long) edt.npt_addr, |
(long) edt.num_names); |
/* PR 17512: file: 140-147171-0.004. */ |
else if (edt.ot_addr + (edt.num_names * 2) - adj >= datasize |
|| data + edt.ot_addr - adj < data) |
fprintf (file, _("\tInvalid Ordinal Table rva (0x%lx) or entry count (0x%lx)\n"), |
(long) edt.ot_addr, |
(long) edt.num_names); |
else for (i = 0; i < edt.num_names; ++i) |
{ |
bfd_vma name_ptr = bfd_get_32 (abfd, |
data + |
edt.npt_addr |
+ (i*4) - adj); |
bfd_vma name_ptr; |
bfd_vma ord; |
ord = bfd_get_16 (abfd, data + edt.ot_addr + (i * 2) - adj); |
name_ptr = bfd_get_32 (abfd, data + edt.npt_addr + (i * 4) - adj); |
if ((name_ptr - adj) >= datasize) |
{ |
fprintf (file, _("\t[%4ld] <corrupt offset: %lx>\n"), |
(long) ord, (long) name_ptr); |
} |
else |
{ |
char *name = (char *) data + name_ptr - adj; |
bfd_vma ord = bfd_get_16 (abfd, |
data + |
edt.ot_addr |
+ (i*2) - adj); |
fprintf (file, |
"\t[%4ld] %s\n", (long) ord, name); |
fprintf (file, "\t[%4ld] %.*s\n", (long) ord, |
(int)((char *)(data + datasize) - name), name); |
} |
} |
free (data); |
1628,6 → 1893,14 |
if (datasize == 0) |
return TRUE; |
/* PR 17512: file: 002-193900-0.004. */ |
if (datasize < stop) |
{ |
fprintf (file, _("Virtual size of .pdata section (%ld) larger than real size (%ld)\n"), |
(long) stop, (long) datasize); |
return FALSE; |
} |
if (! bfd_malloc_and_get_section (abfd, section, &data)) |
{ |
if (data != NULL) |
1737,7 → 2010,11 |
if (storage < 0) |
return NULL; |
if (storage) |
{ |
sy = (asymbol **) bfd_malloc (storage); |
if (sy == NULL) |
return NULL; |
} |
psc->symcount = bfd_canonicalize_symtab (abfd, sy); |
if (psc->symcount < 0) |
1915,15 → 2192,11 |
FILE *file = (FILE *) vfile; |
bfd_byte *data = 0; |
asection *section = bfd_get_section_by_name (abfd, ".reloc"); |
bfd_size_type i; |
bfd_size_type start, stop; |
bfd_byte *p, *end; |
if (section == NULL) |
if (section == NULL || section->size == 0 || !(section->flags & SEC_HAS_CONTENTS)) |
return TRUE; |
if (section->size == 0) |
return TRUE; |
fprintf (file, |
_("\n\nPE File Base Relocations (interpreted .reloc section contents)\n")); |
1934,20 → 2207,20 |
return FALSE; |
} |
start = 0; |
stop = section->size; |
for (i = start; i < stop;) |
p = data; |
end = data + section->size; |
while (p + 8 <= end) |
{ |
int j; |
bfd_vma virtual_address; |
long number, size; |
unsigned long number, size; |
bfd_byte *chunk_end; |
/* The .reloc section is a sequence of blocks, with a header consisting |
of two 32 bit quantities, followed by a number of 16 bit entries. */ |
virtual_address = bfd_get_32 (abfd, data+i); |
size = bfd_get_32 (abfd, data+i+4); |
virtual_address = bfd_get_32 (abfd, p); |
size = bfd_get_32 (abfd, p + 4); |
p += 8; |
number = (size - 8) / 2; |
if (size == 0) |
1955,11 → 2228,15 |
fprintf (file, |
_("\nVirtual Address: %08lx Chunk size %ld (0x%lx) Number of fixups %ld\n"), |
(unsigned long) virtual_address, size, (unsigned long) size, number); |
(unsigned long) virtual_address, size, size, number); |
for (j = 0; j < number; ++j) |
chunk_end = p + size; |
if (chunk_end > end) |
chunk_end = end; |
j = 0; |
while (p + 2 <= chunk_end) |
{ |
unsigned short e = bfd_get_16 (abfd, data + i + 8 + j * 2); |
unsigned short e = bfd_get_16 (abfd, p); |
unsigned int t = (e & 0xF000) >> 12; |
int off = e & 0x0FFF; |
1970,27 → 2247,459 |
_("\treloc %4d offset %4x [%4lx] %s"), |
j, off, (unsigned long) (off + virtual_address), tbl[t]); |
p += 2; |
j++; |
/* HIGHADJ takes an argument, - the next record *is* the |
low 16 bits of addend. */ |
if (t == IMAGE_REL_BASED_HIGHADJ) |
if (t == IMAGE_REL_BASED_HIGHADJ && p + 2 <= chunk_end) |
{ |
fprintf (file, " (%4x)", |
((unsigned int) |
bfd_get_16 (abfd, data + i + 8 + j * 2 + 2))); |
fprintf (file, " (%4x)", (unsigned int) bfd_get_16 (abfd, p)); |
p += 2; |
j++; |
} |
fprintf (file, "\n"); |
} |
} |
i += size; |
free (data); |
return TRUE; |
} |
/* A data structure describing the regions of a .rsrc section. |
Some fields are filled in as the section is parsed. */ |
typedef struct rsrc_regions |
{ |
bfd_byte * section_start; |
bfd_byte * section_end; |
bfd_byte * strings_start; |
bfd_byte * resource_start; |
} rsrc_regions; |
static bfd_byte * |
rsrc_print_resource_directory (FILE * , bfd *, unsigned int, bfd_byte *, |
rsrc_regions *, bfd_vma); |
/* Print the resource entry at DATA, with the text indented by INDENT. |
Recusively calls rsrc_print_resource_directory to print the contents |
of directory entries. |
Returns the address of the end of the data associated with the entry |
or section_end + 1 upon failure. */ |
static bfd_byte * |
rsrc_print_resource_entries (FILE * file, |
bfd * abfd, |
unsigned int indent, |
bfd_boolean is_name, |
bfd_byte * data, |
rsrc_regions * regions, |
bfd_vma rva_bias) |
{ |
unsigned long entry, addr, size; |
bfd_byte * leaf; |
if (data + 8 >= regions->section_end) |
return regions->section_end + 1; |
fprintf (file, _("%03x %*.s Entry: "), (int)(data - regions->section_start), indent, " "); |
entry = (unsigned long) bfd_get_32 (abfd, data); |
if (is_name) |
{ |
bfd_byte * name; |
/* Note - the documentation says that this field is an RVA value |
but windres appears to produce a section relative offset with |
the top bit set. Support both styles for now. */ |
if (HighBitSet (entry)) |
name = regions->section_start + WithoutHighBit (entry); |
else |
name = regions->section_start + entry - rva_bias; |
if (name + 2 < regions->section_end && name > regions->section_start) |
{ |
unsigned int len; |
if (regions->strings_start == NULL) |
regions->strings_start = name; |
len = bfd_get_16 (abfd, name); |
fprintf (file, _("name: [val: %08lx len %d]: "), entry, len); |
if (name + 2 + len * 2 < regions->section_end) |
{ |
/* This strange loop is to cope with multibyte characters. */ |
while (len --) |
{ |
char c; |
name += 2; |
c = * name; |
/* Avoid printing control characters. */ |
if (c > 0 && c < 32) |
fprintf (file, "^%c", c + 64); |
else |
fprintf (file, "%.1s", name); |
} |
} |
else |
{ |
fprintf (file, _("<corrupt string length: %#x>\n"), len); |
/* PR binutils/17512: Do not try to continue decoding a |
corrupted resource section. It is likely to end up with |
reams of extraneous output. FIXME: We could probably |
continue if we disable the printing of strings... */ |
return regions->section_end + 1; |
} |
} |
else |
{ |
fprintf (file, _("<corrupt string offset: %#lx>\n"), entry); |
return regions->section_end + 1; |
} |
} |
else |
fprintf (file, _("ID: %#08lx"), entry); |
entry = (long) bfd_get_32 (abfd, data + 4); |
fprintf (file, _(", Value: %#08lx\n"), entry); |
if (HighBitSet (entry)) |
{ |
data = regions->section_start + WithoutHighBit (entry); |
if (data <= regions->section_start || data > regions->section_end) |
return regions->section_end + 1; |
/* FIXME: PR binutils/17512: A corrupt file could contain a loop |
in the resource table. We need some way to detect this. */ |
return rsrc_print_resource_directory (file, abfd, indent + 1, data, |
regions, rva_bias); |
} |
leaf = regions->section_start + entry; |
if (leaf + 16 >= regions->section_end |
/* PR 17512: file: 055dff7e. */ |
|| leaf < regions->section_start) |
return regions->section_end + 1; |
fprintf (file, _("%03x %*.s Leaf: Addr: %#08lx, Size: %#08lx, Codepage: %d\n"), |
(int) (entry), indent, " ", |
addr = (long) bfd_get_32 (abfd, leaf), |
size = (long) bfd_get_32 (abfd, leaf + 4), |
(int) bfd_get_32 (abfd, leaf + 8)); |
/* Check that the reserved entry is 0. */ |
if (bfd_get_32 (abfd, leaf + 12) != 0 |
/* And that the data address/size is valid too. */ |
|| (regions->section_start + (addr - rva_bias) + size > regions->section_end)) |
return regions->section_end + 1; |
if (regions->resource_start == NULL) |
regions->resource_start = regions->section_start + (addr - rva_bias); |
return regions->section_start + (addr - rva_bias) + size; |
} |
#define max(a,b) ((a) > (b) ? (a) : (b)) |
#define min(a,b) ((a) < (b) ? (a) : (b)) |
static bfd_byte * |
rsrc_print_resource_directory (FILE * file, |
bfd * abfd, |
unsigned int indent, |
bfd_byte * data, |
rsrc_regions * regions, |
bfd_vma rva_bias) |
{ |
unsigned int num_names, num_ids; |
bfd_byte * highest_data = data; |
if (data + 16 >= regions->section_end) |
return regions->section_end + 1; |
fprintf (file, "%03x %*.s ", (int)(data - regions->section_start), indent, " "); |
switch (indent) |
{ |
case 0: fprintf (file, "Type"); break; |
case 2: fprintf (file, "Name"); break; |
case 4: fprintf (file, "Language"); break; |
default: |
fprintf (file, _("<unknown directory type: %d>\n"), indent); |
/* FIXME: For now we end the printing here. If in the |
future more directory types are added to the RSRC spec |
then we will need to change this. */ |
return regions->section_end + 1; |
} |
fprintf (file, _(" Table: Char: %d, Time: %08lx, Ver: %d/%d, Num Names: %d, IDs: %d\n"), |
(int) bfd_get_32 (abfd, data), |
(long) bfd_get_32 (abfd, data + 4), |
(int) bfd_get_16 (abfd, data + 8), |
(int) bfd_get_16 (abfd, data + 10), |
num_names = (int) bfd_get_16 (abfd, data + 12), |
num_ids = (int) bfd_get_16 (abfd, data + 14)); |
data += 16; |
while (num_names --) |
{ |
bfd_byte * entry_end; |
entry_end = rsrc_print_resource_entries (file, abfd, indent + 1, TRUE, |
data, regions, rva_bias); |
data += 8; |
highest_data = max (highest_data, entry_end); |
if (entry_end >= regions->section_end) |
return entry_end; |
} |
while (num_ids --) |
{ |
bfd_byte * entry_end; |
entry_end = rsrc_print_resource_entries (file, abfd, indent + 1, FALSE, |
data, regions, rva_bias); |
data += 8; |
highest_data = max (highest_data, entry_end); |
if (entry_end >= regions->section_end) |
return entry_end; |
} |
return max (highest_data, data); |
} |
/* Display the contents of a .rsrc section. We do not try to |
reproduce the resources, windres does that. Instead we dump |
the tables in a human readable format. */ |
static bfd_boolean |
rsrc_print_section (bfd * abfd, void * vfile) |
{ |
bfd_vma rva_bias; |
pe_data_type * pe; |
FILE * file = (FILE *) vfile; |
bfd_size_type datasize; |
asection * section; |
bfd_byte * data; |
rsrc_regions regions; |
pe = pe_data (abfd); |
if (pe == NULL) |
return TRUE; |
section = bfd_get_section_by_name (abfd, ".rsrc"); |
if (section == NULL) |
return TRUE; |
if (!(section->flags & SEC_HAS_CONTENTS)) |
return TRUE; |
datasize = section->size; |
if (datasize == 0) |
return TRUE; |
rva_bias = section->vma - pe->pe_opthdr.ImageBase; |
if (! bfd_malloc_and_get_section (abfd, section, & data)) |
{ |
if (data != NULL) |
free (data); |
return FALSE; |
} |
regions.section_start = data; |
regions.section_end = data + datasize; |
regions.strings_start = NULL; |
regions.resource_start = NULL; |
fflush (file); |
fprintf (file, "\nThe .rsrc Resource Directory section:\n"); |
while (data < regions.section_end) |
{ |
bfd_byte * p = data; |
data = rsrc_print_resource_directory (file, abfd, 0, data, & regions, rva_bias); |
if (data == regions.section_end + 1) |
fprintf (file, _("Corrupt .rsrc section detected!\n")); |
else |
{ |
/* Align data before continuing. */ |
int align = (1 << section->alignment_power) - 1; |
data = (bfd_byte *) (((ptrdiff_t) (data + align)) & ~ align); |
rva_bias += data - p; |
/* For reasons that are unclear .rsrc sections are sometimes created |
aligned to a 1^3 boundary even when their alignment is set at |
1^2. Catch that case here before we issue a spurious warning |
message. */ |
if (data == (regions.section_end - 4)) |
data = regions.section_end; |
else if (data < regions.section_end) |
{ |
/* If the extra data is all zeros then do not complain. |
This is just padding so that the section meets the |
page size requirements. */ |
while (++ data < regions.section_end) |
if (*data != 0) |
break; |
if (data < regions.section_end) |
fprintf (file, _("\nWARNING: Extra data in .rsrc section - it will be ignored by Windows:\n")); |
} |
} |
} |
if (regions.strings_start != NULL) |
fprintf (file, " String table starts at offset: %#03x\n", |
(int) (regions.strings_start - regions.section_start)); |
if (regions.resource_start != NULL) |
fprintf (file, " Resources start at offset: %#03x\n", |
(int) (regions.resource_start - regions.section_start)); |
free (regions.section_start); |
return TRUE; |
} |
#define IMAGE_NUMBEROF_DEBUG_TYPES 12 |
static char * debug_type_names[IMAGE_NUMBEROF_DEBUG_TYPES] = |
{ |
"Unknown", |
"COFF", |
"CodeView", |
"FPO", |
"Misc", |
"Exception", |
"Fixup", |
"OMAP-to-SRC", |
"OMAP-from-SRC", |
"Borland", |
"Reserved", |
"CLSID", |
}; |
static bfd_boolean |
pe_print_debugdata (bfd * abfd, void * vfile) |
{ |
FILE *file = (FILE *) vfile; |
pe_data_type *pe = pe_data (abfd); |
struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr; |
asection *section; |
bfd_byte *data = 0; |
bfd_size_type dataoff; |
unsigned int i; |
bfd_vma addr = extra->DataDirectory[PE_DEBUG_DATA].VirtualAddress; |
bfd_size_type size = extra->DataDirectory[PE_DEBUG_DATA].Size; |
if (size == 0) |
return TRUE; |
addr += extra->ImageBase; |
for (section = abfd->sections; section != NULL; section = section->next) |
{ |
if ((addr >= section->vma) && (addr < (section->vma + section->size))) |
break; |
} |
if (section == NULL) |
{ |
fprintf (file, |
_("\nThere is a debug directory, but the section containing it could not be found\n")); |
return TRUE; |
} |
else if (!(section->flags & SEC_HAS_CONTENTS)) |
{ |
fprintf (file, |
_("\nThere is a debug directory in %s, but that section has no contents\n"), |
section->name); |
return TRUE; |
} |
else if (section->size < size) |
{ |
fprintf (file, |
_("\nError: section %s contains the debug data starting address but it is too small\n"), |
section->name); |
return FALSE; |
} |
fprintf (file, _("\nThere is a debug directory in %s at 0x%lx\n\n"), |
section->name, (unsigned long) addr); |
dataoff = addr - section->vma; |
if (size > (section->size - dataoff)) |
{ |
fprintf (file, _("The debug data size field in the data directory is too big for the section")); |
return FALSE; |
} |
fprintf (file, |
_("Type Size Rva Offset\n")); |
/* Read the whole section. */ |
if (!bfd_malloc_and_get_section (abfd, section, &data)) |
{ |
if (data != NULL) |
free (data); |
return FALSE; |
} |
for (i = 0; i < size / sizeof (struct external_IMAGE_DEBUG_DIRECTORY); i++) |
{ |
const char *type_name; |
struct external_IMAGE_DEBUG_DIRECTORY *ext |
= &((struct external_IMAGE_DEBUG_DIRECTORY *)(data + dataoff))[i]; |
struct internal_IMAGE_DEBUG_DIRECTORY idd; |
_bfd_pei_swap_debugdir_in (abfd, ext, &idd); |
if ((idd.Type) >= IMAGE_NUMBEROF_DEBUG_TYPES) |
type_name = debug_type_names[0]; |
else |
type_name = debug_type_names[idd.Type]; |
fprintf (file, " %2ld %14s %08lx %08lx %08lx\n", |
idd.Type, type_name, idd.SizeOfData, |
idd.AddressOfRawData, idd.PointerToRawData); |
if (idd.Type == PE_IMAGE_DEBUG_TYPE_CODEVIEW) |
{ |
char signature[CV_INFO_SIGNATURE_LENGTH * 2 + 1]; |
/* PR 17512: file: 065-29434-0.001:0.1 |
We need to use a 32-bit aligned buffer |
to safely read in a codeview record. */ |
char buffer[256 + 1] ATTRIBUTE_ALIGNED_ALIGNOF (CODEVIEW_INFO); |
CODEVIEW_INFO *cvinfo = (CODEVIEW_INFO *) buffer; |
/* The debug entry doesn't have to have to be in a section, |
in which case AddressOfRawData is 0, so always use PointerToRawData. */ |
if (!_bfd_pei_slurp_codeview_record (abfd, (file_ptr) idd.PointerToRawData, |
idd.SizeOfData, cvinfo)) |
continue; |
for (i = 0; i < cvinfo->SignatureLength; i++) |
sprintf (&signature[i*2], "%02x", cvinfo->Signature[i] & 0xff); |
fprintf (file, "(format %c%c%c%c signature %s age %ld)\n", |
buffer[0], buffer[1], buffer[2], buffer[3], |
signature, cvinfo->Age); |
} |
} |
if (size % sizeof (struct external_IMAGE_DEBUG_DIRECTORY) != 0) |
fprintf (file, |
_("The debug directory size is not a multiple of the debug directory entry size\n")); |
return TRUE; |
} |
/* Print out the program headers. */ |
bfd_boolean |
2164,10 → 2873,26 |
else |
pe_print_pdata (abfd, vfile); |
pe_print_reloc (abfd, vfile); |
pe_print_debugdata (abfd, file); |
rsrc_print_section (abfd, vfile); |
return TRUE; |
} |
static bfd_boolean |
is_vma_in_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sect, void *obj) |
{ |
bfd_vma addr = * (bfd_vma *) obj; |
return (addr >= sect->vma) && (addr < (sect->vma + sect->size)); |
} |
static asection * |
find_section_by_vma (bfd *abfd, bfd_vma addr) |
{ |
return bfd_sections_find_if (abfd, is_vma_in_section, (void *) & addr); |
} |
/* Copy any private info we understand from the input bfd |
to the output bfd. */ |
2206,6 → 2931,65 |
&& ! (pe_data (ibfd)->real_flags & IMAGE_FILE_RELOCS_STRIPPED)) |
pe_data (obfd)->dont_strip_reloc = 1; |
/* The file offsets contained in the debug directory need rewriting. */ |
if (ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size != 0) |
{ |
bfd_vma addr = ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].VirtualAddress |
+ ope->pe_opthdr.ImageBase; |
asection *section = find_section_by_vma (obfd, addr); |
bfd_byte *data; |
if (section && bfd_malloc_and_get_section (obfd, section, &data)) |
{ |
unsigned int i; |
struct external_IMAGE_DEBUG_DIRECTORY *dd = |
(struct external_IMAGE_DEBUG_DIRECTORY *)(data + (addr - section->vma)); |
/* PR 17512: file: 0f15796a. */ |
if (ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size + (addr - section->vma) |
> bfd_get_section_size (section)) |
{ |
_bfd_error_handler (_("%B: Data Directory size (%lx) exceeds space left in section (%lx)"), |
obfd, ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size, |
bfd_get_section_size (section) - (addr - section->vma)); |
return FALSE; |
} |
for (i = 0; i < ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size |
/ sizeof (struct external_IMAGE_DEBUG_DIRECTORY); i++) |
{ |
asection *ddsection; |
struct external_IMAGE_DEBUG_DIRECTORY *edd = &(dd[i]); |
struct internal_IMAGE_DEBUG_DIRECTORY idd; |
_bfd_pei_swap_debugdir_in (obfd, edd, &idd); |
if (idd.AddressOfRawData == 0) |
continue; /* RVA 0 means only offset is valid, not handled yet. */ |
ddsection = find_section_by_vma (obfd, idd.AddressOfRawData + ope->pe_opthdr.ImageBase); |
if (!ddsection) |
continue; /* Not in a section! */ |
idd.PointerToRawData = ddsection->filepos + (idd.AddressOfRawData |
+ ope->pe_opthdr.ImageBase) - ddsection->vma; |
_bfd_pei_swap_debugdir_out (obfd, &idd, edd); |
} |
if (!bfd_set_section_contents (obfd, section, data, 0, section->size)) |
{ |
_bfd_error_handler (_("Failed to update file offsets in debug directory")); |
return FALSE; |
} |
} |
else if (section) |
{ |
_bfd_error_handler (_("%B: Failed to read debug data section"), obfd); |
return FALSE; |
} |
} |
return TRUE; |
} |
2270,6 → 3054,1269 |
} |
#endif |
/* Functions to process a .rsrc section. */ |
static unsigned int sizeof_leaves; |
static unsigned int sizeof_strings; |
static unsigned int sizeof_tables_and_entries; |
static bfd_byte * |
rsrc_count_directory (bfd *, bfd_byte *, bfd_byte *, bfd_byte *, bfd_vma); |
static bfd_byte * |
rsrc_count_entries (bfd * abfd, |
bfd_boolean is_name, |
bfd_byte * datastart, |
bfd_byte * data, |
bfd_byte * dataend, |
bfd_vma rva_bias) |
{ |
unsigned long entry, addr, size; |
if (data + 8 >= dataend) |
return dataend + 1; |
if (is_name) |
{ |
bfd_byte * name; |
entry = (long) bfd_get_32 (abfd, data); |
if (HighBitSet (entry)) |
name = datastart + WithoutHighBit (entry); |
else |
name = datastart + entry - rva_bias; |
if (name + 2 >= dataend || name < datastart) |
return dataend + 1; |
unsigned int len = bfd_get_16 (abfd, name); |
if (len == 0 || len > 256) |
return dataend + 1; |
} |
entry = (long) bfd_get_32 (abfd, data + 4); |
if (HighBitSet (entry)) |
{ |
data = datastart + WithoutHighBit (entry); |
if (data <= datastart || data >= dataend) |
return dataend + 1; |
return rsrc_count_directory (abfd, datastart, data, dataend, rva_bias); |
} |
if (datastart + entry + 16 >= dataend) |
return dataend + 1; |
addr = (long) bfd_get_32 (abfd, datastart + entry); |
size = (long) bfd_get_32 (abfd, datastart + entry + 4); |
return datastart + addr - rva_bias + size; |
} |
static bfd_byte * |
rsrc_count_directory (bfd * abfd, |
bfd_byte * datastart, |
bfd_byte * data, |
bfd_byte * dataend, |
bfd_vma rva_bias) |
{ |
unsigned int num_entries, num_ids; |
bfd_byte * highest_data = data; |
if (data + 16 >= dataend) |
return dataend + 1; |
num_entries = (int) bfd_get_16 (abfd, data + 12); |
num_ids = (int) bfd_get_16 (abfd, data + 14); |
num_entries += num_ids; |
data += 16; |
while (num_entries --) |
{ |
bfd_byte * entry_end; |
entry_end = rsrc_count_entries (abfd, num_entries >= num_ids, |
datastart, data, dataend, rva_bias); |
data += 8; |
highest_data = max (highest_data, entry_end); |
if (entry_end >= dataend) |
break; |
} |
return max (highest_data, data); |
} |
typedef struct rsrc_dir_chain |
{ |
unsigned int num_entries; |
struct rsrc_entry * first_entry; |
struct rsrc_entry * last_entry; |
} rsrc_dir_chain; |
typedef struct rsrc_directory |
{ |
unsigned int characteristics; |
unsigned int time; |
unsigned int major; |
unsigned int minor; |
rsrc_dir_chain names; |
rsrc_dir_chain ids; |
struct rsrc_entry * entry; |
} rsrc_directory; |
typedef struct rsrc_string |
{ |
unsigned int len; |
bfd_byte * string; |
} rsrc_string; |
typedef struct rsrc_leaf |
{ |
unsigned int size; |
unsigned int codepage; |
bfd_byte * data; |
} rsrc_leaf; |
typedef struct rsrc_entry |
{ |
bfd_boolean is_name; |
union |
{ |
unsigned int id; |
struct rsrc_string name; |
} name_id; |
bfd_boolean is_dir; |
union |
{ |
struct rsrc_directory * directory; |
struct rsrc_leaf * leaf; |
} value; |
struct rsrc_entry * next_entry; |
struct rsrc_directory * parent; |
} rsrc_entry; |
static bfd_byte * |
rsrc_parse_directory (bfd *, rsrc_directory *, bfd_byte *, |
bfd_byte *, bfd_byte *, bfd_vma, rsrc_entry *); |
static bfd_byte * |
rsrc_parse_entry (bfd * abfd, |
bfd_boolean is_name, |
rsrc_entry * entry, |
bfd_byte * datastart, |
bfd_byte * data, |
bfd_byte * dataend, |
bfd_vma rva_bias, |
rsrc_directory * parent) |
{ |
unsigned long val, addr, size; |
val = bfd_get_32 (abfd, data); |
entry->parent = parent; |
entry->is_name = is_name; |
if (is_name) |
{ |
bfd_byte * address; |
if (HighBitSet (val)) |
{ |
val = WithoutHighBit (val); |
address = datastart + val; |
} |
else |
{ |
address = datastart + val - rva_bias; |
} |
if (address + 3 > dataend) |
return dataend; |
entry->name_id.name.len = bfd_get_16 (abfd, address); |
entry->name_id.name.string = address + 2; |
} |
else |
entry->name_id.id = val; |
val = bfd_get_32 (abfd, data + 4); |
if (HighBitSet (val)) |
{ |
entry->is_dir = TRUE; |
entry->value.directory = bfd_malloc (sizeof * entry->value.directory); |
if (entry->value.directory == NULL) |
return dataend; |
return rsrc_parse_directory (abfd, entry->value.directory, |
datastart, |
datastart + WithoutHighBit (val), |
dataend, rva_bias, entry); |
} |
entry->is_dir = FALSE; |
entry->value.leaf = bfd_malloc (sizeof * entry->value.leaf); |
if (entry->value.leaf == NULL) |
return dataend; |
data = datastart + val; |
if (data < datastart || data >= dataend) |
return dataend; |
addr = bfd_get_32 (abfd, data); |
size = entry->value.leaf->size = bfd_get_32 (abfd, data + 4); |
entry->value.leaf->codepage = bfd_get_32 (abfd, data + 8); |
/* FIXME: We assume that the reserved field (data + 12) is OK. */ |
entry->value.leaf->data = bfd_malloc (size); |
if (entry->value.leaf->data == NULL) |
return dataend; |
memcpy (entry->value.leaf->data, datastart + addr - rva_bias, size); |
return datastart + (addr - rva_bias) + size; |
} |
static bfd_byte * |
rsrc_parse_entries (bfd * abfd, |
rsrc_dir_chain * chain, |
bfd_boolean is_name, |
bfd_byte * highest_data, |
bfd_byte * datastart, |
bfd_byte * data, |
bfd_byte * dataend, |
bfd_vma rva_bias, |
rsrc_directory * parent) |
{ |
unsigned int i; |
rsrc_entry * entry; |
if (chain->num_entries == 0) |
{ |
chain->first_entry = chain->last_entry = NULL; |
return highest_data; |
} |
entry = bfd_malloc (sizeof * entry); |
if (entry == NULL) |
return dataend; |
chain->first_entry = entry; |
for (i = chain->num_entries; i--;) |
{ |
bfd_byte * entry_end; |
entry_end = rsrc_parse_entry (abfd, is_name, entry, datastart, |
data, dataend, rva_bias, parent); |
data += 8; |
highest_data = max (entry_end, highest_data); |
if (entry_end > dataend) |
return dataend; |
if (i) |
{ |
entry->next_entry = bfd_malloc (sizeof * entry); |
entry = entry->next_entry; |
if (entry == NULL) |
return dataend; |
} |
else |
entry->next_entry = NULL; |
} |
chain->last_entry = entry; |
return highest_data; |
} |
static bfd_byte * |
rsrc_parse_directory (bfd * abfd, |
rsrc_directory * table, |
bfd_byte * datastart, |
bfd_byte * data, |
bfd_byte * dataend, |
bfd_vma rva_bias, |
rsrc_entry * entry) |
{ |
bfd_byte * highest_data = data; |
if (table == NULL) |
return dataend; |
table->characteristics = bfd_get_32 (abfd, data); |
table->time = bfd_get_32 (abfd, data + 4); |
table->major = bfd_get_16 (abfd, data + 8); |
table->minor = bfd_get_16 (abfd, data + 10); |
table->names.num_entries = bfd_get_16 (abfd, data + 12); |
table->ids.num_entries = bfd_get_16 (abfd, data + 14); |
table->entry = entry; |
data += 16; |
highest_data = rsrc_parse_entries (abfd, & table->names, TRUE, data, |
datastart, data, dataend, rva_bias, table); |
data += table->names.num_entries * 8; |
highest_data = rsrc_parse_entries (abfd, & table->ids, FALSE, highest_data, |
datastart, data, dataend, rva_bias, table); |
data += table->ids.num_entries * 8; |
return max (highest_data, data); |
} |
typedef struct rsrc_write_data |
{ |
bfd * abfd; |
bfd_byte * datastart; |
bfd_byte * next_table; |
bfd_byte * next_leaf; |
bfd_byte * next_string; |
bfd_byte * next_data; |
bfd_vma rva_bias; |
} rsrc_write_data; |
static void |
rsrc_write_string (rsrc_write_data * data, |
rsrc_string * string) |
{ |
bfd_put_16 (data->abfd, string->len, data->next_string); |
memcpy (data->next_string + 2, string->string, string->len * 2); |
data->next_string += (string->len + 1) * 2; |
} |
static inline unsigned int |
rsrc_compute_rva (rsrc_write_data * data, |
bfd_byte * addr) |
{ |
return (addr - data->datastart) + data->rva_bias; |
} |
static void |
rsrc_write_leaf (rsrc_write_data * data, |
rsrc_leaf * leaf) |
{ |
bfd_put_32 (data->abfd, rsrc_compute_rva (data, data->next_data), |
data->next_leaf); |
bfd_put_32 (data->abfd, leaf->size, data->next_leaf + 4); |
bfd_put_32 (data->abfd, leaf->codepage, data->next_leaf + 8); |
bfd_put_32 (data->abfd, 0 /*reserved*/, data->next_leaf + 12); |
data->next_leaf += 16; |
memcpy (data->next_data, leaf->data, leaf->size); |
/* An undocumented feature of Windows resources is that each unit |
of raw data is 8-byte aligned... */ |
data->next_data += ((leaf->size + 7) & ~7); |
} |
static void rsrc_write_directory (rsrc_write_data *, rsrc_directory *); |
static void |
rsrc_write_entry (rsrc_write_data * data, |
bfd_byte * where, |
rsrc_entry * entry) |
{ |
if (entry->is_name) |
{ |
bfd_put_32 (data->abfd, |
SetHighBit (data->next_string - data->datastart), |
where); |
rsrc_write_string (data, & entry->name_id.name); |
} |
else |
bfd_put_32 (data->abfd, entry->name_id.id, where); |
if (entry->is_dir) |
{ |
bfd_put_32 (data->abfd, |
SetHighBit (data->next_table - data->datastart), |
where + 4); |
rsrc_write_directory (data, entry->value.directory); |
} |
else |
{ |
bfd_put_32 (data->abfd, data->next_leaf - data->datastart, where + 4); |
rsrc_write_leaf (data, entry->value.leaf); |
} |
} |
static void |
rsrc_compute_region_sizes (rsrc_directory * dir) |
{ |
struct rsrc_entry * entry; |
if (dir == NULL) |
return; |
sizeof_tables_and_entries += 16; |
for (entry = dir->names.first_entry; entry != NULL; entry = entry->next_entry) |
{ |
sizeof_tables_and_entries += 8; |
sizeof_strings += (entry->name_id.name.len + 1) * 2; |
if (entry->is_dir) |
rsrc_compute_region_sizes (entry->value.directory); |
else |
sizeof_leaves += 16; |
} |
for (entry = dir->ids.first_entry; entry != NULL; entry = entry->next_entry) |
{ |
sizeof_tables_and_entries += 8; |
if (entry->is_dir) |
rsrc_compute_region_sizes (entry->value.directory); |
else |
sizeof_leaves += 16; |
} |
} |
static void |
rsrc_write_directory (rsrc_write_data * data, |
rsrc_directory * dir) |
{ |
rsrc_entry * entry; |
unsigned int i; |
bfd_byte * next_entry; |
bfd_byte * nt; |
bfd_put_32 (data->abfd, dir->characteristics, data->next_table); |
bfd_put_32 (data->abfd, 0 /*dir->time*/, data->next_table + 4); |
bfd_put_16 (data->abfd, dir->major, data->next_table + 8); |
bfd_put_16 (data->abfd, dir->minor, data->next_table + 10); |
bfd_put_16 (data->abfd, dir->names.num_entries, data->next_table + 12); |
bfd_put_16 (data->abfd, dir->ids.num_entries, data->next_table + 14); |
/* Compute where the entries and the next table will be placed. */ |
next_entry = data->next_table + 16; |
data->next_table = next_entry + (dir->names.num_entries * 8) |
+ (dir->ids.num_entries * 8); |
nt = data->next_table; |
/* Write the entries. */ |
for (i = dir->names.num_entries, entry = dir->names.first_entry; |
i > 0 && entry != NULL; |
i--, entry = entry->next_entry) |
{ |
BFD_ASSERT (entry->is_name); |
rsrc_write_entry (data, next_entry, entry); |
next_entry += 8; |
} |
BFD_ASSERT (i == 0); |
BFD_ASSERT (entry == NULL); |
for (i = dir->ids.num_entries, entry = dir->ids.first_entry; |
i > 0 && entry != NULL; |
i--, entry = entry->next_entry) |
{ |
BFD_ASSERT (! entry->is_name); |
rsrc_write_entry (data, next_entry, entry); |
next_entry += 8; |
} |
BFD_ASSERT (i == 0); |
BFD_ASSERT (entry == NULL); |
BFD_ASSERT (nt == next_entry); |
} |
#if defined HAVE_WCHAR_H && ! defined __CYGWIN__ && ! defined __MINGW32__ |
/* Return the length (number of units) of the first character in S, |
putting its 'ucs4_t' representation in *PUC. */ |
static unsigned int |
#if defined HAVE_WCTYPE_H |
u16_mbtouc (wint_t * puc, const unsigned short * s, unsigned int n) |
#else |
u16_mbtouc (wchar_t * puc, const unsigned short * s, unsigned int n) |
#endif |
{ |
unsigned short c = * s; |
if (c < 0xd800 || c >= 0xe000) |
{ |
*puc = c; |
return 1; |
} |
if (c < 0xdc00) |
{ |
if (n >= 2) |
{ |
if (s[1] >= 0xdc00 && s[1] < 0xe000) |
{ |
*puc = 0x10000 + ((c - 0xd800) << 10) + (s[1] - 0xdc00); |
return 2; |
} |
} |
else |
{ |
/* Incomplete multibyte character. */ |
*puc = 0xfffd; |
return n; |
} |
} |
/* Invalid multibyte character. */ |
*puc = 0xfffd; |
return 1; |
} |
#endif /* HAVE_WCHAR_H and not Cygwin/Mingw */ |
/* Perform a comparison of two entries. */ |
static signed int |
rsrc_cmp (bfd_boolean is_name, rsrc_entry * a, rsrc_entry * b) |
{ |
signed int res; |
bfd_byte * astring; |
unsigned int alen; |
bfd_byte * bstring; |
unsigned int blen; |
if (! is_name) |
return a->name_id.id - b->name_id.id; |
/* We have to perform a case insenstive, unicode string comparison... */ |
astring = a->name_id.name.string; |
alen = a->name_id.name.len; |
bstring = b->name_id.name.string; |
blen = b->name_id.name.len; |
#if defined __CYGWIN__ || defined __MINGW32__ |
/* Under Windows hosts (both Cygwin and Mingw types), |
unicode == UTF-16 == wchar_t. The case insensitive string comparison |
function however goes by different names in the two environments... */ |
#undef rscpcmp |
#ifdef __CYGWIN__ |
#define rscpcmp wcsncasecmp |
#endif |
#ifdef __MINGW32__ |
#define rscpcmp wcsnicmp |
#endif |
res = rscpcmp ((const wchar_t *) astring, (const wchar_t *) bstring, |
min (alen, blen)); |
#elif defined HAVE_WCHAR_H |
{ |
unsigned int i; |
res = 0; |
for (i = min (alen, blen); i--; astring += 2, bstring += 2) |
{ |
#if defined HAVE_WCTYPE_H |
wint_t awc; |
wint_t bwc; |
#else |
wchar_t awc; |
wchar_t bwc; |
#endif |
/* Convert UTF-16 unicode characters into wchar_t characters |
so that we can then perform a case insensitive comparison. */ |
unsigned int Alen = u16_mbtouc (& awc, (const unsigned short *) astring, 2); |
unsigned int Blen = u16_mbtouc (& bwc, (const unsigned short *) bstring, 2); |
if (Alen != Blen) |
return Alen - Blen; |
#ifdef HAVE_WCTYPE_H |
awc = towlower (awc); |
bwc = towlower (bwc); |
res = awc - bwc; |
#else |
res = wcsncasecmp (& awc, & bwc, 1); |
#endif |
if (res) |
break; |
} |
} |
#else |
/* Do the best we can - a case sensitive, untranslated comparison. */ |
res = memcmp (astring, bstring, min (alen, blen) * 2); |
#endif |
if (res == 0) |
res = alen - blen; |
return res; |
} |
static void |
rsrc_print_name (char * buffer, rsrc_string string) |
{ |
unsigned int i; |
bfd_byte * name = string.string; |
for (i = string.len; i--; name += 2) |
sprintf (buffer + strlen (buffer), "%.1s", name); |
} |
static const char * |
rsrc_resource_name (rsrc_entry * entry, rsrc_directory * dir) |
{ |
static char buffer [256]; |
bfd_boolean is_string = FALSE; |
buffer[0] = 0; |
if (dir != NULL && dir->entry != NULL && dir->entry->parent != NULL |
&& dir->entry->parent->entry != NULL) |
{ |
strcpy (buffer, "type: "); |
if (dir->entry->parent->entry->is_name) |
rsrc_print_name (buffer + strlen (buffer), |
dir->entry->parent->entry->name_id.name); |
else |
{ |
unsigned int id = dir->entry->parent->entry->name_id.id; |
sprintf (buffer + strlen (buffer), "%x", id); |
switch (id) |
{ |
case 1: strcat (buffer, " (CURSOR)"); break; |
case 2: strcat (buffer, " (BITMAP)"); break; |
case 3: strcat (buffer, " (ICON)"); break; |
case 4: strcat (buffer, " (MENU)"); break; |
case 5: strcat (buffer, " (DIALOG)"); break; |
case 6: strcat (buffer, " (STRING)"); is_string = TRUE; break; |
case 7: strcat (buffer, " (FONTDIR)"); break; |
case 8: strcat (buffer, " (FONT)"); break; |
case 9: strcat (buffer, " (ACCELERATOR)"); break; |
case 10: strcat (buffer, " (RCDATA)"); break; |
case 11: strcat (buffer, " (MESSAGETABLE)"); break; |
case 12: strcat (buffer, " (GROUP_CURSOR)"); break; |
case 14: strcat (buffer, " (GROUP_ICON)"); break; |
case 16: strcat (buffer, " (VERSION)"); break; |
case 17: strcat (buffer, " (DLGINCLUDE)"); break; |
case 19: strcat (buffer, " (PLUGPLAY)"); break; |
case 20: strcat (buffer, " (VXD)"); break; |
case 21: strcat (buffer, " (ANICURSOR)"); break; |
case 22: strcat (buffer, " (ANIICON)"); break; |
case 23: strcat (buffer, " (HTML)"); break; |
case 24: strcat (buffer, " (MANIFEST)"); break; |
case 240: strcat (buffer, " (DLGINIT)"); break; |
case 241: strcat (buffer, " (TOOLBAR)"); break; |
} |
} |
} |
if (dir != NULL && dir->entry != NULL) |
{ |
strcat (buffer, " name: "); |
if (dir->entry->is_name) |
rsrc_print_name (buffer + strlen (buffer), dir->entry->name_id.name); |
else |
{ |
unsigned int id = dir->entry->name_id.id; |
sprintf (buffer + strlen (buffer), "%x", id); |
if (is_string) |
sprintf (buffer + strlen (buffer), " (resource id range: %d - %d)", |
(id - 1) << 4, (id << 4) - 1); |
} |
} |
if (entry != NULL) |
{ |
strcat (buffer, " lang: "); |
if (entry->is_name) |
rsrc_print_name (buffer + strlen (buffer), entry->name_id.name); |
else |
sprintf (buffer + strlen (buffer), "%x", entry->name_id.id); |
} |
return buffer; |
} |
/* *sigh* Windows resource strings are special. Only the top 28-bits of |
their ID is stored in the NAME entry. The bottom four bits are used as |
an index into unicode string table that makes up the data of the leaf. |
So identical type-name-lang string resources may not actually be |
identical at all. |
This function is called when we have detected two string resources with |
match top-28-bit IDs. We have to scan the string tables inside the leaves |
and discover if there are any real collisions. If there are then we report |
them and return FALSE. Otherwise we copy any strings from B into A and |
then return TRUE. */ |
static bfd_boolean |
rsrc_merge_string_entries (rsrc_entry * a ATTRIBUTE_UNUSED, |
rsrc_entry * b ATTRIBUTE_UNUSED) |
{ |
unsigned int copy_needed = 0; |
unsigned int i; |
bfd_byte * astring; |
bfd_byte * bstring; |
bfd_byte * new_data; |
bfd_byte * nstring; |
/* Step one: Find out what we have to do. */ |
BFD_ASSERT (! a->is_dir); |
astring = a->value.leaf->data; |
BFD_ASSERT (! b->is_dir); |
bstring = b->value.leaf->data; |
for (i = 0; i < 16; i++) |
{ |
unsigned int alen = astring[0] + (astring[1] << 8); |
unsigned int blen = bstring[0] + (bstring[1] << 8); |
if (alen == 0) |
{ |
copy_needed += blen * 2; |
} |
else if (blen == 0) |
; |
else if (alen != blen) |
/* FIXME: Should we continue the loop in order to report other duplicates ? */ |
break; |
/* alen == blen != 0. We might have two identical strings. If so we |
can ignore the second one. There is no need for wchar_t vs UTF-16 |
theatrics here - we are only interested in (case sensitive) equality. */ |
else if (memcmp (astring + 2, bstring + 2, alen * 2) != 0) |
break; |
astring += (alen + 1) * 2; |
bstring += (blen + 1) * 2; |
} |
if (i != 16) |
{ |
if (a->parent != NULL |
&& a->parent->entry != NULL |
&& a->parent->entry->is_name == FALSE) |
_bfd_error_handler (_(".rsrc merge failure: duplicate string resource: %d"), |
((a->parent->entry->name_id.id - 1) << 4) + i); |
return FALSE; |
} |
if (copy_needed == 0) |
return TRUE; |
/* If we reach here then A and B must both have non-colliding strings. |
(We never get string resources with fully empty string tables). |
We need to allocate an extra COPY_NEEDED bytes in A and then bring |
in B's strings. */ |
new_data = bfd_malloc (a->value.leaf->size + copy_needed); |
if (new_data == NULL) |
return FALSE; |
nstring = new_data; |
astring = a->value.leaf->data; |
bstring = b->value.leaf->data; |
for (i = 0; i < 16; i++) |
{ |
unsigned int alen = astring[0] + (astring[1] << 8); |
unsigned int blen = bstring[0] + (bstring[1] << 8); |
if (alen != 0) |
{ |
memcpy (nstring, astring, (alen + 1) * 2); |
nstring += (alen + 1) * 2; |
} |
else if (blen != 0) |
{ |
memcpy (nstring, bstring, (blen + 1) * 2); |
nstring += (blen + 1) * 2; |
} |
else |
{ |
* nstring++ = 0; |
* nstring++ = 0; |
} |
astring += (alen + 1) * 2; |
bstring += (blen + 1) * 2; |
} |
BFD_ASSERT (nstring - new_data == (signed) (a->value.leaf->size + copy_needed)); |
free (a->value.leaf->data); |
a->value.leaf->data = new_data; |
a->value.leaf->size += copy_needed; |
return TRUE; |
} |
static void rsrc_merge (rsrc_entry *, rsrc_entry *); |
/* Sort the entries in given part of the directory. |
We use an old fashioned bubble sort because we are dealing |
with lists and we want to handle matches specially. */ |
static void |
rsrc_sort_entries (rsrc_dir_chain * chain, |
bfd_boolean is_name, |
rsrc_directory * dir) |
{ |
rsrc_entry * entry; |
rsrc_entry * next; |
rsrc_entry ** points_to_entry; |
bfd_boolean swapped; |
if (chain->num_entries < 2) |
return; |
do |
{ |
swapped = FALSE; |
points_to_entry = & chain->first_entry; |
entry = * points_to_entry; |
next = entry->next_entry; |
do |
{ |
signed int cmp = rsrc_cmp (is_name, entry, next); |
if (cmp > 0) |
{ |
entry->next_entry = next->next_entry; |
next->next_entry = entry; |
* points_to_entry = next; |
points_to_entry = & next->next_entry; |
next = entry->next_entry; |
swapped = TRUE; |
} |
else if (cmp == 0) |
{ |
if (entry->is_dir && next->is_dir) |
{ |
/* When we encounter identical directory entries we have to |
merge them together. The exception to this rule is for |
resource manifests - there can only be one of these, |
even if they differ in language. Zero-language manifests |
are assumed to be default manifests (provided by the |
Cygwin/MinGW build system) and these can be silently dropped, |
unless that would reduce the number of manifests to zero. |
There should only ever be one non-zero lang manifest - |
if there are more it is an error. A non-zero lang |
manifest takes precedence over a default manifest. */ |
if (entry->is_name == FALSE |
&& entry->name_id.id == 1 |
&& dir != NULL |
&& dir->entry != NULL |
&& dir->entry->is_name == FALSE |
&& dir->entry->name_id.id == 0x18) |
{ |
if (next->value.directory->names.num_entries == 0 |
&& next->value.directory->ids.num_entries == 1 |
&& next->value.directory->ids.first_entry->is_name == FALSE |
&& next->value.directory->ids.first_entry->name_id.id == 0) |
/* Fall through so that NEXT is dropped. */ |
; |
else if (entry->value.directory->names.num_entries == 0 |
&& entry->value.directory->ids.num_entries == 1 |
&& entry->value.directory->ids.first_entry->is_name == FALSE |
&& entry->value.directory->ids.first_entry->name_id.id == 0) |
{ |
/* Swap ENTRY and NEXT. Then fall through so that the old ENTRY is dropped. */ |
entry->next_entry = next->next_entry; |
next->next_entry = entry; |
* points_to_entry = next; |
points_to_entry = & next->next_entry; |
next = entry->next_entry; |
swapped = TRUE; |
} |
else |
{ |
_bfd_error_handler (_(".rsrc merge failure: multiple non-default manifests")); |
bfd_set_error (bfd_error_file_truncated); |
return; |
} |
/* Unhook NEXT from the chain. */ |
/* FIXME: memory loss here. */ |
entry->next_entry = next->next_entry; |
chain->num_entries --; |
if (chain->num_entries < 2) |
return; |
next = next->next_entry; |
} |
else |
rsrc_merge (entry, next); |
} |
else if (entry->is_dir != next->is_dir) |
{ |
_bfd_error_handler (_(".rsrc merge failure: a directory matches a leaf")); |
bfd_set_error (bfd_error_file_truncated); |
return; |
} |
else |
{ |
/* Otherwise with identical leaves we issue an error |
message - because there should never be duplicates. |
The exception is Type 18/Name 1/Lang 0 which is the |
defaul manifest - this can just be dropped. */ |
if (entry->is_name == FALSE |
&& entry->name_id.id == 0 |
&& dir != NULL |
&& dir->entry != NULL |
&& dir->entry->is_name == FALSE |
&& dir->entry->name_id.id == 1 |
&& dir->entry->parent != NULL |
&& dir->entry->parent->entry != NULL |
&& dir->entry->parent->entry->is_name == FALSE |
&& dir->entry->parent->entry->name_id.id == 0x18 /* RT_MANIFEST */) |
; |
else if (dir != NULL |
&& dir->entry != NULL |
&& dir->entry->parent != NULL |
&& dir->entry->parent->entry != NULL |
&& dir->entry->parent->entry->is_name == FALSE |
&& dir->entry->parent->entry->name_id.id == 0x6 /* RT_STRING */) |
{ |
/* Strings need special handling. */ |
if (! rsrc_merge_string_entries (entry, next)) |
{ |
/* _bfd_error_handler should have been called inside merge_strings. */ |
bfd_set_error (bfd_error_file_truncated); |
return; |
} |
} |
else |
{ |
if (dir == NULL |
|| dir->entry == NULL |
|| dir->entry->parent == NULL |
|| dir->entry->parent->entry == NULL) |
_bfd_error_handler (_(".rsrc merge failure: duplicate leaf")); |
else |
_bfd_error_handler (_(".rsrc merge failure: duplicate leaf: %s"), |
rsrc_resource_name (entry, dir)); |
bfd_set_error (bfd_error_file_truncated); |
return; |
} |
} |
/* Unhook NEXT from the chain. */ |
entry->next_entry = next->next_entry; |
chain->num_entries --; |
if (chain->num_entries < 2) |
return; |
next = next->next_entry; |
} |
else |
{ |
points_to_entry = & entry->next_entry; |
entry = next; |
next = next->next_entry; |
} |
} |
while (next); |
chain->last_entry = entry; |
} |
while (swapped); |
} |
/* Attach B's chain onto A. */ |
static void |
rsrc_attach_chain (rsrc_dir_chain * achain, rsrc_dir_chain * bchain) |
{ |
if (bchain->num_entries == 0) |
return; |
achain->num_entries += bchain->num_entries; |
if (achain->first_entry == NULL) |
{ |
achain->first_entry = bchain->first_entry; |
achain->last_entry = bchain->last_entry; |
} |
else |
{ |
achain->last_entry->next_entry = bchain->first_entry; |
achain->last_entry = bchain->last_entry; |
} |
bchain->num_entries = 0; |
bchain->first_entry = bchain->last_entry = NULL; |
} |
static void |
rsrc_merge (struct rsrc_entry * a, struct rsrc_entry * b) |
{ |
rsrc_directory * adir; |
rsrc_directory * bdir; |
BFD_ASSERT (a->is_dir); |
BFD_ASSERT (b->is_dir); |
adir = a->value.directory; |
bdir = b->value.directory; |
if (adir->characteristics != bdir->characteristics) |
{ |
_bfd_error_handler (_(".rsrc merge failure: dirs with differing characteristics\n")); |
bfd_set_error (bfd_error_file_truncated); |
return; |
} |
if (adir->major != bdir->major || adir->minor != bdir->minor) |
{ |
_bfd_error_handler (_(".rsrc merge failure: differing directory versions\n")); |
bfd_set_error (bfd_error_file_truncated); |
return; |
} |
/* Attach B's name chain to A. */ |
rsrc_attach_chain (& adir->names, & bdir->names); |
/* Attach B's ID chain to A. */ |
rsrc_attach_chain (& adir->ids, & bdir->ids); |
/* Now sort A's entries. */ |
rsrc_sort_entries (& adir->names, TRUE, adir); |
rsrc_sort_entries (& adir->ids, FALSE, adir); |
} |
/* Check the .rsrc section. If it contains multiple concatenated |
resources then we must merge them properly. Otherwise Windows |
will ignore all but the first set. */ |
static void |
rsrc_process_section (bfd * abfd, |
struct coff_final_link_info * pfinfo) |
{ |
rsrc_directory new_table; |
bfd_size_type size; |
asection * sec; |
pe_data_type * pe; |
bfd_vma rva_bias; |
bfd_byte * data; |
bfd_byte * datastart; |
bfd_byte * dataend; |
bfd_byte * new_data; |
unsigned int num_resource_sets; |
rsrc_directory * type_tables; |
rsrc_write_data write_data; |
unsigned int indx; |
bfd * input; |
unsigned int num_input_rsrc = 0; |
unsigned int max_num_input_rsrc = 4; |
ptrdiff_t * rsrc_sizes = NULL; |
new_table.names.num_entries = 0; |
new_table.ids.num_entries = 0; |
sec = bfd_get_section_by_name (abfd, ".rsrc"); |
if (sec == NULL || (size = sec->rawsize) == 0) |
return; |
pe = pe_data (abfd); |
if (pe == NULL) |
return; |
rva_bias = sec->vma - pe->pe_opthdr.ImageBase; |
data = bfd_malloc (size); |
if (data == NULL) |
return; |
datastart = data; |
if (! bfd_get_section_contents (abfd, sec, data, 0, size)) |
goto end; |
/* Step zero: Scan the input bfds looking for .rsrc sections and record |
their lengths. Note - we rely upon the fact that the linker script |
does *not* sort the input .rsrc sections, so that the order in the |
linkinfo list matches the order in the output .rsrc section. |
We need to know the lengths because each input .rsrc section has padding |
at the end of a variable amount. (It does not appear to be based upon |
the section alignment or the file alignment). We need to skip any |
padding bytes when parsing the input .rsrc sections. */ |
rsrc_sizes = bfd_malloc (max_num_input_rsrc * sizeof * rsrc_sizes); |
if (rsrc_sizes == NULL) |
goto end; |
for (input = pfinfo->info->input_bfds; |
input != NULL; |
input = input->link.next) |
{ |
asection * rsrc_sec = bfd_get_section_by_name (input, ".rsrc"); |
/* PR 18372 - skip discarded .rsrc sections. */ |
if (rsrc_sec != NULL && !discarded_section (rsrc_sec)) |
{ |
if (num_input_rsrc == max_num_input_rsrc) |
{ |
max_num_input_rsrc += 10; |
rsrc_sizes = bfd_realloc (rsrc_sizes, max_num_input_rsrc |
* sizeof * rsrc_sizes); |
if (rsrc_sizes == NULL) |
goto end; |
} |
BFD_ASSERT (rsrc_sec->size > 0); |
rsrc_sizes [num_input_rsrc ++] = rsrc_sec->size; |
} |
} |
if (num_input_rsrc < 2) |
goto end; |
/* Step one: Walk the section, computing the size of the tables, |
leaves and data and decide if we need to do anything. */ |
dataend = data + size; |
num_resource_sets = 0; |
while (data < dataend) |
{ |
bfd_byte * p = data; |
data = rsrc_count_directory (abfd, data, data, dataend, rva_bias); |
if (data > dataend) |
{ |
/* Corrupted .rsrc section - cannot merge. */ |
_bfd_error_handler (_("%s: .rsrc merge failure: corrupt .rsrc section"), |
bfd_get_filename (abfd)); |
bfd_set_error (bfd_error_file_truncated); |
goto end; |
} |
if ((data - p) > rsrc_sizes [num_resource_sets]) |
{ |
_bfd_error_handler (_("%s: .rsrc merge failure: unexpected .rsrc size"), |
bfd_get_filename (abfd)); |
bfd_set_error (bfd_error_file_truncated); |
goto end; |
} |
/* FIXME: Should we add a check for "data - p" being much smaller |
than rsrc_sizes[num_resource_sets] ? */ |
data = p + rsrc_sizes[num_resource_sets]; |
rva_bias += data - p; |
++ num_resource_sets; |
} |
BFD_ASSERT (num_resource_sets == num_input_rsrc); |
/* Step two: Walk the data again, building trees of the resources. */ |
data = datastart; |
rva_bias = sec->vma - pe->pe_opthdr.ImageBase; |
type_tables = bfd_malloc (num_resource_sets * sizeof * type_tables); |
if (type_tables == NULL) |
goto end; |
indx = 0; |
while (data < dataend) |
{ |
bfd_byte * p = data; |
(void) rsrc_parse_directory (abfd, type_tables + indx, data, data, |
dataend, rva_bias, NULL); |
data = p + rsrc_sizes[indx]; |
rva_bias += data - p; |
++ indx; |
} |
BFD_ASSERT (indx == num_resource_sets); |
/* Step three: Merge the top level tables (there can be only one). |
We must ensure that the merged entries are in ascending order. |
We also thread the top level table entries from the old tree onto |
the new table, so that they can be pulled off later. */ |
/* FIXME: Should we verify that all type tables are the same ? */ |
new_table.characteristics = type_tables[0].characteristics; |
new_table.time = type_tables[0].time; |
new_table.major = type_tables[0].major; |
new_table.minor = type_tables[0].minor; |
/* Chain the NAME entries onto the table. */ |
new_table.names.first_entry = NULL; |
new_table.names.last_entry = NULL; |
for (indx = 0; indx < num_resource_sets; indx++) |
rsrc_attach_chain (& new_table.names, & type_tables[indx].names); |
rsrc_sort_entries (& new_table.names, TRUE, & new_table); |
/* Chain the ID entries onto the table. */ |
new_table.ids.first_entry = NULL; |
new_table.ids.last_entry = NULL; |
for (indx = 0; indx < num_resource_sets; indx++) |
rsrc_attach_chain (& new_table.ids, & type_tables[indx].ids); |
rsrc_sort_entries (& new_table.ids, FALSE, & new_table); |
/* Step four: Create new contents for the .rsrc section. */ |
/* Step four point one: Compute the size of each region of the .rsrc section. |
We do this now, rather than earlier, as the merging above may have dropped |
some entries. */ |
sizeof_leaves = sizeof_strings = sizeof_tables_and_entries = 0; |
rsrc_compute_region_sizes (& new_table); |
/* We increment sizeof_strings to make sure that resource data |
starts on an 8-byte boundary. FIXME: Is this correct ? */ |
sizeof_strings = (sizeof_strings + 7) & ~ 7; |
new_data = bfd_zalloc (abfd, size); |
if (new_data == NULL) |
goto end; |
write_data.abfd = abfd; |
write_data.datastart = new_data; |
write_data.next_table = new_data; |
write_data.next_leaf = new_data + sizeof_tables_and_entries; |
write_data.next_string = write_data.next_leaf + sizeof_leaves; |
write_data.next_data = write_data.next_string + sizeof_strings; |
write_data.rva_bias = sec->vma - pe->pe_opthdr.ImageBase; |
rsrc_write_directory (& write_data, & new_table); |
/* Step five: Replace the old contents with the new. |
We recompute the size as we may have lost entries due to mergeing. */ |
size = ((write_data.next_data - new_data) + 3) & ~ 3; |
{ |
int page_size; |
if (coff_data (abfd)->link_info) |
{ |
page_size = pe_data (abfd)->pe_opthdr.FileAlignment; |
/* If no file alignment has been set, default to one. |
This repairs 'ld -r' for arm-wince-pe target. */ |
if (page_size == 0) |
page_size = 1; |
} |
else |
page_size = PE_DEF_FILE_ALIGNMENT; |
size = (size + page_size - 1) & - page_size; |
} |
bfd_set_section_contents (pfinfo->output_bfd, sec, new_data, 0, size); |
sec->size = sec->rawsize = size; |
end: |
/* Step six: Free all the memory that we have used. */ |
/* FIXME: Free the resource tree, if we have one. */ |
free (datastart); |
free (rsrc_sizes); |
} |
/* Handle the .idata section and other things that need symbol table |
access. */ |
2475,10 → 4522,14 |
} |
free (tmp_data); |
} |
else |
result = FALSE; |
} |
} |
#endif |
rsrc_process_section (abfd, pfinfo); |
/* If we couldn't find idata$2, we either have an excessively |
trivial program or are in DEEP trouble; we have to assume trivial |
program.... */ |
/contrib/toolchain/binutils/bfd/plugin.h |
---|
1,5 → 1,5 |
/* Plugin support for BFD. |
Copyright 2009 Free Software Foundation, Inc. |
Copyright (C) 2009-2015 Free Software Foundation, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
25,6 → 25,9 |
void bfd_plugin_set_program_name (const char *); |
void bfd_plugin_set_plugin (const char *); |
bfd_boolean bfd_plugin_target_p (const bfd_target *); |
bfd_boolean bfd_plugin_specified_p (void); |
void register_ld_plugin_object_p (const bfd_target *(*object_p) (bfd *)); |
typedef struct plugin_data_struct |
{ |
/contrib/toolchain/binutils/bfd/reloc.c |
---|
1,5 → 1,5 |
/* BFD support for handling relocation entries. |
Copyright 1990-2013 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
437,6 → 437,7 |
case 3: return 0; |
case 4: return 8; |
case 8: return 16; |
case -1: return 2; |
case -2: return 4; |
default: abort (); |
} |
578,7 → 579,7 |
{ |
bfd_vma relocation; |
bfd_reloc_status_type flag = bfd_reloc_ok; |
bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd); |
bfd_size_type octets; |
bfd_vma output_base = 0; |
reloc_howto_type *howto = reloc_entry->howto; |
asection *reloc_target_output_section; |
592,6 → 593,10 |
return bfd_reloc_ok; |
} |
/* PR 17512: file: 0f67f69d. */ |
if (howto == NULL) |
return bfd_reloc_undefined; |
/* If we are not producing relocatable output, return an error if |
the symbol is not defined. An undefined weak symbol is |
considered to have a value of zero (SVR4 ABI, p. 4-27). */ |
613,8 → 618,12 |
return cont; |
} |
/* Is the address of the relocation really within the section? */ |
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) |
/* Is the address of the relocation really within the section? |
Include the size of the reloc in the test for out of range addresses. |
PR 17512: file: c146ab8b, 46dff27f, 38e53ebf. */ |
octets = reloc_entry->address * bfd_octets_per_byte (abfd); |
if (octets + bfd_get_reloc_size (howto) |
> bfd_get_section_limit_octets (abfd, input_section)) |
return bfd_reloc_outofrange; |
/* Work out which section the relocation is targeted at and the |
784,10 → 793,6 |
} |
} |
} |
else |
{ |
reloc_entry->addend = 0; |
} |
/* FIXME: This overflow checking is incomplete, because the value |
might have overflowed before we get here. For a correct check we |
968,7 → 973,7 |
{ |
bfd_vma relocation; |
bfd_reloc_status_type flag = bfd_reloc_ok; |
bfd_size_type octets = reloc_entry->address * bfd_octets_per_byte (abfd); |
bfd_size_type octets; |
bfd_vma output_base = 0; |
reloc_howto_type *howto = reloc_entry->howto; |
asection *reloc_target_output_section; |
1001,7 → 1006,9 |
} |
/* Is the address of the relocation really within the section? */ |
if (reloc_entry->address > bfd_get_section_limit (abfd, input_section)) |
octets = reloc_entry->address * bfd_octets_per_byte (abfd); |
if (octets + bfd_get_reloc_size (howto) |
> bfd_get_section_limit_octets (abfd, input_section)) |
return bfd_reloc_outofrange; |
/* Work out which section the relocation is targeted at and the |
1336,9 → 1343,11 |
bfd_vma addend) |
{ |
bfd_vma relocation; |
bfd_size_type octets = address * bfd_octets_per_byte (input_bfd); |
/* Sanity check the address. */ |
if (address > bfd_get_section_limit (input_bfd, input_section)) |
if (octets + bfd_get_reloc_size (howto) |
> bfd_get_section_limit_octets (input_bfd, input_section)) |
return bfd_reloc_outofrange; |
/* This function assumes that we are dealing with a basic relocation |
1393,8 → 1402,9 |
switch (size) |
{ |
default: |
abort (); |
case 0: |
abort (); |
return bfd_reloc_ok; |
case 1: |
x = bfd_get_8 (input_bfd, location); |
break; |
1561,8 → 1571,9 |
switch (size) |
{ |
default: |
abort (); |
case 0: |
abort (); |
return; |
case 1: |
x = bfd_get_8 (input_bfd, location); |
break; |
2293,6 → 2304,17 |
microMIPS PC-relative relocations. |
ENUM |
BFD_RELOC_MIPS_21_PCREL_S2 |
ENUMX |
BFD_RELOC_MIPS_26_PCREL_S2 |
ENUMX |
BFD_RELOC_MIPS_18_PCREL_S3 |
ENUMX |
BFD_RELOC_MIPS_19_PCREL_S2 |
ENUMDOC |
MIPS PC-relative relocations. |
ENUM |
BFD_RELOC_MICROMIPS_GPREL16 |
ENUMX |
BFD_RELOC_MICROMIPS_HI16 |
2434,6 → 2456,18 |
COMMENT |
ENUM |
BFD_RELOC_FT32_10 |
ENUMX |
BFD_RELOC_FT32_20 |
ENUMX |
BFD_RELOC_FT32_17 |
ENUMX |
BFD_RELOC_FT32_18 |
ENUMDOC |
FT32 ELF relocations. |
COMMENT |
ENUM |
BFD_RELOC_FRV_LABEL16 |
ENUMX |
BFD_RELOC_FRV_LABEL24 |
2642,6 → 2676,8 |
BFD_RELOC_386_TLS_DESC |
ENUMX |
BFD_RELOC_386_IRELATIVE |
ENUMX |
BFD_RELOC_386_GOT32X |
ENUMDOC |
i386/elf relocations |
2703,6 → 2739,10 |
BFD_RELOC_X86_64_PC32_BND |
ENUMX |
BFD_RELOC_X86_64_PLT32_BND |
ENUMX |
BFD_RELOC_X86_64_GOTPCRELX |
ENUMX |
BFD_RELOC_X86_64_REX_GOTPCRELX |
ENUMDOC |
x86-64/elf relocations |
2850,6 → 2890,8 |
ENUMX |
BFD_RELOC_PPC_VLE_SDAREL_HA16D |
ENUMX |
BFD_RELOC_PPC_REL16DX_HA |
ENUMX |
BFD_RELOC_PPC64_HIGHER |
ENUMX |
BFD_RELOC_PPC64_HIGHER_S |
2899,6 → 2941,10 |
BFD_RELOC_PPC64_ADDR16_HIGH |
ENUMX |
BFD_RELOC_PPC64_ADDR16_HIGHA |
ENUMX |
BFD_RELOC_PPC64_ADDR64_LOCAL |
ENUMX |
BFD_RELOC_PPC64_ENTRY |
ENUMDOC |
Power(rs6000) and PowerPC relocations. |
3479,18 → 3525,139 |
Renesas / SuperH SH relocs. Not all of these appear in object files. |
ENUM |
BFD_RELOC_ARC_B22_PCREL |
BFD_RELOC_ARC_NONE |
ENUMX |
BFD_RELOC_ARC_8 |
ENUMX |
BFD_RELOC_ARC_16 |
ENUMX |
BFD_RELOC_ARC_24 |
ENUMX |
BFD_RELOC_ARC_32 |
ENUMX |
BFD_RELOC_ARC_N8 |
ENUMX |
BFD_RELOC_ARC_N16 |
ENUMX |
BFD_RELOC_ARC_N24 |
ENUMX |
BFD_RELOC_ARC_N32 |
ENUMX |
BFD_RELOC_ARC_SDA |
ENUMX |
BFD_RELOC_ARC_SECTOFF |
ENUMX |
BFD_RELOC_ARC_S21H_PCREL |
ENUMX |
BFD_RELOC_ARC_S21W_PCREL |
ENUMX |
BFD_RELOC_ARC_S25H_PCREL |
ENUMX |
BFD_RELOC_ARC_S25W_PCREL |
ENUMX |
BFD_RELOC_ARC_SDA32 |
ENUMX |
BFD_RELOC_ARC_SDA_LDST |
ENUMX |
BFD_RELOC_ARC_SDA_LDST1 |
ENUMX |
BFD_RELOC_ARC_SDA_LDST2 |
ENUMX |
BFD_RELOC_ARC_SDA16_LD |
ENUMX |
BFD_RELOC_ARC_SDA16_LD1 |
ENUMX |
BFD_RELOC_ARC_SDA16_LD2 |
ENUMX |
BFD_RELOC_ARC_S13_PCREL |
ENUMX |
BFD_RELOC_ARC_W |
ENUMX |
BFD_RELOC_ARC_32_ME |
ENUMX |
BFD_RELOC_ARC_32_ME_S |
ENUMX |
BFD_RELOC_ARC_N32_ME |
ENUMX |
BFD_RELOC_ARC_SECTOFF_ME |
ENUMX |
BFD_RELOC_ARC_SDA32_ME |
ENUMX |
BFD_RELOC_ARC_W_ME |
ENUMX |
BFD_RELOC_AC_SECTOFF_U8 |
ENUMX |
BFD_RELOC_AC_SECTOFF_U8_1 |
ENUMX |
BFD_RELOC_AC_SECTOFF_U8_2 |
ENUMX |
BFD_RELOC_AC_SECTFOFF_S9 |
ENUMX |
BFD_RELOC_AC_SECTFOFF_S9_1 |
ENUMX |
BFD_RELOC_AC_SECTFOFF_S9_2 |
ENUMX |
BFD_RELOC_ARC_SECTOFF_ME_1 |
ENUMX |
BFD_RELOC_ARC_SECTOFF_ME_2 |
ENUMX |
BFD_RELOC_ARC_SECTOFF_1 |
ENUMX |
BFD_RELOC_ARC_SECTOFF_2 |
ENUMX |
BFD_RELOC_ARC_SDA16_ST2 |
ENUMX |
BFD_RELOC_ARC_32_PCREL |
ENUMX |
BFD_RELOC_ARC_PC32 |
ENUMX |
BFD_RELOC_ARC_GOT32 |
ENUMX |
BFD_RELOC_ARC_GOTPC32 |
ENUMX |
BFD_RELOC_ARC_PLT32 |
ENUMX |
BFD_RELOC_ARC_COPY |
ENUMX |
BFD_RELOC_ARC_GLOB_DAT |
ENUMX |
BFD_RELOC_ARC_JMP_SLOT |
ENUMX |
BFD_RELOC_ARC_RELATIVE |
ENUMX |
BFD_RELOC_ARC_GOTOFF |
ENUMX |
BFD_RELOC_ARC_GOTPC |
ENUMX |
BFD_RELOC_ARC_S21W_PCREL_PLT |
ENUMX |
BFD_RELOC_ARC_S25H_PCREL_PLT |
ENUMX |
BFD_RELOC_ARC_TLS_DTPMOD |
ENUMX |
BFD_RELOC_ARC_TLS_TPOFF |
ENUMX |
BFD_RELOC_ARC_TLS_GD_GOT |
ENUMX |
BFD_RELOC_ARC_TLS_GD_LD |
ENUMX |
BFD_RELOC_ARC_TLS_GD_CALL |
ENUMX |
BFD_RELOC_ARC_TLS_IE_GOT |
ENUMX |
BFD_RELOC_ARC_TLS_DTPOFF |
ENUMX |
BFD_RELOC_ARC_TLS_DTPOFF_S9 |
ENUMX |
BFD_RELOC_ARC_TLS_LE_S9 |
ENUMX |
BFD_RELOC_ARC_TLS_LE_32 |
ENUMX |
BFD_RELOC_ARC_S25W_PCREL_PLT |
ENUMX |
BFD_RELOC_ARC_S21H_PCREL_PLT |
ENUMDOC |
ARC Cores relocs. |
ARC 22 bit pc-relative branch. The lowest two bits must be zero and are |
not stored in the instruction. The high 20 bits are installed in bits 26 |
through 7 of the instruction. |
ENUM |
BFD_RELOC_ARC_B26 |
ENUMDOC |
ARC 26 bit absolute branch. The lowest two bits must be zero and are not |
stored in the instruction. The high 24 bits are installed in bits 23 |
through 0. |
ARC relocs. |
ENUM |
BFD_RELOC_BFIN_16_IMM |
3839,6 → 4006,322 |
ENUM |
BFD_RELOC_NDS32_20 |
ENUMDOC |
NDS32 relocs. |
This is a 20 bit absolute address. |
ENUM |
BFD_RELOC_NDS32_9_PCREL |
ENUMDOC |
This is a 9-bit pc-relative reloc with the right 1 bit assumed to be 0. |
ENUM |
BFD_RELOC_NDS32_WORD_9_PCREL |
ENUMDOC |
This is a 9-bit pc-relative reloc with the right 1 bit assumed to be 0. |
ENUM |
BFD_RELOC_NDS32_15_PCREL |
ENUMDOC |
This is an 15-bit reloc with the right 1 bit assumed to be 0. |
ENUM |
BFD_RELOC_NDS32_17_PCREL |
ENUMDOC |
This is an 17-bit reloc with the right 1 bit assumed to be 0. |
ENUM |
BFD_RELOC_NDS32_25_PCREL |
ENUMDOC |
This is a 25-bit reloc with the right 1 bit assumed to be 0. |
ENUM |
BFD_RELOC_NDS32_HI20 |
ENUMDOC |
This is a 20-bit reloc containing the high 20 bits of an address |
used with the lower 12 bits |
ENUM |
BFD_RELOC_NDS32_LO12S3 |
ENUMDOC |
This is a 12-bit reloc containing the lower 12 bits of an address |
then shift right by 3. This is used with ldi,sdi... |
ENUM |
BFD_RELOC_NDS32_LO12S2 |
ENUMDOC |
This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 2. This is used with lwi,swi... |
ENUM |
BFD_RELOC_NDS32_LO12S1 |
ENUMDOC |
This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 1. This is used with lhi,shi... |
ENUM |
BFD_RELOC_NDS32_LO12S0 |
ENUMDOC |
This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 0. This is used with lbisbi... |
ENUM |
BFD_RELOC_NDS32_LO12S0_ORI |
ENUMDOC |
This is a 12-bit reloc containing the lower 12 bits of an address |
then shift left by 0. This is only used with branch relaxations |
ENUM |
BFD_RELOC_NDS32_SDA15S3 |
ENUMDOC |
This is a 15-bit reloc containing the small data area 18-bit signed offset |
and shift left by 3 for use in ldi, sdi... |
ENUM |
BFD_RELOC_NDS32_SDA15S2 |
ENUMDOC |
This is a 15-bit reloc containing the small data area 17-bit signed offset |
and shift left by 2 for use in lwi, swi... |
ENUM |
BFD_RELOC_NDS32_SDA15S1 |
ENUMDOC |
This is a 15-bit reloc containing the small data area 16-bit signed offset |
and shift left by 1 for use in lhi, shi... |
ENUM |
BFD_RELOC_NDS32_SDA15S0 |
ENUMDOC |
This is a 15-bit reloc containing the small data area 15-bit signed offset |
and shift left by 0 for use in lbi, sbi... |
ENUM |
BFD_RELOC_NDS32_SDA16S3 |
ENUMDOC |
This is a 16-bit reloc containing the small data area 16-bit signed offset |
and shift left by 3 |
ENUM |
BFD_RELOC_NDS32_SDA17S2 |
ENUMDOC |
This is a 17-bit reloc containing the small data area 17-bit signed offset |
and shift left by 2 for use in lwi.gp, swi.gp... |
ENUM |
BFD_RELOC_NDS32_SDA18S1 |
ENUMDOC |
This is a 18-bit reloc containing the small data area 18-bit signed offset |
and shift left by 1 for use in lhi.gp, shi.gp... |
ENUM |
BFD_RELOC_NDS32_SDA19S0 |
ENUMDOC |
This is a 19-bit reloc containing the small data area 19-bit signed offset |
and shift left by 0 for use in lbi.gp, sbi.gp... |
ENUM |
BFD_RELOC_NDS32_GOT20 |
ENUMX |
BFD_RELOC_NDS32_9_PLTREL |
ENUMX |
BFD_RELOC_NDS32_25_PLTREL |
ENUMX |
BFD_RELOC_NDS32_COPY |
ENUMX |
BFD_RELOC_NDS32_GLOB_DAT |
ENUMX |
BFD_RELOC_NDS32_JMP_SLOT |
ENUMX |
BFD_RELOC_NDS32_RELATIVE |
ENUMX |
BFD_RELOC_NDS32_GOTOFF |
ENUMX |
BFD_RELOC_NDS32_GOTOFF_HI20 |
ENUMX |
BFD_RELOC_NDS32_GOTOFF_LO12 |
ENUMX |
BFD_RELOC_NDS32_GOTPC20 |
ENUMX |
BFD_RELOC_NDS32_GOT_HI20 |
ENUMX |
BFD_RELOC_NDS32_GOT_LO12 |
ENUMX |
BFD_RELOC_NDS32_GOTPC_HI20 |
ENUMX |
BFD_RELOC_NDS32_GOTPC_LO12 |
ENUMDOC |
for PIC |
ENUM |
BFD_RELOC_NDS32_INSN16 |
ENUMX |
BFD_RELOC_NDS32_LABEL |
ENUMX |
BFD_RELOC_NDS32_LONGCALL1 |
ENUMX |
BFD_RELOC_NDS32_LONGCALL2 |
ENUMX |
BFD_RELOC_NDS32_LONGCALL3 |
ENUMX |
BFD_RELOC_NDS32_LONGJUMP1 |
ENUMX |
BFD_RELOC_NDS32_LONGJUMP2 |
ENUMX |
BFD_RELOC_NDS32_LONGJUMP3 |
ENUMX |
BFD_RELOC_NDS32_LOADSTORE |
ENUMX |
BFD_RELOC_NDS32_9_FIXED |
ENUMX |
BFD_RELOC_NDS32_15_FIXED |
ENUMX |
BFD_RELOC_NDS32_17_FIXED |
ENUMX |
BFD_RELOC_NDS32_25_FIXED |
ENUMX |
BFD_RELOC_NDS32_LONGCALL4 |
ENUMX |
BFD_RELOC_NDS32_LONGCALL5 |
ENUMX |
BFD_RELOC_NDS32_LONGCALL6 |
ENUMX |
BFD_RELOC_NDS32_LONGJUMP4 |
ENUMX |
BFD_RELOC_NDS32_LONGJUMP5 |
ENUMX |
BFD_RELOC_NDS32_LONGJUMP6 |
ENUMX |
BFD_RELOC_NDS32_LONGJUMP7 |
ENUMDOC |
for relax |
ENUM |
BFD_RELOC_NDS32_PLTREL_HI20 |
ENUMX |
BFD_RELOC_NDS32_PLTREL_LO12 |
ENUMX |
BFD_RELOC_NDS32_PLT_GOTREL_HI20 |
ENUMX |
BFD_RELOC_NDS32_PLT_GOTREL_LO12 |
ENUMDOC |
for PIC |
ENUM |
BFD_RELOC_NDS32_SDA12S2_DP |
ENUMX |
BFD_RELOC_NDS32_SDA12S2_SP |
ENUMX |
BFD_RELOC_NDS32_LO12S2_DP |
ENUMX |
BFD_RELOC_NDS32_LO12S2_SP |
ENUMDOC |
for floating point |
ENUM |
BFD_RELOC_NDS32_DWARF2_OP1 |
ENUMX |
BFD_RELOC_NDS32_DWARF2_OP2 |
ENUMX |
BFD_RELOC_NDS32_DWARF2_LEB |
ENUMDOC |
for dwarf2 debug_line. |
ENUM |
BFD_RELOC_NDS32_UPDATE_TA |
ENUMDOC |
for eliminate 16-bit instructions |
ENUM |
BFD_RELOC_NDS32_PLT_GOTREL_LO20 |
ENUMX |
BFD_RELOC_NDS32_PLT_GOTREL_LO15 |
ENUMX |
BFD_RELOC_NDS32_PLT_GOTREL_LO19 |
ENUMX |
BFD_RELOC_NDS32_GOT_LO15 |
ENUMX |
BFD_RELOC_NDS32_GOT_LO19 |
ENUMX |
BFD_RELOC_NDS32_GOTOFF_LO15 |
ENUMX |
BFD_RELOC_NDS32_GOTOFF_LO19 |
ENUMX |
BFD_RELOC_NDS32_GOT15S2 |
ENUMX |
BFD_RELOC_NDS32_GOT17S2 |
ENUMDOC |
for PIC object relaxation |
ENUM |
BFD_RELOC_NDS32_5 |
ENUMDOC |
NDS32 relocs. |
This is a 5 bit absolute address. |
ENUM |
BFD_RELOC_NDS32_10_UPCREL |
ENUMDOC |
This is a 10-bit unsigned pc-relative reloc with the right 1 bit assumed to be 0. |
ENUM |
BFD_RELOC_NDS32_SDA_FP7U2_RELA |
ENUMDOC |
If fp were omitted, fp can used as another gp. |
ENUM |
BFD_RELOC_NDS32_RELAX_ENTRY |
ENUMX |
BFD_RELOC_NDS32_GOT_SUFF |
ENUMX |
BFD_RELOC_NDS32_GOTOFF_SUFF |
ENUMX |
BFD_RELOC_NDS32_PLT_GOT_SUFF |
ENUMX |
BFD_RELOC_NDS32_MULCALL_SUFF |
ENUMX |
BFD_RELOC_NDS32_PTR |
ENUMX |
BFD_RELOC_NDS32_PTR_COUNT |
ENUMX |
BFD_RELOC_NDS32_PTR_RESOLVED |
ENUMX |
BFD_RELOC_NDS32_PLTBLOCK |
ENUMX |
BFD_RELOC_NDS32_RELAX_REGION_BEGIN |
ENUMX |
BFD_RELOC_NDS32_RELAX_REGION_END |
ENUMX |
BFD_RELOC_NDS32_MINUEND |
ENUMX |
BFD_RELOC_NDS32_SUBTRAHEND |
ENUMX |
BFD_RELOC_NDS32_DIFF8 |
ENUMX |
BFD_RELOC_NDS32_DIFF16 |
ENUMX |
BFD_RELOC_NDS32_DIFF32 |
ENUMX |
BFD_RELOC_NDS32_DIFF_ULEB128 |
ENUMX |
BFD_RELOC_NDS32_EMPTY |
ENUMDOC |
relaxation relative relocation types |
ENUM |
BFD_RELOC_NDS32_25_ABS |
ENUMDOC |
This is a 25 bit absolute address. |
ENUM |
BFD_RELOC_NDS32_DATA |
ENUMX |
BFD_RELOC_NDS32_TRAN |
ENUMX |
BFD_RELOC_NDS32_17IFC_PCREL |
ENUMX |
BFD_RELOC_NDS32_10IFCU_PCREL |
ENUMDOC |
For ex9 and ifc using. |
ENUM |
BFD_RELOC_NDS32_TPOFF |
ENUMX |
BFD_RELOC_NDS32_TLS_LE_HI20 |
ENUMX |
BFD_RELOC_NDS32_TLS_LE_LO12 |
ENUMX |
BFD_RELOC_NDS32_TLS_LE_ADD |
ENUMX |
BFD_RELOC_NDS32_TLS_LE_LS |
ENUMX |
BFD_RELOC_NDS32_GOTTPOFF |
ENUMX |
BFD_RELOC_NDS32_TLS_IE_HI20 |
ENUMX |
BFD_RELOC_NDS32_TLS_IE_LO12S2 |
ENUMX |
BFD_RELOC_NDS32_TLS_TPOFF |
ENUMX |
BFD_RELOC_NDS32_TLS_LE_20 |
ENUMX |
BFD_RELOC_NDS32_TLS_LE_15S0 |
ENUMX |
BFD_RELOC_NDS32_TLS_LE_15S1 |
ENUMX |
BFD_RELOC_NDS32_TLS_LE_15S2 |
ENUMDOC |
For TLS. |
ENUM |
BFD_RELOC_V850_9_PCREL |
ENUMDOC |
This is a 9-bit reloc |
4510,8 → 4993,35 |
ENUMDOC |
This is a 8 bit reloc for the AVR that stores bits 16..23 of a symbol |
in .byte hlo8(symbol) |
ENUM |
BFD_RELOC_AVR_DIFF8 |
ENUMX |
BFD_RELOC_AVR_DIFF16 |
ENUMX |
BFD_RELOC_AVR_DIFF32 |
ENUMDOC |
AVR relocations to mark the difference of two local symbols. |
These are only needed to support linker relaxation and can be ignored |
when not relaxing. The field is set to the value of the difference |
assuming no relaxation. The relocation encodes the position of the |
second symbol so the linker can determine whether to adjust the field |
value. |
ENUM |
BFD_RELOC_AVR_LDS_STS_16 |
ENUMDOC |
This is a 7 bit reloc for the AVR that stores SRAM address for 16bit |
lds and sts instructions supported only tiny core. |
ENUM |
BFD_RELOC_AVR_PORT6 |
ENUMDOC |
This is a 6 bit reloc for the AVR that stores an I/O register |
number for the IN and OUT instructions |
ENUM |
BFD_RELOC_AVR_PORT5 |
ENUMDOC |
This is a 5 bit reloc for the AVR that stores an I/O register |
number for the SBIC, SBIS, SBI and CBI instructions |
ENUM |
BFD_RELOC_RL78_NEG8 |
ENUMX |
BFD_RELOC_RL78_NEG16 |
4577,6 → 5087,8 |
BFD_RELOC_RL78_LO16 |
ENUMX |
BFD_RELOC_RL78_CODE |
ENUMX |
BFD_RELOC_RL78_SADDR |
ENUMDOC |
Renesas RL78 Relocations. |
5599,11 → 6111,55 |
Intel i860 Relocations. |
ENUM |
BFD_RELOC_OPENRISC_ABS_26 |
BFD_RELOC_OR1K_REL_26 |
ENUMX |
BFD_RELOC_OPENRISC_REL_26 |
BFD_RELOC_OR1K_GOTPC_HI16 |
ENUMX |
BFD_RELOC_OR1K_GOTPC_LO16 |
ENUMX |
BFD_RELOC_OR1K_GOT16 |
ENUMX |
BFD_RELOC_OR1K_PLT26 |
ENUMX |
BFD_RELOC_OR1K_GOTOFF_HI16 |
ENUMX |
BFD_RELOC_OR1K_GOTOFF_LO16 |
ENUMX |
BFD_RELOC_OR1K_COPY |
ENUMX |
BFD_RELOC_OR1K_GLOB_DAT |
ENUMX |
BFD_RELOC_OR1K_JMP_SLOT |
ENUMX |
BFD_RELOC_OR1K_RELATIVE |
ENUMX |
BFD_RELOC_OR1K_TLS_GD_HI16 |
ENUMX |
BFD_RELOC_OR1K_TLS_GD_LO16 |
ENUMX |
BFD_RELOC_OR1K_TLS_LDM_HI16 |
ENUMX |
BFD_RELOC_OR1K_TLS_LDM_LO16 |
ENUMX |
BFD_RELOC_OR1K_TLS_LDO_HI16 |
ENUMX |
BFD_RELOC_OR1K_TLS_LDO_LO16 |
ENUMX |
BFD_RELOC_OR1K_TLS_IE_HI16 |
ENUMX |
BFD_RELOC_OR1K_TLS_IE_LO16 |
ENUMX |
BFD_RELOC_OR1K_TLS_LE_HI16 |
ENUMX |
BFD_RELOC_OR1K_TLS_LE_LO16 |
ENUMX |
BFD_RELOC_OR1K_TLS_TPOFF |
ENUMX |
BFD_RELOC_OR1K_TLS_DTPOFF |
ENUMX |
BFD_RELOC_OR1K_TLS_DTPMOD |
ENUMDOC |
OpenRISC Relocations. |
OpenRISC 1000 Relocations. |
ENUM |
BFD_RELOC_H8_DIR16A8 |
5797,6 → 6353,42 |
BFD_RELOC_NIOS2_RELATIVE |
ENUMX |
BFD_RELOC_NIOS2_GOTOFF |
ENUMX |
BFD_RELOC_NIOS2_CALL26_NOAT |
ENUMX |
BFD_RELOC_NIOS2_GOT_LO |
ENUMX |
BFD_RELOC_NIOS2_GOT_HA |
ENUMX |
BFD_RELOC_NIOS2_CALL_LO |
ENUMX |
BFD_RELOC_NIOS2_CALL_HA |
ENUMX |
BFD_RELOC_NIOS2_R2_S12 |
ENUMX |
BFD_RELOC_NIOS2_R2_I10_1_PCREL |
ENUMX |
BFD_RELOC_NIOS2_R2_T1I7_1_PCREL |
ENUMX |
BFD_RELOC_NIOS2_R2_T1I7_2 |
ENUMX |
BFD_RELOC_NIOS2_R2_T2I4 |
ENUMX |
BFD_RELOC_NIOS2_R2_T2I4_1 |
ENUMX |
BFD_RELOC_NIOS2_R2_T2I4_2 |
ENUMX |
BFD_RELOC_NIOS2_R2_X1I7_2 |
ENUMX |
BFD_RELOC_NIOS2_R2_X2L5 |
ENUMX |
BFD_RELOC_NIOS2_R2_F1I5_2 |
ENUMX |
BFD_RELOC_NIOS2_R2_L5I4X1 |
ENUMX |
BFD_RELOC_NIOS2_R2_T1X1I6 |
ENUMX |
BFD_RELOC_NIOS2_R2_T1X1I6_2 |
ENUMDOC |
Relocations used by the Altera Nios II core. |
6329,6 → 6921,29 |
the GOT entry for this symbol. Used in conjunction with |
BFD_RELOC_AARCH64_ADR_GOTPAGE. Valid in ILP32 ABI only. |
ENUM |
BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC |
ENUMDOC |
Unsigned 16 bit byte offset for 64 bit load/store from the GOT entry |
for this symbol. Valid in LP64 ABI only. |
ENUM |
BFD_RELOC_AARCH64_MOVW_GOTOFF_G1 |
ENUMDOC |
Unsigned 16 bit byte higher offset for 64 bit load/store from the GOT entry |
for this symbol. Valid in LP64 ABI only. |
ENUM |
BFD_RELOC_AARCH64_LD64_GOTOFF_LO15 |
ENUMDOC |
Unsigned 15 bit byte offset for 64 bit load/store from the page of |
the GOT entry for this symbol. Valid in LP64 ABI only. |
ENUM |
BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14 |
ENUMDOC |
Scaled 14 bit byte offset to the page base of the global offset table. |
ENUM |
BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15 |
ENUMDOC |
Scaled 15 bit byte offset to the page base of the global offset table. |
ENUM |
BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21 |
ENUMDOC |
Get to the page base of the global offset table entry for a symbols |
6336,6 → 6951,10 |
relative value. Used in conjunction with |
BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC. |
ENUM |
BFD_RELOC_AARCH64_TLSGD_ADR_PREL21 |
ENUMDOC |
AArch64 TLS General Dynamic |
ENUM |
BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC |
ENUMDOC |
Unsigned 12 bit byte offset to global offset table entry for a symbols |
6342,13 → 6961,13 |
tls_index structure. Used in conjunction with |
BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21. |
ENUM |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1 |
BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC |
ENUMDOC |
AArch64 TLS INITIAL EXEC relocation. |
AArch64 TLS General Dynamic relocation. |
ENUM |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC |
BFD_RELOC_AARCH64_TLSGD_MOVW_G1 |
ENUMDOC |
AArch64 TLS INITIAL EXEC relocation. |
AArch64 TLS General Dynamic relocation. |
ENUM |
BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21 |
ENUMDOC |
6366,6 → 6985,97 |
ENUMDOC |
AArch64 TLS INITIAL EXEC relocation. |
ENUM |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC |
ENUMDOC |
AArch64 TLS INITIAL EXEC relocation. |
ENUM |
BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1 |
ENUMDOC |
AArch64 TLS INITIAL EXEC relocation. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12 |
ENUMDOC |
bit[23:12] of byte offset to module TLS base address. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12 |
ENUMDOC |
Unsigned 12 bit byte offset to module TLS base address. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC |
ENUMDOC |
No overflow check version of BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC |
ENUMDOC |
Unsigned 12 bit byte offset to global offset table entry for a symbols |
tls_index structure. Used in conjunction with |
BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21 |
ENUMDOC |
GOT entry page address for AArch64 TLS Local Dynamic, used with ADRP |
instruction. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_ADR_PREL21 |
ENUMDOC |
GOT entry address for AArch64 TLS Local Dynamic, used with ADR instruction. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12 |
ENUMDOC |
bit[11:1] of byte offset to module TLS base address, encoded in ldst |
instructions. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC |
ENUMDOC |
Similar as BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12, but no overflow check. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12 |
ENUMDOC |
bit[11:2] of byte offset to module TLS base address, encoded in ldst |
instructions. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC |
ENUMDOC |
Similar as BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12, but no overflow check. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12 |
ENUMDOC |
bit[11:3] of byte offset to module TLS base address, encoded in ldst |
instructions. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC |
ENUMDOC |
Similar as BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12, but no overflow check. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12 |
ENUMDOC |
bit[11:0] of byte offset to module TLS base address, encoded in ldst |
instructions. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC |
ENUMDOC |
Similar as BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12, but no overflow check. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0 |
ENUMDOC |
bit[15:0] of byte offset to module TLS base address. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC |
ENUMDOC |
No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0 |
ENUM |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1 |
ENUMDOC |
bit[31:16] of byte offset to module TLS base address. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC |
ENUMDOC |
No overflow check version of BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1 |
ENUM |
BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2 |
ENUMDOC |
bit[47:32] of byte offset to module TLS base address. |
ENUM |
BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G2 |
ENUMDOC |
AArch64 TLS LOCAL EXEC relocation. |
6496,6 → 7206,16 |
AArch64 unspecified load/store instruction, holding bits 0 to 11 of the |
address. Used in conjunction with BFD_RELOC_AARCH64_ADR_HI21_PCREL. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12 |
ENUMDOC |
AArch64 pseudo relocation code for TLS local dynamic mode. It's to be |
used internally by the AArch64 assembler and not (currently) written to |
any object files. |
ENUM |
BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12_NC |
ENUMDOC |
Similar as BFD_RELOC_AARCH64_TLSLD_LDST_DTPREL_LO12, but no overflow check. |
ENUM |
BFD_RELOC_AARCH64_LD_GOT_LO12_NC |
ENUMDOC |
AArch64 pseudo relocation code to be used internally by the AArch64 |
6510,7 → 7230,6 |
ENUMDOC |
AArch64 pseudo relocation code to be used internally by the AArch64 |
assembler and not (currently) written to any object files. |
ENUM |
BFD_RELOC_TILEPRO_COPY |
ENUMX |
6891,6 → 7610,7 |
BFD_RELOC_TILEGX_IMM8_Y1_TLS_ADD |
ENUMDOC |
Tilera TILE-Gx Relocations. |
ENUM |
BFD_RELOC_EPIPHANY_SIMM8 |
ENUMDOC |
6920,6 → 7640,22 |
ENUMDOC |
Adapteva EPIPHANY - 8 bit immediate for 16 bit mov instruction. |
ENUM |
BFD_RELOC_VISIUM_HI16 |
ENUMX |
BFD_RELOC_VISIUM_LO16 |
ENUMX |
BFD_RELOC_VISIUM_IM16 |
ENUMX |
BFD_RELOC_VISIUM_REL16 |
ENUMX |
BFD_RELOC_VISIUM_HI16_PCREL |
ENUMX |
BFD_RELOC_VISIUM_LO16_PCREL |
ENUMX |
BFD_RELOC_VISIUM_IM16_PCREL |
ENUMDOC |
Visium Relocations. |
ENDSENUM |
BFD_RELOC_UNUSED |
7041,7 → 7777,7 |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED, |
bfd_boolean *again) |
{ |
if (link_info->relocatable) |
if (bfd_link_relocatable (link_info)) |
(*link_info->callbacks->einfo) |
(_("%P%F: --relax and -r may not be used together\n")); |
7249,8 → 7985,21 |
abfd, input_section, * parent); |
goto error_return; |
case bfd_reloc_notsupported: |
/* PR ld/17512 |
This error can result when processing a corrupt binary. |
Do not abort. Issue an error message instead. */ |
link_info->callbacks->einfo |
(_("%X%P: %B(%A): relocation \"%R\" is not supported\n"), |
abfd, input_section, * parent); |
goto error_return; |
default: |
abort (); |
/* PR 17512; file: 90c2a92e. |
Report unexpected results, without aborting. */ |
link_info->callbacks->einfo |
(_("%X%P: %B(%A): relocation \"%R\" returns an unrecognized value %x\n"), |
abfd, input_section, * parent, r); |
break; |
} |
/contrib/toolchain/binutils/bfd/section.c |
---|
1,8 → 1,5 |
/* Object file "section" support for the BFD library. |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, |
2012, 2013 |
Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
158,10 → 155,10 |
. const char *name; |
. |
. {* A unique sequence number. *} |
. int id; |
. unsigned int id; |
. |
. {* Which section in the bfd; 0..n-1 as sections are created in a bfd. *} |
. int index; |
. unsigned int index; |
. |
. {* The next section in the list belonging to the BFD, or NULL. *} |
. struct bfd_section *next; |
337,6 → 334,10 |
. executables or shared objects. This is for COFF only. *} |
.#define SEC_COFF_SHARED 0x8000000 |
. |
. {* This section should be compressed. This is for ELF linker |
. internal use only. *} |
.#define SEC_ELF_COMPRESS 0x8000000 |
. |
. {* When a section with this flag is being linked, then if the size of |
. the input section is less than a page, it should not cross a page |
. boundary. If the size of the input section is one page or more, |
344,11 → 345,18 |
. TMS320C54X only. *} |
.#define SEC_TIC54X_BLOCK 0x10000000 |
. |
. {* This section should be renamed. This is for ELF linker |
. internal use only. *} |
.#define SEC_ELF_RENAME 0x10000000 |
. |
. {* Conditionally link this section; do not link if there are no |
. references found to any symbol in the section. This is for TI |
. TMS320C54X only. *} |
.#define SEC_TIC54X_CLINK 0x20000000 |
. |
. {* This section contains vliw code. This is for Toshiba MeP only. *} |
.#define SEC_MEP_VLIW 0x20000000 |
. |
. {* Indicate that section has the no read flag set. This happens |
. when memory read flag isn't set. *} |
.#define SEC_COFF_NOREAD 0x40000000 |
388,6 → 396,8 |
.#define SEC_INFO_TYPE_MERGE 2 |
.#define SEC_INFO_TYPE_EH_FRAME 3 |
.#define SEC_INFO_TYPE_JUST_SYMS 4 |
.#define SEC_INFO_TYPE_TARGET 5 |
.#define SEC_INFO_TYPE_EH_FRAME_ENTRY 6 |
. |
. {* Nonzero if this section uses RELA relocations, rather than REL. *} |
. unsigned int use_rela_p:1; |
542,6 → 552,32 |
. int size; |
.}; |
. |
.{* Note: the following are provided as inline functions rather than macros |
. because not all callers use the return value. A macro implementation |
. would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some |
. compilers will complain about comma expressions that have no effect. *} |
.static inline bfd_boolean |
.bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val) |
.{ |
. ptr->userdata = val; |
. return TRUE; |
.} |
. |
.static inline bfd_boolean |
.bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) |
.{ |
. ptr->vma = ptr->lma = val; |
. ptr->user_set_vma = TRUE; |
. return TRUE; |
.} |
. |
.static inline bfd_boolean |
.bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val) |
.{ |
. ptr->alignment_power = val; |
. return TRUE; |
.} |
. |
.{* These sections are global, and are managed by BFD. The application |
. and target back end are not permitted to change the values in |
. these sections. *} |
785,13 → 821,13 |
return TRUE; |
} |
static unsigned int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */ |
/* Initializes a new section. NEWSECT->NAME is already set. */ |
static asection * |
bfd_section_init (bfd *abfd, asection *newsect) |
{ |
static int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */ |
newsect->id = section_id; |
newsect->index = abfd->section_count; |
newsect->owner = abfd; |
867,16 → 903,18 |
bfd_get_next_section_by_name |
SYNOPSIS |
asection *bfd_get_next_section_by_name (asection *sec); |
asection *bfd_get_next_section_by_name (bfd *ibfd, asection *sec); |
DESCRIPTION |
Given @var{sec} is a section returned by @code{bfd_get_section_by_name}, |
return the next most recently created section attached to the same |
BFD with the same name. Return NULL if no such section exists. |
BFD with the same name, or if no such section exists in the same BFD and |
IBFD is non-NULL, the next section with the same name in any input |
BFD following IBFD. Return NULL on finding no section. |
*/ |
asection * |
bfd_get_next_section_by_name (asection *sec) |
bfd_get_next_section_by_name (bfd *ibfd, asection *sec) |
{ |
struct section_hash_entry *sh; |
const char *name; |
894,6 → 932,16 |
&& strcmp (sh->root.string, name) == 0) |
return &sh->section; |
if (ibfd != NULL) |
{ |
while ((ibfd = ibfd->link.next) != NULL) |
{ |
asection *s = bfd_get_section_by_name (ibfd, name); |
if (s != NULL) |
return s; |
} |
} |
return NULL; |
} |
915,7 → 963,7 |
asection *sec = bfd_get_section_by_name (abfd, name); |
while (sec != NULL && (sec->flags & SEC_LINKER_CREATED) == 0) |
sec = bfd_get_next_section_by_name (sec); |
sec = bfd_get_next_section_by_name (NULL, sec); |
return sec; |
} |
958,14 → 1006,11 |
return NULL; |
hash = sh->root.hash; |
do |
{ |
if ((*operation) (abfd, &sh->section, user_storage)) |
for (; sh != NULL; sh = (struct section_hash_entry *) sh->root.next) |
if (sh->root.hash == hash |
&& strcmp (sh->root.string, name) == 0 |
&& (*operation) (abfd, &sh->section, user_storage)) |
return &sh->section; |
sh = (struct section_hash_entry *) sh->root.next; |
} |
while (sh != NULL && sh->root.hash == hash |
&& strcmp (sh->root.string, name) == 0); |
return NULL; |
} |
1242,6 → 1287,23 |
/* |
FUNCTION |
bfd_get_next_section_id |
SYNOPSIS |
int bfd_get_next_section_id (void); |
DESCRIPTION |
Returns the id that the next section created will have. |
*/ |
int |
bfd_get_next_section_id (void) |
{ |
return section_id; |
} |
/* |
FUNCTION |
bfd_set_section_flags |
SYNOPSIS |
/contrib/toolchain/binutils/bfd/simple.c |
---|
1,6 → 1,5 |
/* simple.c -- BFD simple client routines |
Copyright 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 |
Free Software Foundation, Inc. |
Copyright (C) 2002-2015 Free Software Foundation, Inc. |
Contributed by MontaVista Software, Inc. |
This file is part of BFD, the Binary File Descriptor library. |
101,14 → 100,39 |
asection *section; |
}; |
struct saved_offsets |
{ |
unsigned int section_count; |
struct saved_output_info *sections; |
}; |
/* The sections in ABFD may already have output sections and offsets |
set if we are here during linking. |
DWARF-2 specifies offsets into debug sections in many cases and |
bfd_simple_get_relocated_section_contents is called to relocate |
debug info for a single relocatable object file. So we want |
offsets relative to that object file's sections, not offsets in the |
output file. For that reason, reset a debug section->output_offset |
to zero. |
If not called during linking then set section->output_section to |
point back to the input section, because output_section must not be |
NULL when calling the relocation routines. |
Save the original output offset and section to restore later. */ |
static void |
simple_save_output_info (bfd *abfd ATTRIBUTE_UNUSED, |
asection *section, |
void *ptr) |
{ |
struct saved_output_info *output_info = (struct saved_output_info *) ptr; |
output_info[section->index].offset = section->output_offset; |
output_info[section->index].section = section->output_section; |
struct saved_offsets *saved_offsets = (struct saved_offsets *) ptr; |
struct saved_output_info *output_info; |
output_info = &saved_offsets->sections[section->index]; |
output_info->offset = section->output_offset; |
output_info->section = section->output_section; |
if ((section->flags & SEC_DEBUGGING) != 0 |
|| section->output_section == NULL) |
{ |
122,9 → 146,15 |
asection *section, |
void *ptr) |
{ |
struct saved_output_info *output_info = (struct saved_output_info *) ptr; |
section->output_offset = output_info[section->index].offset; |
section->output_section = output_info[section->index].section; |
struct saved_offsets *saved_offsets = (struct saved_offsets *) ptr; |
struct saved_output_info *output_info; |
if (section->index >= saved_offsets->section_count) |
return; |
output_info = &saved_offsets->sections[section->index]; |
section->output_offset = output_info->offset; |
section->output_section = output_info->section; |
} |
/* |
157,7 → 187,8 |
struct bfd_link_callbacks callbacks; |
bfd_byte *contents, *data; |
int storage_needed; |
void *saved_offsets; |
struct saved_offsets saved_offsets; |
bfd *link_next; |
/* Don't apply relocation on executable and shared library. See |
PR 4756. */ |
177,8 → 208,10 |
memset (&link_info, 0, sizeof (link_info)); |
link_info.output_bfd = abfd; |
link_info.input_bfds = abfd; |
link_info.input_bfds_tail = &abfd->link_next; |
link_info.input_bfds_tail = &abfd->link.next; |
link_next = abfd->link.next; |
abfd->link.next = NULL; |
link_info.hash = _bfd_generic_link_hash_table_create (abfd); |
link_info.callbacks = &callbacks; |
callbacks.warning = simple_dummy_warning; |
202,28 → 235,26 |
bfd_size_type amt = sec->rawsize > sec->size ? sec->rawsize : sec->size; |
data = (bfd_byte *) bfd_malloc (amt); |
if (data == NULL) |
{ |
_bfd_generic_link_hash_table_free (abfd); |
abfd->link.next = link_next; |
return NULL; |
} |
outbuf = data; |
} |
/* The sections in ABFD may already have output sections and offsets set. |
Because this function is primarily for debug sections, and GCC uses the |
knowledge that debug sections will generally have VMA 0 when emitting |
relocations between DWARF-2 sections (which are supposed to be |
section-relative offsets anyway), we need to reset the output offsets |
to zero. We also need to arrange for section->output_section->vma plus |
section->output_offset to equal section->vma, which we do by setting |
section->output_section to point back to section. Save the original |
output offset and output section to restore later. */ |
saved_offsets = malloc (sizeof (struct saved_output_info) |
* abfd->section_count); |
if (saved_offsets == NULL) |
saved_offsets.section_count = abfd->section_count; |
saved_offsets.sections = malloc (sizeof (*saved_offsets.sections) |
* saved_offsets.section_count); |
if (saved_offsets.sections == NULL) |
{ |
if (data) |
free (data); |
_bfd_generic_link_hash_table_free (abfd); |
abfd->link.next = link_next; |
return NULL; |
} |
bfd_map_over_sections (abfd, simple_save_output_info, saved_offsets); |
bfd_map_over_sections (abfd, simple_save_output_info, &saved_offsets); |
if (symbol_table == NULL) |
{ |
245,9 → 276,10 |
if (contents == NULL && data != NULL) |
free (data); |
bfd_map_over_sections (abfd, simple_restore_output_info, saved_offsets); |
free (saved_offsets); |
bfd_map_over_sections (abfd, simple_restore_output_info, &saved_offsets); |
free (saved_offsets.sections); |
_bfd_generic_link_hash_table_free (link_info.hash); |
_bfd_generic_link_hash_table_free (abfd); |
abfd->link.next = link_next; |
return contents; |
} |
/contrib/toolchain/binutils/bfd/srec.c |
---|
1,7 → 1,5 |
/* BFD back-end for s-record objects. |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011 |
Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>. |
This file is part of BFD, the Binary File Descriptor library. |
248,10 → 246,10 |
} |
else |
{ |
char buf[10]; |
char buf[40]; |
if (! ISPRINT (c)) |
sprintf (buf, "\\%03o", (unsigned int) c); |
sprintf (buf, "\\%03o", (unsigned int) c & 0xff); |
else |
{ |
buf[0] = c; |
454,8 → 452,8 |
case 'S': |
{ |
file_ptr pos; |
char hdr[3]; |
unsigned int bytes; |
unsigned char hdr[3]; |
unsigned int bytes, min_bytes; |
bfd_vma address; |
bfd_byte *data; |
unsigned char check_sum; |
478,6 → 476,19 |
} |
check_sum = bytes = HEX (hdr + 1); |
min_bytes = 3; |
if (hdr[0] == '2' || hdr[0] == '8') |
min_bytes = 4; |
else if (hdr[0] == '3' || hdr[0] == '7') |
min_bytes = 5; |
if (bytes < min_bytes) |
{ |
(*_bfd_error_handler) (_("%B:%d: byte count %d too small\n"), |
abfd, lineno, bytes); |
bfd_set_error (bfd_error_bad_value); |
goto error_return; |
} |
if (bytes * 2 > bufsize) |
{ |
if (buf != NULL) |
1244,8 → 1255,10 |
#define srec_bfd_is_local_label_name bfd_generic_is_local_label_name |
#define srec_get_lineno _bfd_nosymbols_get_lineno |
#define srec_find_nearest_line _bfd_nosymbols_find_nearest_line |
#define srec_find_line _bfd_nosymbols_find_line |
#define srec_find_inliner_info _bfd_nosymbols_find_inliner_info |
#define srec_make_empty_symbol _bfd_generic_make_empty_symbol |
#define srec_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string |
#define srec_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol |
#define srec_read_minisymbols _bfd_generic_read_minisymbols |
#define srec_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol |
1260,7 → 1273,6 |
#define srec_section_already_linked _bfd_generic_section_already_linked |
#define srec_bfd_define_common_symbol bfd_generic_define_common_symbol |
#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create |
#define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols |
#define srec_bfd_link_just_syms _bfd_generic_link_just_syms |
#define srec_bfd_copy_link_hash_symbol_type \ |
/contrib/toolchain/binutils/bfd/stab-syms.c |
---|
1,6 → 1,5 |
/* Table of stab names for the BFD library. |
Copyright 1990, 1991, 1992, 1994, 1995, 1996, 2000, 2005, 2007, 2012 |
Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
/contrib/toolchain/binutils/bfd/stabs.c |
---|
1,6 → 1,5 |
/* Stabs in sections linking support. |
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, |
2006, 2007, 2008 Free Software Foundation, Inc. |
Copyright (C) 1996-2015 Free Software Foundation, Inc. |
Written by Ian Lance Taylor, Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
537,7 → 536,7 |
link, so we should just ignore them. */ |
return FALSE; |
/* We should have initialized our data in _bfd_link_stab_sections. |
/* We should have initialized our data in _bfd_link_section_stabs. |
If there was some bizarre error reading the string sections, though, |
we might not have. Bail rather than asserting. */ |
if (psecinfo == NULL) |
/contrib/toolchain/binutils/bfd/syms.c |
---|
1,7 → 1,5 |
/* Generic symbol-table support for the BFD library. |
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, |
2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2012 |
Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
825,6 → 823,7 |
*minisymsp = syms; |
*sizep = sizeof (asymbol *); |
return symcount; |
error_return: |
934,12 → 933,11 |
struct stab_find_info *info; |
bfd_size_type stabsize, strsize; |
bfd_byte *stab, *str; |
bfd_byte *last_stab, *last_str; |
bfd_byte *nul_fun, *nul_str; |
bfd_size_type stroff; |
struct indexentry *indexentry; |
char *file_name; |
char *directory_name; |
int saw_fun; |
bfd_boolean saw_line, saw_func; |
*pfound = FALSE; |
988,7 → 986,6 |
long reloc_size, reloc_count; |
arelent **reloc_vector; |
int i; |
char *name; |
char *function_name; |
bfd_size_type amt = sizeof *info; |
1021,6 → 1018,7 |
stabsize = (info->stabsec->rawsize |
? info->stabsec->rawsize |
: info->stabsec->size); |
stabsize = (stabsize / STABSIZE) * STABSIZE; |
strsize = (info->strsec->rawsize |
? info->strsec->rawsize |
: info->strsec->size); |
1102,36 → 1100,37 |
table. */ |
info->indextablesize = 0; |
saw_fun = 1; |
nul_fun = NULL; |
for (stab = info->stabs; stab < info->stabs + stabsize; stab += STABSIZE) |
{ |
if (stab[TYPEOFF] == (bfd_byte) N_SO) |
{ |
/* N_SO with null name indicates EOF */ |
if (bfd_get_32 (abfd, stab + STRDXOFF) == 0) |
continue; |
/* if we did not see a function def, leave space for one. */ |
if (saw_fun == 0) |
if (nul_fun != NULL) |
++info->indextablesize; |
saw_fun = 0; |
/* N_SO with null name indicates EOF */ |
if (bfd_get_32 (abfd, stab + STRDXOFF) == 0) |
nul_fun = NULL; |
else |
{ |
nul_fun = stab; |
/* two N_SO's in a row is a filename and directory. Skip */ |
if (stab + STABSIZE < info->stabs + stabsize |
if (stab + STABSIZE + TYPEOFF < info->stabs + stabsize |
&& *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO) |
{ |
stab += STABSIZE; |
} |
} |
else if (stab[TYPEOFF] == (bfd_byte) N_FUN) |
else if (stab[TYPEOFF] == (bfd_byte) N_FUN |
&& bfd_get_32 (abfd, stab + STRDXOFF) != 0) |
{ |
saw_fun = 1; |
nul_fun = NULL; |
++info->indextablesize; |
} |
} |
if (saw_fun == 0) |
if (nul_fun != NULL) |
++info->indextablesize; |
if (info->indextablesize == 0) |
1146,10 → 1145,10 |
file_name = NULL; |
directory_name = NULL; |
saw_fun = 1; |
nul_fun = NULL; |
stroff = 0; |
for (i = 0, last_stab = stab = info->stabs, last_str = str = info->strs; |
for (i = 0, stab = info->stabs, nul_str = str = info->strs; |
i < info->indextablesize && stab < info->stabs + stabsize; |
stab += STABSIZE) |
{ |
1171,36 → 1170,33 |
Note that a N_SO without a file name is an EOF and |
there could be 2 N_SO following it with the new filename |
and directory. */ |
if (saw_fun == 0) |
if (nul_fun != NULL) |
{ |
info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF); |
info->indextable[i].stab = last_stab; |
info->indextable[i].str = last_str; |
info->indextable[i].val = bfd_get_32 (abfd, nul_fun + VALOFF); |
info->indextable[i].stab = nul_fun; |
info->indextable[i].str = nul_str; |
info->indextable[i].directory_name = directory_name; |
info->indextable[i].file_name = file_name; |
info->indextable[i].function_name = NULL; |
++i; |
} |
saw_fun = 0; |
directory_name = NULL; |
file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); |
if (*file_name == '\0') |
if (file_name == (char *) str) |
{ |
directory_name = NULL; |
file_name = NULL; |
saw_fun = 1; |
nul_fun = NULL; |
} |
else |
{ |
last_stab = stab; |
last_str = str; |
if (stab + STABSIZE >= info->stabs + stabsize |
|| *(stab + STABSIZE + TYPEOFF) != (bfd_byte) N_SO) |
nul_fun = stab; |
nul_str = str; |
if (file_name >= (char *) info->strs + strsize || file_name < (char *) str) |
file_name = NULL; |
if (stab + STABSIZE + TYPEOFF < info->stabs + stabsize |
&& *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO) |
{ |
directory_name = NULL; |
} |
else |
{ |
/* Two consecutive N_SOs are a directory and a |
file name. */ |
stab += STABSIZE; |
1207,6 → 1203,8 |
directory_name = file_name; |
file_name = ((char *) str |
+ bfd_get_32 (abfd, stab + STRDXOFF)); |
if (file_name >= (char *) info->strs + strsize || file_name < (char *) str) |
file_name = NULL; |
} |
} |
break; |
1214,21 → 1212,21 |
case N_SOL: |
/* The name of an include file. */ |
file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); |
/* PR 17512: file: 0c680a1f. */ |
/* PR 17512: file: 5da8aec4. */ |
if (file_name >= (char *) info->strs + strsize || file_name < (char *) str) |
file_name = NULL; |
break; |
case N_FUN: |
/* A function name. */ |
saw_fun = 1; |
name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); |
if (*name == '\0') |
name = NULL; |
function_name = name; |
if (name == NULL) |
function_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); |
if (function_name == (char *) str) |
continue; |
if (function_name >= (char *) info->strs + strsize) |
function_name = NULL; |
nul_fun = NULL; |
info->indextable[i].val = bfd_get_32 (abfd, stab + VALOFF); |
info->indextable[i].stab = stab; |
info->indextable[i].str = str; |
1240,11 → 1238,11 |
} |
} |
if (saw_fun == 0) |
if (nul_fun != NULL) |
{ |
info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF); |
info->indextable[i].stab = last_stab; |
info->indextable[i].str = last_str; |
info->indextable[i].val = bfd_get_32 (abfd, nul_fun + VALOFF); |
info->indextable[i].stab = nul_fun; |
info->indextable[i].str = nul_str; |
info->indextable[i].directory_name = directory_name; |
info->indextable[i].file_name = file_name; |
info->indextable[i].function_name = NULL; |
1334,6 → 1332,8 |
if (val <= offset) |
{ |
file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); |
if (file_name >= (char *) info->strs + strsize || file_name < (char *) str) |
file_name = NULL; |
*pline = 0; |
} |
break; |
/contrib/toolchain/binutils/bfd/sysdep.h |
---|
1,6 → 1,5 |
/* sysdep.h -- handle host dependencies for the BFD library |
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2005, 2007, 2009 |
Free Software Foundation, Inc. |
Copyright (C) 1995-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
27,8 → 26,6 |
#error sysdep.h must be included in lieu of config.h |
#endif |
#include <stdarg.h> |
#include "config.h" |
#include "ansidecl.h" |
37,6 → 34,8 |
#include <stddef.h> |
#endif |
#include <stdarg.h> |
#include <stdio.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
173,6 → 172,10 |
#endif |
#endif |
#if !HAVE_DECL_STRNLEN |
size_t strnlen (const char *, size_t); |
#endif |
/* Define offsetof for those systems which lack it */ |
#ifndef offsetof |
/contrib/toolchain/binutils/bfd/targets.c |
---|
1,5 → 1,5 |
/* Generic target-file-type support for the BFD library. |
Copyright 1990-2013 Free Software Foundation, Inc. |
Copyright (C) 1990-2015 Free Software Foundation, Inc. |
Written by Cygnus Support. |
This file is part of BFD, the Binary File Descriptor library. |
144,6 → 144,7 |
.enum bfd_flavour |
.{ |
. {* N.B. Update bfd_flavour_name if you change this. *} |
. bfd_target_unknown_flavour, |
. bfd_target_aout_flavour, |
. bfd_target_coff_flavour, |
363,12 → 364,12 |
. NAME##_make_empty_symbol, \ |
. NAME##_print_symbol, \ |
. NAME##_get_symbol_info, \ |
. NAME##_get_symbol_version_string, \ |
. NAME##_bfd_is_local_label_name, \ |
. NAME##_bfd_is_target_special_symbol, \ |
. NAME##_get_lineno, \ |
. NAME##_find_nearest_line, \ |
. _bfd_generic_find_nearest_line_discriminator, \ |
. _bfd_generic_find_line, \ |
. NAME##_find_line, \ |
. NAME##_find_inliner_info, \ |
. NAME##_bfd_make_debug_symbol, \ |
. NAME##_read_minisymbols, \ |
385,14 → 386,14 |
. void (*_bfd_get_symbol_info) |
. (bfd *, struct bfd_symbol *, symbol_info *); |
.#define bfd_get_symbol_info(b,p,e) BFD_SEND (b, _bfd_get_symbol_info, (b,p,e)) |
. const char *(*_bfd_get_symbol_version_string) |
. (bfd *, struct bfd_symbol *, bfd_boolean *); |
.#define bfd_get_symbol_version_string(b,s,h) BFD_SEND (b, _bfd_get_symbol_version_string, (b,s,h)) |
. bfd_boolean (*_bfd_is_local_label_name) (bfd *, const char *); |
. bfd_boolean (*_bfd_is_target_special_symbol) (bfd *, asymbol *); |
. alent * (*_get_lineno) (bfd *, struct bfd_symbol *); |
. bfd_boolean (*_bfd_find_nearest_line) |
. (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, |
. const char **, const char **, unsigned int *); |
. bfd_boolean (*_bfd_find_nearest_line_discriminator) |
. (bfd *, struct bfd_section *, struct bfd_symbol **, bfd_vma, |
. (bfd *, struct bfd_symbol **, struct bfd_section *, bfd_vma, |
. const char **, const char **, unsigned int *, unsigned int *); |
. bfd_boolean (*_bfd_find_line) |
. (bfd *, struct bfd_symbol **, struct bfd_symbol *, |
446,7 → 447,6 |
. NAME##_bfd_get_relocated_section_contents, \ |
. NAME##_bfd_relax_section, \ |
. NAME##_bfd_link_hash_table_create, \ |
. NAME##_bfd_link_hash_table_free, \ |
. NAME##_bfd_link_add_symbols, \ |
. NAME##_bfd_link_just_syms, \ |
. NAME##_bfd_copy_link_hash_symbol_type, \ |
473,9 → 473,6 |
. struct bfd_link_hash_table * |
. (*_bfd_link_hash_table_create) (bfd *); |
. |
. {* Release the memory associated with the linker hash table. *} |
. void (*_bfd_link_hash_table_free) (struct bfd_link_hash_table *); |
. |
. {* Add symbols from this object file into the hash table. *} |
. bfd_boolean (*_bfd_link_add_symbols) (bfd *, struct bfd_link_info *); |
. |
482,7 → 479,8 |
. {* Indicate that we are only retrieving symbol values from this section. *} |
. void (*_bfd_link_just_syms) (asection *, struct bfd_link_info *); |
. |
. {* Copy the symbol type of a linker hash table entry. *} |
. {* Copy the symbol type and other attributes for a linker script |
. assignment of one symbol to another. *} |
.#define bfd_copy_link_hash_symbol_type(b, t, f) \ |
. BFD_SEND (b, _bfd_copy_link_hash_symbol_type, (b, t, f)) |
. void (*_bfd_copy_link_hash_symbol_type) |
567,357 → 565,367 |
Alphabetized for easy reference. |
They are listed a second time below, since |
we can't intermix extern's and initializers. */ |
extern const bfd_target a_out_adobe_vec; |
extern const bfd_target aix5coff64_vec; |
extern const bfd_target aout0_big_vec; |
extern const bfd_target aout_arm_big_vec; |
extern const bfd_target aout_arm_little_vec; |
extern const bfd_target aout_mips_big_vec; |
extern const bfd_target aout_mips_little_vec; |
extern const bfd_target apollocoff_vec; |
extern const bfd_target arm_epoc_pe_big_vec; |
extern const bfd_target arm_epoc_pe_little_vec; |
extern const bfd_target arm_epoc_pei_big_vec; |
extern const bfd_target arm_epoc_pei_little_vec; |
extern const bfd_target arm_wince_pe_big_vec; |
extern const bfd_target arm_wince_pe_little_vec; |
extern const bfd_target arm_wince_pei_big_vec; |
extern const bfd_target arm_wince_pei_little_vec; |
extern const bfd_target armcoff_big_vec; |
extern const bfd_target armcoff_little_vec; |
extern const bfd_target armnetbsd_vec; |
extern const bfd_target armpe_big_vec; |
extern const bfd_target armpe_little_vec; |
extern const bfd_target armpei_big_vec; |
extern const bfd_target armpei_little_vec; |
extern const bfd_target b_out_vec_big_host; |
extern const bfd_target b_out_vec_little_host; |
extern const bfd_target bfd_pei_ia64_vec; |
extern const bfd_target bfd_elf32_avr_vec; |
extern const bfd_target bfd_elf32_bfin_vec; |
extern const bfd_target bfd_elf32_bfinfdpic_vec; |
extern const bfd_target bfd_elf32_big_generic_vec; |
extern const bfd_target bfd_elf32_bigarc_vec; |
extern const bfd_target bfd_elf32_bigarm_vec; |
extern const bfd_target bfd_elf32_bigarm_nacl_vec; |
extern const bfd_target bfd_elf32_bigarm_symbian_vec; |
extern const bfd_target bfd_elf32_bigarm_vxworks_vec; |
extern const bfd_target bfd_elf32_bigmips_vec; |
extern const bfd_target bfd_elf32_bigmips_vxworks_vec; |
extern const bfd_target bfd_elf32_bigmoxie_vec; |
extern const bfd_target bfd_elf32_bignios2_vec; |
extern const bfd_target bfd_elf32_cr16_vec; |
extern const bfd_target bfd_elf32_cr16c_vec; |
extern const bfd_target bfd_elf32_cris_vec; |
extern const bfd_target bfd_elf32_crx_vec; |
extern const bfd_target bfd_elf32_d10v_vec; |
extern const bfd_target bfd_elf32_d30v_vec; |
extern const bfd_target bfd_elf32_dlx_big_vec; |
extern const bfd_target bfd_elf32_epiphany_vec; |
extern const bfd_target bfd_elf32_fr30_vec; |
extern const bfd_target bfd_elf32_frv_vec; |
extern const bfd_target bfd_elf32_frvfdpic_vec; |
extern const bfd_target bfd_elf32_h8300_vec; |
extern const bfd_target bfd_elf32_hppa_linux_vec; |
extern const bfd_target bfd_elf32_hppa_nbsd_vec; |
extern const bfd_target bfd_elf32_hppa_vec; |
extern const bfd_target bfd_elf32_i370_vec; |
extern const bfd_target bfd_elf32_i386_freebsd_vec; |
extern const bfd_target bfd_elf32_i386_nacl_vec; |
extern const bfd_target bfd_elf32_i386_sol2_vec; |
extern const bfd_target bfd_elf32_i386_vxworks_vec; |
extern const bfd_target bfd_elf32_i386_vec; |
extern const bfd_target bfd_elf32_i860_little_vec; |
extern const bfd_target bfd_elf32_i860_vec; |
extern const bfd_target bfd_elf32_i960_vec; |
extern const bfd_target bfd_elf32_ia64_big_vec; |
extern const bfd_target bfd_elf32_ia64_hpux_big_vec; |
extern const bfd_target bfd_elf32_ip2k_vec; |
extern const bfd_target bfd_elf32_iq2000_vec; |
extern const bfd_target bfd_elf32_lm32_vec; |
extern const bfd_target bfd_elf32_lm32fdpic_vec; |
extern const bfd_target bfd_elf32_little_generic_vec; |
extern const bfd_target bfd_elf32_littlearc_vec; |
extern const bfd_target bfd_elf32_littlearm_vec; |
extern const bfd_target bfd_elf32_littlearm_nacl_vec; |
extern const bfd_target bfd_elf32_littlearm_symbian_vec; |
extern const bfd_target bfd_elf32_littlearm_vxworks_vec; |
extern const bfd_target bfd_elf32_littlemips_vec; |
extern const bfd_target bfd_elf32_littlemips_vxworks_vec; |
extern const bfd_target bfd_elf32_littlemoxie_vec; |
extern const bfd_target bfd_elf32_littlenios2_vec; |
extern const bfd_target bfd_elf32_m32c_vec; |
extern const bfd_target bfd_elf32_m32r_vec; |
extern const bfd_target bfd_elf32_m32rle_vec; |
extern const bfd_target bfd_elf32_m32rlin_vec; |
extern const bfd_target bfd_elf32_m32rlelin_vec; |
extern const bfd_target bfd_elf32_m68hc11_vec; |
extern const bfd_target bfd_elf32_m68hc12_vec; |
extern const bfd_target bfd_elf32_m68k_vec; |
extern const bfd_target bfd_elf32_m88k_vec; |
extern const bfd_target bfd_elf32_mcore_big_vec; |
extern const bfd_target bfd_elf32_mcore_little_vec; |
extern const bfd_target bfd_elf32_mep_vec; |
extern const bfd_target bfd_elf32_mep_little_vec; |
extern const bfd_target bfd_elf32_metag_vec; |
extern const bfd_target bfd_elf32_microblazeel_vec; |
extern const bfd_target bfd_elf32_microblaze_vec; |
extern const bfd_target bfd_elf32_mn10200_vec; |
extern const bfd_target bfd_elf32_mn10300_vec; |
extern const bfd_target bfd_elf32_mt_vec; |
extern const bfd_target bfd_elf32_msp430_vec; |
extern const bfd_target bfd_elf32_msp430_ti_vec; |
extern const bfd_target bfd_elf32_nbigmips_vec; |
extern const bfd_target bfd_elf32_nlittlemips_vec; |
extern const bfd_target bfd_elf32_ntradbigmips_vec; |
extern const bfd_target bfd_elf32_ntradlittlemips_vec; |
extern const bfd_target bfd_elf32_ntradbigmips_freebsd_vec; |
extern const bfd_target bfd_elf32_ntradlittlemips_freebsd_vec; |
extern const bfd_target bfd_elf32_openrisc_vec; |
extern const bfd_target bfd_elf32_or32_big_vec; |
extern const bfd_target bfd_elf32_pj_vec; |
extern const bfd_target bfd_elf32_pjl_vec; |
extern const bfd_target bfd_elf32_powerpc_vec; |
extern const bfd_target bfd_elf32_powerpcle_vec; |
extern const bfd_target bfd_elf32_powerpc_freebsd_vec; |
extern const bfd_target bfd_elf32_powerpc_vxworks_vec; |
extern const bfd_target bfd_elf32_rl78_vec; |
extern const bfd_target bfd_elf32_rx_le_vec; |
extern const bfd_target bfd_elf32_rx_be_vec; |
extern const bfd_target bfd_elf32_rx_be_ns_vec; |
extern const bfd_target bfd_elf32_s390_vec; |
extern const bfd_target bfd_elf32_bigscore_vec; |
extern const bfd_target bfd_elf32_littlescore_vec; |
extern const bfd_target bfd_elf32_sh64_vec; |
extern const bfd_target bfd_elf32_sh64l_vec; |
extern const bfd_target bfd_elf32_sh64lin_vec; |
extern const bfd_target bfd_elf32_sh64blin_vec; |
extern const bfd_target bfd_elf32_sh64lnbsd_vec; |
extern const bfd_target bfd_elf32_sh64nbsd_vec; |
extern const bfd_target bfd_elf32_sh_vec; |
extern const bfd_target bfd_elf32_shbfd_vec; |
extern const bfd_target bfd_elf32_shblin_vec; |
extern const bfd_target bfd_elf32_shfd_vec; |
extern const bfd_target bfd_elf32_shl_vec; |
extern const bfd_target bfd_elf32_shl_symbian_vec; |
extern const bfd_target bfd_elf32_shlin_vec; |
extern const bfd_target bfd_elf32_shlnbsd_vec; |
extern const bfd_target bfd_elf32_shlvxworks_vec; |
extern const bfd_target bfd_elf32_shnbsd_vec; |
extern const bfd_target bfd_elf32_shvxworks_vec; |
extern const bfd_target bfd_elf32_sparc_vec; |
extern const bfd_target bfd_elf32_sparc_sol2_vec; |
extern const bfd_target bfd_elf32_sparc_vxworks_vec; |
extern const bfd_target bfd_elf32_spu_vec; |
extern const bfd_target bfd_elf32_tic6x_be_vec; |
extern const bfd_target bfd_elf32_tic6x_le_vec; |
extern const bfd_target bfd_elf32_tic6x_elf_be_vec; |
extern const bfd_target bfd_elf32_tic6x_elf_le_vec; |
extern const bfd_target bfd_elf32_tic6x_linux_be_vec; |
extern const bfd_target bfd_elf32_tic6x_linux_le_vec; |
extern const bfd_target bfd_elf32_tilegx_be_vec; |
extern const bfd_target bfd_elf32_tilegx_le_vec; |
extern const bfd_target bfd_elf32_tilepro_vec; |
extern const bfd_target bfd_elf32_tradbigmips_vec; |
extern const bfd_target bfd_elf32_tradlittlemips_vec; |
extern const bfd_target bfd_elf32_tradbigmips_freebsd_vec; |
extern const bfd_target bfd_elf32_tradlittlemips_freebsd_vec; |
extern const bfd_target bfd_elf32_us_cris_vec; |
extern const bfd_target bfd_elf32_v850_vec; |
extern const bfd_target bfd_elf32_v850_rh850_vec; |
extern const bfd_target bfd_elf32_vax_vec; |
extern const bfd_target bfd_elf32_xc16x_vec; |
extern const bfd_target bfd_elf32_xgate_vec; |
extern const bfd_target bfd_elf32_xstormy16_vec; |
extern const bfd_target bfd_elf32_xtensa_be_vec; |
extern const bfd_target bfd_elf32_xtensa_le_vec; |
extern const bfd_target bfd_elf64_alpha_freebsd_vec; |
extern const bfd_target bfd_elf64_alpha_vec; |
extern const bfd_target bfd_elf64_big_generic_vec; |
extern const bfd_target bfd_elf64_bigmips_vec; |
extern const bfd_target bfd_elf64_bigaarch64_vec; |
extern const bfd_target bfd_elf32_bigaarch64_vec; |
extern const bfd_target bfd_elf64_hppa_linux_vec; |
extern const bfd_target bfd_elf64_hppa_vec; |
extern const bfd_target bfd_elf64_ia64_big_vec; |
extern const bfd_target bfd_elf64_ia64_hpux_big_vec; |
extern const bfd_target bfd_elf64_ia64_little_vec; |
extern const bfd_target bfd_elf64_ia64_vms_vec; |
extern const bfd_target bfd_elf64_little_generic_vec; |
extern const bfd_target bfd_elf64_littlemips_vec; |
extern const bfd_target bfd_elf64_littleaarch64_vec; |
extern const bfd_target bfd_elf32_littleaarch64_vec; |
extern const bfd_target bfd_elf64_mmix_vec; |
extern const bfd_target bfd_elf64_powerpc_vec; |
extern const bfd_target bfd_elf64_powerpcle_vec; |
extern const bfd_target bfd_elf64_powerpc_freebsd_vec; |
extern const bfd_target bfd_elf64_s390_vec; |
extern const bfd_target bfd_elf64_sh64_vec; |
extern const bfd_target bfd_elf64_sh64l_vec; |
extern const bfd_target bfd_elf64_sh64lin_vec; |
extern const bfd_target bfd_elf64_sh64blin_vec; |
extern const bfd_target bfd_elf64_sh64lnbsd_vec; |
extern const bfd_target bfd_elf64_sh64nbsd_vec; |
extern const bfd_target bfd_elf64_sparc_vec; |
extern const bfd_target bfd_elf64_sparc_freebsd_vec; |
extern const bfd_target bfd_elf64_sparc_sol2_vec; |
extern const bfd_target bfd_elf64_tilegx_be_vec; |
extern const bfd_target bfd_elf64_tilegx_le_vec; |
extern const bfd_target bfd_elf64_tradbigmips_vec; |
extern const bfd_target bfd_elf64_tradlittlemips_vec; |
extern const bfd_target bfd_elf64_tradbigmips_freebsd_vec; |
extern const bfd_target bfd_elf64_tradlittlemips_freebsd_vec; |
extern const bfd_target bfd_elf64_x86_64_freebsd_vec; |
extern const bfd_target bfd_elf64_x86_64_nacl_vec; |
extern const bfd_target bfd_elf64_x86_64_sol2_vec; |
extern const bfd_target bfd_elf64_x86_64_vec; |
extern const bfd_target bfd_elf32_x86_64_nacl_vec; |
extern const bfd_target bfd_elf32_x86_64_vec; |
extern const bfd_target bfd_elf64_l1om_freebsd_vec; |
extern const bfd_target bfd_elf64_l1om_vec; |
extern const bfd_target bfd_elf64_k1om_freebsd_vec; |
extern const bfd_target bfd_elf64_k1om_vec; |
extern const bfd_target bfd_mmo_vec; |
extern const bfd_target bfd_powerpc_pe_vec; |
extern const bfd_target bfd_powerpc_pei_vec; |
extern const bfd_target bfd_powerpcle_pe_vec; |
extern const bfd_target bfd_powerpcle_pei_vec; |
extern const bfd_target aarch64_elf32_be_vec; |
extern const bfd_target aarch64_elf32_le_vec; |
extern const bfd_target aarch64_elf64_be_vec; |
extern const bfd_target aarch64_elf64_be_cloudabi_vec; |
extern const bfd_target aarch64_elf64_le_vec; |
extern const bfd_target aarch64_elf64_le_cloudabi_vec; |
extern const bfd_target alpha_ecoff_le_vec; |
extern const bfd_target alpha_elf64_vec; |
extern const bfd_target alpha_elf64_fbsd_vec; |
extern const bfd_target alpha_nlm32_vec; |
extern const bfd_target alpha_vms_vec; |
extern const bfd_target alpha_vms_lib_txt_vec; |
extern const bfd_target am33_elf32_linux_vec; |
extern const bfd_target aout0_be_vec; |
extern const bfd_target aout64_vec; |
extern const bfd_target aout_vec; |
extern const bfd_target aout_adobe_vec; |
extern const bfd_target arc_elf32_be_vec; |
extern const bfd_target arc_elf32_le_vec; |
extern const bfd_target arm_aout_be_vec; |
extern const bfd_target arm_aout_le_vec; |
extern const bfd_target arm_aout_nbsd_vec; |
extern const bfd_target arm_aout_riscix_vec; |
extern const bfd_target arm_coff_be_vec; |
extern const bfd_target arm_coff_le_vec; |
extern const bfd_target arm_elf32_be_vec; |
extern const bfd_target arm_elf32_le_vec; |
extern const bfd_target arm_elf32_nacl_be_vec; |
extern const bfd_target arm_elf32_nacl_le_vec; |
extern const bfd_target arm_elf32_symbian_be_vec; |
extern const bfd_target arm_elf32_symbian_le_vec; |
extern const bfd_target arm_elf32_vxworks_be_vec; |
extern const bfd_target arm_elf32_vxworks_le_vec; |
extern const bfd_target arm_pe_be_vec; |
extern const bfd_target arm_pe_le_vec; |
extern const bfd_target arm_pe_epoc_be_vec; |
extern const bfd_target arm_pe_epoc_le_vec; |
extern const bfd_target arm_pe_wince_be_vec; |
extern const bfd_target arm_pe_wince_le_vec; |
extern const bfd_target arm_pei_be_vec; |
extern const bfd_target arm_pei_le_vec; |
extern const bfd_target arm_pei_epoc_be_vec; |
extern const bfd_target arm_pei_epoc_le_vec; |
extern const bfd_target arm_pei_wince_be_vec; |
extern const bfd_target arm_pei_wince_le_vec; |
extern const bfd_target avr_elf32_vec; |
extern const bfd_target bfin_elf32_vec; |
extern const bfd_target bfin_elf32_fdpic_vec; |
extern const bfd_target bout_be_vec; |
extern const bfd_target bout_le_vec; |
extern const bfd_target cr16_elf32_vec; |
extern const bfd_target cr16c_elf32_vec; |
extern const bfd_target cris_aout_vec; |
extern const bfd_target demo_64_vec; |
extern const bfd_target ecoff_big_vec; |
extern const bfd_target ecoff_biglittle_vec; |
extern const bfd_target ecoff_little_vec; |
extern const bfd_target ecoffalpha_little_vec; |
extern const bfd_target go32coff_vec; |
extern const bfd_target go32stubbedcoff_vec; |
extern const bfd_target h8300coff_vec; |
extern const bfd_target h8500coff_vec; |
extern const bfd_target host_aout_vec; |
extern const bfd_target hp300bsd_vec; |
extern const bfd_target hp300hpux_vec; |
extern const bfd_target i386aout_vec; |
extern const bfd_target i386bsd_vec; |
extern const bfd_target i386coff_vec; |
extern const bfd_target i386dynix_vec; |
extern const bfd_target i386freebsd_vec; |
extern const bfd_target i386linux_vec; |
extern const bfd_target i386lynx_aout_vec; |
extern const bfd_target i386lynx_coff_vec; |
extern const bfd_target i386mach3_vec; |
extern const bfd_target i386msdos_vec; |
extern const bfd_target i386netbsd_vec; |
extern const bfd_target i386os9k_vec; |
extern const bfd_target i386pe_vec; |
extern const bfd_target i386pei_vec; |
extern const bfd_target i860coff_vec; |
extern const bfd_target icoff_big_vec; |
extern const bfd_target icoff_little_vec; |
extern const bfd_target cris_elf32_vec; |
extern const bfd_target cris_elf32_us_vec; |
extern const bfd_target crx_elf32_vec; |
extern const bfd_target d10v_elf32_vec; |
extern const bfd_target d30v_elf32_vec; |
extern const bfd_target dlx_elf32_be_vec; |
extern const bfd_target elf32_be_vec; |
extern const bfd_target elf32_le_vec; |
extern const bfd_target elf64_be_vec; |
extern const bfd_target elf64_le_vec; |
extern const bfd_target epiphany_elf32_vec; |
extern const bfd_target fr30_elf32_vec; |
extern const bfd_target frv_elf32_vec; |
extern const bfd_target frv_elf32_fdpic_vec; |
extern const bfd_target h8300_coff_vec; |
extern const bfd_target h8300_elf32_vec; |
extern const bfd_target h8300_elf32_linux_vec; |
extern const bfd_target h8500_coff_vec; |
extern const bfd_target hppa_elf32_vec; |
extern const bfd_target hppa_elf32_linux_vec; |
extern const bfd_target hppa_elf32_nbsd_vec; |
extern const bfd_target hppa_elf64_vec; |
extern const bfd_target hppa_elf64_linux_vec; |
extern const bfd_target hppa_som_vec; |
extern const bfd_target i370_elf32_vec; |
extern const bfd_target i386_aout_vec; |
extern const bfd_target i386_aout_bsd_vec; |
extern const bfd_target i386_aout_dynix_vec; |
extern const bfd_target i386_aout_fbsd_vec; |
extern const bfd_target i386_aout_linux_vec; |
extern const bfd_target i386_aout_lynx_vec; |
extern const bfd_target i386_aout_mach3_vec; |
extern const bfd_target i386_aout_nbsd_vec; |
extern const bfd_target i386_aout_os9k_vec; |
extern const bfd_target i386_coff_vec; |
extern const bfd_target i386_coff_go32_vec; |
extern const bfd_target i386_coff_go32stubbed_vec; |
extern const bfd_target i386_coff_lynx_vec; |
extern const bfd_target i386_elf32_vec; |
extern const bfd_target i386_elf32_fbsd_vec; |
extern const bfd_target i386_elf32_nacl_vec; |
extern const bfd_target i386_elf32_sol2_vec; |
extern const bfd_target i386_elf32_vxworks_vec; |
extern const bfd_target i386_mach_o_vec; |
extern const bfd_target i386_msdos_vec; |
extern const bfd_target i386_nlm32_vec; |
extern const bfd_target i386_pe_vec; |
extern const bfd_target i386_pei_vec; |
extern const bfd_target iamcu_elf32_vec; |
extern const bfd_target i860_coff_vec; |
extern const bfd_target i860_elf32_vec; |
extern const bfd_target i860_elf32_le_vec; |
extern const bfd_target i960_elf32_vec; |
extern const bfd_target ia64_elf32_be_vec; |
extern const bfd_target ia64_elf32_hpux_be_vec; |
extern const bfd_target ia64_elf64_be_vec; |
extern const bfd_target ia64_elf64_le_vec; |
extern const bfd_target ia64_elf64_hpux_be_vec; |
extern const bfd_target ia64_elf64_vms_vec; |
extern const bfd_target ia64_pei_vec; |
extern const bfd_target icoff_be_vec; |
extern const bfd_target icoff_le_vec; |
extern const bfd_target ieee_vec; |
extern const bfd_target m68k4knetbsd_vec; |
extern const bfd_target m68kaux_coff_vec; |
extern const bfd_target m68kcoff_vec; |
extern const bfd_target m68kcoffun_vec; |
extern const bfd_target m68klinux_vec; |
extern const bfd_target m68knetbsd_vec; |
extern const bfd_target m68ksysvcoff_vec; |
extern const bfd_target m88kbcs_vec; |
extern const bfd_target m88kmach3_vec; |
extern const bfd_target m88kopenbsd_vec; |
extern const bfd_target ip2k_elf32_vec; |
extern const bfd_target iq2000_elf32_vec; |
extern const bfd_target k1om_elf64_vec; |
extern const bfd_target k1om_elf64_fbsd_vec; |
extern const bfd_target l1om_elf64_vec; |
extern const bfd_target l1om_elf64_fbsd_vec; |
extern const bfd_target lm32_elf32_vec; |
extern const bfd_target lm32_elf32_fdpic_vec; |
extern const bfd_target m32c_elf32_vec; |
extern const bfd_target m32r_elf32_vec; |
extern const bfd_target m32r_elf32_le_vec; |
extern const bfd_target m32r_elf32_linux_vec; |
extern const bfd_target m32r_elf32_linux_le_vec; |
extern const bfd_target m68hc11_elf32_vec; |
extern const bfd_target m68hc12_elf32_vec; |
extern const bfd_target m68k_aout_4knbsd_vec; |
extern const bfd_target m68k_aout_hp300bsd_vec; |
extern const bfd_target m68k_aout_hp300hpux_vec; |
extern const bfd_target m68k_aout_linux_vec; |
extern const bfd_target m68k_aout_nbsd_vec; |
extern const bfd_target m68k_aout_newsos3_vec; |
extern const bfd_target m68k_coff_vec; |
extern const bfd_target m68k_coff_apollo_vec; |
extern const bfd_target m68k_coff_aux_vec; |
extern const bfd_target m68k_coff_sysv_vec; |
extern const bfd_target m68k_coff_un_vec; |
extern const bfd_target m68k_elf32_vec; |
extern const bfd_target m68k_versados_vec; |
extern const bfd_target m88k_aout_mach3_vec; |
extern const bfd_target m88k_aout_obsd_vec; |
extern const bfd_target m88k_coff_bcs_vec; |
extern const bfd_target m88k_elf32_vec; |
extern const bfd_target mach_o_be_vec; |
extern const bfd_target mach_o_le_vec; |
extern const bfd_target mach_o_fat_vec; |
extern const bfd_target mach_o_i386_vec; |
extern const bfd_target mach_o_x86_64_vec; |
extern const bfd_target mcore_pe_big_vec; |
extern const bfd_target mcore_pe_little_vec; |
extern const bfd_target mcore_pei_big_vec; |
extern const bfd_target mcore_pei_little_vec; |
extern const bfd_target mipslpe_vec; |
extern const bfd_target mipslpei_vec; |
extern const bfd_target newsos3_vec; |
extern const bfd_target nlm32_alpha_vec; |
extern const bfd_target nlm32_i386_vec; |
extern const bfd_target nlm32_powerpc_vec; |
extern const bfd_target nlm32_sparc_vec; |
extern const bfd_target mcore_elf32_be_vec; |
extern const bfd_target mcore_elf32_le_vec; |
extern const bfd_target mcore_pe_be_vec; |
extern const bfd_target mcore_pe_le_vec; |
extern const bfd_target mcore_pei_be_vec; |
extern const bfd_target mcore_pei_le_vec; |
extern const bfd_target mep_elf32_vec; |
extern const bfd_target mep_elf32_le_vec; |
extern const bfd_target metag_elf32_vec; |
extern const bfd_target microblaze_elf32_vec; |
extern const bfd_target microblaze_elf32_le_vec; |
extern const bfd_target mips_aout_be_vec; |
extern const bfd_target mips_aout_le_vec; |
extern const bfd_target mips_ecoff_be_vec; |
extern const bfd_target mips_ecoff_le_vec; |
extern const bfd_target mips_ecoff_bele_vec; |
extern const bfd_target mips_elf32_be_vec; |
extern const bfd_target mips_elf32_le_vec; |
extern const bfd_target mips_elf32_n_be_vec; |
extern const bfd_target mips_elf32_n_le_vec; |
extern const bfd_target mips_elf32_ntrad_be_vec; |
extern const bfd_target mips_elf32_ntrad_le_vec; |
extern const bfd_target mips_elf32_ntradfbsd_be_vec; |
extern const bfd_target mips_elf32_ntradfbsd_le_vec; |
extern const bfd_target mips_elf32_trad_be_vec; |
extern const bfd_target mips_elf32_trad_le_vec; |
extern const bfd_target mips_elf32_tradfbsd_be_vec; |
extern const bfd_target mips_elf32_tradfbsd_le_vec; |
extern const bfd_target mips_elf32_vxworks_be_vec; |
extern const bfd_target mips_elf32_vxworks_le_vec; |
extern const bfd_target mips_elf64_be_vec; |
extern const bfd_target mips_elf64_le_vec; |
extern const bfd_target mips_elf64_trad_be_vec; |
extern const bfd_target mips_elf64_trad_le_vec; |
extern const bfd_target mips_elf64_tradfbsd_be_vec; |
extern const bfd_target mips_elf64_tradfbsd_le_vec; |
extern const bfd_target mips_pe_le_vec; |
extern const bfd_target mips_pei_le_vec; |
extern const bfd_target mmix_elf64_vec; |
extern const bfd_target mmix_mmo_vec; |
extern const bfd_target mn10200_elf32_vec; |
extern const bfd_target mn10300_elf32_vec; |
extern const bfd_target moxie_elf32_be_vec; |
extern const bfd_target moxie_elf32_le_vec; |
extern const bfd_target msp430_elf32_vec; |
extern const bfd_target msp430_elf32_ti_vec; |
extern const bfd_target mt_elf32_vec; |
extern const bfd_target nds32_elf32_be_vec; |
extern const bfd_target nds32_elf32_le_vec; |
extern const bfd_target nds32_elf32_linux_be_vec; |
extern const bfd_target nds32_elf32_linux_le_vec; |
extern const bfd_target nios2_elf32_be_vec; |
extern const bfd_target nios2_elf32_le_vec; |
extern const bfd_target ns32k_aout_pc532mach_vec; |
extern const bfd_target ns32k_aout_pc532nbsd_vec; |
extern const bfd_target oasys_vec; |
extern const bfd_target or32coff_big_vec; |
extern const bfd_target pc532machaout_vec; |
extern const bfd_target pc532netbsd_vec; |
extern const bfd_target or1k_elf32_vec; |
extern const bfd_target pdp11_aout_vec; |
extern const bfd_target pef_vec; |
extern const bfd_target pef_xlib_vec; |
extern const bfd_target pj_elf32_vec; |
extern const bfd_target pj_elf32_le_vec; |
extern const bfd_target plugin_vec; |
extern const bfd_target pmac_xcoff_vec; |
extern const bfd_target ppcboot_vec; |
extern const bfd_target riscix_vec; |
extern const bfd_target rs6000coff64_vec; |
extern const bfd_target rs6000coff_vec; |
extern const bfd_target shcoff_small_vec; |
extern const bfd_target shcoff_vec; |
extern const bfd_target shlcoff_small_vec; |
extern const bfd_target shlcoff_vec; |
extern const bfd_target shlpe_vec; |
extern const bfd_target shlpei_vec; |
extern const bfd_target som_vec; |
extern const bfd_target sparccoff_vec; |
extern const bfd_target sparcle_aout_vec; |
extern const bfd_target sparclinux_vec; |
extern const bfd_target sparclynx_aout_vec; |
extern const bfd_target sparclynx_coff_vec; |
extern const bfd_target sparcnetbsd_vec; |
extern const bfd_target sunos_big_vec; |
extern const bfd_target powerpc_boot_vec; |
extern const bfd_target powerpc_elf32_vec; |
extern const bfd_target powerpc_elf32_le_vec; |
extern const bfd_target powerpc_elf32_fbsd_vec; |
extern const bfd_target powerpc_elf32_vxworks_vec; |
extern const bfd_target powerpc_elf64_vec; |
extern const bfd_target powerpc_elf64_le_vec; |
extern const bfd_target powerpc_elf64_fbsd_vec; |
extern const bfd_target powerpc_nlm32_vec; |
extern const bfd_target powerpc_pe_vec; |
extern const bfd_target powerpc_pe_le_vec; |
extern const bfd_target powerpc_pei_vec; |
extern const bfd_target powerpc_pei_le_vec; |
extern const bfd_target powerpc_xcoff_vec; |
extern const bfd_target rl78_elf32_vec; |
extern const bfd_target rs6000_xcoff64_vec; |
extern const bfd_target rs6000_xcoff64_aix_vec; |
extern const bfd_target rs6000_xcoff_vec; |
extern const bfd_target rx_elf32_be_vec; |
extern const bfd_target rx_elf32_be_ns_vec; |
extern const bfd_target rx_elf32_le_vec; |
extern const bfd_target s390_elf32_vec; |
extern const bfd_target s390_elf64_vec; |
extern const bfd_target score_elf32_be_vec; |
extern const bfd_target score_elf32_le_vec; |
extern const bfd_target sh64_elf32_vec; |
extern const bfd_target sh64_elf32_le_vec; |
extern const bfd_target sh64_elf32_linux_vec; |
extern const bfd_target sh64_elf32_linux_be_vec; |
extern const bfd_target sh64_elf32_nbsd_vec; |
extern const bfd_target sh64_elf32_nbsd_le_vec; |
extern const bfd_target sh64_elf64_vec; |
extern const bfd_target sh64_elf64_le_vec; |
extern const bfd_target sh64_elf64_linux_vec; |
extern const bfd_target sh64_elf64_linux_be_vec; |
extern const bfd_target sh64_elf64_nbsd_vec; |
extern const bfd_target sh64_elf64_nbsd_le_vec; |
extern const bfd_target sh_coff_vec; |
extern const bfd_target sh_coff_le_vec; |
extern const bfd_target sh_coff_small_vec; |
extern const bfd_target sh_coff_small_le_vec; |
extern const bfd_target sh_elf32_vec; |
extern const bfd_target sh_elf32_le_vec; |
extern const bfd_target sh_elf32_fdpic_be_vec; |
extern const bfd_target sh_elf32_fdpic_le_vec; |
extern const bfd_target sh_elf32_linux_vec; |
extern const bfd_target sh_elf32_linux_be_vec; |
extern const bfd_target sh_elf32_nbsd_vec; |
extern const bfd_target sh_elf32_nbsd_le_vec; |
extern const bfd_target sh_elf32_symbian_le_vec; |
extern const bfd_target sh_elf32_vxworks_vec; |
extern const bfd_target sh_elf32_vxworks_le_vec; |
extern const bfd_target sh_pe_le_vec; |
extern const bfd_target sh_pei_le_vec; |
extern const bfd_target sparc_aout_le_vec; |
extern const bfd_target sparc_aout_linux_vec; |
extern const bfd_target sparc_aout_lynx_vec; |
extern const bfd_target sparc_aout_nbsd_vec; |
extern const bfd_target sparc_aout_sunos_be_vec; |
extern const bfd_target sparc_coff_vec; |
extern const bfd_target sparc_coff_lynx_vec; |
extern const bfd_target sparc_elf32_vec; |
extern const bfd_target sparc_elf32_sol2_vec; |
extern const bfd_target sparc_elf32_vxworks_vec; |
extern const bfd_target sparc_elf64_vec; |
extern const bfd_target sparc_elf64_fbsd_vec; |
extern const bfd_target sparc_elf64_sol2_vec; |
extern const bfd_target sparc_nlm32_vec; |
extern const bfd_target spu_elf32_vec; |
extern const bfd_target sym_vec; |
extern const bfd_target tic30_aout_vec; |
extern const bfd_target tic30_coff_vec; |
extern const bfd_target tic4x_coff0_vec; |
extern const bfd_target tic4x_coff0_beh_vec; |
extern const bfd_target tic4x_coff0_vec; |
extern const bfd_target tic4x_coff1_vec; |
extern const bfd_target tic4x_coff1_beh_vec; |
extern const bfd_target tic4x_coff1_vec; |
extern const bfd_target tic4x_coff2_vec; |
extern const bfd_target tic4x_coff2_beh_vec; |
extern const bfd_target tic4x_coff2_vec; |
extern const bfd_target tic54x_coff0_vec; |
extern const bfd_target tic54x_coff0_beh_vec; |
extern const bfd_target tic54x_coff0_vec; |
extern const bfd_target tic54x_coff1_vec; |
extern const bfd_target tic54x_coff1_beh_vec; |
extern const bfd_target tic54x_coff1_vec; |
extern const bfd_target tic54x_coff2_vec; |
extern const bfd_target tic54x_coff2_beh_vec; |
extern const bfd_target tic54x_coff2_vec; |
extern const bfd_target tic80coff_vec; |
extern const bfd_target vaxbsd_vec; |
extern const bfd_target vaxnetbsd_vec; |
extern const bfd_target vax1knetbsd_vec; |
extern const bfd_target versados_vec; |
extern const bfd_target vms_alpha_vec; |
extern const bfd_target vms_lib_txt_vec; |
extern const bfd_target w65_vec; |
extern const bfd_target we32kcoff_vec; |
extern const bfd_target x86_64pe_vec; |
extern const bfd_target x86_64pei_vec; |
extern const bfd_target x86_64coff_vec; |
extern const bfd_target z80coff_vec; |
extern const bfd_target z8kcoff_vec; |
extern const bfd_target tic6x_elf32_be_vec; |
extern const bfd_target tic6x_elf32_le_vec; |
extern const bfd_target tic6x_elf32_c6000_be_vec; |
extern const bfd_target tic6x_elf32_c6000_le_vec; |
extern const bfd_target tic6x_elf32_linux_be_vec; |
extern const bfd_target tic6x_elf32_linux_le_vec; |
extern const bfd_target tic80_coff_vec; |
extern const bfd_target tilegx_elf32_be_vec; |
extern const bfd_target tilegx_elf32_le_vec; |
extern const bfd_target tilegx_elf64_be_vec; |
extern const bfd_target tilegx_elf64_le_vec; |
extern const bfd_target tilepro_elf32_vec; |
extern const bfd_target v800_elf32_vec; |
extern const bfd_target v850_elf32_vec; |
extern const bfd_target ft32_elf32_vec; |
extern const bfd_target vax_aout_1knbsd_vec; |
extern const bfd_target vax_aout_bsd_vec; |
extern const bfd_target vax_aout_nbsd_vec; |
extern const bfd_target vax_elf32_vec; |
extern const bfd_target visium_elf32_vec; |
extern const bfd_target w65_coff_vec; |
extern const bfd_target we32k_coff_vec; |
extern const bfd_target x86_64_coff_vec; |
extern const bfd_target x86_64_elf32_vec; |
extern const bfd_target x86_64_elf32_nacl_vec; |
extern const bfd_target x86_64_elf64_vec; |
extern const bfd_target x86_64_elf64_cloudabi_vec; |
extern const bfd_target x86_64_elf64_fbsd_vec; |
extern const bfd_target x86_64_elf64_nacl_vec; |
extern const bfd_target x86_64_elf64_sol2_vec; |
extern const bfd_target x86_64_mach_o_vec; |
extern const bfd_target x86_64_pe_vec; |
extern const bfd_target x86_64_pe_be_vec; |
extern const bfd_target x86_64_pei_vec; |
extern const bfd_target xc16x_elf32_vec; |
extern const bfd_target xgate_elf32_vec; |
extern const bfd_target xstormy16_elf32_vec; |
extern const bfd_target xtensa_elf32_be_vec; |
extern const bfd_target xtensa_elf32_le_vec; |
extern const bfd_target z80_coff_vec; |
extern const bfd_target z8k_coff_vec; |
/* These are always included. */ |
extern const bfd_target srec_vec; |
extern const bfd_target symbolsrec_vec; |
extern const bfd_target verilog_vec; |
extern const bfd_target symbolsrec_vec; |
extern const bfd_target tekhex_vec; |
extern const bfd_target binary_vec; |
extern const bfd_target ihex_vec; |
/* All of the xvecs for core files. */ |
extern const bfd_target aix386_core_vec; |
extern const bfd_target cisco_core_big_vec; |
extern const bfd_target cisco_core_little_vec; |
extern const bfd_target hppabsd_core_vec; |
extern const bfd_target hpux_core_vec; |
extern const bfd_target irix_core_vec; |
extern const bfd_target netbsd_core_vec; |
extern const bfd_target osf_core_vec; |
extern const bfd_target ptrace_core_vec; |
extern const bfd_target sco5_core_vec; |
extern const bfd_target trad_core_vec; |
extern const bfd_target core_aix386_vec; |
extern const bfd_target core_cisco_be_vec; |
extern const bfd_target core_cisco_le_vec; |
extern const bfd_target core_hppabsd_vec; |
extern const bfd_target core_hpux_vec; |
extern const bfd_target core_irix_vec; |
extern const bfd_target core_netbsd_vec; |
extern const bfd_target core_osf_vec; |
extern const bfd_target core_ptrace_vec; |
extern const bfd_target core_sco5_vec; |
extern const bfd_target core_trad_vec; |
extern const bfd_target bfd_elf32_am33lin_vec; |
static const bfd_target * const _bfd_target_vector[] = |
{ |
#ifdef SELECT_VECS |
931,339 → 939,319 |
#endif |
/* This list is alphabetized to make it easy to compare |
with other vector lists -- the decls above and |
the case statement in configure.in. |
the case statement in configure.ac. |
Try to keep it in order when adding new targets, and |
use a name of the form <cpu>_<format>_<other>_<endian>_vec. |
Note that sorting is done as if _<endian>_vec wasn't present. |
Vectors that don't compile on all systems, or aren't finished, |
should have an entry here with #if 0 around it, to show that |
it wasn't omitted by mistake. */ |
&a_out_adobe_vec, |
#ifdef BFD64 |
&aix5coff64_vec, |
&aarch64_elf32_be_vec, |
&aarch64_elf32_le_vec, |
&aarch64_elf64_be_vec, |
&aarch64_elf64_be_cloudabi_vec, |
&aarch64_elf64_le_vec, |
&aarch64_elf64_le_cloudabi_vec, |
#endif |
&aout0_big_vec, |
#ifdef BFD64 |
&alpha_ecoff_le_vec, |
&alpha_elf64_vec, |
&alpha_elf64_fbsd_vec, |
&alpha_nlm32_vec, |
&alpha_vms_vec, |
#endif |
&alpha_vms_lib_txt_vec, |
&am33_elf32_linux_vec, |
&aout0_be_vec, |
#ifdef BFD64 |
&aout64_vec, /* Only compiled if host has long-long support. */ |
#endif |
#if 0 |
/* Since a.out files lack decent magic numbers, no way to recognize |
which kind of a.out file it is. */ |
&aout_vec, |
#endif |
&aout_adobe_vec, |
&arc_elf32_be_vec, |
&arc_elf32_le_vec, |
#if 0 |
/* We have no way of distinguishing these from other a.out variants. */ |
&aout_arm_big_vec, |
&aout_arm_little_vec, |
/* No one seems to use this. */ |
&aout_mips_big_vec, |
&arm_aout_be_vec, |
&arm_aout_le_vec, |
#endif |
&aout_mips_little_vec, |
&arm_aout_nbsd_vec, |
#if 0 |
&apollocoff_vec, |
/* We have no way of distinguishing these from other a.out variants. */ |
&arm_aout_riscix_vec, |
#endif |
&arm_epoc_pe_big_vec, |
&arm_epoc_pe_little_vec, |
&arm_epoc_pei_big_vec, |
&arm_epoc_pei_little_vec, |
&arm_wince_pe_big_vec, |
&arm_wince_pe_little_vec, |
&arm_wince_pei_big_vec, |
&arm_wince_pei_little_vec, |
&armcoff_big_vec, |
&armcoff_little_vec, |
&armnetbsd_vec, |
&armpe_big_vec, |
&armpe_little_vec, |
&armpei_big_vec, |
&armpei_little_vec, |
&b_out_vec_big_host, |
&b_out_vec_little_host, |
#ifdef BFD64 |
&bfd_pei_ia64_vec, |
#endif |
&bfd_elf32_avr_vec, |
&bfd_elf32_bfin_vec, |
&bfd_elf32_bfinfdpic_vec, |
&arm_coff_be_vec, |
&arm_coff_le_vec, |
&arm_elf32_be_vec, |
&arm_elf32_le_vec, |
&arm_elf32_symbian_be_vec, |
&arm_elf32_symbian_le_vec, |
&arm_elf32_vxworks_be_vec, |
&arm_elf32_vxworks_le_vec, |
&arm_pe_be_vec, |
&arm_pe_le_vec, |
&arm_pe_epoc_be_vec, |
&arm_pe_epoc_le_vec, |
&arm_pe_wince_be_vec, |
&arm_pe_wince_le_vec, |
&arm_pei_be_vec, |
&arm_pei_le_vec, |
&arm_pei_epoc_be_vec, |
&arm_pei_epoc_le_vec, |
&arm_pei_wince_be_vec, |
&arm_pei_wince_le_vec, |
&avr_elf32_vec, |
&bfin_elf32_vec, |
&bfin_elf32_fdpic_vec, |
&bout_be_vec, |
&bout_le_vec, |
&cr16_elf32_vec, |
&cr16c_elf32_vec, |
&cris_aout_vec, |
&cris_elf32_vec, |
&cris_elf32_us_vec, |
&crx_elf32_vec, |
&d10v_elf32_vec, |
&d30v_elf32_vec, |
&dlx_elf32_be_vec, |
/* This, and other vectors, may not be used in any *.mt configuration. |
But that does not mean they are unnecessary. If configured with |
--enable-targets=all, objdump or gdb should be able to examine |
the file even if we don't recognize the machine type. */ |
&bfd_elf32_big_generic_vec, |
&bfd_elf32_bigarc_vec, |
&bfd_elf32_bigarm_vec, |
&bfd_elf32_bigarm_symbian_vec, |
&bfd_elf32_bigarm_vxworks_vec, |
&elf32_be_vec, |
&elf32_le_vec, |
#ifdef BFD64 |
&bfd_elf32_bigmips_vec, |
&bfd_elf32_bigmips_vxworks_vec, |
&elf64_be_vec, |
&elf64_le_vec, |
#endif |
&bfd_elf32_bigmoxie_vec, |
&bfd_elf32_bignios2_vec, |
&bfd_elf32_cr16_vec, |
&bfd_elf32_cr16c_vec, |
&bfd_elf32_cris_vec, |
&bfd_elf32_crx_vec, |
&bfd_elf32_d10v_vec, |
&bfd_elf32_d30v_vec, |
&bfd_elf32_dlx_big_vec, |
&bfd_elf32_epiphany_vec, |
&bfd_elf32_fr30_vec, |
&bfd_elf32_frv_vec, |
&bfd_elf32_frvfdpic_vec, |
&bfd_elf32_h8300_vec, |
&bfd_elf32_hppa_linux_vec, |
&bfd_elf32_hppa_nbsd_vec, |
&bfd_elf32_hppa_vec, |
&bfd_elf32_i370_vec, |
&bfd_elf32_i386_freebsd_vec, |
&bfd_elf32_i386_nacl_vec, |
&bfd_elf32_i386_sol2_vec, |
&bfd_elf32_i386_vxworks_vec, |
&bfd_elf32_i386_vec, |
&bfd_elf32_i860_little_vec, |
&bfd_elf32_i860_vec, |
&bfd_elf32_i960_vec, |
#if 0 |
&bfd_elf32_ia64_big_vec, |
#endif |
&epiphany_elf32_vec, |
&fr30_elf32_vec, |
&frv_elf32_vec, |
&frv_elf32_fdpic_vec, |
&h8300_coff_vec, |
&h8300_elf32_vec, |
&h8300_elf32_linux_vec, |
&h8500_coff_vec, |
&hppa_elf32_vec, |
&hppa_elf32_linux_vec, |
&hppa_elf32_nbsd_vec, |
#ifdef BFD64 |
&bfd_elf32_ia64_hpux_big_vec, |
&hppa_elf64_vec, |
&hppa_elf64_linux_vec, |
#endif |
&bfd_elf32_ip2k_vec, |
&bfd_elf32_iq2000_vec, |
&bfd_elf32_lm32_vec, |
&bfd_elf32_little_generic_vec, |
&bfd_elf32_littlearc_vec, |
&bfd_elf32_littlearm_vec, |
&bfd_elf32_littlearm_symbian_vec, |
&bfd_elf32_littlearm_vxworks_vec, |
#ifdef BFD64 |
&bfd_elf32_littlemips_vec, |
&bfd_elf32_littlemips_vxworks_vec, |
&hppa_som_vec, |
&i370_elf32_vec, |
&i386_aout_vec, |
&i386_aout_bsd_vec, |
#if 0 |
&i386_aout_dynix_vec, |
#endif |
&bfd_elf32_littlemoxie_vec, |
&bfd_elf32_littlenios2_vec, |
&bfd_elf32_m32c_vec, |
&bfd_elf32_m32r_vec, |
&bfd_elf32_m32rle_vec, |
&bfd_elf32_m32rlin_vec, |
&bfd_elf32_m32rlelin_vec, |
&bfd_elf32_m68hc11_vec, |
&bfd_elf32_m68hc12_vec, |
&bfd_elf32_m68k_vec, |
&bfd_elf32_m88k_vec, |
&bfd_elf32_mcore_big_vec, |
&bfd_elf32_mcore_little_vec, |
&bfd_elf32_mep_vec, |
&bfd_elf32_metag_vec, |
&bfd_elf32_microblaze_vec, |
&bfd_elf32_mn10200_vec, |
&bfd_elf32_mn10300_vec, |
&bfd_elf32_mt_vec, |
&bfd_elf32_msp430_vec, |
&bfd_elf32_msp430_ti_vec, |
#ifdef BFD64 |
&bfd_elf32_nbigmips_vec, |
&bfd_elf32_nlittlemips_vec, |
&bfd_elf32_ntradbigmips_vec, |
&bfd_elf32_ntradlittlemips_vec, |
&bfd_elf32_ntradbigmips_freebsd_vec, |
&bfd_elf32_ntradlittlemips_freebsd_vec, |
#endif |
&bfd_elf32_openrisc_vec, |
&bfd_elf32_or32_big_vec, |
&bfd_elf32_pj_vec, |
&bfd_elf32_pjl_vec, |
&bfd_elf32_powerpc_vec, |
&bfd_elf32_powerpc_vxworks_vec, |
&bfd_elf32_powerpcle_vec, |
&bfd_elf32_powerpc_freebsd_vec, |
&bfd_elf32_rl78_vec, |
&bfd_elf32_rx_be_vec, |
&bfd_elf32_rx_be_ns_vec, |
&bfd_elf32_rx_le_vec, |
&bfd_elf32_s390_vec, |
#ifdef BFD64 |
&bfd_elf32_bigscore_vec, |
&bfd_elf32_littlescore_vec, |
#endif |
&bfd_elf32_sh_vec, |
&bfd_elf32_shbfd_vec, |
&bfd_elf32_shblin_vec, |
&bfd_elf32_shfd_vec, |
&bfd_elf32_shl_vec, |
&bfd_elf32_shl_symbian_vec, |
&bfd_elf32_shlin_vec, |
&bfd_elf32_shlnbsd_vec, |
&bfd_elf32_shlvxworks_vec, |
&bfd_elf32_shnbsd_vec, |
&bfd_elf32_shvxworks_vec, |
#ifdef BFD64 |
&bfd_elf32_sh64_vec, |
&bfd_elf32_sh64l_vec, |
&bfd_elf32_sh64lnbsd_vec, |
&bfd_elf32_sh64nbsd_vec, |
&bfd_elf32_sh64lin_vec, |
&bfd_elf32_sh64blin_vec, |
#endif |
&bfd_elf32_sparc_vec, |
&bfd_elf32_sparc_sol2_vec, |
&bfd_elf32_sparc_vxworks_vec, |
&bfd_elf32_spu_vec, |
&bfd_elf32_tic6x_be_vec, |
&bfd_elf32_tic6x_le_vec, |
&bfd_elf32_tilegx_be_vec, |
&bfd_elf32_tilegx_le_vec, |
&bfd_elf32_tilepro_vec, |
#ifdef BFD64 |
&bfd_elf32_tradbigmips_vec, |
&bfd_elf32_tradlittlemips_vec, |
&bfd_elf32_tradbigmips_freebsd_vec, |
&bfd_elf32_tradlittlemips_freebsd_vec, |
#endif |
&bfd_elf32_us_cris_vec, |
&bfd_elf32_v850_vec, |
&bfd_elf32_v850_rh850_vec, |
&bfd_elf32_vax_vec, |
&bfd_elf32_xc16x_vec, |
&bfd_elf32_xgate_vec, |
&bfd_elf32_xstormy16_vec, |
&bfd_elf32_xtensa_be_vec, |
&bfd_elf32_xtensa_le_vec, |
#ifdef BFD64 |
&bfd_elf64_alpha_freebsd_vec, |
&bfd_elf64_alpha_vec, |
&bfd_elf64_big_generic_vec, |
&bfd_elf64_bigmips_vec, |
&bfd_elf64_bigaarch64_vec, |
&bfd_elf32_bigaarch64_vec, |
&bfd_elf64_hppa_linux_vec, |
&bfd_elf64_hppa_vec, |
&bfd_elf64_ia64_big_vec, |
&bfd_elf64_ia64_hpux_big_vec, |
&bfd_elf64_ia64_little_vec, |
&bfd_elf64_ia64_vms_vec, |
&bfd_elf64_little_generic_vec, |
&bfd_elf64_littlemips_vec, |
&bfd_elf64_littleaarch64_vec, |
&bfd_elf32_littleaarch64_vec, |
&bfd_elf64_mmix_vec, |
&bfd_elf64_powerpc_vec, |
&bfd_elf64_powerpcle_vec, |
&bfd_elf64_powerpc_freebsd_vec, |
&bfd_elf64_s390_vec, |
&bfd_elf64_sh64_vec, |
&bfd_elf64_sh64l_vec, |
&bfd_elf64_sh64lnbsd_vec, |
&bfd_elf64_sh64nbsd_vec, |
&bfd_elf64_sh64lin_vec, |
&bfd_elf64_sh64blin_vec, |
&bfd_elf64_sparc_vec, |
&bfd_elf64_sparc_freebsd_vec, |
&bfd_elf64_sparc_sol2_vec, |
&bfd_elf64_tilegx_be_vec, |
&bfd_elf64_tilegx_le_vec, |
&bfd_elf64_tradbigmips_vec, |
&bfd_elf64_tradlittlemips_vec, |
&bfd_elf64_tradbigmips_freebsd_vec, |
&bfd_elf64_tradlittlemips_freebsd_vec, |
&bfd_elf64_x86_64_freebsd_vec, |
&bfd_elf64_x86_64_nacl_vec, |
&bfd_elf64_x86_64_sol2_vec, |
&bfd_elf64_x86_64_vec, |
&bfd_elf32_x86_64_nacl_vec, |
&bfd_elf32_x86_64_vec, |
&bfd_elf64_l1om_freebsd_vec, |
&bfd_elf64_l1om_vec, |
&bfd_elf64_k1om_freebsd_vec, |
&bfd_elf64_k1om_vec, |
&bfd_mmo_vec, |
#endif |
&bfd_powerpc_pe_vec, |
&bfd_powerpc_pei_vec, |
&bfd_powerpcle_pe_vec, |
&bfd_powerpcle_pei_vec, |
&cris_aout_vec, |
#ifdef BFD64 |
&demo_64_vec, /* Only compiled if host has long-long support. */ |
#endif |
&ecoff_big_vec, |
&ecoff_biglittle_vec, |
&ecoff_little_vec, |
#ifdef BFD64 |
&ecoffalpha_little_vec, |
#endif |
&go32coff_vec, |
&go32stubbedcoff_vec, |
&h8300coff_vec, |
&h8500coff_vec, |
&i386_aout_fbsd_vec, |
#if 0 |
/* Since a.out files lack decent magic numbers, no way to recognize |
which kind of a.out file it is. */ |
&host_aout_vec, |
/* Clashes with sunos_big_vec magic no. */ |
&hp300bsd_vec, |
&i386_aout_linux_vec, |
#endif |
&hp300hpux_vec, |
&i386aout_vec, |
&i386bsd_vec, |
&i386coff_vec, |
&i386_aout_lynx_vec, |
#if 0 |
&i386dynix_vec, |
/* No distinguishing features for Mach 3 executables. */ |
&i386_aout_mach3_vec, |
#endif |
&i386freebsd_vec, |
&i386_aout_nbsd_vec, |
&i386_aout_os9k_vec, |
&i386_coff_vec, |
&i386_coff_go32_vec, |
&i386_coff_go32stubbed_vec, |
&i386_coff_lynx_vec, |
&i386_elf32_vec, |
&i386_elf32_fbsd_vec, |
&i386_elf32_nacl_vec, |
&i386_elf32_sol2_vec, |
&i386_elf32_vxworks_vec, |
&i386_mach_o_vec, |
&i386_msdos_vec, |
&i386_nlm32_vec, |
&i386_pe_vec, |
&i386_pei_vec, |
&iamcu_elf32_vec, |
&i860_coff_vec, |
&i860_elf32_vec, |
&i860_elf32_le_vec, |
&i960_elf32_vec, |
#ifdef BFD64 |
#if 0 |
/* Since a.out files lack decent magic numbers, no way to recognize |
which kind of a.out file it is. */ |
&i386linux_vec, |
&ia64_elf32_be_vec, |
#endif |
&i386lynx_aout_vec, |
&i386lynx_coff_vec, |
#if 0 |
/* No distinguishing features for Mach 3 executables. */ |
&i386mach3_vec, |
&ia64_elf32_hpux_be_vec, |
&ia64_elf64_be_vec, |
&ia64_elf64_le_vec, |
&ia64_elf64_hpux_be_vec, |
&ia64_elf64_vms_vec, |
&ia64_pei_vec, |
#endif |
&i386msdos_vec, |
&i386netbsd_vec, |
&i386os9k_vec, |
&i386pe_vec, |
&i386pei_vec, |
&icoff_be_vec, |
&icoff_le_vec, |
&ieee_vec, |
&ip2k_elf32_vec, |
&iq2000_elf32_vec, |
#ifdef BFD64 |
&x86_64coff_vec, |
&x86_64pe_vec, |
&x86_64pei_vec, |
&k1om_elf64_vec, |
&k1om_elf64_fbsd_vec, |
&l1om_elf64_vec, |
&l1om_elf64_fbsd_vec, |
#endif |
&i860coff_vec, |
&icoff_big_vec, |
&icoff_little_vec, |
&ieee_vec, |
&lm32_elf32_vec, |
&m32c_elf32_vec, |
&m32r_elf32_vec, |
&m32r_elf32_le_vec, |
&m32r_elf32_linux_vec, |
&m32r_elf32_linux_le_vec, |
&m68hc11_elf32_vec, |
&m68hc12_elf32_vec, |
#if 0 |
&m68k4knetbsd_vec, |
&m68kaux_coff_vec, |
&m68k_aout_4knbsd_vec, |
/* Clashes with sparc_aout_sunos_be_vec magic no. */ |
&m68k_aout_hp300bsd_vec, |
#endif |
&m68kcoff_vec, |
&m68kcoffun_vec, |
&m68k_aout_hp300hpux_vec, |
#if 0 |
/* Since a.out files lack decent magic numbers, no way to recognize |
which kind of a.out file it is. */ |
&m68klinux_vec, |
&m68k_aout_linux_vec, |
#endif |
&m68knetbsd_vec, |
&m68ksysvcoff_vec, |
&m88kbcs_vec, |
&m88kmach3_vec, |
&m88kopenbsd_vec, |
&m68k_aout_nbsd_vec, |
&m68k_aout_newsos3_vec, |
&m68k_coff_vec, |
#if 0 |
&m68k_coff_apollo_vec, |
&m68k_coff_aux_vec, |
#endif |
&m68k_coff_sysv_vec, |
&m68k_coff_un_vec, |
&m68k_elf32_vec, |
&m68k_versados_vec, |
&m88k_aout_mach3_vec, |
&m88k_aout_obsd_vec, |
&m88k_coff_bcs_vec, |
&m88k_elf32_vec, |
&mach_o_be_vec, |
&mach_o_le_vec, |
&mach_o_fat_vec, |
&mach_o_i386_vec, |
&mcore_elf32_be_vec, |
&mcore_elf32_le_vec, |
&mcore_pe_be_vec, |
&mcore_pe_le_vec, |
&mcore_pei_be_vec, |
&mcore_pei_le_vec, |
&mep_elf32_vec, |
&metag_elf32_vec, |
µblaze_elf32_vec, |
#if 0 |
/* No one seems to use this. */ |
&mips_aout_be_vec, |
#endif |
&mips_aout_le_vec, |
&mips_ecoff_be_vec, |
&mips_ecoff_le_vec, |
&mips_ecoff_bele_vec, |
#ifdef BFD64 |
&mach_o_x86_64_vec, |
&mips_elf32_be_vec, |
&mips_elf32_le_vec, |
&mips_elf32_n_be_vec, |
&mips_elf32_n_le_vec, |
&mips_elf32_ntrad_be_vec, |
&mips_elf32_ntrad_le_vec, |
&mips_elf32_ntradfbsd_be_vec, |
&mips_elf32_ntradfbsd_le_vec, |
&mips_elf32_trad_be_vec, |
&mips_elf32_trad_le_vec, |
&mips_elf32_tradfbsd_be_vec, |
&mips_elf32_tradfbsd_le_vec, |
&mips_elf32_vxworks_be_vec, |
&mips_elf32_vxworks_le_vec, |
&mips_elf64_be_vec, |
&mips_elf64_le_vec, |
&mips_elf64_trad_be_vec, |
&mips_elf64_trad_le_vec, |
&mips_elf64_tradfbsd_be_vec, |
&mips_elf64_tradfbsd_le_vec, |
#endif |
&mcore_pe_big_vec, |
&mcore_pe_little_vec, |
&mcore_pei_big_vec, |
&mcore_pei_little_vec, |
&mipslpe_vec, |
&mipslpei_vec, |
&newsos3_vec, |
&mips_pe_le_vec, |
&mips_pei_le_vec, |
#ifdef BFD64 |
&nlm32_alpha_vec, |
&mmix_elf64_vec, |
&mmix_mmo_vec, |
#endif |
&nlm32_i386_vec, |
&nlm32_powerpc_vec, |
&nlm32_sparc_vec, |
&mn10200_elf32_vec, |
&mn10300_elf32_vec, |
&moxie_elf32_be_vec, |
&moxie_elf32_le_vec, |
&msp430_elf32_vec, |
&msp430_elf32_ti_vec, |
&mt_elf32_vec, |
&nds32_elf32_be_vec, |
&nds32_elf32_le_vec, |
&nds32_elf32_linux_be_vec, |
&nds32_elf32_linux_le_vec, |
&nios2_elf32_be_vec, |
&nios2_elf32_le_vec, |
&ns32k_aout_pc532mach_vec, |
&ns32k_aout_pc532nbsd_vec, |
#if 0 |
/* We have no oasys tools anymore, so we can't test any of this |
anymore. If you want to test the stuff yourself, go ahead... |
1272,45 → 1260,116 |
can be annoying target mis-matches. */ |
&oasys_vec, |
#endif |
/* Entry for the OpenRISC family. */ |
&or32coff_big_vec, |
&pc532machaout_vec, |
&pc532netbsd_vec, |
&or1k_elf32_vec, |
&pdp11_aout_vec, |
&pef_vec, |
&pef_xlib_vec, |
&pj_elf32_vec, |
&pj_elf32_le_vec, |
#if BFD_SUPPORTS_PLUGINS |
&plugin_vec, |
#endif |
&powerpc_boot_vec, |
&powerpc_elf32_vec, |
&powerpc_elf32_le_vec, |
&powerpc_elf32_fbsd_vec, |
&powerpc_elf32_vxworks_vec, |
#ifdef BFD64 |
&powerpc_elf64_vec, |
&powerpc_elf64_le_vec, |
&powerpc_elf64_fbsd_vec, |
#endif |
&powerpc_nlm32_vec, |
&powerpc_pe_vec, |
&powerpc_pe_le_vec, |
&powerpc_pei_vec, |
&powerpc_pei_le_vec, |
#if 0 |
/* This has the same magic number as RS/6000. */ |
&pmac_xcoff_vec, |
&powerpc_xcoff_vec, |
#endif |
&ppcboot_vec, |
#if 0 |
/* We have no way of distinguishing these from other a.out variants. */ |
&riscix_vec, |
&rl78_elf32_vec, |
#ifdef BFD64 |
&rs6000_xcoff64_vec, |
&rs6000_xcoff64_aix_vec, |
#endif |
&rs6000_xcoff_vec, |
&rx_elf32_be_vec, |
&rx_elf32_be_ns_vec, |
&rx_elf32_le_vec, |
&s390_elf32_vec, |
#ifdef BFD64 |
&rs6000coff64_vec, |
&s390_elf64_vec, |
#endif |
&rs6000coff_vec, |
&shcoff_small_vec, |
&shcoff_vec, |
&shlcoff_small_vec, |
&shlcoff_vec, |
&shlpe_vec, |
&shlpei_vec, |
&som_vec, |
&sparccoff_vec, |
&sparcle_aout_vec, |
&sparclinux_vec, |
&sparclynx_aout_vec, |
&sparclynx_coff_vec, |
&sparcnetbsd_vec, |
&sunos_big_vec, |
#ifdef BFD64 |
&score_elf32_be_vec, |
&score_elf32_le_vec, |
#endif |
#ifdef BFD64 |
&sh64_elf32_vec, |
&sh64_elf32_le_vec, |
&sh64_elf32_linux_vec, |
&sh64_elf32_linux_be_vec, |
&sh64_elf32_nbsd_vec, |
&sh64_elf32_nbsd_le_vec, |
&sh64_elf64_vec, |
&sh64_elf64_le_vec, |
&sh64_elf64_linux_vec, |
&sh64_elf64_linux_be_vec, |
&sh64_elf64_nbsd_vec, |
&sh64_elf64_nbsd_le_vec, |
#endif |
&sh_coff_vec, |
&sh_coff_le_vec, |
&sh_coff_small_vec, |
&sh_coff_small_le_vec, |
&sh_elf32_vec, |
&sh_elf32_le_vec, |
&sh_elf32_fdpic_be_vec, |
&sh_elf32_fdpic_le_vec, |
&sh_elf32_linux_vec, |
&sh_elf32_linux_be_vec, |
&sh_elf32_nbsd_vec, |
&sh_elf32_nbsd_le_vec, |
&sh_elf32_symbian_le_vec, |
&sh_elf32_vxworks_vec, |
&sh_elf32_vxworks_le_vec, |
&sh_pe_le_vec, |
&sh_pei_le_vec, |
&sparc_aout_le_vec, |
&sparc_aout_linux_vec, |
&sparc_aout_lynx_vec, |
&sparc_aout_nbsd_vec, |
&sparc_aout_sunos_be_vec, |
&sparc_coff_vec, |
&sparc_coff_lynx_vec, |
&sparc_elf32_vec, |
&sparc_elf32_sol2_vec, |
&sparc_elf32_vxworks_vec, |
#ifdef BFD64 |
&sparc_elf64_vec, |
&sparc_elf64_fbsd_vec, |
&sparc_elf64_sol2_vec, |
#endif |
&sparc_nlm32_vec, |
&spu_elf32_vec, |
&sym_vec, |
&tic30_aout_vec, |
&tic30_coff_vec, |
&tic54x_coff0_beh_vec, |
1319,20 → 1378,61 |
&tic54x_coff1_vec, |
&tic54x_coff2_beh_vec, |
&tic54x_coff2_vec, |
&tic80coff_vec, |
&vaxbsd_vec, |
&vaxnetbsd_vec, |
&vax1knetbsd_vec, |
&versados_vec, |
&tic6x_elf32_be_vec, |
&tic6x_elf32_le_vec, |
&tic80_coff_vec, |
&tilegx_elf32_be_vec, |
&tilegx_elf32_le_vec, |
#ifdef BFD64 |
&vms_alpha_vec, |
&tilegx_elf64_be_vec, |
&tilegx_elf64_le_vec, |
#endif |
&vms_lib_txt_vec, |
&w65_vec, |
&we32kcoff_vec, |
&z80coff_vec, |
&z8kcoff_vec, |
&bfd_elf32_am33lin_vec, |
&tilepro_elf32_vec, |
&ft32_elf32_vec, |
&v800_elf32_vec, |
&v850_elf32_vec, |
&vax_aout_1knbsd_vec, |
&vax_aout_bsd_vec, |
&vax_aout_nbsd_vec, |
&vax_elf32_vec, |
&visium_elf32_vec, |
&w65_coff_vec, |
&we32k_coff_vec, |
#ifdef BFD64 |
&x86_64_coff_vec, |
&x86_64_elf32_vec, |
&x86_64_elf32_nacl_vec, |
&x86_64_elf64_vec, |
&x86_64_elf64_cloudabi_vec, |
&x86_64_elf64_fbsd_vec, |
&x86_64_elf64_nacl_vec, |
&x86_64_elf64_sol2_vec, |
&x86_64_mach_o_vec, |
&x86_64_pe_vec, |
&x86_64_pe_be_vec, |
&x86_64_pei_vec, |
#endif |
&xc16x_elf32_vec, |
&xgate_elf32_vec, |
&xstormy16_elf32_vec, |
&xtensa_elf32_be_vec, |
&xtensa_elf32_le_vec, |
&z80_coff_vec, |
&z8k_coff_vec, |
#endif /* not SELECT_VECS */ |
/* Always support S-records, for convenience. */ |
1350,38 → 1450,38 |
/* Add any required traditional-core-file-handler. */ |
#ifdef AIX386_CORE |
&aix386_core_vec, |
&core_aix386_vec, |
#endif |
#if 0 |
/* We don't include cisco_core_*_vec. Although it has a magic number, |
the magic number isn't at the beginning of the file, and thus |
might spuriously match other kinds of files. */ |
&cisco_core_big_vec, |
&cisco_core_little_vec, |
&core_cisco_be_vec, |
&core_cisco_le_vec, |
#endif |
#ifdef HPPABSD_CORE |
&hppabsd_core_vec, |
&core_hppabsd_vec, |
#endif |
#ifdef HPUX_CORE |
&hpux_core_vec, |
&core_hpux_vec, |
#endif |
#ifdef IRIX_CORE |
&irix_core_vec, |
&core_irix_vec, |
#endif |
#ifdef NETBSD_CORE |
&netbsd_core_vec, |
&core_netbsd_vec, |
#endif |
#ifdef OSF_CORE |
&osf_core_vec, |
&core_osf_vec, |
#endif |
#ifdef PTRACE_CORE |
&ptrace_core_vec, |
&core_ptrace_vec, |
#endif |
#ifdef SCO5_CORE |
&sco5_core_vec, |
&core_sco5_vec, |
#endif |
#ifdef TRAD_CORE |
&trad_core_vec, |
&core_trad_vec, |
#endif |
NULL /* end of list marker */ |
1734,3 → 1834,50 |
return NULL; |
} |
/* |
FUNCTION |
bfd_flavour_name |
SYNOPSIS |
const char *bfd_flavour_name (enum bfd_flavour flavour); |
DESCRIPTION |
Return the string form of @var{flavour}. |
*/ |
const char * |
bfd_flavour_name (enum bfd_flavour flavour) |
{ |
switch (flavour) |
{ |
case bfd_target_unknown_flavour: return "unknown file format"; |
case bfd_target_aout_flavour: return "a.out"; |
case bfd_target_coff_flavour: return "COFF"; |
case bfd_target_ecoff_flavour: return "ECOFF"; |
case bfd_target_xcoff_flavour: return "XCOFF"; |
case bfd_target_elf_flavour: return "ELF"; |
case bfd_target_ieee_flavour: return "IEEE"; |
case bfd_target_nlm_flavour: return "NLM"; |
case bfd_target_oasys_flavour: return "Oasys"; |
case bfd_target_tekhex_flavour: return "Tekhex"; |
case bfd_target_srec_flavour: return "Srec"; |
case bfd_target_verilog_flavour: return "Verilog"; |
case bfd_target_ihex_flavour: return "Ihex"; |
case bfd_target_som_flavour: return "SOM"; |
case bfd_target_os9k_flavour: return "OS9K"; |
case bfd_target_versados_flavour: return "Versados"; |
case bfd_target_msdos_flavour: return "MSDOS"; |
case bfd_target_ovax_flavour: return "Ovax"; |
case bfd_target_evax_flavour: return "Evax"; |
case bfd_target_mmo_flavour: return "mmo"; |
case bfd_target_mach_o_flavour: return "MACH_O"; |
case bfd_target_pef_flavour: return "PEF"; |
case bfd_target_pef_xlib_flavour: return "PEF_XLIB"; |
case bfd_target_sym_flavour: return "SYM"; |
/* There is no "default" case here so that -Wswitch (part of -Wall) |
catches missing entries. */ |
} |
abort (); |
} |
/contrib/toolchain/binutils/bfd/targmatch.h |
---|
1,44 → 1,62 |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_littleaarch64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_aarch64_elf64_le_vec) |
{ "aarch64-*-elf", |
&bfd_elf64_littleaarch64_vec }, |
&aarch64_elf64_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_bigaarch64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_aarch64_elf64_be_vec) |
{ "aarch64_be-*-elf", |
&bfd_elf64_bigaarch64_vec }, |
&aarch64_elf64_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_littleaarch64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_aarch64_elf64_le_vec) |
{ "aarch64-*-freebsd*", |
&aarch64_elf64_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_aarch64_elf64_le_cloudabi_vec) |
{ "aarch64-*-cloudabi*", |
&aarch64_elf64_le_cloudabi_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_aarch64_elf64_le_vec) |
{ "aarch64-*-linux*", |
&bfd_elf64_littleaarch64_vec }, |
&aarch64_elf64_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_bigaarch64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_aarch64_elf64_be_vec) |
{ "aarch64_be-*-linux*", |
&bfd_elf64_bigaarch64_vec }, |
&aarch64_elf64_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_alpha_freebsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_alpha_elf64_fbsd_vec) |
{ "alpha*-*-freebsd*", NULL },{ "alpha*-*-kfreebsd*-gnu", |
&bfd_elf64_alpha_freebsd_vec }, |
&alpha_elf64_fbsd_vec }, |
#endif |
45,98 → 63,98 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_alpha_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_alpha_elf64_vec) |
{ "alpha*-*-netbsd*", NULL },{ "alpha*-*-openbsd*", |
&bfd_elf64_alpha_vec }, |
&alpha_elf64_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_ecoffalpha_little_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_alpha_ecoff_le_vec) |
{ "alpha*-*-netware*", |
&ecoffalpha_little_vec }, |
&alpha_ecoff_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_ecoffalpha_little_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_alpha_ecoff_le_vec) |
{ "alpha*-*-linux*ecoff*", |
&ecoffalpha_little_vec }, |
&alpha_ecoff_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_alpha_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_alpha_elf64_vec) |
{ "alpha*-*-linux-*", NULL },{ "alpha*-*-elf*", |
&bfd_elf64_alpha_vec }, |
&alpha_elf64_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_vms_alpha_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_alpha_vms_vec) |
{ "alpha*-*-*vms*", |
&vms_alpha_vec }, |
&alpha_vms_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_ecoffalpha_little_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_alpha_ecoff_le_vec) |
{ "alpha*-*-*", |
&ecoffalpha_little_vec }, |
&alpha_ecoff_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_ia64_little_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_ia64_elf64_le_vec) |
{ "ia64*-*-freebsd*", NULL },{ "ia64*-*-netbsd*", NULL },{ "ia64*-*-linux-*", NULL },{ "ia64*-*-elf*", NULL },{ "ia64*-*-kfreebsd*-gnu", |
&bfd_elf64_ia64_little_vec }, |
&ia64_elf64_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_ia64_hpux_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_ia64_elf32_hpux_be_vec) |
{ "ia64*-*-hpux*", |
&bfd_elf32_ia64_hpux_big_vec }, |
&ia64_elf32_hpux_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_ia64_vms_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_ia64_elf64_vms_vec) |
{ "ia64*-*-*vms*", |
&bfd_elf64_ia64_vms_vec }, |
&ia64_elf64_vms_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_sparc_freebsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf64_fbsd_vec) |
{ "sparc64-*-freebsd*", NULL },{ "sparc64-*-kfreebsd*-gnu", |
&bfd_elf64_sparc_freebsd_vec }, |
&sparc_elf64_fbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_sparc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf64_vec) |
{ "sparc64-*-netbsd*", NULL },{ "sparc64-*-openbsd*", |
&bfd_elf64_sparc_vec }, |
&sparc_elf64_vec }, |
#endif |
144,27 → 162,27 |
#endif /* BFD64 */ |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_am33lin_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_am33_elf32_linux_vec) |
{ "am34-*-linux*", NULL },{ "am33_2.0-*-linux*", |
&bfd_elf32_am33lin_vec }, |
&am33_elf32_linux_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlearc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arc_elf32_le_vec) |
{ "arc-*-elf*", |
&bfd_elf32_littlearc_vec }, |
{ "arc*-*-elf*", NULL },{ "arc*-*-linux-uclibc*", |
&arc_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlearm_nacl_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_nacl_le_vec) |
{ "arm-*-nacl*", |
&bfd_elf32_littlearm_nacl_vec }, |
&arm_elf32_nacl_le_vec }, |
#endif |
171,10 → 189,10 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_bigarm_nacl_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_nacl_be_vec) |
{ "armeb-*-nacl*", |
&bfd_elf32_bigarm_nacl_vec }, |
&arm_elf32_nacl_be_vec }, |
#endif |
181,51 → 199,51 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_bigarm_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_be_vec) |
{ "armeb-*-netbsdelf*", |
&bfd_elf32_bigarm_vec }, |
&arm_elf32_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlearm_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_le_vec) |
{ "arm-*-netbsdelf*", |
&bfd_elf32_littlearm_vec }, |
&arm_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_armnetbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_aout_nbsd_vec) |
{ "arm-*-netbsd*", NULL },{ "arm-*-openbsd*", |
&armnetbsd_vec }, |
&arm_aout_nbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_le_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlearm_vec) |
{ "arm-*-nto*", NULL },{ "nto*arm*", |
&bfd_elf32_littlearm_vec }, |
&arm_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_riscix_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_aout_riscix_vec) |
{ "arm-*-riscix*", |
&riscix_vec }, |
&arm_aout_riscix_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_arm_epoc_pe_little_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_pe_epoc_le_vec) |
{ "arm-epoc-pe*", |
&arm_epoc_pe_little_vec }, |
&arm_pe_epoc_le_vec }, |
#endif |
232,10 → 250,10 |
#if !defined (SELECT_VECS) || defined (HAVE_arm_wince_pe_little_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_pe_wince_le_vec) |
{ "arm-wince-pe", NULL },{ "arm-*-wince", NULL },{ "arm*-*-mingw32ce*", NULL },{ "arm*-*-cegcc*", |
&arm_wince_pe_little_vec }, |
&arm_pe_wince_le_vec }, |
#endif |
242,111 → 260,111 |
#if !defined (SELECT_VECS) || defined (HAVE_armpe_little_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_pe_le_vec) |
{ "arm-*-pe*", |
&armpe_little_vec }, |
&arm_pe_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_aout_arm_little_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_aout_le_vec) |
{ "arm-*-aout", NULL },{ "armel-*-aout", |
&aout_arm_little_vec }, |
&arm_aout_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_aout_arm_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_aout_be_vec) |
{ "armeb-*-aout", |
&aout_arm_big_vec }, |
&arm_aout_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_armcoff_little_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_coff_le_vec) |
{ "arm-*-coff", |
&armcoff_little_vec }, |
&arm_coff_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlearm_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_le_vec) |
{ "arm-*-rtems*", |
&bfd_elf32_littlearm_vec }, |
&arm_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_bigarm_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_be_vec) |
{ "armeb-*-elf", NULL },{ "arm*b-*-linux-*", |
&bfd_elf32_bigarm_vec }, |
{ "armeb-*-elf", NULL },{ "arm*b-*-freebsd*", NULL },{ "arm*b-*-linux-*", NULL },{ "armeb-*-eabi*", |
&arm_elf32_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlearm_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_le_vec) |
{ "arm-*-kaos*", |
&bfd_elf32_littlearm_vec }, |
&arm_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlearm_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_le_vec) |
{ "arm-*-elf", NULL },{ "arm-*-freebsd*", NULL },{ "arm*-*-linux-*", NULL },{ "arm*-*-conix*", NULL }, |
{ "arm-*-elf", NULL },{ "arm*-*-freebsd*", NULL },{ "arm*-*-linux-*", NULL },{ "arm*-*-conix*", NULL }, |
{ "arm*-*-uclinux*", NULL },{ "arm-*-kfreebsd*-gnu", NULL }, |
{ "arm*-*-eabi*", |
&bfd_elf32_littlearm_vec }, |
&arm_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlearm_vxworks_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_vxworks_le_vec) |
{ "arm*-*-vxworks", NULL },{ "arm*-*-windiss", |
&bfd_elf32_littlearm_vxworks_vec }, |
&arm_elf32_vxworks_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlearm_symbian_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_symbian_le_vec) |
{ "arm*-*-symbianelf*", |
&bfd_elf32_littlearm_symbian_vec }, |
&arm_elf32_symbian_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlearm_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_arm_elf32_le_vec) |
{ "arm9e-*-elf", |
&bfd_elf32_littlearm_vec }, |
&arm_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_avr_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_avr_elf32_vec) |
{ "avr-*-*", |
&bfd_elf32_avr_vec }, |
&avr_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_bfin_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_bfin_elf32_vec) |
{ "bfin-*-*", |
&bfd_elf32_bfin_vec }, |
&bfin_elf32_vec }, |
#endif |
388,19 → 406,19 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_cr16_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_cr16_elf32_vec) |
{ "cr16-*-elf*", NULL },{ "cr16*-*-uclinux*", |
&bfd_elf32_cr16_vec }, |
&cr16_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_cr16c_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_cr16c_elf32_vec) |
{ "cr16c-*-elf*", |
&bfd_elf32_cr16c_vec }, |
&cr16c_elf32_vec }, |
#endif |
416,123 → 434,139 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_crx_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_crx_elf32_vec) |
{ "crx-*-elf*", |
&bfd_elf32_crx_vec }, |
&crx_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_d10v_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_d10v_elf32_vec) |
{ "d10v-*-*", |
&bfd_elf32_d10v_vec }, |
&d10v_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_dlx_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_dlx_elf32_be_vec) |
{ "dlx-*-elf*", |
&bfd_elf32_dlx_big_vec }, |
&dlx_elf32_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_d30v_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_d30v_elf32_vec) |
{ "d30v-*-*", |
&bfd_elf32_d30v_vec }, |
&d30v_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_epiphany_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_epiphany_elf32_vec) |
{ "epiphany-*-elf", |
&bfd_elf32_epiphany_vec }, |
&epiphany_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m68k_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_elf32_vec) |
{ "fido-*-elf*", |
&bfd_elf32_m68k_vec }, |
&m68k_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_fr30_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_fr30_elf32_vec) |
{ "fr30-*-elf", |
&bfd_elf32_fr30_vec }, |
&fr30_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_frv_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_frv_elf32_vec) |
{ "frv-*-elf", |
&bfd_elf32_frv_vec }, |
&frv_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_frvfdpic_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_frv_elf32_fdpic_vec) |
{ "frv-*-*linux*", |
&bfd_elf32_frvfdpic_vec }, |
&frv_elf32_fdpic_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_bigmoxie_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_moxie_elf32_be_vec) |
{ "moxie-*-elf", NULL },{ "moxie-*-rtems*", NULL },{ "moxie-*-uclinux", |
&bfd_elf32_bigmoxie_vec }, |
&moxie_elf32_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_h8300coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_moxie_elf32_le_vec) |
{ "moxie-*-moxiebox*", |
&moxie_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_h8300_coff_vec) |
{ "h8300*-*-rtemscoff*", |
&h8300coff_vec }, |
&h8300_coff_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_h8300_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_h8300_elf32_vec) |
{ "h8300*-*-elf", NULL },{ "h8300*-*-rtems*", |
&bfd_elf32_h8300_vec }, |
&h8300_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_h8300coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_h8300_elf32_linux_vec) |
{ "h8300*-*-linux*", |
&h8300_elf32_linux_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_h8300_coff_vec) |
{ "h8300*-*-*", |
&h8300coff_vec }, |
&h8300_coff_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_h8500coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_h8500_coff_vec) |
{ "h8500-*-*", |
&h8500coff_vec }, |
&h8500_coff_vec }, |
#endif |
539,19 → 573,19 |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_hppa_linux_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_hppa_elf64_linux_vec) |
{ "hppa*64*-*-linux-*", |
&bfd_elf64_hppa_linux_vec }, |
&hppa_elf64_linux_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_hppa_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_hppa_elf64_vec) |
{ "hppa*64*-*-hpux11*", |
&bfd_elf64_hppa_vec }, |
&hppa_elf64_vec }, |
#endif |
560,85 → 594,85 |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_hppa_linux_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_hppa_elf32_linux_vec) |
{ "hppa*-*-linux-*", |
&bfd_elf32_hppa_linux_vec }, |
&hppa_elf32_linux_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_hppa_nbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_hppa_elf32_nbsd_vec) |
{ "hppa*-*-netbsd*", |
&bfd_elf32_hppa_nbsd_vec }, |
&hppa_elf32_nbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_hppa_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_hppa_elf32_vec) |
{ "hppa*-*-*elf*", NULL },{ "hppa*-*-lites*", NULL },{ "hppa*-*-sysv4*", NULL },{ "hppa*-*-openbsd*", |
&bfd_elf32_hppa_vec }, |
&hppa_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_som_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_hppa_som_vec) |
{ "hppa*-*-bsd*", |
&som_vec }, |
&hppa_som_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_som_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_hppa_som_vec) |
{ "hppa*-*-hpux*", NULL },{ "hppa*-*-hiux*", NULL },{ "hppa*-*-mpeix*", |
&som_vec }, |
&hppa_som_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_som_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_hppa_som_vec) |
{ "hppa*-*-osf*", |
&som_vec }, |
&hppa_som_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i370_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i370_elf32_vec) |
{ "i370-*-*", |
&bfd_elf32_i370_vec }, |
&i370_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_coff_vec) |
{ "i[3-7]86-*-sco3.2v5*coff", |
&i386coff_vec }, |
&i386_coff_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-sysv4*", NULL },{ "i[3-7]86-*-unixware*", NULL }, |
{ "i[3-7]86-*-elf", NULL },{ "i[3-7]86-*-sco3.2v5*", NULL }, |
{ "i[3-7]86-*-elf*", NULL },{ "i[3-7]86-*-sco3.2v5*", NULL }, |
{ "i[3-7]86-*-dgux*", NULL },{ "i[3-7]86-*-sysv5*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_sol2_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_sol2_vec) |
{ "i[3-7]86-*-solaris2*", |
&bfd_elf32_i386_sol2_vec }, |
&i386_elf32_sol2_vec }, |
#endif |
646,10 → 680,10 |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_sol2_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_sol2_vec) |
{ "x86_64-*-solaris2*", |
&bfd_elf32_i386_sol2_vec }, |
&i386_elf32_sol2_vec }, |
#endif |
656,72 → 690,75 |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-kaos*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-nto*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-aros*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-chorus*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-dicos*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_go32coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_coff_go32_vec) |
{ "*-*-msdosdjgpp*", NULL },{ "*-*-go32*", |
&go32coff_vec }, |
&i386_coff_go32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_coff_vec) |
{ "i[3-7]86-*-sysv*", NULL },{ "i[3-7]86-*-isc*", NULL },{ "i[3-7]86-*-sco*", NULL },{ "i[3-7]86-*-coff", NULL }, |
{ "i[3-7]86-*-aix*", |
&i386coff_vec }, |
&i386_coff_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-rtems*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_mach_o_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_mach_o_vec) |
{ "i[3-7]86-*-darwin*", NULL },{ "i[3-7]86-*-macos10*", NULL },{ "i[3-7]86-*-rhapsody*", |
&mach_o_i386_vec }, |
&i386_mach_o_vec }, |
#endif |
728,44 → 765,45 |
#if !defined (SELECT_VECS) || defined (HAVE_i386dynix_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_aout_dynix_vec) |
{ "i[3-7]86-sequent-bsd*", |
&i386dynix_vec }, |
&i386_aout_dynix_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386bsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_aout_bsd_vec) |
{ "i[3-7]86-*-bsd*", |
&i386bsd_vec }, |
&i386_aout_bsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-dragonfly*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386freebsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_aout_fbsd_vec) |
{ "i[3-7]86-*-freebsdaout*", NULL },{ "i[3-7]86-*-freebsd[12].*", NULL }, |
{ "i[3-7]86-*-freebsd[12]", |
&i386freebsd_vec }, |
&i386_aout_fbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_freebsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_fbsd_vec) |
{ "i[3-7]86-*-freebsd*", NULL },{ "i[3-7]86-*-kfreebsd*-gnu", |
&bfd_elf32_i386_freebsd_vec }, |
&i386_elf32_fbsd_vec }, |
#endif |
772,71 → 810,71 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-netbsdelf*", NULL },{ "i[3-7]86-*-netbsd*-gnu*", NULL },{ "i[3-7]86-*-knetbsd*-gnu", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386pe_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_pe_vec) |
{ "i[3-7]86-*-netbsdpe*", |
&i386pe_vec }, |
&i386_pe_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386netbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_aout_nbsd_vec) |
{ "i[3-7]86-*-netbsdaout*", NULL },{ "i[3-7]86-*-netbsd*", NULL }, |
{ "i[3-7]86-*-openbsd[0-2].*", NULL },{ "i[3-7]86-*-openbsd3.[0-3]", |
&i386netbsd_vec }, |
&i386_aout_nbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-openbsd*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-netware*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386linux_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_aout_linux_vec) |
{ "i[3-7]86-*-linux*aout*", |
&i386linux_vec }, |
&i386_aout_linux_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-linux-*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_nacl_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_nacl_vec) |
{ "i[3-7]86-*-nacl*", |
&bfd_elf32_i386_nacl_vec }, |
&i386_elf32_nacl_vec }, |
#endif |
844,10 → 882,18 |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_mach_o_x86_64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_x86_64_elf64_cloudabi_vec) |
{ "x86_64-*-cloudabi*", |
&x86_64_elf64_cloudabi_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_x86_64_mach_o_vec) |
{ "x86_64-*-darwin*", |
&mach_o_x86_64_vec }, |
&x86_64_mach_o_vec }, |
#endif |
854,64 → 900,64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_x86_64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_x86_64_elf64_vec) |
{ "x86_64-*-dicos*", |
&bfd_elf64_x86_64_vec }, |
&x86_64_elf64_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_x86_64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_x86_64_elf64_vec) |
{ "x86_64-*-elf*", |
&bfd_elf64_x86_64_vec }, |
&x86_64_elf64_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_x86_64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_x86_64_elf64_vec) |
{ "x86_64-*-dragonfly*", |
&bfd_elf64_x86_64_vec }, |
&x86_64_elf64_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_x86_64_freebsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_x86_64_elf64_fbsd_vec) |
{ "x86_64-*-freebsd*", NULL },{ "x86_64-*-kfreebsd*-gnu", |
&bfd_elf64_x86_64_freebsd_vec }, |
&x86_64_elf64_fbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_x86_64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_x86_64_elf64_vec) |
{ "x86_64-*-netbsd*", NULL },{ "x86_64-*-openbsd*", |
&bfd_elf64_x86_64_vec }, |
&x86_64_elf64_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_x86_64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_x86_64_elf64_vec) |
{ "x86_64-*-linux-*", |
&bfd_elf64_x86_64_vec }, |
&x86_64_elf64_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_x86_64_nacl_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_x86_64_elf32_nacl_vec) |
{ "x86_64-*-nacl*", |
&bfd_elf32_x86_64_nacl_vec }, |
&x86_64_elf32_nacl_vec }, |
#endif |
918,10 → 964,10 |
#if !defined (SELECT_VECS) || defined (HAVE_x86_64pe_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_x86_64_pe_vec) |
{ "x86_64-*-mingw*", NULL },{ "x86_64-*-pe", NULL },{ "x86_64-*-pep", NULL },{ "x86_64-*-cygwin", |
&x86_64pe_vec }, |
&x86_64_pe_vec }, |
#endif |
928,82 → 974,83 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_x86_64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_x86_64_elf64_vec) |
{ "x86_64-*-rdos*", |
&bfd_elf64_x86_64_vec }, |
&x86_64_elf64_vec }, |
#endif |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-lynxos*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-gnu*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386mach3_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_aout_mach3_vec) |
{ "i[3-7]86-*-mach*", NULL },{ "i[3-7]86-*-osf1mk*", |
&i386mach3_vec }, |
&i386_aout_mach3_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386os9k_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_aout_os9k_vec) |
{ "i[3-7]86-*-os9k", |
&i386os9k_vec }, |
&i386_aout_os9k_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386aout_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_aout_vec) |
{ "i[3-7]86-*-msdos*", |
&i386aout_vec }, |
&i386_aout_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-moss*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386pe_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_pe_vec) |
{ "i[3-7]86-*-beospe*", |
&i386pe_vec }, |
&i386_pe_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-beoself*", NULL },{ "i[3-7]86-*-beos*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386pei_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_pei_vec) |
{ "i[3-7]86-*-interix*", |
&i386pei_vec }, |
&i386_pei_vec }, |
#endif |
1010,223 → 1057,223 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-rdos*", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386pe_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_pe_vec) |
{ "i[3-7]86-*-mingw32*", NULL },{ "i[3-7]86-*-cygwin*", NULL },{ "i[3-7]86-*-winnt", NULL },{ "i[3-7]86-*-pe", |
&i386pe_vec }, |
&i386_pe_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_coff_vec) |
{ "i[3-7]86-none-*", |
&i386coff_vec }, |
&i386_coff_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i386aout_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_aout_vec) |
{ "i[3-7]86-*-aout*", NULL },{ "i[3-7]86*-*-vsta*", |
&i386aout_vec }, |
&i386_aout_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vxworks_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vxworks_vec) |
{ "i[3-7]86-*-vxworks*", |
&bfd_elf32_i386_vxworks_vec }, |
&i386_elf32_vxworks_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i386_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i386_elf32_vec) |
{ "i[3-7]86-*-chaos", |
&bfd_elf32_i386_vec }, |
&i386_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_i860coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i860_coff_vec) |
{ "i860-*-mach3*", NULL },{ "i860-*-osf1*", NULL },{ "i860-*-coff*", |
&i860coff_vec }, |
&i860_coff_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i860_little_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i860_elf32_le_vec) |
{ "i860-stardent-sysv4*", NULL },{ "i860-stardent-elf*", |
&bfd_elf32_i860_little_vec }, |
&i860_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i860_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i860_elf32_vec) |
{ "i860-*-sysv4*", NULL },{ "i860-*-elf*", |
&bfd_elf32_i860_vec }, |
&i860_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_b_out_vec_little_host) |
#if !defined (SELECT_VECS) || defined (HAVE_bout_le_vec) |
{ "i960-*-vxworks4*", NULL },{ "i960-*-vxworks5.0", |
&b_out_vec_little_host }, |
&bout_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_icoff_little_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_icoff_le_vec) |
{ "i960-*-vxworks5.*", NULL },{ "i960-*-coff*", NULL },{ "i960-*-sysv*", |
&icoff_little_vec }, |
&icoff_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_b_out_vec_little_host) |
#if !defined (SELECT_VECS) || defined (HAVE_bout_le_vec) |
{ "i960-*-vxworks*", NULL },{ "i960-*-aout*", NULL },{ "i960-*-bout*", NULL },{ "i960-*-nindy*", |
&b_out_vec_little_host }, |
&bout_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_i960_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_i960_elf32_vec) |
{ "i960-*-elf*", |
&bfd_elf32_i960_vec }, |
&i960_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_ip2k_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_ip2k_elf32_vec) |
{ "ip2k-*-elf", |
&bfd_elf32_ip2k_vec }, |
&ip2k_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_iq2000_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_iq2000_elf32_vec) |
{ "iq2000-*-elf", |
&bfd_elf32_iq2000_vec }, |
&iq2000_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_lm32_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_lm32_elf32_vec) |
{ "lm32-*-elf", NULL },{ "lm32-*-rtems*", |
&bfd_elf32_lm32_vec }, |
&lm32_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_lm32fdpic_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_lm32_elf32_fdpic_vec) |
{ "lm32-*-*linux*", |
&bfd_elf32_lm32fdpic_vec }, |
&lm32_elf32_fdpic_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m32c_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m32c_elf32_vec) |
{ "m32c-*-elf", NULL },{ "m32c-*-rtems*", |
&bfd_elf32_m32c_vec }, |
&m32c_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m32rlelin_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m32r_elf32_linux_le_vec) |
{ "m32r*le-*-linux*", |
&bfd_elf32_m32rlelin_vec }, |
&m32r_elf32_linux_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m32rlin_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m32r_elf32_linux_vec) |
{ "m32r*-*-linux*", |
&bfd_elf32_m32rlin_vec }, |
&m32r_elf32_linux_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m32rle_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m32r_elf32_le_vec) |
{ "m32r*le-*-*", |
&bfd_elf32_m32rle_vec }, |
&m32r_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m32r_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m32r_elf32_vec) |
{ "m32r-*-*", |
&bfd_elf32_m32r_vec }, |
&m32r_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m68hc11_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68hc11_elf32_vec) |
{ "m68hc11-*-*", NULL },{ "m6811-*-*", |
&bfd_elf32_m68hc11_vec }, |
&m68hc11_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m68hc12_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68hc12_elf32_vec) |
{ "m68hc12-*-*", NULL },{ "m6812-*-*", |
&bfd_elf32_m68hc12_vec }, |
&m68hc12_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_m68ksysvcoff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_coff_sysv_vec) |
{ "m68*-motorola-sysv*", |
&m68ksysvcoff_vec }, |
&m68k_coff_sysv_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_hp300bsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_aout_hp300bsd_vec) |
{ "m68*-hp-bsd*", |
&hp300bsd_vec }, |
&m68k_aout_hp300bsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_aout0_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_aout0_be_vec) |
{ "m68*-*-aout*", |
&aout0_big_vec }, |
&aout0_be_vec }, |
#endif |
1235,129 → 1282,129 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m68k_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_elf32_vec) |
{ "m68*-*-elf*", NULL },{ "m68*-*-sysv4*", NULL },{ "m68*-*-uclinux*", |
&bfd_elf32_m68k_vec }, |
&m68k_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m68k_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_elf32_vec) |
{ "m68*-*-rtems*", |
&bfd_elf32_m68k_vec }, |
&m68k_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_m68kcoff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_coff_vec) |
{ "m68*-*-coff*", NULL },{ "m68*-*-sysv*", |
&m68kcoff_vec }, |
&m68k_coff_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_hp300hpux_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_aout_hp300hpux_vec) |
{ "m68*-*-hpux*", |
&hp300hpux_vec }, |
&m68k_aout_hp300hpux_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_m68klinux_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_aout_linux_vec) |
{ "m68*-*-linux*aout*", |
&m68klinux_vec }, |
&m68k_aout_linux_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m68k_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_elf32_vec) |
{ "m68*-*-linux-*", |
&bfd_elf32_m68k_vec }, |
&m68k_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m68k_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_elf32_vec) |
{ "m68*-*-gnu*", |
&bfd_elf32_m68k_vec }, |
&m68k_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_m68k4knetbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_aout_4knbsd_vec) |
{ "m68*-hp*-netbsd*", |
&m68k4knetbsd_vec }, |
&m68k_aout_4knbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m68k_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_elf32_vec) |
{ "m68*-*-netbsdelf*", |
&bfd_elf32_m68k_vec }, |
&m68k_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_m68knetbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_aout_nbsd_vec) |
{ "m68*-*-netbsdaout*", NULL },{ "m68*-*-netbsd*", |
&m68knetbsd_vec }, |
&m68k_aout_nbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_m68knetbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_aout_nbsd_vec) |
{ "m68*-*-openbsd*", |
&m68knetbsd_vec }, |
&m68k_aout_nbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_sunos_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_aout_sunos_be_vec) |
{ "m68*-*-sunos*", NULL },{ "m68*-*-os68k*", NULL },{ "m68*-*-vxworks*", NULL },{ "m68*-netx-*", NULL }, |
{ "m68*-*-bsd*", NULL },{ "m68*-*-vsta*", |
&sunos_big_vec }, |
&sparc_aout_sunos_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_sunos_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_aout_sunos_be_vec) |
{ "m68*-ericsson-*", |
&sunos_big_vec }, |
&sparc_aout_sunos_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m68k_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_elf32_vec) |
{ "m68*-cbm-*", |
&bfd_elf32_m68k_vec }, |
&m68k_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m68k_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_elf32_vec) |
{ "m68*-*-psos*", |
&bfd_elf32_m68k_vec }, |
&m68k_elf32_vec }, |
#endif |
1364,320 → 1411,320 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_m88k_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m88k_elf32_vec) |
{ "m88*-harris-cxux*", NULL },{ "m88*-*-dgux*", NULL },{ "m88*-*-sysv4*", |
&bfd_elf32_m88k_vec }, |
&m88k_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_m88kmach3_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m88k_aout_mach3_vec) |
{ "m88*-*-mach3*", |
&m88kmach3_vec }, |
&m88k_aout_mach3_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_m88kopenbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m88k_aout_obsd_vec) |
{ "m88*-*-openbsd*", |
&m88kopenbsd_vec }, |
&m88k_aout_obsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_m88kbcs_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m88k_coff_bcs_vec) |
{ "m88*-*-*", |
&m88kbcs_vec }, |
&m88k_coff_bcs_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_mcore_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mcore_elf32_be_vec) |
{ "mcore-*-elf", |
&bfd_elf32_mcore_big_vec }, |
&mcore_elf32_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_mcore_pe_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mcore_pe_be_vec) |
{ "mcore-*-pe", |
&mcore_pe_big_vec }, |
&mcore_pe_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_mep_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mep_elf32_vec) |
{ "mep-*-elf", |
&bfd_elf32_mep_vec }, |
&mep_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_metag_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_metag_elf32_vec) |
{ "metag-*-*", |
&bfd_elf32_metag_vec }, |
&metag_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_microblazeel_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_microblaze_elf32_le_vec) |
{ "microblazeel*-*", |
&bfd_elf32_microblazeel_vec }, |
µblaze_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_microblaze_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_microblaze_elf32_vec) |
{ "microblaze*-*", |
&bfd_elf32_microblaze_vec }, |
µblaze_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_ecoff_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_ecoff_be_vec) |
{ "mips*-big-*", |
&ecoff_big_vec }, |
&mips_ecoff_be_vec }, |
#endif |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_tradlittlemips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_trad_le_vec) |
{ "mips*el-*-netbsd*", |
&bfd_elf32_tradlittlemips_vec }, |
&mips_elf32_trad_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_tradbigmips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_trad_be_vec) |
{ "mips*-*-netbsd*", |
&bfd_elf32_tradbigmips_vec }, |
&mips_elf32_trad_be_vec }, |
#endif |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_ecoff_little_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_ecoff_le_vec) |
{ "mips*-dec-*", NULL },{ "mips*el-*-ecoff*", |
&ecoff_little_vec }, |
&mips_ecoff_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_ecoff_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_ecoff_be_vec) |
{ "mips*-*-ecoff*", |
&ecoff_big_vec }, |
&mips_ecoff_be_vec }, |
#endif |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_nbigmips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_n_be_vec) |
{ "mips*-*-irix6*", |
&bfd_elf32_nbigmips_vec }, |
&mips_elf32_n_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_nlittlemips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_n_le_vec) |
{ "mips64*-ps2-elf*", |
&bfd_elf32_nlittlemips_vec }, |
&mips_elf32_n_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlemips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_le_vec) |
{ "mips*-ps2-elf*", |
&bfd_elf32_littlemips_vec }, |
&mips_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_bigmips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_be_vec) |
{ "mips*-*-irix5*", |
&bfd_elf32_bigmips_vec }, |
&mips_elf32_be_vec }, |
#endif |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_ecoff_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_ecoff_be_vec) |
{ "mips*-sgi-*", NULL },{ "mips*-*-bsd*", |
&ecoff_big_vec }, |
&mips_ecoff_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_ecoff_biglittle_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_ecoff_bele_vec) |
{ "mips*-*-lnews*", |
&ecoff_biglittle_vec }, |
&mips_ecoff_bele_vec }, |
#endif |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_tradbigmips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_trad_be_vec) |
{ "mips*-*-sysv4*", |
&bfd_elf32_tradbigmips_vec }, |
&mips_elf32_trad_be_vec }, |
#endif |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_ecoff_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_ecoff_be_vec) |
{ "mips*-*-sysv*", NULL },{ "mips*-*-riscos*", |
&ecoff_big_vec }, |
&mips_ecoff_be_vec }, |
#endif |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlemips_vxworks_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_vxworks_le_vec) |
{ "mips*el-*-vxworks*", |
&bfd_elf32_littlemips_vxworks_vec }, |
&mips_elf32_vxworks_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_bigmips_vxworks_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_vxworks_be_vec) |
{ "mips*-*-vxworks*", |
&bfd_elf32_bigmips_vxworks_vec }, |
&mips_elf32_vxworks_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_tradlittlemips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_trad_le_vec) |
{ "mips*el-sde-elf*", |
&bfd_elf32_tradlittlemips_vec }, |
&mips_elf32_trad_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_tradbigmips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_trad_be_vec) |
{ "mips*-sde-elf*", NULL },{ "mips*-mti-elf*", |
&bfd_elf32_tradbigmips_vec }, |
{ "mips*-sde-elf*", NULL },{ "mips*-mti-elf*", NULL },{ "mips*-img-elf*", |
&mips_elf32_trad_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlemips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_le_vec) |
{ "mips*el-*-elf*", NULL },{ "mips*el-*-vxworks*", NULL },{ "mips*-*-chorus*", |
&bfd_elf32_littlemips_vec }, |
&mips_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_bigmips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_be_vec) |
{ "mips*-*-elf*", NULL },{ "mips*-*-rtems*", NULL },{ "mips*-*-vxworks", NULL },{ "mips*-*-windiss", |
&bfd_elf32_bigmips_vec }, |
&mips_elf32_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_bigmips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_be_vec) |
{ "mips*-*-none", |
&bfd_elf32_bigmips_vec }, |
&mips_elf32_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_tradbigmips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf64_trad_be_vec) |
{ "mips64*-*-openbsd*", |
&bfd_elf64_tradbigmips_vec }, |
&mips_elf64_trad_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlemips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_le_vec) |
{ "mips*el-*-openbsd*", |
&bfd_elf32_littlemips_vec }, |
&mips_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_bigmips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_be_vec) |
{ "mips*-*-openbsd*", |
&bfd_elf32_bigmips_vec }, |
&mips_elf32_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_ntradlittlemips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_ntrad_le_vec) |
{ "mips64*el-*-linux*", |
&bfd_elf32_ntradlittlemips_vec }, |
&mips_elf32_ntrad_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_ntradbigmips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_ntrad_be_vec) |
{ "mips64*-*-linux*", |
&bfd_elf32_ntradbigmips_vec }, |
&mips_elf32_ntrad_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_tradlittlemips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_trad_le_vec) |
{ "mips*el-*-linux*", |
&bfd_elf32_tradlittlemips_vec }, |
&mips_elf32_trad_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_tradbigmips_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_trad_be_vec) |
{ "mips*-*-linux*", |
&bfd_elf32_tradbigmips_vec }, |
&mips_elf32_trad_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_ntradlittlemips_freebsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_ntradfbsd_le_vec) |
{ "mips64*el-*-freebsd*", NULL },{ "mips64*el-*-kfreebsd*-gnu", |
&bfd_elf32_ntradlittlemips_freebsd_vec }, |
&mips_elf32_ntradfbsd_le_vec }, |
#endif |
1685,10 → 1732,10 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_ntradbigmips_freebsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_ntradfbsd_be_vec) |
{ "mips64*-*-freebsd*", NULL },{ "mips64*-*-kfreebsd*-gnu", |
&bfd_elf32_ntradbigmips_freebsd_vec }, |
&mips_elf32_ntradfbsd_be_vec }, |
#endif |
1696,10 → 1743,10 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_tradlittlemips_freebsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_tradfbsd_le_vec) |
{ "mips*el-*-freebsd*", NULL },{ "mips*el-*-kfreebsd*-gnu", |
&bfd_elf32_tradlittlemips_freebsd_vec }, |
&mips_elf32_tradfbsd_le_vec }, |
#endif |
1707,10 → 1754,10 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_tradbigmips_freebsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mips_elf32_tradfbsd_be_vec) |
{ "mips*-*-freebsd*", NULL },{ "mips*-*-kfreebsd*-gnu", |
&bfd_elf32_tradbigmips_freebsd_vec }, |
&mips_elf32_tradfbsd_be_vec }, |
#endif |
1717,10 → 1764,10 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_mmix_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mmix_elf64_vec) |
{ "mmix-*-*", |
&bfd_elf64_mmix_vec }, |
&mmix_elf64_vec }, |
#endif |
1727,109 → 1774,136 |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_mn10200_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mn10200_elf32_vec) |
{ "mn10200-*-*", |
&bfd_elf32_mn10200_vec }, |
&mn10200_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_mn10300_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mn10300_elf32_vec) |
{ "mn10300-*-*", |
&bfd_elf32_mn10300_vec }, |
&mn10300_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_mt_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_mt_elf32_vec) |
{ "mt-*-elf", |
&bfd_elf32_mt_vec }, |
&mt_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_msp430_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_msp430_elf32_vec) |
{ "msp430-*-*", |
&bfd_elf32_msp430_vec }, |
&msp430_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_pc532machaout_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_nds32_elf32_linux_le_vec) |
{ "ns32k-pc532-mach*", NULL },{ "ns32k-pc532-ux*", |
&pc532machaout_vec }, |
{ "nds32*le-*-linux*", |
&nds32_elf32_linux_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_pc532netbsd_vec) |
{ "ns32k-*-netbsd*", NULL },{ "ns32k-*-lites*", NULL },{ "ns32k-*-openbsd*", |
&pc532netbsd_vec }, |
#if !defined (SELECT_VECS) || defined (HAVE_nds32_elf32_linux_be_vec) |
{ "nds32*be-*-linux*", |
&nds32_elf32_linux_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_bignios2_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_nds32_elf32_le_vec) |
{ "nios2eb-*-*", |
&bfd_elf32_bignios2_vec }, |
{ "nds32*le-*-*", |
&nds32_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlenios2_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_nds32_elf32_be_vec) |
{ "nios2el-*-*", |
&bfd_elf32_littlenios2_vec }, |
{ "nds32*be-*-*", |
&nds32_elf32_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_littlenios2_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_ns32k_aout_pc532mach_vec) |
{ "nios2-*-*", |
&bfd_elf32_littlenios2_vec }, |
{ "ns32k-pc532-mach*", NULL },{ "ns32k-pc532-ux*", |
&ns32k_aout_pc532mach_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_ns32k_aout_pc532nbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_openrisc_vec) |
{ "ns32k-*-netbsd*", NULL },{ "ns32k-*-lites*", NULL },{ "ns32k-*-openbsd*", |
&ns32k_aout_pc532nbsd_vec }, |
#endif |
{ "openrisc-*-elf", |
&bfd_elf32_openrisc_vec }, |
#if !defined (SELECT_VECS) || defined (HAVE_nios2_elf32_be_vec) |
{ "nios2eb-*-*", |
&nios2_elf32_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_or32coff_big_vec) |
{ "or32-*-coff", |
&or32coff_big_vec }, |
#if !defined (SELECT_VECS) || defined (HAVE_nios2_elf32_le_vec) |
{ "nios2el-*-*", |
&nios2_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_or32_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_nios2_elf32_le_vec) |
{ "or32-*-elf", |
&bfd_elf32_or32_big_vec }, |
{ "nios2-*-*", |
&nios2_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_or1k_elf32_vec) |
{ "or1k-*-elf", NULL },{ "or1k-*-linux*", NULL },{ "or1k-*-rtems*", |
&or1k_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_or1k_elf32_vec) |
{ "or1knd-*-elf", NULL },{ "or1knd-*-linux*", NULL },{ "or1knd-*-rtems*", |
&or1k_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_pdp11_aout_vec) |
{ "pdp11-*-*", |
1839,28 → 1913,28 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_pj_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_pj_elf32_vec) |
{ "pj-*-*", |
&bfd_elf32_pj_vec }, |
&pj_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_pjl_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_pj_elf32_le_vec) |
{ "pjl-*-*", |
&bfd_elf32_pjl_vec }, |
&pj_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_rs6000coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_rs6000_xcoff_vec) |
{ "powerpc-*-aix5.[01]", NULL },{ "rs6000-*-aix5.[01]", |
&rs6000coff_vec }, |
&rs6000_xcoff_vec }, |
#endif |
1867,10 → 1941,10 |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_aix5coff64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_rs6000_xcoff64_aix_vec) |
{ "powerpc64-*-aix5.[01]", NULL },{ "rs6000-*-aix5.[01]", |
&aix5coff64_vec }, |
&rs6000_xcoff64_aix_vec }, |
#endif |
1878,10 → 1952,10 |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_rs6000coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_rs6000_xcoff_vec) |
{ "powerpc-*-aix[5-9]*", NULL },{ "rs6000-*-aix[5-9]*", |
&rs6000coff_vec }, |
&rs6000_xcoff_vec }, |
#endif |
1889,10 → 1963,10 |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_aix5coff64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_rs6000_xcoff64_aix_vec) |
{ "powerpc64-*-aix[5-9]*", NULL },{ "rs6000-*-aix[5-9]*", |
&aix5coff64_vec }, |
&rs6000_xcoff64_aix_vec }, |
#endif |
1900,48 → 1974,48 |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_rs6000coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_rs6000_xcoff_vec) |
{ "powerpc-*-aix*", NULL },{ "powerpc-*-beos*", NULL },{ "rs6000-*-*", |
&rs6000coff_vec }, |
&rs6000_xcoff_vec }, |
#endif |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_rs6000coff64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_rs6000_xcoff64_vec) |
{ "powerpc64-*-aix*", |
&rs6000coff64_vec }, |
&rs6000_xcoff64_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_powerpc_freebsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_elf64_fbsd_vec) |
{ "powerpc64-*-freebsd*", |
&bfd_elf64_powerpc_freebsd_vec }, |
&powerpc_elf64_fbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_powerpc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_elf64_vec) |
{ "powerpc64-*-elf*", NULL },{ "powerpc-*-elf64*", NULL },{ "powerpc64-*-linux*", NULL }, |
{ "powerpc64-*-*bsd*", |
&bfd_elf64_powerpc_vec }, |
&powerpc_elf64_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_powerpcle_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_elf64_le_vec) |
{ "powerpc64le-*-elf*", NULL },{ "powerpcle-*-elf64*", NULL },{ "powerpc64le-*-linux*", NULL }, |
{ "powerpc64le-*-*bsd*", |
&bfd_elf64_powerpcle_vec }, |
&powerpc_elf64_le_vec }, |
#endif |
1948,30 → 2022,30 |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_powerpc_freebsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_elf32_fbsd_vec) |
{ "powerpc-*-*freebsd*", |
&bfd_elf32_powerpc_freebsd_vec }, |
&powerpc_elf32_fbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_powerpc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_elf32_vec) |
{ "powerpc-*-*bsd*", NULL },{ "powerpc-*-elf*", NULL },{ "powerpc-*-sysv4*", NULL },{ "powerpc-*-eabi*", NULL }, |
{ "powerpc-*-solaris2*", NULL },{ "powerpc-*-linux-*", NULL },{ "powerpc-*-rtems*", NULL }, |
{ "powerpc-*-chorus*", |
&bfd_elf32_powerpc_vec }, |
&powerpc_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_powerpc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_elf32_vec) |
{ "powerpc-*-kaos*", |
&bfd_elf32_powerpc_vec }, |
&powerpc_elf32_vec }, |
#endif |
1986,95 → 2060,95 |
#if !defined (SELECT_VECS) || defined (HAVE_pmac_xcoff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_xcoff_vec) |
{ "powerpc-*-macos*", |
&pmac_xcoff_vec }, |
&powerpc_xcoff_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_powerpc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_elf32_vec) |
{ "powerpc-*-lynxos*", |
&bfd_elf32_powerpc_vec }, |
&powerpc_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_powerpc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_elf32_vec) |
{ "powerpc-*-netware*", |
&bfd_elf32_powerpc_vec }, |
&powerpc_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_powerpc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_elf32_vec) |
{ "powerpc-*-nto*", |
&bfd_elf32_powerpc_vec }, |
&powerpc_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_powerpc_vxworks_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_elf32_vxworks_vec) |
{ "powerpc-*-vxworks*", NULL },{ "powerpc-*-windiss*", |
&bfd_elf32_powerpc_vxworks_vec }, |
&powerpc_elf32_vxworks_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_powerpcle_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_elf32_le_vec) |
{ "powerpcle-*-nto*", |
&bfd_elf32_powerpcle_vec }, |
&powerpc_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_powerpcle_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_elf32_le_vec) |
{ "powerpcle-*-elf*", NULL },{ "powerpcle-*-sysv4*", NULL },{ "powerpcle-*-eabi*", NULL }, |
{ "powerpcle-*-solaris2*", NULL },{ "powerpcle-*-linux-*", NULL },{ "powerpcle-*-vxworks*", |
&bfd_elf32_powerpcle_vec }, |
&powerpc_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_powerpcle_pe_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_powerpc_pe_le_vec) |
{ "powerpcle-*-pe", NULL },{ "powerpcle-*-winnt*", NULL },{ "powerpcle-*-cygwin*", |
&bfd_powerpcle_pe_vec }, |
&powerpc_pe_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_rl78_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_rl78_elf32_vec) |
{ "rl78-*-elf", |
&bfd_elf32_rl78_vec }, |
&rl78_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_rx_le_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_rx_elf32_le_vec) |
{ "rx-*-elf", |
&bfd_elf32_rx_le_vec }, |
&rx_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_s390_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_s390_elf32_vec) |
{ "s390-*-linux*", |
&bfd_elf32_s390_vec }, |
&s390_elf32_vec }, |
#endif |
2081,37 → 2155,37 |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_s390_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_s390_elf64_vec) |
{ "s390x-*-linux*", |
&bfd_elf64_s390_vec }, |
&s390_elf64_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_s390_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_s390_elf64_vec) |
{ "s390x-*-tpf*", |
&bfd_elf64_s390_vec }, |
&s390_elf64_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_bigscore_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_score_elf32_be_vec) |
{ "score*-*-elf*", |
&bfd_elf32_bigscore_vec }, |
&score_elf32_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sh64l_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh64_elf32_le_vec) |
{ "sh64l*-*-elf*", |
&bfd_elf32_sh64l_vec }, |
&sh64_elf32_le_vec }, |
#endif |
2118,10 → 2192,10 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sh64_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh64_elf32_vec) |
{ "sh64-*-elf*", |
&bfd_elf32_sh64_vec }, |
&sh64_elf32_vec }, |
#endif |
2128,56 → 2202,59 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sh64blin_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh64_elf32_linux_be_vec) |
{ "sh64eb-*-linux*", |
&bfd_elf32_sh64blin_vec }, |
&sh64_elf32_linux_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sh64lin_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh64_elf32_linux_vec) |
{ "sh64-*-linux*", |
&bfd_elf32_sh64lin_vec }, |
&sh64_elf32_linux_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_shblin_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_linux_be_vec) |
{ "sh-*-linux*", |
&bfd_elf32_shblin_vec }, |
&sh_elf32_linux_be_vec }, |
#endif |
#endif /* BFD64 */ |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_shblin_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_linux_be_vec) |
{ "sh*eb-*-linux*", |
&bfd_elf32_shblin_vec }, |
&sh_elf32_linux_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_shlin_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_linux_vec) |
{ "sh*-*-linux*", |
&bfd_elf32_shlin_vec }, |
&sh_elf32_linux_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sh_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_vec) |
{ "sh-*-uclinux*", NULL },{ "sh[12]-*-uclinux*", |
&bfd_elf32_sh_vec }, |
&sh_elf32_vec }, |
#endif |
2187,19 → 2264,19 |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sh64lnbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh64_elf32_nbsd_le_vec) |
{ "sh5le-*-netbsd*", |
&bfd_elf32_sh64lnbsd_vec }, |
&sh64_elf32_nbsd_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sh64nbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh64_elf32_nbsd_vec) |
{ "sh5-*-netbsd*", |
&bfd_elf32_sh64nbsd_vec }, |
&sh64_elf32_nbsd_vec }, |
#endif |
2206,19 → 2283,19 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_sh64lnbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh64_elf64_nbsd_le_vec) |
{ "sh64le-*-netbsd*", |
&bfd_elf64_sh64lnbsd_vec }, |
&sh64_elf64_nbsd_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_sh64nbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh64_elf64_nbsd_vec) |
{ "sh64-*-netbsd*", |
&bfd_elf64_sh64nbsd_vec }, |
&sh64_elf64_nbsd_vec }, |
#endif |
2225,19 → 2302,19 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_shlnbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_nbsd_le_vec) |
{ "sh*l*-*-netbsdelf*", |
&bfd_elf32_shlnbsd_vec }, |
&sh_elf32_nbsd_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_shnbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_nbsd_vec) |
{ "sh-*-netbsdelf*", |
&bfd_elf32_shnbsd_vec }, |
&sh_elf32_nbsd_vec }, |
#endif |
2245,18 → 2322,18 |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_shnbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_nbsd_vec) |
{ "sh*-*-netbsdelf*", |
&bfd_elf32_shnbsd_vec }, |
&sh_elf32_nbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_shl_symbian_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_symbian_le_vec) |
{ "sh*-*-symbianelf*", |
&bfd_elf32_shl_symbian_vec }, |
&sh_elf32_symbian_le_vec }, |
#endif |
2264,10 → 2341,10 |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_shl_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_le_vec) |
{ "shl*-*-elf*", NULL },{ "sh[1234]l*-*-elf*", NULL },{ "sh3el*-*-elf*", NULL },{ "shl*-*-kaos*", |
&bfd_elf32_shl_vec }, |
&sh_elf32_le_vec }, |
#endif |
2276,10 → 2353,10 |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_shcoff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_coff_vec) |
{ "sh-*-rtemscoff*", |
&shcoff_vec }, |
&sh_coff_vec }, |
#endif |
2287,10 → 2364,10 |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sh_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_vec) |
{ "sh-*-elf*", NULL },{ "sh[1234]*-elf*", NULL },{ "sh-*-rtems*", NULL },{ "sh-*-kaos*", |
&bfd_elf32_sh_vec }, |
&sh_elf32_vec }, |
#endif |
2299,36 → 2376,36 |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sh_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_vec) |
{ "sh-*-nto*", |
&bfd_elf32_sh_vec }, |
&sh_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_shlnbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_nbsd_le_vec) |
{ "sh*-*-openbsd*", |
&bfd_elf32_shlnbsd_vec }, |
&sh_elf32_nbsd_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_shlpe_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_pe_le_vec) |
{ "sh-*-pe", |
&shlpe_vec }, |
&sh_pe_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_shvxworks_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_elf32_vxworks_vec) |
{ "sh-*-vxworks", |
&bfd_elf32_shvxworks_vec }, |
&sh_elf32_vxworks_vec }, |
#endif |
2338,10 → 2415,10 |
#if !defined (SELECT_VECS) || defined (HAVE_shcoff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sh_coff_vec) |
{ "sh-*-*", |
&shcoff_vec }, |
&sh_coff_vec }, |
#endif |
2348,108 → 2425,108 |
#if !defined (SELECT_VECS) || defined (HAVE_sunos_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_aout_sunos_be_vec) |
{ "sparclet-*-aout*", |
&sunos_big_vec }, |
&sparc_aout_sunos_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_sunos_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_aout_sunos_be_vec) |
{ "sparc86x-*-aout*", |
&sunos_big_vec }, |
&sparc_aout_sunos_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sparc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf32_vec) |
{ "sparclite-*-elf*", NULL },{ "sparc86x-*-elf*", |
&bfd_elf32_sparc_vec }, |
&sparc_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sparc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf32_vec) |
{ "sparc*-*-chorus*", |
&bfd_elf32_sparc_vec }, |
&sparc_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_sparclinux_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_aout_linux_vec) |
{ "sparc-*-linux*aout*", |
&sparclinux_vec }, |
&sparc_aout_linux_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sparc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf32_vec) |
{ "sparc-*-linux-*", NULL },{ "sparcv*-*-linux-*", |
&bfd_elf32_sparc_vec }, |
&sparc_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sparc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf32_vec) |
{ "sparc-*-netbsdelf*", |
&bfd_elf32_sparc_vec }, |
&sparc_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_sparcnetbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_aout_nbsd_vec) |
{ "sparc-*-netbsdaout*", NULL },{ "sparc-*-netbsd*", |
&sparcnetbsd_vec }, |
&sparc_aout_nbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_sparcnetbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_aout_nbsd_vec) |
{ "sparc-*-openbsd[0-2].*", NULL },{ "sparc-*-openbsd3.[0-1]", |
&sparcnetbsd_vec }, |
&sparc_aout_nbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sparc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf32_vec) |
{ "sparc-*-openbsd*", |
&bfd_elf32_sparc_vec }, |
&sparc_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sparc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf32_vec) |
{ "sparc-*-elf*", |
&bfd_elf32_sparc_vec }, |
&sparc_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sparc_sol2_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf32_sol2_vec) |
{ "sparc-*-solaris2.[0-6]", NULL },{ "sparc-*-solaris2.[0-6].*", |
&bfd_elf32_sparc_sol2_vec }, |
&sparc_elf32_sol2_vec }, |
#endif |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sparc_sol2_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf32_sol2_vec) |
{ "sparc-*-solaris2*", NULL },{ "sparcv9-*-solaris2*", NULL },{ "sparc64-*-solaris2*", |
&bfd_elf32_sparc_sol2_vec }, |
&sparc_elf32_sol2_vec }, |
#endif |
2456,52 → 2533,52 |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sparc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf32_vec) |
{ "sparc-*-sysv4*", |
&bfd_elf32_sparc_vec }, |
&sparc_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sparc_vxworks_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf32_vxworks_vec) |
{ "sparc-*-vxworks*", |
&bfd_elf32_sparc_vxworks_vec }, |
&sparc_elf32_vxworks_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sparc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf32_vec) |
{ "sparc-*-netware*", |
&bfd_elf32_sparc_vec }, |
&sparc_elf32_vec }, |
#endif |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_sunos_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_aout_sunos_be_vec) |
{ "sparc64-*-aout*", |
&sunos_big_vec }, |
&sparc_aout_sunos_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_sparc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf64_vec) |
{ "sparc64*-*-linux-*", |
&bfd_elf64_sparc_vec }, |
&sparc_elf64_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_sparc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf64_vec) |
{ "sparc64-*-elf*", NULL },{ "sparc64-*-rtems*", |
&bfd_elf64_sparc_vec }, |
&sparc_elf64_vec }, |
#endif |
2508,44 → 2585,44 |
#endif /* BFD64 */ |
#if !defined (SELECT_VECS) || defined (HAVE_sparccoff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_coff_vec) |
{ "sparc*-*-coff*", |
&sparccoff_vec }, |
&sparc_coff_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_sparc_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_elf32_vec) |
{ "sparc-*-rtems*", |
&bfd_elf32_sparc_vec }, |
&sparc_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_sunos_big_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_sparc_aout_sunos_be_vec) |
{ "sparc*-*-*", |
&sunos_big_vec }, |
&sparc_aout_sunos_be_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_spu_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_spu_elf32_vec) |
{ "spu-*-elf", |
&bfd_elf32_spu_vec }, |
&spu_elf32_vec }, |
#endif |
#if HAVE_host_aout_vec |
#if !defined (SELECT_VECS) || defined (HAVE_host_aout_vec) |
#if HAVE_aout_vec |
#if !defined (SELECT_VECS) || defined (HAVE_aout_vec) |
{ "tahoe-*-*", |
&host_aout_vec }, |
&aout_vec }, |
#endif |
2552,28 → 2629,28 |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_tic6x_elf_le_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_tic6x_elf32_c6000_le_vec) |
{ "tic6x-*-elf", |
&bfd_elf32_tic6x_elf_le_vec }, |
&tic6x_elf32_c6000_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_tic6x_linux_le_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_tic6x_elf32_linux_le_vec) |
{ "tic6x-*-uclinux", |
&bfd_elf32_tic6x_linux_le_vec }, |
&tic6x_elf32_linux_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_tic80coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_tic80_coff_vec) |
{ "tic80*-*-*", |
&tic80coff_vec }, |
&tic80_coff_vec }, |
#endif |
2580,18 → 2657,18 |
#ifdef BFD64 |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_tilegx_le_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_tilegx_elf64_le_vec) |
{ "tilegx-*-*", |
&bfd_elf64_tilegx_le_vec }, |
&tilegx_elf64_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf64_tilegx_be_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_tilegx_elf64_be_vec) |
{ "tilegxbe-*-*", |
&bfd_elf64_tilegx_be_vec }, |
&tilegx_elf64_be_vec }, |
#endif |
2598,36 → 2675,44 |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_tilepro_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_tilepro_elf32_vec) |
{ "tilepro-*-*", |
&bfd_elf32_tilepro_vec }, |
&tilepro_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_v850_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_ft32_elf32_vec) |
{ "ft32*-*-*", |
&ft32_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_v850_elf32_vec) |
{ "v850*-*-*", |
&bfd_elf32_v850_vec }, |
&v850_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_vax_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_vax_elf32_vec) |
{ "vax-*-netbsdelf*", |
&bfd_elf32_vax_vec }, |
&vax_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_vaxnetbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_vax_aout_nbsd_vec) |
{ "vax-*-netbsdaout*", NULL },{ "vax-*-netbsd*", |
&vaxnetbsd_vec }, |
&vax_aout_nbsd_vec }, |
#endif |
2634,94 → 2719,102 |
#if !defined (SELECT_VECS) || defined (HAVE_vaxbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_vax_aout_bsd_vec) |
{ "vax-*-bsd*", NULL },{ "vax-*-ultrix*", |
&vaxbsd_vec }, |
&vax_aout_bsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_vaxnetbsd_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_vax_aout_nbsd_vec) |
{ "vax-*-openbsd*", |
&vaxnetbsd_vec }, |
&vax_aout_nbsd_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_vax_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_vax_elf32_vec) |
{ "vax-*-linux-*", |
&bfd_elf32_vax_vec }, |
&vax_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_we32kcoff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_visium_elf32_vec) |
{ "visium-*-elf", |
&visium_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_we32k_coff_vec) |
{ "we32k-*-*", |
&we32kcoff_vec }, |
&we32k_coff_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_w65_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_w65_coff_vec) |
{ "w65-*-*", |
&w65_vec }, |
&w65_coff_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_xgate_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_xgate_elf32_vec) |
{ "xgate-*-*", |
&bfd_elf32_xgate_vec }, |
&xgate_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_xstormy16_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_xstormy16_elf32_vec) |
{ "xstormy16-*-elf", |
&bfd_elf32_xstormy16_vec }, |
&xstormy16_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_xtensa_le_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_xtensa_elf32_le_vec) |
{ "xtensa*-*-*", |
&bfd_elf32_xtensa_le_vec }, |
&xtensa_elf32_le_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_bfd_elf32_xc16x_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_xc16x_elf32_vec) |
{ "xc16x-*-elf", |
&bfd_elf32_xc16x_vec }, |
&xc16x_elf32_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_z80coff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_z80_coff_vec) |
{ "z80-*-*", |
&z80coff_vec }, |
&z80_coff_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_z8kcoff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_z8k_coff_vec) |
{ "z8k*-*-*", |
&z8kcoff_vec }, |
&z8k_coff_vec }, |
#endif |
2735,28 → 2828,28 |
#if !defined (SELECT_VECS) || defined (HAVE_a_out_adobe_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_aout_adobe_vec) |
{ "*-adobe-*", |
&a_out_adobe_vec }, |
&aout_adobe_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_newsos3_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_aout_newsos3_vec) |
{ "*-sony-*", |
&newsos3_vec }, |
&m68k_aout_newsos3_vec }, |
#endif |
#if !defined (SELECT_VECS) || defined (HAVE_m68kcoff_vec) |
#if !defined (SELECT_VECS) || defined (HAVE_m68k_coff_vec) |
{ "*-tandem-*", |
&m68kcoff_vec }, |
&m68k_coff_vec }, |
#endif |
/contrib/toolchain/binutils/bfd/tekhex.c |
---|
1,6 → 1,5 |
/* BFD backend for Extended Tektronix Hex Format objects. |
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, |
2003, 2004, 2005, 2006, 2007, 2009, 2011 Free Software Foundation, Inc. |
Copyright (C) 1992-2015 Free Software Foundation, Inc. |
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>. |
This file is part of BFD, the Binary File Descriptor library. |
247,11 → 246,12 |
typedef struct tekhex_data_list_struct tekhex_data_list_type; |
#define CHUNK_MASK 0x1fff |
#define CHUNK_SPAN 32 |
struct data_struct |
{ |
char chunk_data[CHUNK_MASK + 1]; |
char chunk_init[CHUNK_MASK + 1]; |
unsigned char chunk_data[CHUNK_MASK + 1]; |
unsigned char chunk_init[(CHUNK_MASK + 1 + CHUNK_SPAN - 1) / CHUNK_SPAN]; |
bfd_vma vma; |
struct data_struct *next; |
}; |
267,7 → 267,7 |
#define enda(x) (x->vma + x->size) |
static bfd_boolean |
getvalue (char **srcp, bfd_vma *valuep) |
getvalue (char **srcp, bfd_vma *valuep, char * endp) |
{ |
char *src = *srcp; |
bfd_vma value = 0; |
279,7 → 279,7 |
len = hex_value (*src++); |
if (len == 0) |
len = 16; |
while (len--) |
while (len-- && src < endp) |
{ |
if (!ISHEX (*src)) |
return FALSE; |
288,11 → 288,11 |
*srcp = src; |
*valuep = value; |
return TRUE; |
return len == -1U; |
} |
static bfd_boolean |
getsym (char *dstp, char **srcp, unsigned int *lenp) |
getsym (char *dstp, char **srcp, unsigned int *lenp, char * endp) |
{ |
char *src = *srcp; |
unsigned int i; |
304,16 → 304,16 |
len = hex_value (*src++); |
if (len == 0) |
len = 16; |
for (i = 0; i < len; i++) |
for (i = 0; i < len && src < endp; i++) |
dstp[i] = src[i]; |
dstp[i] = 0; |
*srcp = src + i; |
*lenp = len; |
return TRUE; |
return i == len; |
} |
static struct data_struct * |
find_chunk (bfd *abfd, bfd_vma vma) |
find_chunk (bfd *abfd, bfd_vma vma, bfd_boolean create) |
{ |
struct data_struct *d = abfd->tdata.tekhex_data->data; |
321,7 → 321,7 |
while (d && (d->vma) != vma) |
d = d->next; |
if (!d) |
if (!d && create) |
{ |
/* No chunk for this address, so make one up. */ |
d = (struct data_struct *) |
340,20 → 340,23 |
static void |
insert_byte (bfd *abfd, int value, bfd_vma addr) |
{ |
if (value != 0) |
{ |
/* Find the chunk that this byte needs and put it in. */ |
struct data_struct *d = find_chunk (abfd, addr); |
struct data_struct *d = find_chunk (abfd, addr, TRUE); |
d->chunk_data[addr & CHUNK_MASK] = value; |
d->chunk_init[addr & CHUNK_MASK] = 1; |
d->chunk_init[(addr & CHUNK_MASK) / CHUNK_SPAN] = 1; |
} |
} |
/* The first pass is to find the names of all the sections, and see |
how big the data is. */ |
static bfd_boolean |
first_phase (bfd *abfd, int type, char *src) |
first_phase (bfd *abfd, int type, char *src, char * src_end) |
{ |
asection *section = bfd_abs_section_ptr; |
asection *section, *alt_section; |
unsigned int len; |
bfd_vma val; |
char sym[17]; /* A symbol can only be 16chars long. */ |
365,21 → 368,21 |
{ |
bfd_vma addr; |
if (!getvalue (&src, &addr)) |
if (!getvalue (&src, &addr, src_end)) |
return FALSE; |
while (*src) |
while (*src && src < src_end - 1) |
{ |
insert_byte (abfd, HEX (src), addr); |
src += 2; |
addr++; |
} |
return TRUE; |
} |
return TRUE; |
case '3': |
/* Symbol record, read the segment. */ |
if (!getsym (sym, &src, &len)) |
if (!getsym (sym, &src, &len, src_end)) |
return FALSE; |
section = bfd_get_section_by_name (abfd, sym); |
if (section == NULL) |
393,17 → 396,24 |
if (section == NULL) |
return FALSE; |
} |
while (*src) |
alt_section = NULL; |
while (src < src_end && *src) |
{ |
switch (*src) |
{ |
case '1': /* Section range. */ |
src++; |
if (!getvalue (&src, §ion->vma)) |
if (!getvalue (&src, §ion->vma, src_end)) |
return FALSE; |
if (!getvalue (&src, &val)) |
if (!getvalue (&src, &val, src_end)) |
return FALSE; |
if (val < section->vma) |
val = section->vma; |
section->size = val - section->vma; |
/* PR 17512: file: objdump-s-endless-loop.tekhex. |
Check for overlarge section sizes. */ |
if (section->size & 0x80000000) |
return FALSE; |
section->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC; |
break; |
case '0': |
428,7 → 438,7 |
abfd->flags |= HAS_SYMS; |
new_symbol->prev = abfd->tdata.tekhex_data->symbols; |
abfd->tdata.tekhex_data->symbols = new_symbol; |
if (!getsym (sym, &src, &len)) |
if (!getsym (sym, &src, &len, src_end)) |
return FALSE; |
new_symbol->symbol.name = (const char *) |
bfd_alloc (abfd, (bfd_size_type) len + 1); |
440,8 → 450,46 |
new_symbol->symbol.flags = (BSF_GLOBAL | BSF_EXPORT); |
else |
new_symbol->symbol.flags = BSF_LOCAL; |
if (!getvalue (&src, &val)) |
if (stype == '2' || stype == '6') |
new_symbol->symbol.section = bfd_abs_section_ptr; |
else if (stype == '3' || stype == '7') |
{ |
if ((section->flags & SEC_DATA) == 0) |
section->flags |= SEC_CODE; |
else |
{ |
if (alt_section == NULL) |
alt_section |
= bfd_get_next_section_by_name (NULL, section); |
if (alt_section == NULL) |
alt_section = bfd_make_section_anyway_with_flags |
(abfd, section->name, |
(section->flags & ~SEC_DATA) | SEC_CODE); |
if (alt_section == NULL) |
return FALSE; |
new_symbol->symbol.section = alt_section; |
} |
} |
else if (stype == '4' || stype == '8') |
{ |
if ((section->flags & SEC_CODE) == 0) |
section->flags |= SEC_DATA; |
else |
{ |
if (alt_section == NULL) |
alt_section |
= bfd_get_next_section_by_name (NULL, section); |
if (alt_section == NULL) |
alt_section = bfd_make_section_anyway_with_flags |
(abfd, section->name, |
(section->flags & ~SEC_CODE) | SEC_DATA); |
if (alt_section == NULL) |
return FALSE; |
new_symbol->symbol.section = alt_section; |
} |
} |
if (!getvalue (&src, &val, src_end)) |
return FALSE; |
new_symbol->symbol.value = val - section->vma; |
break; |
} |
458,7 → 506,7 |
record. */ |
static bfd_boolean |
pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *)) |
pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *, char *)) |
{ |
unsigned int chars_on_line; |
bfd_boolean is_eof = FALSE; |
499,8 → 547,7 |
/* Put a null at the end. */ |
src[chars_on_line] = 0; |
if (!func (abfd, type, src)) |
if (!func (abfd, type, src, src + chars_on_line)) |
return FALSE; |
} |
590,22 → 637,26 |
/* Get high bits of address. */ |
bfd_vma chunk_number = addr & ~(bfd_vma) CHUNK_MASK; |
bfd_vma low_bits = addr & CHUNK_MASK; |
bfd_boolean must_write = !get && *location != 0; |
if (chunk_number != prev_number) |
if (chunk_number != prev_number || (!d && must_write)) |
{ |
/* Different chunk, so move pointer. */ |
d = find_chunk (abfd, chunk_number); |
d = find_chunk (abfd, chunk_number, must_write); |
prev_number = chunk_number; |
} |
if (get) |
{ |
if (d->chunk_init[low_bits]) |
if (d) |
*location = d->chunk_data[low_bits]; |
else |
*location = 0; |
} |
else |
else if (must_write) |
{ |
d->chunk_data[low_bits] = *location; |
d->chunk_init[low_bits] = (*location != 0); |
d->chunk_init[low_bits / CHUNK_SPAN] = 1; |
} |
location++; |
633,7 → 684,9 |
enum bfd_architecture arch, |
unsigned long machine) |
{ |
return bfd_default_set_arch_mach (abfd, arch, machine); |
/* Ignore errors about unknown architecture. */ |
return (bfd_default_set_arch_mach (abfd, arch, machine) |
|| arch == bfd_arch_unknown); |
} |
/* We have to save up all the Tekhexords for a splurge before output. */ |
645,24 → 698,6 |
file_ptr offset, |
bfd_size_type bytes_to_do) |
{ |
if (! abfd->output_has_begun) |
{ |
/* The first time around, allocate enough sections to hold all the chunks. */ |
asection *s = abfd->sections; |
bfd_vma vma; |
for (s = abfd->sections; s; s = s->next) |
{ |
if (s->flags & SEC_LOAD) |
{ |
for (vma = s->vma & ~(bfd_vma) CHUNK_MASK; |
vma < s->vma + s->size; |
vma += CHUNK_MASK) |
find_chunk (abfd, vma); |
} |
} |
} |
if (section->flags & (SEC_LOAD | SEC_ALLOC)) |
{ |
move_section_contents (abfd, section, locationp, offset, bytes_to_do, |
773,26 → 808,17 |
d = d->next) |
{ |
int low; |
const int span = 32; |
int addr; |
/* Write it in blocks of 32 bytes. */ |
for (addr = 0; addr < CHUNK_MASK + 1; addr += span) |
for (addr = 0; addr < CHUNK_MASK + 1; addr += CHUNK_SPAN) |
{ |
int need = 0; |
/* Check to see if necessary. */ |
for (low = 0; !need && low < span; low++) |
if (d->chunk_init[addr + low]) |
need = 1; |
if (need) |
if (d->chunk_init[addr / CHUNK_SPAN]) |
{ |
char *dst = buffer; |
writevalue (&dst, addr + d->vma); |
for (low = 0; low < span; low++) |
for (low = 0; low < CHUNK_SPAN; low++) |
{ |
TOHEX (dst, d->chunk_data[addr + low]); |
dst += 2; |
936,7 → 962,9 |
#define tekhex_bfd_is_local_label_name bfd_generic_is_local_label_name |
#define tekhex_get_lineno _bfd_nosymbols_get_lineno |
#define tekhex_find_nearest_line _bfd_nosymbols_find_nearest_line |
#define tekhex_find_line _bfd_nosymbols_find_line |
#define tekhex_find_inliner_info _bfd_nosymbols_find_inliner_info |
#define tekhex_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string |
#define tekhex_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol |
#define tekhex_read_minisymbols _bfd_generic_read_minisymbols |
#define tekhex_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol |
950,7 → 978,6 |
#define tekhex_section_already_linked _bfd_generic_section_already_linked |
#define tekhex_bfd_define_common_symbol bfd_generic_define_common_symbol |
#define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create |
#define tekhex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
#define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols |
#define tekhex_bfd_link_just_syms _bfd_generic_link_just_syms |
#define tekhex_bfd_copy_link_hash_symbol_type \ |
/contrib/toolchain/binutils/bfd/verilog.c |
---|
1,6 → 1,5 |
/* BFD back-end for verilog hex memory dump files. |
Copyright 2009, 2010, 2011 |
Free Software Foundation, Inc. |
Copyright (C) 2009-2015 Free Software Foundation, Inc. |
Written by Anthony Green <green@moxielogic.com> |
This file is part of BFD, the Binary File Descriptor library. |
192,7 → 191,7 |
const bfd_byte *data, |
const bfd_byte *end) |
{ |
char buffer[48]; |
char buffer[50]; |
const bfd_byte *src = data; |
char *dst = buffer; |
bfd_size_type wrlen; |
312,7 → 311,6 |
#define verilog_bfd_discard_group bfd_generic_discard_group |
#define verilog_section_already_linked _bfd_generic_section_already_linked |
#define verilog_bfd_link_hash_table_create _bfd_generic_link_hash_table_create |
#define verilog_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
#define verilog_bfd_link_add_symbols _bfd_generic_link_add_symbols |
#define verilog_bfd_link_just_syms _bfd_generic_link_just_syms |
#define verilog_bfd_final_link _bfd_generic_final_link |