1999-05-03 07:29:11 +00:00
|
|
|
/* Object file "section" 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-03-04 05:50:50 +00:00
|
|
|
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
1999-05-03 07:29:11 +00:00
|
|
|
Free Software Foundation, Inc.
|
|
|
|
Written by Cygnus Support.
|
|
|
|
|
2007-07-03 14:26:43 +00:00
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
SECTION
|
|
|
|
Sections
|
|
|
|
|
|
|
|
The raw data contained within a BFD is maintained through the
|
|
|
|
section abstraction. A single BFD may have any number of
|
|
|
|
sections. It keeps hold of them by pointing to the first;
|
|
|
|
each one points to the next in the list.
|
|
|
|
|
|
|
|
Sections are supported in BFD in <<section.c>>.
|
|
|
|
|
|
|
|
@menu
|
|
|
|
@* Section Input::
|
|
|
|
@* Section Output::
|
|
|
|
@* typedef asection::
|
|
|
|
@* section prototypes::
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
INODE
|
|
|
|
Section Input, Section Output, Sections, Sections
|
|
|
|
SUBSECTION
|
|
|
|
Section input
|
|
|
|
|
|
|
|
When a BFD is opened for reading, the section structures are
|
|
|
|
created and attached to the BFD.
|
|
|
|
|
|
|
|
Each section has a name which describes the section in the
|
|
|
|
outside world---for example, <<a.out>> would contain at least
|
|
|
|
three sections, called <<.text>>, <<.data>> and <<.bss>>.
|
|
|
|
|
|
|
|
Names need not be unique; for example a COFF file may have several
|
|
|
|
sections named <<.data>>.
|
|
|
|
|
|
|
|
Sometimes a BFD will contain more than the ``natural'' number of
|
|
|
|
sections. A back end may attach other sections containing
|
|
|
|
constructor data, or an application may add a section (using
|
|
|
|
<<bfd_make_section>>) to the sections attached to an already open
|
|
|
|
BFD. For example, the linker creates an extra section
|
|
|
|
<<COMMON>> for each input file's BFD to hold information about
|
|
|
|
common storage.
|
|
|
|
|
|
|
|
The raw data is not necessarily read in when
|
|
|
|
the section descriptor is created. Some targets may leave the
|
|
|
|
data in place until a <<bfd_get_section_contents>> call is
|
|
|
|
made. Other back ends may read in all the data at once. For
|
|
|
|
example, an S-record file has to be read once to determine the
|
|
|
|
size of the data. An IEEE-695 file doesn't contain raw data in
|
|
|
|
sections, but data and relocation expressions intermixed, so
|
|
|
|
the data area has to be parsed to get out the data and
|
|
|
|
relocations.
|
|
|
|
|
|
|
|
INODE
|
|
|
|
Section Output, typedef asection, Section Input, Sections
|
|
|
|
|
|
|
|
SUBSECTION
|
|
|
|
Section output
|
|
|
|
|
|
|
|
To write a new object style BFD, the various sections to be
|
|
|
|
written have to be created. They are attached to the BFD in
|
|
|
|
the same way as input sections; data is written to the
|
|
|
|
sections using <<bfd_set_section_contents>>.
|
|
|
|
|
|
|
|
Any program that creates or combines sections (e.g., the assembler
|
|
|
|
and linker) must use the <<asection>> fields <<output_section>> and
|
|
|
|
<<output_offset>> to indicate the file sections to which each
|
|
|
|
section must be written. (If the section is being created from
|
|
|
|
scratch, <<output_section>> should probably point to the section
|
|
|
|
itself and <<output_offset>> should probably be zero.)
|
|
|
|
|
|
|
|
The data to be written comes from input sections attached
|
|
|
|
(via <<output_section>> pointers) to
|
|
|
|
the output sections. The output section structure can be
|
|
|
|
considered a filter for the input section: the output section
|
|
|
|
determines the vma of the output data and the name, but the
|
|
|
|
input section determines the offset into the output section of
|
|
|
|
the data to be written.
|
|
|
|
|
|
|
|
E.g., to create a section "O", starting at 0x100, 0x123 long,
|
|
|
|
containing two subsections, "A" at offset 0x0 (i.e., at vma
|
|
|
|
0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the <<asection>>
|
|
|
|
structures would look like:
|
|
|
|
|
|
|
|
| section name "A"
|
|
|
|
| output_offset 0x00
|
|
|
|
| size 0x20
|
|
|
|
| output_section -----------> section name "O"
|
|
|
|
| | vma 0x100
|
|
|
|
| section name "B" | size 0x123
|
|
|
|
| output_offset 0x20 |
|
|
|
|
| size 0x103 |
|
|
|
|
| output_section --------|
|
|
|
|
|
|
|
|
SUBSECTION
|
|
|
|
Link orders
|
|
|
|
|
|
|
|
The data within a section is stored in a @dfn{link_order}.
|
|
|
|
These are much like the fixups in <<gas>>. The link_order
|
|
|
|
abstraction allows a section to grow and shrink within itself.
|
|
|
|
|
|
|
|
A link_order knows how big it is, and which is the next
|
|
|
|
link_order and where the raw data for it is; it also points to
|
|
|
|
a list of relocations which apply to it.
|
|
|
|
|
|
|
|
The link_order is used by the linker to perform relaxing on
|
|
|
|
final code. The compiler creates code which is as big as
|
|
|
|
necessary to make it work without relaxing, and the user can
|
|
|
|
select whether to relax. Sometimes relaxing takes a lot of
|
|
|
|
time. The linker runs around the relocations to see if any
|
|
|
|
are attached to data which can be shrunk, if so it does it on
|
|
|
|
a link_order by link_order basis.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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"
|
|
|
|
#include "bfdlink.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
DOCDD
|
|
|
|
INODE
|
|
|
|
typedef asection, section prototypes, Section Output, Sections
|
|
|
|
SUBSECTION
|
|
|
|
typedef asection
|
|
|
|
|
|
|
|
Here is the section structure:
|
|
|
|
|
|
|
|
CODE_FRAGMENT
|
|
|
|
.
|
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
|
|
|
.typedef struct bfd_section
|
1999-05-03 07:29:11 +00:00
|
|
|
.{
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The name of the section; the name isn't a copy, the pointer is
|
|
|
|
. the same as that passed to bfd_make_section. *}
|
|
|
|
. const char *name;
|
|
|
|
.
|
|
|
|
. {* A unique sequence number. *}
|
|
|
|
. int id;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2001-10-09 06:05:17 +00:00
|
|
|
. {* Which section in the bfd; 0..n-1 as sections are created in a bfd. *}
|
2000-07-08 12:08:43 +00:00
|
|
|
. int index;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The next section in the list belonging to the BFD, or NULL. *}
|
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 *next;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2005-05-03 01:05:03 +00:00
|
|
|
. {* The previous section in the list belonging to the BFD, or NULL. *}
|
|
|
|
. struct bfd_section *prev;
|
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The field flags contains attributes of the section. Some
|
|
|
|
. flags are read in from the object file, and some are
|
|
|
|
. synthesized from other information. *}
|
|
|
|
. flagword flags;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
|
|
|
.#define SEC_NO_FLAGS 0x000
|
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* Tells the OS to allocate space for this section when loading.
|
|
|
|
. This is clear for a section containing debug information only. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
.#define SEC_ALLOC 0x001
|
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* Tells the OS to load the section from the file when loading.
|
|
|
|
. This is clear for a .bss section. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
.#define SEC_LOAD 0x002
|
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The section contains data still to be relocated, so there is
|
|
|
|
. some relocation information too. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
.#define SEC_RELOC 0x004
|
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* A signal to the OS that the section contains read only data. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_READONLY 0x008
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The section contains code only. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_CODE 0x010
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The section contains data only. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_DATA 0x020
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The section will reside in ROM. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_ROM 0x040
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The section contains constructor information. This section
|
|
|
|
. type is used by the linker to create lists of constructors and
|
|
|
|
. destructors used by <<g++>>. When a back end sees a symbol
|
|
|
|
. which should be used in a constructor list, it creates a new
|
|
|
|
. section for the type of name (e.g., <<__CTOR_LIST__>>), attaches
|
|
|
|
. the symbol to it, and builds a relocation. To build the lists
|
|
|
|
. of constructors, all the linker has to do is catenate all the
|
|
|
|
. sections called <<__CTOR_LIST__>> and relocate the data
|
|
|
|
. contained within - exactly the operations it would peform on
|
|
|
|
. standard data. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_CONSTRUCTOR 0x080
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The section has contents - a data section could be
|
|
|
|
. <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
|
|
|
|
. <<SEC_HAS_CONTENTS>> *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_HAS_CONTENTS 0x100
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* An instruction to the linker to not output the section
|
|
|
|
. even if it has information which would normally be written. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_NEVER_LOAD 0x200
|
1999-05-03 07:29: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
|
|
|
. {* The section contains thread local data. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_THREAD_LOCAL 0x400
|
* 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
|
|
|
.
|
2000-09-05 02:42:16 +00:00
|
|
|
. {* The section has GOT references. This flag is only for the
|
|
|
|
. linker, and is currently only used by the elf32-hppa back end.
|
|
|
|
. It will be set if global offset table references were detected
|
|
|
|
. in this section, which indicate to the linker that the section
|
|
|
|
. contains PIC code, and must be handled specially when doing a
|
|
|
|
. static link. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_HAS_GOT_REF 0x800
|
2000-09-05 02:42:16 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The section contains common symbols (symbols may be defined
|
|
|
|
. multiple times, the value of a symbol is the amount of
|
|
|
|
. space it requires, and the largest symbol value is the one
|
|
|
|
. used). Most targets have exactly one of these (which we
|
|
|
|
. translate to bfd_com_section_ptr), but ECOFF has two. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_IS_COMMON 0x1000
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The section contains only debugging information. For
|
|
|
|
. example, this is set for ELF .debug and .stab sections.
|
|
|
|
. strip tests this flag to see if a section can be
|
|
|
|
. discarded. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_DEBUGGING 0x2000
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The contents of this section are held in memory pointed to
|
|
|
|
. by the contents field. This is checked by bfd_get_section_contents,
|
|
|
|
. and the data is retrieved from memory if appropriate. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_IN_MEMORY 0x4000
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The contents of this section are to be excluded by the
|
|
|
|
. linker for executable and shared objects unless those
|
|
|
|
. objects are to be further relocated. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_EXCLUDE 0x8000
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2001-10-09 06:05:17 +00:00
|
|
|
. {* The contents of this section are to be sorted based on the sum of
|
|
|
|
. the symbol and addend values specified by the associated relocation
|
|
|
|
. entries. Entries without associated relocation entries will be
|
|
|
|
. appended to the end of the section in an unspecified order. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_SORT_ENTRIES 0x10000
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* When linking, duplicate sections of the same name should be
|
|
|
|
. discarded, rather than being combined into a single section as
|
|
|
|
. is usually done. This is similar to how common symbols are
|
|
|
|
. handled. See SEC_LINK_DUPLICATES below. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_LINK_ONCE 0x20000
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* If SEC_LINK_ONCE is set, this bitfield describes how the linker
|
|
|
|
. should handle duplicate sections. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_LINK_DUPLICATES 0xc0000
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* This value for SEC_LINK_DUPLICATES means that duplicate
|
|
|
|
. sections with the same name should simply be discarded. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
.#define SEC_LINK_DUPLICATES_DISCARD 0x0
|
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* This value for SEC_LINK_DUPLICATES means that the linker
|
|
|
|
. should warn if there are any duplicate sections, although
|
|
|
|
. it should still only link one copy. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_LINK_DUPLICATES_ONE_ONLY 0x40000
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* This value for SEC_LINK_DUPLICATES means that the linker
|
|
|
|
. should warn if any duplicate sections are a different size. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_LINK_DUPLICATES_SAME_SIZE 0x80000
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* This value for SEC_LINK_DUPLICATES means that the linker
|
|
|
|
. should warn if any duplicate sections contain different
|
|
|
|
. contents. *}
|
2005-02-22 00:50:07 +00:00
|
|
|
.#define SEC_LINK_DUPLICATES_SAME_CONTENTS \
|
|
|
|
. (SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE)
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* This section was created by the linker as part of dynamic
|
|
|
|
. relocation or other arcane processing. It is skipped when
|
|
|
|
. going through the first-pass output, trusting that someone
|
|
|
|
. else up the line will take care of it later. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_LINKER_CREATED 0x100000
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2006-10-27 03:22:09 +00:00
|
|
|
. {* This section should not be subject to garbage collection.
|
|
|
|
. Also set to inform the linker that this section should not be
|
|
|
|
. listed in the link map as discarded. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_KEEP 0x200000
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* This section contains "short" data, and should be placed
|
|
|
|
. "near" the GP. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_SMALL_DATA 0x400000
|
2000-04-07 00:58:07 +00:00
|
|
|
.
|
2001-04-14 04:13:00 +00:00
|
|
|
. {* Attempt to merge identical entities in the section.
|
|
|
|
. Entity size is given in the entsize field. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_MERGE 0x800000
|
2001-04-14 04:13:00 +00:00
|
|
|
.
|
|
|
|
. {* If given with SEC_MERGE, entities to merge are zero terminated
|
|
|
|
. strings where entsize specifies character size instead of fixed
|
|
|
|
. size entries. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_STRINGS 0x1000000
|
2001-04-14 04:13:00 +00:00
|
|
|
.
|
2001-10-09 06:05:17 +00:00
|
|
|
. {* This section contains data about section groups. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_GROUP 0x2000000
|
2005-02-22 00:50:07 +00:00
|
|
|
.
|
|
|
|
. {* The section is a COFF shared library section. This flag is
|
|
|
|
. only for the linker. If this type of section appears in
|
|
|
|
. the input file, the linker must copy it to the output file
|
|
|
|
. without changing the vma or size. FIXME: Although this
|
|
|
|
. was originally intended to be general, it really is COFF
|
|
|
|
. specific (and the flag was renamed to indicate this). It
|
|
|
|
. might be cleaner to have some more general mechanism to
|
|
|
|
. allow the back end to control what the linker does with
|
|
|
|
. sections. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_COFF_SHARED_LIBRARY 0x4000000
|
2005-02-22 00:50:07 +00:00
|
|
|
.
|
|
|
|
. {* This section contains data which may be shared with other
|
|
|
|
. executables or shared objects. This is for COFF only. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_COFF_SHARED 0x8000000
|
2005-02-22 00:50:07 +00:00
|
|
|
.
|
|
|
|
. {* When a section with this flag is being linked, then if the size of
|
|
|
|
. the input section is less than a page, it should not cross a page
|
|
|
|
. boundary. If the size of the input section is one page or more,
|
|
|
|
. it should be aligned on a page boundary. This is for TI
|
|
|
|
. TMS320C54X only. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_TIC54X_BLOCK 0x10000000
|
2005-02-22 00:50:07 +00:00
|
|
|
.
|
|
|
|
. {* Conditionally link this section; do not link if there are no
|
|
|
|
. references found to any symbol in the section. This is for TI
|
|
|
|
. TMS320C54X only. *}
|
2008-02-15 10:35:46 +00:00
|
|
|
.#define SEC_TIC54X_CLINK 0x20000000
|
2001-10-09 06:05:17 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* End of section flags. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* Some internal packed boolean fields. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* See the vma field. *}
|
|
|
|
. unsigned int user_set_vma : 1;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* A mark flag used by some of the linker backends. *}
|
|
|
|
. unsigned int linker_mark : 1;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2001-05-17 03:58:45 +00:00
|
|
|
. {* Another mark flag used by some of the linker backends. Set for
|
2001-10-10 12:08:29 +00:00
|
|
|
. output sections that have an input section. *}
|
2001-05-17 03:58:45 +00:00
|
|
|
. unsigned int linker_has_input : 1;
|
|
|
|
.
|
2007-12-15 09:34:48 +00:00
|
|
|
. {* Mark flag used by some linker backends for garbage collection. *}
|
2000-07-08 12:08:43 +00:00
|
|
|
. unsigned int gc_mark : 1;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
bfd
* elf-bfd.h (enum elf_link_info_type): Remove.
(struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
to struct sec. Remove linkonce_p field.
(elf_linkonce_p): Delete.
(elf_discarded_section): Update for sec_info_type change.
* section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
(ELF_INFO_TYPE_NONE): Define.
(ELF_INFO_TYPE_STABS): Define.
(ELF_INFO_TYPE_MERGE): Define.
(ELF_INFO_TYPE_EH_FRAME): Define.
(ELF_INFO_TYPE_JUST_SYMS): Define.
(STD_SECTION): Update struct sec initializer.
* ecoff.c (bfd_debug_section): Likewise.
* elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p.
* elflink.h: Likewise.
* elf-eh-frame.c: Likewise.
* elf64-alpha.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* bfd-in2.h: Regenerate.
* elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
referring to used_by_bfd.
* elf64-sparc.c (sec_do_relax): Likewise.
* elf64-mmix.c (mmix_elf_section_data): Likewise.
* elfxx-mips.c (mips_elf_section_data): Likewise.
* ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
(ieee_get_section_contents): Likewise.
(ieee_new_section_hook): Formatting.
(ieee_canonicalize_reloc): Remove commented out code.
* mmo.c (mmo_section_data): Define. Use throughout file.
* oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
gas
* config/obj-elf.c (obj_elf_change_section): Set SEC_LINK_ONCE and
SEC_LINK_DUPLICATES_DISCARD directly rather than using elf_linkonce_p.
2003-02-04 12:34:08 +00:00
|
|
|
. {* The following flags are used by the ELF linker. *}
|
|
|
|
.
|
|
|
|
. {* Mark sections which have been allocated to segments. *}
|
2000-08-03 19:40:29 +00:00
|
|
|
. unsigned int segment_mark : 1;
|
|
|
|
.
|
bfd
* elf-bfd.h (enum elf_link_info_type): Remove.
(struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
to struct sec. Remove linkonce_p field.
(elf_linkonce_p): Delete.
(elf_discarded_section): Update for sec_info_type change.
* section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
(ELF_INFO_TYPE_NONE): Define.
(ELF_INFO_TYPE_STABS): Define.
(ELF_INFO_TYPE_MERGE): Define.
(ELF_INFO_TYPE_EH_FRAME): Define.
(ELF_INFO_TYPE_JUST_SYMS): Define.
(STD_SECTION): Update struct sec initializer.
* ecoff.c (bfd_debug_section): Likewise.
* elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p.
* elflink.h: Likewise.
* elf-eh-frame.c: Likewise.
* elf64-alpha.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* bfd-in2.h: Regenerate.
* elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
referring to used_by_bfd.
* elf64-sparc.c (sec_do_relax): Likewise.
* elf64-mmix.c (mmix_elf_section_data): Likewise.
* elfxx-mips.c (mips_elf_section_data): Likewise.
* ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
(ieee_get_section_contents): Likewise.
(ieee_new_section_hook): Formatting.
(ieee_canonicalize_reloc): Remove commented out code.
* mmo.c (mmo_section_data): Define. Use throughout file.
* oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
gas
* config/obj-elf.c (obj_elf_change_section): Set SEC_LINK_ONCE and
SEC_LINK_DUPLICATES_DISCARD directly rather than using elf_linkonce_p.
2003-02-04 12:34:08 +00:00
|
|
|
. {* Type of sec_info information. *}
|
|
|
|
. unsigned int sec_info_type:3;
|
|
|
|
.#define ELF_INFO_TYPE_NONE 0
|
|
|
|
.#define ELF_INFO_TYPE_STABS 1
|
|
|
|
.#define ELF_INFO_TYPE_MERGE 2
|
|
|
|
.#define ELF_INFO_TYPE_EH_FRAME 3
|
|
|
|
.#define ELF_INFO_TYPE_JUST_SYMS 4
|
|
|
|
.
|
|
|
|
. {* Nonzero if this section uses RELA relocations, rather than REL. *}
|
|
|
|
. unsigned int use_rela_p:1;
|
|
|
|
.
|
2005-01-06 09:03:56 +00:00
|
|
|
. {* Bits used by various backends. The generic code doesn't touch
|
|
|
|
. these fields. *}
|
bfd
* elf-bfd.h (enum elf_link_info_type): Remove.
(struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
to struct sec. Remove linkonce_p field.
(elf_linkonce_p): Delete.
(elf_discarded_section): Update for sec_info_type change.
* section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
(ELF_INFO_TYPE_NONE): Define.
(ELF_INFO_TYPE_STABS): Define.
(ELF_INFO_TYPE_MERGE): Define.
(ELF_INFO_TYPE_EH_FRAME): Define.
(ELF_INFO_TYPE_JUST_SYMS): Define.
(STD_SECTION): Update struct sec initializer.
* ecoff.c (bfd_debug_section): Likewise.
* elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p.
* elflink.h: Likewise.
* elf-eh-frame.c: Likewise.
* elf64-alpha.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* bfd-in2.h: Regenerate.
* elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
referring to used_by_bfd.
* elf64-sparc.c (sec_do_relax): Likewise.
* elf64-mmix.c (mmix_elf_section_data): Likewise.
* elfxx-mips.c (mips_elf_section_data): Likewise.
* ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
(ieee_get_section_contents): Likewise.
(ieee_new_section_hook): Formatting.
(ieee_canonicalize_reloc): Remove commented out code.
* mmo.c (mmo_section_data): Define. Use throughout file.
* oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
gas
* config/obj-elf.c (obj_elf_change_section): Set SEC_LINK_ONCE and
SEC_LINK_DUPLICATES_DISCARD directly rather than using elf_linkonce_p.
2003-02-04 12:34:08 +00:00
|
|
|
.
|
2004-06-15 01:24:22 +00:00
|
|
|
. {* Nonzero if this section has TLS related relocations. *}
|
|
|
|
. unsigned int has_tls_reloc:1;
|
2003-04-29 01:53:46 +00:00
|
|
|
.
|
2009-03-04 05:50:50 +00:00
|
|
|
. {* Nonzero if this section has a call to __tls_get_addr. *}
|
|
|
|
. unsigned int has_tls_get_addr_call:1;
|
|
|
|
.
|
2003-06-08 14:06:38 +00:00
|
|
|
. {* Nonzero if this section has a gp reloc. *}
|
|
|
|
. unsigned int has_gp_reloc:1;
|
|
|
|
.
|
2004-06-15 01:24:22 +00:00
|
|
|
. {* Nonzero if this section needs the relax finalize pass. *}
|
|
|
|
. unsigned int need_finalize_relax:1;
|
|
|
|
.
|
|
|
|
. {* Whether relocations have been processed. *}
|
|
|
|
. unsigned int reloc_done : 1;
|
bfd
* elf-bfd.h (enum elf_link_info_type): Remove.
(struct bfd_elf_section_data): Move sec_info_type, use_rela_p fields
to struct sec. Remove linkonce_p field.
(elf_linkonce_p): Delete.
(elf_discarded_section): Update for sec_info_type change.
* section.c (struct sec): Add sec_info_type, use_rela_p, has_tls_reloc,
flag11, flag12, flag13, flag14, flag15, flag16, flag20, flag24.
(ELF_INFO_TYPE_NONE): Define.
(ELF_INFO_TYPE_STABS): Define.
(ELF_INFO_TYPE_MERGE): Define.
(ELF_INFO_TYPE_EH_FRAME): Define.
(ELF_INFO_TYPE_JUST_SYMS): Define.
(STD_SECTION): Update struct sec initializer.
* ecoff.c (bfd_debug_section): Likewise.
* elf.c: Likewise. Update occurrences of sec_info_type and use_rela_p.
* elflink.h: Likewise.
* elf-eh-frame.c: Likewise.
* elf64-alpha.c: Likewise.
* elfxx-ia64.c: Likewise.
* elfxx-mips.c: Likewise.
* bfd-in2.h: Regenerate.
* elf32-sparc.c (sec_do_relax): Use elf_section_data macro rather than
referring to used_by_bfd.
* elf64-sparc.c (sec_do_relax): Likewise.
* elf64-mmix.c (mmix_elf_section_data): Likewise.
* elfxx-mips.c (mips_elf_section_data): Likewise.
* ieee.c (ieee_slurp_section_data): Use ieee_per_section macro.
(ieee_get_section_contents): Likewise.
(ieee_new_section_hook): Formatting.
(ieee_canonicalize_reloc): Remove commented out code.
* mmo.c (mmo_section_data): Define. Use throughout file.
* oasys.c (oasys_get_section_contents): Use oasys_per_section macro.
gas
* config/obj-elf.c (obj_elf_change_section): Set SEC_LINK_ONCE and
SEC_LINK_DUPLICATES_DISCARD directly rather than using elf_linkonce_p.
2003-02-04 12:34:08 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* End of internal packed boolean fields. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The virtual memory address of the section - where it will be
|
|
|
|
. at run time. The symbols are relocated against this. The
|
|
|
|
. user_set_vma flag is maintained by bfd; if it's not set, the
|
|
|
|
. backend can assign addresses (for example, in <<a.out>>, where
|
|
|
|
. the default address for <<.data>> is dependent on the specific
|
|
|
|
. target and various flags). *}
|
|
|
|
. bfd_vma vma;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The load address of the section - where it would be in a
|
|
|
|
. rom image; really only used for writing section header
|
2002-01-30 18:12:17 +00:00
|
|
|
. information. *}
|
2000-07-08 12:08:43 +00:00
|
|
|
. bfd_vma lma;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The size of the section in octets, as it will be output.
|
|
|
|
. Contains a value even if the section has no contents (e.g., the
|
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
|
|
|
. size of <<.bss>>). *}
|
|
|
|
. bfd_size_type size;
|
|
|
|
.
|
2004-06-29 14:13:47 +00:00
|
|
|
. {* For input sections, the original size on disk of the section, in
|
2007-10-16 23:51:55 +00:00
|
|
|
. octets. This field should be set for any section whose size is
|
|
|
|
. changed by linker relaxation. It is required for sections where
|
|
|
|
. the linker relaxation scheme doesn't cache altered section and
|
|
|
|
. reloc contents (stabs, eh_frame, SEC_MERGE, some coff relaxing
|
|
|
|
. targets), and thus the original size needs to be kept to read the
|
|
|
|
. section multiple times. For output sections, rawsize holds the
|
|
|
|
. section size calculated on a previous linker relaxation pass. *}
|
bfd/
* 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
|
|
|
. bfd_size_type rawsize;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* If this section is going to be output, then this value is the
|
|
|
|
. offset in *bytes* into the output section of the first byte in the
|
|
|
|
. input section (byte ==> smallest addressable unit on the
|
|
|
|
. target). In most cases, if this was going to start at the
|
|
|
|
. 100th octet (8-bit quantity) in the output section, this value
|
|
|
|
. would be 100. However, if the target byte size is 16 bits
|
|
|
|
. (bfd_octets_per_byte is "2"), this value would be 50. *}
|
|
|
|
. bfd_vma output_offset;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The output section through which to map on output. *}
|
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 *output_section;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The alignment requirement of the section, as an exponent of 2 -
|
|
|
|
. e.g., 3 aligns to 2^3 (or 8). *}
|
|
|
|
. unsigned int alignment_power;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* If an input section, a pointer to a vector of relocation
|
|
|
|
. records for the data in this section. *}
|
|
|
|
. struct reloc_cache_entry *relocation;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* If an output section, a pointer to a vector of pointers to
|
|
|
|
. relocation records for the data in this section. *}
|
|
|
|
. struct reloc_cache_entry **orelocation;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* The number of relocation records in one of the above. *}
|
2000-07-08 12:08:43 +00:00
|
|
|
. unsigned reloc_count;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* Information below is back end specific - and not always used
|
|
|
|
. or updated. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* File position of section data. *}
|
|
|
|
. file_ptr filepos;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* File position of relocation info. *}
|
|
|
|
. file_ptr rel_filepos;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* File position of line data. *}
|
|
|
|
. file_ptr line_filepos;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* Pointer to data for applications. *}
|
2003-06-29 10:06:40 +00:00
|
|
|
. void *userdata;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* If the SEC_IN_MEMORY flag is set, this points to the actual
|
|
|
|
. contents. *}
|
|
|
|
. unsigned char *contents;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* Attached line number information. *}
|
|
|
|
. alent *lineno;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* Number of line number records. *}
|
|
|
|
. unsigned int lineno_count;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2001-04-14 04:13:00 +00:00
|
|
|
. {* Entity size for merging purposes. *}
|
|
|
|
. unsigned int entsize;
|
|
|
|
.
|
2003-06-18 00:30:04 +00:00
|
|
|
. {* Points to the kept section if this section is a link-once section,
|
|
|
|
. and is discarded. *}
|
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 *kept_section;
|
2003-06-18 00:30:04 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* When a section is being output, this value changes as more
|
|
|
|
. linenumbers are written out. *}
|
|
|
|
. file_ptr moving_line_filepos;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* What the section number is in the target world. *}
|
|
|
|
. int target_index;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2003-06-29 10:06:40 +00:00
|
|
|
. void *used_by_bfd;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* If this is a constructor section then here is a list of the
|
|
|
|
. relocations created to relocate items within it. *}
|
|
|
|
. struct relent_chain *constructor_chain;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
. {* The BFD which owns the section. *}
|
|
|
|
. bfd *owner;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
. {* A symbol which points at this section only. *}
|
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
|
|
|
. struct bfd_symbol *symbol;
|
|
|
|
. struct bfd_symbol **symbol_ptr_ptr;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2005-05-04 11:00:28 +00:00
|
|
|
. {* Early in the link process, map_head and map_tail are used to build
|
|
|
|
. a list of input sections attached to an output section. Later,
|
|
|
|
. output sections use these fields for a list of bfd_link_order
|
|
|
|
. structs. *}
|
|
|
|
. union {
|
|
|
|
. struct bfd_link_order *link_order;
|
|
|
|
. struct bfd_section *s;
|
|
|
|
. } map_head, map_tail;
|
2002-01-30 18:12:17 +00:00
|
|
|
.} asection;
|
1999-05-03 07:29:11 +00:00
|
|
|
.
|
2000-07-08 12:08:43 +00:00
|
|
|
.{* These sections are global, and are managed by BFD. The application
|
|
|
|
. and target back end are not permitted to change the values in
|
|
|
|
. these sections. New code should use the section_ptr macros rather
|
|
|
|
. than referring directly to the const sections. The const sections
|
|
|
|
. may eventually vanish. *}
|
1999-05-03 07:29:11 +00:00
|
|
|
.#define BFD_ABS_SECTION_NAME "*ABS*"
|
|
|
|
.#define BFD_UND_SECTION_NAME "*UND*"
|
|
|
|
.#define BFD_COM_SECTION_NAME "*COM*"
|
|
|
|
.#define BFD_IND_SECTION_NAME "*IND*"
|
|
|
|
.
|
2002-01-30 18:12:17 +00:00
|
|
|
.{* The absolute section. *}
|
2003-07-25 14:35:56 +00:00
|
|
|
.extern asection bfd_abs_section;
|
1999-05-03 07:29:11 +00:00
|
|
|
.#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
|
|
|
|
.#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
|
2002-01-30 18:12:17 +00:00
|
|
|
.{* Pointer to the undefined section. *}
|
2003-07-25 14:35:56 +00:00
|
|
|
.extern asection bfd_und_section;
|
1999-05-03 07:29:11 +00:00
|
|
|
.#define bfd_und_section_ptr ((asection *) &bfd_und_section)
|
|
|
|
.#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
|
2002-01-30 18:12:17 +00:00
|
|
|
.{* Pointer to the common section. *}
|
2003-07-25 14:35:56 +00:00
|
|
|
.extern asection bfd_com_section;
|
1999-05-03 07:29:11 +00:00
|
|
|
.#define bfd_com_section_ptr ((asection *) &bfd_com_section)
|
2002-01-30 18:12:17 +00:00
|
|
|
.{* Pointer to the indirect section. *}
|
2003-07-25 14:35:56 +00:00
|
|
|
.extern asection bfd_ind_section;
|
1999-05-03 07:29:11 +00:00
|
|
|
.#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
|
|
|
|
.#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
|
|
|
|
.
|
2001-11-19 15:35:38 +00:00
|
|
|
.#define bfd_is_const_section(SEC) \
|
|
|
|
. ( ((SEC) == bfd_abs_section_ptr) \
|
|
|
|
. || ((SEC) == bfd_und_section_ptr) \
|
|
|
|
. || ((SEC) == bfd_com_section_ptr) \
|
|
|
|
. || ((SEC) == bfd_ind_section_ptr))
|
|
|
|
.
|
2002-01-05 13:11:33 +00:00
|
|
|
.{* Macros to handle insertion and deletion of a bfd's sections. These
|
|
|
|
. only handle the list pointers, ie. do not adjust section_count,
|
|
|
|
. target_index etc. *}
|
2005-05-03 01:05:03 +00:00
|
|
|
.#define bfd_section_list_remove(ABFD, S) \
|
|
|
|
. do \
|
|
|
|
. { \
|
|
|
|
. asection *_s = S; \
|
|
|
|
. asection *_next = _s->next; \
|
|
|
|
. asection *_prev = _s->prev; \
|
|
|
|
. if (_prev) \
|
|
|
|
. _prev->next = _next; \
|
|
|
|
. else \
|
|
|
|
. (ABFD)->sections = _next; \
|
|
|
|
. if (_next) \
|
2005-05-03 17:05:51 +00:00
|
|
|
. _next->prev = _prev; \
|
2005-05-03 01:05:03 +00:00
|
|
|
. else \
|
|
|
|
. (ABFD)->section_last = _prev; \
|
|
|
|
. } \
|
|
|
|
. while (0)
|
|
|
|
.#define bfd_section_list_append(ABFD, S) \
|
2002-01-05 13:11:33 +00:00
|
|
|
. do \
|
|
|
|
. { \
|
2005-05-03 01:05:03 +00:00
|
|
|
. asection *_s = S; \
|
|
|
|
. bfd *_abfd = ABFD; \
|
|
|
|
. _s->next = NULL; \
|
|
|
|
. if (_abfd->section_last) \
|
|
|
|
. { \
|
|
|
|
. _s->prev = _abfd->section_last; \
|
|
|
|
. _abfd->section_last->next = _s; \
|
|
|
|
. } \
|
|
|
|
. else \
|
2005-05-03 17:05:51 +00:00
|
|
|
. { \
|
|
|
|
. _s->prev = NULL; \
|
|
|
|
. _abfd->sections = _s; \
|
|
|
|
. } \
|
2005-05-03 01:05:03 +00:00
|
|
|
. _abfd->section_last = _s; \
|
|
|
|
. } \
|
|
|
|
. while (0)
|
2005-05-03 17:05:51 +00:00
|
|
|
.#define bfd_section_list_prepend(ABFD, S) \
|
|
|
|
. do \
|
|
|
|
. { \
|
|
|
|
. asection *_s = S; \
|
|
|
|
. bfd *_abfd = ABFD; \
|
|
|
|
. _s->prev = NULL; \
|
|
|
|
. if (_abfd->sections) \
|
|
|
|
. { \
|
|
|
|
. _s->next = _abfd->sections; \
|
|
|
|
. _abfd->sections->prev = _s; \
|
|
|
|
. } \
|
|
|
|
. else \
|
|
|
|
. { \
|
|
|
|
. _s->next = NULL; \
|
|
|
|
. _abfd->section_last = _s; \
|
|
|
|
. } \
|
|
|
|
. _abfd->sections = _s; \
|
|
|
|
. } \
|
|
|
|
. while (0)
|
2005-05-03 01:05:03 +00:00
|
|
|
.#define bfd_section_list_insert_after(ABFD, A, S) \
|
|
|
|
. do \
|
|
|
|
. { \
|
|
|
|
. asection *_a = A; \
|
|
|
|
. asection *_s = S; \
|
|
|
|
. asection *_next = _a->next; \
|
|
|
|
. _s->next = _next; \
|
|
|
|
. _s->prev = _a; \
|
|
|
|
. _a->next = _s; \
|
|
|
|
. if (_next) \
|
2005-05-03 17:05:51 +00:00
|
|
|
. _next->prev = _s; \
|
2005-04-11 22:21:23 +00:00
|
|
|
. else \
|
2005-05-03 01:05:03 +00:00
|
|
|
. (ABFD)->section_last = _s; \
|
2002-01-05 13:11:33 +00:00
|
|
|
. } \
|
|
|
|
. while (0)
|
2005-05-03 01:05:03 +00:00
|
|
|
.#define bfd_section_list_insert_before(ABFD, B, S) \
|
2002-01-05 13:11:33 +00:00
|
|
|
. do \
|
|
|
|
. { \
|
2005-05-03 01:05:03 +00:00
|
|
|
. asection *_b = B; \
|
2002-01-05 13:11:33 +00:00
|
|
|
. asection *_s = S; \
|
2005-05-03 01:05:03 +00:00
|
|
|
. asection *_prev = _b->prev; \
|
|
|
|
. _s->prev = _prev; \
|
|
|
|
. _s->next = _b; \
|
|
|
|
. _b->prev = _s; \
|
|
|
|
. if (_prev) \
|
|
|
|
. _prev->next = _s; \
|
|
|
|
. else \
|
|
|
|
. (ABFD)->sections = _s; \
|
2002-01-05 13:11:33 +00:00
|
|
|
. } \
|
|
|
|
. while (0)
|
2005-05-03 01:05:03 +00:00
|
|
|
.#define bfd_section_removed_from_list(ABFD, S) \
|
2005-05-03 17:05:51 +00:00
|
|
|
. ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
|
2002-01-05 13:11:33 +00:00
|
|
|
.
|
2006-05-03 14:26:41 +00:00
|
|
|
.#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
|
2005-07-25 15:35:37 +00:00
|
|
|
. {* name, id, index, next, prev, flags, user_set_vma, *} \
|
|
|
|
. { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
|
|
|
|
. \
|
2007-12-18 19:48:07 +00:00
|
|
|
. {* linker_mark, linker_has_input, gc_mark, *} \
|
|
|
|
. 0, 0, 1, \
|
2005-07-25 15:35:37 +00:00
|
|
|
. \
|
|
|
|
. {* segment_mark, sec_info_type, use_rela_p, has_tls_reloc, *} \
|
|
|
|
. 0, 0, 0, 0, \
|
|
|
|
. \
|
2009-03-04 05:50:50 +00:00
|
|
|
. {* has_tls_get_addr_call, has_gp_reloc, need_finalize_relax, *} \
|
|
|
|
. 0, 0, 0, \
|
2005-07-25 15:35:37 +00:00
|
|
|
. \
|
2009-03-04 05:50:50 +00:00
|
|
|
. {* reloc_done, vma, lma, size, rawsize *} \
|
|
|
|
. 0, 0, 0, 0, 0, \
|
2005-07-25 15:35:37 +00:00
|
|
|
. \
|
|
|
|
. {* output_offset, output_section, alignment_power, *} \
|
|
|
|
. 0, (struct bfd_section *) &SEC, 0, \
|
|
|
|
. \
|
|
|
|
. {* relocation, orelocation, reloc_count, filepos, rel_filepos, *} \
|
|
|
|
. NULL, NULL, 0, 0, 0, \
|
|
|
|
. \
|
|
|
|
. {* line_filepos, userdata, contents, lineno, lineno_count, *} \
|
|
|
|
. 0, NULL, NULL, NULL, 0, \
|
|
|
|
. \
|
|
|
|
. {* entsize, kept_section, moving_line_filepos, *} \
|
|
|
|
. 0, NULL, 0, \
|
|
|
|
. \
|
|
|
|
. {* target_index, used_by_bfd, constructor_chain, owner, *} \
|
|
|
|
. 0, NULL, NULL, NULL, \
|
|
|
|
. \
|
2006-05-03 14:26:41 +00:00
|
|
|
. {* symbol, symbol_ptr_ptr, *} \
|
|
|
|
. (struct bfd_symbol *) SYM, &SEC.symbol, \
|
2005-07-25 15:35:37 +00:00
|
|
|
. \
|
|
|
|
. {* map_head, map_tail *} \
|
|
|
|
. { NULL }, { NULL } \
|
|
|
|
. }
|
|
|
|
.
|
1999-05-03 07:29:11 +00:00
|
|
|
*/
|
|
|
|
|
1999-08-06 23:31:14 +00:00
|
|
|
/* We use a macro to initialize the static asymbol structures because
|
|
|
|
traditional C does not permit us to initialize a union member while
|
|
|
|
gcc warns if we don't initialize it. */
|
|
|
|
/* the_bfd, name, value, attr, section [, udata] */
|
|
|
|
#ifdef __STDC__
|
|
|
|
#define GLOBAL_SYM_INIT(NAME, SECTION) \
|
|
|
|
{ 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION, { 0 }}
|
|
|
|
#else
|
|
|
|
#define GLOBAL_SYM_INIT(NAME, SECTION) \
|
|
|
|
{ 0, NAME, 0, BSF_SECTION_SYM, (asection *) SECTION }
|
|
|
|
#endif
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
/* These symbols are global, not specific to any BFD. Therefore, anything
|
|
|
|
that tries to change them is broken, and should be repaired. */
|
1999-08-06 23:31:14 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
static const asymbol global_syms[] =
|
|
|
|
{
|
1999-08-06 23:31:14 +00:00
|
|
|
GLOBAL_SYM_INIT (BFD_COM_SECTION_NAME, &bfd_com_section),
|
|
|
|
GLOBAL_SYM_INIT (BFD_UND_SECTION_NAME, &bfd_und_section),
|
|
|
|
GLOBAL_SYM_INIT (BFD_ABS_SECTION_NAME, &bfd_abs_section),
|
|
|
|
GLOBAL_SYM_INIT (BFD_IND_SECTION_NAME, &bfd_ind_section)
|
1999-05-03 07:29:11 +00:00
|
|
|
};
|
|
|
|
|
2006-05-03 14:26:41 +00:00
|
|
|
#define STD_SECTION(SEC, FLAGS, NAME, IDX) \
|
|
|
|
asection SEC = BFD_FAKE_SECTION(SEC, FLAGS, &global_syms[IDX], \
|
2005-07-25 15:35:37 +00:00
|
|
|
NAME, IDX)
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2006-05-03 14:26:41 +00:00
|
|
|
STD_SECTION (bfd_com_section, SEC_IS_COMMON, BFD_COM_SECTION_NAME, 0);
|
|
|
|
STD_SECTION (bfd_und_section, 0, BFD_UND_SECTION_NAME, 1);
|
|
|
|
STD_SECTION (bfd_abs_section, 0, BFD_ABS_SECTION_NAME, 2);
|
|
|
|
STD_SECTION (bfd_ind_section, 0, BFD_IND_SECTION_NAME, 3);
|
1999-05-03 07:29:11 +00:00
|
|
|
#undef STD_SECTION
|
|
|
|
|
2001-12-17 00:40:53 +00:00
|
|
|
/* Initialize an entry in the section hash table. */
|
|
|
|
|
|
|
|
struct bfd_hash_entry *
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_section_hash_newfunc (struct bfd_hash_entry *entry,
|
|
|
|
struct bfd_hash_table *table,
|
|
|
|
const char *string)
|
2001-12-17 00:40:53 +00:00
|
|
|
{
|
|
|
|
/* Allocate the structure if it has not already been allocated by a
|
|
|
|
subclass. */
|
|
|
|
if (entry == NULL)
|
|
|
|
{
|
* 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
|
|
|
entry = (struct bfd_hash_entry *)
|
|
|
|
bfd_hash_allocate (table, sizeof (struct section_hash_entry));
|
2001-12-17 00:40:53 +00:00
|
|
|
if (entry == NULL)
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Call the allocation method of the superclass. */
|
|
|
|
entry = bfd_hash_newfunc (entry, table, string);
|
|
|
|
if (entry != NULL)
|
2003-06-29 10:06:40 +00:00
|
|
|
memset (&((struct section_hash_entry *) entry)->section, 0,
|
|
|
|
sizeof (asection));
|
2001-12-17 00:40:53 +00:00
|
|
|
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define section_hash_lookup(table, string, create, copy) \
|
|
|
|
((struct section_hash_entry *) \
|
|
|
|
bfd_hash_lookup ((table), (string), (create), (copy)))
|
|
|
|
|
2006-05-03 14:26:41 +00:00
|
|
|
/* Create a symbol whose only job is to point to this section. This
|
|
|
|
is useful for things like relocs which are relative to the base
|
|
|
|
of a section. */
|
2001-12-17 00:40:53 +00:00
|
|
|
|
2006-05-03 14:26:41 +00:00
|
|
|
bfd_boolean
|
|
|
|
_bfd_generic_new_section_hook (bfd *abfd, asection *newsect)
|
2001-12-17 00:40:53 +00:00
|
|
|
{
|
|
|
|
newsect->symbol = bfd_make_empty_symbol (abfd);
|
|
|
|
if (newsect->symbol == NULL)
|
2006-05-03 14:26:41 +00:00
|
|
|
return FALSE;
|
2001-12-17 00:40:53 +00:00
|
|
|
|
|
|
|
newsect->symbol->name = newsect->name;
|
|
|
|
newsect->symbol->value = 0;
|
|
|
|
newsect->symbol->section = newsect;
|
|
|
|
newsect->symbol->flags = BSF_SECTION_SYM;
|
|
|
|
|
|
|
|
newsect->symbol_ptr_ptr = &newsect->symbol;
|
2006-05-03 14:26:41 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initializes a new section. NEWSECT->NAME is already set. */
|
|
|
|
|
|
|
|
static asection *
|
|
|
|
bfd_section_init (bfd *abfd, asection *newsect)
|
|
|
|
{
|
|
|
|
static int section_id = 0x10; /* id 0 to 3 used by STD_SECTION. */
|
|
|
|
|
|
|
|
newsect->id = section_id;
|
|
|
|
newsect->index = abfd->section_count;
|
|
|
|
newsect->owner = abfd;
|
2001-12-17 00:40:53 +00:00
|
|
|
|
|
|
|
if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect)))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
section_id++;
|
|
|
|
abfd->section_count++;
|
2005-05-03 01:05:03 +00:00
|
|
|
bfd_section_list_append (abfd, newsect);
|
2001-12-17 00:40:53 +00:00
|
|
|
return newsect;
|
|
|
|
}
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
/*
|
|
|
|
DOCDD
|
|
|
|
INODE
|
|
|
|
section prototypes, , typedef asection, Sections
|
|
|
|
SUBSECTION
|
|
|
|
Section prototypes
|
|
|
|
|
|
|
|
These are the functions exported by the section handling part of BFD.
|
|
|
|
*/
|
|
|
|
|
2002-01-05 13:11:33 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_section_list_clear
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
void bfd_section_list_clear (bfd *);
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Clears the section list, and also resets the section count and
|
|
|
|
hash table entries.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_section_list_clear (bfd *abfd)
|
2002-01-05 13:11:33 +00:00
|
|
|
{
|
|
|
|
abfd->sections = NULL;
|
2005-05-03 01:05:03 +00:00
|
|
|
abfd->section_last = NULL;
|
2002-01-05 13:11:33 +00:00
|
|
|
abfd->section_count = 0;
|
2003-06-29 10:06:40 +00:00
|
|
|
memset (abfd->section_htab.table, 0,
|
2002-01-05 13:11:33 +00:00
|
|
|
abfd->section_htab.size * sizeof (struct bfd_hash_entry *));
|
|
|
|
}
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_get_section_by_name
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
asection *bfd_get_section_by_name (bfd *abfd, const char *name);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Run through @var{abfd} and return the one of the
|
|
|
|
<<asection>>s whose name matches @var{name}, otherwise <<NULL>>.
|
|
|
|
@xref{Sections}, for more information.
|
|
|
|
|
|
|
|
This should only be used in special cases; the normal way to process
|
|
|
|
all sections of a given name is to use <<bfd_map_over_sections>> and
|
|
|
|
<<strcmp>> on the name (or better yet, base it on the section flags
|
|
|
|
or something else) for each section.
|
|
|
|
*/
|
|
|
|
|
|
|
|
asection *
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_get_section_by_name (bfd *abfd, const char *name)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2001-12-17 00:40:53 +00:00
|
|
|
struct section_hash_entry *sh;
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE);
|
2001-12-17 00:40:53 +00:00
|
|
|
if (sh != NULL)
|
|
|
|
return &sh->section;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-05-02 14:36:25 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_get_section_by_name_if
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
asection *bfd_get_section_by_name_if
|
|
|
|
(bfd *abfd,
|
|
|
|
const char *name,
|
|
|
|
bfd_boolean (*func) (bfd *abfd, asection *sect, void *obj),
|
|
|
|
void *obj);
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Call the provided function @var{func} for each section
|
|
|
|
attached to the BFD @var{abfd} whose name matches @var{name},
|
|
|
|
passing @var{obj} as an argument. The function will be called
|
|
|
|
as if by
|
|
|
|
|
|
|
|
| func (abfd, the_section, obj);
|
|
|
|
|
|
|
|
It returns the first section for which @var{func} returns true,
|
|
|
|
otherwise <<NULL>>.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
asection *
|
|
|
|
bfd_get_section_by_name_if (bfd *abfd, const char *name,
|
|
|
|
bfd_boolean (*operation) (bfd *,
|
|
|
|
asection *,
|
|
|
|
void *),
|
|
|
|
void *user_storage)
|
|
|
|
{
|
|
|
|
struct section_hash_entry *sh;
|
|
|
|
unsigned long hash;
|
|
|
|
|
|
|
|
sh = section_hash_lookup (&abfd->section_htab, name, FALSE, FALSE);
|
|
|
|
if (sh == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
hash = sh->root.hash;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ((*operation) (abfd, &sh->section, user_storage))
|
|
|
|
return &sh->section;
|
|
|
|
sh = (struct section_hash_entry *) sh->root.next;
|
|
|
|
}
|
|
|
|
while (sh != NULL && sh->root.hash == hash
|
|
|
|
&& strcmp (sh->root.string, name) == 0);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-09-05 02:42:16 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_get_unique_section_name
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
char *bfd_get_unique_section_name
|
|
|
|
(bfd *abfd, const char *templat, int *count);
|
2000-09-05 02:42:16 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Invent a section name that is unique in @var{abfd} by tacking
|
2000-09-08 02:11:34 +00:00
|
|
|
a dot and a digit suffix onto the original @var{templat}. If
|
|
|
|
@var{count} is non-NULL, then it specifies the first number
|
|
|
|
tried as a suffix to generate a unique name. The value
|
|
|
|
pointed to by @var{count} will be incremented in this case.
|
2000-09-05 02:42:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
char *
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_get_unique_section_name (bfd *abfd, const char *templat, int *count)
|
2000-09-05 02:42:16 +00:00
|
|
|
{
|
|
|
|
int num;
|
|
|
|
unsigned int len;
|
|
|
|
char *sname;
|
|
|
|
|
2000-09-06 00:22:01 +00:00
|
|
|
len = strlen (templat);
|
2003-06-29 10:06:40 +00:00
|
|
|
sname = bfd_malloc (len + 8);
|
2000-09-20 04:20:26 +00:00
|
|
|
if (sname == NULL)
|
|
|
|
return NULL;
|
2002-06-25 09:40:45 +00:00
|
|
|
memcpy (sname, templat, len);
|
2000-09-05 02:42:16 +00:00
|
|
|
num = 1;
|
|
|
|
if (count != NULL)
|
|
|
|
num = *count;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
/* If we have a million sections, something is badly wrong. */
|
|
|
|
if (num > 999999)
|
|
|
|
abort ();
|
2000-09-08 02:11:34 +00:00
|
|
|
sprintf (sname + len, ".%d", num++);
|
2000-09-05 02:42:16 +00:00
|
|
|
}
|
2002-11-30 08:39:46 +00:00
|
|
|
while (section_hash_lookup (&abfd->section_htab, sname, FALSE, FALSE));
|
2000-09-05 02:42:16 +00:00
|
|
|
|
|
|
|
if (count != NULL)
|
|
|
|
*count = num;
|
|
|
|
return sname;
|
|
|
|
}
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_make_section_old_way
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
asection *bfd_make_section_old_way (bfd *abfd, const char *name);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Create a new empty section called @var{name}
|
|
|
|
and attach it to the end of the chain of sections for the
|
|
|
|
BFD @var{abfd}. An attempt to create a section with a name which
|
|
|
|
is already in use returns its pointer without changing the
|
|
|
|
section chain.
|
|
|
|
|
|
|
|
It has the funny name since this is the way it used to be
|
|
|
|
before it was rewritten....
|
|
|
|
|
|
|
|
Possible errors are:
|
|
|
|
o <<bfd_error_invalid_operation>> -
|
|
|
|
If output has already started for this BFD.
|
|
|
|
o <<bfd_error_no_memory>> -
|
|
|
|
If memory allocation fails.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
asection *
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_make_section_old_way (bfd *abfd, const char *name)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2001-12-17 00:40:53 +00:00
|
|
|
asection *newsect;
|
|
|
|
|
|
|
|
if (abfd->output_has_begun)
|
|
|
|
{
|
|
|
|
bfd_set_error (bfd_error_invalid_operation);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strcmp (name, BFD_ABS_SECTION_NAME) == 0)
|
2006-05-03 14:26:41 +00:00
|
|
|
newsect = bfd_abs_section_ptr;
|
|
|
|
else if (strcmp (name, BFD_COM_SECTION_NAME) == 0)
|
|
|
|
newsect = bfd_com_section_ptr;
|
|
|
|
else if (strcmp (name, BFD_UND_SECTION_NAME) == 0)
|
|
|
|
newsect = bfd_und_section_ptr;
|
|
|
|
else if (strcmp (name, BFD_IND_SECTION_NAME) == 0)
|
|
|
|
newsect = bfd_ind_section_ptr;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
struct section_hash_entry *sh;
|
2001-12-17 00:40:53 +00:00
|
|
|
|
2006-05-03 14:26:41 +00:00
|
|
|
sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
|
|
|
|
if (sh == NULL)
|
|
|
|
return NULL;
|
2001-12-17 00:40:53 +00:00
|
|
|
|
2006-05-03 14:26:41 +00:00
|
|
|
newsect = &sh->section;
|
|
|
|
if (newsect->name != NULL)
|
|
|
|
{
|
|
|
|
/* Section already exists. */
|
|
|
|
return newsect;
|
|
|
|
}
|
2001-12-17 00:40:53 +00:00
|
|
|
|
2006-05-03 14:26:41 +00:00
|
|
|
newsect->name = name;
|
|
|
|
return bfd_section_init (abfd, newsect);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
2001-12-17 00:40:53 +00:00
|
|
|
|
2006-05-03 14:26:41 +00:00
|
|
|
/* Call new_section_hook when "creating" the standard abs, com, und
|
|
|
|
and ind sections to tack on format specific section data.
|
|
|
|
Also, create a proper section symbol. */
|
|
|
|
if (! BFD_SEND (abfd, _new_section_hook, (abfd, newsect)))
|
|
|
|
return NULL;
|
|
|
|
return newsect;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
2005-05-05 14:34:04 +00:00
|
|
|
bfd_make_section_anyway_with_flags
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
SYNOPSIS
|
2005-05-05 14:34:04 +00:00
|
|
|
asection *bfd_make_section_anyway_with_flags
|
|
|
|
(bfd *abfd, const char *name, flagword flags);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Create a new empty section called @var{name} and attach it to the end of
|
|
|
|
the chain of sections for @var{abfd}. Create a new section even if there
|
2005-05-05 14:34:04 +00:00
|
|
|
is already a section with that name. Also set the attributes of the
|
|
|
|
new section to the value @var{flags}.
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
Return <<NULL>> and set <<bfd_error>> on error; possible errors are:
|
|
|
|
o <<bfd_error_invalid_operation>> - If output has already started for @var{abfd}.
|
|
|
|
o <<bfd_error_no_memory>> - If memory allocation fails.
|
|
|
|
*/
|
|
|
|
|
|
|
|
sec_ptr
|
2005-05-05 14:34:04 +00:00
|
|
|
bfd_make_section_anyway_with_flags (bfd *abfd, const char *name,
|
|
|
|
flagword flags)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2001-12-17 00:40:53 +00:00
|
|
|
struct section_hash_entry *sh;
|
1999-05-03 07:29:11 +00:00
|
|
|
asection *newsect;
|
|
|
|
|
|
|
|
if (abfd->output_has_begun)
|
|
|
|
{
|
|
|
|
bfd_set_error (bfd_error_invalid_operation);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
|
2001-12-17 00:40:53 +00:00
|
|
|
if (sh == NULL)
|
1999-05-03 07:29:11 +00:00
|
|
|
return NULL;
|
|
|
|
|
2001-12-17 00:40:53 +00:00
|
|
|
newsect = &sh->section;
|
|
|
|
if (newsect->name != NULL)
|
2000-10-10 15:23:38 +00:00
|
|
|
{
|
2004-04-30 14:23:40 +00:00
|
|
|
/* We are making a section of the same name. Put it in the
|
|
|
|
section hash table. Even though we can't find it directly by a
|
|
|
|
hash lookup, we'll be able to find the section by traversing
|
|
|
|
sh->root.next quicker than looking at all the bfd sections. */
|
|
|
|
struct section_hash_entry *new_sh;
|
|
|
|
new_sh = (struct section_hash_entry *)
|
|
|
|
bfd_section_hash_newfunc (NULL, &abfd->section_htab, name);
|
|
|
|
if (new_sh == NULL)
|
2001-12-17 00:40:53 +00:00
|
|
|
return NULL;
|
2004-04-30 14:23:40 +00:00
|
|
|
|
2004-05-01 14:20:26 +00:00
|
|
|
new_sh->root = sh->root;
|
2004-04-30 14:23:40 +00:00
|
|
|
sh->root.next = &new_sh->root;
|
|
|
|
newsect = &new_sh->section;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2005-05-05 14:34:04 +00:00
|
|
|
newsect->flags = flags;
|
2001-12-17 00:40:53 +00:00
|
|
|
newsect->name = name;
|
|
|
|
return bfd_section_init (abfd, newsect);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
2005-05-05 14:34:04 +00:00
|
|
|
bfd_make_section_anyway
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
SYNOPSIS
|
2005-05-05 14:34:04 +00:00
|
|
|
asection *bfd_make_section_anyway (bfd *abfd, const char *name);
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Create a new empty section called @var{name} and attach it to the end of
|
|
|
|
the chain of sections for @var{abfd}. Create a new section even if there
|
|
|
|
is already a section with that name.
|
|
|
|
|
|
|
|
Return <<NULL>> and set <<bfd_error>> on error; possible errors are:
|
|
|
|
o <<bfd_error_invalid_operation>> - If output has already started for @var{abfd}.
|
|
|
|
o <<bfd_error_no_memory>> - If memory allocation fails.
|
|
|
|
*/
|
|
|
|
|
|
|
|
sec_ptr
|
|
|
|
bfd_make_section_anyway (bfd *abfd, const char *name)
|
|
|
|
{
|
|
|
|
return bfd_make_section_anyway_with_flags (abfd, name, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_make_section_with_flags
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
asection *bfd_make_section_with_flags
|
|
|
|
(bfd *, const char *name, flagword flags);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling
|
|
|
|
bfd_set_error ()) without changing the section chain if there is already a
|
2005-05-05 14:34:04 +00:00
|
|
|
section named @var{name}. Also set the attributes of the new section to
|
|
|
|
the value @var{flags}. If there is an error, return <<NULL>> and set
|
1999-05-03 07:29:11 +00:00
|
|
|
<<bfd_error>>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
asection *
|
2005-05-05 14:34:04 +00:00
|
|
|
bfd_make_section_with_flags (bfd *abfd, const char *name,
|
|
|
|
flagword flags)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2001-12-17 00:40:53 +00:00
|
|
|
struct section_hash_entry *sh;
|
|
|
|
asection *newsect;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2001-12-17 00:40:53 +00:00
|
|
|
if (abfd->output_has_begun)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2001-12-17 00:40:53 +00:00
|
|
|
bfd_set_error (bfd_error_invalid_operation);
|
|
|
|
return NULL;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2001-12-17 00:40:53 +00:00
|
|
|
if (strcmp (name, BFD_ABS_SECTION_NAME) == 0
|
|
|
|
|| strcmp (name, BFD_COM_SECTION_NAME) == 0
|
|
|
|
|| strcmp (name, BFD_UND_SECTION_NAME) == 0
|
|
|
|
|| strcmp (name, BFD_IND_SECTION_NAME) == 0)
|
|
|
|
return NULL;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
sh = section_hash_lookup (&abfd->section_htab, name, TRUE, FALSE);
|
2001-12-17 00:40:53 +00:00
|
|
|
if (sh == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
newsect = &sh->section;
|
|
|
|
if (newsect->name != NULL)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
2001-12-17 00:40:53 +00:00
|
|
|
/* Section already exists. */
|
2003-07-04 04:14:56 +00:00
|
|
|
return NULL;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2001-12-17 00:40:53 +00:00
|
|
|
newsect->name = name;
|
2005-05-05 14:34:04 +00:00
|
|
|
newsect->flags = flags;
|
2001-12-17 00:40:53 +00:00
|
|
|
return bfd_section_init (abfd, newsect);
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2005-05-05 14:34:04 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_make_section
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
asection *bfd_make_section (bfd *, const char *name);
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Like <<bfd_make_section_anyway>>, but return <<NULL>> (without calling
|
|
|
|
bfd_set_error ()) without changing the section chain if there is already a
|
|
|
|
section named @var{name}. If there is an error, return <<NULL>> and set
|
|
|
|
<<bfd_error>>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
asection *
|
|
|
|
bfd_make_section (bfd *abfd, const char *name)
|
|
|
|
{
|
|
|
|
return bfd_make_section_with_flags (abfd, name, 0);
|
|
|
|
}
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_set_section_flags
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_boolean bfd_set_section_flags
|
|
|
|
(bfd *abfd, asection *sec, flagword flags);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Set the attributes of the section @var{sec} in the BFD
|
2002-11-30 08:39:46 +00:00
|
|
|
@var{abfd} to the value @var{flags}. Return <<TRUE>> on success,
|
|
|
|
<<FALSE>> on error. Possible error returns are:
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
o <<bfd_error_invalid_operation>> -
|
|
|
|
The section cannot have one or more of the attributes
|
|
|
|
requested. For example, a .bss section in <<a.out>> may not
|
|
|
|
have the <<SEC_HAS_CONTENTS>> field set.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_set_section_flags (bfd *abfd ATTRIBUTE_UNUSED,
|
|
|
|
sec_ptr section,
|
|
|
|
flagword flags)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
section->flags = flags;
|
2002-11-30 08:39:46 +00:00
|
|
|
return TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_map_over_sections
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
void bfd_map_over_sections
|
|
|
|
(bfd *abfd,
|
|
|
|
void (*func) (bfd *abfd, asection *sect, void *obj),
|
|
|
|
void *obj);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Call the provided function @var{func} for each section
|
|
|
|
attached to the BFD @var{abfd}, passing @var{obj} as an
|
|
|
|
argument. The function will be called as if by
|
|
|
|
|
2003-06-29 10:06:40 +00:00
|
|
|
| func (abfd, the_section, obj);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2003-11-30 18:40:41 +00:00
|
|
|
This is the preferred method for iterating over sections; an
|
1999-05-03 07:29:11 +00:00
|
|
|
alternative would be to use a loop:
|
|
|
|
|
|
|
|
| section *p;
|
|
|
|
| for (p = abfd->sections; p != NULL; p = p->next)
|
2003-06-29 10:06:40 +00:00
|
|
|
| func (abfd, p, ...)
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_map_over_sections (bfd *abfd,
|
|
|
|
void (*operation) (bfd *, asection *, void *),
|
|
|
|
void *user_storage)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
asection *sect;
|
|
|
|
unsigned int i = 0;
|
|
|
|
|
|
|
|
for (sect = abfd->sections; sect != NULL; i++, sect = sect->next)
|
|
|
|
(*operation) (abfd, sect, user_storage);
|
|
|
|
|
|
|
|
if (i != abfd->section_count) /* Debugging */
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
2004-04-30 15:01:15 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_sections_find_if
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
asection *bfd_sections_find_if
|
|
|
|
(bfd *abfd,
|
2004-09-10 21:16:27 +00:00
|
|
|
bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj),
|
2004-04-30 15:01:15 +00:00
|
|
|
void *obj);
|
|
|
|
|
|
|
|
DESCRIPTION
|
2004-09-10 21:16:27 +00:00
|
|
|
Call the provided function @var{operation} for each section
|
2004-04-30 15:01:15 +00:00
|
|
|
attached to the BFD @var{abfd}, passing @var{obj} as an
|
|
|
|
argument. The function will be called as if by
|
|
|
|
|
2004-09-10 21:16:27 +00:00
|
|
|
| operation (abfd, the_section, obj);
|
2004-04-30 15:01:15 +00:00
|
|
|
|
2004-09-10 21:16:27 +00:00
|
|
|
It returns the first section for which @var{operation} returns true.
|
2004-04-30 15:01:15 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
asection *
|
|
|
|
bfd_sections_find_if (bfd *abfd,
|
|
|
|
bfd_boolean (*operation) (bfd *, asection *, void *),
|
|
|
|
void *user_storage)
|
|
|
|
{
|
|
|
|
asection *sect;
|
|
|
|
|
|
|
|
for (sect = abfd->sections; sect != NULL; sect = sect->next)
|
|
|
|
if ((*operation) (abfd, sect, user_storage))
|
|
|
|
break;
|
|
|
|
|
|
|
|
return sect;
|
|
|
|
}
|
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_set_section_size
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_boolean bfd_set_section_size
|
|
|
|
(bfd *abfd, asection *sec, bfd_size_type val);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Set @var{sec} to the size @var{val}. If the operation is
|
2002-11-30 08:39:46 +00:00
|
|
|
ok, then <<TRUE>> is returned, else <<FALSE>>.
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
Possible error returns:
|
|
|
|
o <<bfd_error_invalid_operation>> -
|
|
|
|
Writing has started to the BFD, so setting the size is invalid.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_set_section_size (bfd *abfd, sec_ptr ptr, bfd_size_type val)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
/* Once you've started writing to any section you cannot create or change
|
2000-12-20 00:21:57 +00:00
|
|
|
the size of any others. */
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
if (abfd->output_has_begun)
|
|
|
|
{
|
|
|
|
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/
* 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
|
|
|
ptr->size = val;
|
2002-11-30 08:39:46 +00:00
|
|
|
return TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_set_section_contents
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_boolean bfd_set_section_contents
|
2003-11-03 14:44:08 +00:00
|
|
|
(bfd *abfd, asection *section, const void *data,
|
|
|
|
file_ptr offset, bfd_size_type count);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Sets the contents of the section @var{section} in BFD
|
|
|
|
@var{abfd} to the data starting in memory at @var{data}. The
|
|
|
|
data is written to the output section starting at offset
|
2000-01-13 22:10:36 +00:00
|
|
|
@var{offset} for @var{count} octets.
|
1999-05-03 07:29:11 +00:00
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
Normally <<TRUE>> is returned, else <<FALSE>>. Possible error
|
1999-05-03 07:29:11 +00:00
|
|
|
returns are:
|
|
|
|
o <<bfd_error_no_contents>> -
|
|
|
|
The output section does not have the <<SEC_HAS_CONTENTS>>
|
|
|
|
attribute, so nothing can be written to it.
|
|
|
|
o and some more too
|
|
|
|
|
|
|
|
This routine is front end to the back end function
|
|
|
|
<<_bfd_set_section_contents>>.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_set_section_contents (bfd *abfd,
|
|
|
|
sec_ptr section,
|
2003-11-03 14:44:08 +00:00
|
|
|
const void *location,
|
2003-06-29 10:06:40 +00:00
|
|
|
file_ptr offset,
|
|
|
|
bfd_size_type count)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
bfd_size_type sz;
|
|
|
|
|
|
|
|
if (!(bfd_get_section_flags (abfd, section) & SEC_HAS_CONTENTS))
|
|
|
|
{
|
|
|
|
bfd_set_error (bfd_error_no_contents);
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
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
|
|
|
sz = section->size;
|
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_size_type) offset > sz
|
|
|
|
|| count > sz
|
|
|
|
|| offset + count > sz
|
|
|
|
|| count != (size_t) count)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
bfd_set_error (bfd_error_bad_value);
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2005-05-17 19:44:55 +00:00
|
|
|
if (!bfd_write_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
|
|
|
}
|
|
|
|
|
2000-11-08 07:54:31 +00:00
|
|
|
/* Record a copy of the data in memory if desired. */
|
|
|
|
if (section->contents
|
2003-06-29 10:06:40 +00:00
|
|
|
&& location != section->contents + offset)
|
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
|
|
|
memcpy (section->contents + offset, location, (size_t) count);
|
2000-11-08 07:54:31 +00:00
|
|
|
|
1999-05-03 07:29:11 +00:00
|
|
|
if (BFD_SEND (abfd, _bfd_set_section_contents,
|
|
|
|
(abfd, section, location, offset, count)))
|
|
|
|
{
|
2002-11-30 08:39:46 +00:00
|
|
|
abfd->output_has_begun = TRUE;
|
|
|
|
return TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_get_section_contents
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_boolean bfd_get_section_contents
|
|
|
|
(bfd *abfd, asection *section, void *location, file_ptr offset,
|
|
|
|
bfd_size_type count);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Read data from @var{section} in BFD @var{abfd}
|
|
|
|
into memory starting at @var{location}. The data is read at an
|
|
|
|
offset of @var{offset} from the start of the input section,
|
|
|
|
and is read for @var{count} bytes.
|
|
|
|
|
|
|
|
If the contents of a constructor with the <<SEC_CONSTRUCTOR>>
|
|
|
|
flag set are requested or if the section does not have the
|
|
|
|
<<SEC_HAS_CONTENTS>> flag set, then the @var{location} is filled
|
2002-11-30 08:39:46 +00:00
|
|
|
with zeroes. If no errors occur, <<TRUE>> is returned, else
|
|
|
|
<<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_get_section_contents (bfd *abfd,
|
|
|
|
sec_ptr section,
|
|
|
|
void *location,
|
|
|
|
file_ptr offset,
|
|
|
|
bfd_size_type count)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
bfd_size_type sz;
|
|
|
|
|
|
|
|
if (section->flags & SEC_CONSTRUCTOR)
|
|
|
|
{
|
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
|
|
|
memset (location, 0, (size_t) count);
|
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
|
|
|
sz = section->rawsize ? section->rawsize : section->size;
|
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_size_type) offset > sz
|
|
|
|
|| count > sz
|
|
|
|
|| offset + count > sz
|
|
|
|
|| count != (size_t) count)
|
1999-05-03 07:29:11 +00:00
|
|
|
{
|
|
|
|
bfd_set_error (bfd_error_bad_value);
|
2002-11-30 08:39:46 +00:00
|
|
|
return FALSE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (count == 0)
|
|
|
|
/* Don't bother. */
|
2002-11-30 08:39:46 +00:00
|
|
|
return TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
if ((section->flags & SEC_HAS_CONTENTS) == 0)
|
|
|
|
{
|
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
|
|
|
memset (location, 0, (size_t) count);
|
2002-11-30 08:39:46 +00:00
|
|
|
return TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((section->flags & SEC_IN_MEMORY) != 0)
|
|
|
|
{
|
|
|
|
memcpy (location, section->contents + offset, (size_t) count);
|
2002-11-30 08:39:46 +00:00
|
|
|
return TRUE;
|
1999-05-03 07:29:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return BFD_SEND (abfd, _bfd_get_section_contents,
|
|
|
|
(abfd, section, location, offset, count));
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_malloc_and_get_section
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
bfd_boolean bfd_malloc_and_get_section
|
|
|
|
(bfd *abfd, asection *section, bfd_byte **buf);
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Read all data from @var{section} in BFD @var{abfd}
|
|
|
|
into a buffer, *@var{buf}, malloc'd by this function.
|
|
|
|
*/
|
|
|
|
|
|
|
|
bfd_boolean
|
|
|
|
bfd_malloc_and_get_section (bfd *abfd, sec_ptr sec, bfd_byte **buf)
|
|
|
|
{
|
|
|
|
bfd_size_type sz = sec->rawsize ? sec->rawsize : sec->size;
|
|
|
|
bfd_byte *p = NULL;
|
|
|
|
|
|
|
|
*buf = p;
|
|
|
|
if (sz == 0)
|
|
|
|
return TRUE;
|
|
|
|
|
2004-06-29 14:13:47 +00:00
|
|
|
p = bfd_malloc (sec->rawsize > sec->size ? sec->rawsize : sec->size);
|
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
|
|
|
if (p == NULL)
|
|
|
|
return FALSE;
|
|
|
|
*buf = p;
|
|
|
|
|
|
|
|
return bfd_get_section_contents (abfd, sec, p, 0, sz);
|
|
|
|
}
|
1999-05-03 07:29:11 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_copy_private_section_data
|
|
|
|
|
|
|
|
SYNOPSIS
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_boolean bfd_copy_private_section_data
|
|
|
|
(bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
|
1999-05-03 07:29:11 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Copy private section information from @var{isec} in the BFD
|
|
|
|
@var{ibfd} to the section @var{osec} 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_section_data(ibfd, isection, obfd, osection) \
|
|
|
|
. BFD_SEND (obfd, _bfd_copy_private_section_data, \
|
|
|
|
. (ibfd, isection, obfd, osection))
|
|
|
|
*/
|
|
|
|
|
2004-04-30 14:23:40 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
|
|
|
bfd_generic_is_group_section
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec);
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Returns TRUE if @var{sec} is a member of a group.
|
|
|
|
*/
|
|
|
|
|
|
|
|
bfd_boolean
|
|
|
|
bfd_generic_is_group_section (bfd *abfd ATTRIBUTE_UNUSED,
|
|
|
|
const asection *sec ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2002-06-04 01:05:21 +00:00
|
|
|
/*
|
|
|
|
FUNCTION
|
2002-06-05 03:43:11 +00:00
|
|
|
bfd_generic_discard_group
|
2002-06-04 01:05:21 +00:00
|
|
|
|
|
|
|
SYNOPSIS
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group);
|
2002-06-04 01:05:21 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
Remove all members of @var{group} from the output.
|
|
|
|
*/
|
|
|
|
|
2002-11-30 08:39:46 +00:00
|
|
|
bfd_boolean
|
2003-06-29 10:06:40 +00:00
|
|
|
bfd_generic_discard_group (bfd *abfd ATTRIBUTE_UNUSED,
|
|
|
|
asection *group ATTRIBUTE_UNUSED)
|
2002-06-04 01:05:21 +00:00
|
|
|
{
|
2002-11-30 08:39:46 +00:00
|
|
|
return TRUE;
|
2002-06-04 01:05:21 +00:00
|
|
|
}
|