1999-05-03 07:29:11 +00:00
|
|
|
/* Generic symbol-table support for the BFD library.
|
2001-03-08 21:04:02 +00:00
|
|
|
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
2009-09-02 07:25:43 +00:00
|
|
|
2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
|
1999-05-03 07:29:11 +00:00
|
|
|
Free Software Foundation, Inc.
|
|
|
|
Written by Cygnus Support.
|
|
|
|
|
2003-02-14 09:31:57 +00:00
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2003-02-14 09:31:57 +00:00
|
|
|
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
|
2007-07-03 14:26:43 +00:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2003-02-14 09:31:57 +00:00
|
|
|
(at your option) any later version.
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2003-02-14 09:31:57 +00:00
|
|
|
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.
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2003-02-14 09:31:57 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2007-07-03 14:26:43 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
SECTION
|
|
|
|
Symbols
|
|
|
|
|
|
|
|
BFD tries to maintain as much symbol information as it can when
|
|
|
|
it moves information from file to file. BFD passes information
|
|
|
|
to applications though the <<asymbol>> structure. When the
|
|
|
|
application requests the symbol table, BFD reads the table in
|
|
|
|
the native form and translates parts of it into the internal
|
|
|
|
format. To maintain more than the information passed to
|
|
|
|
applications, some targets keep some information ``behind the
|
|
|
|
scenes'' in a structure only the particular back end knows
|
|
|
|
about. For example, the coff back end keeps the original
|
|
|
|
symbol table structure as well as the canonical structure when
|
|
|
|
a BFD is read in. On output, the coff back end can reconstruct
|
|
|
|
the output symbol table so that no information is lost, even
|
|
|
|
information unique to coff which BFD doesn't know or
|
|
|
|
understand. If a coff symbol table were read, but were written
|
|
|
|
through an a.out back end, all the coff specific information
|
|
|
|
would be lost. The symbol table of a BFD
|
|
|
|
is not necessarily read in until a canonicalize request is
|
|
|
|
made. Then the BFD back end fills in a table provided by the
|
|
|
|
application with pointers to the canonical information. To
|
|
|
|
output symbols, the application provides BFD with a table of
|
|
|
|
pointers to pointers to <<asymbol>>s. This allows applications
|
|
|
|
like the linker to output a symbol as it was read, since the ``behind
|
|
|
|
the scenes'' information will be still available.
|
|
|
|
@menu
|
|
|
|
@* Reading Symbols::
|
|
|
|
@* Writing Symbols::
|
|
|
|
@* Mini Symbols::
|
|
|
|
@* typedef asymbol::
|
|
|
|
@* symbol handling functions::
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
INODE
|
|
|
|
Reading Symbols, Writing Symbols, Symbols, Symbols
|
|
|
|
SUBSECTION
|
|
|
|
Reading symbols
|
|
|
|
|
|
|
|
There are two stages to reading a symbol table from a BFD:
|
|
|
|
allocating storage, and the actual reading process. This is an
|
|
|
|
excerpt from an application which reads the symbol table:
|
|
|
|
|
|
|
|
| long storage_needed;
|
|
|
|
| asymbol **symbol_table;
|
|
|
|
| long number_of_symbols;
|
|
|
|
| long i;
|
|
|
|
|
|
|
|
|
| storage_needed = bfd_get_symtab_upper_bound (abfd);
|
|
|
|
|
|
|
|
|
| if (storage_needed < 0)
|
|
|
|
| FAIL
|
|
|
|
|
|
2003-02-14 09:31:57 +00:00
|
|
|
| if (storage_needed == 0)
|
|
|
|
| return;
|
|
|
|
|
|
2003-06-29 10:06:40 +00:00
|
|
|
| symbol_table = xmalloc (storage_needed);
|
1999-05-03 07:29:11 +00:00
|
|
|
| ...
|
|
|
|
| number_of_symbols =
|
|
|
|
| bfd_canonicalize_symtab (abfd, symbol_table);
|
|
|
|
|
|
|
|
|
| if (number_of_symbols < 0)
|
|
|
|
| FAIL
|
|
|
|
|
|
2003-02-14 09:31:57 +00:00
|
|
|
| for (i = 0; i < number_of_symbols; i++)
|
|
|
|
| process_symbol (symbol_table[i]);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
All storage for the symbols themselves is in an objalloc
|
|
|
|
connected to the BFD; it is freed when the BFD is closed.
|
|
|
|
|
|
|
|
INODE
|
|
|
|
Writing Symbols, Mini Symbols, Reading Symbols, Symbols
|
|
|
|
SUBSECTION
|
|
|
|
Writing symbols
|
|
|
|
|
|
|
|
Writing of a symbol table is automatic when a BFD open for
|
|
|
|
writing is closed. The application attaches a vector of
|
|
|
|
pointers to pointers to symbols to the BFD being written, and
|
|
|
|
fills in the symbol count. The close and cleanup code reads
|
|
|
|
through the table provided and performs all the necessary
|
|
|
|
operations. The BFD output code must always be provided with an
|
|
|
|
``owned'' symbol: one which has come from another BFD, or one
|
|
|
|
which has been created using <<bfd_make_empty_symbol>>. Here is an
|
|
|
|
example showing the creation of a symbol table with only one element:
|
|
|
|
|
|
|
|
| #include "bfd.h"
|
2003-02-14 09:31:57 +00:00
|
|
|
| int main (void)
|
1999-05-03 07:29:11 +00:00
|
|
|
| {
|
|
|
|
| bfd *abfd;
|
|
|
|
| asymbol *ptrs[2];
|
|
|
|
| asymbol *new;
|
|
|
|
|
|
2003-02-14 09:31:57 +00:00
|
|
|
| abfd = bfd_openw ("foo","a.out-sunos-big");
|
|
|
|
| bfd_set_format (abfd, bfd_object);
|
|
|
|
| new = bfd_make_empty_symbol (abfd);
|
1999-05-03 07:29:11 +00:00
|
|
|
| new->name = "dummy_symbol";
|
2003-02-14 09:31:57 +00:00
|
|
|
| new->section = bfd_make_section_old_way (abfd, ".text");
|
1999-05-03 07:29:11 +00:00
|
|
|
| new->flags = BSF_GLOBAL;
|
|
|
|
| new->value = 0x12345;
|
|
|
|
|
|
|
|
|
| ptrs[0] = new;
|
2003-06-29 10:06:40 +00:00
|
|
|
| ptrs[1] = 0;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
2003-02-14 09:31:57 +00:00
|
|
|
| bfd_set_symtab (abfd, ptrs, 1);
|
|
|
|
| bfd_close (abfd);
|
|
|
|
| return 0;
|
1999-05-03 07:29:11 +00:00
|
|
|
| }
|
|
|
|
|
|
|
|
|
| ./makesym
|
|
|
|
| nm foo
|
|
|
|
| 00012345 A dummy_symbol
|
|
|
|
|
2003-11-30 18:40:41 +00:00
|
|
|
Many formats cannot represent arbitrary symbol information; for
|
1999-05-03 07:29:11 +00:00
|
|
|
instance, the <<a.out>> object format does not allow an
|
2003-11-30 18:40:41 +00:00
|
|
|
arbitrary number of sections. A symbol pointing to a section
|
1999-05-03 07:29:11 +00:00
|
|
|
which is not one of <<.text>>, <<.data>> or <<.bss>> cannot
|
|
|
|
be described.
|
|
|
|
|
|
|
|
INODE
|
|
|
|
Mini Symbols, typedef asymbol, Writing Symbols, Symbols
|
|
|
|
SUBSECTION
|
|
|
|
Mini Symbols
|
|
|
|
|
|
|
|
Mini symbols provide read-only access to the symbol table.
|
|
|
|
They use less memory space, but require more time to access.
|
|
|
|
They can be useful for tools like nm or objdump, which may
|
|
|
|
have to handle symbol tables of extremely large executables.
|
|
|
|
|
|
|
|
The <<bfd_read_minisymbols>> function will read the symbols
|
|
|
|
into memory in an internal form. It will return a <<void *>>
|
|
|
|
pointer to a block of memory, a symbol count, and the size of
|
|
|
|
each symbol. The pointer is allocated using <<malloc>>, and
|
|
|
|
should be freed by the caller when it is no longer needed.
|
|
|
|
|
|
|
|
The function <<bfd_minisymbol_to_symbol>> will take a pointer
|
|
|
|
to a minisymbol, and a pointer to a structure returned by
|
|
|
|
<<bfd_make_empty_symbol>>, and return a <<asymbol>> structure.
|
|
|
|
The return value may or may not be the same as the value from
|
|
|
|
<<bfd_make_empty_symbol>> which was passed in.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
DOCDD
|
|
|
|
INODE
|
|
|
|
typedef asymbol, symbol handling functions, Mini Symbols, Symbols
|
|
|
|
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
SUBSECTION
|
|
|
|
typedef asymbol
|
|
|
|
|
|
|
|
An <<asymbol>> has the form:
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
CODE_FRAGMENT
|
|
|
|
|
|
|
|
.
|
Index: sim/frv/ChangeLog
2003-10-30 Andrew Cagney <cagney@redhat.com>
* traps.c: Replace "struct symbol_cache_entry" with "struct
bfd_symbol".
Index: sim/d10v/ChangeLog
2003-10-30 Andrew Cagney <cagney@redhat.com>
* simops.c: Replace "struct symbol_cache_entry" with "struct
bfd_symbol".
Index: sim/common/ChangeLog
2003-10-30 Andrew Cagney <cagney@redhat.com>
* sim-trace.c, sim-base.h: Replace "struct symbol_cache_entry"
with "struct bfd_symbol".
Index: ld/ChangeLog
2003-10-30 Andrew Cagney <cagney@redhat.com>
* emultempl/pe.em, pe-dll.c: Replace "struct symbol_cache_entry"
with "struct bfd_symbol".
Index: bfd/ChangeLog
2003-10-30 Andrew Cagney <cagney@redhat.com>
* syms.c: Replace "struct symbol_cache_entry" with "struct
bfd_symbol".
* vms.h, targets.c, section.c, reloc.c, peicode.h: Ditto.
* mipsbsd.c, elf.c, linker.c, elf-bfd.h, ecoff.c: Ditto.
* cpu-z8k.c, cpu-ns32k.c, cpu-h8500.c, bfd.c, bfd-in.h: Ditto.
* bfd-in2.h: Re-generate.
2003-10-31 05:32:46 +00:00
|
|
|
.typedef struct bfd_symbol
|
1999-05-03 07:29:11 +00:00
|
|
|
.{
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* 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.
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. 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. *}
|
2003-02-28 23:43:35 +00:00
|
|
|
. struct bfd *the_bfd; {* Use bfd_asymbol_bfd(sym) to access this field. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* The text of the symbol. The name is left alone, and not copied; the
|
|
|
|
. application may not alter it. *}
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
|
|
|
. const char *name;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* 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. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
. symvalue value;
|
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* Attributes of a symbol. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_NO_FLAGS 0x00
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* The symbol has local scope; <<static>> in <<C>>. The value
|
|
|
|
. is the offset into the section of the data. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_LOCAL (1 << 0)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* The symbol has global scope; initialized data in <<C>>. The
|
|
|
|
. value is the offset into the section of the data. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_GLOBAL (1 << 1)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* 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. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* A normal C symbol would be one of:
|
2008-12-03 14:51:00 +00:00
|
|
|
. <<BSF_LOCAL>>, <<BSF_COMMON>>, <<BSF_UNDEFINED>> or
|
2002-01-30 18:12:17 +00:00
|
|
|
. <<BSF_GLOBAL>>. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2003-11-30 18:40:41 +00:00
|
|
|
. {* The symbol is a debugging record. The value has an arbitrary
|
2002-01-30 18:12:17 +00:00
|
|
|
. meaning, unless BSF_DEBUGGING_RELOC is also set. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_DEBUGGING (1 << 2)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* The symbol denotes a function entry point. Used in ELF,
|
|
|
|
. perhaps others someday. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_FUNCTION (1 << 3)
|
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* Used by the linker. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_KEEP (1 << 5)
|
|
|
|
.#define BSF_KEEP_G (1 << 6)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* A weak global symbol, overridable without warnings by
|
|
|
|
. a regular global symbol of the same name. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_WEAK (1 << 7)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* This symbol was created to point to a section, e.g. ELF's
|
|
|
|
. STT_SECTION symbols. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_SECTION_SYM (1 << 8)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* The symbol used to be a common symbol, but now it is
|
|
|
|
. allocated. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_OLD_COMMON (1 << 9)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* 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. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_NOT_AT_END (1 << 10)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* Signal that the symbol is the label of constructor section. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_CONSTRUCTOR (1 << 11)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* 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. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_WARNING (1 << 12)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* Signal that the symbol is indirect. This symbol is an indirect
|
|
|
|
. pointer to the symbol with the same name as the next symbol. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_INDIRECT (1 << 13)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* BSF_FILE marks symbols that contain a file name. This is used
|
|
|
|
. for ELF STT_FILE symbols. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_FILE (1 << 14)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* Symbol is from dynamic linking information. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_DYNAMIC (1 << 15)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* The symbol denotes a data object. Used in ELF, and perhaps
|
|
|
|
. others someday. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_OBJECT (1 << 16)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* This symbol is a debugging symbol. The value is the offset
|
|
|
|
. into the section of the data. BSF_DEBUGGING should be set
|
|
|
|
. as well. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_DEBUGGING_RELOC (1 << 17)
|
1999-09-11 14:41:11 +00:00
|
|
|
.
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 13:12:53 +00:00
|
|
|
. {* This symbol is thread local. Used in ELF. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_THREAD_LOCAL (1 << 18)
|
* elf.c (_bfd_elf_make_section_from_shdr): Set SEC_THREAD_LOCAL
for symbols from SHF_TLS section.
(_bfd_elf_print_private_bfd_data): Add PT_TLS.
(elf_fake_sections): Set SHF_TLS for SEC_THREAD_LOCAL sections.
(map_sections_to_segments): Build PT_TLS segment if necessary.
(assign_file_positions_for_segments): Likewise.
(get_program_header_size): Account for PT_TLS segment.
(swap_out_syms): Set type of BSF_THREAD_LOCAL symbols and symbols from
SEC_THREAD_LOCAL sections to STT_TLS.
* reloc.c: Add 386 and IA-64 TLS relocs.
* section.c (SEC_THREAD_LOCAL): Define.
(SEC_CONSTRUCTOR_TEXT, SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS):
Remove.
* elflink.h (elf_link_add_object_symbols): Support .tcommon.
(size_dynamic_sections): If DF_STATIC_TLS, set DF_FLAGS
unconditionally.
(struct elf_final_link_info): Add first_tls_sec.
(elf_bfd_final_link): Set first_tls_sec.
Compute elf_hash_table (info)->tls_segment.
(elf_link_output_extsym): Handle STT_TLS symbols.
(elf_link_input_bfd): Likewise.
* syms.c (BSF_THREAD_LOCAL): Define.
* bfd-in2.h: Rebuilt.
* libbfd.h: Rebuilt.
* elf32-i386.c (elf_i386_tls_transition, dtpoff_base, tpoff,
elf_i386_mkobject, elf_i386_object_p): New functions.
(elf_howto_table): Add TLS relocs.
(elf_i386_reloc_type_lookup): Support TLS relocs.
(elf_i386_info_to_howto_rel): Likewise.
(struct elf_i386_link_hash_entry): Add tls_type.
(struct elf_i386_obj_tdata): New.
(elf_i386_hash_entry, elf_i386_tdata, elf_i386_local_got_tls_type):
New macros.
(struct elf_i386_link_hash_table): Add tls_ldm_got.
(link_hash_newfunc): Clear tls_type.
(elf_i386_check_relocs): Support TLS relocs.
(elf_i386_gc_sweep_hook): Likewise.
(allocate_dynrelocs): Likewise.
(elf_i386_size_dynamic_sections): Likewise.
(elf_i386_relocate_section): Likewise.
(elf_i386_finish_dynamic_symbol): Likewise.
(bfd_elf32_mkobject, elf_backend_object_p): Define.
* elfxx-ia64.c (struct elfNN_ia64_dyn_sym_info): Add tprel_offset,
dtpmod_offset, dtprel_offset, tprel_done, dtpmod_done, dtprel_done,
want_tprel, want_dtpmod, want_dtprel.
(elfNN_ia64_tprel_base, elfNN_ia64_dtprel_base): New functions.
(ia64_howto_table): Add TLS relocs, rename R_IA64_LTOFF_TP22 to
R_IA64_LTOFF_TPREL22.
(elf_code_to_howto_index): Add TLS relocs.
(elfNN_ia64_check_relocs): Support TLS relocs.
(allocate_global_data_got): Account for TLS .got data.
(allocate_dynrel_entries): Account for TLS dynamic relocations.
(elfNN_ia64_install_value): Supprt TLS relocs.
(set_got_entry): Support TLS relocs.
(elfNN_ia64_relocate_section): Likewise.
* config/obj-elf.c (elf_common): Renamed from obj_elf_common.
(obj_elf_common): Call elf_common.
(obj_elf_tls_common): New function.
(elf_pseudo_tab): Support .tls_common.
(special_sections): Add .tdata and .tbss.
(obj_elf_change_section): Set SEC_THREAD_LOCAL for SHF_TLS
sections.
(obj_elf_parse_section_letters): Support T in section flags (SHF_TLS).
(obj_elf_parse_section_letters): Include T in error message.
* config/tc-ppc.c (ppc_section_letter): Likewise.
* config/tc-alpha.c (alpha_elf_section_letter): Likewise.
(tc_gen_reloc): Handle SEC_THREAD_LOCAL the same way as
SEC_MERGE.
* config/tc-sparc.c (md_apply_fix3): Likewise.
* config/tc-i386.c (tc_i386_fix_adjustable): Add TLS relocs.
Define them if not BFD_ASSEMBLER.
(lex_got): Support @TLSGD, @TLSLDM, @GOTTPOFF, @TPOFF, @DTPOFF
and @NTPOFF.
(md_apply_fix3): Add TLS relocs.
* config/tc-ia64.c (enum reloc_func): Add FUNC_DTP_MODULE,
FUNC_DTP_RELATIVE, FUNC_TP_RELATIVE, FUNC_LT_DTP_MODULE,
FUNC_LT_DTP_RELATIVE, FUNC_LT_TP_RELATIVE.
(pseudo_func): Support @dtpmod(), @dtprel() and @tprel().
(ia64_elf_section_letter): Include T in error message.
(md_begin): Support TLS operators.
(md_operand): Likewise.
(ia64_gen_real_reloc_type): Support TLS relocs.
* testsuite/gas/i386/tlspic.s: New file.
* testsuite/gas/i386/tlsd.s: New file.
* testsuite/gas/i386/tlsnopic.s: New file.
* testsuite/gas/i386/tlsd.d: New file.
* testsuite/gas/i386/tlsnopic.d: New file.
* testsuite/gas/i386/tlspic.d: New file.
* testsuite/gas/i386/i386.exp: Add tlsd, tlsnopic and tlspic tests.
* testsuite/gas/ia64/tls.s: New file.
* testsuite/gas/ia64/tls.d: New file.
* testsuite/gas/ia64/ia64.exp: Add tls test.
* write.c (adjust_reloc_syms): Don't change symbols in
SEC_THREAD_LOCAL sections to STT_SECTION + addend.
* elf/common.h (PT_TLS, SHF_TLS, STT_TLS, DF_STATIC_TLS): Define.
* elf/ia64.h (R_IA64_LTOFF_TPREL22): Renamed from R_IA64_LTOFF_TP22.
* elf/i386.h: Add TLS relocs.
* scripttempl/elf.sc: Add .rel{,a}.t{bss,data}, .tdata and .tbss.
* ldlang.c (lang_add_section): Set SEC_THREAD_LOCAL for
output section if necessary. Handle .tbss.
(lang_size_sections): Clear _raw_size for .tbss section
(it allocates space in PT_TLS segment only).
* ldwrite.c (build_link_order): Build link order for .tbss too.
* readelf.c (get_segment_type): Add PT_TLS.
(get_elf_section_flags): Add SHF_TLS.
(get_dynamic_flags): Optimize. Add DF_STATIC_TLS.
(process_dynamic_segment): Use puts instead of printf.
(get_symbol_type): Support STT_TLS.
* objdump.c (dump_section_header): Remove SEC_CONSTRUCTOR_TEXT,
SEC_CONSTRUCTOR_DATA, SEC_CONSTRUCTOR_BSS.
Add SEC_THREAD_LOCAL.
2002-05-23 13:12:53 +00:00
|
|
|
.
|
2007-02-05 19:50:12 +00:00
|
|
|
. {* This symbol represents a complex relocation expression,
|
|
|
|
. with the expression tree serialized in the symbol name. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_RELC (1 << 19)
|
2007-02-05 19:50:12 +00:00
|
|
|
.
|
|
|
|
. {* This symbol represents a signed complex relocation expression,
|
|
|
|
. with the expression tree serialized in the symbol name. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_SRELC (1 << 20)
|
2007-02-05 19:50:12 +00:00
|
|
|
.
|
2008-06-30 20:51:58 +00:00
|
|
|
. {* This symbol was created by bfd_get_synthetic_symtab. *}
|
2008-12-03 14:51:00 +00:00
|
|
|
.#define BSF_SYNTHETIC (1 << 21)
|
2008-06-30 20:51:58 +00:00
|
|
|
.
|
2009-04-30 15:47:13 +00:00
|
|
|
. {* 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)
|
2009-07-23 13:00:30 +00:00
|
|
|
. {* 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)
|
2009-04-30 15:47:13 +00:00
|
|
|
.
|
1999-05-03 07:29:11 +00:00
|
|
|
. flagword flags;
|
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* 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. *}
|
2003-10-19 Andrew Cagney <cagney@redhat.com>
* targets.c: Replace "struct sec" with "struct bfd_section"
* syms.c, sparclynx.c, section.c, opncls.c: Ditto.
* libcoff-in.h, libbfd-in.h, elfxx-target.h: Ditto.
* elf.c, coffgen.c, bfd.c, bfd-in.h, aoutf1.h: Ditto.
* aout-tic30.c, aout-target.h:
* bfd-in2.h, libcoff.h, libbfd.h: Regenerate.
Index: binutils/ChangeLog
2003-10-19 Andrew Cagney <cagney@redhat.com>
* coffgrok.h (coff_section): Replace 'struct sec" with "struct
bfd_section".
Index: gdb/ChangeLog
2003-10-19 Andrew Cagney <cagney@redhat.com>
* symtab.c: Replace "struct sec" with "struct bfd_section".
* objfiles.c, linespec.c, blockframe.c, block.c: Ditto.
Index: ld/ChangeLog
2003-10-19 Andrew Cagney <cagney@redhat.com>
* pe-dll.c: Replace "struct sec" with "struct bfd_section".
Index: sim/common/ChangeLog
2003-10-19 Andrew Cagney <cagney@redhat.com>
* sim-base.h: Replace "struct sec" with "struct bfd_section".
2003-10-20 14:38:46 +00:00
|
|
|
. struct bfd_section *section;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* Back end special data. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
. union
|
|
|
|
. {
|
2003-06-29 10:06:40 +00:00
|
|
|
. void *p;
|
1999-05-03 07:29:11 +00:00
|
|
|
. bfd_vma i;
|
2002-01-30 18:12:17 +00:00
|
|
|
. }
|
|
|
|
. udata;
|
|
|
|
.}
|
|
|
|
.asymbol;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "sysdep.h"
|
2007-04-26 14:47:00 +00:00
|
|
|
#include "bfd.h"
|
1999-05-03 07:29:11 +00:00
|
|
|
#include "libbfd.h"
|
2001-09-19 05:33:36 +00:00
|
|
|
#include "safe-ctype.h"
|
1999-05-03 07:29:11 +00:00
|
|
|
#include "bfdlink.h"
|
|
|
|
#include "aout/stab_gnu.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
DOCDD
|
|
|
|
INODE
|
|
|
|
symbol handling functions, , typedef asymbol, Symbols
|
|
|
|
SUBSECTION
|
|
|
|
Symbol handling functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_get_symtab_upper_bound
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Return the number of bytes required to store a vector of pointers
|
|
|
|
to <<asymbols>> for all the symbols in the BFD @var{abfd},
|
|
|
|
including a terminal NULL pointer. If there are no symbols in
|
|
|
|
the BFD, then return 0. If an error occurs, return -1.
|
|
|
|
|
|
|
|
.#define bfd_get_symtab_upper_bound(abfd) \
|
|
|
|
. BFD_SEND (abfd, _bfd_get_symtab_upper_bound, (abfd))
|
2002-01-30 18:12:17 +00:00
|
|
|
.
|
1999-05-03 07:29:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_is_local_label
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-02-14 09:31:57 +00:00
|
|
|
bfd_boolean bfd_is_local_label (bfd *abfd, asymbol *sym);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
2002-11-30 08:39:46 +00:00
|
|
|
Return TRUE if the given symbol @var{sym} in the BFD @var{abfd} is
|
|
|
|
a compiler generated local label, else return FALSE.
|
1999-05-03 07:29:11 +00:00
|
|
|
*/
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_is_local_label (bfd *abfd, asymbol *sym)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2001-07-05 18:27:55 +00:00
|
|
|
/* The BSF_SECTION_SYM check is needed for IA-64, where every label that
|
|
|
|
starts with '.' is local. This would accidentally catch section names
|
|
|
|
if we didn't reject them here. */
|
2004-10-08 05:53:59 +00:00
|
|
|
if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_FILE | BSF_SECTION_SYM)) != 0)
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
if (sym->name == NULL)
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
return bfd_is_local_label_name (abfd, sym->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_is_local_label_name
|
|
|
|
|
|
|
|
SYNOPSIS
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean bfd_is_local_label_name (bfd *abfd, const char *name);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
2002-11-30 08:39:46 +00:00
|
|
|
Return TRUE if a symbol with the name @var{name} in the BFD
|
1999-05-03 07:29:11 +00:00
|
|
|
@var{abfd} is a compiler generated local label, else return
|
2002-11-30 08:39:46 +00:00
|
|
|
FALSE. This just checks whether the name has the form of a
|
1999-05-03 07:29:11 +00:00
|
|
|
local label.
|
|
|
|
|
|
|
|
.#define bfd_is_local_label_name(abfd, name) \
|
2003-06-29 10:06:40 +00:00
|
|
|
. BFD_SEND (abfd, _bfd_is_local_label_name, (abfd, name))
|
2002-01-30 18:12:17 +00:00
|
|
|
.
|
1999-05-03 07:29:11 +00:00
|
|
|
*/
|
|
|
|
|
2004-10-08 14:54:04 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_is_target_special_symbol
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
bfd_boolean bfd_is_target_special_symbol (bfd *abfd, asymbol *sym);
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Return TRUE iff a symbol @var{sym} in the BFD @var{abfd} is something
|
|
|
|
special to the particular target represented by the BFD. Such symbols
|
|
|
|
should normally not be mentioned to the user.
|
|
|
|
|
|
|
|
.#define bfd_is_target_special_symbol(abfd, sym) \
|
|
|
|
. BFD_SEND (abfd, _bfd_is_target_special_symbol, (abfd, sym))
|
|
|
|
.
|
|
|
|
*/
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_canonicalize_symtab
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Read the symbols from the BFD @var{abfd}, and fills in
|
|
|
|
the vector @var{location} with pointers to the symbols and
|
|
|
|
a trailing NULL.
|
|
|
|
Return the actual number of symbol pointers, not
|
|
|
|
including the NULL.
|
|
|
|
|
|
|
|
.#define bfd_canonicalize_symtab(abfd, location) \
|
2003-06-29 10:06:40 +00:00
|
|
|
. BFD_SEND (abfd, _bfd_canonicalize_symtab, (abfd, location))
|
2002-01-30 18:12:17 +00:00
|
|
|
.
|
1999-05-03 07:29:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_set_symtab
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_boolean bfd_set_symtab
|
|
|
|
(bfd *abfd, asymbol **location, unsigned int count);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Arrange that when the output BFD @var{abfd} is closed,
|
|
|
|
the table @var{location} of @var{count} pointers to symbols
|
|
|
|
will be written.
|
|
|
|
*/
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_set_symtab (bfd *abfd, asymbol **location, unsigned int symcount)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2003-06-29 10:06:40 +00:00
|
|
|
if (abfd->format != bfd_object || bfd_read_p (abfd))
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
bfd_set_error (bfd_error_invalid_operation);
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bfd_get_outsymbols (abfd) = location;
|
|
|
|
bfd_get_symcount (abfd) = symcount;
|
2002-11-30 08:39:46 +00:00
|
|
|
return TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_print_symbol_vandf
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
void bfd_print_symbol_vandf (bfd *abfd, void *file, asymbol *symbol);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Print the value and flags of the @var{symbol} supplied to the
|
|
|
|
stream @var{file}.
|
|
|
|
*/
|
|
|
|
void
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_print_symbol_vandf (bfd *abfd, void *arg, asymbol *symbol)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2009-09-09 21:38:59 +00:00
|
|
|
FILE *file = (FILE *) arg;
|
2003-02-14 09:31:57 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
flagword type = symbol->flags;
|
2003-02-14 09:31:57 +00:00
|
|
|
|
2003-06-29 10:06:40 +00:00
|
|
|
if (symbol->section != NULL)
|
|
|
|
bfd_fprintf_vma (abfd, file, symbol->value + symbol->section->vma);
|
1999-05-03 07:29:11 +00:00
|
|
|
else
|
2003-02-14 09:31:57 +00:00
|
|
|
bfd_fprintf_vma (abfd, file, symbol->value);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
/* This presumes that a symbol can not be both BSF_DEBUGGING and
|
|
|
|
BSF_DYNAMIC, nor more than one of BSF_FUNCTION, BSF_FILE, and
|
|
|
|
BSF_OBJECT. */
|
|
|
|
fprintf (file, " %c%c%c%c%c%c%c",
|
|
|
|
((type & BSF_LOCAL)
|
|
|
|
? (type & BSF_GLOBAL) ? '!' : 'l'
|
2009-07-23 13:00:30 +00:00
|
|
|
: (type & BSF_GLOBAL) ? 'g'
|
|
|
|
: (type & BSF_GNU_UNIQUE) ? 'u' : ' '),
|
1999-05-03 07:29:11 +00:00
|
|
|
(type & BSF_WEAK) ? 'w' : ' ',
|
|
|
|
(type & BSF_CONSTRUCTOR) ? 'C' : ' ',
|
|
|
|
(type & BSF_WARNING) ? 'W' : ' ',
|
2009-04-30 15:47:13 +00:00
|
|
|
(type & BSF_INDIRECT) ? 'I' : (type & BSF_GNU_INDIRECT_FUNCTION) ? 'i' : ' ',
|
1999-05-03 07:29:11 +00:00
|
|
|
(type & BSF_DEBUGGING) ? 'd' : (type & BSF_DYNAMIC) ? 'D' : ' ',
|
|
|
|
((type & BSF_FUNCTION)
|
|
|
|
? 'F'
|
|
|
|
: ((type & BSF_FILE)
|
|
|
|
? 'f'
|
|
|
|
: ((type & BSF_OBJECT) ? 'O' : ' '))));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_make_empty_symbol
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Create a new <<asymbol>> structure for the BFD @var{abfd}
|
|
|
|
and return a pointer to it.
|
|
|
|
|
|
|
|
This routine is necessary because each back end has private
|
|
|
|
information surrounding the <<asymbol>>. Building your own
|
|
|
|
<<asymbol>> and pointing to it will not create the private
|
|
|
|
information, and will cause problems later on.
|
|
|
|
|
|
|
|
.#define bfd_make_empty_symbol(abfd) \
|
2003-06-29 10:06:40 +00:00
|
|
|
. BFD_SEND (abfd, _bfd_make_empty_symbol, (abfd))
|
2002-01-30 18:12:17 +00:00
|
|
|
.
|
1999-05-03 07:29:11 +00:00
|
|
|
*/
|
|
|
|
|
2002-01-06 07:30:35 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
_bfd_generic_make_empty_symbol
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
asymbol *_bfd_generic_make_empty_symbol (bfd *);
|
2002-01-06 07:30:35 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Create a new <<asymbol>> structure for the BFD @var{abfd}
|
|
|
|
and return a pointer to it. Used by core file routines,
|
|
|
|
binary back-end and anywhere else where no private info
|
|
|
|
is needed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
asymbol *
|
2003-06-29 10:06:40 +00:00
|
|
|
_bfd_generic_make_empty_symbol (bfd *abfd)
|
2002-01-06 07:30:35 +00:00
|
|
|
{
|
|
|
|
bfd_size_type amt = sizeof (asymbol);
|
Updated sources to avoid using the identifier name "new", which is a
keyword in c++.
* bfd/aoutx.h (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol.
* bfd/coffgen.c (coff_make_empty_symbol)
(coff_bfd_make_debug_symbol): Rename variable new to new_symbol.
* bfd/cpu-ia64-opc.c (ext_reg, ins_imms_scaled): Rename variable
new to new_insn.
* bfd/doc/chew.c (newentry, add_intrinsic): Rename variable new to
new_d.
* bfd/ecoff.c (_bfd_ecoff_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/elf32-m68k.c (elf_m68k_get_got_entry_type): Rename argument
new to new_reloc.
* bfd/hash.c (bfd_hash_lookup): Rename variable new to new_string.
* bfd/ieee.c (ieee_make_empty_symbol): Rename variable new to
new_symbol.
* bfd/linker.c (bfd_new_link_order): Rename variable new to
new_lo.
* bfd/mach-o.c (bfd_mach_o_sizeof_headers): Rename variable new to
symbol.
* bfd/oasys.c (oasys_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/pdp11.c (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol_type.
* bfd/plugin.c (bfd_plugin_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/rs6000-core.c (CoreHdr, VmInfo): Rename union member new to
new_dump.
(read_hdr, rs6000coff_core_p)
(rs6000coff_core_file_matches_executable_p)
(rs6000coff_core_file_failing_command)
(rs6000coff_core_file_failing_signal): Updated function to use new
union member name.
* bfd/som.c (som_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/syms.c (_bfd_generic_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/tekhex.c (first_phase, tekhex_make_empty_symbol): Rename
variable new to new_symbol.
* binutils/nlmconv.c (main): Rename variable new to new_name.
* gas/config/tc-arm.c (insert_reg_alias): Rename variable new to
new_reg.
* gas/config/tc-dlx.c (parse_operand): Rename variable new to
new_pos.
* gas/config/tc-ia64.c (ia64_gen_real_reloc_type): Rename variable
new to newr.
* gas/config/tc-mcore.c (parse_exp, parse_imm): Rename variable
new to new_pointer.
* gas/config/tc-microblaze.c (parse_exp, parse_imm, check_got):
Change name from new to new_pointer.
* gas/config/tc-or32.c (parse_operand): Rename variable new to
new_pointer.
* gas/config/tc-pdp11.c (md_assemble): Rename variable new to
new_pointer.
* gas/config/tc-pj.c (alias): Change argument new to new_name.
* gas/config/tc-score.c (s3_build_score_ops_hsh): Rename variable
new to new_opcode. (s3_build_dependency_insn_hsh) Rename variable
new to new_i2n. (s3_convert): Rename variables old and new to
r_old and r_new.
* gas/config/tc-score7.c (s7_build_score_ops_hsh): Rename variable
new to new_opcode. (s7_build_dependency_insn_hsh): Rename variable
new to new_i2d. (s7_b32_relax_to_b16, s7_convert_frag): Rename
variables old and new to r_old and r_new.
* gas/config/tc-sh.c (parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-sh64.c (shmedia_parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-tic4x.c (tic4x_operand_parse): Rename variable new
to new_pointer.
* gas/config/tc-z8k.c (parse_exp): Rename variable new to
new_pointer.
* gas/listing.c (listing_newline): Rename variable new to new_i.
* ld/ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop)
(exp_trinop, exp_unop, exp_nameop, exp_assop): Rename variable new
to new_e.
* ld/ldfile.c (ldfile_add_library_path): Rename variable new to
new_dirs. (ldfile_add_arch): Rename variable new to new_arch.
* ld/ldlang.c (new_statement, lang_final, lang_add_wild)
(lang_target, lang_add_fill, lang_add_data, lang_add_assignment)
(lang_add_insert): Rename variable new to new_stmt. (new_afile):
Added missing cast. (lang_memory_region_lookup): Rename variable
new to new_region. (init_os): Rename variable new to
new_userdata. (lang_add_section): Rename variable new to
new_section. (ldlang_add_undef): Rename variable new to
new_undef. (realsymbol): Rename variable new to new_name.
* opcodes/z8kgen.c (internal, gas): Rename variable new to new_op.
Updated sources to avoid using the identifier name "template",
which is a keyword in c++.
* bfd/elf32-arm.c (struct stub_def): Rename member template to
template_sequence. (arm_build_one_stub,
find_stub_size_and_template, arm_size_one_stub, arm_map_one_stub):
Rename variable template to template_sequence.
* bfd/elfxx-ia64.c (elfNN_ia64_relax_br, elfNN_ia64_relax_brl):
Rename variable template to template_val.
* gas/config/tc-arm.c (struct asm_cond, struct asm_psr, struct
asm_barrier_opt): Change member template to
template_name. (md_begin): Update code to reflect new member
names.
* gas/config/tc-i386.c (struct templates, struct _i386_insn)
(match_template, cpu_flags_match, match_reg_size, match_mem_size)
(operand_size_match, md_begin, i386_print_statistics, pi)
(build_vex_prefix, md_assemble, parse_insn, optimize_imm)
(optimize_disp): Updated code to use new names. (parse_insn):
Added casts.
* gas/config/tc-ia64.c (dot_template, emit_one_bundle): Updated
code to use new names.
* gas/config/tc-score.c (struct s3_asm_opcode): Renamed member
template to template_name. (s3_parse_16_32_inst, s3_parse_48_inst,
s3_do_macro_ldst_label, s3_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-score7.c (struct s7_asm_opcode): Renamed member
template to template_name. (s7_parse_16_32_inst,
s7_do_macro_ldst_label, s7_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-tic30.c (md_begin, struct tic30_insn)
(md_assemble): Update code to use new names.
* gas/config/tc-tic54x.c (struct _tic54x_insn, md_begin)
(optimize_insn, tic54x_parse_insn, next_line_shows_parallel):
Update code to use new names.
* include/opcode/tic30.h (template): Rename type template to
insn_template. Updated code to use new name.
* include/opcode/tic54x.h (template): Rename type template to
insn_template.
* opcodes/cris-dis.c (bytes_to_skip): Update code to use new name.
* opcodes/i386-dis.c (putop): Update code to use new name.
* opcodes/i386-gen.c (process_i386_opcodes): Update code to use
new name.
* opcodes/i386-opc.h (struct template): Rename struct template to
insn_template. Update code accordingly.
* opcodes/i386-tbl.h (i386_optab): Update type to use new name.
* opcodes/ia64-dis.c (print_insn_ia64): Rename variable template
to template_val.
* opcodes/tic30-dis.c (struct instruction, get_tic30_instruction):
Update code to use new name.
* opcodes/tic54x-dis.c (has_lkaddr, get_insn_size)
(print_parallel_instruction, print_insn_tic54x, tic54x_get_insn):
Update code to use new name.
* opcodes/tic54x-opc.c (tic54x_unknown_opcode, tic54x_optab):
Update type to new name.
2009-08-29 22:11:02 +00:00
|
|
|
asymbol *new_symbol = (asymbol *) bfd_zalloc (abfd, amt);
|
|
|
|
if (new_symbol)
|
|
|
|
new_symbol->the_bfd = abfd;
|
|
|
|
return new_symbol;
|
2002-01-06 07:30:35 +00:00
|
|
|
}
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_make_debug_symbol
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Create a new <<asymbol>> structure for the BFD @var{abfd},
|
|
|
|
to be used as a debugging symbol. Further details of its use have
|
|
|
|
yet to be worked out.
|
|
|
|
|
|
|
|
.#define bfd_make_debug_symbol(abfd,ptr,size) \
|
2003-06-29 10:06:40 +00:00
|
|
|
. BFD_SEND (abfd, _bfd_make_debug_symbol, (abfd, ptr, size))
|
2002-01-30 18:12:17 +00:00
|
|
|
.
|
1999-05-03 07:29:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct section_to_type
|
|
|
|
{
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
|
|
|
const char *section;
|
1999-05-03 07:29:11 +00:00
|
|
|
char type;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Map section names to POSIX/BSD single-character symbol types.
|
|
|
|
This table is probably incomplete. It is sorted for convenience of
|
|
|
|
adding entries. Since it is so short, a linear search is used. */
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
|
|
|
static const struct section_to_type stt[] =
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
{".bss", 'b'},
|
2002-02-19 16:33:04 +00:00
|
|
|
{"code", 't'}, /* MRI .text */
|
1999-05-03 07:29:11 +00:00
|
|
|
{".data", 'd'},
|
2002-02-19 16:33:04 +00:00
|
|
|
{"*DEBUG*", 'N'},
|
|
|
|
{".debug", 'N'}, /* MSVC's .debug (non-standard debug syms) */
|
|
|
|
{".drectve", 'i'}, /* MSVC's .drective section */
|
|
|
|
{".edata", 'e'}, /* MSVC's .edata (export) section */
|
|
|
|
{".fini", 't'}, /* ELF fini section */
|
|
|
|
{".idata", 'i'}, /* MSVC's .idata (import) section */
|
|
|
|
{".init", 't'}, /* ELF init section */
|
|
|
|
{".pdata", 'p'}, /* MSVC's .pdata (stack unwind) section */
|
1999-05-03 07:29:11 +00:00
|
|
|
{".rdata", 'r'}, /* Read only data. */
|
|
|
|
{".rodata", 'r'}, /* Read only data. */
|
|
|
|
{".sbss", 's'}, /* Small BSS (uninitialized data). */
|
|
|
|
{".scommon", 'c'}, /* Small common. */
|
|
|
|
{".sdata", 'g'}, /* Small initialized data. */
|
|
|
|
{".text", 't'},
|
2002-02-19 16:33:04 +00:00
|
|
|
{"vars", 'd'}, /* MRI .data */
|
|
|
|
{"zerovars", 'b'}, /* MRI .bss */
|
1999-05-03 07:29:11 +00:00
|
|
|
{0, 0}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Return the single-character symbol type corresponding to
|
2000-12-20 00:21:57 +00:00
|
|
|
section S, or '?' for an unknown COFF section.
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
Check for any leading string which matches, so .text5 returns
|
|
|
|
't' as well as .text */
|
|
|
|
|
|
|
|
static char
|
2003-06-29 10:06:40 +00:00
|
|
|
coff_section_type (const char *s)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
|
|
|
const struct section_to_type *t;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2000-12-20 00:21:57 +00:00
|
|
|
for (t = &stt[0]; t->section; t++)
|
1999-05-03 07:29:11 +00:00
|
|
|
if (!strncmp (s, t->section, strlen (t->section)))
|
|
|
|
return t->type;
|
|
|
|
|
|
|
|
return '?';
|
|
|
|
}
|
|
|
|
|
2002-07-05 20:29:38 +00:00
|
|
|
/* Return the single-character symbol type corresponding to section
|
|
|
|
SECTION, or '?' for an unknown section. This uses section flags to
|
|
|
|
identify sections.
|
|
|
|
|
|
|
|
FIXME These types are unhandled: c, i, e, p. If we handled these also,
|
|
|
|
we could perhaps obsolete coff_section_type. */
|
|
|
|
|
|
|
|
static char
|
2003-10-19 Andrew Cagney <cagney@redhat.com>
* targets.c: Replace "struct sec" with "struct bfd_section"
* syms.c, sparclynx.c, section.c, opncls.c: Ditto.
* libcoff-in.h, libbfd-in.h, elfxx-target.h: Ditto.
* elf.c, coffgen.c, bfd.c, bfd-in.h, aoutf1.h: Ditto.
* aout-tic30.c, aout-target.h:
* bfd-in2.h, libcoff.h, libbfd.h: Regenerate.
Index: binutils/ChangeLog
2003-10-19 Andrew Cagney <cagney@redhat.com>
* coffgrok.h (coff_section): Replace 'struct sec" with "struct
bfd_section".
Index: gdb/ChangeLog
2003-10-19 Andrew Cagney <cagney@redhat.com>
* symtab.c: Replace "struct sec" with "struct bfd_section".
* objfiles.c, linespec.c, blockframe.c, block.c: Ditto.
Index: ld/ChangeLog
2003-10-19 Andrew Cagney <cagney@redhat.com>
* pe-dll.c: Replace "struct sec" with "struct bfd_section".
Index: sim/common/ChangeLog
2003-10-19 Andrew Cagney <cagney@redhat.com>
* sim-base.h: Replace "struct sec" with "struct bfd_section".
2003-10-20 14:38:46 +00:00
|
|
|
decode_section_type (const struct bfd_section *section)
|
2002-07-05 20:29:38 +00:00
|
|
|
{
|
|
|
|
if (section->flags & SEC_CODE)
|
|
|
|
return 't';
|
|
|
|
if (section->flags & SEC_DATA)
|
|
|
|
{
|
|
|
|
if (section->flags & SEC_READONLY)
|
|
|
|
return 'r';
|
|
|
|
else if (section->flags & SEC_SMALL_DATA)
|
|
|
|
return 'g';
|
|
|
|
else
|
|
|
|
return 'd';
|
|
|
|
}
|
|
|
|
if ((section->flags & SEC_HAS_CONTENTS) == 0)
|
|
|
|
{
|
|
|
|
if (section->flags & SEC_SMALL_DATA)
|
|
|
|
return 's';
|
|
|
|
else
|
|
|
|
return 'b';
|
|
|
|
}
|
|
|
|
if (section->flags & SEC_DEBUGGING)
|
|
|
|
return 'N';
|
2003-06-29 10:06:40 +00:00
|
|
|
if ((section->flags & SEC_HAS_CONTENTS) && (section->flags & SEC_READONLY))
|
2003-06-03 17:45:49 +00:00
|
|
|
return 'n';
|
2002-07-05 20:29:38 +00:00
|
|
|
|
|
|
|
return '?';
|
|
|
|
}
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_decode_symclass
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Return a character corresponding to the symbol
|
|
|
|
class of @var{symbol}, or '?' for an unknown class.
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-02-14 09:31:57 +00:00
|
|
|
int bfd_decode_symclass (asymbol *symbol);
|
1999-05-03 07:29:11 +00:00
|
|
|
*/
|
|
|
|
int
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_decode_symclass (asymbol *symbol)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
char c;
|
|
|
|
|
2007-07-26 18:53:51 +00:00
|
|
|
if (symbol->section && bfd_is_com_section (symbol->section))
|
1999-05-03 07:29:11 +00:00
|
|
|
return 'C';
|
|
|
|
if (bfd_is_und_section (symbol->section))
|
1999-09-06 18:44:56 +00:00
|
|
|
{
|
|
|
|
if (symbol->flags & BSF_WEAK)
|
2000-01-28 01:06:37 +00:00
|
|
|
{
|
|
|
|
/* If weak, determine if it's specifically an object
|
|
|
|
or non-object weak. */
|
|
|
|
if (symbol->flags & BSF_OBJECT)
|
|
|
|
return 'v';
|
|
|
|
else
|
|
|
|
return 'w';
|
|
|
|
}
|
1999-09-06 18:44:56 +00:00
|
|
|
else
|
|
|
|
return 'U';
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
if (bfd_is_ind_section (symbol->section))
|
|
|
|
return 'I';
|
2009-04-30 15:47:13 +00:00
|
|
|
if (symbol->flags & BSF_GNU_INDIRECT_FUNCTION)
|
|
|
|
return 'i';
|
1999-05-03 07:29:11 +00:00
|
|
|
if (symbol->flags & BSF_WEAK)
|
2000-01-28 01:06:37 +00:00
|
|
|
{
|
|
|
|
/* If weak, determine if it's specifically an object
|
|
|
|
or non-object weak. */
|
|
|
|
if (symbol->flags & BSF_OBJECT)
|
|
|
|
return 'V';
|
|
|
|
else
|
|
|
|
return 'W';
|
|
|
|
}
|
2009-07-23 13:00:30 +00:00
|
|
|
if (symbol->flags & BSF_GNU_UNIQUE)
|
|
|
|
return 'u';
|
1999-05-03 07:29:11 +00:00
|
|
|
if (!(symbol->flags & (BSF_GLOBAL | BSF_LOCAL)))
|
|
|
|
return '?';
|
|
|
|
|
|
|
|
if (bfd_is_abs_section (symbol->section))
|
|
|
|
c = 'a';
|
|
|
|
else if (symbol->section)
|
2002-07-05 20:29:38 +00:00
|
|
|
{
|
|
|
|
c = coff_section_type (symbol->section->name);
|
|
|
|
if (c == '?')
|
|
|
|
c = decode_section_type (symbol->section);
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
else
|
|
|
|
return '?';
|
|
|
|
if (symbol->flags & BSF_GLOBAL)
|
2001-09-19 05:33:36 +00:00
|
|
|
c = TOUPPER (c);
|
1999-05-03 07:29:11 +00:00
|
|
|
return c;
|
|
|
|
|
|
|
|
/* We don't have to handle these cases just yet, but we will soon:
|
|
|
|
N_SETV: 'v';
|
|
|
|
N_SETA: 'l';
|
|
|
|
N_SETT: 'x';
|
|
|
|
N_SETD: 'z';
|
|
|
|
N_SETB: 's';
|
|
|
|
N_INDR: 'i';
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2000-01-28 01:06:37 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
2000-12-20 00:21:57 +00:00
|
|
|
bfd_is_undefined_symclass
|
2000-01-28 01:06:37 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Returns non-zero if the class symbol returned by
|
|
|
|
bfd_decode_symclass represents an undefined symbol.
|
|
|
|
Returns zero otherwise.
|
|
|
|
|
|
|
|
SYNOPSIS
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean bfd_is_undefined_symclass (int symclass);
|
2000-01-28 01:06:37 +00:00
|
|
|
*/
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_is_undefined_symclass (int symclass)
|
2000-01-28 01:06:37 +00:00
|
|
|
{
|
2002-11-30 08:39:46 +00:00
|
|
|
return symclass == 'U' || symclass == 'w' || symclass == 'v';
|
2000-01-28 01:06:37 +00:00
|
|
|
}
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_symbol_info
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Fill in the basic info about symbol that nm needs.
|
|
|
|
Additional info may be added by the back-ends after
|
|
|
|
calling this function.
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-02-14 09:31:57 +00:00
|
|
|
void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
|
1999-05-03 07:29:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_symbol_info (asymbol *symbol, symbol_info *ret)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
ret->type = bfd_decode_symclass (symbol);
|
2000-12-20 00:21:57 +00:00
|
|
|
|
2000-01-28 01:06:37 +00:00
|
|
|
if (bfd_is_undefined_symclass (ret->type))
|
1999-05-03 07:29:11 +00:00
|
|
|
ret->value = 0;
|
2000-01-28 01:06:37 +00:00
|
|
|
else
|
|
|
|
ret->value = symbol->value + symbol->section->vma;
|
2000-12-20 00:21:57 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
ret->name = symbol->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_copy_private_symbol_data
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_boolean bfd_copy_private_symbol_data
|
|
|
|
(bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Copy private symbol information from @var{isym} in the BFD
|
|
|
|
@var{ibfd} to the symbol @var{osym} in the BFD @var{obfd}.
|
2002-11-30 08:39:46 +00:00
|
|
|
Return <<TRUE>> on success, <<FALSE>> on error. Possible error
|
1999-05-03 07:29:11 +00:00
|
|
|
returns are:
|
|
|
|
|
|
|
|
o <<bfd_error_no_memory>> -
|
|
|
|
Not enough memory exists to create private data for @var{osec}.
|
|
|
|
|
|
|
|
.#define bfd_copy_private_symbol_data(ibfd, isymbol, obfd, osymbol) \
|
2003-06-29 10:06:40 +00:00
|
|
|
. BFD_SEND (obfd, _bfd_copy_private_symbol_data, \
|
|
|
|
. (ibfd, isymbol, obfd, osymbol))
|
2002-01-30 18:12:17 +00:00
|
|
|
.
|
1999-05-03 07:29:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* The generic version of the function which returns mini symbols.
|
|
|
|
This is used when the backend does not provide a more efficient
|
|
|
|
version. It just uses BFD asymbol structures as mini symbols. */
|
|
|
|
|
|
|
|
long
|
2003-06-29 10:06:40 +00:00
|
|
|
_bfd_generic_read_minisymbols (bfd *abfd,
|
|
|
|
bfd_boolean dynamic,
|
|
|
|
void **minisymsp,
|
|
|
|
unsigned int *sizep)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
long storage;
|
|
|
|
asymbol **syms = NULL;
|
|
|
|
long symcount;
|
|
|
|
|
|
|
|
if (dynamic)
|
|
|
|
storage = bfd_get_dynamic_symtab_upper_bound (abfd);
|
|
|
|
else
|
|
|
|
storage = bfd_get_symtab_upper_bound (abfd);
|
|
|
|
if (storage < 0)
|
|
|
|
goto error_return;
|
2001-12-12 19:05:26 +00:00
|
|
|
if (storage == 0)
|
|
|
|
return 0;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2009-09-09 21:38:59 +00:00
|
|
|
syms = (asymbol **) bfd_malloc (storage);
|
1999-05-03 07:29:11 +00:00
|
|
|
if (syms == NULL)
|
|
|
|
goto error_return;
|
|
|
|
|
|
|
|
if (dynamic)
|
|
|
|
symcount = bfd_canonicalize_dynamic_symtab (abfd, syms);
|
|
|
|
else
|
|
|
|
symcount = bfd_canonicalize_symtab (abfd, syms);
|
|
|
|
if (symcount < 0)
|
|
|
|
goto error_return;
|
|
|
|
|
2003-06-29 10:06:40 +00:00
|
|
|
*minisymsp = syms;
|
1999-05-03 07:29:11 +00:00
|
|
|
*sizep = sizeof (asymbol *);
|
|
|
|
return symcount;
|
|
|
|
|
|
|
|
error_return:
|
2002-08-22 16:12:00 +00:00
|
|
|
bfd_set_error (bfd_error_no_symbols);
|
1999-05-03 07:29:11 +00:00
|
|
|
if (syms != NULL)
|
|
|
|
free (syms);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The generic version of the function which converts a minisymbol to
|
|
|
|
an asymbol. We don't worry about the sym argument we are passed;
|
|
|
|
we just return the asymbol the minisymbol points to. */
|
|
|
|
|
|
|
|
asymbol *
|
2003-06-29 10:06:40 +00:00
|
|
|
_bfd_generic_minisymbol_to_symbol (bfd *abfd ATTRIBUTE_UNUSED,
|
|
|
|
bfd_boolean dynamic ATTRIBUTE_UNUSED,
|
|
|
|
const void *minisym,
|
|
|
|
asymbol *sym ATTRIBUTE_UNUSED)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
return *(asymbol **) minisym;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Look through stabs debugging information in .stab and .stabstr
|
|
|
|
sections to find the source file and line closest to a desired
|
|
|
|
location. This is used by COFF and ELF targets. It sets *pfound
|
2002-11-30 08:39:46 +00:00
|
|
|
to TRUE if it finds some information. The *pinfo field is used to
|
1999-05-03 07:29:11 +00:00
|
|
|
pass cached information in and out of this routine; this first time
|
|
|
|
the routine is called for a BFD, *pinfo should be NULL. The value
|
|
|
|
placed in *pinfo should be saved with the BFD, and passed back each
|
|
|
|
time this function is called. */
|
|
|
|
|
|
|
|
/* We use a cache by default. */
|
|
|
|
|
|
|
|
#define ENABLE_CACHING
|
|
|
|
|
|
|
|
/* We keep an array of indexentry structures to record where in the
|
|
|
|
stabs section we should look to find line number information for a
|
|
|
|
particular address. */
|
|
|
|
|
|
|
|
struct indexentry
|
|
|
|
{
|
|
|
|
bfd_vma val;
|
|
|
|
bfd_byte *stab;
|
|
|
|
bfd_byte *str;
|
|
|
|
char *directory_name;
|
|
|
|
char *file_name;
|
|
|
|
char *function_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Compare two indexentry structures. This is called via qsort. */
|
|
|
|
|
|
|
|
static int
|
2003-06-29 10:06:40 +00:00
|
|
|
cmpindexentry (const void *a, const void *b)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2009-09-09 21:38:59 +00:00
|
|
|
const struct indexentry *contestantA = (const struct indexentry *) a;
|
|
|
|
const struct indexentry *contestantB = (const struct indexentry *) b;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
if (contestantA->val < contestantB->val)
|
|
|
|
return -1;
|
|
|
|
else if (contestantA->val > contestantB->val)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* A pointer to this structure is stored in *pinfo. */
|
|
|
|
|
|
|
|
struct stab_find_info
|
|
|
|
{
|
|
|
|
/* The .stab section. */
|
|
|
|
asection *stabsec;
|
|
|
|
/* The .stabstr section. */
|
|
|
|
asection *strsec;
|
|
|
|
/* The contents of the .stab section. */
|
|
|
|
bfd_byte *stabs;
|
|
|
|
/* The contents of the .stabstr section. */
|
|
|
|
bfd_byte *strs;
|
|
|
|
|
|
|
|
/* A table that indexes stabs by memory address. */
|
|
|
|
struct indexentry *indextable;
|
|
|
|
/* The number of entries in indextable. */
|
|
|
|
int indextablesize;
|
|
|
|
|
|
|
|
#ifdef ENABLE_CACHING
|
|
|
|
/* Cached values to restart quickly. */
|
|
|
|
struct indexentry *cached_indexentry;
|
|
|
|
bfd_vma cached_offset;
|
|
|
|
bfd_byte *cached_stab;
|
|
|
|
char *cached_file_name;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Saved ptr to malloc'ed filename. */
|
|
|
|
char *filename;
|
|
|
|
};
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean
|
2003-06-29 10:06:40 +00:00
|
|
|
_bfd_stab_section_find_nearest_line (bfd *abfd,
|
|
|
|
asymbol **symbols,
|
|
|
|
asection *section,
|
|
|
|
bfd_vma offset,
|
|
|
|
bfd_boolean *pfound,
|
|
|
|
const char **pfilename,
|
|
|
|
const char **pfnname,
|
|
|
|
unsigned int *pline,
|
|
|
|
void **pinfo)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
struct stab_find_info *info;
|
|
|
|
bfd_size_type stabsize, strsize;
|
1999-07-11 19:49:48 +00:00
|
|
|
bfd_byte *stab, *str;
|
|
|
|
bfd_byte *last_stab = NULL;
|
1999-05-03 07:29:11 +00:00
|
|
|
bfd_size_type stroff;
|
|
|
|
struct indexentry *indexentry;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
|
|
|
char *file_name;
|
|
|
|
char *directory_name;
|
1999-05-03 07:29:11 +00:00
|
|
|
int saw_fun;
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean saw_line, saw_func;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
*pfound = FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
*pfilename = bfd_get_filename (abfd);
|
|
|
|
*pfnname = NULL;
|
|
|
|
*pline = 0;
|
|
|
|
|
|
|
|
/* Stabs entries use a 12 byte format:
|
|
|
|
4 byte string table index
|
|
|
|
1 byte stab type
|
|
|
|
1 byte stab other field
|
|
|
|
2 byte stab desc field
|
|
|
|
4 byte stab value
|
|
|
|
FIXME: This will have to change for a 64 bit object format.
|
|
|
|
|
|
|
|
The stabs symbols are divided into compilation units. For the
|
|
|
|
first entry in each unit, the type of 0, the value is the length
|
|
|
|
of the string table for this unit, and the desc field is the
|
|
|
|
number of stabs symbols for this unit. */
|
|
|
|
|
|
|
|
#define STRDXOFF (0)
|
|
|
|
#define TYPEOFF (4)
|
|
|
|
#define OTHEROFF (5)
|
|
|
|
#define DESCOFF (6)
|
|
|
|
#define VALOFF (8)
|
|
|
|
#define STABSIZE (12)
|
|
|
|
|
2009-09-09 21:38:59 +00:00
|
|
|
info = (struct stab_find_info *) *pinfo;
|
1999-05-03 07:29:11 +00:00
|
|
|
if (info != NULL)
|
|
|
|
{
|
|
|
|
if (info->stabsec == NULL || info->strsec == NULL)
|
|
|
|
{
|
|
|
|
/* No stabs debugging information. */
|
2002-11-30 08:39:46 +00:00
|
|
|
return TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
bfd/
* section.c (struct sec): Rename "_cooked_size" to "size".
Rename "_raw_size" to "rawsize".
(STD_SECTION): Adjust comments.
(bfd_set_section_size, bfd_get_section_contents): Use size.
(bfd_malloc_and_get_section): New function.
* bfd-in.h (bfd_section_size, bfd_get_section_size): Use size.
* coff-sh.c (sh_relax_section): Alloc coff_section_data struct early.
Correctly free reloc and contents memory.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME
and fake CIE now that we can shink section size to zero.
(_bfd_elf_write_section_eh_frame): Likewise..
* elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents.
* elf-m10300.c (mn10300_elf_final_link_relocate): Don't use
_bfd_stab_section_offset. Use _bfd_elf_section_offset.
* stabs.c (_bfd_stab_section_offset_): Remove unused args and
unneeded indirection.
* elf.c (_bfd_elf_section_offset): .. and update call.
* libbfd-in.h (_bfd_stab_section_offset): Update prototype.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
Replace occurrences of "_raw_size" and "_cooked_size" in most places
with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE
sections. Use "rawsize", if non-zero, for bfd_get_section_contents
calls if the section might be a stabs, eh_frame, or SEC_MERGE section.
Similarly use "rawsize", if non-zero, in reloc functions to validate
reloc addresses. Use new bfd_malloc_and_get_section in most places
where bfd_get_section_contents was called. Expand all occurrences of
bfd_section_size and bfd_get_section_size. Rename "raw_size" var in
grok_prstatus and similar functions to "size".
* aix386-core.c (aix386_core_file_p): ..
* aix5ppc-core.c (xcoff64_core_p): ..
* aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents,
aout_adobe_set_section_contents): ..
* aout-target.h (callback): ..
* aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate,
MY_bfd_final_link): ..
* aoutf1.h (sunos4_core_file_p): ..
* aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags,
final_link, aout_link_input_section): ..
* binary.c (binary_object_p, binary_canonicalize_symtab,
binary_set_section_contents): ..
* bout.c (b_out_callback, b_out_write_object_contents,
b_out_set_section_contents, b_out_bfd_relax_section,
b_out_bfd_get_relocated_section_contents): ..
* cisco-core.c (cisco_core_file_validate): ..
* coff-alpha.c (alpha_ecoff_object_p,
alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): ..
* coff-arm.c (coff_arm_relocate_section,
bfd_arm_allocate_interworking_sections): ..
* coff-h8300.c (h8300_reloc16_extra_cases,
h8300_bfd_link_add_symbols): ..
* coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): ..
* coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section,
ppc_bfd_coff_final_link): ..
* coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): ..
* coff-sh.c (sh_relax_section, sh_relax_delete_bytes,
sh_align_loads, sh_coff_get_relocated_section_contents): ..
* coff64-rs6000.c (xcoff64_write_object_contents,
xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): ..
* coffcode.h (coff_compute_section_file_positions,
coff_write_object_contents): ..
* coffgen.c (make_a_section_from_file, coff_write_symbols,
coff_section_symbol, build_debug_section): ..
* cofflink.c (coff_link_add_symbols, _bfd_coff_final_link,
process_embedded_commands, _bfd_coff_link_input_bfd,
_bfd_coff_write_global_sym): ..
* cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): ..
* cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): ..
* dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): ..
* dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info,
_bfd_dwarf2_find_nearest_line): ..
* ecoff.c (bfd_debug_section, ecoff_set_symbol_info,
ecoff_compute_section_file_positions,
_bfd_ecoff_write_object_contents, ecoff_indirect_link_order): ..
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame,
_bfd_elf_discard_section_eh_frame_hdr,
_bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset,
_bfd_elf_write_section_eh_frame,
_bfd_elf_write_section_eh_frame_hdr): ..
* elf-hppa.h (elf_hppa_sort_unwind): ..
* elf-m10200.c (mn10200_elf_relax_section,
mn10200_elf_relax_delete_bytes,
mn10200_elf_get_relocated_section_contents): ..
* elf-m10300.c (_bfd_mn10300_elf_create_got_section,
mn10300_elf_check_relocs, mn10300_elf_relax_section,
mn10300_elf_relax_delete_bytes,
mn10300_elf_get_relocated_section_contents,
_bfd_mn10300_elf_adjust_dynamic_symbol,
_bfd_mn10300_elf_discard_copies,
_bfd_mn10300_elf_size_dynamic_sections,
_bfd_mn10300_elf_finish_dynamic_sections): ..
* elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list,
_bfd_elf_make_section_from_phdr, elf_fake_sections,
bfd_elf_set_group_contents, map_sections_to_segments,
elf_sort_sections, assign_file_positions_for_segments,
SECTION_SIZE, copy_private_bfd_data,
_bfd_elf_get_dynamic_reloc_upper_bound,
_bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect,
_bfd_elfcore_make_pseudosection, elfcore_grok_prstatus,
elfcore_grok_lwpstatus, elfcore_grok_win32pstatus,
elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs,
_bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): ..
* elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect,
bfd_elf32_arm_process_before_allocation,
elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs,
elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections,
elf32_arm_write_section): ..
* elf32-cris.c (cris_elf_grok_prstatus,
elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook,
elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol,
cris_elf_check_relocs, elf_cris_size_dynamic_sections,
elf_cris_discard_excess_dso_dynamics,
elf_cris_discard_excess_program_dynamics): ..
* elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): ..
* elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): ..
* elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup,
_frv_create_got_section, _frvfdpic_assign_plt_entries,
elf32_frvfdpic_size_dynamic_sections,
elf32_frvfdpic_modify_segment_map,
elf32_frvfdpic_finish_dynamic_sections): ..
* elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes,
elf32_h8_get_relocated_section_contents): ..
* elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub,
elf32_hppa_adjust_dynamic_symbol, allocate_plt_static,
allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections,
elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs,
elf32_hppa_finish_dynamic_sections): ..
* elf32-i370.c (i370_elf_adjust_dynamic_symbol,
i370_elf_size_dynamic_sections, i370_elf_check_relocs,
i370_elf_finish_dynamic_sections): ..
* elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol,
allocate_dynrelocs, elf_i386_size_dynamic_sections,
elf_i386_relocate_section, elf_i386_finish_dynamic_sections): ..
* elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc,
i860_howto_highadj_reloc, i860_howto_splitn_reloc): ..
* elf32-ip2k.c (ip2k_is_switch_table_128,
ip2k_relax_switch_table_128, ip2k_is_switch_table_256,
ip2k_relax_switch_table_256, ip2k_elf_relax_section,
adjust_all_relocations, ip2k_elf_relax_delete_bytes): ..
* elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc,
m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol,
allocate_dynrelocs, m32r_elf_size_dynamic_sections,
m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections,
m32r_elf_relax_section, m32r_elf_relax_delete_bytes,
m32r_elf_get_relocated_section_contents): ..
* elf32-m68hc11.c (m68hc11_elf_build_one_stub,
m68hc11_elf_size_one_stub, m68hc11_elf_relax_section,
m68hc11_elf_relax_delete_bytes): ..
* elf32-m68hc12.c (m68hc12_elf_build_one_stub,
m68hc12_elf_size_one_stub): ..
* elf32-m68hc1x.c (elf32_m68hc11_size_stubs,
elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): ..
* elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook,
elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections,
elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): ..
* elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elf32-or32.c (or32_elf_consth_reloc): ..
* elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc,
elf_create_pointer_linker_section, ppc_elf_create_linker_section,
ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol,
allocate_dynrelocs, ppc_elf_size_dynamic_sections,
ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus,
ppc_elf_final_write_processing): ..
* elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): ..
* elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section,
sh_elf_relax_delete_bytes, sh_elf_align_loads,
sh_elf_adjust_dynamic_symbol, allocate_dynrelocs,
sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents,
sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): ..
* elf32-sh64-com.c (sh64_address_in_cranges,
sh64_get_contents_type): ..
* elf32-sh64.c (sh64_find_section_for_address,
sh64_elf_final_write_processing): ..
* elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc,
sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol,
allocate_dynrelocs, elf32_sparc_size_dynamic_sections,
elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): ..
* elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): ..
* elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol,
elf_vax_size_dynamic_sections, elf_vax_discard_copies,
elf_vax_instantiate_got_entries, elf_vax_relocate_section,
elf_vax_finish_dynamic_sections): ..
* elf32-xstormy16.c (xstormy16_elf_24_reloc,
xstormy16_elf_check_relocs, xstormy16_relax_plt_check,
xstormy16_elf_relax_section, xstormy16_elf_always_size_sections,
xstormy16_elf_finish_dynamic_sections): ..
* elf32-xtensa.c (xtensa_read_table_entries,
elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size,
elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc,
bfd_elf_xtensa_reloc, elf_xtensa_relocate_section,
elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections,
elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus,
get_relocation_opcode, retrieve_contents, find_relaxable_sections,
collect_source_relocs, is_resolvable_asm_expansion, remove_literals,
relax_section, shrink_dynamic_reloc_sections, relax_property_section,
xtensa_callback_required_dependence): ..
* elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section,
elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol,
elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets,
elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1,
elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes,
elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1,
elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel,
elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): ..
* elf64-hppa.c (allocate_dynrel_entries,
elf64_hppa_size_dynamic_sections,
elf64_hppa_finish_dynamic_sections): ..
* elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc,
mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table,
elf64_mips_grok_prstatus): ..
* elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc,
mmix_elf_relocate_section, mmix_elf_final_link,
mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation,
mmix_elf_relax_section, mmix_elf_get_section_contents): ..
* elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus,
ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust,
ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd,
allocate_dynrelocs, ppc64_elf_size_dynamic_sections,
ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section,
toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs,
ppc64_elf_build_stubs, ppc64_elf_relocate_section,
ppc64_elf_finish_dynamic_sections): ..
* elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections): ..
* elf64-sh64.c (sh_elf64_get_relocated_section_contents,
sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol,
sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections,
sh64_elf64_finish_dynamic_sections): ..
* elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc,
sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol,
sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section,
sparc64_elf_finish_dynamic_symbol,
sparc64_elf_finish_dynamic_sections): ..
* elf64-x86-64.c (elf64_x86_64_grok_prstatus,
elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs,
elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section,
elf64_x86_64_finish_dynamic_sections): ..
* elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): ..
* elfcode.h (elf_slurp_reloc_table): ..
* elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag,
elf_finalize_dynstr, elf_link_add_object_symbols,
bfd_elf_size_dynamic_sections, elf_link_sort_relocs,
elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): ..
* elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries,
elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc,
elfNN_ia64_choose_gp, elfNN_ia64_final_link,
elfNN_ia64_finish_dynamic_sections): ..
* elfxx-mips.c (mips_elf_create_procedure_table,
mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp,
_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc,
mips_elf_global_got_index, mips_elf_multi_got,
mips_elf_create_compact_rel_section, mips_elf_calculate_relocation,
mips_elf_allocate_dynamic_relocations,
mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections,
_bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol,
_bfd_mips_elf_always_size_sections,
_bfd_mips_elf_size_dynamic_sections,
_bfd_mips_elf_finish_dynamic_symbol,
_bfd_mips_elf_finish_dynamic_sections,
_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info,
_bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents,
_bfd_elf_mips_get_relocated_section_contents,
_bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): ..
* hp300hpux.c (callback): ..
* hppabsd-core.c (make_bfd_asection): ..
* hpux-core.c (make_bfd_asection): ..
* i386linux.c (linux_link_create_dynamic_sections,
bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): ..
* i386msdos.c (msdos_write_object_contents): ..
* i386os9k.c (os9k_callback, os9k_write_object_contents,
os9k_set_section_contents): ..
* ieee.c (parse_expression, ieee_slurp_external_symbols,
ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data,
ieee_write_section_part, do_with_relocs, do_as_repeat,
do_without_relocs, ieee_write_debug_part, init_for_output,
ieee_set_section_contents): ..
* ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): ..
* irix-core.c (do_sections, make_bfd_asection): ..
* libaout.h (aout_section_merge_with_text_p): ..
* libbfd.c (_bfd_generic_get_section_contents,
_bfd_generic_get_section_contents_in_window): ..
* linker.c (default_indirect_link_order): ..
* lynx-core.c (make_bfd_asection): ..
* m68klinux.c (linux_link_create_dynamic_sections,
bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* mach-o.c (bfd_mach_o_make_bfd_section,
bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib,
bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab,
bfd_mach_o_scan_read_segment): ..
* merge.c (_bfd_add_merge_section, record_section, merge_strings,
_bfd_merge_sections): ..
* mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc,
mmo_map_set_sizes, mmo_canonicalize_symtab,
mmo_internal_write_section, mmo_write_object_contents): ..
* netbsd-core.c (netbsd_core_file_p): ..
* nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import,
nlm_alpha_set_public_section): ..
* nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): ..
* nlm32-sparc.c (nlm_sparc_write_import): ..
* nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in,
nlm_compute_section_file_positions): ..
* oasys.c (oasys_object_p, oasys_slurp_section_data,
oasys_write_sections, oasys_write_data, oasys_set_section_contents): ..
* opncls.c (get_debug_link_info): ..
* osf-core.c (make_bfd_asection): ..
* pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs,
final_link, aout_link_input_section): ..
* peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out,
pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): ..
* pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section,
bfd_pef_scan_start_address, bfd_pef_parse_symbols): ..
* ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): ..
* ptrace-core.c (ptrace_unix_core_file_p): ..
* reloc.c (bfd_perform_relocation, bfd_install_relocation,
_bfd_final_link_relocate, bfd_generic_relax_section,
bfd_generic_get_relocated_section_contents): ..
* reloc16.c (bfd_coff_reloc16_relax_section,
bfd_coff_reloc16_get_relocated_section_c): ..
* riscix.c (riscix_some_aout_object_p): ..
* rs6000-core.c (read_hdr, make_bfd_asection): ..
* sco5-core.c (make_bfd_asection): ..
* simple.c (bfd_simple_get_relocated_section_contents): ..
* som.c (som_object_setup, setup_sections, som_prep_headers,
som_write_fixups, som_begin_writing, bfd_section_from_som_symbol,
som_set_reloc_info, som_get_section_contents,
som_bfd_link_split_section): ..
* sparclinux.c (linux_link_create_dynamic_sections,
bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* srec.c (srec_scan, srec_read_section, srec_get_section_contents): ..
* stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs,
_bfd_write_stab_strings, _bfd_stab_section_offset): ..
* sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections,
bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs,
sunos_scan_ext_relocs, sunos_scan_dynamic_symbol,
sunos_write_dynamic_symbol, sunos_check_dynamic_reloc,
sunos_finish_dynamic_link): ..
* syms.c (_bfd_stab_section_find_nearest_line): ..
* tekhex.c (first_phase, tekhex_set_section_contents,
tekhex_write_object_contents): ..
* trad-core.c (trad_unix_core_file_p): ..
* versados.c (process_esd, process_otr, process_otr): ..
* vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): ..
* vms-misc.c (add_new_contents): ..
* vms-tir.c (check_section, new_section, _bfd_vms_write_tir): ..
* vms.c (vms_set_section_contents): ..
* xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols,
xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms,
_bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): ..
* xsym.c (bfd_sym_scan): .. See above.
binutils/
* objcopy.c (copy_section): Don't set _cooked_size.
include/
* bfdlink.h (struct bfd_link_order): Update comment.
ld/
* ldlang.c (print_output_section_statement): Don't print size before
relaxation.
(IGNORE_SECTION): Remove bfd arg. Update all callers.
* ldexp.c (fold_name): .. See below.
* ldlang.c (section_already_linked, print_output_section_statement,
print_input_section, insert_pad, size_input_section,
lang_check_section_addresses, lang_size_sections_1,
lang_size_sections, lang_do_assignments_1, lang_set_startof,
lang_one_common, lang_reset_memory_regions, lang_process,
lang_abs_symbol_at_end_of, lang_do_version_exports_section): ..
* ldwrite.c (build_link_order, clone_section, ds, split_sections): ..
* pe-dll.c (process_def_file, generate_reloc): ..
* emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment,
gld${EMULATION_NAME}_before_allocation): ..
* emultempl/mmix-elfnmmo.em (mmix_after_allocation): ..
* emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation,
sh64_elf_${EMULATION_NAME}_after_allocation): ..
* emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): ..
* emultempl/xtensaelf.em (ld_assign_relative_paged_dot,
ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use
"size" instead of "_raw_size" and "_cooked_size". Expand
bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
|
|
|
stabsize = (info->stabsec->rawsize
|
|
|
|
? info->stabsec->rawsize
|
|
|
|
: info->stabsec->size);
|
|
|
|
strsize = (info->strsec->rawsize
|
|
|
|
? info->strsec->rawsize
|
|
|
|
: info->strsec->size);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
long reloc_size, reloc_count;
|
|
|
|
arelent **reloc_vector;
|
|
|
|
int i;
|
|
|
|
char *name;
|
|
|
|
char *function_name;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
|
|
|
bfd_size_type amt = sizeof *info;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2009-09-09 21:38:59 +00:00
|
|
|
info = (struct stab_find_info *) bfd_zalloc (abfd, amt);
|
1999-05-03 07:29:11 +00:00
|
|
|
if (info == NULL)
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
/* FIXME: When using the linker --split-by-file or
|
|
|
|
--split-by-reloc options, it is possible for the .stab and
|
|
|
|
.stabstr sections to be split. We should handle that. */
|
|
|
|
|
|
|
|
info->stabsec = bfd_get_section_by_name (abfd, ".stab");
|
|
|
|
info->strsec = bfd_get_section_by_name (abfd, ".stabstr");
|
|
|
|
|
|
|
|
if (info->stabsec == NULL || info->strsec == NULL)
|
|
|
|
{
|
2007-09-21 07:58:03 +00:00
|
|
|
/* Try SOM section names. */
|
|
|
|
info->stabsec = bfd_get_section_by_name (abfd, "$GDB_SYMBOLS$");
|
|
|
|
info->strsec = bfd_get_section_by_name (abfd, "$GDB_STRINGS$");
|
|
|
|
|
|
|
|
if (info->stabsec == NULL || info->strsec == NULL)
|
|
|
|
{
|
|
|
|
/* No stabs debugging information. Set *pinfo so that we
|
|
|
|
can return quickly in the info != NULL case above. */
|
|
|
|
*pinfo = info;
|
|
|
|
return TRUE;
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
bfd/
* section.c (struct sec): Rename "_cooked_size" to "size".
Rename "_raw_size" to "rawsize".
(STD_SECTION): Adjust comments.
(bfd_set_section_size, bfd_get_section_contents): Use size.
(bfd_malloc_and_get_section): New function.
* bfd-in.h (bfd_section_size, bfd_get_section_size): Use size.
* coff-sh.c (sh_relax_section): Alloc coff_section_data struct early.
Correctly free reloc and contents memory.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME
and fake CIE now that we can shink section size to zero.
(_bfd_elf_write_section_eh_frame): Likewise..
* elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents.
* elf-m10300.c (mn10300_elf_final_link_relocate): Don't use
_bfd_stab_section_offset. Use _bfd_elf_section_offset.
* stabs.c (_bfd_stab_section_offset_): Remove unused args and
unneeded indirection.
* elf.c (_bfd_elf_section_offset): .. and update call.
* libbfd-in.h (_bfd_stab_section_offset): Update prototype.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
Replace occurrences of "_raw_size" and "_cooked_size" in most places
with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE
sections. Use "rawsize", if non-zero, for bfd_get_section_contents
calls if the section might be a stabs, eh_frame, or SEC_MERGE section.
Similarly use "rawsize", if non-zero, in reloc functions to validate
reloc addresses. Use new bfd_malloc_and_get_section in most places
where bfd_get_section_contents was called. Expand all occurrences of
bfd_section_size and bfd_get_section_size. Rename "raw_size" var in
grok_prstatus and similar functions to "size".
* aix386-core.c (aix386_core_file_p): ..
* aix5ppc-core.c (xcoff64_core_p): ..
* aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents,
aout_adobe_set_section_contents): ..
* aout-target.h (callback): ..
* aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate,
MY_bfd_final_link): ..
* aoutf1.h (sunos4_core_file_p): ..
* aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags,
final_link, aout_link_input_section): ..
* binary.c (binary_object_p, binary_canonicalize_symtab,
binary_set_section_contents): ..
* bout.c (b_out_callback, b_out_write_object_contents,
b_out_set_section_contents, b_out_bfd_relax_section,
b_out_bfd_get_relocated_section_contents): ..
* cisco-core.c (cisco_core_file_validate): ..
* coff-alpha.c (alpha_ecoff_object_p,
alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): ..
* coff-arm.c (coff_arm_relocate_section,
bfd_arm_allocate_interworking_sections): ..
* coff-h8300.c (h8300_reloc16_extra_cases,
h8300_bfd_link_add_symbols): ..
* coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): ..
* coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section,
ppc_bfd_coff_final_link): ..
* coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): ..
* coff-sh.c (sh_relax_section, sh_relax_delete_bytes,
sh_align_loads, sh_coff_get_relocated_section_contents): ..
* coff64-rs6000.c (xcoff64_write_object_contents,
xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): ..
* coffcode.h (coff_compute_section_file_positions,
coff_write_object_contents): ..
* coffgen.c (make_a_section_from_file, coff_write_symbols,
coff_section_symbol, build_debug_section): ..
* cofflink.c (coff_link_add_symbols, _bfd_coff_final_link,
process_embedded_commands, _bfd_coff_link_input_bfd,
_bfd_coff_write_global_sym): ..
* cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): ..
* cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): ..
* dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): ..
* dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info,
_bfd_dwarf2_find_nearest_line): ..
* ecoff.c (bfd_debug_section, ecoff_set_symbol_info,
ecoff_compute_section_file_positions,
_bfd_ecoff_write_object_contents, ecoff_indirect_link_order): ..
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame,
_bfd_elf_discard_section_eh_frame_hdr,
_bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset,
_bfd_elf_write_section_eh_frame,
_bfd_elf_write_section_eh_frame_hdr): ..
* elf-hppa.h (elf_hppa_sort_unwind): ..
* elf-m10200.c (mn10200_elf_relax_section,
mn10200_elf_relax_delete_bytes,
mn10200_elf_get_relocated_section_contents): ..
* elf-m10300.c (_bfd_mn10300_elf_create_got_section,
mn10300_elf_check_relocs, mn10300_elf_relax_section,
mn10300_elf_relax_delete_bytes,
mn10300_elf_get_relocated_section_contents,
_bfd_mn10300_elf_adjust_dynamic_symbol,
_bfd_mn10300_elf_discard_copies,
_bfd_mn10300_elf_size_dynamic_sections,
_bfd_mn10300_elf_finish_dynamic_sections): ..
* elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list,
_bfd_elf_make_section_from_phdr, elf_fake_sections,
bfd_elf_set_group_contents, map_sections_to_segments,
elf_sort_sections, assign_file_positions_for_segments,
SECTION_SIZE, copy_private_bfd_data,
_bfd_elf_get_dynamic_reloc_upper_bound,
_bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect,
_bfd_elfcore_make_pseudosection, elfcore_grok_prstatus,
elfcore_grok_lwpstatus, elfcore_grok_win32pstatus,
elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs,
_bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): ..
* elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect,
bfd_elf32_arm_process_before_allocation,
elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs,
elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections,
elf32_arm_write_section): ..
* elf32-cris.c (cris_elf_grok_prstatus,
elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook,
elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol,
cris_elf_check_relocs, elf_cris_size_dynamic_sections,
elf_cris_discard_excess_dso_dynamics,
elf_cris_discard_excess_program_dynamics): ..
* elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): ..
* elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): ..
* elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup,
_frv_create_got_section, _frvfdpic_assign_plt_entries,
elf32_frvfdpic_size_dynamic_sections,
elf32_frvfdpic_modify_segment_map,
elf32_frvfdpic_finish_dynamic_sections): ..
* elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes,
elf32_h8_get_relocated_section_contents): ..
* elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub,
elf32_hppa_adjust_dynamic_symbol, allocate_plt_static,
allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections,
elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs,
elf32_hppa_finish_dynamic_sections): ..
* elf32-i370.c (i370_elf_adjust_dynamic_symbol,
i370_elf_size_dynamic_sections, i370_elf_check_relocs,
i370_elf_finish_dynamic_sections): ..
* elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol,
allocate_dynrelocs, elf_i386_size_dynamic_sections,
elf_i386_relocate_section, elf_i386_finish_dynamic_sections): ..
* elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc,
i860_howto_highadj_reloc, i860_howto_splitn_reloc): ..
* elf32-ip2k.c (ip2k_is_switch_table_128,
ip2k_relax_switch_table_128, ip2k_is_switch_table_256,
ip2k_relax_switch_table_256, ip2k_elf_relax_section,
adjust_all_relocations, ip2k_elf_relax_delete_bytes): ..
* elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc,
m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol,
allocate_dynrelocs, m32r_elf_size_dynamic_sections,
m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections,
m32r_elf_relax_section, m32r_elf_relax_delete_bytes,
m32r_elf_get_relocated_section_contents): ..
* elf32-m68hc11.c (m68hc11_elf_build_one_stub,
m68hc11_elf_size_one_stub, m68hc11_elf_relax_section,
m68hc11_elf_relax_delete_bytes): ..
* elf32-m68hc12.c (m68hc12_elf_build_one_stub,
m68hc12_elf_size_one_stub): ..
* elf32-m68hc1x.c (elf32_m68hc11_size_stubs,
elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): ..
* elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook,
elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections,
elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): ..
* elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elf32-or32.c (or32_elf_consth_reloc): ..
* elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc,
elf_create_pointer_linker_section, ppc_elf_create_linker_section,
ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol,
allocate_dynrelocs, ppc_elf_size_dynamic_sections,
ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus,
ppc_elf_final_write_processing): ..
* elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): ..
* elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section,
sh_elf_relax_delete_bytes, sh_elf_align_loads,
sh_elf_adjust_dynamic_symbol, allocate_dynrelocs,
sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents,
sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): ..
* elf32-sh64-com.c (sh64_address_in_cranges,
sh64_get_contents_type): ..
* elf32-sh64.c (sh64_find_section_for_address,
sh64_elf_final_write_processing): ..
* elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc,
sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol,
allocate_dynrelocs, elf32_sparc_size_dynamic_sections,
elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): ..
* elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): ..
* elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol,
elf_vax_size_dynamic_sections, elf_vax_discard_copies,
elf_vax_instantiate_got_entries, elf_vax_relocate_section,
elf_vax_finish_dynamic_sections): ..
* elf32-xstormy16.c (xstormy16_elf_24_reloc,
xstormy16_elf_check_relocs, xstormy16_relax_plt_check,
xstormy16_elf_relax_section, xstormy16_elf_always_size_sections,
xstormy16_elf_finish_dynamic_sections): ..
* elf32-xtensa.c (xtensa_read_table_entries,
elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size,
elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc,
bfd_elf_xtensa_reloc, elf_xtensa_relocate_section,
elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections,
elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus,
get_relocation_opcode, retrieve_contents, find_relaxable_sections,
collect_source_relocs, is_resolvable_asm_expansion, remove_literals,
relax_section, shrink_dynamic_reloc_sections, relax_property_section,
xtensa_callback_required_dependence): ..
* elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section,
elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol,
elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets,
elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1,
elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes,
elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1,
elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel,
elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): ..
* elf64-hppa.c (allocate_dynrel_entries,
elf64_hppa_size_dynamic_sections,
elf64_hppa_finish_dynamic_sections): ..
* elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc,
mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table,
elf64_mips_grok_prstatus): ..
* elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc,
mmix_elf_relocate_section, mmix_elf_final_link,
mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation,
mmix_elf_relax_section, mmix_elf_get_section_contents): ..
* elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus,
ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust,
ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd,
allocate_dynrelocs, ppc64_elf_size_dynamic_sections,
ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section,
toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs,
ppc64_elf_build_stubs, ppc64_elf_relocate_section,
ppc64_elf_finish_dynamic_sections): ..
* elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections): ..
* elf64-sh64.c (sh_elf64_get_relocated_section_contents,
sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol,
sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections,
sh64_elf64_finish_dynamic_sections): ..
* elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc,
sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol,
sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section,
sparc64_elf_finish_dynamic_symbol,
sparc64_elf_finish_dynamic_sections): ..
* elf64-x86-64.c (elf64_x86_64_grok_prstatus,
elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs,
elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section,
elf64_x86_64_finish_dynamic_sections): ..
* elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): ..
* elfcode.h (elf_slurp_reloc_table): ..
* elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag,
elf_finalize_dynstr, elf_link_add_object_symbols,
bfd_elf_size_dynamic_sections, elf_link_sort_relocs,
elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): ..
* elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries,
elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc,
elfNN_ia64_choose_gp, elfNN_ia64_final_link,
elfNN_ia64_finish_dynamic_sections): ..
* elfxx-mips.c (mips_elf_create_procedure_table,
mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp,
_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc,
mips_elf_global_got_index, mips_elf_multi_got,
mips_elf_create_compact_rel_section, mips_elf_calculate_relocation,
mips_elf_allocate_dynamic_relocations,
mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections,
_bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol,
_bfd_mips_elf_always_size_sections,
_bfd_mips_elf_size_dynamic_sections,
_bfd_mips_elf_finish_dynamic_symbol,
_bfd_mips_elf_finish_dynamic_sections,
_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info,
_bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents,
_bfd_elf_mips_get_relocated_section_contents,
_bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): ..
* hp300hpux.c (callback): ..
* hppabsd-core.c (make_bfd_asection): ..
* hpux-core.c (make_bfd_asection): ..
* i386linux.c (linux_link_create_dynamic_sections,
bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): ..
* i386msdos.c (msdos_write_object_contents): ..
* i386os9k.c (os9k_callback, os9k_write_object_contents,
os9k_set_section_contents): ..
* ieee.c (parse_expression, ieee_slurp_external_symbols,
ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data,
ieee_write_section_part, do_with_relocs, do_as_repeat,
do_without_relocs, ieee_write_debug_part, init_for_output,
ieee_set_section_contents): ..
* ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): ..
* irix-core.c (do_sections, make_bfd_asection): ..
* libaout.h (aout_section_merge_with_text_p): ..
* libbfd.c (_bfd_generic_get_section_contents,
_bfd_generic_get_section_contents_in_window): ..
* linker.c (default_indirect_link_order): ..
* lynx-core.c (make_bfd_asection): ..
* m68klinux.c (linux_link_create_dynamic_sections,
bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* mach-o.c (bfd_mach_o_make_bfd_section,
bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib,
bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab,
bfd_mach_o_scan_read_segment): ..
* merge.c (_bfd_add_merge_section, record_section, merge_strings,
_bfd_merge_sections): ..
* mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc,
mmo_map_set_sizes, mmo_canonicalize_symtab,
mmo_internal_write_section, mmo_write_object_contents): ..
* netbsd-core.c (netbsd_core_file_p): ..
* nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import,
nlm_alpha_set_public_section): ..
* nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): ..
* nlm32-sparc.c (nlm_sparc_write_import): ..
* nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in,
nlm_compute_section_file_positions): ..
* oasys.c (oasys_object_p, oasys_slurp_section_data,
oasys_write_sections, oasys_write_data, oasys_set_section_contents): ..
* opncls.c (get_debug_link_info): ..
* osf-core.c (make_bfd_asection): ..
* pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs,
final_link, aout_link_input_section): ..
* peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out,
pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): ..
* pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section,
bfd_pef_scan_start_address, bfd_pef_parse_symbols): ..
* ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): ..
* ptrace-core.c (ptrace_unix_core_file_p): ..
* reloc.c (bfd_perform_relocation, bfd_install_relocation,
_bfd_final_link_relocate, bfd_generic_relax_section,
bfd_generic_get_relocated_section_contents): ..
* reloc16.c (bfd_coff_reloc16_relax_section,
bfd_coff_reloc16_get_relocated_section_c): ..
* riscix.c (riscix_some_aout_object_p): ..
* rs6000-core.c (read_hdr, make_bfd_asection): ..
* sco5-core.c (make_bfd_asection): ..
* simple.c (bfd_simple_get_relocated_section_contents): ..
* som.c (som_object_setup, setup_sections, som_prep_headers,
som_write_fixups, som_begin_writing, bfd_section_from_som_symbol,
som_set_reloc_info, som_get_section_contents,
som_bfd_link_split_section): ..
* sparclinux.c (linux_link_create_dynamic_sections,
bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* srec.c (srec_scan, srec_read_section, srec_get_section_contents): ..
* stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs,
_bfd_write_stab_strings, _bfd_stab_section_offset): ..
* sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections,
bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs,
sunos_scan_ext_relocs, sunos_scan_dynamic_symbol,
sunos_write_dynamic_symbol, sunos_check_dynamic_reloc,
sunos_finish_dynamic_link): ..
* syms.c (_bfd_stab_section_find_nearest_line): ..
* tekhex.c (first_phase, tekhex_set_section_contents,
tekhex_write_object_contents): ..
* trad-core.c (trad_unix_core_file_p): ..
* versados.c (process_esd, process_otr, process_otr): ..
* vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): ..
* vms-misc.c (add_new_contents): ..
* vms-tir.c (check_section, new_section, _bfd_vms_write_tir): ..
* vms.c (vms_set_section_contents): ..
* xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols,
xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms,
_bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): ..
* xsym.c (bfd_sym_scan): .. See above.
binutils/
* objcopy.c (copy_section): Don't set _cooked_size.
include/
* bfdlink.h (struct bfd_link_order): Update comment.
ld/
* ldlang.c (print_output_section_statement): Don't print size before
relaxation.
(IGNORE_SECTION): Remove bfd arg. Update all callers.
* ldexp.c (fold_name): .. See below.
* ldlang.c (section_already_linked, print_output_section_statement,
print_input_section, insert_pad, size_input_section,
lang_check_section_addresses, lang_size_sections_1,
lang_size_sections, lang_do_assignments_1, lang_set_startof,
lang_one_common, lang_reset_memory_regions, lang_process,
lang_abs_symbol_at_end_of, lang_do_version_exports_section): ..
* ldwrite.c (build_link_order, clone_section, ds, split_sections): ..
* pe-dll.c (process_def_file, generate_reloc): ..
* emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment,
gld${EMULATION_NAME}_before_allocation): ..
* emultempl/mmix-elfnmmo.em (mmix_after_allocation): ..
* emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation,
sh64_elf_${EMULATION_NAME}_after_allocation): ..
* emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): ..
* emultempl/xtensaelf.em (ld_assign_relative_paged_dot,
ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use
"size" instead of "_raw_size" and "_cooked_size". Expand
bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
|
|
|
stabsize = (info->stabsec->rawsize
|
|
|
|
? info->stabsec->rawsize
|
|
|
|
: info->stabsec->size);
|
|
|
|
strsize = (info->strsec->rawsize
|
|
|
|
? info->strsec->rawsize
|
|
|
|
: info->strsec->size);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2009-09-09 21:38:59 +00:00
|
|
|
info->stabs = (bfd_byte *) bfd_alloc (abfd, stabsize);
|
|
|
|
info->strs = (bfd_byte *) bfd_alloc (abfd, strsize);
|
1999-05-03 07:29:11 +00:00
|
|
|
if (info->stabs == NULL || info->strs == NULL)
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
|
|
|
if (! bfd_get_section_contents (abfd, info->stabsec, info->stabs,
|
bfd/
* section.c (struct sec): Rename "_cooked_size" to "size".
Rename "_raw_size" to "rawsize".
(STD_SECTION): Adjust comments.
(bfd_set_section_size, bfd_get_section_contents): Use size.
(bfd_malloc_and_get_section): New function.
* bfd-in.h (bfd_section_size, bfd_get_section_size): Use size.
* coff-sh.c (sh_relax_section): Alloc coff_section_data struct early.
Correctly free reloc and contents memory.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME
and fake CIE now that we can shink section size to zero.
(_bfd_elf_write_section_eh_frame): Likewise..
* elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents.
* elf-m10300.c (mn10300_elf_final_link_relocate): Don't use
_bfd_stab_section_offset. Use _bfd_elf_section_offset.
* stabs.c (_bfd_stab_section_offset_): Remove unused args and
unneeded indirection.
* elf.c (_bfd_elf_section_offset): .. and update call.
* libbfd-in.h (_bfd_stab_section_offset): Update prototype.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
Replace occurrences of "_raw_size" and "_cooked_size" in most places
with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE
sections. Use "rawsize", if non-zero, for bfd_get_section_contents
calls if the section might be a stabs, eh_frame, or SEC_MERGE section.
Similarly use "rawsize", if non-zero, in reloc functions to validate
reloc addresses. Use new bfd_malloc_and_get_section in most places
where bfd_get_section_contents was called. Expand all occurrences of
bfd_section_size and bfd_get_section_size. Rename "raw_size" var in
grok_prstatus and similar functions to "size".
* aix386-core.c (aix386_core_file_p): ..
* aix5ppc-core.c (xcoff64_core_p): ..
* aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents,
aout_adobe_set_section_contents): ..
* aout-target.h (callback): ..
* aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate,
MY_bfd_final_link): ..
* aoutf1.h (sunos4_core_file_p): ..
* aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags,
final_link, aout_link_input_section): ..
* binary.c (binary_object_p, binary_canonicalize_symtab,
binary_set_section_contents): ..
* bout.c (b_out_callback, b_out_write_object_contents,
b_out_set_section_contents, b_out_bfd_relax_section,
b_out_bfd_get_relocated_section_contents): ..
* cisco-core.c (cisco_core_file_validate): ..
* coff-alpha.c (alpha_ecoff_object_p,
alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): ..
* coff-arm.c (coff_arm_relocate_section,
bfd_arm_allocate_interworking_sections): ..
* coff-h8300.c (h8300_reloc16_extra_cases,
h8300_bfd_link_add_symbols): ..
* coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): ..
* coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section,
ppc_bfd_coff_final_link): ..
* coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): ..
* coff-sh.c (sh_relax_section, sh_relax_delete_bytes,
sh_align_loads, sh_coff_get_relocated_section_contents): ..
* coff64-rs6000.c (xcoff64_write_object_contents,
xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): ..
* coffcode.h (coff_compute_section_file_positions,
coff_write_object_contents): ..
* coffgen.c (make_a_section_from_file, coff_write_symbols,
coff_section_symbol, build_debug_section): ..
* cofflink.c (coff_link_add_symbols, _bfd_coff_final_link,
process_embedded_commands, _bfd_coff_link_input_bfd,
_bfd_coff_write_global_sym): ..
* cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): ..
* cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): ..
* dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): ..
* dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info,
_bfd_dwarf2_find_nearest_line): ..
* ecoff.c (bfd_debug_section, ecoff_set_symbol_info,
ecoff_compute_section_file_positions,
_bfd_ecoff_write_object_contents, ecoff_indirect_link_order): ..
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame,
_bfd_elf_discard_section_eh_frame_hdr,
_bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset,
_bfd_elf_write_section_eh_frame,
_bfd_elf_write_section_eh_frame_hdr): ..
* elf-hppa.h (elf_hppa_sort_unwind): ..
* elf-m10200.c (mn10200_elf_relax_section,
mn10200_elf_relax_delete_bytes,
mn10200_elf_get_relocated_section_contents): ..
* elf-m10300.c (_bfd_mn10300_elf_create_got_section,
mn10300_elf_check_relocs, mn10300_elf_relax_section,
mn10300_elf_relax_delete_bytes,
mn10300_elf_get_relocated_section_contents,
_bfd_mn10300_elf_adjust_dynamic_symbol,
_bfd_mn10300_elf_discard_copies,
_bfd_mn10300_elf_size_dynamic_sections,
_bfd_mn10300_elf_finish_dynamic_sections): ..
* elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list,
_bfd_elf_make_section_from_phdr, elf_fake_sections,
bfd_elf_set_group_contents, map_sections_to_segments,
elf_sort_sections, assign_file_positions_for_segments,
SECTION_SIZE, copy_private_bfd_data,
_bfd_elf_get_dynamic_reloc_upper_bound,
_bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect,
_bfd_elfcore_make_pseudosection, elfcore_grok_prstatus,
elfcore_grok_lwpstatus, elfcore_grok_win32pstatus,
elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs,
_bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): ..
* elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect,
bfd_elf32_arm_process_before_allocation,
elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs,
elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections,
elf32_arm_write_section): ..
* elf32-cris.c (cris_elf_grok_prstatus,
elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook,
elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol,
cris_elf_check_relocs, elf_cris_size_dynamic_sections,
elf_cris_discard_excess_dso_dynamics,
elf_cris_discard_excess_program_dynamics): ..
* elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): ..
* elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): ..
* elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup,
_frv_create_got_section, _frvfdpic_assign_plt_entries,
elf32_frvfdpic_size_dynamic_sections,
elf32_frvfdpic_modify_segment_map,
elf32_frvfdpic_finish_dynamic_sections): ..
* elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes,
elf32_h8_get_relocated_section_contents): ..
* elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub,
elf32_hppa_adjust_dynamic_symbol, allocate_plt_static,
allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections,
elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs,
elf32_hppa_finish_dynamic_sections): ..
* elf32-i370.c (i370_elf_adjust_dynamic_symbol,
i370_elf_size_dynamic_sections, i370_elf_check_relocs,
i370_elf_finish_dynamic_sections): ..
* elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol,
allocate_dynrelocs, elf_i386_size_dynamic_sections,
elf_i386_relocate_section, elf_i386_finish_dynamic_sections): ..
* elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc,
i860_howto_highadj_reloc, i860_howto_splitn_reloc): ..
* elf32-ip2k.c (ip2k_is_switch_table_128,
ip2k_relax_switch_table_128, ip2k_is_switch_table_256,
ip2k_relax_switch_table_256, ip2k_elf_relax_section,
adjust_all_relocations, ip2k_elf_relax_delete_bytes): ..
* elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc,
m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol,
allocate_dynrelocs, m32r_elf_size_dynamic_sections,
m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections,
m32r_elf_relax_section, m32r_elf_relax_delete_bytes,
m32r_elf_get_relocated_section_contents): ..
* elf32-m68hc11.c (m68hc11_elf_build_one_stub,
m68hc11_elf_size_one_stub, m68hc11_elf_relax_section,
m68hc11_elf_relax_delete_bytes): ..
* elf32-m68hc12.c (m68hc12_elf_build_one_stub,
m68hc12_elf_size_one_stub): ..
* elf32-m68hc1x.c (elf32_m68hc11_size_stubs,
elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): ..
* elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook,
elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections,
elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): ..
* elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elf32-or32.c (or32_elf_consth_reloc): ..
* elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc,
elf_create_pointer_linker_section, ppc_elf_create_linker_section,
ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol,
allocate_dynrelocs, ppc_elf_size_dynamic_sections,
ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus,
ppc_elf_final_write_processing): ..
* elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): ..
* elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section,
sh_elf_relax_delete_bytes, sh_elf_align_loads,
sh_elf_adjust_dynamic_symbol, allocate_dynrelocs,
sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents,
sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): ..
* elf32-sh64-com.c (sh64_address_in_cranges,
sh64_get_contents_type): ..
* elf32-sh64.c (sh64_find_section_for_address,
sh64_elf_final_write_processing): ..
* elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc,
sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol,
allocate_dynrelocs, elf32_sparc_size_dynamic_sections,
elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): ..
* elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): ..
* elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol,
elf_vax_size_dynamic_sections, elf_vax_discard_copies,
elf_vax_instantiate_got_entries, elf_vax_relocate_section,
elf_vax_finish_dynamic_sections): ..
* elf32-xstormy16.c (xstormy16_elf_24_reloc,
xstormy16_elf_check_relocs, xstormy16_relax_plt_check,
xstormy16_elf_relax_section, xstormy16_elf_always_size_sections,
xstormy16_elf_finish_dynamic_sections): ..
* elf32-xtensa.c (xtensa_read_table_entries,
elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size,
elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc,
bfd_elf_xtensa_reloc, elf_xtensa_relocate_section,
elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections,
elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus,
get_relocation_opcode, retrieve_contents, find_relaxable_sections,
collect_source_relocs, is_resolvable_asm_expansion, remove_literals,
relax_section, shrink_dynamic_reloc_sections, relax_property_section,
xtensa_callback_required_dependence): ..
* elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section,
elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol,
elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets,
elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1,
elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes,
elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1,
elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel,
elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): ..
* elf64-hppa.c (allocate_dynrel_entries,
elf64_hppa_size_dynamic_sections,
elf64_hppa_finish_dynamic_sections): ..
* elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc,
mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table,
elf64_mips_grok_prstatus): ..
* elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc,
mmix_elf_relocate_section, mmix_elf_final_link,
mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation,
mmix_elf_relax_section, mmix_elf_get_section_contents): ..
* elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus,
ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust,
ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd,
allocate_dynrelocs, ppc64_elf_size_dynamic_sections,
ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section,
toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs,
ppc64_elf_build_stubs, ppc64_elf_relocate_section,
ppc64_elf_finish_dynamic_sections): ..
* elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections): ..
* elf64-sh64.c (sh_elf64_get_relocated_section_contents,
sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol,
sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections,
sh64_elf64_finish_dynamic_sections): ..
* elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc,
sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol,
sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section,
sparc64_elf_finish_dynamic_symbol,
sparc64_elf_finish_dynamic_sections): ..
* elf64-x86-64.c (elf64_x86_64_grok_prstatus,
elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs,
elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section,
elf64_x86_64_finish_dynamic_sections): ..
* elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): ..
* elfcode.h (elf_slurp_reloc_table): ..
* elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag,
elf_finalize_dynstr, elf_link_add_object_symbols,
bfd_elf_size_dynamic_sections, elf_link_sort_relocs,
elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): ..
* elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries,
elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc,
elfNN_ia64_choose_gp, elfNN_ia64_final_link,
elfNN_ia64_finish_dynamic_sections): ..
* elfxx-mips.c (mips_elf_create_procedure_table,
mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp,
_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc,
mips_elf_global_got_index, mips_elf_multi_got,
mips_elf_create_compact_rel_section, mips_elf_calculate_relocation,
mips_elf_allocate_dynamic_relocations,
mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections,
_bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol,
_bfd_mips_elf_always_size_sections,
_bfd_mips_elf_size_dynamic_sections,
_bfd_mips_elf_finish_dynamic_symbol,
_bfd_mips_elf_finish_dynamic_sections,
_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info,
_bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents,
_bfd_elf_mips_get_relocated_section_contents,
_bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): ..
* hp300hpux.c (callback): ..
* hppabsd-core.c (make_bfd_asection): ..
* hpux-core.c (make_bfd_asection): ..
* i386linux.c (linux_link_create_dynamic_sections,
bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): ..
* i386msdos.c (msdos_write_object_contents): ..
* i386os9k.c (os9k_callback, os9k_write_object_contents,
os9k_set_section_contents): ..
* ieee.c (parse_expression, ieee_slurp_external_symbols,
ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data,
ieee_write_section_part, do_with_relocs, do_as_repeat,
do_without_relocs, ieee_write_debug_part, init_for_output,
ieee_set_section_contents): ..
* ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): ..
* irix-core.c (do_sections, make_bfd_asection): ..
* libaout.h (aout_section_merge_with_text_p): ..
* libbfd.c (_bfd_generic_get_section_contents,
_bfd_generic_get_section_contents_in_window): ..
* linker.c (default_indirect_link_order): ..
* lynx-core.c (make_bfd_asection): ..
* m68klinux.c (linux_link_create_dynamic_sections,
bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* mach-o.c (bfd_mach_o_make_bfd_section,
bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib,
bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab,
bfd_mach_o_scan_read_segment): ..
* merge.c (_bfd_add_merge_section, record_section, merge_strings,
_bfd_merge_sections): ..
* mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc,
mmo_map_set_sizes, mmo_canonicalize_symtab,
mmo_internal_write_section, mmo_write_object_contents): ..
* netbsd-core.c (netbsd_core_file_p): ..
* nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import,
nlm_alpha_set_public_section): ..
* nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): ..
* nlm32-sparc.c (nlm_sparc_write_import): ..
* nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in,
nlm_compute_section_file_positions): ..
* oasys.c (oasys_object_p, oasys_slurp_section_data,
oasys_write_sections, oasys_write_data, oasys_set_section_contents): ..
* opncls.c (get_debug_link_info): ..
* osf-core.c (make_bfd_asection): ..
* pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs,
final_link, aout_link_input_section): ..
* peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out,
pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): ..
* pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section,
bfd_pef_scan_start_address, bfd_pef_parse_symbols): ..
* ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): ..
* ptrace-core.c (ptrace_unix_core_file_p): ..
* reloc.c (bfd_perform_relocation, bfd_install_relocation,
_bfd_final_link_relocate, bfd_generic_relax_section,
bfd_generic_get_relocated_section_contents): ..
* reloc16.c (bfd_coff_reloc16_relax_section,
bfd_coff_reloc16_get_relocated_section_c): ..
* riscix.c (riscix_some_aout_object_p): ..
* rs6000-core.c (read_hdr, make_bfd_asection): ..
* sco5-core.c (make_bfd_asection): ..
* simple.c (bfd_simple_get_relocated_section_contents): ..
* som.c (som_object_setup, setup_sections, som_prep_headers,
som_write_fixups, som_begin_writing, bfd_section_from_som_symbol,
som_set_reloc_info, som_get_section_contents,
som_bfd_link_split_section): ..
* sparclinux.c (linux_link_create_dynamic_sections,
bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* srec.c (srec_scan, srec_read_section, srec_get_section_contents): ..
* stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs,
_bfd_write_stab_strings, _bfd_stab_section_offset): ..
* sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections,
bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs,
sunos_scan_ext_relocs, sunos_scan_dynamic_symbol,
sunos_write_dynamic_symbol, sunos_check_dynamic_reloc,
sunos_finish_dynamic_link): ..
* syms.c (_bfd_stab_section_find_nearest_line): ..
* tekhex.c (first_phase, tekhex_set_section_contents,
tekhex_write_object_contents): ..
* trad-core.c (trad_unix_core_file_p): ..
* versados.c (process_esd, process_otr, process_otr): ..
* vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): ..
* vms-misc.c (add_new_contents): ..
* vms-tir.c (check_section, new_section, _bfd_vms_write_tir): ..
* vms.c (vms_set_section_contents): ..
* xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols,
xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms,
_bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): ..
* xsym.c (bfd_sym_scan): .. See above.
binutils/
* objcopy.c (copy_section): Don't set _cooked_size.
include/
* bfdlink.h (struct bfd_link_order): Update comment.
ld/
* ldlang.c (print_output_section_statement): Don't print size before
relaxation.
(IGNORE_SECTION): Remove bfd arg. Update all callers.
* ldexp.c (fold_name): .. See below.
* ldlang.c (section_already_linked, print_output_section_statement,
print_input_section, insert_pad, size_input_section,
lang_check_section_addresses, lang_size_sections_1,
lang_size_sections, lang_do_assignments_1, lang_set_startof,
lang_one_common, lang_reset_memory_regions, lang_process,
lang_abs_symbol_at_end_of, lang_do_version_exports_section): ..
* ldwrite.c (build_link_order, clone_section, ds, split_sections): ..
* pe-dll.c (process_def_file, generate_reloc): ..
* emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment,
gld${EMULATION_NAME}_before_allocation): ..
* emultempl/mmix-elfnmmo.em (mmix_after_allocation): ..
* emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation,
sh64_elf_${EMULATION_NAME}_after_allocation): ..
* emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): ..
* emultempl/xtensaelf.em (ld_assign_relative_paged_dot,
ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use
"size" instead of "_raw_size" and "_cooked_size". Expand
bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
|
|
|
0, stabsize)
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
|
|
|
|| ! bfd_get_section_contents (abfd, info->strsec, info->strs,
|
bfd/
* section.c (struct sec): Rename "_cooked_size" to "size".
Rename "_raw_size" to "rawsize".
(STD_SECTION): Adjust comments.
(bfd_set_section_size, bfd_get_section_contents): Use size.
(bfd_malloc_and_get_section): New function.
* bfd-in.h (bfd_section_size, bfd_get_section_size): Use size.
* coff-sh.c (sh_relax_section): Alloc coff_section_data struct early.
Correctly free reloc and contents memory.
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Delete FIXME
and fake CIE now that we can shink section size to zero.
(_bfd_elf_write_section_eh_frame): Likewise..
* elf32-ppc.c (ppc_elf_relax_section): Delay reading section contents.
* elf-m10300.c (mn10300_elf_final_link_relocate): Don't use
_bfd_stab_section_offset. Use _bfd_elf_section_offset.
* stabs.c (_bfd_stab_section_offset_): Remove unused args and
unneeded indirection.
* elf.c (_bfd_elf_section_offset): .. and update call.
* libbfd-in.h (_bfd_stab_section_offset): Update prototype.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
Replace occurrences of "_raw_size" and "_cooked_size" in most places
with "size". Set new "rawsize" for stabs, eh_frame, and SEC_MERGE
sections. Use "rawsize", if non-zero, for bfd_get_section_contents
calls if the section might be a stabs, eh_frame, or SEC_MERGE section.
Similarly use "rawsize", if non-zero, in reloc functions to validate
reloc addresses. Use new bfd_malloc_and_get_section in most places
where bfd_get_section_contents was called. Expand all occurrences of
bfd_section_size and bfd_get_section_size. Rename "raw_size" var in
grok_prstatus and similar functions to "size".
* aix386-core.c (aix386_core_file_p): ..
* aix5ppc-core.c (xcoff64_core_p): ..
* aout-adobe.c (aout_adobe_callback, aout_adobe_write_object_contents,
aout_adobe_set_section_contents): ..
* aout-target.h (callback): ..
* aout-tic30.c (tic30_aout_callback, tic30_aout_final_link_relocate,
MY_bfd_final_link): ..
* aoutf1.h (sunos4_core_file_p): ..
* aoutx.h (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, translate_from_native_sym_flags,
final_link, aout_link_input_section): ..
* binary.c (binary_object_p, binary_canonicalize_symtab,
binary_set_section_contents): ..
* bout.c (b_out_callback, b_out_write_object_contents,
b_out_set_section_contents, b_out_bfd_relax_section,
b_out_bfd_get_relocated_section_contents): ..
* cisco-core.c (cisco_core_file_validate): ..
* coff-alpha.c (alpha_ecoff_object_p,
alpha_ecoff_get_relocated_section_conten, alpha_relocate_section): ..
* coff-arm.c (coff_arm_relocate_section,
bfd_arm_allocate_interworking_sections): ..
* coff-h8300.c (h8300_reloc16_extra_cases,
h8300_bfd_link_add_symbols): ..
* coff-mips.c (mips_refhi_reloc, mips_gprel_reloc): ..
* coff-ppc.c (coff_ppc_relocate_section, ppc_allocate_toc_section,
ppc_bfd_coff_final_link): ..
* coff-rs6000.c (xcoff_reloc_type_br, xcoff_ppc_relocate_section): ..
* coff-sh.c (sh_relax_section, sh_relax_delete_bytes,
sh_align_loads, sh_coff_get_relocated_section_contents): ..
* coff64-rs6000.c (xcoff64_write_object_contents,
xcoff64_reloc_type_br, xcoff64_ppc_relocate_section): ..
* coffcode.h (coff_compute_section_file_positions,
coff_write_object_contents): ..
* coffgen.c (make_a_section_from_file, coff_write_symbols,
coff_section_symbol, build_debug_section): ..
* cofflink.c (coff_link_add_symbols, _bfd_coff_final_link,
process_embedded_commands, _bfd_coff_link_input_bfd,
_bfd_coff_write_global_sym): ..
* cpu-arm.c (bfd_arm_update_notes, bfd_arm_get_mach_from_notes): ..
* cpu-ns32k.c (do_ns32k_reloc, _bfd_ns32k_final_link_relocate): ..
* dwarf1.c (parse_line_table, _bfd_dwarf1_find_nearest_line): ..
* dwarf2.c (read_indirect_string, read_abbrevs, decode_line_info,
_bfd_dwarf2_find_nearest_line): ..
* ecoff.c (bfd_debug_section, ecoff_set_symbol_info,
ecoff_compute_section_file_positions,
_bfd_ecoff_write_object_contents, ecoff_indirect_link_order): ..
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame,
_bfd_elf_discard_section_eh_frame_hdr,
_bfd_elf_maybe_strip_eh_frame_hdr, _bfd_elf_eh_frame_section_offset,
_bfd_elf_write_section_eh_frame,
_bfd_elf_write_section_eh_frame_hdr): ..
* elf-hppa.h (elf_hppa_sort_unwind): ..
* elf-m10200.c (mn10200_elf_relax_section,
mn10200_elf_relax_delete_bytes,
mn10200_elf_get_relocated_section_contents): ..
* elf-m10300.c (_bfd_mn10300_elf_create_got_section,
mn10300_elf_check_relocs, mn10300_elf_relax_section,
mn10300_elf_relax_delete_bytes,
mn10300_elf_get_relocated_section_contents,
_bfd_mn10300_elf_adjust_dynamic_symbol,
_bfd_mn10300_elf_discard_copies,
_bfd_mn10300_elf_size_dynamic_sections,
_bfd_mn10300_elf_finish_dynamic_sections): ..
* elf.c (_bfd_elf_print_private_bfd_data, bfd_elf_get_bfd_needed_list,
_bfd_elf_make_section_from_phdr, elf_fake_sections,
bfd_elf_set_group_contents, map_sections_to_segments,
elf_sort_sections, assign_file_positions_for_segments,
SECTION_SIZE, copy_private_bfd_data,
_bfd_elf_get_dynamic_reloc_upper_bound,
_bfd_elf_canonicalize_dynamic_reloc, elfcore_maybe_make_sect,
_bfd_elfcore_make_pseudosection, elfcore_grok_prstatus,
elfcore_grok_lwpstatus, elfcore_grok_win32pstatus,
elfcore_grok_note, elfcore_grok_nto_status, elfcore_grok_nto_gregs,
_bfd_elf_rel_local_sym, _bfd_elf_get_synthetic_symtab): ..
* elf32-arm.h (bfd_elf32_arm_allocate_interworking_sect,
bfd_elf32_arm_process_before_allocation,
elf32_arm_adjust_dynamic_symbol, allocate_dynrelocs,
elf32_arm_size_dynamic_sections, elf32_arm_finish_dynamic_sections,
elf32_arm_write_section): ..
* elf32-cris.c (cris_elf_grok_prstatus,
elf_cris_finish_dynamic_sections, cris_elf_gc_sweep_hook,
elf_cris_adjust_gotplt_to_got, elf_cris_adjust_dynamic_symbol,
cris_elf_check_relocs, elf_cris_size_dynamic_sections,
elf_cris_discard_excess_dso_dynamics,
elf_cris_discard_excess_program_dynamics): ..
* elf32-d30v.c (bfd_elf_d30v_reloc, bfd_elf_d30v_reloc_21): ..
* elf32-dlx.c (_bfd_dlx_elf_hi16_reloc): ..
* elf32-frv.c (_frvfdpic_add_dyn_reloc, _frvfdpic_add_rofixup,
_frv_create_got_section, _frvfdpic_assign_plt_entries,
elf32_frvfdpic_size_dynamic_sections,
elf32_frvfdpic_modify_segment_map,
elf32_frvfdpic_finish_dynamic_sections): ..
* elf32-h8300.c (elf32_h8_relax_section, elf32_h8_relax_delete_bytes,
elf32_h8_get_relocated_section_contents): ..
* elf32-hppa.c (hppa_build_one_stub, hppa_size_one_stub,
elf32_hppa_adjust_dynamic_symbol, allocate_plt_static,
allocate_dynrelocs, elf32_hppa_size_dynamic_sections, group_sections,
elf32_hppa_size_stubs, elf32_hppa_set_gp, elf32_hppa_build_stubs,
elf32_hppa_finish_dynamic_sections): ..
* elf32-i370.c (i370_elf_adjust_dynamic_symbol,
i370_elf_size_dynamic_sections, i370_elf_check_relocs,
i370_elf_finish_dynamic_sections): ..
* elf32-i386.c (elf_i386_grok_prstatus, elf_i386_adjust_dynamic_symbol,
allocate_dynrelocs, elf_i386_size_dynamic_sections,
elf_i386_relocate_section, elf_i386_finish_dynamic_sections): ..
* elf32-i860.c (i860_howto_pc26_reloc, i860_howto_pc16_reloc,
i860_howto_highadj_reloc, i860_howto_splitn_reloc): ..
* elf32-ip2k.c (ip2k_is_switch_table_128,
ip2k_relax_switch_table_128, ip2k_is_switch_table_256,
ip2k_relax_switch_table_256, ip2k_elf_relax_section,
adjust_all_relocations, ip2k_elf_relax_delete_bytes): ..
* elf32-m32r.c (m32r_elf_do_10_pcrel_reloc, m32r_elf_hi16_reloc,
m32r_elf_generic_reloc, m32r_elf_adjust_dynamic_symbol,
allocate_dynrelocs, m32r_elf_size_dynamic_sections,
m32r_elf_relocate_section, m32r_elf_finish_dynamic_sections,
m32r_elf_relax_section, m32r_elf_relax_delete_bytes,
m32r_elf_get_relocated_section_contents): ..
* elf32-m68hc11.c (m68hc11_elf_build_one_stub,
m68hc11_elf_size_one_stub, m68hc11_elf_relax_section,
m68hc11_elf_relax_delete_bytes): ..
* elf32-m68hc12.c (m68hc12_elf_build_one_stub,
m68hc12_elf_size_one_stub): ..
* elf32-m68hc1x.c (elf32_m68hc11_size_stubs,
elf32_m68hc11_build_stubs, m68hc11_elf_special_reloc): ..
* elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_gc_sweep_hook,
elf_m68k_adjust_dynamic_symbol, elf_m68k_size_dynamic_sections,
elf_m68k_discard_copies, elf_m68k_finish_dynamic_sections): ..
* elf32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elf32-or32.c (or32_elf_consth_reloc): ..
* elf32-ppc.c (ppc_elf_relax_section, ppc_elf_addr16_ha_reloc,
elf_create_pointer_linker_section, ppc_elf_create_linker_section,
ppc_elf_additional_program_headers, ppc_elf_adjust_dynamic_symbol,
allocate_dynrelocs, ppc_elf_size_dynamic_sections,
ppc_elf_finish_dynamic_sections, ppc_elf_grok_prstatus,
ppc_elf_final_write_processing): ..
* elf32-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections, elf_s390_grok_prstatus): ..
* elf32-sh.c (sh_elf_reloc_loop, sh_elf_relax_section,
sh_elf_relax_delete_bytes, sh_elf_align_loads,
sh_elf_adjust_dynamic_symbol, allocate_dynrelocs,
sh_elf_size_dynamic_sections, sh_elf_get_relocated_section_contents,
sh_elf_finish_dynamic_sections, elf32_shlin_grok_prstatus): ..
* elf32-sh64-com.c (sh64_address_in_cranges,
sh64_get_contents_type): ..
* elf32-sh64.c (sh64_find_section_for_address,
sh64_elf_final_write_processing): ..
* elf32-sparc.c (sparc_elf_wdisp16_reloc, sparc_elf_hix22_reloc,
sparc_elf_lox10_reloc, elf32_sparc_adjust_dynamic_symbol,
allocate_dynrelocs, elf32_sparc_size_dynamic_sections,
elf32_sparc_relocate_section, elf32_sparc_finish_dynamic_sections): ..
* elf32-v850.c (v850_elf_reloc, v850_elf_relax_section): ..
* elf32-vax.c (elf_vax_check_relocs, elf_vax_adjust_dynamic_symbol,
elf_vax_size_dynamic_sections, elf_vax_discard_copies,
elf_vax_instantiate_got_entries, elf_vax_relocate_section,
elf_vax_finish_dynamic_sections): ..
* elf32-xstormy16.c (xstormy16_elf_24_reloc,
xstormy16_elf_check_relocs, xstormy16_relax_plt_check,
xstormy16_elf_relax_section, xstormy16_elf_always_size_sections,
xstormy16_elf_finish_dynamic_sections): ..
* elf32-xtensa.c (xtensa_read_table_entries,
elf_xtensa_allocate_got_size, elf_xtensa_allocate_local_got_size,
elf_xtensa_size_dynamic_sections, elf_xtensa_do_reloc,
bfd_elf_xtensa_reloc, elf_xtensa_relocate_section,
elf_xtensa_combine_prop_entries, elf_xtensa_finish_dynamic_sections,
elf_xtensa_discard_info_for_section, elf_xtensa_grok_prstatus,
get_relocation_opcode, retrieve_contents, find_relaxable_sections,
collect_source_relocs, is_resolvable_asm_expansion, remove_literals,
relax_section, shrink_dynamic_reloc_sections, relax_property_section,
xtensa_callback_required_dependence): ..
* elf64-alpha.c (elf64_alpha_reloc_gpdisp, elf64_alpha_relax_section,
elf64_alpha_check_relocs, elf64_alpha_adjust_dynamic_symbol,
elf64_alpha_calc_got_offsets_for_symbol, elf64_alpha_calc_got_offsets,
elf64_alpha_size_plt_section, elf64_alpha_size_plt_section_1,
elf64_alpha_always_size_sections, elf64_alpha_calc_dynrel_sizes,
elf64_alpha_size_rela_got_section, elf64_alpha_size_rela_got_1,
elf64_alpha_size_dynamic_sections, elf64_alpha_emit_dynrel,
elf64_alpha_finish_dynamic_sections, elf64_alpha_final_link): ..
* elf64-hppa.c (allocate_dynrel_entries,
elf64_hppa_size_dynamic_sections,
elf64_hppa_finish_dynamic_sections): ..
* elf64-mips.c (mips_elf64_gprel32_reloc, mips16_gprel_reloc,
mips_elf64_canonicalize_dynamic_reloc, mips_elf64_slurp_reloc_table,
elf64_mips_grok_prstatus): ..
* elf64-mmix.c (mmix_elf_perform_relocation, mmix_elf_reloc,
mmix_elf_relocate_section, mmix_elf_final_link,
mmix_set_relaxable_size, _bfd_mmix_after_linker_allocation,
mmix_elf_relax_section, mmix_elf_get_section_contents): ..
* elf64-ppc.c (ppc64_elf_object_p, ppc64_elf_grok_prstatus,
ppc64_elf_check_relocs, ppc64_elf_func_desc_adjust,
ppc64_elf_adjust_dynamic_symbol, ppc64_elf_edit_opd,
allocate_dynrelocs, ppc64_elf_size_dynamic_sections,
ppc_build_one_stub, ppc_size_one_stub, ppc64_elf_next_toc_section,
toc_adjusting_stub_needed, group_sections, ppc64_elf_size_stubs,
ppc64_elf_build_stubs, ppc64_elf_relocate_section,
ppc64_elf_finish_dynamic_sections): ..
* elf64-s390.c (s390_elf_ldisp_reloc, elf_s390_adjust_dynamic_symbol,
allocate_dynrelocs, elf_s390_size_dynamic_sections,
elf_s390_finish_dynamic_sections): ..
* elf64-sh64.c (sh_elf64_get_relocated_section_contents,
sh_elf64_check_relocs, sh64_elf64_adjust_dynamic_symbol,
sh64_elf64_discard_copies, sh64_elf64_size_dynamic_sections,
sh64_elf64_finish_dynamic_sections): ..
* elf64-sparc.c (sparc64_elf_slurp_reloc_table, init_insn_reloc,
sparc64_elf_check_relocs, sparc64_elf_adjust_dynamic_symbol,
sparc64_elf_size_dynamic_sections, sparc64_elf_relocate_section,
sparc64_elf_finish_dynamic_symbol,
sparc64_elf_finish_dynamic_sections): ..
* elf64-x86-64.c (elf64_x86_64_grok_prstatus,
elf64_x86_64_adjust_dynamic_symbol, allocate_dynrelocs,
elf64_x86_64_size_dynamic_sections, elf64_x86_64_relocate_section,
elf64_x86_64_finish_dynamic_sections): ..
* elfarm-nabi.c (elf32_arm_nabi_grok_prstatus): ..
* elfcode.h (elf_slurp_reloc_table): ..
* elflink.c (_bfd_elf_create_got_section, elf_add_dt_needed_tag,
elf_finalize_dynstr, elf_link_add_object_symbols,
bfd_elf_size_dynamic_sections, elf_link_sort_relocs,
elf_link_input_bfd, bfd_elf_final_link, bfd_elf_discard_info): ..
* elfn32-mips.c (gprel32_with_gp, mips16_gprel_reloc,
elf32_mips_grok_prstatus): ..
* elfxx-ia64.c (elfNN_ia64_relax_section, allocate_dynrel_entries,
elfNN_ia64_size_dynamic_sections, elfNN_ia64_install_dyn_reloc,
elfNN_ia64_choose_gp, elfNN_ia64_final_link,
elfNN_ia64_finish_dynamic_sections): ..
* elfxx-mips.c (mips_elf_create_procedure_table,
mips_elf_check_mips16_stubs, _bfd_mips_elf_gprel16_with_gp,
_bfd_mips_elf_hi16_reloc, _bfd_mips_elf_generic_reloc,
mips_elf_global_got_index, mips_elf_multi_got,
mips_elf_create_compact_rel_section, mips_elf_calculate_relocation,
mips_elf_allocate_dynamic_relocations,
mips_elf_create_dynamic_relocation, _bfd_mips_elf_fake_sections,
_bfd_mips_relax_section, _bfd_mips_elf_adjust_dynamic_symbol,
_bfd_mips_elf_always_size_sections,
_bfd_mips_elf_size_dynamic_sections,
_bfd_mips_elf_finish_dynamic_symbol,
_bfd_mips_elf_finish_dynamic_sections,
_bfd_mips_elf_modify_segment_map, _bfd_mips_elf_discard_info,
_bfd_mips_elf_write_section, _bfd_mips_elf_set_section_contents,
_bfd_elf_mips_get_relocated_section_contents,
_bfd_mips_elf_final_link, _bfd_mips_elf_merge_private_bfd_data): ..
* hp300hpux.c (callback): ..
* hppabsd-core.c (make_bfd_asection): ..
* hpux-core.c (make_bfd_asection): ..
* i386linux.c (linux_link_create_dynamic_sections,
bfd_i386linux_size_dynamic_sections, linux_finish_dynamic_link): ..
* i386msdos.c (msdos_write_object_contents): ..
* i386os9k.c (os9k_callback, os9k_write_object_contents,
os9k_set_section_contents): ..
* ieee.c (parse_expression, ieee_slurp_external_symbols,
ieee_slurp_sections, ieee_slurp_debug, ieee_slurp_section_data,
ieee_write_section_part, do_with_relocs, do_as_repeat,
do_without_relocs, ieee_write_debug_part, init_for_output,
ieee_set_section_contents): ..
* ihex.c (ihex_scan, ihex_read_section, ihex_get_section_contents): ..
* irix-core.c (do_sections, make_bfd_asection): ..
* libaout.h (aout_section_merge_with_text_p): ..
* libbfd.c (_bfd_generic_get_section_contents,
_bfd_generic_get_section_contents_in_window): ..
* linker.c (default_indirect_link_order): ..
* lynx-core.c (make_bfd_asection): ..
* m68klinux.c (linux_link_create_dynamic_sections,
bfd_m68klinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* mach-o.c (bfd_mach_o_make_bfd_section,
bfd_mach_o_scan_read_dylinker, bfd_mach_o_scan_read_dylib,
bfd_mach_o_scan_read_thread, bfd_mach_o_scan_read_symtab,
bfd_mach_o_scan_read_segment): ..
* merge.c (_bfd_add_merge_section, record_section, merge_strings,
_bfd_merge_sections): ..
* mmo.c (mmo_find_sec_w_addr, mmo_get_spec_section, mmo_get_loc,
mmo_map_set_sizes, mmo_canonicalize_symtab,
mmo_internal_write_section, mmo_write_object_contents): ..
* netbsd-core.c (netbsd_core_file_p): ..
* nlm32-alpha.c (nlm_alpha_read_reloc, nlm_alpha_write_import,
nlm_alpha_set_public_section): ..
* nlm32-ppc.c (nlm_powerpc_read_reloc, nlm_powerpc_write_reloc): ..
* nlm32-sparc.c (nlm_sparc_write_import): ..
* nlmcode.h (add_bfd_section, nlm_swap_auxiliary_headers_in,
nlm_compute_section_file_positions): ..
* oasys.c (oasys_object_p, oasys_slurp_section_data,
oasys_write_sections, oasys_write_data, oasys_set_section_contents): ..
* opncls.c (get_debug_link_info): ..
* osf-core.c (make_bfd_asection): ..
* pdp11.c (some_aout_object_p, adjust_o_magic, adjust_z_magic,
adjust_n_magic, adjust_sizes_and_vmas, squirt_out_relocs,
final_link, aout_link_input_section): ..
* peXXigen.c (_bfd_XXi_swap_sym_in, _bfd_XXi_swap_aouthdr_out,
pe_print_idata, pe_print_edata, pe_print_pdata, pe_print_reloc): ..
* pef.c (bfd_pef_make_bfd_section, bfd_pef_print_loader_section,
bfd_pef_scan_start_address, bfd_pef_parse_symbols): ..
* ppcboot.c (ppcboot_object_p, ppcboot_canonicalize_symtab): ..
* ptrace-core.c (ptrace_unix_core_file_p): ..
* reloc.c (bfd_perform_relocation, bfd_install_relocation,
_bfd_final_link_relocate, bfd_generic_relax_section,
bfd_generic_get_relocated_section_contents): ..
* reloc16.c (bfd_coff_reloc16_relax_section,
bfd_coff_reloc16_get_relocated_section_c): ..
* riscix.c (riscix_some_aout_object_p): ..
* rs6000-core.c (read_hdr, make_bfd_asection): ..
* sco5-core.c (make_bfd_asection): ..
* simple.c (bfd_simple_get_relocated_section_contents): ..
* som.c (som_object_setup, setup_sections, som_prep_headers,
som_write_fixups, som_begin_writing, bfd_section_from_som_symbol,
som_set_reloc_info, som_get_section_contents,
som_bfd_link_split_section): ..
* sparclinux.c (linux_link_create_dynamic_sections,
bfd_sparclinux_size_dynamic_sections, linux_finish_dynamic_link): ..
* srec.c (srec_scan, srec_read_section, srec_get_section_contents): ..
* stabs.c (_bfd_link_section_stabs, _bfd_discard_section_stabs,
_bfd_write_stab_strings, _bfd_stab_section_offset): ..
* sunos.c (sunos_read_dynamic_info, sunos_create_dynamic_sections,
bfd_sunos_size_dynamic_sections, sunos_scan_std_relocs,
sunos_scan_ext_relocs, sunos_scan_dynamic_symbol,
sunos_write_dynamic_symbol, sunos_check_dynamic_reloc,
sunos_finish_dynamic_link): ..
* syms.c (_bfd_stab_section_find_nearest_line): ..
* tekhex.c (first_phase, tekhex_set_section_contents,
tekhex_write_object_contents): ..
* trad-core.c (trad_unix_core_file_p): ..
* versados.c (process_esd, process_otr, process_otr): ..
* vms-gsd.c (_bfd_vms_slurp_gsd, _bfd_vms_write_gsd): ..
* vms-misc.c (add_new_contents): ..
* vms-tir.c (check_section, new_section, _bfd_vms_write_tir): ..
* vms.c (vms_set_section_contents): ..
* xcofflink.c (xcoff_get_section_contents, xcoff_link_add_symbols,
xcoff_sweep, bfd_xcoff_size_dynamic_sections, xcoff_build_ldsyms,
_bfd_xcoff_bfd_final_link, xcoff_link_input_bfd): ..
* xsym.c (bfd_sym_scan): .. See above.
binutils/
* objcopy.c (copy_section): Don't set _cooked_size.
include/
* bfdlink.h (struct bfd_link_order): Update comment.
ld/
* ldlang.c (print_output_section_statement): Don't print size before
relaxation.
(IGNORE_SECTION): Remove bfd arg. Update all callers.
* ldexp.c (fold_name): .. See below.
* ldlang.c (section_already_linked, print_output_section_statement,
print_input_section, insert_pad, size_input_section,
lang_check_section_addresses, lang_size_sections_1,
lang_size_sections, lang_do_assignments_1, lang_set_startof,
lang_one_common, lang_reset_memory_regions, lang_process,
lang_abs_symbol_at_end_of, lang_do_version_exports_section): ..
* ldwrite.c (build_link_order, clone_section, ds, split_sections): ..
* pe-dll.c (process_def_file, generate_reloc): ..
* emultempl/elf32.em (gld${EMULATION_NAME}_find_statement_assignment,
gld${EMULATION_NAME}_before_allocation): ..
* emultempl/mmix-elfnmmo.em (mmix_after_allocation): ..
* emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_before_allocation,
sh64_elf_${EMULATION_NAME}_after_allocation): ..
* emultempl/sunos.em (gld${EMULATION_NAME}_before_allocation): ..
* emultempl/xtensaelf.em (ld_assign_relative_paged_dot,
ld_local_file_relocations_fit, ld_xtensa_insert_page_offsets): Use
"size" instead of "_raw_size" and "_cooked_size". Expand
bfd_section_size macro invocations.
2004-06-24 04:46:28 +00:00
|
|
|
0, strsize))
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2003-06-25 06:40:27 +00:00
|
|
|
/* If this is a relocatable object file, we have to relocate
|
1999-05-03 07:29:11 +00:00
|
|
|
the entries in .stab. This should always be simple 32 bit
|
|
|
|
relocations against symbols defined in this object file, so
|
|
|
|
this should be no big deal. */
|
|
|
|
reloc_size = bfd_get_reloc_upper_bound (abfd, info->stabsec);
|
|
|
|
if (reloc_size < 0)
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
2009-09-09 21:38:59 +00:00
|
|
|
reloc_vector = (arelent **) bfd_malloc (reloc_size);
|
1999-05-03 07:29:11 +00:00
|
|
|
if (reloc_vector == NULL && reloc_size != 0)
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
reloc_count = bfd_canonicalize_reloc (abfd, info->stabsec, reloc_vector,
|
|
|
|
symbols);
|
|
|
|
if (reloc_count < 0)
|
|
|
|
{
|
|
|
|
if (reloc_vector != NULL)
|
|
|
|
free (reloc_vector);
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
if (reloc_count > 0)
|
|
|
|
{
|
|
|
|
arelent **pr;
|
|
|
|
|
|
|
|
for (pr = reloc_vector; *pr != NULL; pr++)
|
|
|
|
{
|
|
|
|
arelent *r;
|
|
|
|
unsigned long val;
|
|
|
|
asymbol *sym;
|
|
|
|
|
|
|
|
r = *pr;
|
2004-10-05 11:12:56 +00:00
|
|
|
/* Ignore R_*_NONE relocs. */
|
|
|
|
if (r->howto->dst_mask == 0)
|
|
|
|
continue;
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
if (r->howto->rightshift != 0
|
|
|
|
|| r->howto->size != 2
|
|
|
|
|| r->howto->bitsize != 32
|
|
|
|
|| r->howto->pc_relative
|
|
|
|
|| r->howto->bitpos != 0
|
|
|
|
|| r->howto->dst_mask != 0xffffffff)
|
|
|
|
{
|
|
|
|
(*_bfd_error_handler)
|
|
|
|
(_("Unsupported .stab relocation"));
|
|
|
|
bfd_set_error (bfd_error_invalid_operation);
|
|
|
|
if (reloc_vector != NULL)
|
|
|
|
free (reloc_vector);
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
val = bfd_get_32 (abfd, info->stabs + r->address);
|
|
|
|
val &= r->howto->src_mask;
|
|
|
|
sym = *r->sym_ptr_ptr;
|
|
|
|
val += sym->value + sym->section->vma + r->addend;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
|
|
|
bfd_put_32 (abfd, (bfd_vma) val, info->stabs + r->address);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reloc_vector != NULL)
|
|
|
|
free (reloc_vector);
|
|
|
|
|
|
|
|
/* First time through this function, build a table matching
|
|
|
|
function VM addresses to stabs, then sort based on starting
|
|
|
|
VM address. Do this in two passes: once to count how many
|
|
|
|
table entries we'll need, and a second to actually build the
|
|
|
|
table. */
|
|
|
|
|
|
|
|
info->indextablesize = 0;
|
|
|
|
saw_fun = 1;
|
|
|
|
for (stab = info->stabs; stab < info->stabs + stabsize; stab += STABSIZE)
|
|
|
|
{
|
* aoutx.h (NAME(aout,swap_ext_reloc_in)): Cast bytes->r_index to
unsigned int. Cast RELOC_BASE10, RELOC_BASE13 and RELOC_BASE22 to
unsigned int.
(NAME(aout,final_link)): Cast enum used in assignment.
(aout_link_write_symbols): Cast enums in comparisons, int values to
boolean, enums in assignments to int.
(aout_link_input_section_std): Cast rel->r_index to unsigned int.
(aout_link_input_section_ext): Likewise. Cast enums used in comparisons
with unsigned ints.
(aout_link_reloc_link_order): Cast enum to int in assignment.
* archive.c (_bfd_generic_read_ar_hdr_mag): Cast result of memchr
calls to char *.
* bfd-in.h (bfd_set_section_vma): Cast enum true to unsigned int in
assignment.
* bfd-in2.h (bfd_set_section_vma): Likewise.
* bfd.c (bfd_record_phdr): Cast enums in assignments.
* binary.c (bfd_alloc): Cast enum to long.
* coffgen.c (_bfd_coff_is_local_label_name): Cast return to boolean.
* dwarf2.c (read_abbrevs): Add casts to enum types.
(read_attribute_value): Likewise.
(arange_add): Cast result of bfd_zalloc call.
(comp_unit_contains_address): Return true and false.
(comp_unit_find_nearest_line): Cast return to boolean.
* format.c (bfd_check_format_matches, bfd_set_format): Likewise.
* gen-aout.c: define macro '_' if not defined.
* libbfd.c (bfd_realloc): Cast malloc and realloc to PTR.
(bfd_bwrite): Cast bfd_realloc to bfd_byte *.
(bfd_write_bigendian_4byte_int): Cast return to boolean.
(bfd_seek): Cast bfd_realloc to bfd_byte *.
(bfd_generic_is_local_label_name): Cast return to boolean.
* libcoff.h (_bfd_coff_adjust_symndx): Remove extraneous '\'.
* linker.c (_bfd_link_hash_newfunc): Cast bfd_hash_allocate result to
struct bfd_hash_entry *.
(_bfd_generic_link_hash_newfunc): likewise.
(_bfd_generic_final_link): Cast enum to unsigned int.
* merge.c (sec_merge_emit): Cast return to boolean.
(merge_strings): Add casts to const unsigned char *.
* reloc.c (bfd_get_reloc_code_name): Cast enums in comparison to int.
(bfd_generic_get_relocated_section_content): Cast enum to unsigned int.
* section.c (bfd_section_hash_newfunc): Cast bfd_hash_allocate result to
struct bfd_hash_entry *.
(bfd_set_section_content): Add cast to PTR in comparison.
* simple.c (simple_dummy_warning, simple_dummy_undefined_symbol,
simple_dummy_reloc_overflow, simple_dummy_reloc_dangerous,
simple_dummy_unattached_reloc,
bfd_simple_get_relocated_section_contents): Add K&R declarations and
function definitions.
* srec.c (S3Forced): Initialize to false.
(srec_get_symtab): Cast return value from bfd_alloc to asymbol *.
* stabs.c (_bfd_link_section_stabs): Cast enum to int in comparisons.
(_bfd_discard_section_stabs): Likewise. Also cast return to boolean.
* syms.c (bfd_is_undefined_symclass): Cast return to boolean.
(_bfd_stab_section_find_nearest_line): Cast enum to bfd_byte in
comparisons.
2002-10-25 02:45:54 +00:00
|
|
|
if (stab[TYPEOFF] == (bfd_byte) N_SO)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
/* N_SO with null name indicates EOF */
|
|
|
|
if (bfd_get_32 (abfd, stab + STRDXOFF) == 0)
|
|
|
|
continue;
|
|
|
|
|
2000-12-20 00:21:57 +00:00
|
|
|
/* if we did not see a function def, leave space for one. */
|
1999-05-03 07:29:11 +00:00
|
|
|
if (saw_fun == 0)
|
|
|
|
++info->indextablesize;
|
|
|
|
|
|
|
|
saw_fun = 0;
|
|
|
|
|
|
|
|
/* two N_SO's in a row is a filename and directory. Skip */
|
|
|
|
if (stab + STABSIZE < info->stabs + stabsize
|
* aoutx.h (NAME(aout,swap_ext_reloc_in)): Cast bytes->r_index to
unsigned int. Cast RELOC_BASE10, RELOC_BASE13 and RELOC_BASE22 to
unsigned int.
(NAME(aout,final_link)): Cast enum used in assignment.
(aout_link_write_symbols): Cast enums in comparisons, int values to
boolean, enums in assignments to int.
(aout_link_input_section_std): Cast rel->r_index to unsigned int.
(aout_link_input_section_ext): Likewise. Cast enums used in comparisons
with unsigned ints.
(aout_link_reloc_link_order): Cast enum to int in assignment.
* archive.c (_bfd_generic_read_ar_hdr_mag): Cast result of memchr
calls to char *.
* bfd-in.h (bfd_set_section_vma): Cast enum true to unsigned int in
assignment.
* bfd-in2.h (bfd_set_section_vma): Likewise.
* bfd.c (bfd_record_phdr): Cast enums in assignments.
* binary.c (bfd_alloc): Cast enum to long.
* coffgen.c (_bfd_coff_is_local_label_name): Cast return to boolean.
* dwarf2.c (read_abbrevs): Add casts to enum types.
(read_attribute_value): Likewise.
(arange_add): Cast result of bfd_zalloc call.
(comp_unit_contains_address): Return true and false.
(comp_unit_find_nearest_line): Cast return to boolean.
* format.c (bfd_check_format_matches, bfd_set_format): Likewise.
* gen-aout.c: define macro '_' if not defined.
* libbfd.c (bfd_realloc): Cast malloc and realloc to PTR.
(bfd_bwrite): Cast bfd_realloc to bfd_byte *.
(bfd_write_bigendian_4byte_int): Cast return to boolean.
(bfd_seek): Cast bfd_realloc to bfd_byte *.
(bfd_generic_is_local_label_name): Cast return to boolean.
* libcoff.h (_bfd_coff_adjust_symndx): Remove extraneous '\'.
* linker.c (_bfd_link_hash_newfunc): Cast bfd_hash_allocate result to
struct bfd_hash_entry *.
(_bfd_generic_link_hash_newfunc): likewise.
(_bfd_generic_final_link): Cast enum to unsigned int.
* merge.c (sec_merge_emit): Cast return to boolean.
(merge_strings): Add casts to const unsigned char *.
* reloc.c (bfd_get_reloc_code_name): Cast enums in comparison to int.
(bfd_generic_get_relocated_section_content): Cast enum to unsigned int.
* section.c (bfd_section_hash_newfunc): Cast bfd_hash_allocate result to
struct bfd_hash_entry *.
(bfd_set_section_content): Add cast to PTR in comparison.
* simple.c (simple_dummy_warning, simple_dummy_undefined_symbol,
simple_dummy_reloc_overflow, simple_dummy_reloc_dangerous,
simple_dummy_unattached_reloc,
bfd_simple_get_relocated_section_contents): Add K&R declarations and
function definitions.
* srec.c (S3Forced): Initialize to false.
(srec_get_symtab): Cast return value from bfd_alloc to asymbol *.
* stabs.c (_bfd_link_section_stabs): Cast enum to int in comparisons.
(_bfd_discard_section_stabs): Likewise. Also cast return to boolean.
* syms.c (bfd_is_undefined_symclass): Cast return to boolean.
(_bfd_stab_section_find_nearest_line): Cast enum to bfd_byte in
comparisons.
2002-10-25 02:45:54 +00:00
|
|
|
&& *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
stab += STABSIZE;
|
|
|
|
}
|
|
|
|
}
|
* aoutx.h (NAME(aout,swap_ext_reloc_in)): Cast bytes->r_index to
unsigned int. Cast RELOC_BASE10, RELOC_BASE13 and RELOC_BASE22 to
unsigned int.
(NAME(aout,final_link)): Cast enum used in assignment.
(aout_link_write_symbols): Cast enums in comparisons, int values to
boolean, enums in assignments to int.
(aout_link_input_section_std): Cast rel->r_index to unsigned int.
(aout_link_input_section_ext): Likewise. Cast enums used in comparisons
with unsigned ints.
(aout_link_reloc_link_order): Cast enum to int in assignment.
* archive.c (_bfd_generic_read_ar_hdr_mag): Cast result of memchr
calls to char *.
* bfd-in.h (bfd_set_section_vma): Cast enum true to unsigned int in
assignment.
* bfd-in2.h (bfd_set_section_vma): Likewise.
* bfd.c (bfd_record_phdr): Cast enums in assignments.
* binary.c (bfd_alloc): Cast enum to long.
* coffgen.c (_bfd_coff_is_local_label_name): Cast return to boolean.
* dwarf2.c (read_abbrevs): Add casts to enum types.
(read_attribute_value): Likewise.
(arange_add): Cast result of bfd_zalloc call.
(comp_unit_contains_address): Return true and false.
(comp_unit_find_nearest_line): Cast return to boolean.
* format.c (bfd_check_format_matches, bfd_set_format): Likewise.
* gen-aout.c: define macro '_' if not defined.
* libbfd.c (bfd_realloc): Cast malloc and realloc to PTR.
(bfd_bwrite): Cast bfd_realloc to bfd_byte *.
(bfd_write_bigendian_4byte_int): Cast return to boolean.
(bfd_seek): Cast bfd_realloc to bfd_byte *.
(bfd_generic_is_local_label_name): Cast return to boolean.
* libcoff.h (_bfd_coff_adjust_symndx): Remove extraneous '\'.
* linker.c (_bfd_link_hash_newfunc): Cast bfd_hash_allocate result to
struct bfd_hash_entry *.
(_bfd_generic_link_hash_newfunc): likewise.
(_bfd_generic_final_link): Cast enum to unsigned int.
* merge.c (sec_merge_emit): Cast return to boolean.
(merge_strings): Add casts to const unsigned char *.
* reloc.c (bfd_get_reloc_code_name): Cast enums in comparison to int.
(bfd_generic_get_relocated_section_content): Cast enum to unsigned int.
* section.c (bfd_section_hash_newfunc): Cast bfd_hash_allocate result to
struct bfd_hash_entry *.
(bfd_set_section_content): Add cast to PTR in comparison.
* simple.c (simple_dummy_warning, simple_dummy_undefined_symbol,
simple_dummy_reloc_overflow, simple_dummy_reloc_dangerous,
simple_dummy_unattached_reloc,
bfd_simple_get_relocated_section_contents): Add K&R declarations and
function definitions.
* srec.c (S3Forced): Initialize to false.
(srec_get_symtab): Cast return value from bfd_alloc to asymbol *.
* stabs.c (_bfd_link_section_stabs): Cast enum to int in comparisons.
(_bfd_discard_section_stabs): Likewise. Also cast return to boolean.
* syms.c (bfd_is_undefined_symclass): Cast return to boolean.
(_bfd_stab_section_find_nearest_line): Cast enum to bfd_byte in
comparisons.
2002-10-25 02:45:54 +00:00
|
|
|
else if (stab[TYPEOFF] == (bfd_byte) N_FUN)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
saw_fun = 1;
|
|
|
|
++info->indextablesize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (saw_fun == 0)
|
|
|
|
++info->indextablesize;
|
2000-12-20 00:21:57 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
if (info->indextablesize == 0)
|
2002-11-30 08:39:46 +00:00
|
|
|
return TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
++info->indextablesize;
|
|
|
|
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
|
|
|
amt = info->indextablesize;
|
|
|
|
amt *= sizeof (struct indexentry);
|
2009-09-09 21:38:59 +00:00
|
|
|
info->indextable = (struct indexentry *) bfd_alloc (abfd, amt);
|
1999-05-03 07:29:11 +00:00
|
|
|
if (info->indextable == NULL)
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
file_name = NULL;
|
|
|
|
directory_name = NULL;
|
|
|
|
saw_fun = 1;
|
|
|
|
|
|
|
|
for (i = 0, stroff = 0, stab = info->stabs, str = info->strs;
|
|
|
|
i < info->indextablesize && stab < info->stabs + stabsize;
|
|
|
|
stab += STABSIZE)
|
|
|
|
{
|
|
|
|
switch (stab[TYPEOFF])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
/* This is the first entry in a compilation unit. */
|
|
|
|
if ((bfd_size_type) ((info->strs + strsize) - str) < stroff)
|
|
|
|
break;
|
|
|
|
str += stroff;
|
|
|
|
stroff = bfd_get_32 (abfd, stab + VALOFF);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case N_SO:
|
|
|
|
/* The main file name. */
|
|
|
|
|
|
|
|
/* The following code creates a new indextable entry with
|
|
|
|
a NULL function name if there were no N_FUNs in a file.
|
|
|
|
Note that a N_SO without a file name is an EOF and
|
2000-12-20 00:21:57 +00:00
|
|
|
there could be 2 N_SO following it with the new filename
|
|
|
|
and directory. */
|
1999-05-03 07:29:11 +00:00
|
|
|
if (saw_fun == 0)
|
|
|
|
{
|
|
|
|
info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF);
|
|
|
|
info->indextable[i].stab = last_stab;
|
|
|
|
info->indextable[i].str = 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;
|
2000-12-20 00:21:57 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
|
|
|
|
if (*file_name == '\0')
|
|
|
|
{
|
|
|
|
directory_name = NULL;
|
|
|
|
file_name = NULL;
|
|
|
|
saw_fun = 1;
|
|
|
|
}
|
1999-07-11 19:49:48 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
last_stab = stab;
|
|
|
|
if (stab + STABSIZE >= info->stabs + stabsize
|
* aoutx.h (NAME(aout,swap_ext_reloc_in)): Cast bytes->r_index to
unsigned int. Cast RELOC_BASE10, RELOC_BASE13 and RELOC_BASE22 to
unsigned int.
(NAME(aout,final_link)): Cast enum used in assignment.
(aout_link_write_symbols): Cast enums in comparisons, int values to
boolean, enums in assignments to int.
(aout_link_input_section_std): Cast rel->r_index to unsigned int.
(aout_link_input_section_ext): Likewise. Cast enums used in comparisons
with unsigned ints.
(aout_link_reloc_link_order): Cast enum to int in assignment.
* archive.c (_bfd_generic_read_ar_hdr_mag): Cast result of memchr
calls to char *.
* bfd-in.h (bfd_set_section_vma): Cast enum true to unsigned int in
assignment.
* bfd-in2.h (bfd_set_section_vma): Likewise.
* bfd.c (bfd_record_phdr): Cast enums in assignments.
* binary.c (bfd_alloc): Cast enum to long.
* coffgen.c (_bfd_coff_is_local_label_name): Cast return to boolean.
* dwarf2.c (read_abbrevs): Add casts to enum types.
(read_attribute_value): Likewise.
(arange_add): Cast result of bfd_zalloc call.
(comp_unit_contains_address): Return true and false.
(comp_unit_find_nearest_line): Cast return to boolean.
* format.c (bfd_check_format_matches, bfd_set_format): Likewise.
* gen-aout.c: define macro '_' if not defined.
* libbfd.c (bfd_realloc): Cast malloc and realloc to PTR.
(bfd_bwrite): Cast bfd_realloc to bfd_byte *.
(bfd_write_bigendian_4byte_int): Cast return to boolean.
(bfd_seek): Cast bfd_realloc to bfd_byte *.
(bfd_generic_is_local_label_name): Cast return to boolean.
* libcoff.h (_bfd_coff_adjust_symndx): Remove extraneous '\'.
* linker.c (_bfd_link_hash_newfunc): Cast bfd_hash_allocate result to
struct bfd_hash_entry *.
(_bfd_generic_link_hash_newfunc): likewise.
(_bfd_generic_final_link): Cast enum to unsigned int.
* merge.c (sec_merge_emit): Cast return to boolean.
(merge_strings): Add casts to const unsigned char *.
* reloc.c (bfd_get_reloc_code_name): Cast enums in comparison to int.
(bfd_generic_get_relocated_section_content): Cast enum to unsigned int.
* section.c (bfd_section_hash_newfunc): Cast bfd_hash_allocate result to
struct bfd_hash_entry *.
(bfd_set_section_content): Add cast to PTR in comparison.
* simple.c (simple_dummy_warning, simple_dummy_undefined_symbol,
simple_dummy_reloc_overflow, simple_dummy_reloc_dangerous,
simple_dummy_unattached_reloc,
bfd_simple_get_relocated_section_contents): Add K&R declarations and
function definitions.
* srec.c (S3Forced): Initialize to false.
(srec_get_symtab): Cast return value from bfd_alloc to asymbol *.
* stabs.c (_bfd_link_section_stabs): Cast enum to int in comparisons.
(_bfd_discard_section_stabs): Likewise. Also cast return to boolean.
* syms.c (bfd_is_undefined_symclass): Cast return to boolean.
(_bfd_stab_section_find_nearest_line): Cast enum to bfd_byte in
comparisons.
2002-10-25 02:45:54 +00:00
|
|
|
|| *(stab + STABSIZE + TYPEOFF) != (bfd_byte) N_SO)
|
1999-07-11 19:49:48 +00:00
|
|
|
{
|
|
|
|
directory_name = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Two consecutive N_SOs are a directory and a
|
|
|
|
file name. */
|
|
|
|
stab += STABSIZE;
|
|
|
|
directory_name = file_name;
|
|
|
|
file_name = ((char *) str
|
|
|
|
+ bfd_get_32 (abfd, stab + STRDXOFF));
|
|
|
|
}
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case N_SOL:
|
|
|
|
/* The name of an include file. */
|
|
|
|
file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
|
|
|
|
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)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
info->indextable[i].val = bfd_get_32 (abfd, stab + VALOFF);
|
|
|
|
info->indextable[i].stab = stab;
|
|
|
|
info->indextable[i].str = str;
|
|
|
|
info->indextable[i].directory_name = directory_name;
|
|
|
|
info->indextable[i].file_name = file_name;
|
|
|
|
info->indextable[i].function_name = function_name;
|
|
|
|
++i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (saw_fun == 0)
|
|
|
|
{
|
|
|
|
info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF);
|
|
|
|
info->indextable[i].stab = last_stab;
|
|
|
|
info->indextable[i].str = str;
|
|
|
|
info->indextable[i].directory_name = directory_name;
|
|
|
|
info->indextable[i].file_name = file_name;
|
|
|
|
info->indextable[i].function_name = NULL;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
info->indextable[i].val = (bfd_vma) -1;
|
|
|
|
info->indextable[i].stab = info->stabs + stabsize;
|
|
|
|
info->indextable[i].str = str;
|
|
|
|
info->indextable[i].directory_name = NULL;
|
|
|
|
info->indextable[i].file_name = NULL;
|
|
|
|
info->indextable[i].function_name = NULL;
|
|
|
|
++i;
|
|
|
|
|
|
|
|
info->indextablesize = i;
|
Touches most files in bfd/, so likely will be blamed for everything..
o bfd_read and bfd_write lose an unnecessary param and become
bfd_bread and bfd_bwrite.
o bfd_*alloc now all take a bfd_size_type arg, and will error if
size_t is too small. eg. 32 bit host, 64 bit bfd, verrry big files
or bugs in linker scripts etc.
o file_ptr becomes a bfd_signed_vma. Besides matching sizes with
various other types involved in handling sections, this should make
it easier for bfd to support a 64 bit off_t on 32 bit hosts that
provide it.
o I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
generally available. They now cast their args to bfd_vma and
bfd_byte * as appropriate, which removes a swag of casts from the
source.
o Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
aout-encap.c.
o Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
|
|
|
qsort (info->indextable, (size_t) i, sizeof (struct indexentry),
|
|
|
|
cmpindexentry);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2003-06-29 10:06:40 +00:00
|
|
|
*pinfo = info;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We are passed a section relative offset. The offsets in the
|
|
|
|
stabs information are absolute. */
|
|
|
|
offset += bfd_get_section_vma (abfd, section);
|
|
|
|
|
|
|
|
#ifdef ENABLE_CACHING
|
|
|
|
if (info->cached_indexentry != NULL
|
|
|
|
&& offset >= info->cached_offset
|
|
|
|
&& offset < (info->cached_indexentry + 1)->val)
|
|
|
|
{
|
|
|
|
stab = info->cached_stab;
|
|
|
|
indexentry = info->cached_indexentry;
|
|
|
|
file_name = info->cached_file_name;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
long low, high;
|
|
|
|
long mid = -1;
|
|
|
|
|
2003-11-30 18:40:41 +00:00
|
|
|
/* Cache non-existent or invalid. Do binary search on
|
2003-02-14 09:31:57 +00:00
|
|
|
indextable. */
|
1999-05-03 07:29:11 +00:00
|
|
|
indexentry = NULL;
|
|
|
|
|
|
|
|
low = 0;
|
|
|
|
high = info->indextablesize - 1;
|
|
|
|
while (low != high)
|
|
|
|
{
|
|
|
|
mid = (high + low) / 2;
|
|
|
|
if (offset >= info->indextable[mid].val
|
|
|
|
&& offset < info->indextable[mid + 1].val)
|
|
|
|
{
|
|
|
|
indexentry = &info->indextable[mid];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (info->indextable[mid].val > offset)
|
|
|
|
high = mid;
|
|
|
|
else
|
|
|
|
low = mid + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (indexentry == NULL)
|
2002-11-30 08:39:46 +00:00
|
|
|
return TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
stab = indexentry->stab + STABSIZE;
|
|
|
|
file_name = indexentry->file_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
directory_name = indexentry->directory_name;
|
|
|
|
str = indexentry->str;
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
saw_line = FALSE;
|
|
|
|
saw_func = FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
for (; stab < (indexentry+1)->stab; stab += STABSIZE)
|
|
|
|
{
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean done;
|
1999-05-03 07:29:11 +00:00
|
|
|
bfd_vma val;
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
done = FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
switch (stab[TYPEOFF])
|
|
|
|
{
|
|
|
|
case N_SOL:
|
|
|
|
/* The name of an include file. */
|
|
|
|
val = bfd_get_32 (abfd, stab + VALOFF);
|
|
|
|
if (val <= offset)
|
|
|
|
{
|
|
|
|
file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
|
|
|
|
*pline = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case N_SLINE:
|
|
|
|
case N_DSLINE:
|
|
|
|
case N_BSLINE:
|
2003-02-14 09:31:57 +00:00
|
|
|
/* A line number. If the function was specified, then the value
|
|
|
|
is relative to the start of the function. Otherwise, the
|
|
|
|
value is an absolute address. */
|
|
|
|
val = ((indexentry->function_name ? indexentry->val : 0)
|
|
|
|
+ bfd_get_32 (abfd, stab + VALOFF));
|
2002-03-20 19:15:30 +00:00
|
|
|
/* If this line starts before our desired offset, or if it's
|
|
|
|
the first line we've been able to find, use it. The
|
|
|
|
!saw_line check works around a bug in GCC 2.95.3, which emits
|
|
|
|
the first N_SLINE late. */
|
|
|
|
if (!saw_line || val <= offset)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
*pline = bfd_get_16 (abfd, stab + DESCOFF);
|
|
|
|
|
|
|
|
#ifdef ENABLE_CACHING
|
|
|
|
info->cached_stab = stab;
|
|
|
|
info->cached_offset = val;
|
|
|
|
info->cached_file_name = file_name;
|
|
|
|
info->cached_indexentry = indexentry;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
if (val > offset)
|
2002-11-30 08:39:46 +00:00
|
|
|
done = TRUE;
|
|
|
|
saw_line = TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case N_FUN:
|
|
|
|
case N_SO:
|
2002-03-20 19:15:30 +00:00
|
|
|
if (saw_func || saw_line)
|
2002-11-30 08:39:46 +00:00
|
|
|
done = TRUE;
|
|
|
|
saw_func = TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (done)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
*pfound = TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2002-05-01 07:36:39 +00:00
|
|
|
if (file_name == NULL || IS_ABSOLUTE_PATH (file_name)
|
|
|
|
|| directory_name == NULL)
|
1999-05-03 07:29:11 +00:00
|
|
|
*pfilename = file_name;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
size_t dirlen;
|
|
|
|
|
|
|
|
dirlen = strlen (directory_name);
|
|
|
|
if (info->filename == NULL
|
2011-02-28 18:30:16 +00:00
|
|
|
|| filename_ncmp (info->filename, directory_name, dirlen) != 0
|
|
|
|
|| filename_cmp (info->filename + dirlen, file_name) != 0)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2002-06-25 09:40:45 +00:00
|
|
|
size_t len;
|
|
|
|
|
2009-01-13 23:44:45 +00:00
|
|
|
/* Don't free info->filename here. objdump and other
|
|
|
|
apps keep a copy of a previously returned file name
|
|
|
|
pointer. */
|
2002-06-25 09:40:45 +00:00
|
|
|
len = strlen (file_name) + 1;
|
2009-09-09 21:38:59 +00:00
|
|
|
info->filename = (char *) bfd_alloc (abfd, dirlen + len);
|
1999-05-03 07:29:11 +00:00
|
|
|
if (info->filename == NULL)
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
2002-06-25 09:40:45 +00:00
|
|
|
memcpy (info->filename, directory_name, dirlen);
|
|
|
|
memcpy (info->filename + dirlen, file_name, len);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*pfilename = info->filename;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (indexentry->function_name != NULL)
|
|
|
|
{
|
|
|
|
char *s;
|
|
|
|
|
|
|
|
/* This will typically be something like main:F(0,1), so we want
|
|
|
|
to clobber the colon. It's OK to change the name, since the
|
|
|
|
string is in our own local storage anyhow. */
|
|
|
|
s = strchr (indexentry->function_name, ':');
|
|
|
|
if (s != NULL)
|
|
|
|
*s = '\0';
|
|
|
|
|
|
|
|
*pfnname = indexentry->function_name;
|
|
|
|
}
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
return TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|