diff options
author | Alan Modra <amodra@gmail.com> | 2019-09-16 20:25:17 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-09-19 09:40:13 +0930 |
commit | fd3619828e94a24a92cddec42cbc0ab33352eeb4 (patch) | |
tree | 496b4a1d9bc015f6d1177758a811afa3f6e6895e | |
parent | 5dfda3562a69686c43aad4fb0269cc9d5ec010d5 (diff) | |
download | binutils-gdb-fd3619828e94a24a92cddec42cbc0ab33352eeb4.tar.gz |
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
305 files changed, 1917 insertions, 1996 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 63f6c4c33ff..8fff6a67523 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,50 @@ 2019-09-18 Alan Modra <amodra@gmail.com> + * bfd-in.h (bfd_get_section_name, bfd_get_section_vma), + (bfd_get_section_lma, bfd_get_section_alignment), + (bfd_get_section_size, bfd_get_section_flags), + (bfd_get_section_userdata): Delete. + (bfd_section_name, bfd_section_size, bfd_section_vma), + (bfd_section_lma, bfd_section_alignment): Lose bfd parameter. + (bfd_section_flags, bfd_section_userdata): New. + (bfd_is_com_section): Rename parameter. + * section.c (bfd_set_section_userdata, bfd_set_section_vma), + (bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section), + (bfd_set_section_size): Delete bfd parameter, rename section parameter. + (bfd_set_section_lma): New. + * bfd-in2.h: Regenerate. + * mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param, + update callers. + * aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c, + * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, + * compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h, + * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c, + * elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c, + * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, + * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, + * elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, + * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, + * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, + * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, + * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, + * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, + * elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c, + * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, + * elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c, + * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, + * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, + * elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, + * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, + * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, + * elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c, + * elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c, + * mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c, + * peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c, + * xcofflink.c: Update throughout for bfd section macro and function + changes. + +2019-09-18 Alan Modra <amodra@gmail.com> + * bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section. (bfd_get_output_section): Delete. (bfd_asymbol_base): Delete. diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 859153be100..8923ca7b3cb 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -3108,18 +3108,18 @@ aout_link_add_symbols (bfd *abfd, struct bfd_link_info *info) break; case N_TEXT | N_EXT: section = obj_textsec (abfd); - value -= bfd_get_section_vma (abfd, section); + value -= bfd_section_vma (section); break; case N_DATA | N_EXT: case N_SETV | N_EXT: /* Treat N_SETV symbols as N_DATA symbol; see comment in translate_from_native_sym_flags. */ section = obj_datasec (abfd); - value -= bfd_get_section_vma (abfd, section); + value -= bfd_section_vma (section); break; case N_BSS | N_EXT: section = obj_bsssec (abfd); - value -= bfd_get_section_vma (abfd, section); + value -= bfd_section_vma (section); break; case N_INDR | N_EXT: /* An indirect symbol. The next symbol is the symbol @@ -3145,17 +3145,17 @@ aout_link_add_symbols (bfd *abfd, struct bfd_link_info *info) case N_SETT: case N_SETT | N_EXT: section = obj_textsec (abfd); flags |= BSF_CONSTRUCTOR; - value -= bfd_get_section_vma (abfd, section); + value -= bfd_section_vma (section); break; case N_SETD: case N_SETD | N_EXT: section = obj_datasec (abfd); flags |= BSF_CONSTRUCTOR; - value -= bfd_get_section_vma (abfd, section); + value -= bfd_section_vma (section); break; case N_SETB: case N_SETB | N_EXT: section = obj_bsssec (abfd); flags |= BSF_CONSTRUCTOR; - value -= bfd_get_section_vma (abfd, section); + value -= bfd_section_vma (section); break; case N_WARNING: /* A warning symbol. The next symbol is the one to warn @@ -3181,17 +3181,17 @@ aout_link_add_symbols (bfd *abfd, struct bfd_link_info *info) break; case N_WEAKT: section = obj_textsec (abfd); - value -= bfd_get_section_vma (abfd, section); + value -= bfd_section_vma (section); flags = BSF_WEAK; break; case N_WEAKD: section = obj_datasec (abfd); - value -= bfd_get_section_vma (abfd, section); + value -= bfd_section_vma (section); flags = BSF_WEAK; break; case N_WEAKB: section = obj_bsssec (abfd); - value -= bfd_get_section_vma (abfd, section); + value -= bfd_section_vma (section); flags = BSF_WEAK; break; } @@ -3899,8 +3899,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo, (*flaginfo->info->callbacks->reloc_overflow) (flaginfo->info, NULL, (p->type == bfd_section_reloc_link_order - ? bfd_section_name (flaginfo->output_bfd, - pr->u.section) + ? bfd_section_name (pr->u.section) : pr->u.name), howto->name, pr->addend, NULL, NULL, (bfd_vma) 0); break; @@ -4314,7 +4313,7 @@ aout_link_input_section_std (struct aout_final_link_info *flaginfo, asection *s; s = aout_reloc_index_to_section (input_bfd, r_index); - name = bfd_section_name (input_bfd, s); + name = bfd_section_name (s); } (*flaginfo->info->callbacks->reloc_overflow) (flaginfo->info, (h ? &h->root : NULL), name, howto->name, @@ -4728,7 +4727,7 @@ aout_link_input_section_ext (struct aout_final_link_info *flaginfo, asection *s; s = aout_reloc_index_to_section (input_bfd, r_index); - name = bfd_section_name (input_bfd, s); + name = bfd_section_name (s); } (*flaginfo->info->callbacks->reloc_overflow) (flaginfo->info, (h ? &h->root : NULL), name, @@ -4868,8 +4867,7 @@ aout_link_write_symbols (struct aout_final_link_info *flaginfo, bfd *input_bfd) return FALSE; PUT_WORD (output_bfd, strtab_index, outsym->e_strx); PUT_WORD (output_bfd, - (bfd_get_section_vma (output_bfd, - obj_textsec (input_bfd)->output_section) + (bfd_section_vma (obj_textsec (input_bfd)->output_section) + obj_textsec (input_bfd)->output_offset), outsym->e_value); ++obj_aout_external_sym_count (output_bfd); @@ -5077,7 +5075,7 @@ aout_link_write_symbols (struct aout_final_link_info *flaginfo, bfd *input_bfd) BFD_ASSERT (bfd_is_abs_section (output_section) || output_section->owner == output_bfd); val = (hresolve->root.u.def.value - + bfd_get_section_vma (output_bfd, output_section) + + bfd_section_vma (output_section) + input_section->output_offset); /* Get the correct type based on the section. If diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 5a303443501..e55e3e90ba7 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -299,21 +299,15 @@ typedef struct bfd_section *sec_ptr; ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ : ~ (bfd_vma) 0) -#define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name) -#define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma) -#define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma) -#define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \ - (ptr)->alignment_power) -#define bfd_section_name(bfd, ptr) ((ptr)->name) -#define bfd_section_size(bfd, ptr) ((ptr)->size) -#define bfd_get_section_size(ptr) ((ptr)->size) -#define bfd_section_vma(bfd, ptr) ((ptr)->vma) -#define bfd_section_lma(bfd, ptr) ((ptr)->lma) -#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power) -#define bfd_get_section_flags(bfd, ptr) ((void) bfd, (ptr)->flags) -#define bfd_get_section_userdata(bfd, ptr) ((void) bfd, (ptr)->userdata) - -#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) +#define bfd_section_name(sec) ((sec)->name) +#define bfd_section_size(sec) ((sec)->size) +#define bfd_section_vma(sec) ((sec)->vma) +#define bfd_section_lma(sec) ((sec)->lma) +#define bfd_section_alignment(sec) ((sec)->alignment_power) +#define bfd_section_flags(sec) ((sec)->flags) +#define bfd_section_userdata(sec) ((sec)->userdata) + +#define bfd_is_com_section(sec) (((sec)->flags & SEC_IS_COMMON) != 0) #define bfd_get_section_limit_octets(bfd, sec) \ ((bfd)->direction != write_direction && (sec)->rawsize != 0 \ diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 6542d403e06..425f0c6709a 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -306,21 +306,15 @@ typedef struct bfd_section *sec_ptr; ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ : ~ (bfd_vma) 0) -#define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name) -#define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma) -#define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma) -#define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \ - (ptr)->alignment_power) -#define bfd_section_name(bfd, ptr) ((ptr)->name) -#define bfd_section_size(bfd, ptr) ((ptr)->size) -#define bfd_get_section_size(ptr) ((ptr)->size) -#define bfd_section_vma(bfd, ptr) ((ptr)->vma) -#define bfd_section_lma(bfd, ptr) ((ptr)->lma) -#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power) -#define bfd_get_section_flags(bfd, ptr) ((void) bfd, (ptr)->flags) -#define bfd_get_section_userdata(bfd, ptr) ((void) bfd, (ptr)->userdata) - -#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) +#define bfd_section_name(sec) ((sec)->name) +#define bfd_section_size(sec) ((sec)->size) +#define bfd_section_vma(sec) ((sec)->vma) +#define bfd_section_lma(sec) ((sec)->lma) +#define bfd_section_alignment(sec) ((sec)->alignment_power) +#define bfd_section_flags(sec) ((sec)->flags) +#define bfd_section_userdata(sec) ((sec)->userdata) + +#define bfd_is_com_section(sec) (((sec)->flags & SEC_IS_COMMON) != 0) #define bfd_get_section_limit_octets(bfd, sec) \ ((bfd)->direction != write_direction && (sec)->rawsize != 0 \ @@ -1742,26 +1736,31 @@ struct relax_table { would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some compilers will complain about comma expressions that have no effect. */ static inline bfd_boolean -bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, - void * val) +bfd_set_section_userdata (asection *sec, void *val) +{ + sec->userdata = val; + return TRUE; +} + +static inline bfd_boolean +bfd_set_section_vma (asection *sec, bfd_vma val) { - ptr->userdata = val; + sec->vma = sec->lma = val; + sec->user_set_vma = TRUE; return TRUE; } static inline bfd_boolean -bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) +bfd_set_section_lma (asection *sec, bfd_vma val) { - ptr->vma = ptr->lma = val; - ptr->user_set_vma = TRUE; + sec->lma = val; return TRUE; } static inline bfd_boolean -bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, - unsigned int val) +bfd_set_section_alignment (asection *sec, unsigned int val) { - ptr->alignment_power = val; + sec->alignment_power = val; return TRUE; } @@ -1963,11 +1962,10 @@ asection *bfd_make_section_with_flags asection *bfd_make_section (bfd *, const char *name); -bfd_boolean bfd_set_section_flags - (bfd *abfd, asection *sec, flagword flags); +bfd_boolean bfd_set_section_flags (asection *sec, flagword flags); void bfd_rename_section - (bfd *abfd, asection *sec, const char *newname); + (asection *sec, const char *newname); void bfd_map_over_sections (bfd *abfd, @@ -1979,8 +1977,7 @@ asection *bfd_sections_find_if bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj), void *obj); -bfd_boolean bfd_set_section_size - (bfd *abfd, asection *sec, bfd_size_type val); +bfd_boolean bfd_set_section_size (asection *sec, bfd_size_type val); bfd_boolean bfd_set_section_contents (bfd *abfd, asection *section, const void *data, diff --git a/bfd/bfd.c b/bfd/bfd.c index c973c780b40..7029bf7b85b 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -2342,7 +2342,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, bfd_put_32 (abfd, 1 << sec->alignment_power, &echdr->ch_addralign); /* bfd_log2 (alignof (Elf32_Chdr)) */ - bfd_set_section_alignment (abfd, sec, 2); + bfd_set_section_alignment (sec, 2); } else { @@ -2354,7 +2354,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, bfd_put_64 (abfd, 1 << sec->alignment_power, &echdr->ch_addralign); /* bfd_log2 (alignof (Elf64_Chdr)) */ - bfd_set_section_alignment (abfd, sec, 3); + bfd_set_section_alignment (sec, 3); } } else @@ -2368,7 +2368,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents, memcpy (contents, "ZLIB", 4); bfd_putb64 (sec->size, contents + 4); /* No way to keep the original alignment, just use 1 always. */ - bfd_set_section_alignment (abfd, sec, 0); + bfd_set_section_alignment (sec, 0); } } } @@ -2597,7 +2597,7 @@ bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd, use_memmove = TRUE; } - size = bfd_get_section_size (isec) - ihdr_size + ohdr_size; + size = bfd_section_size (isec) - ihdr_size + ohdr_size; if (!use_memmove) { contents = (bfd_byte *) bfd_malloc (size); diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index ee4a3eeded7..d36921bbfe6 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -426,7 +426,7 @@ alpha_ecoff_object_p (bfd *abfd) size = sec->line_filepos * 8; BFD_ASSERT (size == sec->size || size + 8 == sec->size); - if (! bfd_set_section_size (abfd, sec, size)) + if (!bfd_set_section_size (sec, size)) return NULL; } } @@ -1237,7 +1237,7 @@ alpha_convert_external_reloc (bfd *output_bfd ATTRIBUTE_UNUSED, /* Compute a new r_symndx value. */ hsec = h->root.u.def.section; - name = bfd_get_section_name (output_bfd, hsec->output_section); + name = bfd_section_name (hsec->output_section); r_symndx = (unsigned long) -1; switch (name[1]) @@ -1928,8 +1928,7 @@ alpha_relocate_section (bfd *output_bfd, if (r_extern) name = sym_hashes[r_symndx]->root.root.string; else - name = bfd_section_name (input_bfd, - symndx_to_section[r_symndx]); + name = bfd_section_name (symndx_to_section[r_symndx]); (*info->callbacks->reloc_overflow) (info, NULL, name, alpha_howto_table[r_type].name, (bfd_vma) 0, input_bfd, input_section, diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index 5237bfb2d08..cbc5257e9f3 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -1989,7 +1989,7 @@ bfd_arm_get_bfd_for_interworking (bfd * abfd, sec = bfd_make_section_with_flags (abfd, ARM2THUMB_GLUE_SECTION_NAME, flags); if (sec == NULL - || ! bfd_set_section_alignment (abfd, sec, 2)) + || !bfd_set_section_alignment (sec, 2)) return FALSE; } @@ -2003,7 +2003,7 @@ bfd_arm_get_bfd_for_interworking (bfd * abfd, flags); if (sec == NULL - || ! bfd_set_section_alignment (abfd, sec, 2)) + || !bfd_set_section_alignment (sec, 2)) return FALSE; } diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index a2dd9e1c4fc..c6fe679a6c6 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -1012,8 +1012,7 @@ mips_relocate_section (bfd *output_bfd, /* Compute a new r_symndx value. */ s = h->root.u.def.section; - name = bfd_get_section_name (output_bfd, - s->output_section); + name = bfd_section_name (s->output_section); int_rel.r_symndx = -1; switch (name[1]) @@ -1223,7 +1222,7 @@ mips_relocate_section (bfd *output_bfd, if (int_rel.r_extern) name = NULL; else - name = bfd_section_name (input_bfd, s); + name = bfd_section_name (s); (*info->callbacks->reloc_overflow) (info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0, input_bfd, input_section, diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 1c80a9df885..091da1fd5e8 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -959,7 +959,7 @@ xcoff64_write_object_contents (bfd *abfd) if (text_sec != NULL) { internal_a.o_sntext = text_sec->target_index; - internal_a.o_algntext = bfd_get_section_alignment (abfd, text_sec); + internal_a.o_algntext = bfd_section_alignment (text_sec); } else { @@ -970,7 +970,7 @@ xcoff64_write_object_contents (bfd *abfd) if (data_sec != NULL) { internal_a.o_sndata = data_sec->target_index; - internal_a.o_algndata = bfd_get_section_alignment (abfd, data_sec); + internal_a.o_algndata = bfd_section_alignment (data_sec); } else { diff --git a/bfd/coffcode.h b/bfd/coffcode.h index dd3189fbd3d..948bb705b09 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1696,7 +1696,7 @@ coff_set_custom_section_alignment (bfd *abfd ATTRIBUTE_UNUSED, for (i = 0; i < table_size; ++i) { - const char *secname = bfd_get_section_name (abfd, section); + const char *secname = bfd_section_name (section); if (alignment_table[i].comparison_length == (unsigned int) -1 ? strcmp (alignment_table[i].name, secname) == 0 @@ -1759,17 +1759,17 @@ coff_new_section_hook (bfd * abfd, asection * section) #ifdef RS6000COFF_C if (bfd_xcoff_text_align_power (abfd) != 0 - && strcmp (bfd_get_section_name (abfd, section), ".text") == 0) + && strcmp (bfd_section_name (section), ".text") == 0) section->alignment_power = bfd_xcoff_text_align_power (abfd); else if (bfd_xcoff_data_align_power (abfd) != 0 - && strcmp (bfd_get_section_name (abfd, section), ".data") == 0) + && strcmp (bfd_section_name (section), ".data") == 0) section->alignment_power = bfd_xcoff_data_align_power (abfd); else { int i; for (i = 0; i < XCOFF_DWSECT_NBR_NAMES; i++) - if (strcmp (bfd_get_section_name (abfd, section), + if (strcmp (bfd_section_name (section), xcoff_dwsect_names[i].name) == 0) { section->alignment_power = 0; @@ -3221,7 +3221,7 @@ coff_compute_section_file_positions (bfd * abfd) incremented in coff_set_section_contents. This is right for SVR3.2. */ if (strcmp (current->name, _LIB) == 0) - (void) bfd_set_section_vma (abfd, current, 0); + bfd_set_section_vma (current, 0); #endif #ifdef ALIGN_SECTIONS_IN_FILE @@ -4011,7 +4011,7 @@ coff_write_object_contents (bfd * abfd) if (text_sec != NULL) { internal_a.o_sntext = text_sec->target_index; - internal_a.o_algntext = bfd_get_section_alignment (abfd, text_sec); + internal_a.o_algntext = bfd_section_alignment (text_sec); } else { @@ -4021,7 +4021,7 @@ coff_write_object_contents (bfd * abfd) if (data_sec != NULL) { internal_a.o_sndata = data_sec->target_index; - internal_a.o_algndata = bfd_get_section_alignment (abfd, data_sec); + internal_a.o_algndata = bfd_section_alignment (data_sec); } else { @@ -4390,8 +4390,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect) PR 17521: file: 078-10659-0.004. */ continue; else - cache_ptr->u.offset = (dst.l_addr.l_paddr - - bfd_section_vma (abfd, asect)); + cache_ptr->u.offset = dst.l_addr.l_paddr - bfd_section_vma (asect); cache_ptr++; } @@ -4886,7 +4885,7 @@ coff_classify_symbol (bfd *abfd, name = _bfd_coff_internal_syment_name (abfd, syment, buf) sec = coff_section_from_bfd_index (abfd, syment->n_scnum); if (sec != NULL && name != NULL - && (strcmp (bfd_get_section_name (abfd, sec), name) == 0)) + && (strcmp (bfd_section_name (sec), name) == 0)) return COFF_SYMBOL_PE_SECTION; } #endif diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 80a9a2ab9ae..ba7bb5eaf42 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -217,7 +217,7 @@ make_a_section_from_file (bfd *abfd, break; } if (new_name != NULL) - bfd_rename_section (abfd, return_section, new_name); + bfd_rename_section (return_section, new_name); } return result; @@ -2366,7 +2366,7 @@ coff_find_nearest_line_with_names (bfd *abfd, bfd_vma maxdiff; /* Look through the C_FILE symbols to find the best one. */ - sec_vma = bfd_get_section_vma (abfd, section); + sec_vma = bfd_section_vma (section); *filename_ptr = (char *) p->u.syment._n._n_n._n_offset; maxdiff = (bfd_vma) 0 - (bfd_vma) 1; while (1) @@ -2658,7 +2658,7 @@ _bfd_coff_section_already_linked (bfd *abfd, if ((flags & SEC_GROUP) != 0) return FALSE; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); s_comdat = bfd_coff_get_comdat_section (abfd, sec); if (s_comdat != NULL) diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 7bcc1ca77da..2115e9c36ab 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -2846,8 +2846,7 @@ _bfd_coff_reloc_link_order (bfd *output_bfd, (*flaginfo->info->callbacks->reloc_overflow) (flaginfo->info, NULL, (link_order->type == bfd_section_reloc_link_order - ? bfd_section_name (output_bfd, - link_order->u.reloc.p->u.section) + ? bfd_section_name (link_order->u.reloc.p->u.section) : link_order->u.reloc.p->u.name), howto->name, link_order->u.reloc.p->addend, (bfd *) NULL, (asection *) NULL, (bfd_vma) 0); diff --git a/bfd/compress.c b/bfd/compress.c index 32de09923df..8f96d064bde 100644 --- a/bfd/compress.c +++ b/bfd/compress.c @@ -155,8 +155,7 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec, return 0; } free (uncompressed_buffer); - bfd_set_section_alignment (abfd, sec, - orig_uncompressed_alignment_pow); + bfd_set_section_alignment (sec, orig_uncompressed_alignment_pow); sec->contents = buffer; sec->compress_status = COMPRESS_SECTION_DONE; @@ -255,7 +254,7 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr) && filesize < sz /* PR 24753: Linker created sections can be larger than the file size, eg if they are being used to hold stubs. */ - && (bfd_get_section_flags (abfd, sec) & SEC_LINKER_CREATED) == 0 + && (bfd_section_flags (sec) & SEC_LINKER_CREATED) == 0 /* The MMO file format supports its own special compression technique, but it uses COMPRESS_SECTION_NONE when loading a section's contents. */ @@ -552,7 +551,7 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec) sec->compressed_size = sec->size; sec->size = uncompressed_size; - bfd_set_section_alignment (abfd, sec, uncompressed_alignment_power); + bfd_set_section_alignment (sec, uncompressed_alignment_power); sec->compress_status = DECOMPRESS_SECTION_SIZED; return TRUE; diff --git a/bfd/ecoff.c b/bfd/ecoff.c index c06fa5ec7f9..30adba0e6d2 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -1676,10 +1676,10 @@ ecoff_slurp_reloc_table (bfd *abfd, abort (); rptr->sym_ptr_ptr = sec->symbol_ptr_ptr; - rptr->addend = - bfd_get_section_vma (abfd, sec); + rptr->addend = - bfd_section_vma (sec); } - rptr->address = intern.r_vaddr - bfd_get_section_vma (abfd, section); + rptr->address = intern.r_vaddr - bfd_section_vma (section); /* Let the backend select the howto field and do any other required processing. */ @@ -2431,7 +2431,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) strncpy (section.s_name, current->name, sizeof section.s_name); /* This seems to be correct for Irix 4 shared libraries. */ - vma = bfd_get_section_vma (abfd, current); + vma = bfd_section_vma (current); if (streq (current->name, _LIB)) section.s_vaddr = 0; else @@ -2682,8 +2682,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) if (reloc->howto == NULL) continue; - in.r_vaddr = (reloc->address - + bfd_get_section_vma (abfd, current)); + in.r_vaddr = reloc->address + bfd_section_vma (current); in.r_type = reloc->howto->type; if ((sym->flags & BSF_SECTION_SYM) == 0) @@ -2719,7 +2718,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) { _RCONST, RELOC_SECTION_RCONST } }; - name = bfd_get_section_name (abfd, bfd_asymbol_section (sym)); + name = bfd_section_name (bfd_asymbol_section (sym)); for (j = 0; j < ARRAY_SIZE (section_symndx); j++) if (streq (name, section_symndx[j].name)) @@ -4010,7 +4009,7 @@ ecoff_reloc_link_order (bfd *output_bfd, (*info->callbacks->reloc_overflow) (info, NULL, (link_order->type == bfd_section_reloc_link_order - ? bfd_section_name (output_bfd, section) + ? bfd_section_name (section) : link_order->u.reloc.p->u.name), rel.howto->name, addend, NULL, NULL, (bfd_vma) 0); break; @@ -4025,8 +4024,7 @@ ecoff_reloc_link_order (bfd *output_bfd, rel.addend = 0; /* Move the information into an internal_reloc structure. */ - in.r_vaddr = (rel.address - + bfd_get_section_vma (output_bfd, output_section)); + in.r_vaddr = rel.address + bfd_section_vma (output_section); in.r_type = rel.howto->type; if (type == bfd_symbol_reloc_link_order) @@ -4076,7 +4074,7 @@ ecoff_reloc_link_order (bfd *output_bfd, { _RCONST, RELOC_SECTION_RCONST } }; - name = bfd_get_section_name (output_bfd, section); + name = bfd_section_name (section); for (i = 0; i < ARRAY_SIZE (section_symndx); i++) if (streq (name, section_symndx[i].name)) @@ -4189,7 +4187,7 @@ ecoff_link_write_external (struct bfd_hash_entry *bh, void * data) }; output_section = h->root.u.def.section->output_section; - name = bfd_section_name (output_section->owner, output_section); + name = bfd_section_name (output_section); for (i = 0; i < ARRAY_SIZE (section_storage_classes); i++) if (streq (name, section_storage_classes[i].name)) diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index 6919ac3031b..c2cb77bb110 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -1109,7 +1109,7 @@ add_eh_frame_hdr_terminator (asection *sec, if (!sec->rawsize) sec->rawsize = sec->size; - bfd_set_section_size (sec->owner, sec, sec->size + 8); + bfd_set_section_size (sec, sec->size + 8); } /* Finish a pass over all .eh_frame_entry sections. */ @@ -1682,7 +1682,7 @@ _bfd_elf_eh_frame_entry_present (struct bfd_link_info *info) { for (o = abfd->sections; o; o = o->next) { - const char *name = bfd_get_section_name (abfd, o); + const char *name = bfd_section_name (o); if (strcmp (name, ".eh_frame_entry") && !bfd_is_abs_section (o->output_section)) diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index cc98caeeb0b..2035d4c9c0b 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -881,7 +881,7 @@ elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) { const char *name; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); if (strcmp (name, ".PARISC.unwind") == 0) { diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c index 89054e439a1..58948e32f11 100644 --- a/bfd/elf-ifunc.c +++ b/bfd/elf-ifunc.c @@ -62,8 +62,7 @@ _bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_with_flags (abfd, rel_sec, flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->irelifunc = s; } @@ -73,7 +72,7 @@ _bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info) for static executables. */ s = bfd_make_section_with_flags (abfd, ".iplt", pltflags); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; htab->iplt = s; @@ -82,8 +81,7 @@ _bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info) ? ".rela.iplt" : ".rel.iplt"), flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->irelplt = s; @@ -94,8 +92,7 @@ _bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info) else s = bfd_make_section_with_flags (abfd, ".igot", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->igotplt = s; } diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index cfccb968670..b234c168c8f 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -413,7 +413,7 @@ mn10200_elf_relocate_section (bfd *output_bfd, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (r) diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index acc3c54258e..30828f117ab 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -725,7 +725,7 @@ _bfd_mn10300_elf_create_got_section (bfd * abfd, s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags); htab->splt = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the @@ -742,7 +742,7 @@ _bfd_mn10300_elf_create_got_section (bfd * abfd, s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); htab->sgot = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; if (bed->want_got_plt) @@ -750,7 +750,7 @@ _bfd_mn10300_elf_create_got_section (bfd * abfd, s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags); htab->sgotplt = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; } @@ -2125,7 +2125,7 @@ mn10300_elf_relocate_section (bfd *output_bfd, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (r) @@ -4821,7 +4821,7 @@ _bfd_mn10300_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) flags | SEC_READONLY); htab->root.srelplt = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; if (! _bfd_mn10300_elf_create_got_section (abfd, info)) @@ -4858,7 +4858,7 @@ _bfd_mn10300_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) ? ".rela.bss" : ".rel.bss"), flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; } } @@ -5073,7 +5073,7 @@ _bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if (streq (name, ".plt")) { @@ -5099,8 +5099,7 @@ _bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd, entry. The entries in the .rela.plt section really apply to the .got section, which we created ourselves and so know is not readonly. */ - outname = bfd_get_section_name (output_bfd, - s->output_section); + outname = bfd_section_name (s->output_section); target = bfd_get_section_by_name (output_bfd, outname + 5); if (target != NULL && (target->flags & SEC_READONLY) != 0 diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c index 198eece0843..199e61728e4 100644 --- a/bfd/elf-properties.c +++ b/bfd/elf-properties.c @@ -695,12 +695,12 @@ _bfd_elf_convert_gnu_properties (bfd *ibfd, asection *isec, align_shift = bed->s->elfclass == ELFCLASS64 ? 3 : 2; /* Get the output .note.gnu.property section size. */ - size = bfd_get_section_size (isec->output_section); + size = bfd_section_size (isec->output_section); /* Update the output .note.gnu.property section alignment. */ - bfd_set_section_alignment (obfd, isec->output_section, align_shift); + bfd_set_section_alignment (isec->output_section, align_shift); - if (size > bfd_get_section_size (isec)) + if (size > bfd_section_size (isec)) { contents = (bfd_byte *) bfd_malloc (size); free (*ptr); diff --git a/bfd/elf-s390-common.c b/bfd/elf-s390-common.c index ef8abeb2d07..d7cd7e60e9e 100644 --- a/bfd/elf-s390-common.c +++ b/bfd/elf-s390-common.c @@ -131,8 +131,7 @@ s390_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_with_flags (abfd, ".rela.ifunc", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->irelifunc = s; } @@ -141,21 +140,19 @@ s390_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_with_flags (abfd, ".iplt", flags | SEC_CODE | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; htab->iplt = s; s = bfd_make_section_with_flags (abfd, ".rela.iplt", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->irelplt = s; s = bfd_make_section_with_flags (abfd, ".igot.plt", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->igotplt = s; diff --git a/bfd/elf-vxworks.c b/bfd/elf-vxworks.c index a7f574c2ef7..8fe17bf628f 100644 --- a/bfd/elf-vxworks.c +++ b/bfd/elf-vxworks.c @@ -97,7 +97,7 @@ elf_vxworks_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info, | SEC_READONLY | SEC_LINKER_CREATED); if (s == NULL - || !bfd_set_section_alignment (dynobj, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; *srelplt2_out = s; @@ -279,9 +279,7 @@ elf_vxworks_finish_dynamic_entry (bfd *output_bfd, Elf_Internal_Dyn *dyn) case DT_VX_WRS_TLS_DATA_ALIGN: sec = bfd_get_section_by_name (output_bfd, ".tls_data"); - dyn->d_un.d_val - = (bfd_size_type)1 << bfd_get_section_alignment (output_bfd, - sec); + dyn->d_un.d_val = (bfd_size_type) 1 << bfd_section_alignment (sec); break; case DT_VX_WRS_TLS_VARS_START: diff --git a/bfd/elf.c b/bfd/elf.c index 1a1eed90857..664eae5c66f 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -547,7 +547,7 @@ bfd_elf_sym_name (bfd *abfd, if (name == NULL) name = "(null)"; else if (sym_sec && *name == '\0') - name = bfd_section_name (abfd, sym_sec); + name = bfd_section_name (sym_sec); return name; } @@ -1049,10 +1049,9 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, newsect->filepos = hdr->sh_offset; - if (! bfd_set_section_vma (abfd, newsect, hdr->sh_addr) - || ! bfd_set_section_size (abfd, newsect, hdr->sh_size) - || ! bfd_set_section_alignment (abfd, newsect, - bfd_log2 (hdr->sh_addralign))) + if (!bfd_set_section_vma (newsect, hdr->sh_addr) + || !bfd_set_section_size (newsect, hdr->sh_size) + || !bfd_set_section_alignment (newsect, bfd_log2 (hdr->sh_addralign))) return FALSE; flags = SEC_NO_FLAGS; @@ -1142,7 +1141,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, if (! bed->elf_backend_section_flags (&flags, hdr)) return FALSE; - if (! bfd_set_section_flags (abfd, newsect, flags)) + if (!bfd_set_section_flags (newsect, flags)) return FALSE; /* We do not parse the PT_NOTE segments as we are interested even in the @@ -1286,7 +1285,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, char *new_name = convert_zdebug_to_debug (abfd, name); if (new_name == NULL) return FALSE; - bfd_rename_section (abfd, newsect, new_name); + bfd_rename_section (newsect, new_name); } } else @@ -5542,7 +5541,7 @@ assign_file_positions_for_load_sections (bfd *abfd, { unsigned int secalign; - secalign = bfd_get_section_alignment (abfd, *secpp); + secalign = bfd_section_alignment (*secpp); if (secalign > align_power) align_power = secalign; } @@ -5696,7 +5695,7 @@ assign_file_positions_for_load_sections (bfd *abfd, sec = *secpp; this_hdr = &elf_section_data (sec)->this_hdr; - align = (bfd_size_type) 1 << bfd_get_section_alignment (abfd, sec); + align = (bfd_size_type) 1 << bfd_section_alignment (sec); if ((p->p_type == PT_LOAD || p->p_type == PT_TLS) @@ -6835,8 +6834,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd) || (segment->p_paddr \ ? segment->p_paddr != section->lma \ : segment->p_vaddr != section->vma) \ - || (strcmp (bfd_get_section_name (ibfd, section), ".dynamic") \ - == 0)) \ + || (strcmp (bfd_section_name (section), ".dynamic") == 0)) \ && (segment->p_type != PT_LOAD || !section->segment_mark)) /* If the output section of a section in the input segment is NULL, diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c index 493f32dad7f..91537efd841 100644 --- a/bfd/elf32-arc.c +++ b/bfd/elf32-arc.c @@ -900,7 +900,7 @@ arc_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) for (sec = ibfd->sections; sec != NULL; sec = sec->next) { - if ((bfd_get_section_flags (ibfd, sec) + if ((bfd_section_flags (sec) & (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) only_data_sections = FALSE; diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index e29a60abf19..1c4887a0340 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -3817,7 +3817,8 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info) htab->srofixup = bfd_make_section_with_flags (dynobj, ".rofixup", (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED | SEC_READONLY)); - if (htab->srofixup == NULL || ! bfd_set_section_alignment (dynobj, htab->srofixup, 2)) + if (htab->srofixup == NULL + || !bfd_set_section_alignment (htab->srofixup, 2)) return FALSE; } @@ -3845,7 +3846,7 @@ create_ifunc_sections (struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (dynobj, ".iplt", flags | SEC_READONLY | SEC_CODE); if (s == NULL - || !bfd_set_section_alignment (dynobj, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; htab->root.iplt = s; } @@ -3856,7 +3857,7 @@ create_ifunc_sections (struct bfd_link_info *info) RELOC_SECTION (htab, ".iplt"), flags | SEC_READONLY); if (s == NULL - || !bfd_set_section_alignment (dynobj, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->root.irelplt = s; } @@ -3865,7 +3866,7 @@ create_ifunc_sections (struct bfd_link_info *info) { s = bfd_make_section_anyway_with_flags (dynobj, ".igot.plt", flags); if (s == NULL - || !bfd_set_section_alignment (dynobj, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->root.igotplt = s; } @@ -7709,7 +7710,7 @@ arm_make_glue_section (bfd * abfd, const char * name) sec = bfd_make_section_anyway_with_flags (abfd, name, ARM_GLUE_SECTION_FLAGS); if (sec == NULL - || !bfd_set_section_alignment (abfd, sec, 2)) + || !bfd_set_section_alignment (sec, 2)) return FALSE; /* Set the gc mark to prevent the section from being removed by garbage @@ -13374,7 +13375,7 @@ elf32_arm_relocate_section (bfd * output_bfd, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (r_symndx != STN_UNDEF @@ -13552,10 +13553,10 @@ adjust_exidx_size(asection *exidx_sec, int adjust) if (!exidx_sec->rawsize) exidx_sec->rawsize = exidx_sec->size; - bfd_set_section_size (exidx_sec->owner, exidx_sec, exidx_sec->size + adjust); + bfd_set_section_size (exidx_sec, exidx_sec->size + adjust); out_sec = exidx_sec->output_section; /* Adjust size of output section. */ - bfd_set_section_size (out_sec->owner, out_sec, out_sec->size +adjust); + bfd_set_section_size (out_sec, out_sec->size +adjust); } /* Insert an EXIDX_CANTUNWIND marker at the end of a section. */ @@ -15696,9 +15697,9 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, { flagword flags; - flags = bfd_get_section_flags (dynobj, sreloc); + flags = bfd_section_flags (sreloc); flags &= ~(SEC_LOAD | SEC_ALLOC); - bfd_set_section_flags (dynobj, sreloc, flags); + bfd_set_section_flags (sreloc, flags); } } @@ -17158,7 +17159,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if (s == htab->root.splt) { @@ -17951,7 +17952,7 @@ elf32_arm_fake_sections (bfd * abfd, Elf_Internal_Shdr * hdr, asection * sec) { const char * name; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); if (is_arm_elf_unwind_section_name (abfd, name)) { @@ -20874,7 +20875,7 @@ elf32_arm_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) if (strcmp (sec->name, ".glue_7") && strcmp (sec->name, ".glue_7t")) { - if ((bfd_get_section_flags (ibfd, sec) + if ((bfd_section_flags (sec) & (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) only_data_sections = FALSE; diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index e75ac9fc1db..f04cc94ff34 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -1465,7 +1465,7 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { @@ -2354,8 +2354,7 @@ avr_property_record_compare (const void *ap, const void *bp) return (a->offset - b->offset); if (a->section != b->section) - return (bfd_get_section_vma (a->section->owner, a->section) - - bfd_get_section_vma (b->section->owner, b->section)); + return bfd_section_vma (a->section) - bfd_section_vma (b->section); return (a->type - b->type); } @@ -3948,12 +3947,12 @@ internal_reloc_compare (const void *ap, const void *bp) /* Return true if ADDRESS is within the vma range of SECTION from ABFD. */ static bfd_boolean -avr_is_section_for_address (bfd *abfd, asection *section, bfd_vma address) +avr_is_section_for_address (asection *section, bfd_vma address) { bfd_vma vma; bfd_size_type size; - vma = bfd_get_section_vma (abfd, section); + vma = bfd_section_vma (section); if (address < vma) return FALSE; @@ -3985,7 +3984,7 @@ struct avr_find_section_data perform any checks, and just returns. */ static void -avr_find_section_for_address (bfd *abfd, +avr_find_section_for_address (bfd *abfd ATTRIBUTE_UNUSED, asection *section, void *data) { struct avr_find_section_data *fs_data @@ -3996,11 +3995,11 @@ avr_find_section_for_address (bfd *abfd, return; /* If this section isn't part of the addressable code content, skip it. */ - if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0 - && (bfd_get_section_flags (abfd, section) & SEC_CODE) == 0) + if ((bfd_section_flags (section) & SEC_ALLOC) == 0 + && (bfd_section_flags (section) & SEC_CODE) == 0) return; - if (avr_is_section_for_address (abfd, section, fs_data->address)) + if (avr_is_section_for_address (section, fs_data->address)) fs_data->section = section; } @@ -4023,7 +4022,7 @@ avr_elf32_load_records_from_section (bfd *abfd, asection *sec) fs_data.section = NULL; - size = bfd_get_section_size (sec); + size = bfd_section_size (sec); contents = bfd_malloc (size); bfd_get_section_contents (abfd, sec, contents, 0, size); ptr = contents; @@ -4126,8 +4125,7 @@ avr_elf32_load_records_from_section (bfd *abfd, asection *sec) { /* Try to find section and offset from address. */ if (fs_data.section != NULL - && !avr_is_section_for_address (abfd, fs_data.section, - address)) + && !avr_is_section_for_address (fs_data.section, address)) fs_data.section = NULL; if (fs_data.section == NULL) @@ -4145,7 +4143,7 @@ avr_elf32_load_records_from_section (bfd *abfd, asection *sec) r_list->records [i].section = fs_data.section; r_list->records [i].offset - = address - bfd_get_section_vma (abfd, fs_data.section); + = address - bfd_section_vma (fs_data.section); } r_list->records [i].type = *((bfd_byte *) ptr); diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index d73bfdaee39..6efee04c8bb 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -1601,7 +1601,7 @@ bfin_relocate_section (bfd * output_bfd, if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (r == bfd_reloc_overflow) @@ -2560,7 +2560,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { @@ -2778,8 +2778,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, bfd_vma offset; addend += bfinfdpic_got_section (info)->output_section->vma; - if ((bfd_get_section_flags (output_bfd, - input_section->output_section) + if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { if (_bfinfdpic_osec_readonly_p (output_bfd, @@ -2807,8 +2806,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, picrel); } } - else if ((bfd_get_section_flags (output_bfd, - input_section->output_section) + else if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { bfd_vma offset; @@ -2901,8 +2899,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, if (osec) addend += osec->output_section->vma; if (IS_FDPIC (input_bfd) - && (bfd_get_section_flags (output_bfd, - input_section->output_section) + && (bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { if (_bfinfdpic_osec_readonly_p (output_bfd, @@ -2939,8 +2936,7 @@ bfinfdpic_relocate_section (bfd * output_bfd, } else { - if ((bfd_get_section_flags (output_bfd, - input_section->output_section) + if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { if (_bfinfdpic_osec_readonly_p (output_bfd, @@ -3201,7 +3197,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); elf_hash_table (info)->sgot = s; if (s == NULL - || !bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; if (bed->want_got_sym) @@ -3238,7 +3234,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rel.got", (flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; bfinfdpic_gotrel_section (info) = s; @@ -3247,7 +3243,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rofixup", (flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; bfinfdpic_gotfixup_section (info) = s; @@ -3261,7 +3257,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; /* Blackfin-specific: remember it. */ bfinfdpic_plt_section (info) = s; @@ -3289,7 +3285,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rel.plt", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; /* Blackfin-specific: remember it. */ bfinfdpic_pltrel_section (info) = s; @@ -3355,7 +3351,7 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) ".rela.bss", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; } } @@ -4616,7 +4612,7 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info, case R_BFIN_FUNCDESC_VALUE: picrel->relocsfdv++; - if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + if (bfd_section_flags (sec) & SEC_ALLOC) picrel->relocs32--; /* Fall through. */ @@ -4625,7 +4621,7 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info, break; picrel->sym++; - if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + if (bfd_section_flags (sec) & SEC_ALLOC) picrel->relocs32++; break; @@ -5064,9 +5060,9 @@ bfin_adjust_dynamic_symbol (struct bfd_link_info *info, /* Apply the required alignment. */ s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) + if (power_of_two > bfd_section_alignment (s)) { - if (!bfd_set_section_alignment (dynobj, s, power_of_two)) + if (!bfd_set_section_alignment (s, power_of_two)) return FALSE; } @@ -5200,7 +5196,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); strip = FALSE; diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c index 7d0a0e558f1..72642e532c1 100644 --- a/bfd/elf32-cr16.c +++ b/bfd/elf32-cr16.c @@ -610,7 +610,7 @@ _bfd_cr16_elf_create_got_section (bfd * abfd, struct bfd_link_info * info) s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); htab->sgot= s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; if (bed->want_got_plt) @@ -618,7 +618,7 @@ _bfd_cr16_elf_create_got_section (bfd * abfd, struct bfd_link_info * info) s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags); htab->sgotplt = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; } @@ -1444,7 +1444,7 @@ elf32_cr16_relocate_section (bfd *output_bfd, struct bfd_link_info *info, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (r) @@ -2241,7 +2241,7 @@ _bfd_cr16_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) flags | SEC_READONLY); htab->srelplt = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; if (! _bfd_cr16_elf_create_got_section (abfd, info)) @@ -2278,7 +2278,7 @@ _bfd_cr16_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) ? ".rela.bss" : ".rel.bss"), flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; } } @@ -2463,7 +2463,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if (strcmp (name, ".plt") == 0) { @@ -2489,8 +2489,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd, entry. The entries in the .rela.plt section really apply to the .got section, which we created ourselves and so know is not readonly. */ - outname = bfd_get_section_name (output_bfd, - s->output_section); + outname = bfd_section_name (s->output_section); target = bfd_get_section_by_name (output_bfd, outname + 5); if (target != NULL && (target->flags & SEC_READONLY) != 0 diff --git a/bfd/elf32-cr16c.c b/bfd/elf32-cr16c.c index 9a2fda0ea8e..35bacbbc6fa 100644 --- a/bfd/elf32-cr16c.c +++ b/bfd/elf32-cr16c.c @@ -763,7 +763,7 @@ elf32_cr16c_relocate_section (bfd *output_bfd, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (r) @@ -827,9 +827,9 @@ elf32_cr16c_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, int *retval) { - if (strcmp (bfd_get_section_name (abfd, sec), ".fcommon") == 0) + if (strcmp (bfd_section_name (sec), ".fcommon") == 0) *retval = SHN_CR16C_FCOMMON; - else if (strcmp (bfd_get_section_name (abfd, sec), ".ncommon") == 0) + else if (strcmp (bfd_section_name (sec), ".ncommon") == 0) *retval = SHN_CR16C_NCOMMON; else return FALSE; diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index 5d230562a5c..9c07b6d7b98 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -1044,7 +1044,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, symname = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (symname == NULL) - symname = bfd_section_name (input_bfd, sec); + symname = bfd_section_name (sec); } else { @@ -2480,7 +2480,7 @@ cris_elf_plt_sym_val (bfd_vma i ATTRIBUTE_UNUSED, const asection *plt, if ((got = bfd_get_section_by_name (abfd, ".got")) == NULL) return (bfd_vma) -1; - plt_sec_size = bfd_section_size (plt->owner, plt); + plt_sec_size = bfd_section_size (plt); plt_entry_size = (bfd_get_mach (abfd) == bfd_mach_cris_v32 ? PLT_ENTRY_SIZE_V32 : PLT_ENTRY_SIZE); @@ -3580,7 +3580,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if (strcmp (name, ".plt") == 0) { diff --git a/bfd/elf32-crx.c b/bfd/elf32-crx.c index 306a0e4f2b2..6d15b2b10bf 100644 --- a/bfd/elf32-crx.c +++ b/bfd/elf32-crx.c @@ -905,7 +905,7 @@ elf32_crx_relocate_section (bfd *output_bfd, struct bfd_link_info *info, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (r) diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c index b3451b60b21..16897b3930e 100644 --- a/bfd/elf32-csky.c +++ b/bfd/elf32-csky.c @@ -2092,7 +2092,7 @@ csky_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, if (htab->elf.hplt != NULL) strip_section = FALSE; } - else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rel") ) + else if (CONST_STRNEQ (bfd_section_name (s), ".rel") ) { if (s->size != 0 ) relocs = TRUE; @@ -5070,7 +5070,7 @@ csky_elf_relocate_section (bfd * output_bfd, if (name == NULL) break; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } (*info->callbacks->reloc_overflow) (info, diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c index a03ce632868..bd07ad68b28 100644 --- a/bfd/elf32-d10v.c +++ b/bfd/elf32-d10v.c @@ -482,7 +482,7 @@ elf32_d10v_relocate_section (bfd *output_bfd, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } r = _bfd_final_link_relocate (howto, input_bfd, input_section, diff --git a/bfd/elf32-epiphany.c b/bfd/elf32-epiphany.c index 4bd417d6f50..c45f0b35042 100644 --- a/bfd/elf32-epiphany.c +++ b/bfd/elf32-epiphany.c @@ -518,7 +518,7 @@ epiphany_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c index 6a13767c7ae..0d299c64b61 100644 --- a/bfd/elf32-fr30.c +++ b/bfd/elf32-fr30.c @@ -549,7 +549,7 @@ fr30_elf_relocate_section (bfd *output_bfd, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 8c6a97dea26..7770687f557 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -2736,7 +2736,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); if (name == NULL || name[0] == 0) - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } else { @@ -3566,8 +3566,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, && (!h || FRVFDPIC_FUNCDESC_LOCAL (info, h))) { addend += frvfdpic_got_section (info)->output_section->vma; - if ((bfd_get_section_flags (output_bfd, - input_section->output_section) + if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { bfd_vma offset; @@ -3597,8 +3596,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, picrel); } } - else if ((bfd_get_section_flags (output_bfd, - input_section->output_section) + else if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { bfd_vma offset; @@ -3691,8 +3689,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (osec) addend += osec->output_section->vma; if (IS_FDPIC (input_bfd) - && (bfd_get_section_flags (output_bfd, - input_section->output_section) + && (bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { if (_frvfdpic_osec_readonly_p (output_bfd, @@ -3732,8 +3729,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, } else { - if ((bfd_get_section_flags (output_bfd, - input_section->output_section) + if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { bfd_vma offset; @@ -4192,7 +4188,7 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); elf_hash_table (info)->sgot = s; if (s == NULL - || !bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; if (bed->want_got_sym) @@ -4230,14 +4226,14 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info) (flags | SEC_READONLY)); elf_hash_table (info)->srelgot = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; /* Machine-specific. */ s = bfd_make_section_anyway_with_flags (abfd, ".rofixup", (flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; frvfdpic_gotfixup_section (info) = s; @@ -4285,7 +4281,7 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; /* FRV-specific: remember it. */ frvfdpic_plt_section (info) = s; @@ -4305,7 +4301,7 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rel.plt", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; /* FRV-specific: remember it. */ frvfdpic_pltrel_section (info) = s; @@ -4373,7 +4369,7 @@ elf32_frvfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) ? ".rela.bss" : ".rel.bss"), flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; } } @@ -6137,7 +6133,7 @@ elf32_frv_check_relocs (bfd *abfd, case R_FRV_FUNCDESC_VALUE: picrel->relocsfdv++; - if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + if (bfd_section_flags (sec) & SEC_ALLOC) picrel->relocs32--; /* Fall through. */ @@ -6146,7 +6142,7 @@ elf32_frv_check_relocs (bfd *abfd, break; picrel->sym = 1; - if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + if (bfd_section_flags (sec) & SEC_ALLOC) picrel->relocs32++; break; diff --git a/bfd/elf32-ft32.c b/bfd/elf32-ft32.c index d67372429de..b8e69e5a248 100644 --- a/bfd/elf32-ft32.c +++ b/bfd/elf32-ft32.c @@ -389,7 +389,7 @@ ft32_elf_relocate_section (bfd *output_bfd, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index a2f06d5a928..ba7c8b2062d 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -502,7 +502,7 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (r) diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index a61adbc3c89..f065449b15e 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -2270,12 +2270,12 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Make space for the plt stub at the end of the .plt section. We want this stub right at the end, up against the .got section. */ - int gotalign = bfd_section_alignment (dynobj, htab->etab.sgot); - int pltalign = bfd_section_alignment (dynobj, sec); + int gotalign = bfd_section_alignment (htab->etab.sgot); + int pltalign = bfd_section_alignment (sec); bfd_size_type mask; if (gotalign > pltalign) - (void) bfd_set_section_alignment (dynobj, sec, gotalign); + bfd_set_section_alignment (sec, gotalign); mask = ((bfd_size_type) 1 << gotalign) - 1; sec->size = (sec->size + sizeof (plt_stub) + mask) & ~mask; } @@ -2284,7 +2284,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, || sec == htab->etab.sdynbss || sec == htab->etab.sdynrelro) ; - else if (CONST_STRNEQ (bfd_get_section_name (dynobj, sec), ".rela")) + else if (CONST_STRNEQ (bfd_section_name (sec), ".rela")) { if (sec->size != 0) { @@ -4151,7 +4151,7 @@ elf32_hppa_relocate_section (bfd *output_bfd, if (sym_name == NULL) return FALSE; if (*sym_name == '\0') - sym_name = bfd_section_name (input_bfd, sym_sec); + sym_name = bfd_section_name (sym_sec); _bfd_error_handler (_("%pB:%s has both normal and TLS relocs"), input_bfd, sym_name); @@ -4201,7 +4201,7 @@ elf32_hppa_relocate_section (bfd *output_bfd, if (sym_name == NULL) return FALSE; if (*sym_name == '\0') - sym_name = bfd_section_name (input_bfd, sym_sec); + sym_name = bfd_section_name (sym_sec); } howto = elf_hppa_howto_table + r_type; diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index d7a61d7a481..9248ef5a418 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -1948,7 +1948,7 @@ elf_i386_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, { const char *name; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); /* This is an ugly, but unfortunately necessary hack that is needed when producing EFI binaries on x86. It tells @@ -3429,7 +3429,7 @@ check_relocation_error: if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (r == bfd_reloc_overflow) diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c index 43e7be63dad..6e5131ff98b 100644 --- a/bfd/elf32-ip2k.c +++ b/bfd/elf32-ip2k.c @@ -1435,7 +1435,7 @@ ip2k_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c index 6e470272929..e95f1a56eac 100644 --- a/bfd/elf32-iq2000.c +++ b/bfd/elf32-iq2000.c @@ -625,7 +625,7 @@ iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, osec) : name; + name = name == NULL ? bfd_section_name (osec) : name; } else { diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c index 5233dbbb67c..0601f1454b4 100644 --- a/bfd/elf32-lm32.c +++ b/bfd/elf32-lm32.c @@ -195,8 +195,7 @@ create_rofixup_section (bfd *dynobj, struct bfd_link_info *info) | SEC_LINKER_CREATED | SEC_READONLY)); if (lm32fdpic_fixup32_section (info) == NULL - || ! bfd_set_section_alignment (dynobj, - lm32fdpic_fixup32_section (info), 2)) + || !bfd_set_section_alignment (lm32fdpic_fixup32_section (info), 2)) return FALSE; return TRUE; @@ -821,7 +820,7 @@ lm32_elf_relocate_section (bfd *output_bfd, relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { @@ -1036,7 +1035,7 @@ lm32_elf_relocate_section (bfd *output_bfd, if ((!h) || (h && h->root.type != bfd_link_hash_undefweak)) { /* Only create .rofixup entries for relocs in loadable sections. */ - if ((bfd_get_section_flags (output_bfd, input_section->output_section) + if ((bfd_section_flags (input_section->output_section) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) { @@ -1090,7 +1089,7 @@ lm32_elf_relocate_section (bfd *output_bfd, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (r) @@ -2120,7 +2119,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd, /* Strip this section if we don't need it; see the comment below. */ } - else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) + else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) { if (s->size != 0 && s != htab->root.srelplt) relocs = TRUE; @@ -2255,7 +2254,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd, /* Don't generate entries for weak symbols. */ if (!h || (h && h->root.type != bfd_link_hash_undefweak)) { - if (!discarded_section (s) && !((bfd_get_section_flags (ibfd, s) & SEC_ALLOC) == 0)) + if (!discarded_section (s) && !((bfd_section_flags (s) & SEC_ALLOC) == 0)) { switch (ELF32_R_TYPE (internal_relocs->r_info)) { @@ -2277,7 +2276,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd, if (!strcmp (current->name, h->root.root.string)) break; } - if (!current && !discarded_section (s) && (bfd_get_section_flags (ibfd, s) & SEC_ALLOC)) + if (!current && !discarded_section (s) && (bfd_section_flags (s) & SEC_ALLOC)) { /* Will this have an entry in the GOT. */ if (ELF32_R_TYPE (internal_relocs->r_info) == R_LM32_16_GOT) @@ -2377,7 +2376,7 @@ lm32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags); htab->root.splt = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; if (bed->want_plt_sym) @@ -2408,7 +2407,7 @@ lm32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) flags | SEC_READONLY); htab->root.srelplt = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; if (htab->root.sgot == NULL @@ -2447,7 +2446,7 @@ lm32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) flags | SEC_READONLY); htab->srelbss = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; } } diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c index b12c788c0df..e3f03cc045a 100644 --- a/bfd/elf32-m32c.c +++ b/bfd/elf32-m32c.c @@ -450,7 +450,7 @@ m32c_elf_relocate_section name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (sym->st_name == 0) ? bfd_section_name (input_bfd, sec) : name; + name = sym->st_name == 0 ? bfd_section_name (sec) : name; } else { @@ -709,7 +709,7 @@ m32c_elf_check_relocs flags); elf_hash_table (info)->splt = splt; if (splt == NULL - || ! bfd_set_section_alignment (dynobj, splt, 1)) + || !bfd_set_section_alignment (splt, 1)) return FALSE; } diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 2f182e782d2..edd04b91d9d 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -1322,7 +1322,7 @@ _bfd_m32r_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, int *retval) { - if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) + if (strcmp (bfd_section_name (sec), ".scommon") == 0) { *retval = SHN_M32R_SCOMMON; return TRUE; @@ -1407,7 +1407,7 @@ m32r_elf_add_symbol_hook (bfd *abfd, flags); if (s == NULL) return FALSE; - if (! bfd_set_section_alignment (abfd, s, 2)) + if (!bfd_set_section_alignment (s, 2)) return FALSE; } @@ -1623,7 +1623,7 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags); htab->root.splt = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; if (bed->want_plt_sym) @@ -1654,7 +1654,7 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) flags | SEC_READONLY); htab->root.srelplt = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; if (htab->root.sgot == NULL @@ -1693,7 +1693,7 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) flags | SEC_READONLY); htab->srelbss = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; } } @@ -2234,7 +2234,7 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Strip this section if we don't need it; see the comment below. */ } - else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) + else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) { if (s->size != 0 && s != htab->root.srelplt) relocs = TRUE; @@ -2954,7 +2954,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, const char *name; BFD_ASSERT (sec != NULL); - name = bfd_get_section_name (sec->owner, sec); + name = bfd_section_name (sec); if ( strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0 @@ -3022,7 +3022,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (errmsg != NULL) diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 6a996789b5b..8739ca86c13 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -267,7 +267,7 @@ elf32_m68hc11_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) section != NULL; section = section->next) { - const char* name = bfd_get_section_name (input_bfd, section); + const char *name = bfd_section_name (section); if (!strcmp (name, ".tramp")) htab->tramp_section = section; @@ -1014,7 +1014,7 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (is_far && ELF32_R_TYPE (rel->r_info) == R_M68HC11_16) diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 177be5d1d39..559578d8182 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -3104,7 +3104,7 @@ elf_m68k_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if (strcmp (name, ".plt") == 0) { @@ -3938,7 +3938,7 @@ elf_m68k_relocate_section (bfd *output_bfd, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } _bfd_error_handler @@ -3973,7 +3973,7 @@ elf_m68k_relocate_section (bfd *output_bfd, if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (r == bfd_reloc_overflow) diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index 7bca4585089..3a58ff3038b 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -536,7 +536,7 @@ mcore_elf_relocate_section (bfd * output_bfd, break; if (* name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } (*info->callbacks->reloc_overflow) diff --git a/bfd/elf32-mep.c b/bfd/elf32-mep.c index 414e6f394b7..f46e3bcbe36 100644 --- a/bfd/elf32-mep.c +++ b/bfd/elf32-mep.c @@ -477,7 +477,7 @@ mep_elf_relocate_section name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c index f68f9dca6f8..e3df8c56843 100644 --- a/bfd/elf32-metag.c +++ b/bfd/elf32-metag.c @@ -1519,7 +1519,7 @@ elf_metag_relocate_section (bfd *output_bfd, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { @@ -2934,7 +2934,7 @@ elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Strip this section if we don't need it; see the comment below. */ } - else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) + else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) { if (s->size != 0 && s != htab->etab.srelplt) relocs = TRUE; diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index 8d1700bf0f0..c187d83ee04 100644 --- a/bfd/elf32-microblaze.c +++ b/bfd/elf32-microblaze.c @@ -1071,7 +1071,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, /* Only relocate if the symbol is defined. */ if (sec) { - name = bfd_get_section_name (sec->owner, sec); + name = bfd_section_name (sec); if (strcmp (name, ".sdata2") == 0 || strcmp (name, ".sbss2") == 0) @@ -1119,7 +1119,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, /* Only relocate if the symbol is defined. */ if (sec) { - name = bfd_get_section_name (sec->owner, sec); + name = bfd_section_name (sec); if (strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0) @@ -1608,7 +1608,7 @@ microblaze_elf_relocate_section (bfd *output_bfd, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (errmsg != NULL) @@ -2766,7 +2766,7 @@ microblaze_elf_adjust_dynamic_symbol (struct bfd_link_info *info, s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); if (power_of_two > s->alignment_power) { - if (!bfd_set_section_alignment (s->owner, s, power_of_two)) + if (!bfd_set_section_alignment (s, power_of_two)) return FALSE; } @@ -3115,7 +3115,7 @@ microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if (strncmp (name, ".rela", 5) == 0) { @@ -3501,7 +3501,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd, put into .sbss. */ *secp = bfd_make_section_old_way (abfd, ".sbss"); if (*secp == NULL - || ! bfd_set_section_flags (abfd, *secp, SEC_IS_COMMON)) + || !bfd_set_section_flags (*secp, SEC_IS_COMMON)) return FALSE; *valp = sym->st_size; diff --git a/bfd/elf32-moxie.c b/bfd/elf32-moxie.c index 9834d8978fd..9b6048f0c00 100644 --- a/bfd/elf32-moxie.c +++ b/bfd/elf32-moxie.c @@ -243,7 +243,7 @@ moxie_elf_relocate_section (bfd *output_bfd, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c index fe5fd8ff8c1..4dcc8d480da 100644 --- a/bfd/elf32-msp430.c +++ b/bfd/elf32-msp430.c @@ -1314,7 +1314,7 @@ elf32_msp430_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL || * name == 0) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL || *name == 0 ? bfd_section_name (sec) : name; } else { @@ -1691,7 +1691,7 @@ msp430_elf_relax_delete_bytes (bfd * abfd, asection * sec, bfd_vma addr, name = bfd_elf_string_from_elf_section (abfd, symtab_hdr->sh_link, isym->st_name); - name = (name == NULL || * name == 0) ? bfd_section_name (abfd, sec) : name; + name = name == NULL || *name == 0 ? bfd_section_name (sec) : name; if (isym->st_shndx != sec_shndx) continue; diff --git a/bfd/elf32-mt.c b/bfd/elf32-mt.c index ca6aa13f195..d120d054828 100644 --- a/bfd/elf32-mt.c +++ b/bfd/elf32-mt.c @@ -346,7 +346,7 @@ mt_elf_relocate_section name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 27ffea2e692..013355a4908 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -3723,11 +3723,11 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info) /* _bfd_elf_create_got_section will create it for us. */ ehtab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); if (ehtab->srelgot == NULL - || !bfd_set_section_flags (dynobj, ehtab->srelgot, + || !bfd_set_section_flags (ehtab->srelgot, (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED | SEC_READONLY)) - || !bfd_set_section_alignment (dynobj, ehtab->srelgot, 2)) + || !bfd_set_section_alignment (ehtab->srelgot, 2)) return FALSE; return TRUE; @@ -3769,8 +3769,8 @@ nds32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section (abfd, ".plt"); ehtab->splt = s; if (s == NULL - || !bfd_set_section_flags (abfd, s, pltflags) - || !bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_flags (s, pltflags) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; if (bed->want_plt_sym) @@ -3798,8 +3798,8 @@ nds32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) bed->default_use_rela_p ? ".rela.plt" : ".rel.plt"); ehtab->srelplt = s; if (s == NULL - || !bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || !bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_flags (s, flags | SEC_READONLY) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; if (ehtab->sgot == NULL && !create_got_section (abfd, info)) @@ -3807,11 +3807,11 @@ nds32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) for (sec = abfd->sections; sec; sec = sec->next) { - secflags = bfd_get_section_flags (abfd, sec); + secflags = bfd_section_flags (sec); if ((secflags & (SEC_DATA | SEC_LINKER_CREATED)) || ((secflags & SEC_HAS_CONTENTS) != SEC_HAS_CONTENTS)) continue; - secname = bfd_get_section_name (abfd, sec); + secname = bfd_section_name (sec); relname = (char *) bfd_malloc ((bfd_size_type) strlen (secname) + 6); strcpy (relname, ".rela"); strcat (relname, secname); @@ -3819,8 +3819,8 @@ nds32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) continue; s = bfd_make_section (abfd, relname); if (s == NULL - || !bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || !bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_flags (s, flags | SEC_READONLY) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; } @@ -3835,7 +3835,7 @@ nds32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section (abfd, ".dynbss"); htab->sdynbss = s; if (s == NULL - || !bfd_set_section_flags (abfd, s, SEC_ALLOC | SEC_LINKER_CREATED)) + || !bfd_set_section_flags (s, SEC_ALLOC | SEC_LINKER_CREATED)) return FALSE; /* The .rel[a].bss section holds copy relocs. This section is not normally needed. We need to create it here, though, so that the @@ -3854,8 +3854,8 @@ nds32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) ? ".rela.bss" : ".rel.bss")); htab->srelbss = s; if (s == NULL - || !bfd_set_section_flags (abfd, s, flags | SEC_READONLY) - || !bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_flags (s, flags | SEC_READONLY) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; } } @@ -4065,9 +4065,9 @@ nds32_elf_adjust_dynamic_symbol (struct bfd_link_info *info, /* Apply the required alignment. */ s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); - if (power_of_two > bfd_get_section_alignment (dynobj, s)) + if (power_of_two > bfd_section_alignment (s)) { - if (!bfd_set_section_alignment (dynobj, s, power_of_two)) + if (!bfd_set_section_alignment (s, power_of_two)) return FALSE; } @@ -4525,7 +4525,7 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, { got_size += s->size; } - else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0) + else if (strncmp (bfd_section_name (s), ".rela", 5) == 0) { if (s->size != 0 && s != elf_hash_table (info)->srelplt) relocs = TRUE; @@ -5571,8 +5571,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, return FALSE; BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (input_bfd, - input_section), + && strcmp (bfd_section_name (input_section), name + 5) == 0); sreloc = bfd_get_section_by_name (dynobj, name); @@ -6166,7 +6165,7 @@ check_reloc: name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (errmsg != NULL) @@ -7390,7 +7389,7 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, return FALSE; BFD_ASSERT (strncmp (name, ".rela", 5) == 0 - && strcmp (bfd_get_section_name (abfd, sec), + && strcmp (bfd_section_name (sec), name + 5) == 0); sreloc = bfd_get_section_by_name (dynobj, name); @@ -7404,8 +7403,8 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, if ((sec->flags & SEC_ALLOC) != 0) flags |= SEC_ALLOC | SEC_LOAD; if (sreloc == NULL - || !bfd_set_section_flags (dynobj, sreloc, flags) - || !bfd_set_section_alignment (dynobj, sreloc, 2)) + || !bfd_set_section_flags (sreloc, flags) + || !bfd_set_section_alignment (sreloc, 2)) return FALSE; elf_section_type (sreloc) = SHT_RELA; diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c index 5d787eb2f40..698e4e5c2d4 100644 --- a/bfd/elf32-nios2.c +++ b/bfd/elf32-nios2.c @@ -3846,7 +3846,7 @@ nios2_elf32_relocate_section (bfd *output_bfd, (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } /* xgettext:c-format */ format = _("unable to reach %s (at %#" PRIx64 ") from " @@ -4484,7 +4484,7 @@ nios2_elf32_relocate_section (bfd *output_bfd, symtab_hdr->sh_link, sym->st_name); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (r) @@ -4554,7 +4554,7 @@ static bfd_boolean nios2_elf32_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, Elf_Internal_Shdr *hdr, asection *sec) { - register const char *name = bfd_get_section_name (abfd, sec); + const char *name = bfd_section_name (sec); if ((sec->flags & SEC_SMALL_DATA) || strcmp (name, ".sdata") == 0 @@ -4580,7 +4580,7 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info) /* In order for the two loads in .PLTresolve to share the same %hiadj, _GLOBAL_OFFSET_TABLE_ must be aligned to a 16-byte boundary. */ - if (!bfd_set_section_alignment (dynobj, htab->root.sgotplt, 4)) + if (!bfd_set_section_alignment (htab->root.sgotplt, 4)) return FALSE; /* The Nios II ABI specifies that GOT-relative relocations are relative @@ -4616,7 +4616,7 @@ nios2_elf32_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) same %hiadj, the start of the PLT (as well as the GOT) must be aligned to a 16-byte boundary. This is because the addresses for these loads include the -(.plt+4) PIC correction. */ - return bfd_set_section_alignment (dynobj, htab->root.splt, 4); + return bfd_set_section_alignment (htab->root.splt, 4); } /* Implement elf_backend_copy_indirect_symbol: @@ -5429,8 +5429,8 @@ nios2_elf32_adjust_dynamic_symbol (struct bfd_link_info *info, /* Align dynbss. */ s->size = BFD_ALIGN (s->size, (bfd_size_type)1 << align2); - if (align2 > bfd_get_section_alignment (dynobj, s) - && !bfd_set_section_alignment (dynobj, s, align2)) + if (align2 > bfd_section_alignment (s) + && !bfd_set_section_alignment (s, align2)) return FALSE; /* Define the symbol as being at this point in the section. */ @@ -5853,7 +5853,7 @@ nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if (CONST_STRNEQ (name, ".rela")) { diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index 0d1336ceacc..4cf0b7cc36c 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -1303,7 +1303,7 @@ or1k_elf_relocate_section (bfd *output_bfd, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { @@ -2064,8 +2064,7 @@ or1k_elf_check_relocs (bfd *abfd, return FALSE; if (strncmp (name, ".rela", 5) != 0 - || strcmp (bfd_get_section_name (abfd, sec), - name + 5) != 0) + || strcmp (bfd_section_name (sec), name + 5) != 0) { _bfd_error_handler /* xgettext:c-format */ @@ -2996,7 +2995,7 @@ or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Strip this section if we don't need it; see the comment below. */ } - else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) + else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) { if (s->size != 0 && s != htab->root.srelplt) relocs = TRUE; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 5e5834a70ca..9765a33541f 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -1329,14 +1329,14 @@ ppc_elf_section_from_shdr (bfd *abfd, return FALSE; newsect = hdr->bfd_section; - flags = bfd_get_section_flags (abfd, newsect); + flags = bfd_section_flags (newsect); if (hdr->sh_flags & SHF_EXCLUDE) flags |= SEC_EXCLUDE; if (hdr->sh_type == SHT_ORDERED) flags |= SEC_SORT_ENTRIES; - bfd_set_section_flags (abfd, newsect, flags); + bfd_set_section_flags (newsect, flags); return TRUE; } @@ -1674,7 +1674,7 @@ ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info) /* Set the output section size, if it exists. */ asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME); - if (asec && ! bfd_set_section_size (abfd, asec, 20 + num_entries * 4)) + if (asec && !bfd_set_section_size (asec, 20 + num_entries * 4)) { ibfd = abfd; /* xgettext:c-format */ @@ -2337,7 +2337,7 @@ ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info) executable. */ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); - if (!bfd_set_section_flags (abfd, htab->elf.sgot, flags)) + if (!bfd_set_section_flags (htab->elf.sgot, flags)) return FALSE; } @@ -2390,7 +2390,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info) if (p2align < htab->params->plt_stub_align) p2align = htab->params->plt_stub_align; if (s == NULL - || !bfd_set_section_alignment (abfd, s, p2align)) + || !bfd_set_section_alignment (s, p2align)) return FALSE; if (!info->no_ld_generated_unwind_info) @@ -2400,7 +2400,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".eh_frame", flags); htab->glink_eh_frame = s; if (s == NULL - || !bfd_set_section_alignment (abfd, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; } @@ -2408,7 +2408,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".iplt", flags); htab->elf.iplt = s; if (s == NULL - || !bfd_set_section_alignment (abfd, s, 4)) + || !bfd_set_section_alignment (s, 4)) return FALSE; flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS @@ -2416,7 +2416,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rela.iplt", flags); htab->elf.irelplt = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 2)) + || ! bfd_set_section_alignment (s, 2)) return FALSE; /* Local plt entries. */ @@ -2425,7 +2425,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info) htab->pltlocal = bfd_make_section_anyway_with_flags (abfd, ".branch_lt", flags); if (htab->pltlocal == NULL - || ! bfd_set_section_alignment (abfd, htab->pltlocal, 2)) + || !bfd_set_section_alignment (htab->pltlocal, 2)) return FALSE; if (bfd_link_pic (info)) @@ -2435,7 +2435,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info) htab->relpltlocal = bfd_make_section_anyway_with_flags (abfd, ".rela.branch_lt", flags); if (htab->relpltlocal == NULL - || ! bfd_set_section_alignment (abfd, htab->relpltlocal, 2)) + || !bfd_set_section_alignment (htab->relpltlocal, 2)) return FALSE; } @@ -2487,7 +2487,7 @@ ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rela.sbss", flags); htab->relsbss = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; } @@ -2500,7 +2500,7 @@ ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) if (htab->plt_type == PLT_VXWORKS) /* The VxWorks PLT is a loaded section with contents. */ flags |= SEC_HAS_CONTENTS | SEC_LOAD | SEC_READONLY; - return bfd_set_section_flags (abfd, s, flags); + return bfd_set_section_flags (s, flags); } /* Copy the extra info we tack onto an elf_link_hash_entry. */ @@ -2739,7 +2739,7 @@ elf_allocate_pointer_linker_section (bfd *abfd, linker_section_ptr->lsect = lsect; *ptr_linker_section_ptr = linker_section_ptr; - if (!bfd_set_section_alignment (lsect->section->owner, lsect->section, 2)) + if (!bfd_set_section_alignment (lsect->section, 2)) return FALSE; linker_section_ptr->offset = lsect->section->size; lsect->section->size += 4; @@ -4029,19 +4029,19 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED, /* The new PLT is a loaded section. */ if (htab->elf.splt != NULL - && !bfd_set_section_flags (htab->elf.dynobj, htab->elf.splt, flags)) + && !bfd_set_section_flags (htab->elf.splt, flags)) return -1; /* The new GOT is not executable. */ if (htab->elf.sgot != NULL - && !bfd_set_section_flags (htab->elf.dynobj, htab->elf.sgot, flags)) + && !bfd_set_section_flags (htab->elf.sgot, flags)) return -1; } else { /* Stop an unused .glink section from affecting .text alignment. */ if (htab->glink != NULL - && !bfd_set_section_alignment (htab->elf.dynobj, htab->glink, 0)) + && !bfd_set_section_alignment (htab->glink, 0)) return -1; } return htab->plt_type == PLT_NEW; @@ -5823,8 +5823,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd, { strip_section = (s->flags & SEC_KEEP) == 0; } - else if (CONST_STRNEQ (bfd_get_section_name (htab->elf.dynobj, s), - ".rela")) + else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) { if (s->size != 0) { @@ -8394,10 +8393,8 @@ ppc_elf_relocate_section (bfd *output_bfd, unresolved_reloc = TRUE; break; } - BFD_ASSERT (strcmp (bfd_get_section_name (sec->owner, sec), - ".got") == 0 - || strcmp (bfd_get_section_name (sec->owner, sec), - ".cgot") == 0); + BFD_ASSERT (strcmp (bfd_section_name (sec), ".got") == 0 + || strcmp (bfd_section_name (sec), ".cgot") == 0); addend -= sec->output_section->vma + sec->output_offset + 0x8000; break; @@ -8512,7 +8509,7 @@ ppc_elf_relocate_section (bfd *output_bfd, } addend -= SYM_VAL (sda); - name = bfd_get_section_name (output_bfd, sec->output_section); + name = bfd_section_name (sec->output_section); if (!(strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0)) { @@ -8543,7 +8540,7 @@ ppc_elf_relocate_section (bfd *output_bfd, } addend -= SYM_VAL (sda); - name = bfd_get_section_name (output_bfd, sec->output_section); + name = bfd_section_name (sec->output_section); if (!(strcmp (name, ".sdata2") == 0 || strcmp (name, ".sbss2") == 0)) { @@ -8618,7 +8615,7 @@ ppc_elf_relocate_section (bfd *output_bfd, break; } - name = bfd_get_section_name (output_bfd, sec->output_section); + name = bfd_section_name (sec->output_section); if (strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0) { @@ -8725,7 +8722,7 @@ ppc_elf_relocate_section (bfd *output_bfd, break; } - name = bfd_get_section_name (output_bfd, sec->output_section); + name = bfd_section_name (sec->output_section); if (strcmp (name, ".sdata") == 0 || strcmp (name, ".sbss") == 0) sda = htab->sdata[0].sym; diff --git a/bfd/elf32-pru.c b/bfd/elf32-pru.c index d9be74f9163..054f1650f26 100644 --- a/bfd/elf32-pru.c +++ b/bfd/elf32-pru.c @@ -905,7 +905,7 @@ pru_elf32_relocate_section (bfd *output_bfd, symtab_hdr->sh_link, sym->st_name); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (r) diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c index 8fa7ea30be3..ba95515f7d5 100644 --- a/bfd/elf32-rl78.c +++ b/bfd/elf32-rl78.c @@ -726,7 +726,7 @@ rl78_elf_relocate_section name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (sym->st_name == 0) ? bfd_section_name (input_bfd, sec) : name; + name = sym->st_name == 0 ? bfd_section_name (sec) : name; } else { @@ -1349,7 +1349,7 @@ rl78_elf_check_relocs flags); elf_hash_table (info)->splt = splt; if (splt == NULL - || ! bfd_set_section_alignment (dynobj, splt, 1)) + || !bfd_set_section_alignment (splt, 1)) return FALSE; } diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c index e130784bc8f..7978244f1e5 100644 --- a/bfd/elf32-rx.c +++ b/bfd/elf32-rx.c @@ -543,7 +543,7 @@ rx_elf_relocate_section name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (sym->st_name == 0) ? bfd_section_name (input_bfd, sec) : name; + name = sym->st_name == 0 ? bfd_section_name (sec) : name; } else { diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 7bdccdbef98..7e22d9666ab 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -2003,7 +2003,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Strip this section if we don't need it; see the comment below. */ } - else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) + else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) { if (s->size != 0) relocs = TRUE; @@ -3254,7 +3254,7 @@ elf_s390_relocate_section (bfd *output_bfd, if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (r == bfd_reloc_overflow) diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c index 1bbf64fe6dc..3d499ca0719 100644 --- a/bfd/elf32-score.c +++ b/bfd/elf32-score.c @@ -1257,8 +1257,8 @@ score_elf_rel_dyn_section (bfd *dynobj, bfd_boolean create_p) | SEC_LINKER_CREATED | SEC_READONLY)); if (sreloc == NULL - || ! bfd_set_section_alignment (dynobj, sreloc, - SCORE_ELF_LOG_FILE_ALIGN (dynobj))) + || !bfd_set_section_alignment (sreloc, + SCORE_ELF_LOG_FILE_ALIGN (dynobj))) return NULL; } return sreloc; @@ -1431,7 +1431,7 @@ score_elf_create_got_section (bfd *abfd, s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); elf_hash_table (info)->sgot = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 4)) + || !bfd_set_section_alignment (s, 4)) return FALSE; /* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the @@ -3070,7 +3070,7 @@ s3_bfd_score_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, int *retval) { - if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) + if (strcmp (bfd_section_name (sec), ".scommon") == 0) { *retval = SHN_SCORE_SCOMMON; return TRUE; @@ -3283,7 +3283,7 @@ s3_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if (CONST_STRNEQ (name, ".rel")) { @@ -3296,8 +3296,7 @@ s3_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i the linker now does not create empty output sections. */ if (s->output_section != NULL && strcmp (name, - bfd_get_section_name (s->output_section->owner, - s->output_section)) == 0) + bfd_section_name (s->output_section)) == 0) s->flags |= SEC_EXCLUDE; } else @@ -3311,7 +3310,7 @@ s3_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i assert a DT_TEXTREL entry rather than testing whether there exists a relocation to a read only section or not. */ - outname = bfd_get_section_name (output_bfd, s->output_section); + outname = bfd_section_name (s->output_section); target = bfd_get_section_by_name (output_bfd, outname + 4); if ((target != NULL && (target->flags & SEC_READONLY) != 0 @@ -3424,7 +3423,7 @@ s3_bfd_score_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_get_linker_section (abfd, ".dynamic"); if (s != NULL) { - if (!bfd_set_section_flags (abfd, s, flags)) + if (!bfd_set_section_flags (s, flags)) return FALSE; } @@ -3441,7 +3440,7 @@ s3_bfd_score_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, SCORE_ELF_STUB_SECTION_NAME, flags | SEC_CODE); if (s == NULL - || !bfd_set_section_alignment (abfd, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; } @@ -3709,7 +3708,7 @@ s3_bfd_score_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, { const char *name; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); if (strcmp (name, ".got") == 0 || strcmp (name, ".srdata") == 0 @@ -3732,7 +3731,7 @@ s3_bfd_score_elf_section_processing (bfd *abfd ATTRIBUTE_UNUSED, Elf_Internal_Sh { if (hdr->bfd_section != NULL) { - const char *name = bfd_get_section_name (abfd, hdr->bfd_section); + const char *name = bfd_section_name (hdr->bfd_section); if (strcmp (name, ".sdata") == 0) { diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c index 51a5fb106d7..e625435ff57 100644 --- a/bfd/elf32-score7.c +++ b/bfd/elf32-score7.c @@ -1114,8 +1114,8 @@ score_elf_rel_dyn_section (bfd *dynobj, bfd_boolean create_p) | SEC_LINKER_CREATED | SEC_READONLY)); if (sreloc == NULL - || ! bfd_set_section_alignment (dynobj, sreloc, - SCORE_ELF_LOG_FILE_ALIGN (dynobj))) + || !bfd_set_section_alignment (sreloc, + SCORE_ELF_LOG_FILE_ALIGN (dynobj))) return NULL; } return sreloc; @@ -1289,7 +1289,7 @@ score_elf_create_got_section (bfd *abfd, s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); elf_hash_table (info)->sgot = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 4)) + || !bfd_set_section_alignment (s, 4)) return FALSE; /* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the @@ -2875,7 +2875,7 @@ s7_bfd_score_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, int *retval) { - if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) + if (strcmp (bfd_section_name (sec), ".scommon") == 0) { *retval = SHN_SCORE_SCOMMON; return TRUE; @@ -3091,7 +3091,7 @@ s7_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if (CONST_STRNEQ (name, ".rel")) { @@ -3104,8 +3104,7 @@ s7_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i the linker now does not create empty output sections. */ if (s->output_section != NULL && strcmp (name, - bfd_get_section_name (s->output_section->owner, - s->output_section)) == 0) + bfd_section_name (s->output_section)) == 0) s->flags |= SEC_EXCLUDE; } else @@ -3119,7 +3118,7 @@ s7_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i assert a DT_TEXTREL entry rather than testing whether there exists a relocation to a read only section or not. */ - outname = bfd_get_section_name (output_bfd, s->output_section); + outname = bfd_section_name (s->output_section); target = bfd_get_section_by_name (output_bfd, outname + 4); if ((target != NULL && (target->flags & SEC_READONLY) != 0 @@ -3232,7 +3231,7 @@ s7_bfd_score_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_get_linker_section (abfd, ".dynamic"); if (s != NULL) { - if (!bfd_set_section_flags (abfd, s, flags)) + if (!bfd_set_section_flags (s, flags)) return FALSE; } @@ -3249,7 +3248,7 @@ s7_bfd_score_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, SCORE_ELF_STUB_SECTION_NAME, flags | SEC_CODE); if (s == NULL - || !bfd_set_section_alignment (abfd, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; } @@ -3520,7 +3519,7 @@ s7_bfd_score_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, { const char *name; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); if (strcmp (name, ".got") == 0 || strcmp (name, ".srdata") == 0 @@ -3544,7 +3543,7 @@ s7_bfd_score_elf_section_processing (bfd *abfd ATTRIBUTE_UNUSED, Elf_Internal_Sh { if (hdr->bfd_section != NULL) { - const char *name = bfd_get_section_name (abfd, hdr->bfd_section); + const char *name = bfd_section_name (hdr->bfd_section); if (strcmp (name, ".sdata") == 0) { diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 91900b8bea3..c572f709f2a 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -2324,7 +2324,7 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info) | SEC_IN_MEMORY | SEC_LINKER_CREATED)); if (htab->sfuncdesc == NULL - || ! bfd_set_section_alignment (dynobj, htab->sfuncdesc, 2)) + || !bfd_set_section_alignment (htab->sfuncdesc, 2)) return FALSE; htab->srelfuncdesc = bfd_make_section_anyway_with_flags (dynobj, @@ -2335,7 +2335,7 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info) | SEC_LINKER_CREATED | SEC_READONLY)); if (htab->srelfuncdesc == NULL - || ! bfd_set_section_alignment (dynobj, htab->srelfuncdesc, 2)) + || !bfd_set_section_alignment (htab->srelfuncdesc, 2)) return FALSE; /* Also create .rofixup. */ @@ -2346,7 +2346,7 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info) | SEC_LINKER_CREATED | SEC_READONLY)); if (htab->srofixup == NULL - || ! bfd_set_section_alignment (dynobj, htab->srofixup, 2)) + || !bfd_set_section_alignment (htab->srofixup, 2)) return FALSE; return TRUE; @@ -2401,7 +2401,7 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags); htab->root.splt = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; if (bed->want_plt_sym) @@ -2433,7 +2433,7 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) flags | SEC_READONLY); htab->root.srelplt = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; if (htab->root.sgot == NULL @@ -2473,7 +2473,7 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) flags | SEC_READONLY); htab->srelbss = s; if (s == NULL - || ! bfd_set_section_alignment (abfd, s, ptralign)) + || !bfd_set_section_alignment (s, ptralign)) return FALSE; } } @@ -3211,7 +3211,7 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Strip this section if we don't need it; see the comment below. */ } - else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) + else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) { if (s->size != 0 && s != htab->root.srelplt && s != htab->srelplt2) relocs = TRUE; @@ -3619,7 +3619,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, symname = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); if (symname == NULL || *symname == '\0') - symname = bfd_section_name (input_bfd, sec); + symname = bfd_section_name (sec); relocation = (sec->output_section->vma + sec->output_offset @@ -5170,7 +5170,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } (*info->callbacks->reloc_overflow) (info, (h ? &h->root : NULL), name, howto->name, diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c index f66e37cd00a..e75d999fd51 100644 --- a/bfd/elf32-spu.c +++ b/bfd/elf32-spu.c @@ -585,7 +585,7 @@ spu_elf_create_sections (struct bfd_link_info *info) flags = SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY; s = bfd_make_section_anyway_with_flags (ibfd, SPU_PTNOTE_SPUNAME, flags); if (s == NULL - || !bfd_set_section_alignment (ibfd, s, 4)) + || !bfd_set_section_alignment (s, 4)) return FALSE; /* Because we didn't set SEC_LINKER_CREATED we need to set the proper section type. */ @@ -595,7 +595,7 @@ spu_elf_create_sections (struct bfd_link_info *info) size = 12 + ((sizeof (SPU_PLUGIN_NAME) + 3) & -4); size += (name_len + 3) & -4; - if (!bfd_set_section_size (ibfd, s, size)) + if (!bfd_set_section_size (s, size)) return FALSE; data = bfd_zalloc (ibfd, size); @@ -622,7 +622,7 @@ spu_elf_create_sections (struct bfd_link_info *info) flags = (SEC_LOAD | SEC_ALLOC | SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_LINKER_CREATED); s = bfd_make_section_anyway_with_flags (ibfd, ".fixup", flags); - if (s == NULL || !bfd_set_section_alignment (ibfd, s, 2)) + if (s == NULL || !bfd_set_section_alignment (s, 2)) return FALSE; htab->sfixup = s; } @@ -1694,7 +1694,7 @@ spu_elf_size_stubs (struct bfd_link_info *info) stub = bfd_make_section_anyway_with_flags (ibfd, ".stub", flags); htab->stub_sec[0] = stub; if (stub == NULL - || !bfd_set_section_alignment (ibfd, stub, + || !bfd_set_section_alignment (stub, ovl_stub_size_log2 (htab->params))) return 0; stub->size = htab->stub_count[0] * ovl_stub_size (htab->params); @@ -1709,7 +1709,7 @@ spu_elf_size_stubs (struct bfd_link_info *info) stub = bfd_make_section_anyway_with_flags (ibfd, ".stub", flags); htab->stub_sec[ovl] = stub; if (stub == NULL - || !bfd_set_section_alignment (ibfd, stub, + || !bfd_set_section_alignment (stub, ovl_stub_size_log2 (htab->params))) return 0; stub->size = htab->stub_count[ovl] * ovl_stub_size (htab->params); @@ -1727,7 +1727,7 @@ spu_elf_size_stubs (struct bfd_link_info *info) flags = SEC_ALLOC; htab->ovtab = bfd_make_section_anyway_with_flags (ibfd, ".ovtab", flags); if (htab->ovtab == NULL - || !bfd_set_section_alignment (ibfd, htab->ovtab, 4)) + || !bfd_set_section_alignment (htab->ovtab, 4)) return 0; htab->ovtab->size = (16 + 16 + (16 << htab->fromelem_size_log2)) @@ -1736,7 +1736,7 @@ spu_elf_size_stubs (struct bfd_link_info *info) flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY; htab->init = bfd_make_section_anyway_with_flags (ibfd, ".ovini", flags); if (htab->init == NULL - || !bfd_set_section_alignment (ibfd, htab->init, 4)) + || !bfd_set_section_alignment (htab->init, 4)) return 0; htab->init->size = 16; @@ -1761,7 +1761,7 @@ spu_elf_size_stubs (struct bfd_link_info *info) flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY; htab->ovtab = bfd_make_section_anyway_with_flags (ibfd, ".ovtab", flags); if (htab->ovtab == NULL - || !bfd_set_section_alignment (ibfd, htab->ovtab, 4)) + || !bfd_set_section_alignment (htab->ovtab, 4)) return 0; htab->ovtab->size = htab->num_overlays * 16 + 16 + htab->num_buf * 4; @@ -1769,7 +1769,7 @@ spu_elf_size_stubs (struct bfd_link_info *info) htab->toe = bfd_make_section_anyway_with_flags (ibfd, ".toe", SEC_ALLOC); if (htab->toe == NULL - || !bfd_set_section_alignment (ibfd, htab->toe, 4)) + || !bfd_set_section_alignment (htab->toe, 4)) return 0; htab->toe->size = 16; @@ -5049,7 +5049,7 @@ spu_elf_relocate_section (bfd *output_bfd, (_("%pB(%s+%#" PRIx64 "): " "unresolvable %s relocation against symbol `%s'"), input_bfd, - bfd_get_section_name (input_bfd, input_section), + bfd_section_name (input_section), (uint64_t) rel->r_offset, howto->name, sym_name); @@ -5436,7 +5436,7 @@ spu_elf_modify_program_headers (bfd *abfd, struct bfd_link_info *info) } bfd_boolean -spu_elf_size_sections (bfd * output_bfd, struct bfd_link_info *info) +spu_elf_size_sections (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info) { struct spu_link_hash_table *htab = spu_hash_table (info); if (htab->params->emit_fixups) @@ -5493,7 +5493,7 @@ spu_elf_size_sections (bfd * output_bfd, struct bfd_link_info *info) /* We always have a NULL fixup as a sentinel */ size = (fixup_count + 1) * FIXUP_RECORD_SIZE; - if (!bfd_set_section_size (output_bfd, sfixup, size)) + if (!bfd_set_section_size (sfixup, size)) return FALSE; sfixup->contents = (bfd_byte *) bfd_zalloc (info->input_bfds, size); if (sfixup->contents == NULL) diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c index 87ec8475a8a..258349cfb75 100644 --- a/bfd/elf32-tic6x.c +++ b/bfd/elf32-tic6x.c @@ -1684,8 +1684,8 @@ elf32_tic6x_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) htab->dsbt = bfd_make_section_anyway_with_flags (dynobj, ".dsbt", flags); if (htab->dsbt == NULL - || ! bfd_set_section_alignment (dynobj, htab->dsbt, 2) - || ! bfd_set_section_alignment (dynobj, htab->elf.splt, 5)) + || !bfd_set_section_alignment (htab->dsbt, 2) + || !bfd_set_section_alignment (htab->elf.splt, 5)) return FALSE; return TRUE; @@ -1992,7 +1992,7 @@ elf32_tic6x_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, { const char * name; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); if (is_tic6x_elf_unwind_section_name (name)) { @@ -2683,7 +2683,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd, if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (r) @@ -3016,7 +3016,7 @@ elf32_tic6x_add_symbol_hook (bfd *abfd, *secp = bfd_make_section_old_way (abfd, ".scommon"); (*secp)->flags |= SEC_IS_COMMON; *valp = sym->st_size; - (void) bfd_set_section_alignment (abfd, *secp, bfd_log2 (sym->st_value)); + bfd_set_section_alignment (*secp, bfd_log2 (sym->st_value)); break; } @@ -3072,7 +3072,7 @@ elf32_tic6x_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, int *retval) { - if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) + if (strcmp (bfd_section_name (sec), ".scommon") == 0) { *retval = SHN_TIC6X_SCOMMON; return TRUE; @@ -3385,7 +3385,7 @@ elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) if (s == htab->elf.splt && s->size > 0) s->size = (s->size + 31) & ~(bfd_vma)31; } - else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) + else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) { if (s->size != 0 && s != htab->elf.srelplt) @@ -3992,10 +3992,10 @@ elf32_tic6x_adjust_exidx_size (asection *exidx_sec, int adjust) if (!exidx_sec->rawsize) exidx_sec->rawsize = exidx_sec->size; - bfd_set_section_size (exidx_sec->owner, exidx_sec, exidx_sec->size + adjust); + bfd_set_section_size (exidx_sec, exidx_sec->size + adjust); out_sec = exidx_sec->output_section; /* Adjust size of output section. */ - bfd_set_section_size (out_sec->owner, out_sec, out_sec->size +adjust); + bfd_set_section_size (out_sec, out_sec->size +adjust); } /* Insert an EXIDX_CANTUNWIND marker at the end of a section. */ diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index 832561d2606..249b3aaf5ba 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -1229,13 +1229,13 @@ tilepro_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) (bed->dynamic_sec_flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->srelgot = s; s = s_got = bfd_make_section_with_flags (abfd, ".got", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->sgot = s; @@ -1246,8 +1246,7 @@ tilepro_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) { s = bfd_make_section_with_flags (abfd, ".got.plt", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->sgotplt = s; @@ -2754,7 +2753,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (r_type) diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index 74e15463212..21df3c8b9ac 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -177,7 +177,7 @@ v850_elf_check_relocs (bfd *abfd, if (h && h->root.type == bfd_link_hash_common && h->root.u.c.p - && !strcmp (bfd_get_section_name (abfd, h->root.u.c.p->section), "COMMON")) + && !strcmp (bfd_section_name (h->root.u.c.p->section), "COMMON")) { asection * section; @@ -2269,7 +2269,7 @@ v850_elf_relocate_section (bfd *output_bfd, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch ((int) r) @@ -2372,11 +2372,11 @@ v850_elf_make_note_section (bfd * abfd) if (s == NULL) return NULL; - if (!bfd_set_section_alignment (abfd, s, 2)) + if (!bfd_set_section_alignment (s, 2)) return NULL; /* Allocate space for all known notes. */ - if (!bfd_set_section_size (abfd, s, NUM_V850_NOTES * SIZEOF_V850_NOTE)) + if (!bfd_set_section_size (s, NUM_V850_NOTES * SIZEOF_V850_NOTE)) return NULL; data = bfd_zalloc (abfd, NUM_V850_NOTES * SIZEOF_V850_NOTE); @@ -2443,7 +2443,7 @@ v850_elf_copy_notes (bfd *ibfd, bfd *obfd) if ((inotes = bfd_get_section_by_name (ibfd, V850_NOTE_SECNAME)) == NULL) return; - if (bfd_section_size (ibfd, inotes) == bfd_section_size (obfd, onotes)) + if (bfd_section_size (inotes) == bfd_section_size (onotes)) { bfd_byte * icont; bfd_byte * ocont; @@ -2457,7 +2457,7 @@ v850_elf_copy_notes (bfd *ibfd, bfd *obfd) return; /* Copy/overwrite notes from the input to the output. */ - memcpy (ocont, icont, bfd_section_size (obfd, onotes)); + memcpy (ocont, icont, bfd_section_size (onotes)); } } @@ -2490,7 +2490,7 @@ v850_elf_merge_notes (bfd * ibfd, bfd *obfd) bfd_byte * icont; bfd_byte * ocont; - BFD_ASSERT (bfd_section_size (ibfd, inotes) == bfd_section_size (obfd, onotes)); + BFD_ASSERT (bfd_section_size (inotes) == bfd_section_size (onotes)); if ((icont = elf_section_data (inotes)->this_hdr.contents) == NULL) BFD_ASSERT (bfd_malloc_and_get_section (ibfd, inotes, & icont)); @@ -2672,7 +2672,7 @@ v850_elf_print_notes (bfd * abfd, FILE * file) if (notes == NULL || notes->contents == NULL) return; - BFD_ASSERT (bfd_section_size (abfd, notes) == NUM_V850_NOTES * SIZEOF_V850_NOTE); + BFD_ASSERT (bfd_section_size (notes) == NUM_V850_NOTES * SIZEOF_V850_NOTE); for (id = V850_NOTE_ALIGNMENT; id <= NUM_V850_NOTES; id++) print_v850_note (abfd, file, notes->contents, id); @@ -2946,11 +2946,11 @@ v850_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, int *retval) { - if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) + if (strcmp (bfd_section_name (sec), ".scommon") == 0) *retval = SHN_V850_SCOMMON; - else if (strcmp (bfd_get_section_name (abfd, sec), ".tcommon") == 0) + else if (strcmp (bfd_section_name (sec), ".tcommon") == 0) *retval = SHN_V850_TCOMMON; - else if (strcmp (bfd_get_section_name (abfd, sec), ".zcommon") == 0) + else if (strcmp (bfd_section_name (sec), ".zcommon") == 0) *retval = SHN_V850_ZCOMMON; else return FALSE; @@ -3162,10 +3162,9 @@ v850_elf_section_from_shdr (bfd *abfd, case SHT_V850_SCOMMON: case SHT_V850_TCOMMON: case SHT_V850_ZCOMMON: - if (! bfd_set_section_flags (abfd, hdr->bfd_section, - (bfd_get_section_flags (abfd, - hdr->bfd_section) - | SEC_IS_COMMON))) + if (!bfd_set_section_flags (hdr->bfd_section, + (bfd_section_flags (hdr->bfd_section) + | SEC_IS_COMMON))) return FALSE; } @@ -3182,7 +3181,7 @@ v850_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, { const char * name; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); if (strcmp (name, ".scommon") == 0) hdr->sh_type = SHT_V850_SCOMMON; diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c index 2af70507079..80162d87cb2 100644 --- a/bfd/elf32-vax.c +++ b/bfd/elf32-vax.c @@ -1069,7 +1069,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if (strcmp (name, ".plt") == 0) { @@ -1094,8 +1094,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) section, then we probably need a DT_TEXTREL entry. .rela.plt is actually associated with .got.plt, which is never readonly. */ - outname = bfd_get_section_name (output_bfd, - s->output_section); + outname = bfd_section_name (s->output_section); target = bfd_get_section_by_name (output_bfd, outname + 5); if (target != NULL && (target->flags & SEC_READONLY) != 0 @@ -1633,7 +1632,7 @@ elf_vax_relocate_section (bfd *output_bfd, if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } info->callbacks->reloc_overflow (info, (h ? &h->root : NULL), name, howto->name, diff --git a/bfd/elf32-visium.c b/bfd/elf32-visium.c index 76271ce7cd4..35e4b84ed14 100644 --- a/bfd/elf32-visium.c +++ b/bfd/elf32-visium.c @@ -599,7 +599,7 @@ visium_elf_relocate_section (bfd *output_bfd, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index 05a93266852..ef106b3f928 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -471,7 +471,7 @@ xstormy16_elf_check_relocs (bfd *abfd, flags); elf_hash_table (info)->splt = splt; if (splt == NULL - || ! bfd_set_section_alignment (dynobj, splt, 1)) + || !bfd_set_section_alignment (splt, 1)) return FALSE; } @@ -834,7 +834,7 @@ xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (ELF32_R_TYPE (rel->r_info)) diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 8a7bf7e96f8..306b18b4f26 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -1320,21 +1320,21 @@ elf_xtensa_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) /* Mark the ".got.plt" section READONLY. */ if (htab->elf.sgotplt == NULL - || ! bfd_set_section_flags (dynobj, htab->elf.sgotplt, flags)) + || !bfd_set_section_flags (htab->elf.sgotplt, flags)) return FALSE; /* Create ".got.loc" (literal tables for use by dynamic linker). */ htab->sgotloc = bfd_make_section_anyway_with_flags (dynobj, ".got.loc", flags); if (htab->sgotloc == NULL - || ! bfd_set_section_alignment (dynobj, htab->sgotloc, 2)) + || !bfd_set_section_alignment (htab->sgotloc, 2)) return FALSE; /* Create ".xt.lit.plt" (literal table for ".got.plt*"). */ htab->spltlittbl = bfd_make_section_anyway_with_flags (dynobj, ".xt.lit.plt", noalloc_flags); if (htab->spltlittbl == NULL - || ! bfd_set_section_alignment (dynobj, htab->spltlittbl, 2)) + || !bfd_set_section_alignment (htab->spltlittbl, 2)) return FALSE; return TRUE; @@ -1366,14 +1366,14 @@ add_extra_plt_sections (struct bfd_link_info *info, int count) sprintf (sname, ".plt.%u", chunk); s = bfd_make_section_anyway_with_flags (dynobj, sname, flags | SEC_CODE); if (s == NULL - || ! bfd_set_section_alignment (dynobj, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; sname = (char *) bfd_malloc (14); sprintf (sname, ".got.plt.%u", chunk); s = bfd_make_section_anyway_with_flags (dynobj, sname, flags); if (s == NULL - || ! bfd_set_section_alignment (dynobj, s, 2)) + || !bfd_set_section_alignment (s, 2)) return FALSE; } @@ -1626,7 +1626,7 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if (CONST_STRNEQ (name, ".rela")) { @@ -2687,7 +2687,7 @@ elf_xtensa_relocate_section (bfd *output_bfd, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (r_symndx != STN_UNDEF @@ -11244,7 +11244,7 @@ xtensa_make_property_section (asection *sec, const char *base_name) if (! prop_sec) { flagword flags = (SEC_RELOC | SEC_HAS_CONTENTS | SEC_READONLY); - flags |= (bfd_get_section_flags (sec->owner, sec) + flags |= (bfd_section_flags (sec) & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES)); prop_sec = bfd_make_section_anyway_with_flags diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 490860123c9..84ec83b74af 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -1168,9 +1168,8 @@ elf64_alpha_section_from_shdr (bfd *abfd, if (hdr->sh_type == SHT_ALPHA_DEBUG) { - if (! bfd_set_section_flags (abfd, newsect, - (bfd_get_section_flags (abfd, newsect) - | SEC_DEBUGGING))) + if (!bfd_set_section_flags (newsect, + bfd_section_flags (newsect) | SEC_DEBUGGING)) return FALSE; } @@ -1196,7 +1195,7 @@ elf64_alpha_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) { register const char *name; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); if (strcmp (name, ".mdebug") == 0) { @@ -1270,7 +1269,7 @@ elf64_alpha_create_got_section (bfd *abfd, | SEC_LINKER_CREATED); s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, 3)) + || !bfd_set_section_alignment (s, 3)) return FALSE; alpha_elf_tdata (abfd)->got = s; @@ -1302,7 +1301,7 @@ elf64_alpha_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) | (elf64_alpha_use_secureplt ? SEC_READONLY : 0)); s = bfd_make_section_anyway_with_flags (abfd, ".plt", flags); elf_hash_table (info)->splt = s; - if (s == NULL || ! bfd_set_section_alignment (abfd, s, 4)) + if (s == NULL || ! bfd_set_section_alignment (s, 4)) return FALSE; /* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the @@ -1317,7 +1316,7 @@ elf64_alpha_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) | SEC_LINKER_CREATED | SEC_READONLY); s = bfd_make_section_anyway_with_flags (abfd, ".rela.plt", flags); elf_hash_table (info)->srelplt = s; - if (s == NULL || ! bfd_set_section_alignment (abfd, s, 3)) + if (s == NULL || ! bfd_set_section_alignment (s, 3)) return FALSE; if (elf64_alpha_use_secureplt) @@ -1325,7 +1324,7 @@ elf64_alpha_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) flags = SEC_ALLOC | SEC_LINKER_CREATED; s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags); elf_hash_table (info)->sgotplt = s; - if (s == NULL || ! bfd_set_section_alignment (abfd, s, 3)) + if (s == NULL || ! bfd_set_section_alignment (s, 3)) return FALSE; } @@ -1343,7 +1342,7 @@ elf64_alpha_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rela.got", flags); elf_hash_table (info)->srelgot = s; if (s == NULL - || !bfd_set_section_alignment (abfd, s, 3)) + || !bfd_set_section_alignment (s, 3)) return FALSE; /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the @@ -1616,7 +1615,7 @@ elf64_alpha_output_extsym (struct alpha_elf_link_hash_entry *h, void * data) h->esym.asym.sc = scUndefined; else { - name = bfd_section_name (output_section->owner, output_section); + name = bfd_section_name (output_section); if (strcmp (name, ".text") == 0) h->esym.asym.sc = scText; @@ -2860,7 +2859,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if (CONST_STRNEQ (name, ".rela")) { @@ -4508,7 +4507,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (name == NULL) name = _("<unknown>"); else if (name[0] == 0) - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } _bfd_error_handler /* xgettext:c-format */ @@ -4779,7 +4778,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } (*info->callbacks->reloc_overflow) (info, (h ? &h->root.root : NULL), name, howto->name, diff --git a/bfd/elf64-bpf.c b/bfd/elf64-bpf.c index 3e11f089ecb..67c45a1fa44 100644 --- a/bfd/elf64-bpf.c +++ b/bfd/elf64-bpf.c @@ -407,7 +407,7 @@ bpf_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, name = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - name = (name == NULL) ? bfd_section_name (input_bfd, sec) : name; + name = name == NULL ? bfd_section_name (sec) : name; } else { diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 77811580c67..25e91d8a233 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -422,7 +422,7 @@ get_reloc_section (bfd *abfd, | SEC_LINKER_CREATED | SEC_READONLY)); if (srel == NULL - || !bfd_set_section_alignment (dynobj, srel, 3)) + || !bfd_set_section_alignment (srel, 3)) return FALSE; } @@ -1159,7 +1159,7 @@ get_opd (bfd *abfd, | SEC_IN_MEMORY | SEC_LINKER_CREATED)); if (!opd - || !bfd_set_section_alignment (abfd, opd, 3)) + || !bfd_set_section_alignment (opd, 3)) { BFD_ASSERT (0); return FALSE; @@ -1195,7 +1195,7 @@ get_plt (bfd *abfd, | SEC_IN_MEMORY | SEC_LINKER_CREATED)); if (!plt - || !bfd_set_section_alignment (abfd, plt, 3)) + || !bfd_set_section_alignment (plt, 3)) { BFD_ASSERT (0); return FALSE; @@ -1231,7 +1231,7 @@ get_dlt (bfd *abfd, | SEC_IN_MEMORY | SEC_LINKER_CREATED)); if (!dlt - || !bfd_set_section_alignment (abfd, dlt, 3)) + || !bfd_set_section_alignment (dlt, 3)) { BFD_ASSERT (0); return FALSE; @@ -1267,7 +1267,7 @@ get_stub (bfd *abfd, | SEC_READONLY | SEC_LINKER_CREATED)); if (!stub - || !bfd_set_section_alignment (abfd, stub, 3)) + || !bfd_set_section_alignment (stub, 3)) { BFD_ASSERT (0); return FALSE; @@ -1347,7 +1347,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd, | SEC_READONLY | SEC_LINKER_CREATED)); if (s == NULL - || !bfd_set_section_alignment (abfd, s, 3)) + || !bfd_set_section_alignment (s, 3)) return FALSE; hppa_info->dlt_rel_sec = s; @@ -1358,7 +1358,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd, | SEC_READONLY | SEC_LINKER_CREATED)); if (s == NULL - || !bfd_set_section_alignment (abfd, s, 3)) + || !bfd_set_section_alignment (s, 3)) return FALSE; hppa_info->plt_rel_sec = s; @@ -1369,7 +1369,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd, | SEC_READONLY | SEC_LINKER_CREATED)); if (s == NULL - || !bfd_set_section_alignment (abfd, s, 3)) + || !bfd_set_section_alignment (s, 3)) return FALSE; hppa_info->other_rel_sec = s; @@ -1380,7 +1380,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd, | SEC_READONLY | SEC_LINKER_CREATED)); if (s == NULL - || !bfd_set_section_alignment (abfd, s, 3)) + || !bfd_set_section_alignment (s, 3)) return FALSE; hppa_info->opd_rel_sec = s; @@ -1750,7 +1750,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, sec); + name = bfd_section_name (sec); if (strcmp (name, ".plt") == 0) { @@ -1783,8 +1783,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) entry. The entries in the .rela.plt section really apply to the .got section, which we created ourselves and so know is not readonly. */ - outname = bfd_get_section_name (output_bfd, - sec->output_section); + outname = bfd_section_name (sec->output_section); target = bfd_get_section_by_name (output_bfd, outname + 4); if (target != NULL && (target->flags & SEC_READONLY) != 0 @@ -3938,7 +3937,7 @@ elf64_hppa_relocate_section (bfd *output_bfd, if (sym_name == NULL) return FALSE; if (*sym_name == '\0') - sym_name = bfd_section_name (input_bfd, sym_sec); + sym_name = bfd_section_name (sym_sec); } (*info->callbacks->reloc_overflow) diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index 0ae9f353f48..aa2aa119f5e 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -840,7 +840,7 @@ elf64_ia64_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, { const char *name; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); if (is_unwind_section_name (abfd, name)) { @@ -1286,12 +1286,12 @@ elf64_ia64_create_dynamic_sections (bfd *abfd, s = bfd_make_section_anyway_with_flags (abfd, ".dynamic", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; s = bfd_make_section_anyway_with_flags (abfd, ".plt", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; ia64_info->root.splt = s; @@ -1307,7 +1307,7 @@ elf64_ia64_create_dynamic_sections (bfd *abfd, | SEC_IN_MEMORY | SEC_LINKER_CREATED)); if (s == NULL - || !bfd_set_section_alignment (abfd, s, 0)) + || !bfd_set_section_alignment (s, 0)) return FALSE; /* Create a fixup section. */ @@ -1317,7 +1317,7 @@ elf64_ia64_create_dynamic_sections (bfd *abfd, | SEC_IN_MEMORY | SEC_LINKER_CREATED)); if (s == NULL - || !bfd_set_section_alignment (abfd, s, 3)) + || !bfd_set_section_alignment (s, 3)) return FALSE; ia64_info->fixups_sec = s; @@ -1328,7 +1328,7 @@ elf64_ia64_create_dynamic_sections (bfd *abfd, | SEC_IN_MEMORY | SEC_LINKER_CREATED)); if (s == NULL - || !bfd_set_section_alignment (abfd, s, 3)) + || !bfd_set_section_alignment (s, 3)) return FALSE; s->size = sizeof (struct elf64_vms_transfer); ia64_info->transfer_sec = s; @@ -1340,7 +1340,7 @@ elf64_ia64_create_dynamic_sections (bfd *abfd, | SEC_IN_MEMORY | SEC_READONLY)); if (s == NULL - || !bfd_set_section_alignment (abfd, s, 3)) + || !bfd_set_section_alignment (s, 3)) return FALSE; ia64_info->note_sec = s; @@ -1738,7 +1738,7 @@ get_got (bfd *abfd, struct elf64_ia64_link_hash_table *ia64_info) got = bfd_make_section_anyway_with_flags (dynobj, ".got", flags | SEC_SMALL_DATA); if (got == NULL - || !bfd_set_section_alignment (dynobj, got, 3)) + || !bfd_set_section_alignment (got, 3)) return NULL; ia64_info->root.sgot = got; } @@ -1774,7 +1774,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info, : SEC_READONLY) | SEC_LINKER_CREATED)); if (!fptr - || !bfd_set_section_alignment (dynobj, fptr, 4)) + || !bfd_set_section_alignment (fptr, 4)) { BFD_ASSERT (0); return NULL; @@ -1792,7 +1792,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info, | SEC_LINKER_CREATED | SEC_READONLY)); if (fptr_rel == NULL - || !bfd_set_section_alignment (dynobj, fptr_rel, 3)) + || !bfd_set_section_alignment (fptr_rel, 3)) { BFD_ASSERT (0); return NULL; @@ -1827,7 +1827,7 @@ get_pltoff (bfd *abfd, struct elf64_ia64_link_hash_table *ia64_info) | SEC_SMALL_DATA | SEC_LINKER_CREATED)); if (!pltoff - || !bfd_set_section_alignment (dynobj, pltoff, 4)) + || !bfd_set_section_alignment (pltoff, 4)) { BFD_ASSERT (0); return NULL; @@ -1855,11 +1855,9 @@ get_reloc_section (bfd *abfd, return NULL; BFD_ASSERT ((CONST_STRNEQ (srel_name, ".rela") - && strcmp (bfd_get_section_name (abfd, sec), - srel_name+5) == 0) + && strcmp (bfd_section_name (sec), srel_name+5) == 0) || (CONST_STRNEQ (srel_name, ".rel") - && strcmp (bfd_get_section_name (abfd, sec), - srel_name+4) == 0)); + && strcmp (bfd_section_name (sec), srel_name+4) == 0)); dynobj = ia64_info->root.dynobj; if (!dynobj) @@ -1875,7 +1873,7 @@ get_reloc_section (bfd *abfd, | SEC_LINKER_CREATED | SEC_READONLY)); if (srel == NULL - || !bfd_set_section_alignment (dynobj, srel, 3)) + || !bfd_set_section_alignment (srel, 3)) return NULL; } @@ -2750,7 +2748,7 @@ elf64_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, sec); + name = bfd_section_name (sec); if (strcmp (name, ".got.plt") == 0) strip = FALSE; @@ -4501,8 +4499,8 @@ elf64_vms_section_from_shdr (bfd *abfd, { asection *newsect = hdr->bfd_section; - if (! bfd_set_section_flags - (abfd, newsect, bfd_get_section_flags (abfd, newsect) | secflags)) + if (!bfd_set_section_flags (newsect, + bfd_section_flags (newsect) | secflags)) return FALSE; } @@ -4629,7 +4627,7 @@ elf64_vms_section_processing (bfd *abfd ATTRIBUTE_UNUSED, { if (hdr->bfd_section != NULL) { - const char *name = bfd_get_section_name (abfd, hdr->bfd_section); + const char *name = bfd_section_name (hdr->bfd_section); if (strcmp (name, ".text") == 0) hdr->sh_flags |= SHF_IA_64_VMS_SHARED; @@ -4670,7 +4668,7 @@ elf64_vms_final_write_processing (bfd *abfd) { hdr = &elf_section_data (s)->this_hdr; - if (strcmp (bfd_get_section_name (abfd, hdr->bfd_section), + if (strcmp (bfd_section_name (hdr->bfd_section), ".IA_64.unwind_info") == 0) unwind_info_sect_idx = elf_section_data (s)->this_idx; diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 18ed456c2bf..69d57a2ce96 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -1414,7 +1414,7 @@ mmix_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, symtab_hdr->sh_link, sym->st_name); if (name == NULL) - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } else { @@ -1606,9 +1606,9 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section, return bfd_reloc_undefined; /* Check that we're not relocating against a register symbol. */ - if (strcmp (bfd_get_section_name (symsec->owner, symsec), + if (strcmp (bfd_section_name (symsec), MMIX_REG_CONTENTS_SECTION_NAME) == 0 - || strcmp (bfd_get_section_name (symsec->owner, symsec), + || strcmp (bfd_section_name (symsec), MMIX_REG_SECTION_NAME) == 0) { /* Note: This is separated out into two messages in order @@ -1641,7 +1641,7 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section, if (symsec == NULL) return bfd_reloc_undefined; - if (strcmp (bfd_get_section_name (symsec->owner, symsec), + if (strcmp (bfd_section_name (symsec), MMIX_REG_CONTENTS_SECTION_NAME) == 0) { if ((srel & 7) != 0 || srel < 32*8 || srel > 255*8) @@ -1652,7 +1652,7 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section, } srel /= 8; } - else if (strcmp (bfd_get_section_name (symsec->owner, symsec), + else if (strcmp (bfd_section_name (symsec), MMIX_REG_SECTION_NAME) == 0) { if (srel < 0 || srel > 255) @@ -1704,9 +1704,9 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section, accidentally handling it. */ if (!bfd_is_abs_section (symsec) && !bfd_is_und_section (symsec) - && strcmp (bfd_get_section_name (symsec->owner, symsec), + && strcmp (bfd_section_name (symsec), MMIX_REG_CONTENTS_SECTION_NAME) != 0 - && strcmp (bfd_get_section_name (symsec->owner, symsec), + && strcmp (bfd_section_name (symsec), MMIX_REG_SECTION_NAME) != 0) { _bfd_error_handler @@ -1722,10 +1722,8 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section, first_global = 255; else { - first_global - = bfd_get_section_vma (input_section->output_section->owner, - regsec) / 8; - if (strcmp (bfd_get_section_name (symsec->owner, symsec), + first_global = bfd_section_vma (regsec) / 8; + if (strcmp (bfd_section_name (symsec), MMIX_REG_CONTENTS_SECTION_NAME) == 0) { if ((srel & 7) != 0 || srel < 32*8 || srel > 255*8) @@ -1876,9 +1874,7 @@ mmix_elf_check_common_relocs (bfd *abfd, those flags, as that is what currently happens for usual GREG allocations, and that works. */ if (allocated_gregs_section == NULL - || !bfd_set_section_alignment (bpo_greg_owner, - allocated_gregs_section, - 3)) + || !bfd_set_section_alignment (allocated_gregs_section, 3)) return FALSE; gregdata = (struct bpo_greg_section_info *) @@ -2123,7 +2119,7 @@ mmix_elf_section_from_bfd_section (bfd * abfd ATTRIBUTE_UNUSED, asection * sec, int * retval) { - if (strcmp (bfd_get_section_name (abfd, sec), MMIX_REG_SECTION_NAME) == 0) + if (strcmp (bfd_section_name (sec), MMIX_REG_SECTION_NAME) == 0) *retval = SHN_REGISTER; else return FALSE; @@ -2222,7 +2218,7 @@ mmix_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (reg_section != NULL) { /* FIXME: Pass error state gracefully. */ - if (bfd_get_section_flags (abfd, reg_section) & SEC_HAS_CONTENTS) + if (bfd_section_flags (reg_section) & SEC_HAS_CONTENTS) _bfd_abort (__FILE__, __LINE__, _("register section has contents\n")); /* Really remove the section, if it hasn't already been done. */ @@ -2330,7 +2326,7 @@ _bfd_mmix_before_linker_allocation (bfd *abfd ATTRIBUTE_UNUSED, /* Set the zeroth-order estimate for the GREGs size. */ gregs_size = n_gregs * 8; - if (!bfd_set_section_size (bpo_greg_owner, bpo_gregs_section, gregs_size)) + if (!bfd_set_section_size (bpo_gregs_section, gregs_size)) return FALSE; /* Allocate and set up the GREG arrays. They're filled in at relaxation diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 345710ee594..14119dd259a 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -3487,7 +3487,7 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) htab->sfpr = bfd_make_section_anyway_with_flags (dynobj, ".sfpr", flags); if (htab->sfpr == NULL - || !bfd_set_section_alignment (dynobj, htab->sfpr, 2)) + || !bfd_set_section_alignment (htab->sfpr, 2)) return FALSE; } @@ -3498,7 +3498,7 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) htab->glink = bfd_make_section_anyway_with_flags (dynobj, ".glink", flags); if (htab->glink == NULL - || !bfd_set_section_alignment (dynobj, htab->glink, 3)) + || !bfd_set_section_alignment (htab->glink, 3)) return FALSE; /* The part of .glink used by global entry stubs, separate so that @@ -3506,7 +3506,7 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) htab->global_entry = bfd_make_section_anyway_with_flags (dynobj, ".glink", flags); if (htab->global_entry == NULL - || !bfd_set_section_alignment (dynobj, htab->global_entry, 2)) + || !bfd_set_section_alignment (htab->global_entry, 2)) return FALSE; if (!info->no_ld_generated_unwind_info) @@ -3517,14 +3517,14 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) ".eh_frame", flags); if (htab->glink_eh_frame == NULL - || !bfd_set_section_alignment (dynobj, htab->glink_eh_frame, 2)) + || !bfd_set_section_alignment (htab->glink_eh_frame, 2)) return FALSE; } flags = SEC_ALLOC | SEC_LINKER_CREATED; htab->elf.iplt = bfd_make_section_anyway_with_flags (dynobj, ".iplt", flags); if (htab->elf.iplt == NULL - || !bfd_set_section_alignment (dynobj, htab->elf.iplt, 3)) + || !bfd_set_section_alignment (htab->elf.iplt, 3)) return FALSE; flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY @@ -3532,7 +3532,7 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) htab->elf.irelplt = bfd_make_section_anyway_with_flags (dynobj, ".rela.iplt", flags); if (htab->elf.irelplt == NULL - || !bfd_set_section_alignment (dynobj, htab->elf.irelplt, 3)) + || !bfd_set_section_alignment (htab->elf.irelplt, 3)) return FALSE; /* Create branch lookup table for plt_branch stubs. */ @@ -3541,7 +3541,7 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) htab->brlt = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt", flags); if (htab->brlt == NULL - || !bfd_set_section_alignment (dynobj, htab->brlt, 3)) + || !bfd_set_section_alignment (htab->brlt, 3)) return FALSE; /* Local plt entries, put in .branch_lt but a separate section for @@ -3549,7 +3549,7 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) htab->pltlocal = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt", flags); if (htab->pltlocal == NULL - || !bfd_set_section_alignment (dynobj, htab->pltlocal, 3)) + || !bfd_set_section_alignment (htab->pltlocal, 3)) return FALSE; if (!bfd_link_pic (info)) @@ -3560,13 +3560,13 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info) htab->relbrlt = bfd_make_section_anyway_with_flags (dynobj, ".rela.branch_lt", flags); if (htab->relbrlt == NULL - || !bfd_set_section_alignment (dynobj, htab->relbrlt, 3)) + || !bfd_set_section_alignment (htab->relbrlt, 3)) return FALSE; htab->relpltlocal = bfd_make_section_anyway_with_flags (dynobj, ".rela.branch_lt", flags); if (htab->relpltlocal == NULL - || !bfd_set_section_alignment (dynobj, htab->relpltlocal, 3)) + || !bfd_set_section_alignment (htab->relpltlocal, 3)) return FALSE; return TRUE; @@ -3762,13 +3762,13 @@ create_got_section (bfd *abfd, struct bfd_link_info *info) got = bfd_make_section_anyway_with_flags (abfd, ".got", flags); if (!got - || !bfd_set_section_alignment (abfd, got, 3)) + || !bfd_set_section_alignment (got, 3)) return FALSE; relgot = bfd_make_section_anyway_with_flags (abfd, ".rela.got", flags | SEC_READONLY); if (!relgot - || !bfd_set_section_alignment (abfd, relgot, 3)) + || !bfd_set_section_alignment (relgot, 3)) return FALSE; ppc64_elf_tdata (abfd)->got = got; diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 6bc6dfd50eb..4ffcde92e21 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -1957,7 +1957,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Strip this section if we don't need it; see the comment below. */ } - else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) + else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) { if (s->size != 0 && s != htab->elf.srelplt) relocs = TRUE; @@ -3203,7 +3203,7 @@ elf_s390_relocate_section (bfd *output_bfd, if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (r == bfd_reloc_overflow) diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 50b051aa6bf..8bf9623bd9f 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -748,7 +748,7 @@ elf64_sparc_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, { const char *name; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); if (strcmp (name, ".stab") == 0) { diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index e5c8003a68e..16e66f95d2c 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -3989,7 +3989,7 @@ check_relocation_error: if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (r == bfd_reloc_overflow) diff --git a/bfd/elflink.c b/bfd/elflink.c index 8f18be07db7..2169e2b40cb 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -162,13 +162,13 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) (bed->dynamic_sec_flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->srelgot = s; s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->sgot = s; @@ -176,8 +176,7 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) { s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->sgotplt = s; } @@ -286,25 +285,25 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version_d", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 1)) + || !bfd_set_section_alignment (s, 1)) return FALSE; s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version_r", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; s = bfd_make_section_anyway_with_flags (abfd, ".dynsym", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; elf_hash_table (info)->dynsym = s; @@ -315,7 +314,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".dynamic", flags); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; /* The special symbol _DYNAMIC is always set to the start of the @@ -334,7 +333,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".hash", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry; } @@ -344,7 +343,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".gnu.hash", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; /* For 64-bit ELF, .gnu.hash is a non-uniform entity size section: 4 32-bit words followed by variable count of 64-bit words, then @@ -395,7 +394,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; htab->splt = s; @@ -415,7 +414,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) ? ".rela.plt" : ".rel.plt"), flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->srelplt = s; @@ -466,7 +465,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) ? ".rela.bss" : ".rel.bss"), flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->srelbss = s; @@ -477,8 +476,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) ? ".rela.data.rel.ro" : ".rel.data.rel.ro"), flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->sreldynrelro = s; } @@ -3099,7 +3097,7 @@ _bfd_elf_adjust_dynamic_copy (struct bfd_link_info *info, know the symbol alignment requirement, we start with the maximum alignment and check low bits of the symbol address for the minimum alignment. */ - power_of_two = bfd_get_section_alignment (sec->owner, sec); + power_of_two = bfd_section_alignment (sec); mask = ((bfd_vma) 1 << power_of_two) - 1; while ((h->root.u.def.value & mask) != 0) { @@ -3107,12 +3105,10 @@ _bfd_elf_adjust_dynamic_copy (struct bfd_link_info *info, --power_of_two; } - if (power_of_two > bfd_get_section_alignment (dynbss->owner, - dynbss)) + if (power_of_two > bfd_section_alignment (dynbss)) { /* Adjust the section alignment if needed. */ - if (! bfd_set_section_alignment (dynbss->owner, dynbss, - power_of_two)) + if (!bfd_set_section_alignment (dynbss, power_of_two)) return FALSE; } @@ -3949,7 +3945,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { const char *name; - name = bfd_get_section_name (abfd, s); + name = bfd_section_name (s); if (CONST_STRNEQ (name, ".gnu.warning.")) { char *msg; @@ -11393,8 +11389,7 @@ elf_reloc_link_order (bfd *output_bfd, case bfd_reloc_overflow: if (link_order->type == bfd_section_reloc_link_order) - sym_name = bfd_section_name (output_bfd, - link_order->u.reloc.p->u.section); + sym_name = bfd_section_name (link_order->u.reloc.p->u.section); else sym_name = link_order->u.reloc.p->u.name; (*info->callbacks->reloc_overflow) (info, NULL, sym_name, @@ -11837,7 +11832,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) } attr_size = bfd_elf_obj_attr_size (abfd); - bfd_set_section_size (abfd, o, attr_size); + bfd_set_section_size (o, attr_size); /* Skip this section later on. */ o->map_head.link_order = NULL; if (attr_size) @@ -13588,7 +13583,7 @@ bfd_elf_parse_eh_frame_entries (bfd *abfd ATTRIBUTE_UNUSED, for (sec = ibfd->sections; sec; sec = sec->next) { - if (CONST_STRNEQ (bfd_section_name (ibfd, sec), ".eh_frame_entry") + if (CONST_STRNEQ (bfd_section_name (sec), ".eh_frame_entry") && init_reloc_cookie_rels (&cookie, info, ibfd, sec)) { _bfd_elf_parse_eh_frame_entry (info, sec, &cookie); @@ -14444,7 +14439,7 @@ get_dynamic_reloc_section_name (bfd * abfd, bfd_boolean is_rela) { char *name; - const char *old_name = bfd_get_section_name (NULL, sec); + const char *old_name = bfd_section_name (sec); const char *prefix = is_rela ? ".rela" : ".rel"; if (old_name == NULL) @@ -14527,7 +14522,7 @@ _bfd_elf_make_dynamic_reloc_section (asection *sec, section named "auto" we'll get ".relauto" which is seen to be a .rela section. */ elf_section_type (reloc_sec) = is_rela ? SHT_RELA : SHT_REL; - if (! bfd_set_section_alignment (dynobj, reloc_sec, alignment)) + if (!bfd_set_section_alignment (reloc_sec, alignment)) reloc_sec = NULL; } } diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c index 7132b6bc733..6f3bd0d5650 100644 --- a/bfd/elfnn-aarch64.c +++ b/bfd/elfnn-aarch64.c @@ -6790,7 +6790,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } if (r_symndx != 0 @@ -7273,7 +7273,7 @@ elfNN_aarch64_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) for (sec = ibfd->sections; sec != NULL; sec = sec->next) { - if ((bfd_get_section_flags (ibfd, sec) + if ((bfd_section_flags (sec) & (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) only_data_sections = FALSE; @@ -7519,13 +7519,13 @@ aarch64_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) (bed->dynamic_sec_flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->srelgot = s; s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->sgot = s; htab->sgot->size += GOT_ENTRY_SIZE; @@ -7547,8 +7547,7 @@ aarch64_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) { s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->sgotplt = s; } @@ -9150,7 +9149,7 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Strip this section if we don't need it; see the comment below. */ } - else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela")) + else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) { if (s->size != 0 && s != htab->root.srelplt) relocs = TRUE; diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index 65471dd4a49..da10178d4fe 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -956,7 +956,7 @@ elfNN_ia64_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, { const char *name; - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); if (is_unwind_section_name (abfd, name)) { @@ -1561,11 +1561,10 @@ elfNN_ia64_create_dynamic_sections (bfd *abfd, return FALSE; { - flagword flags = bfd_get_section_flags (abfd, ia64_info->root.sgot); - bfd_set_section_flags (abfd, ia64_info->root.sgot, - SEC_SMALL_DATA | flags); + flagword flags = bfd_section_flags (ia64_info->root.sgot); + bfd_set_section_flags (ia64_info->root.sgot, SEC_SMALL_DATA | flags); /* The .got section is always aligned at 8 bytes. */ - if (! bfd_set_section_alignment (abfd, ia64_info->root.sgot, 3)) + if (!bfd_set_section_alignment (ia64_info->root.sgot, 3)) return FALSE; } @@ -1579,7 +1578,7 @@ elfNN_ia64_create_dynamic_sections (bfd *abfd, | SEC_LINKER_CREATED | SEC_READONLY)); if (s == NULL - || !bfd_set_section_alignment (abfd, s, LOG_SECTION_ALIGN)) + || !bfd_set_section_alignment (s, LOG_SECTION_ALIGN)) return FALSE; ia64_info->rel_pltoff_sec = s; @@ -1977,11 +1976,11 @@ get_got (bfd *abfd, struct bfd_link_info *info, got = ia64_info->root.sgot; /* The .got section is always aligned at 8 bytes. */ - if (!bfd_set_section_alignment (abfd, got, 3)) + if (!bfd_set_section_alignment (got, 3)) return NULL; - flags = bfd_get_section_flags (abfd, got); - if (! bfd_set_section_flags (abfd, got, SEC_SMALL_DATA | flags)) + flags = bfd_section_flags (got); + if (!bfd_set_section_flags (got, SEC_SMALL_DATA | flags)) return NULL; } @@ -2016,7 +2015,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info, ? 0 : SEC_READONLY) | SEC_LINKER_CREATED)); if (!fptr - || !bfd_set_section_alignment (abfd, fptr, 4)) + || !bfd_set_section_alignment (fptr, 4)) { BFD_ASSERT (0); return NULL; @@ -2034,8 +2033,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info, | SEC_LINKER_CREATED | SEC_READONLY)); if (fptr_rel == NULL - || !bfd_set_section_alignment (abfd, fptr_rel, - LOG_SECTION_ALIGN)) + || !bfd_set_section_alignment (fptr_rel, LOG_SECTION_ALIGN)) { BFD_ASSERT (0); return NULL; @@ -2071,7 +2069,7 @@ get_pltoff (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED, | SEC_SMALL_DATA | SEC_LINKER_CREATED)); if (!pltoff - || !bfd_set_section_alignment (abfd, pltoff, 4)) + || !bfd_set_section_alignment (pltoff, 4)) { BFD_ASSERT (0); return NULL; @@ -2112,8 +2110,7 @@ get_reloc_section (bfd *abfd, | SEC_LINKER_CREATED | SEC_READONLY)); if (srel == NULL - || !bfd_set_section_alignment (dynobj, srel, - LOG_SECTION_ALIGN)) + || !bfd_set_section_alignment (srel, LOG_SECTION_ALIGN)) return NULL; } @@ -3171,7 +3168,7 @@ elfNN_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, sec); + name = bfd_section_name (sec); if (strcmp (name, ".got.plt") == 0) strip = FALSE; diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 1d04ae9b7ef..ccf904af1bc 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -310,13 +310,13 @@ riscv_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) (bed->dynamic_sec_flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->srelgot = s; s = s_got = bfd_make_section_anyway_with_flags (abfd, ".got", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->sgot = s; @@ -327,8 +327,7 @@ riscv_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) { s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->sgotplt = s; @@ -1840,7 +1839,7 @@ riscv_elf_relocate_section (bfd *output_bfd, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } resolved_to_zero = (h != NULL @@ -3160,7 +3159,7 @@ _bfd_riscv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) for (sec = ibfd->sections; sec != NULL; sec = sec->next) { - if ((bfd_get_section_flags (ibfd, sec) + if ((bfd_section_flags (sec) & (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) only_data_sections = FALSE; diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c index 1f692807131..e7290aaab1d 100644 --- a/bfd/elfxx-aarch64.c +++ b/bfd/elfxx-aarch64.c @@ -758,11 +758,9 @@ _bfd_aarch64_elf_link_setup_gnu_properties (struct bfd_link_info *info, _("%F%P: failed to create GNU property section\n")); align = (bfd_get_mach (ebfd) & bfd_mach_aarch64_ilp32) ? 2 : 3; - if (!bfd_set_section_alignment (ebfd, sec, align)) - { - info->callbacks->einfo (_("%F%pA: failed to align section\n"), - sec); - } + if (!bfd_set_section_alignment (sec, align)) + info->callbacks->einfo (_("%F%pA: failed to align section\n"), + sec); elf_section_type (sec) = SHT_NOTE; } diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 8ad5268520b..496e42e7c5d 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -1726,7 +1726,7 @@ section_allows_mips16_refs_p (asection *section) { const char *name; - name = bfd_get_section_name (section->owner, section); + name = bfd_section_name (section); return (FN_STUB_P (name) || CALL_STUB_P (name) || CALL_FP_STUB_P (name) @@ -1937,7 +1937,7 @@ mips_elf_add_la25_intro (struct mips_elf_la25_stub *stub, /* Make sure that any padding goes before the stub. */ align = input_section->alignment_power; - if (!bfd_set_section_alignment (s->owner, s, align)) + if (!bfd_set_section_alignment (s, align)) return FALSE; if (align > 3) s->size = (1 << align) - 8; @@ -1974,7 +1974,7 @@ mips_elf_add_la25_trampoline (struct mips_elf_la25_stub *stub, asection *input_section = stub->h->root.root.u.def.section; s = htab->add_stub_section (".text", NULL, input_section->output_section); - if (s == NULL || !bfd_set_section_alignment (s->owner, s, 4)) + if (s == NULL || !bfd_set_section_alignment (s, 4)) return FALSE; htab->strampoline = s; } @@ -2992,7 +2992,7 @@ mips_elf_output_extsym (struct mips_elf_link_hash_entry *h, void *data) h->esym.asym.sc = scUndefined; else { - name = bfd_section_name (output_section->owner, output_section); + name = bfd_section_name (output_section); if (strcmp (name, ".text") == 0) h->esym.asym.sc = scText; @@ -3265,8 +3265,8 @@ mips_elf_rel_dyn_section (struct bfd_link_info *info, bfd_boolean create_p) | SEC_LINKER_CREATED | SEC_READONLY)); if (sreloc == NULL - || ! bfd_set_section_alignment (dynobj, sreloc, - MIPS_ELF_LOG_FILE_ALIGN (dynobj))) + || !bfd_set_section_alignment (sreloc, + MIPS_ELF_LOG_FILE_ALIGN (dynobj))) return NULL; } return sreloc; @@ -5201,8 +5201,7 @@ mips_elf_create_compact_rel_section s = bfd_make_section_anyway_with_flags (abfd, ".compact_rel", flags); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) + || !bfd_set_section_alignment (s, MIPS_ELF_LOG_FILE_ALIGN (abfd))) return FALSE; s->size = sizeof (Elf32_External_compact_rel); @@ -5236,7 +5235,7 @@ mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) in the function stub generation and in the linker script. */ s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, 4)) + || !bfd_set_section_alignment (s, 4)) return FALSE; htab->root.sgot = s; @@ -5537,7 +5536,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, symtab_hdr->sh_link, sym->st_name); if (*namep == NULL || **namep == '\0') - *namep = bfd_section_name (input_bfd, sec); + *namep = bfd_section_name (sec); /* For relocations against a section symbol and ones against no symbol (absolute relocations) infer the ISA mode from the addend. */ @@ -5735,7 +5734,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd, sec = NULL; for (o = input_bfd->sections; o != NULL; o = o->next) { - if (CALL_FP_STUB_P (bfd_get_section_name (input_bfd, o))) + if (CALL_FP_STUB_P (bfd_section_name (o))) { sec = h->call_fp_stub; break; @@ -7385,7 +7384,7 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr) if (hdr->bfd_section != NULL) { - const char *name = bfd_get_section_name (abfd, hdr->bfd_section); + const char *name = bfd_section_name (hdr->bfd_section); /* .sbss is not handled specially here because the GNU/Linux prelinker can convert .sbss from NOBITS to PROGBITS and @@ -7514,10 +7513,9 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, if (flags) { - if (! bfd_set_section_flags (abfd, hdr->bfd_section, - (bfd_get_section_flags (abfd, - hdr->bfd_section) - | flags))) + if (!bfd_set_section_flags (hdr->bfd_section, + (bfd_section_flags (hdr->bfd_section) + | flags))) return FALSE; } @@ -7624,7 +7622,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd, bfd_boolean _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) { - const char *name = bfd_get_section_name (abfd, sec); + const char *name = bfd_section_name (sec); if (strcmp (name, ".liblist") == 0) { @@ -7764,12 +7762,12 @@ bfd_boolean _bfd_mips_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, int *retval) { - if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) + if (strcmp (bfd_section_name (sec), ".scommon") == 0) { *retval = SHN_MIPS_SCOMMON; return TRUE; } - if (strcmp (bfd_get_section_name (abfd, sec), ".acommon") == 0) + if (strcmp (bfd_section_name (sec), ".acommon") == 0) { *retval = SHN_MIPS_ACOMMON; return TRUE; @@ -7996,7 +7994,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_get_linker_section (abfd, ".dynamic"); if (s != NULL) { - if (! bfd_set_section_flags (abfd, s, flags)) + if (!bfd_set_section_flags (s, flags)) return FALSE; } } @@ -8013,8 +8011,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) MIPS_ELF_STUB_SECTION_NAME (abfd), flags | SEC_CODE); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) + || !bfd_set_section_alignment (s, MIPS_ELF_LOG_FILE_ALIGN (abfd))) return FALSE; htab->sstubs = s; @@ -8025,8 +8022,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_anyway_with_flags (abfd, ".rld_map", flags &~ (flagword) SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, - MIPS_ELF_LOG_FILE_ALIGN (abfd))) + || !bfd_set_section_alignment (s, MIPS_ELF_LOG_FILE_ALIGN (abfd))) return FALSE; } @@ -8069,24 +8065,24 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) /* Change alignments of some sections. */ s = bfd_get_linker_section (abfd, ".hash"); if (s != NULL) - (void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); + bfd_set_section_alignment (s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); s = bfd_get_linker_section (abfd, ".dynsym"); if (s != NULL) - (void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); + bfd_set_section_alignment (s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); s = bfd_get_linker_section (abfd, ".dynstr"); if (s != NULL) - (void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); + bfd_set_section_alignment (s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); /* ??? */ s = bfd_get_section_by_name (abfd, ".reginfo"); if (s != NULL) - (void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); + bfd_set_section_alignment (s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); s = bfd_get_linker_section (abfd, ".dynamic"); if (s != NULL) - (void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); + bfd_set_section_alignment (s, MIPS_ELF_LOG_FILE_ALIGN (abfd)); } if (bfd_link_executable (info)) @@ -8378,7 +8374,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, /* Check for the mips16 stub sections. */ - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); if (FN_STUB_P (name)) { unsigned long r_symndx; @@ -9375,12 +9371,12 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info, Encourage better cache usage by aligning. We do this lazily to avoid pessimizing traditional objects. */ if (!htab->is_vxworks - && !bfd_set_section_alignment (dynobj, htab->root.splt, 5)) + && !bfd_set_section_alignment (htab->root.splt, 5)) return FALSE; /* Make sure that .got.plt is word-aligned. We do this lazily for the same reason as above. */ - if (!bfd_set_section_alignment (dynobj, htab->root.sgotplt, + if (!bfd_set_section_alignment (htab->root.sgotplt, MIPS_ELF_LOG_FILE_ALIGN (dynobj))) return FALSE; @@ -9588,7 +9584,7 @@ _bfd_mips_elf_always_size_sections (bfd *output_bfd, sect = bfd_get_section_by_name (output_bfd, ".reginfo"); if (sect != NULL) { - bfd_set_section_size (output_bfd, sect, sizeof (Elf32_External_RegInfo)); + bfd_set_section_size (sect, sizeof (Elf32_External_RegInfo)); sect->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; } @@ -9596,8 +9592,7 @@ _bfd_mips_elf_always_size_sections (bfd *output_bfd, sect = bfd_get_section_by_name (output_bfd, ".MIPS.abiflags"); if (sect != NULL) { - bfd_set_section_size (output_bfd, sect, - sizeof (Elf_External_ABIFlags_v0)); + bfd_set_section_size (sect, sizeof (Elf_External_ABIFlags_v0)); sect->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; } @@ -10030,7 +10025,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, /* It's OK to base decisions on the section name, because none of the dynobj section names depend upon the input files. */ - name = bfd_get_section_name (dynobj, s); + name = bfd_section_name (s); if ((s->flags & SEC_LINKER_CREATED) == 0) continue; @@ -10048,8 +10043,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, assert a DT_TEXTREL entry rather than testing whether there exists a relocation to a read only section or not. */ - outname = bfd_get_section_name (output_bfd, - s->output_section); + outname = bfd_section_name (s->output_section); target = bfd_get_section_by_name (output_bfd, outname + 4); if ((target != NULL && (target->flags & SEC_READONLY) != 0 @@ -12445,7 +12439,7 @@ _bfd_mips_final_write_processing (bfd *abfd) case SHT_MIPS_GPTAB: BFD_ASSERT ((*hdrpp)->bfd_section != NULL); - name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); + name = bfd_section_name ((*hdrpp)->bfd_section); BFD_ASSERT (name != NULL && CONST_STRNEQ (name, ".gptab.")); sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1); @@ -12455,7 +12449,7 @@ _bfd_mips_final_write_processing (bfd *abfd) case SHT_MIPS_CONTENT: BFD_ASSERT ((*hdrpp)->bfd_section != NULL); - name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); + name = bfd_section_name ((*hdrpp)->bfd_section); BFD_ASSERT (name != NULL && CONST_STRNEQ (name, ".MIPS.content")); sec = bfd_get_section_by_name (abfd, @@ -12475,7 +12469,7 @@ _bfd_mips_final_write_processing (bfd *abfd) case SHT_MIPS_EVENTS: BFD_ASSERT ((*hdrpp)->bfd_section != NULL); - name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section); + name = bfd_section_name ((*hdrpp)->bfd_section); BFD_ASSERT (name != NULL); if (CONST_STRNEQ (name, ".MIPS.events")) sec = bfd_get_section_by_name (abfd, @@ -12861,8 +12855,7 @@ _bfd_mips_elf_gc_mark_extra_sections (struct bfd_link_info *info, for (o = sub->sections; o != NULL; o = o->next) if (!o->gc_mark - && MIPS_ELF_ABIFLAGS_SECTION_NAME_P - (bfd_get_section_name (sub, o))) + && MIPS_ELF_ABIFLAGS_SECTION_NAME_P (bfd_section_name (o))) { if (!_bfd_elf_gc_mark (info, o, gc_mark_hook)) return FALSE; @@ -15024,7 +15017,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info) ".rtproc", flags); if (rtproc_sec == NULL - || ! bfd_set_section_alignment (abfd, rtproc_sec, 4)) + || !bfd_set_section_alignment (rtproc_sec, 4)) return FALSE; } diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c index e479884071d..735e83f3de5 100644 --- a/bfd/elfxx-sparc.c +++ b/bfd/elfxx-sparc.c @@ -1263,15 +1263,14 @@ create_ifunc_sections (bfd *abfd, struct bfd_link_info *info) s = bfd_make_section_with_flags (abfd, ".iplt", pltflags); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) + || !bfd_set_section_alignment (s, bed->plt_alignment)) return FALSE; htab->iplt = s; s = bfd_make_section_with_flags (abfd, ".rela.iplt", flags | SEC_READONLY); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->irelplt = s; @@ -4164,8 +4163,7 @@ do_relocation: || r_type == R_SPARC_UA32 || r_type == R_SPARC_DISP32) && (((input_section->flags & SEC_DEBUGGING) != 0 - && strcmp (bfd_section_name (input_bfd, - input_section), + && strcmp (bfd_section_name (input_section), ".stab") == 0) || _bfd_elf_section_offset (output_bfd, info, input_section, @@ -4194,7 +4192,7 @@ do_relocation: if (name == NULL) return FALSE; if (*name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } (*info->callbacks->reloc_overflow) (info, (h ? &h->root : NULL), name, howto->name, diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index 2149fbcd226..41af167e1e1 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -1438,13 +1438,13 @@ tilegx_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) (bed->dynamic_sec_flags | SEC_READONLY)); if (s == NULL - || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->srelgot = s; s = s_got = bfd_make_section_anyway_with_flags (abfd, ".got", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->sgot = s; @@ -1455,8 +1455,7 @@ tilegx_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) { s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags); if (s == NULL - || !bfd_set_section_alignment (abfd, s, - bed->s->log_file_align)) + || !bfd_set_section_alignment (s, bed->s->log_file_align)) return FALSE; htab->sgotplt = s; @@ -3032,7 +3031,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, name = (bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name)); if (name == NULL || *name == '\0') - name = bfd_section_name (input_bfd, sec); + name = bfd_section_name (sec); } switch (r_type) diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c index 634f911ca53..d8165d17528 100644 --- a/bfd/elfxx-x86.c +++ b/bfd/elfxx-x86.c @@ -1238,7 +1238,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, { /* Strip these too. */ } - else if (htab->is_reloc_section (bfd_get_section_name (dynobj, s))) + else if (htab->is_reloc_section (bfd_section_name (s))) { if (s->size != 0 && s != htab->elf.srelplt @@ -1280,8 +1280,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd, it is empty. Update its section alignment now since it is non-empty. */ if (s == htab->elf.iplt) - bfd_set_section_alignment (s->owner, s, - htab->plt.iplt_alignment); + bfd_set_section_alignment (s, htab->plt.iplt_alignment); /* Allocate memory for the section contents. We use bfd_zalloc here in case unused entries are not reclaimed before the @@ -2625,7 +2624,7 @@ _bfd_x86_elf_link_setup_gnu_properties if (sec == NULL) info->callbacks->einfo (_("%F%P: failed to create GNU property section\n")); - if (!bfd_set_section_alignment (ebfd, sec, class_align)) + if (!bfd_set_section_alignment (sec, class_align)) { error_alignment: info->callbacks->einfo (_("%F%pA: failed to align section\n"), @@ -2839,11 +2838,11 @@ error_alignment: instead of in create_dynamic_sections so that they are always properly aligned even if create_dynamic_sections isn't called. */ sec = htab->elf.sgot; - if (!bfd_set_section_alignment (dynobj, sec, got_align)) + if (!bfd_set_section_alignment (sec, got_align)) goto error_alignment; sec = htab->elf.sgotplt; - if (!bfd_set_section_alignment (dynobj, sec, got_align)) + if (!bfd_set_section_alignment (sec, got_align)) goto error_alignment; /* Create the ifunc sections here so that check_relocs can be @@ -2881,8 +2880,7 @@ error_alignment: = bfd_log2 (htab->non_lazy_plt->plt_entry_size); sec = pltsec; - if (!bfd_set_section_alignment (sec->owner, sec, - plt_alignment)) + if (!bfd_set_section_alignment (sec, plt_alignment)) goto error_alignment; /* Create the GOT procedure linkage table. */ @@ -2892,8 +2890,7 @@ error_alignment: if (sec == NULL) info->callbacks->einfo (_("%F%P: failed to create GOT PLT section\n")); - if (!bfd_set_section_alignment (dynobj, sec, - non_lazy_plt_alignment)) + if (!bfd_set_section_alignment (sec, non_lazy_plt_alignment)) goto error_alignment; htab->plt_got = sec; @@ -2913,8 +2910,7 @@ error_alignment: if (sec == NULL) info->callbacks->einfo (_("%F%P: failed to create IBT-enabled PLT section\n")); - if (!bfd_set_section_alignment (dynobj, sec, - plt_alignment)) + if (!bfd_set_section_alignment (sec, plt_alignment)) goto error_alignment; } else if (htab->params->bndplt && ABI_64_P (dynobj)) @@ -2928,8 +2924,7 @@ error_alignment: if (sec == NULL) info->callbacks->einfo (_("%F%P: failed to create BND PLT section\n")); - if (!bfd_set_section_alignment (dynobj, sec, - non_lazy_plt_alignment)) + if (!bfd_set_section_alignment (sec, non_lazy_plt_alignment)) goto error_alignment; } @@ -2949,7 +2944,7 @@ error_alignment: if (sec == NULL) info->callbacks->einfo (_("%F%P: failed to create PLT .eh_frame section\n")); - if (!bfd_set_section_alignment (dynobj, sec, class_align)) + if (!bfd_set_section_alignment (sec, class_align)) goto error_alignment; htab->plt_eh_frame = sec; @@ -2962,7 +2957,7 @@ error_alignment: if (sec == NULL) info->callbacks->einfo (_("%F%P: failed to create GOT PLT .eh_frame section\n")); - if (!bfd_set_section_alignment (dynobj, sec, class_align)) + if (!bfd_set_section_alignment (sec, class_align)) goto error_alignment; htab->plt_got_eh_frame = sec; @@ -2976,7 +2971,7 @@ error_alignment: if (sec == NULL) info->callbacks->einfo (_("%F%P: failed to create the second PLT .eh_frame section\n")); - if (!bfd_set_section_alignment (dynobj, sec, class_align)) + if (!bfd_set_section_alignment (sec, class_align)) goto error_alignment; htab->plt_second_eh_frame = sec; @@ -2995,7 +2990,7 @@ error_alignment: section backwards, resulting in a warning and section lma not being set properly. It later leads to a "File truncated" error. */ - if (!bfd_set_section_alignment (sec->owner, sec, 0)) + if (!bfd_set_section_alignment (sec, 0)) goto error_alignment; htab->plt.iplt_alignment = (normal_target diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index 9c4ab4cecec..18f332f60d3 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -109,7 +109,7 @@ msdos_object_p (bfd *abfd) return NULL; } - bfd_set_section_size (abfd, section, size); + bfd_set_section_size (section, size); section->alignment_power = 4; return abfd->xvec; @@ -135,16 +135,16 @@ msdos_write_object_contents (bfd *abfd) { if (sec->size == 0) continue; - if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + if (bfd_section_flags (sec) & SEC_ALLOC) { - bfd_vma sec_vma = bfd_get_section_vma (abfd, sec) + sec->size; + bfd_vma sec_vma = bfd_section_vma (sec) + sec->size; if (sec_vma > high_vma) high_vma = sec_vma; } - if (bfd_get_section_flags (abfd, sec) & SEC_LOAD) + if (bfd_section_flags (sec) & SEC_LOAD) { file_ptr sec_end = (sizeof (hdr) - + bfd_get_section_vma (abfd, sec) + + bfd_section_vma (sec) + sec->size); if (sec_end > outfile_size) outfile_size = sec_end; @@ -195,9 +195,9 @@ msdos_set_section_contents (bfd *abfd, if (count == 0) return TRUE; - section->filepos = EXE_PAGE_SIZE + bfd_get_section_vma (abfd, section); + section->filepos = EXE_PAGE_SIZE + bfd_section_vma (section); - if (bfd_get_section_flags (abfd, section) & SEC_LOAD) + if (bfd_section_flags (section) & SEC_LOAD) { if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 || bfd_bwrite (location, count, abfd) != count) diff --git a/bfd/linker.c b/bfd/linker.c index 2518371f247..143b8eb950e 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -2396,7 +2396,7 @@ _bfd_generic_reloc_link_order (bfd *abfd, (*info->callbacks->reloc_overflow) (info, NULL, (link_order->type == bfd_section_reloc_link_order - ? bfd_section_name (abfd, link_order->u.reloc.p->u.section) + ? bfd_section_name (link_order->u.reloc.p->u.section) : link_order->u.reloc.p->u.name), r->howto->name, link_order->u.reloc.p->addend, NULL, NULL, 0); @@ -2942,7 +2942,7 @@ _bfd_generic_section_already_linked (bfd *abfd ATTRIBUTE_UNUSED, into a single large link once section, which defeats the purpose of having link once sections in the first place. */ - name = bfd_get_section_name (abfd, sec); + name = bfd_section_name (sec); already_linked_list = bfd_section_already_linked_table_lookup (name); diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 7d70087c95e..117e410d834 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -437,7 +437,7 @@ bfd_mach_o_convert_section_name_to_mach_o (bfd *abfd ATTRIBUTE_UNUSED, bfd_mach_o_section *section) { const mach_o_section_name_xlat *xlat; - const char *name = bfd_get_section_name (abfd, sect); + const char *name = bfd_section_name (sect); const char *segname; const char *dot; unsigned int len; @@ -2583,13 +2583,13 @@ bfd_mach_o_mangle_sections (bfd *abfd, bfd_mach_o_data_struct *mdata) target_index = 0; for (sec = abfd->sections; sec; sec = sec->next) { - unsigned bfd_align = bfd_get_section_alignment (abfd, sec); + unsigned bfd_align = bfd_section_alignment (sec); bfd_mach_o_section *msect = bfd_mach_o_get_mach_o_section (sec); mdata->sections[target_index] = msect; - msect->addr = bfd_get_section_vma (abfd, sec); - msect->size = bfd_get_section_size (sec); + msect->addr = bfd_section_vma (sec); + msect->size = bfd_section_size (sec); /* Use the largest alignment set, in case it was bumped after the section was created. */ @@ -2808,7 +2808,7 @@ bfd_mach_o_set_section_flags_from_bfd (bfd *abfd ATTRIBUTE_UNUSED, bfd_mach_o_section *s = bfd_mach_o_get_mach_o_section (sec); /* Create default flags. */ - bfd_flags = bfd_get_section_flags (abfd, sec); + bfd_flags = bfd_section_flags (sec); if ((bfd_flags & SEC_CODE) == SEC_CODE) s->flags = BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS | BFD_MACH_O_S_ATTR_SOME_INSTRUCTIONS @@ -2983,7 +2983,7 @@ bfd_mach_o_build_exec_seg_command (bfd *abfd, bfd_mach_o_segment_command *seg) for (s = seg->sect_head; s != NULL; s = s->next) { asection *sec = s->bfdsection; - flagword flags = bfd_get_section_flags (abfd, sec); + flagword flags = bfd_section_flags (sec); /* Adjust segment size. */ seg->vmsize = FILE_ALIGN (seg->vmsize, s->align); @@ -3502,7 +3502,7 @@ bfd_boolean bfd_mach_o_new_section_hook (bfd *abfd, asection *sec) { bfd_mach_o_section *s; - unsigned bfdalign = bfd_get_section_alignment (abfd, sec); + unsigned bfdalign = bfd_section_alignment (sec); s = bfd_mach_o_get_mach_o_section (sec); if (s == NULL) @@ -3526,10 +3526,10 @@ bfd_mach_o_new_section_hook (bfd *abfd, asection *sec) s->flags = xlat->macho_sectype | xlat->macho_secattr; s->align = xlat->sectalign > bfdalign ? xlat->sectalign : bfdalign; - (void) bfd_set_section_alignment (abfd, sec, s->align); - bfd_flags = bfd_get_section_flags (abfd, sec); + bfd_set_section_alignment (sec, s->align); + bfd_flags = bfd_section_flags (sec); if (bfd_flags == SEC_NO_FLAGS) - bfd_set_section_flags (abfd, sec, xlat->bfd_flags); + bfd_set_section_flags (sec, xlat->bfd_flags); } else /* Create default flags. */ @@ -3540,13 +3540,12 @@ bfd_mach_o_new_section_hook (bfd *abfd, asection *sec) } static void -bfd_mach_o_init_section_from_mach_o (bfd *abfd, asection *sec, - unsigned long prot) +bfd_mach_o_init_section_from_mach_o (asection *sec, unsigned long prot) { flagword flags; bfd_mach_o_section *section; - flags = bfd_get_section_flags (abfd, sec); + flags = bfd_section_flags (sec); section = bfd_mach_o_get_mach_o_section (sec); /* TODO: see if we should use the xlat system for doing this by @@ -3584,7 +3583,7 @@ bfd_mach_o_init_section_from_mach_o (bfd *abfd, asection *sec, if (section->nreloc != 0) flags |= SEC_RELOC; - bfd_set_section_flags (abfd, sec, flags); + bfd_set_section_flags (sec, flags); sec->vma = section->addr; sec->lma = section->addr; @@ -3651,7 +3650,7 @@ bfd_mach_o_read_section_32 (bfd *abfd, unsigned long prot) section->reserved2 = bfd_h_get_32 (abfd, raw.reserved2); section->reserved3 = 0; - bfd_mach_o_init_section_from_mach_o (abfd, sec, prot); + bfd_mach_o_init_section_from_mach_o (sec, prot); return sec; } @@ -3694,7 +3693,7 @@ bfd_mach_o_read_section_64 (bfd *abfd, unsigned long prot) section->reserved2 = bfd_h_get_32 (abfd, raw.reserved2); section->reserved3 = bfd_h_get_32 (abfd, raw.reserved3); - bfd_mach_o_init_section_from_mach_o (abfd, sec, prot); + bfd_mach_o_init_section_from_mach_o (sec, prot); return sec; } diff --git a/bfd/mmo.c b/bfd/mmo.c index f48f9868fee..736ee4bed81 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -596,7 +596,7 @@ static bfd_boolean mmo_section_has_contents (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *p ATTRIBUTE_UNUSED) { /* The point is to match what --extract-symbols does (well, negated). */ - return bfd_get_section_size (sec) != 0; + return bfd_section_size (sec) != 0; } /* Find out whether we should omit symbol consistency checks for this @@ -642,10 +642,10 @@ static void mmo_find_sec_w_addr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *p) { struct mmo_find_sec_info *infop = (struct mmo_find_sec_info *) p; - bfd_vma vma = bfd_get_section_vma (abfd, sec); + bfd_vma vma = bfd_section_vma (sec); /* Ignore sections that aren't loaded. */ - if ((bfd_get_section_flags (abfd, sec) & (SEC_LOAD | SEC_ALLOC)) + if ((bfd_section_flags (sec) & (SEC_LOAD | SEC_ALLOC)) != (SEC_LOAD | SEC_ALLOC)) return; @@ -657,10 +657,10 @@ static void mmo_find_sec_w_addr_grow (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *p) { struct mmo_find_sec_info *infop = (struct mmo_find_sec_info *) p; - bfd_vma vma = bfd_get_section_vma (abfd, sec); + bfd_vma vma = bfd_section_vma (sec); /* Ignore sections that aren't loaded. */ - if ((bfd_get_section_flags (abfd, sec) & (SEC_LOAD | SEC_ALLOC)) + if ((bfd_section_flags (sec) & (SEC_LOAD | SEC_ALLOC)) != (SEC_LOAD | SEC_ALLOC)) return; @@ -700,12 +700,11 @@ mmo_decide_section (bfd *abfd, bfd_vma vma) if (sec == NULL) return NULL; - if (! sec->user_set_vma && ! bfd_set_section_vma (abfd, sec, vma)) + if (!sec->user_set_vma && !bfd_set_section_vma (sec, vma)) return NULL; - if (! bfd_set_section_flags (abfd, sec, - bfd_get_section_flags (abfd, sec) - | SEC_CODE | SEC_LOAD | SEC_ALLOC)) + if (!bfd_set_section_flags (sec, (bfd_section_flags (sec) + | SEC_CODE | SEC_LOAD | SEC_ALLOC))) return NULL; } else if ((vma >> 56) == 0x20) @@ -715,12 +714,11 @@ mmo_decide_section (bfd *abfd, bfd_vma vma) if (sec == NULL) return NULL; - if (! sec->user_set_vma && ! bfd_set_section_vma (abfd, sec, vma)) + if (!sec->user_set_vma && !bfd_set_section_vma (sec, vma)) return NULL; - if (! bfd_set_section_flags (abfd, sec, - bfd_get_section_flags (abfd, sec) - | SEC_LOAD | SEC_ALLOC)) + if (!bfd_set_section_flags (sec, (bfd_section_flags (sec) + | SEC_LOAD | SEC_ALLOC))) return NULL; } @@ -733,12 +731,11 @@ mmo_decide_section (bfd *abfd, bfd_vma vma) sprintf (sec_name, ".MMIX.sec.%d", abfd->tdata.mmo_data->sec_no++); sec = mmo_make_section (abfd, sec_name); - if (! sec->user_set_vma && ! bfd_set_section_vma (abfd, sec, vma)) + if (!sec->user_set_vma && !bfd_set_section_vma (sec, vma)) return NULL; - if (! bfd_set_section_flags (abfd, sec, - bfd_get_section_flags (abfd, sec) - | SEC_LOAD | SEC_ALLOC)) + if (!bfd_set_section_flags (sec, (bfd_section_flags (sec) + | SEC_LOAD | SEC_ALLOC))) return NULL; return sec; } @@ -1136,14 +1133,13 @@ mmo_get_spec_section (bfd *abfd, int spec_data_number) /* Add in the section flags we found to those bfd entered during this process and set the contents. */ - if (! bfd_set_section_flags (abfd, sec, - bfd_sec_flags_from_mmo_flags (flags) - | bfd_get_section_flags (abfd, sec) - | (section_length != 0 ? SEC_HAS_CONTENTS : 0)) - || ! bfd_set_section_size (abfd, sec, sec->size + section_length) + if (!bfd_set_section_flags (sec, + (bfd_sec_flags_from_mmo_flags (flags) + | bfd_section_flags (sec) + | (section_length != 0 ? SEC_HAS_CONTENTS : 0))) + || !bfd_set_section_size (sec, sec->size + section_length) /* Set VMA only for the first occurrence. */ - || (! sec->user_set_vma - && ! bfd_set_section_vma (abfd, sec, section_vma))) + || (!sec->user_set_vma && !bfd_set_section_vma (sec, section_vma))) { /* If we get an error for any of the calls above, signal more than just a format error for the spec section. */ @@ -1561,9 +1557,8 @@ mmo_get_loc (asection *sec, bfd_vma vma, int size) /* We get here for the first time (at other times too) for this section. Say we have contents. */ - if (! bfd_set_section_flags (sec->owner, sec, - bfd_get_section_flags (sec->owner, sec) - | SEC_HAS_CONTENTS)) + if (!bfd_set_section_flags (sec, (bfd_section_flags (sec) + | SEC_HAS_CONTENTS))) return NULL; } } @@ -2070,18 +2065,16 @@ mmo_scan (bfd *abfd) section flags must be set then. */ sec = bfd_get_section_by_name (abfd, MMO_TEXT_SECTION_NAME); if (sec != NULL - && (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) - && ! bfd_set_section_flags (abfd, sec, - bfd_get_section_flags (abfd, sec) - | SEC_ALLOC | SEC_LOAD | SEC_CODE)) + && (bfd_section_flags (sec) & SEC_HAS_CONTENTS) + && !bfd_set_section_flags (sec, (bfd_section_flags (sec) + | SEC_ALLOC | SEC_LOAD | SEC_CODE))) error = TRUE; sec = bfd_get_section_by_name (abfd, MMO_DATA_SECTION_NAME); if (sec != NULL - && (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) - && ! bfd_set_section_flags (abfd, sec, - bfd_get_section_flags (abfd, sec) - | SEC_ALLOC | SEC_LOAD)) + && (bfd_section_flags (sec) & SEC_HAS_CONTENTS) + && !bfd_set_section_flags (sec, (bfd_section_flags (sec) + | SEC_ALLOC | SEC_LOAD))) error = TRUE; /* Free whatever resources we took. */ @@ -2432,7 +2425,7 @@ bfd_sec_flags_from_mmo_flags (flagword flags) static bfd_boolean mmo_has_leading_or_trailing_zero_tetra_p (bfd *abfd, asection *sec) { - bfd_vma secaddr = bfd_get_section_vma (abfd, sec); + bfd_vma secaddr = bfd_section_vma (sec); if (sec->size < 4) return FALSE; @@ -2464,7 +2457,7 @@ mmo_internal_write_section (bfd *abfd, asection *sec) if (strcmp (sec->name, MMO_TEXT_SECTION_NAME) == 0) { - bfd_vma secaddr = bfd_get_section_vma (abfd, sec); + bfd_vma secaddr = bfd_section_vma (sec); /* Because leading and trailing zeros are omitted in output, we need to specify the section boundaries so they're correct when the file @@ -2485,7 +2478,7 @@ mmo_internal_write_section (bfd *abfd, asection *sec) } else if (strcmp (sec->name, MMO_DATA_SECTION_NAME) == 0) { - bfd_vma secaddr = bfd_get_section_vma (abfd, sec); + bfd_vma secaddr = bfd_section_vma (sec); /* Same goes as for MMO_TEXT_SECTION_NAME above. */ if (sec->size != 0 @@ -2519,7 +2512,7 @@ mmo_internal_write_section (bfd *abfd, asection *sec) } /* Ignore sections that are just allocated or empty; we write out _contents_ here. */ - else if ((bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) != 0 + else if ((bfd_section_flags (sec) & SEC_HAS_CONTENTS) != 0 && sec->size != 0) { if (!mmo_write_section_description (abfd, sec)) @@ -2527,7 +2520,7 @@ mmo_internal_write_section (bfd *abfd, asection *sec) /* Writing a LOP_LOC ends the LOP_SPEC data, and makes data actually loaded. */ - if (bfd_get_section_flags (abfd, sec) & SEC_LOAD) + if (bfd_section_flags (sec) & SEC_LOAD) return (! abfd->tdata.mmo_data->have_error && mmo_write_loc_chunk_list (abfd, mmo_section_data (sec)->head)); @@ -2646,10 +2639,9 @@ EXAMPLE for all alien sections; perhaps mmo.em should clear that flag. Might be related to weak references. */ mmo_write_tetra (abfd, - mmo_sec_flags_from_bfd_flags - (bfd_get_section_flags (abfd, sec))); + mmo_sec_flags_from_bfd_flags (bfd_section_flags (sec))); mmo_write_octa (abfd, sec->size); - mmo_write_octa (abfd, bfd_get_section_vma (abfd, sec)); + mmo_write_octa (abfd, bfd_section_vma (sec)); return TRUE; } @@ -3171,7 +3163,7 @@ mmo_write_section_unless_reg_contents (bfd *abfd, asection *sec, void *p) /* Exclude the convenience register section. */ if (strcmp (sec->name, MMIX_REG_SECTION_NAME) == 0) { - if (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) + if (bfd_section_flags (sec) & SEC_HAS_CONTENTS) { /* Make sure it hasn't got contents. It seems impossible to make it carry contents, so we don't have a test-case for diff --git a/bfd/opncls.c b/bfd/opncls.c index d14dfe93206..b537dfd96d1 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -1218,7 +1218,7 @@ bfd_get_debug_link_info_1 (bfd *abfd, void *crc32_out) if (sect == NULL) return NULL; - size = bfd_get_section_size (sect); + size = bfd_section_size (sect); /* PR 22794: Make sure that the section has a reasonable size. */ if (size < 8 || size >= bfd_get_size (abfd)) @@ -1308,7 +1308,7 @@ bfd_get_alt_debug_link_info (bfd * abfd, bfd_size_type *buildid_len, if (sect == NULL) return NULL; - size = bfd_get_section_size (sect); + size = bfd_section_size (sect); if (size < 8 || size >= bfd_get_size (abfd)) return NULL; @@ -1322,7 +1322,7 @@ bfd_get_alt_debug_link_info (bfd * abfd, bfd_size_type *buildid_len, /* BuildID value is stored after the filename. */ name = (char *) contents; buildid_offset = strnlen (name, size) + 1; - if (buildid_offset >= bfd_get_section_size (sect)) + if (buildid_offset >= bfd_section_size (sect)) return NULL; *buildid_len = size - buildid_offset; @@ -1727,14 +1727,14 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename) debuglink_size &= ~3; debuglink_size += 4; - if (! bfd_set_section_size (abfd, sect, debuglink_size)) + if (!bfd_set_section_size (sect, debuglink_size)) /* XXX Should we delete the section from the bfd ? */ return NULL; /* PR 21193: Ensure that the section has 4-byte alignment for the CRC. Note - despite the name of the function being called, we are setting an alignment power, not a byte alignment value. */ - bfd_set_section_alignment (abfd, sect, 2); + bfd_set_section_alignment (sect, 2); return sect; } @@ -1872,7 +1872,7 @@ get_build_id (bfd *abfd) return NULL; } - size = bfd_get_section_size (sect); + size = bfd_section_size (sect); /* FIXME: Should we support smaller build-id notes ? */ if (size < 0x24) { @@ -1890,7 +1890,7 @@ get_build_id (bfd *abfd) /* FIXME: Paranoia - allow for compressed build-id sections. Maybe we should complain if this size is different from the one obtained above... */ - size = bfd_get_section_size (sect); + size = bfd_section_size (sect); if (size < sizeof (Elf_External_Note)) { bfd_set_error (bfd_error_invalid_operation); diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 238f5144d4c..a0c3ac0fa66 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -2802,17 +2802,17 @@ aout_link_add_symbols (bfd *abfd, struct bfd_link_info *info) break; case N_TEXT | N_EXT: section = obj_textsec (abfd); - value -= bfd_get_section_vma (abfd, section); + value -= bfd_section_vma (section); break; case N_DATA | N_EXT: /* Treat N_SETV symbols as N_DATA symbol; see comment in translate_from_native_sym_flags. */ section = obj_datasec (abfd); - value -= bfd_get_section_vma (abfd, section); + value -= bfd_section_vma (section); break; case N_BSS | N_EXT: section = obj_bsssec (abfd); - value -= bfd_get_section_vma (abfd, section); + value -= bfd_section_vma (section); break; } @@ -3151,8 +3151,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo, (*flaginfo->info->callbacks->reloc_overflow) (flaginfo->info, NULL, (p->type == bfd_section_reloc_link_order - ? bfd_section_name (flaginfo->output_bfd, - pr->u.section) + ? bfd_section_name (pr->u.section) : pr->u.name), howto->name, pr->addend, NULL, (asection *) NULL, (bfd_vma) 0); @@ -3477,7 +3476,7 @@ pdp11_aout_link_input_section (struct aout_final_link_info *flaginfo, asection *s; s = aout_reloc_type_to_section (input_bfd, r_type); - name = bfd_section_name (input_bfd, s); + name = bfd_section_name (s); } (*flaginfo->info->callbacks->reloc_overflow) (flaginfo->info, (h ? &h->root : NULL), name, howto->name, @@ -3997,8 +3996,7 @@ aout_link_write_symbols (struct aout_final_link_info *flaginfo, bfd *input_bfd) return FALSE; PUT_WORD (output_bfd, strtab_index, outsym->e_strx); PUT_WORD (output_bfd, - (bfd_get_section_vma (output_bfd, - obj_textsec (input_bfd)->output_section) + (bfd_section_vma (obj_textsec (input_bfd)->output_section) + obj_textsec (input_bfd)->output_offset), outsym->e_value); ++obj_aout_external_sym_count (output_bfd); @@ -4206,7 +4204,7 @@ aout_link_write_symbols (struct aout_final_link_info *flaginfo, bfd *input_bfd) BFD_ASSERT (bfd_is_abs_section (output_section) || output_section->owner == output_bfd); val = (hresolve->root.u.def.value - + bfd_get_section_vma (output_bfd, output_section) + + bfd_section_vma (output_section) + input_section->output_offset); /* Get the correct type based on the section. If diff --git a/bfd/pei-x86_64.c b/bfd/pei-x86_64.c index 2588e6c6e90..c0b97351def 100644 --- a/bfd/pei-x86_64.c +++ b/bfd/pei-x86_64.c @@ -770,7 +770,7 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile, asection *pdata_section) if (PEX64_IS_RUNTIME_FUNCTION_CHAINED (&rf)) { bfd_vma altent = PEX64_GET_UNWINDDATA_UNIFIED_RVA (&rf); - bfd_vma pdata_vma = bfd_get_section_vma (abfd, pdata_section); + bfd_vma pdata_vma = bfd_section_vma (pdata_section); struct pex64_runtime_function arf; fprintf (file, "\t shares information with "); diff --git a/bfd/peicode.h b/bfd/peicode.h index 679474ecd15..1e2b1044302 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -608,16 +608,16 @@ pe_ILF_make_a_section (pe_ILF_vars * vars, flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_KEEP | SEC_IN_MEMORY; - bfd_set_section_flags (vars->abfd, sec, flags | extra_flags); + bfd_set_section_flags (sec, flags | extra_flags); - (void) bfd_set_section_alignment (vars->abfd, sec, 2); + bfd_set_section_alignment (sec, 2); /* Check that we will not run out of space. */ BFD_ASSERT (vars->data + size < vars->bim->buffer + vars->bim->size); /* Set the section size and contents. The actual contents are filled in by our parent. */ - bfd_set_section_size (vars->abfd, sec, (bfd_size_type) size); + bfd_set_section_size (sec, (bfd_size_type) size); sec->contents = vars->data; sec->target_index = vars->sec_index ++; diff --git a/bfd/reloc.c b/bfd/reloc.c index 8eac73ddfe5..0c67ecd313a 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -1526,8 +1526,7 @@ _bfd_clear_contents (reloc_howto_type *howto, /* For a range list, use 1 instead of 0 as placeholder. 0 would terminate the list, hiding any later entries. */ - if (strcmp (bfd_get_section_name (input_bfd, input_section), - ".debug_ranges") == 0 + if (strcmp (bfd_section_name (input_section), ".debug_ranges") == 0 && (howto->dst_mask & 1) != 0) x |= 1; diff --git a/bfd/section.c b/bfd/section.c index 74feb73be90..3a9cb260234 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -554,26 +554,31 @@ CODE_FRAGMENT . would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some . compilers will complain about comma expressions that have no effect. *} .static inline bfd_boolean -.bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, -. void * val) +.bfd_set_section_userdata (asection *sec, void *val) .{ -. ptr->userdata = val; +. sec->userdata = val; . return TRUE; .} . .static inline bfd_boolean -.bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) +.bfd_set_section_vma (asection *sec, bfd_vma val) .{ -. ptr->vma = ptr->lma = val; -. ptr->user_set_vma = TRUE; +. sec->vma = sec->lma = val; +. sec->user_set_vma = TRUE; . return TRUE; .} . .static inline bfd_boolean -.bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, -. unsigned int val) +.bfd_set_section_lma (asection *sec, bfd_vma val) .{ -. ptr->alignment_power = val; +. sec->lma = val; +. return TRUE; +.} +. +.static inline bfd_boolean +.bfd_set_section_alignment (asection *sec, unsigned int val) +.{ +. sec->alignment_power = val; . return TRUE; .} . @@ -1289,13 +1294,12 @@ FUNCTION bfd_set_section_flags SYNOPSIS - bfd_boolean bfd_set_section_flags - (bfd *abfd, asection *sec, flagword flags); + bfd_boolean bfd_set_section_flags (asection *sec, flagword flags); DESCRIPTION - Set the attributes of the section @var{sec} in the BFD - @var{abfd} to the value @var{flags}. Return <<TRUE>> on success, - <<FALSE>> on error. Possible error returns are: + Set the attributes of the section @var{sec} to the value @var{flags}. + Return <<TRUE>> on success, <<FALSE>> on error. Possible error + returns are: o <<bfd_error_invalid_operation>> - The section cannot have one or more of the attributes @@ -1305,9 +1309,7 @@ DESCRIPTION */ bfd_boolean -bfd_set_section_flags (bfd *abfd ATTRIBUTE_UNUSED, - sec_ptr section, - flagword flags) +bfd_set_section_flags (asection *section, flagword flags) { section->flags = flags; return TRUE; @@ -1319,21 +1321,21 @@ FUNCTION SYNOPSIS void bfd_rename_section - (bfd *abfd, asection *sec, const char *newname); + (asection *sec, const char *newname); DESCRIPTION - Rename section @var{sec} in @var{abfd} to @var{newname}. + Rename section @var{sec} to @var{newname}. */ void -bfd_rename_section (bfd *abfd, sec_ptr sec, const char *newname) +bfd_rename_section (asection *sec, const char *newname) { struct section_hash_entry *sh; sh = (struct section_hash_entry *) ((char *) sec - offsetof (struct section_hash_entry, section)); sh->section.name = newname; - bfd_hash_rename (&abfd->section_htab, newname, &sh->root); + bfd_hash_rename (&sec->owner->section_htab, newname, &sh->root); } /* @@ -1417,8 +1419,7 @@ FUNCTION bfd_set_section_size SYNOPSIS - bfd_boolean bfd_set_section_size - (bfd *abfd, asection *sec, bfd_size_type val); + bfd_boolean bfd_set_section_size (asection *sec, bfd_size_type val); DESCRIPTION Set @var{sec} to the size @var{val}. If the operation is @@ -1431,18 +1432,18 @@ DESCRIPTION */ bfd_boolean -bfd_set_section_size (bfd *abfd, sec_ptr ptr, bfd_size_type val) +bfd_set_section_size (asection *sec, bfd_size_type val) { /* Once you've started writing to any section you cannot create or change the size of any others. */ - if (abfd->output_has_begun) + if (sec->owner == NULL || sec->owner->output_has_begun) { bfd_set_error (bfd_error_invalid_operation); return FALSE; } - ptr->size = val; + sec->size = val; return TRUE; } @@ -1486,7 +1487,7 @@ bfd_set_section_contents (bfd *abfd, { bfd_size_type sz; - if (!(bfd_get_section_flags (abfd, section) & SEC_HAS_CONTENTS)) + if (!(bfd_section_flags (section) & SEC_HAS_CONTENTS)) { bfd_set_error (bfd_error_no_contents); return FALSE; diff --git a/bfd/syms.c b/bfd/syms.c index 4d532b2cd21..9a2754ebe69 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -1290,7 +1290,7 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, /* We are passed a section relative offset. The offsets in the stabs information are absolute. */ - offset += bfd_get_section_vma (abfd, section); + offset += bfd_section_vma (section); #ifdef ENABLE_CACHING if (info->cached_indexentry != NULL diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c index 8d2a2dff623..4dde056e1ee 100644 --- a/bfd/vms-alpha.c +++ b/bfd/vms-alpha.c @@ -632,7 +632,7 @@ _bfd_vms_slurp_eisd (bfd *abfd, unsigned int offset) section->size = size; section->vma = vaddr; - if (!bfd_set_section_flags (abfd, section, bfd_flags)) + if (!bfd_set_section_flags (section, bfd_flags)) return FALSE; } @@ -687,7 +687,7 @@ _bfd_vms_slurp_eihs (bfd *abfd, unsigned int offset) section->size = dstsize; section->filepos = VMS_BLOCK_SIZE * (dstvbn - 1); - if (!bfd_set_section_flags (abfd, section, bfd_flags)) + if (!bfd_set_section_flags (section, bfd_flags)) return FALSE; PRIV (dst_section) = section; @@ -705,7 +705,7 @@ _bfd_vms_slurp_eihs (bfd *abfd, unsigned int offset) section->size = dmtbytes; section->filepos = VMS_BLOCK_SIZE * (dmtvbn - 1); - if (!bfd_set_section_flags (abfd, section, bfd_flags)) + if (!bfd_set_section_flags (section, bfd_flags)) return FALSE; } @@ -1261,7 +1261,7 @@ _bfd_vms_slurp_egsd (bfd *abfd) new_flags |= SEC_CODE; new_flags &= ~SEC_DATA; } - if (!bfd_set_section_flags (abfd, section, new_flags)) + if (!bfd_set_section_flags (section, new_flags)) return FALSE; /* Give a non-overlapping vma to non absolute sections. */ @@ -2441,7 +2441,7 @@ vms_slurp_debug (bfd *abfd) section = bfd_make_section (abfd, "$DST$"); if (!section) return FALSE; - if (!bfd_set_section_flags (abfd, section, flags)) + if (!bfd_set_section_flags (section, flags)) return FALSE; PRIV (dst_section) = section; } @@ -4623,7 +4623,7 @@ build_module_list (bfd *abfd) section and build the list of modules. This is sufficient since we can compute the start address and the end address of every module from the section contents. */ - bfd_size_type size = bfd_get_section_size (dmt); + bfd_size_type size = bfd_section_size (dmt); unsigned char *ptr, *end; ptr = (unsigned char *) bfd_alloc (abfd, size); @@ -9324,7 +9324,7 @@ vms_new_section_hook (bfd * abfd, asection *section) vms_debug2 ((1, "vms_new_section_hook (%p, [%u]%s)\n", abfd, section->index, section->name)); - if (! bfd_set_section_alignment (abfd, section, 0)) + if (!bfd_set_section_alignment (section, 0)) return FALSE; vms_debug2 ((7, "%u: %s\n", section->index, section->name)); @@ -9412,11 +9412,11 @@ vms_get_symbol_info (bfd * abfd ATTRIBUTE_UNUSED, else if (bfd_is_ind_section (sec)) ret->type = 'I'; else if ((symbol->flags & BSF_FUNCTION) - || (bfd_get_section_flags (abfd, sec) & SEC_CODE)) + || (bfd_section_flags (sec) & SEC_CODE)) ret->type = 'T'; - else if (bfd_get_section_flags (abfd, sec) & SEC_DATA) + else if (bfd_section_flags (sec) & SEC_DATA) ret->type = 'D'; - else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) + else if (bfd_section_flags (sec) & SEC_ALLOC) ret->type = 'B'; else ret->type = '?'; diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 1a2f87c4b00..52691720aea 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -2080,14 +2080,14 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info) for (o = abfd->sections; o != first_csect; o = o->next) { /* Debugging sections have no csects. */ - if (bfd_get_section_flags (abfd, o) & SEC_DEBUGGING) + if (bfd_section_flags (o) & SEC_DEBUGGING) continue; /* Reset the section size and the line number count, since the data is now attached to the csects. Don't reset the size of the .debug section, since we need to read it below in bfd_xcoff_size_dynamic_sections. */ - if (strcmp (bfd_get_section_name (abfd, o), ".debug") != 0) + if (strcmp (bfd_section_name (o), ".debug") != 0) o->size = 0; o->lineno_count = 0; @@ -3019,7 +3019,7 @@ xcoff_sweep (struct bfd_link_info *info) || o == xcoff_hash_table (info)->loader_section || o == xcoff_hash_table (info)->linkage_section || o == xcoff_hash_table (info)->descriptor_section - || (bfd_get_section_flags (sub, o) & SEC_DEBUGGING) + || (bfd_section_flags (o) & SEC_DEBUGGING) || strcmp (o->name, ".debug") == 0) o->flags |= SEC_MARK; else diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 9c791f6d656..9f6300f17d6 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,5 +1,13 @@ 2019-09-18 Alan Modra <amodra@gmail.com> + * addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c, + * objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c, + * od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c, + * resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update + throughout for bfd section macro and function changes. + +2019-09-18 Alan Modra <amodra@gmail.com> + * nm.c: Update bfd_get_section to bfd_asymbol_section throughout. * objcopy.c: Likewise. * objdump.c: Likewise. diff --git a/binutils/addr2line.c b/binutils/addr2line.c index 8a77c473bad..d9cc2881f8d 100644 --- a/binutils/addr2line.c +++ b/binutils/addr2line.c @@ -182,14 +182,14 @@ find_address_in_section (bfd *abfd, asection *section, if (found) return; - if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0) + if ((bfd_section_flags (section) & SEC_ALLOC) == 0) return; - vma = bfd_get_section_vma (abfd, section); + vma = bfd_section_vma (section); if (pc < vma) return; - size = bfd_get_section_size (section); + size = bfd_section_size (section); if (pc >= vma + size) return; @@ -208,10 +208,10 @@ find_offset_in_section (bfd *abfd, asection *section) if (found) return; - if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0) + if ((bfd_section_flags (section) & SEC_ALLOC) == 0) return; - size = bfd_get_section_size (section); + size = bfd_section_size (section); if (pc >= size) return; diff --git a/binutils/bucomm.c b/binutils/bucomm.c index e8ac3b6de85..2493fd561bc 100644 --- a/binutils/bucomm.c +++ b/binutils/bucomm.c @@ -94,7 +94,7 @@ bfd_nonfatal_message (const char *filename, if (!filename) filename = bfd_get_archive_filename (abfd); if (section) - section_name = bfd_get_section_name (abfd, section); + section_name = bfd_section_name (section); } if (section_name) fprintf (stderr, ":%s[%s]", filename, section_name); diff --git a/binutils/coffgrok.c b/binutils/coffgrok.c index 1556a0b8ad2..177c66ed766 100644 --- a/binutils/coffgrok.c +++ b/binutils/coffgrok.c @@ -145,7 +145,7 @@ do_sections_p1 (struct coff_ofile *head) if (strcmp (section->name, ".bss") == 0) head->sections[i].data = 1; head->sections[i].address = section->lma; - head->sections[i].size = bfd_get_section_size (section); + head->sections[i].size = bfd_section_size (section); head->sections[i].number = idx; head->sections[i].nrelocs = section->reloc_count; head->sections[i].relocs = diff --git a/binutils/dlltool.c b/binutils/dlltool.c index cd2ff24325d..85304d0c37f 100644 --- a/binutils/dlltool.c +++ b/binutils/dlltool.c @@ -1384,7 +1384,7 @@ scan_drectve_symbols (bfd *abfd) if (s == NULL) return; - size = bfd_get_section_size (s); + size = bfd_section_size (s); buf = xmalloc (size); bfd_get_section_contents (abfd, s, buf, 0, size); @@ -2482,11 +2482,9 @@ make_one_lib_file (export_type *exp, int i, int delay) if (si->id != i) abort (); si->sec = bfd_make_section_old_way (abfd, si->name); - bfd_set_section_flags (abfd, - si->sec, - si->flags & applicable); + bfd_set_section_flags (si->sec, si->flags & applicable); - bfd_set_section_alignment(abfd, si->sec, si->align); + bfd_set_section_alignment (si->sec, si->align); si->sec->output_section = si->sec; si->sym = bfd_make_empty_symbol(abfd); si->sym->name = si->sec->name; @@ -2822,7 +2820,7 @@ make_one_lib_file (export_type *exp, int i, int delay) arelent *imglue, *ba_rel, *ea_rel, *pea_rel; /* Alignment must be set to 2**2 or you get extra stuff. */ - bfd_set_section_alignment(abfd, sec, 2); + bfd_set_section_alignment (sec, 2); si->size = 4 * 5; si->data = xmalloc (si->size); @@ -2908,8 +2906,8 @@ make_one_lib_file (export_type *exp, int i, int delay) { sinfo *si = secdata + i; - bfd_set_section_size (abfd, si->sec, si->size); - bfd_set_section_vma (abfd, si->sec, vma); + bfd_set_section_size (si->sec, si->size); + bfd_set_section_vma (si->sec, vma); } } /* Write them out. */ @@ -3691,7 +3689,7 @@ identify_search_section (bfd * abfd, asection * section, void * obj) if (ms_style && ((section->flags & SEC_DATA) == 0)) return; - if ((datasize = bfd_section_size (abfd, section)) == 0) + if ((datasize = bfd_section_size (section)) == 0) return; data = (bfd_byte *) xmalloc (datasize + 1); diff --git a/binutils/nm.c b/binutils/nm.c index 0bded073912..e177d444efd 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -791,8 +791,8 @@ sort_symbols_by_size (bfd *abfd, bfd_boolean is_dynamic, void *minisyms, && sec == bfd_asymbol_section (next)) sz = valueof (next) - valueof (sym); else - sz = (bfd_get_section_vma (abfd, sec) - + bfd_section_size (abfd, sec) + sz = (bfd_section_vma (sec) + + bfd_section_size (sec) - valueof (sym)); } diff --git a/binutils/objcopy.c b/binutils/objcopy.c index ce4a4afa55c..6489fbe72f9 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1255,7 +1255,7 @@ group_signature (asection *group) static bfd_boolean is_dwo_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) { - const char *name = bfd_get_section_name (abfd, sec); + const char *name = bfd_section_name (sec); int len = strlen (name); return strncmp (name + len - 4, ".dwo", 4) == 0; @@ -1310,17 +1310,17 @@ is_strip_section_1 (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) struct section_list *p; struct section_list *q; - p = find_section_list (bfd_get_section_name (abfd, sec), FALSE, + p = find_section_list (bfd_section_name (sec), FALSE, SECTION_CONTEXT_REMOVE); - q = find_section_list (bfd_get_section_name (abfd, sec), FALSE, + q = find_section_list (bfd_section_name (sec), FALSE, SECTION_CONTEXT_COPY); if (p && q) fatal (_("error: section %s matches both remove and copy options"), - bfd_get_section_name (abfd, sec)); + bfd_section_name (sec)); if (p && is_update_section (abfd, sec)) fatal (_("error: section %s matches both update and remove options"), - bfd_get_section_name (abfd, sec)); + bfd_section_name (sec)); if (p != NULL) return TRUE; @@ -1328,7 +1328,7 @@ is_strip_section_1 (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) return TRUE; } - if ((bfd_get_section_flags (abfd, sec) & SEC_DEBUGGING) != 0) + if ((bfd_section_flags (sec) & SEC_DEBUGGING) != 0) { if (strip_symbols == STRIP_DEBUG || strip_symbols == STRIP_UNNEEDED @@ -1339,7 +1339,7 @@ is_strip_section_1 (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) /* By default we don't want to strip .reloc section. This section has for pe-coff special meaning. See pe-dll.c file in ld, and peXXigen.c in bfd for details. */ - if (strcmp (bfd_get_section_name (abfd, sec), ".reloc") != 0) + if (strcmp (bfd_section_name (sec), ".reloc") != 0) return TRUE; } @@ -1364,7 +1364,7 @@ is_strip_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) if (is_strip_section_1 (abfd, sec)) return TRUE; - if ((bfd_get_section_flags (abfd, sec) & SEC_GROUP) != 0) + if ((bfd_section_flags (sec) & SEC_GROUP) != 0) { asymbol *gsym; const char *gname; @@ -1414,7 +1414,7 @@ is_nondebug_keep_contents_section (bfd *ibfd, asection *isection) directory", but that may be the .text section for objects produced by some tools, which it is not sensible to keep. */ if (ibfd->xvec->flavour == bfd_target_coff_flavour) - return (strcmp (bfd_get_section_name (ibfd, isection), ".buildid") == 0); + return (strcmp (bfd_section_name (isection), ".buildid") == 0); return FALSE; } @@ -2728,7 +2728,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) } } - if (! bfd_set_section_size (obfd, padd->section, padd->size)) + if (!bfd_set_section_size (padd->section, padd->size)) { bfd_nonfatal_message (NULL, obfd, padd->section, NULL); return FALSE; @@ -2737,7 +2737,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) pset = find_section_list (padd->name, FALSE, SECTION_CONTEXT_SET_VMA | SECTION_CONTEXT_ALTER_VMA); if (pset != NULL - && ! bfd_set_section_vma (obfd, padd->section, pset->vma_val)) + && !bfd_set_section_vma (padd->section, pset->vma_val)) { bfd_nonfatal_message (NULL, obfd, padd->section, NULL); return FALSE; @@ -2749,9 +2749,8 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) { padd->section->lma = pset->lma_val; - if (! bfd_set_section_alignment - (obfd, padd->section, - bfd_section_alignment (obfd, padd->section))) + if (!bfd_set_section_alignment + (padd->section, bfd_section_alignment (padd->section))) { bfd_nonfatal_message (NULL, obfd, padd->section, NULL); return FALSE; @@ -2776,7 +2775,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) } osec = pupdate->section->output_section; - if (! bfd_set_section_size (obfd, osec, pupdate->size)) + if (!bfd_set_section_size (osec, pupdate->size)) { bfd_nonfatal_message (NULL, obfd, osec, NULL); return FALSE; @@ -2793,7 +2792,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) { bfd_size_type size; - size = bfd_get_section_size (osec); + size = bfd_section_size (osec); if (size == 0) { bfd_nonfatal_message (NULL, ibfd, osec, _("warning: note section is empty")); @@ -2820,7 +2819,8 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) else { if (osec->output_section == NULL - || ! bfd_set_section_size (obfd, osec->output_section, merged_size)) + || !bfd_set_section_size (osec->output_section, + merged_size)) { bfd_nonfatal_message (NULL, obfd, osec, _("warning: failed to set merged notes size")); free (merged_notes); @@ -2848,14 +2848,14 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) continue; } - if ((bfd_get_section_flags (ibfd, osec) & SEC_HAS_CONTENTS) == 0) + if ((bfd_section_flags (osec) & SEC_HAS_CONTENTS) == 0) { bfd_nonfatal_message (NULL, ibfd, osec, _("can't dump section - it has no contents")); continue; } - bfd_size_type size = bfd_get_section_size (osec); + bfd_size_type size = bfd_section_size (osec); if (size == 0) { bfd_nonfatal_message (NULL, ibfd, osec, @@ -2948,7 +2948,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) + highest_section->size, /* FIXME: We ought to be using COFF_PAGE_SIZE here or maybe - bfd_get_section_alignment() (if it + bfd_section_alignment() (if it was set) but since this is for PE and we know the required alignment it is easier just to hard code it. */ @@ -2957,7 +2957,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) /* Umm, not sure what to do in this case. */ debuglink_vma = 0x1000; - bfd_set_section_vma (obfd, gnu_debuglink_section, debuglink_vma); + bfd_set_section_vma (gnu_debuglink_section, debuglink_vma); } } } @@ -2991,18 +2991,18 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) bfd_size_type size; bfd_vma gap_start, gap_stop; - flags = bfd_get_section_flags (obfd, osections[i]); + flags = bfd_section_flags (osections[i]); if ((flags & SEC_HAS_CONTENTS) == 0 || (flags & SEC_LOAD) == 0) continue; - size = bfd_section_size (obfd, osections[i]); - gap_start = bfd_section_lma (obfd, osections[i]) + size; - gap_stop = bfd_section_lma (obfd, osections[i + 1]); + size = bfd_section_size (osections[i]); + gap_start = bfd_section_lma (osections[i]) + size; + gap_stop = bfd_section_lma (osections[i + 1]); if (gap_start < gap_stop) { - if (! bfd_set_section_size (obfd, osections[i], - size + (gap_stop - gap_start))) + if (!bfd_set_section_size (osections[i], + size + (gap_stop - gap_start))) { bfd_nonfatal_message (NULL, obfd, osections[i], _("Can't fill gap after section")); @@ -3021,12 +3021,11 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) bfd_vma lma; bfd_size_type size; - lma = bfd_section_lma (obfd, osections[c - 1]); - size = bfd_section_size (obfd, osections[c - 1]); + lma = bfd_section_lma (osections[c - 1]); + size = bfd_section_size (osections[c - 1]); if (lma + size < pad_to) { - if (! bfd_set_section_size (obfd, osections[c - 1], - pad_to - lma)) + if (!bfd_set_section_size (osections[c - 1], pad_to - lma)) { bfd_nonfatal_message (NULL, obfd, osections[c - 1], _("can't add padding")); @@ -3204,7 +3203,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch) file_ptr off; left = gaps[i]; - off = bfd_section_size (obfd, osections[i]) - left; + off = bfd_section_size (osections[i]) - left; while (left > 0) { @@ -3779,13 +3778,13 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) return; /* Get the, possibly new, name of the output section. */ - name = bfd_section_name (ibfd, isection); - flags = bfd_get_section_flags (ibfd, isection); + name = bfd_section_name (isection); + flags = bfd_section_flags (isection); name = find_section_rename (name, &flags); /* Prefix sections. */ if ((prefix_alloc_sections_string) - && (bfd_get_section_flags (ibfd, isection) & SEC_ALLOC)) + && (bfd_section_flags (isection) & SEC_ALLOC)) prefix = prefix_alloc_sections_string; else if (prefix_sections_string) prefix = prefix_sections_string; @@ -3802,7 +3801,7 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) make_nobits = FALSE; - p = find_section_list (bfd_section_name (ibfd, isection), FALSE, + p = find_section_list (bfd_section_name (isection), FALSE, SECTION_CONTEXT_SET_FLAGS); if (p != NULL) flags = p->flags | (flags & (SEC_HAS_CONTENTS | SEC_RELOC)); @@ -3834,20 +3833,20 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) if (make_nobits) elf_section_type (osection) = SHT_NOBITS; - size = bfd_section_size (ibfd, isection); + size = bfd_section_size (isection); size = bfd_convert_section_size (ibfd, isection, obfd, size); if (copy_byte >= 0) size = (size + interleave - 1) / interleave * copy_width; else if (extract_symbol) size = 0; - if (! bfd_set_section_size (obfd, osection, size)) + if (!bfd_set_section_size (osection, size)) { err = _("failed to set size"); goto loser; } - vma = bfd_section_vma (ibfd, isection); - p = find_section_list (bfd_section_name (ibfd, isection), FALSE, + vma = bfd_section_vma (isection); + p = find_section_list (bfd_section_name (isection), FALSE, SECTION_CONTEXT_ALTER_VMA | SECTION_CONTEXT_SET_VMA); if (p != NULL) { @@ -3859,14 +3858,14 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) else vma += change_section_address; - if (! bfd_set_section_vma (obfd, osection, vma)) + if (!bfd_set_section_vma (osection, vma)) { err = _("failed to set vma"); goto loser; } lma = isection->lma; - p = find_section_list (bfd_section_name (ibfd, isection), FALSE, + p = find_section_list (bfd_section_name (isection), FALSE, SECTION_CONTEXT_ALTER_LMA | SECTION_CONTEXT_SET_LMA); if (p != NULL) { @@ -3880,18 +3879,16 @@ setup_section (bfd *ibfd, sec_ptr isection, void *obfdarg) osection->lma = lma; - p = find_section_list (bfd_section_name (ibfd, isection), FALSE, + p = find_section_list (bfd_section_name (isection), FALSE, SECTION_CONTEXT_SET_ALIGNMENT); if (p != NULL) alignment = p->alignment; else - alignment = bfd_section_alignment (ibfd, isection); + alignment = bfd_section_alignment (isection); /* FIXME: This is probably not enough. If we change the LMA we may have to recompute the header for the file as well. */ - if (!bfd_set_section_alignment (obfd, - osection, - alignment)) + if (!bfd_set_section_alignment (osection, alignment)) { err = _("failed to set alignment"); goto loser; @@ -3965,12 +3962,12 @@ skip_section (bfd *ibfd, sec_ptr isection, bfd_boolean skip_copy) if (skip_copy && is_merged_note_section (ibfd, isection)) return TRUE; - flags = bfd_get_section_flags (ibfd, isection); + flags = bfd_section_flags (isection); if ((flags & SEC_GROUP) != 0) return TRUE; osection = isection->output_section; - size = bfd_get_section_size (isection); + size = bfd_section_size (isection); if (size == 0 || osection == 0) return TRUE; @@ -3995,7 +3992,7 @@ handle_remove_relocations_option (const char *section_pattern) static bfd_boolean discard_relocations (bfd *ibfd ATTRIBUTE_UNUSED, asection *isection) { - return (find_section_list (bfd_section_name (ibfd, isection), FALSE, + return (find_section_list (bfd_section_name (isection), FALSE, SECTION_CONTEXT_REMOVE_RELOCS) != NULL); } @@ -4140,10 +4137,10 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg) ELF classes of input and output aren't the same. We can't use the output section size since --interleave will shrink the output section. Size will be updated if the section is converted. */ - size = bfd_get_section_size (isection); + size = bfd_section_size (isection); - if (bfd_get_section_flags (ibfd, isection) & SEC_HAS_CONTENTS - && bfd_get_section_flags (obfd, osection) & SEC_HAS_CONTENTS) + if (bfd_section_flags (isection) & SEC_HAS_CONTENTS + && bfd_section_flags (osection) & SEC_HAS_CONTENTS) { bfd_byte *memhunk = NULL; @@ -4180,7 +4177,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg) else /* User must pad the section up in order to do this. */ fatal (_("cannot reverse bytes: length of section %s must be evenly divisible by %d"), - bfd_section_name (ibfd, isection), reverse_bytes); + bfd_section_name (isection), reverse_bytes); } if (copy_byte >= 0) @@ -4223,7 +4220,7 @@ copy_section (bfd *ibfd, sec_ptr isection, void *obfdarg) } free (memhunk); } - else if ((p = find_section_list (bfd_get_section_name (ibfd, isection), + else if ((p = find_section_list (bfd_section_name (isection), FALSE, SECTION_CONTEXT_SET_FLAGS)) != NULL && (p->flags & SEC_HAS_CONTENTS) != 0) { @@ -4294,9 +4291,9 @@ compare_section_lma (const void *arg1, const void *arg2) return -1; /* Sort sections with the same LMA by size. */ - if (bfd_get_section_size (*sec1) > bfd_get_section_size (*sec2)) + if (bfd_section_size (*sec1) > bfd_section_size (*sec2)) return 1; - else if (bfd_get_section_size (*sec1) < bfd_get_section_size (*sec2)) + else if (bfd_section_size (*sec1) < bfd_section_size (*sec2)) return -1; return 0; @@ -4378,10 +4375,10 @@ write_debugging_info (bfd *obfd, void *dhandle, stabstrsec = bfd_make_section_with_flags (obfd, ".stabstr", flags); if (stabsec == NULL || stabstrsec == NULL - || ! bfd_set_section_size (obfd, stabsec, symsize) - || ! bfd_set_section_size (obfd, stabstrsec, stringsize) - || ! bfd_set_section_alignment (obfd, stabsec, 2) - || ! bfd_set_section_alignment (obfd, stabstrsec, 0)) + || !bfd_set_section_size (stabsec, symsize) + || !bfd_set_section_size (stabstrsec, stringsize) + || !bfd_set_section_alignment (stabsec, 2) + || !bfd_set_section_alignment (stabstrsec, 0)) { bfd_nonfatal_message (NULL, obfd, NULL, _("can't create debugging section")); diff --git a/binutils/objdump.c b/binutils/objdump.c index 4a7c8f9a74b..96727a0f51e 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -545,13 +545,13 @@ dump_section_header (bfd *abfd, asection *section, void *data) return; printf ("%3d %-*s %08lx ", section->index, longest_section_name, - sanitize_string (bfd_get_section_name (abfd, section)), - (unsigned long) bfd_section_size (abfd, section) / opb); - bfd_printf_vma (abfd, bfd_get_section_vma (abfd, section)); + sanitize_string (bfd_section_name (section)), + (unsigned long) bfd_section_size (section) / opb); + bfd_printf_vma (abfd, bfd_section_vma (section)); printf (" "); bfd_printf_vma (abfd, section->lma); printf (" %08lx 2**%u", (unsigned long) section->filepos, - bfd_get_section_alignment (abfd, section)); + bfd_section_alignment (section)); if (! wide_output) printf ("\n "); printf (" "); @@ -631,7 +631,8 @@ dump_section_header (bfd *abfd, asection *section, void *data) DATA which contains the string length of the longest section name. */ static void -find_longest_section_name (bfd *abfd, asection *section, void *data) +find_longest_section_name (bfd *abfd ATTRIBUTE_UNUSED, + asection *section, void *data) { int *longest_so_far = (int *) data; const char *name; @@ -645,7 +646,7 @@ find_longest_section_name (bfd *abfd, asection *section, void *data) if (! process_section_p (section)) return; - name = bfd_get_section_name (abfd, section); + name = bfd_section_name (section); len = (int) strlen (name); if (len > *longest_so_far) *longest_so_far = len; @@ -1034,8 +1035,8 @@ sym_ok (bfd_boolean want_section, debug info file, whilst the section we want is in a normal file. So the section pointers will be different, but the section names will be the same. */ - if (strcmp (bfd_section_name (abfd, sorted_syms[place]->section), - bfd_section_name (abfd, sec)) != 0) + if (strcmp (bfd_section_name (sorted_syms[place]->section), + bfd_section_name (sec)) != 0) return FALSE; } @@ -1141,9 +1142,9 @@ find_symbol_for_address (bfd_vma vma, Also give the target a chance to reject symbols. */ want_section = (aux->require_sec || ((abfd->flags & HAS_RELOC) != 0 - && vma >= bfd_get_section_vma (abfd, sec) - && vma < (bfd_get_section_vma (abfd, sec) - + bfd_section_size (abfd, sec) / opb))); + && vma >= bfd_section_vma (sec) + && vma < (bfd_section_vma (sec) + + bfd_section_size (sec) / opb))); if (! sym_ok (want_section, abfd, thisplace, sec, inf)) { @@ -1267,8 +1268,8 @@ objdump_print_addr_with_sym (bfd *abfd, asection *sec, asymbol *sym, bfd_vma secaddr; (*inf->fprintf_func) (inf->stream, " <%s", - sanitize_string (bfd_get_section_name (abfd, sec))); - secaddr = bfd_get_section_vma (abfd, sec); + sanitize_string (bfd_section_name (sec))); + secaddr = bfd_section_vma (sec); if (vma < secaddr) { (*inf->fprintf_func) (inf->stream, "-0x"); @@ -2235,7 +2236,7 @@ disassemble_bytes (struct disassemble_info * inf, asection *sym_sec; sym_sec = bfd_asymbol_section (*q->sym_ptr_ptr); - sym_name = bfd_get_section_name (aux->abfd, sym_sec); + sym_name = bfd_section_name (sym_sec); if (sym_name == NULL || *sym_name == '\0') sym_name = "*unknown*"; printf ("%s", sanitize_string (sym_name)); @@ -2308,7 +2309,7 @@ disassemble_section (bfd *abfd, asection *section, void *inf) if (! process_section_p (section)) return; - datasize = bfd_get_section_size (section); + datasize = bfd_section_size (section); if (datasize == 0) return; @@ -2538,7 +2539,7 @@ disassemble_section (bfd *abfd, asection *section, void *inf) else { #define is_valid_next_sym(SYM) \ - (strcmp (bfd_section_name (abfd, (SYM)->section), bfd_section_name (abfd, section)) == 0 \ + (strcmp (bfd_section_name ((SYM)->section), bfd_section_name (section)) == 0 \ && (bfd_asymbol_value (SYM) > bfd_asymbol_value (sym)) \ && pinfo->symbol_is_valid (SYM, pinfo)) @@ -2750,9 +2751,9 @@ load_specific_debug_section (enum dwarf_section_display_enum debug, section->filename = bfd_get_filename (abfd); section->reloc_info = NULL; section->num_relocs = 0; - section->address = bfd_get_section_vma (abfd, sec); + section->address = bfd_section_vma (sec); section->user_data = sec; - section->size = bfd_get_section_size (sec); + section->size = bfd_section_size (sec); /* PR 24360: On 32-bit hosts sizeof (size_t) < sizeof (bfd_size_type). */ alloced = amt = section->size + 1; if (alloced != amt || alloced == 0) @@ -2925,7 +2926,7 @@ static void dump_dwarf_section (bfd *abfd, asection *section, void *arg ATTRIBUTE_UNUSED) { - const char *name = bfd_get_section_name (abfd, section); + const char *name = bfd_section_name (section); const char *match; int i; @@ -3050,7 +3051,7 @@ read_section_stabs (bfd *abfd, const char *sect_name, bfd_size_type *size_ptr, return NULL; } - *size_ptr = bfd_section_size (abfd, stabsect); + *size_ptr = bfd_section_size (stabsect); if (entsize_ptr) *entsize_ptr = stabsect->entsize; @@ -3459,7 +3460,7 @@ dump_section (bfd *abfd, asection *section, void *dummy ATTRIBUTE_UNUSED) if (! process_section_p (section)) return; - if ((datasize = bfd_section_size (abfd, section)) == 0) + if ((datasize = bfd_section_size (section)) == 0) return; /* Compute the address range to display. */ diff --git a/binutils/od-elf32_avr.c b/binutils/od-elf32_avr.c index aaa97bb5818..4a607d20ee7 100644 --- a/binutils/od-elf32_avr.c +++ b/binutils/od-elf32_avr.c @@ -85,7 +85,7 @@ elf32_avr_get_note_section_contents (bfd *abfd, bfd_size_type *size) if ((section = bfd_get_section_by_name (abfd, ".note.gnu.avr.deviceinfo")) == NULL) return NULL; - *size = bfd_get_section_size (section); + *size = bfd_section_size (section); char *contents = (char *) xmalloc (*size); bfd_get_section_contents (abfd, section, contents, 0, *size); @@ -162,17 +162,17 @@ elf32_avr_get_memory_usage (bfd *abfd, asection *section; if ((section = bfd_get_section_by_name (abfd, ".data")) != NULL) - avr_datasize = bfd_section_size (abfd, section); + avr_datasize = bfd_section_size (section); if ((section = bfd_get_section_by_name (abfd, ".text")) != NULL) - avr_textsize = bfd_section_size (abfd, section); + avr_textsize = bfd_section_size (section); if ((section = bfd_get_section_by_name (abfd, ".bss")) != NULL) - avr_bsssize = bfd_section_size (abfd, section); + avr_bsssize = bfd_section_size (section); if ((section = bfd_get_section_by_name (abfd, ".bootloader")) != NULL) - bootloadersize = bfd_section_size (abfd, section); + bootloadersize = bfd_section_size (section); if ((section = bfd_get_section_by_name (abfd, ".noinit")) != NULL) - noinitsize = bfd_section_size (abfd, section); + noinitsize = bfd_section_size (section); if ((section = bfd_get_section_by_name (abfd, ".eeprom")) != NULL) - eepromsize = bfd_section_size (abfd, section); + eepromsize = bfd_section_size (section); *text_usage = avr_textsize + avr_datasize + bootloadersize; *data_usage = avr_datasize + avr_bsssize + noinitsize; @@ -255,12 +255,12 @@ elf32_avr_dump_avr_prop (bfd *abfd) for (i = 0; i < r_list->record_count; ++i) { printf (" %d %s @ %s + %#08lx (%#08lx)\n", - i, - avr_elf32_property_record_name (&r_list->records [i]), - r_list->records [i].section->name, - r_list->records [i].offset, - (bfd_get_section_vma (abfd, r_list->records [i].section) - + r_list->records [i].offset)); + i, + avr_elf32_property_record_name (&r_list->records [i]), + r_list->records [i].section->name, + r_list->records [i].offset, + (bfd_section_vma (r_list->records [i].section) + + r_list->records [i].offset)); switch (r_list->records [i].type) { case RECORD_ORG: diff --git a/binutils/od-macho.c b/binutils/od-macho.c index 6dc8c4d385e..ada86b52360 100644 --- a/binutils/od-macho.c +++ b/binutils/od-macho.c @@ -2259,7 +2259,7 @@ dump_section_content (bfd *abfd, asection *bfdsec = sec->bfdsection; unsigned char *content; - size = bfd_get_section_size (bfdsec); + size = bfd_section_size (bfdsec); content = (unsigned char *) xmalloc (size); bfd_get_section_contents (abfd, bfdsec, content, 0, size); diff --git a/binutils/od-xcoff.c b/binutils/od-xcoff.c index 1f79985002d..e5566bc9a73 100644 --- a/binutils/od-xcoff.c +++ b/binutils/od-xcoff.c @@ -763,7 +763,7 @@ dump_xcoff32_symbols (bfd *abfd, struct xcoff_dump *data) { bfd_size_type size; - size = bfd_get_section_size (debugsec); + size = bfd_section_size (debugsec); debug = (char *) xmalloc (size); bfd_get_section_contents (abfd, debugsec, debug, 0, size); } @@ -1051,7 +1051,7 @@ dump_xcoff32_loader (bfd *abfd) printf (_("no .loader section in file\n")); return; } - size = bfd_get_section_size (loader); + size = bfd_section_size (loader); if (size < sizeof (*lhdr)) { printf (_("section .loader is too short\n")); @@ -1198,7 +1198,7 @@ dump_xcoff32_except (bfd *abfd, struct xcoff_dump *data) printf (_("no .except section in file\n")); return; } - size = bfd_get_section_size (sec); + size = bfd_section_size (sec); excp_data = (bfd_byte *) xmalloc (size); bfd_get_section_contents (abfd, sec, excp_data, 0, size); exceptab = (struct external_exceptab *)excp_data; @@ -1241,7 +1241,7 @@ dump_xcoff32_typchk (bfd *abfd) printf (_("no .typchk section in file\n")); return; } - size = bfd_get_section_size (sec); + size = bfd_section_size (sec); data = (bfd_byte *) xmalloc (size); bfd_get_section_contents (abfd, sec, data, 0, size); @@ -1449,9 +1449,9 @@ dump_xcoff32_traceback (bfd *abfd, struct xcoff_dump *data) text_sec = bfd_get_section_by_name (abfd, ".text"); if (text_sec == NULL) return; - text_vma = bfd_get_section_vma (abfd, text_sec); + text_vma = bfd_section_vma (text_sec); - text_size = bfd_get_section_size (text_sec); + text_size = bfd_section_size (text_sec); text = (char *) xmalloc (text_size); bfd_get_section_contents (abfd, text_sec, text, 0, text_size); diff --git a/binutils/prdbg.c b/binutils/prdbg.c index d44f5c4fccd..40cf54b8fe9 100644 --- a/binutils/prdbg.c +++ b/binutils/prdbg.c @@ -1930,14 +1930,14 @@ find_address_in_section (bfd *abfd, asection *section, void *data) if (found) return; - if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0) + if ((bfd_section_flags (section) & SEC_ALLOC) == 0) return; - vma = bfd_get_section_vma (abfd, section); + vma = bfd_section_vma (section); if (pc < vma) return; - size = bfd_get_section_size (section); + size = bfd_section_size (section); if (pc >= vma + size) return; diff --git a/binutils/rdcoff.c b/binutils/rdcoff.c index cbb5db1b94b..006f13b3aa0 100644 --- a/binutils/rdcoff.c +++ b/binutils/rdcoff.c @@ -816,7 +816,7 @@ parse_coff (bfd *abfd, asymbol **syms, long symcount, void *dhandle) else base = auxent.x_sym.x_misc.x_lnsz.x_lnno - 1; - addr = bfd_get_section_vma (abfd, bfd_asymbol_section (sym)); + addr = bfd_section_vma (bfd_asymbol_section (sym)); ++linenos; diff --git a/binutils/rddbg.c b/binutils/rddbg.c index 92052783ba9..eb8ffcbc025 100644 --- a/binutils/rddbg.c +++ b/binutils/rddbg.c @@ -121,7 +121,7 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount, bfd_byte *stab; bfd_size_type stroff, next_stroff; - stabsize = bfd_section_size (abfd, sec); + stabsize = bfd_section_size (sec); stabs = (bfd_byte *) xmalloc (stabsize); if (! bfd_get_section_contents (abfd, sec, stabs, 0, stabsize)) { @@ -133,7 +133,7 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount, return FALSE; } - strsize = bfd_section_size (abfd, strsec); + strsize = bfd_section_size (strsec); strings = (bfd_byte *) xmalloc (strsize + 1); if (! bfd_get_section_contents (abfd, strsec, strings, 0, strsize)) { diff --git a/binutils/rescoff.c b/binutils/rescoff.c index 815f0a17336..9a0fcda2ac6 100644 --- a/binutils/rescoff.c +++ b/binutils/rescoff.c @@ -141,7 +141,7 @@ read_coff_rsrc (const char *filename, const char *target) } set_windres_bfd (&wrbfd, abfd, sec, WR_KIND_BFD); - size = bfd_section_size (abfd, sec); + size = bfd_section_size (sec); /* PR 17512: file: 1b25ba5d The call to get_file_size here may be expensive but there is no other way to determine if the section size @@ -155,8 +155,8 @@ read_coff_rsrc (const char *filename, const char *target) flaginfo.filename = filename; flaginfo.data = data; flaginfo.data_end = data + size; - flaginfo.secaddr = (bfd_get_section_vma (abfd, sec) - - pe_data (abfd)->pe_opthdr.ImageBase); + flaginfo.secaddr = (bfd_section_vma (sec) + - pe_data (abfd)->pe_opthdr.ImageBase); /* Now just read in the top level resource directory. Note that we don't free data, since we create resource entries that point into @@ -547,7 +547,7 @@ write_coff_file (const char *filename, const char *target, + cwi.dataentsize + cwi.resources.length); - if (! bfd_set_section_size (abfd, sec, length)) + if (!bfd_set_section_size (sec, length)) bfd_fatal ("bfd_set_section_size"); bfd_set_reloc (abfd, sec, cwi.relocs, cwi.reloc_count); diff --git a/binutils/resres.c b/binutils/resres.c index e9444bda0e1..161ea354fec 100644 --- a/binutils/resres.c +++ b/binutils/resres.c @@ -142,7 +142,7 @@ write_res_file (const char *fn,const rc_res_directory *resdir) sec_length = write_res_directory ((windres_bfd *) NULL, 0x20UL, resdir, (const rc_res_id *) NULL, (const rc_res_id *) NULL, &language, 1); - if (! bfd_set_section_size (abfd, sec, (sec_length + 3) & ~3)) + if (!bfd_set_section_size (sec, (sec_length + 3) & ~3)) bfd_fatal ("bfd_set_section_size"); if ((sec_length & 3) != 0) set_windres_bfd_content (&wrbfd, sign, sec_length, 4-(sec_length & 3)); diff --git a/binutils/size.c b/binutils/size.c index 479a4648877..b147221e916 100644 --- a/binutils/size.c +++ b/binutils/size.c @@ -478,11 +478,11 @@ berkeley_or_gnu_sum (bfd *abfd ATTRIBUTE_UNUSED, sec_ptr sec, flagword flags; bfd_size_type size; - flags = bfd_get_section_flags (abfd, sec); + flags = bfd_section_flags (sec); if ((flags & SEC_ALLOC) == 0) return; - size = bfd_get_section_size (sec); + size = bfd_section_size (sec); if ((flags & SEC_CODE) != 0 || (selected_output_format == FORMAT_BERKLEY && (flags & SEC_READONLY) != 0)) @@ -557,21 +557,21 @@ static void sysv_internal_sizer (bfd *file ATTRIBUTE_UNUSED, sec_ptr sec, void *ignore ATTRIBUTE_UNUSED) { - bfd_size_type size = bfd_section_size (file, sec); + bfd_size_type size = bfd_section_size (sec); if ( ! bfd_is_abs_section (sec) && ! bfd_is_com_section (sec) && ! bfd_is_und_section (sec)) { - int namelen = strlen (bfd_section_name (file, sec)); + int namelen = strlen (bfd_section_name (sec)); if (namelen > svi_namelen) svi_namelen = namelen; svi_total += size; - if (bfd_section_vma (file, sec) > svi_maxvma) - svi_maxvma = bfd_section_vma (file, sec); + if (bfd_section_vma (sec) > svi_maxvma) + svi_maxvma = bfd_section_vma (sec); } } @@ -589,7 +589,7 @@ static void sysv_internal_printer (bfd *file ATTRIBUTE_UNUSED, sec_ptr sec, void *ignore ATTRIBUTE_UNUSED) { - bfd_size_type size = bfd_section_size (file, sec); + bfd_size_type size = bfd_section_size (sec); if ( ! bfd_is_abs_section (sec) && ! bfd_is_com_section (sec) @@ -597,9 +597,9 @@ sysv_internal_printer (bfd *file ATTRIBUTE_UNUSED, sec_ptr sec, { svi_total += size; - sysv_one_line (bfd_section_name (file, sec), + sysv_one_line (bfd_section_name (sec), size, - bfd_section_vma (file, sec)); + bfd_section_vma (sec)); } } diff --git a/binutils/srconv.c b/binutils/srconv.c index 39c1a4f4e75..a421f642e0b 100644 --- a/binutils/srconv.c +++ b/binutils/srconv.c @@ -419,14 +419,14 @@ wr_ob (struct coff_ofile *p ATTRIBUTE_UNUSED, struct coff_section *section) unsigned char stuff[200]; i = 0; - while (i < bfd_get_section_size (section->bfd_section)) + while (i < bfd_section_size (section->bfd_section)) { struct IT_ob ob; int todo = 200; /* Copy in 200 byte lumps. */ ob.spare = 0; - if (i + todo > bfd_get_section_size (section->bfd_section)) - todo = bfd_get_section_size (section->bfd_section) - i; + if (i + todo > bfd_section_size (section->bfd_section)) + todo = bfd_section_size (section->bfd_section) - i; if (first) { diff --git a/binutils/strings.c b/binutils/strings.c index ea48f92feba..8150c1181df 100644 --- a/binutils/strings.c +++ b/binutils/strings.c @@ -332,7 +332,7 @@ strings_a_section (bfd *abfd, asection *sect, const char *filename, if ((sect->flags & DATA_FLAGS) != DATA_FLAGS) return; - sectsize = bfd_get_section_size (sect); + sectsize = bfd_section_size (sect); if (sectsize == 0) return; diff --git a/binutils/windmc.c b/binutils/windmc.c index eaf4d6e4e1b..10bd6144c69 100644 --- a/binutils/windmc.c +++ b/binutils/windmc.c @@ -698,7 +698,7 @@ windmc_write_bin (const char *filename, mc_node_lang **nl, int elems) dta_off += mi[i].res_len; } sec_length = (dta_off + 3) & ~3; - if (! bfd_set_section_size (mc_bfd.abfd, mc_bfd.sec, sec_length)) + if (!bfd_set_section_size (mc_bfd.sec, sec_length)) bfd_fatal ("bfd_set_section_size"); /* Make sure we write the complete block. */ set_windmc_bfd_content ("\0", sec_length - 1, 1); diff --git a/gas/ChangeLog b/gas/ChangeLog index 3d61530a9b3..819585d9e31 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,33 @@ 2019-09-18 Alan Modra <amodra@gmail.com> + * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, + * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, + * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, + * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, + * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, + * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, + * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, + * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, + * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, + * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, + * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, + * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, + * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, + * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, + * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, + * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, + * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, + * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, + * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, + * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, + * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, + * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, + * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for + bfd section macro and function changes. + * write.c (compress_debug): Use bfd_rename_section. + +2019-09-18 Alan Modra <amodra@gmail.com> + * symbols.c (S_IS_LOCAL): Update bfd_get_section to bfd_asymbol_section. @@ -1147,13 +1147,13 @@ perform_an_assembly_pass (int argc, char ** argv) /* @@ FIXME -- we're setting the RELOC flag so that sections are assumed to have relocs, otherwise we don't find out in time. */ applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, text_section, + bfd_set_section_flags (text_section, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_READONLY)); - bfd_set_section_flags (stdoutput, data_section, + bfd_set_section_flags (data_section, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA)); - bfd_set_section_flags (stdoutput, bss_section, applicable & SEC_ALLOC); + bfd_set_section_flags (bss_section, applicable & SEC_ALLOC); seg_info (bss_section)->bss = 1; #endif subseg_new (BFD_ABS_SECTION_NAME, 0); @@ -1360,7 +1360,7 @@ main (int argc, char ** argv) segT gnustack; gnustack = subseg_new (".note.GNU-stack", 0); - bfd_set_section_flags (stdoutput, gnustack, + bfd_set_section_flags (gnustack, SEC_READONLY | (flag_execstack ? SEC_CODE : 0)); } @@ -226,7 +226,7 @@ COMMON subsegT now_subseg; /* Segment our instructions emit to. */ COMMON segT now_seg; -#define segment_name(SEG) bfd_get_section_name (stdoutput, SEG) +#define segment_name(SEG) bfd_section_name (SEG) extern segT reg_section, expr_section; /* Shouldn't these be eliminated someday? */ diff --git a/gas/config/obj-coff-seh.c b/gas/config/obj-coff-seh.c index 183be7925fc..b24e435677b 100644 --- a/gas/config/obj-coff-seh.c +++ b/gas/config/obj-coff-seh.c @@ -48,7 +48,7 @@ get_pxdata_name (segT seg, const char *base_name) const char *name,*dollar, *dot; char *sname; - name = bfd_get_section_name (stdoutput, seg); + name = bfd_section_name (seg); dollar = strchr (name, '$'); dot = strchr (name + 1, '.'); @@ -95,16 +95,16 @@ make_pxdata_seg (segT cseg, char *name) r = subseg_new (name, 0); /* Check if code segment is marked as linked once. */ - flags = bfd_get_section_flags (stdoutput, cseg) - & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD - | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE - | SEC_LINK_DUPLICATES_SAME_CONTENTS); + flags = (bfd_section_flags (cseg) + & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD + | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE + | SEC_LINK_DUPLICATES_SAME_CONTENTS)); /* Add standard section flags. */ flags |= SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA; /* Apply possibly linked once flags to new generated segment, too. */ - if (!bfd_set_section_flags (stdoutput, r, flags)) + if (!bfd_set_section_flags (r, flags)) as_bad (_("bfd_set_section_flags: %s"), bfd_errmsg (bfd_get_error ())); @@ -161,8 +161,8 @@ seh_validate_seg (const char *directive) const char *cseg_name, *nseg_name; if (seh_ctx_cur->code_seg == now_seg) return 1; - cseg_name = bfd_get_section_name (stdoutput, seh_ctx_cur->code_seg); - nseg_name = bfd_get_section_name (stdoutput, now_seg); + cseg_name = bfd_section_name (seh_ctx_cur->code_seg); + nseg_name = bfd_section_name (now_seg); as_bad (_("%s used in segment '%s' instead of expected '%s'"), directive, nseg_name, cseg_name); ignore_rest_of_line (); diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index c4e1d71ce4e..d1dd0f0131a 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -205,13 +205,12 @@ obj_coff_common_parse (int ignore ATTRIBUTE_UNUSED, symbolS *symbolP, addressT s char numbuff[20]; sec = subseg_new (".drectve", 0); - oldflags = bfd_get_section_flags (stdoutput, sec); + oldflags = bfd_section_flags (sec); if (oldflags == SEC_NO_FLAGS) { - if (!bfd_set_section_flags (stdoutput, sec, - TC_COFF_SECTION_DEFAULT_ATTRIBUTES)) + if (!bfd_set_section_flags (sec, TC_COFF_SECTION_DEFAULT_ATTRIBUTES)) as_warn (_("error setting flags for \"%s\": %s"), - bfd_section_name (stdoutput, sec), + bfd_section_name (sec), bfd_errmsg (bfd_get_error ())); } @@ -554,7 +553,7 @@ obj_coff_ident (int ignore ATTRIBUTE_UNUSED) that shouldn't be loaded into memory, which requires linker changes... For now, until proven otherwise, use .rdata. */ sec = subseg_new (".rdata$zzz", 0); - bfd_set_section_flags (stdoutput, sec, + bfd_set_section_flags (sec, ((SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA) & bfd_applicable_section_flags (stdoutput))); } @@ -774,8 +773,7 @@ obj_coff_endef (int ignore ATTRIBUTE_UNUSED) if (S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_EFCN || S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_LABEL - || (streq (bfd_get_section_name (stdoutput, - S_GET_SEGMENT (def_symbol_in_progress)), + || (streq (bfd_section_name (S_GET_SEGMENT (def_symbol_in_progress)), "*DEBUG*") && !SF_GET_TAG (def_symbol_in_progress)) || S_GET_SEGMENT (def_symbol_in_progress) == absolute_section @@ -1480,7 +1478,7 @@ coff_adjust_section_syms (bfd *abfd ATTRIBUTE_UNUSED, fixp = fixp->fx_next; } } - if (bfd_get_section_size (sec) == 0 + if (bfd_section_size (sec) == 0 && nrelocs == 0 && nlnno == 0 && sec != text_section @@ -1657,7 +1655,7 @@ obj_coff_section (int ignore ATTRIBUTE_UNUSED) if (alignment >= 0) sec->alignment_power = alignment; - oldflags = bfd_get_section_flags (stdoutput, sec); + oldflags = bfd_section_flags (sec); if (oldflags == SEC_NO_FLAGS) { /* Set section flags for a new section just created by subseg_new. @@ -1673,9 +1671,9 @@ obj_coff_section (int ignore ATTRIBUTE_UNUSED) flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; #endif - if (! bfd_set_section_flags (stdoutput, sec, flags)) + if (!bfd_set_section_flags (sec, flags)) as_warn (_("error setting flags for \"%s\": %s"), - bfd_section_name (stdoutput, sec), + bfd_section_name (sec), bfd_errmsg (bfd_get_error ())); } else if (flags != SEC_NO_FLAGS) @@ -1713,7 +1711,7 @@ coff_frob_section (segT sec) supposedly because standard COFF has no other way of encoding alignment for sections. If your COFF flavor has a different way of encoding section alignment, then skip this step, as TICOFF does. */ - bfd_vma size = bfd_get_section_size (sec); + bfd_vma size = bfd_section_size (sec); #if !defined(TICOFF) bfd_vma align_power = (bfd_vma) sec->alignment_power + OCTETS_PER_BYTE_POWER; bfd_vma mask = ((bfd_vma) 1 << align_power) - 1; @@ -1724,7 +1722,7 @@ coff_frob_section (segT sec) fragS *last; new_size = (size + mask) & ~mask; - bfd_set_section_size (stdoutput, sec, new_size); + bfd_set_section_size (sec, new_size); /* If the size had to be rounded up, add some padding in the last non-empty frag. */ @@ -1751,7 +1749,7 @@ coff_frob_section (segT sec) unsigned char sclass = C_STAT; #ifdef OBJ_XCOFF - if (bfd_get_section_flags (stdoutput, sec) & SEC_DEBUGGING) + if (bfd_section_flags (sec) & SEC_DEBUGGING) sclass = C_DWARF; #endif S_SET_STORAGE_CLASS (secsym, sclass); @@ -1772,9 +1770,9 @@ coff_frob_section (segT sec) strsec = sec; sec = subseg_get (STAB_SECTION_NAME, 0); /* size is already rounded up, since other section will be listed first */ - size = bfd_get_section_size (strsec); + size = bfd_section_size (strsec); - n_entries = bfd_get_section_size (sec) / 12 - 1; + n_entries = bfd_section_size (sec) / 12 - 1; /* Find first non-empty frag. It should be large enough. */ fragp = seg_info (sec)->frchainP->frch_root; diff --git a/gas/config/obj-ecoff.c b/gas/config/obj-ecoff.c index b62176fe73c..a5616f388e8 100644 --- a/gas/config/obj-ecoff.c +++ b/gas/config/obj-ecoff.c @@ -90,15 +90,15 @@ ecoff_frob_file_before_fix (void) } if (i == n_names) { - bfd_set_section_vma (stdoutput, sec, addr); - addr += bfd_section_size (stdoutput, sec); + bfd_set_section_vma (sec, addr); + addr += bfd_section_size (sec); } } for (i = 0; i < n_names; i++) if (secs[i]) { - bfd_set_section_vma (stdoutput, secs[i], addr); - addr += bfd_section_size (stdoutput, secs[i]); + bfd_set_section_vma (secs[i], addr); + addr += bfd_section_size (secs[i]); } for (i = n_names - 1; i >= 0; i--) if (secs[i]) diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index bdf3da81199..56293584a0a 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -737,7 +737,7 @@ obj_elf_change_section (const char *name, if (type == SHT_NOBITS) seg_info (sec)->bss = 1; - bfd_set_section_flags (stdoutput, sec, flags); + bfd_set_section_flags (sec, flags); if (flags & SEC_MERGE) sec->entsize = entsize; elf_group_name (sec) = group_name; @@ -1859,9 +1859,7 @@ obj_elf_version (int ignore ATTRIBUTE_UNUSED) /* Create the .note section. */ note_secp = subseg_new (".note", 0); - bfd_set_section_flags (stdoutput, - note_secp, - SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_flags (note_secp, SEC_HAS_CONTENTS | SEC_READONLY); record_alignment (note_secp, 2); /* Process the version string. */ @@ -2140,9 +2138,8 @@ obj_elf_ident (int ignore ATTRIBUTE_UNUSED) { char *p; comment_section = subseg_new (".comment", 0); - bfd_set_section_flags (stdoutput, comment_section, - SEC_READONLY | SEC_HAS_CONTENTS - | SEC_MERGE | SEC_STRINGS); + bfd_set_section_flags (comment_section, (SEC_READONLY | SEC_HAS_CONTENTS + | SEC_MERGE | SEC_STRINGS)); comment_section->entsize = 1; #ifdef md_elf_section_change_hook md_elf_section_change_hook (); @@ -2170,7 +2167,7 @@ obj_elf_init_stab_section (segT seg) /* Force the section to align to a longword boundary. Without this, UnixWare ar crashes. */ - bfd_set_section_alignment (stdoutput, seg, 2); + bfd_set_section_alignment (seg, 2); /* Make space for this first symbol. */ p = frag_more (12); @@ -2204,10 +2201,10 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) name = concat (sec->name, "str", NULL); strsec = bfd_get_section_by_name (abfd, name); if (strsec) - strsz = bfd_section_size (abfd, strsec); + strsz = bfd_section_size (strsec); else strsz = 0; - nsyms = bfd_section_size (abfd, sec) / 12 - 1; + nsyms = bfd_section_size (sec) / 12 - 1; p = seg_info (sec)->stabu.p; gas_assert (p != 0); @@ -2490,8 +2487,8 @@ elf_adjust_symtab (void) sec_name = ".group"; s = subseg_force_new (sec_name, 0); if (s == NULL - || !bfd_set_section_flags (stdoutput, s, flags) - || !bfd_set_section_alignment (stdoutput, s, 2)) + || !bfd_set_section_flags (s, flags) + || !bfd_set_section_alignment (s, 2)) { as_fatal (_("can't create group: %s"), bfd_errmsg (bfd_get_error ())); @@ -2598,7 +2595,7 @@ elf_frob_file_after_relocs (void) group = elf_sec_group (head); subseg_set (group, 0); - bfd_set_section_size (stdoutput, group, size); + bfd_set_section_size (group, size); group->contents = (unsigned char *) frag_more (size); frag_now->fr_fix = frag_now_fix_octets (); frag_wane (frag_now); @@ -2656,8 +2653,8 @@ elf_frob_file_after_relocs (void) to force the ELF backend to allocate a file position, and then write out the data. FIXME: Is this really the best way to do this? */ - bfd_set_section_size - (stdoutput, sec, bfd_ecoff_debug_size (stdoutput, &debug, debug_swap)); + bfd_set_section_size (sec, bfd_ecoff_debug_size (stdoutput, &debug, + debug_swap)); /* Pass BUF to bfd_set_section_contents because this will eventually become a call to fwrite, and ISO C prohibits diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c index 185949ee1fd..07c7831945e 100644 --- a/gas/config/obj-macho.c +++ b/gas/config/obj-macho.c @@ -227,7 +227,7 @@ obj_mach_o_make_or_get_sect (char * segname, char * sectname, /* Sub-segments don't exists as is on Mach-O. */ sec = subseg_new (name, 0); - oldflags = bfd_get_section_flags (stdoutput, sec); + oldflags = bfd_section_flags (sec); msect = bfd_mach_o_get_mach_o_section (sec); if (oldflags == SEC_NO_FLAGS) @@ -245,9 +245,9 @@ obj_mach_o_make_or_get_sect (char * segname, char * sectname, flags |= SEC_DEBUGGING; /* New, so just use the defaults or what's specified. */ - if (! bfd_set_section_flags (stdoutput, sec, flags)) + if (!bfd_set_section_flags (sec, flags)) as_warn (_("failed to set flags for \"%s\": %s"), - bfd_section_name (stdoutput, sec), + bfd_section_name (sec), bfd_errmsg (bfd_get_error ())); strncpy (msect->segname, segname, BFD_MACH_O_SEGNAME_SIZE); @@ -1697,7 +1697,7 @@ static void obj_mach_o_set_section_vma (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *v_p) { bfd_mach_o_section *ms = bfd_mach_o_get_mach_o_section (sec); - unsigned bfd_align = bfd_get_section_alignment (abfd, sec); + unsigned bfd_align = bfd_section_alignment (sec); obj_mach_o_set_vma_data *p = (struct obj_mach_o_set_vma_data *)v_p; unsigned sectype = (ms->flags & BFD_MACH_O_SECTION_TYPE_MASK); unsigned zf; @@ -1719,16 +1719,16 @@ obj_mach_o_set_section_vma (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *v_p /* We know the section size now - so make a vma for the section just based on order. */ - ms->size = bfd_get_section_size (sec); + ms->size = bfd_section_size (sec); /* Make sure that the align agrees, and set to the largest value chosen. */ ms->align = ms->align > bfd_align ? ms->align : bfd_align; - bfd_set_section_alignment (abfd, sec, ms->align); + bfd_set_section_alignment (sec, ms->align); p->vma += (1 << ms->align) - 1; p->vma &= ~((1 << ms->align) - 1); ms->addr = p->vma; - bfd_set_section_vma (abfd, sec, p->vma); + bfd_set_section_vma (sec, p->vma); p->vma += ms->size; } @@ -1752,7 +1752,7 @@ static void obj_mach_o_set_indirect_symbols (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) { - bfd_vma sect_size = bfd_section_size (abfd, sec); + bfd_vma sect_size = bfd_section_size (sec); bfd_mach_o_section *ms = bfd_mach_o_get_mach_o_section (sec); unsigned lazy = 0; diff --git a/gas/config/obj-som.c b/gas/config/obj-som.c index edd49dc7f19..20213b8b327 100644 --- a/gas/config/obj-som.c +++ b/gas/config/obj-som.c @@ -224,14 +224,14 @@ obj_som_init_stab_section (segT seg) of the various stabs spaces/subspaces need to be "small". We reserve range 72/73 which appear to work well. */ obj_set_section_attributes (space, 1, 1, 72, 2); - bfd_set_section_alignment (stdoutput, space, 2); + bfd_set_section_alignment (space, 2); /* Set the containing space for both stab sections to be $GDB_DEBUG$ (just created above). Also set some attributes which BFD does not understand. In particular, access bits, sort keys, and load quadrant. */ obj_set_subsection_attributes (seg, space, 0x1f, 73, 0, 0, 0, 0); - bfd_set_section_alignment (stdoutput, seg, 2); + bfd_set_section_alignment (seg, 2); /* Make some space for the first special stab entry and zero the memory. It contains information about the length of this file's @@ -254,7 +254,7 @@ obj_som_init_stab_section (segT seg) quadrant. */ seg = bfd_get_section_by_name (stdoutput, "$GDB_STRINGS$"); obj_set_subsection_attributes (seg, space, 0x1f, 72, 0, 0, 0, 0); - bfd_set_section_alignment (stdoutput, seg, 2); + bfd_set_section_alignment (seg, 2); subseg_set (saved_seg, saved_subseg); } @@ -273,10 +273,10 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) strsec = bfd_get_section_by_name (abfd, "$GDB_STRINGS$"); if (strsec) - strsz = bfd_section_size (abfd, strsec); + strsz = bfd_section_size (strsec); else strsz = 0; - nsyms = bfd_section_size (abfd, sec) / 12 - 1; + nsyms = bfd_section_size (sec) / 12 - 1; p = seg_info (sec)->stabu.p; gas_assert (p != 0); diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 735ecd60735..522efebfe42 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -7363,7 +7363,7 @@ aarch64_init_frag (fragS * fragP, int max_chars) /* PR 21809: Do not set a mapping state for debug sections - it just confuses other tools. */ - if (bfd_get_section_flags (NULL, now_seg) & SEC_DEBUGGING) + if (bfd_section_flags (now_seg) & SEC_DEBUGGING) return; switch (fragP->fr_type) diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index 7f800361574..70ceba02c16 100644 --- a/gas/config/tc-alpha.c +++ b/gas/config/tc-alpha.c @@ -1205,10 +1205,9 @@ create_literal_section (const char *name, *secp = new_sec = subseg_new (name, 0); subseg_set (current_section, current_subsec); - bfd_set_section_alignment (stdoutput, new_sec, 4); - bfd_set_section_flags (stdoutput, new_sec, - SEC_RELOC | SEC_ALLOC | SEC_LOAD | SEC_READONLY - | SEC_DATA); + bfd_set_section_alignment (new_sec, 4); + bfd_set_section_flags (new_sec, (SEC_RELOC | SEC_ALLOC | SEC_LOAD + | SEC_READONLY | SEC_DATA)); S_CLEAR_EXTERNAL (*symp = section_symbol (new_sec)); } @@ -3985,8 +3984,8 @@ s_alpha_stab (int n) if (alpha_flag_mdebug < 0) { segT sec = subseg_new (".mdebug", 0); - bfd_set_section_flags (stdoutput, sec, SEC_HAS_CONTENTS | SEC_READONLY); - bfd_set_section_alignment (stdoutput, sec, 3); + bfd_set_section_flags (sec, SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_alignment (sec, 3); ecoff_read_begin_hook (); @@ -5301,7 +5300,7 @@ maybe_set_gp (asection *sec) if (!sec) return; - vma = bfd_get_section_vma (sec->owner, sec); + vma = bfd_section_vma (sec); if (vma && vma < alpha_gp_value) alpha_gp_value = vma; } @@ -5515,8 +5514,8 @@ md_begin (void) if (ECOFF_DEBUGGING) { segT sec = subseg_new (".mdebug", (subsegT) 0); - bfd_set_section_flags (stdoutput, sec, SEC_HAS_CONTENTS | SEC_READONLY); - bfd_set_section_alignment (stdoutput, sec, 3); + bfd_set_section_flags (sec, SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_alignment (sec, 3); } #endif @@ -5563,7 +5562,7 @@ md_assemble (char *str) valueT md_section_align (segT seg, valueT size) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); valueT mask = ((valueT) 1 << align) - 1; return (size + mask) & ~mask; diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index c1d5ea3d470..c73906b51bb 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -2706,7 +2706,7 @@ valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & (-((valueT) 1 << align))); } @@ -4529,8 +4529,7 @@ arc_set_ext_seg (void) if (!arcext_section) { arcext_section = subseg_new (".arcextmap", 0); - bfd_set_section_flags (stdoutput, arcext_section, - SEC_READONLY | SEC_HAS_CONTENTS); + bfd_set_section_flags (arcext_section, SEC_READONLY | SEC_HAS_CONTENTS); } else subseg_set (arcext_section, 0); diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 32a15f65ec8..b0f1507c360 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -22878,7 +22878,7 @@ arm_frob_label (symbolS * sym) out of the jump table, and chaos would ensue. */ if (label_is_thumb_function_name && (S_GET_NAME (sym)[0] != '.' || S_GET_NAME (sym)[1] != 'L') - && (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + && (bfd_section_flags (now_seg) & SEC_CODE) != 0) { /* When the address of a Thumb function is taken the bottom bit of that address should be set. This will allow @@ -26491,7 +26491,7 @@ arm_init_frag (fragS * fragP, int max_chars) /* PR 21809: Do not set a mapping state for debug sections - it just confuses other tools. */ - if (bfd_get_section_flags (NULL, now_seg) & SEC_DEBUGGING) + if (bfd_section_flags (now_seg) & SEC_DEBUGGING) return; frag_thumb_mode = fragP->tc_frag_data.thumb_mode ^ MODE_RECORDED; @@ -30019,9 +30019,8 @@ md_begin (void) if (sec != NULL) { - bfd_set_section_flags - (stdoutput, sec, SEC_READONLY | SEC_DEBUGGING /* | SEC_HAS_CONTENTS */); - bfd_set_section_size (stdoutput, sec, 0); + bfd_set_section_flags (sec, SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_size (sec, 0); bfd_set_section_contents (stdoutput, sec, NULL, 0, 0); } } diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c index df0833c761c..36262ad8c0d 100644 --- a/gas/config/tc-avr.c +++ b/gas/config/tc-avr.c @@ -1429,7 +1429,7 @@ avr_operands (struct avr_opcodes_s *opcode, char **line) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & (-1UL << align)); } @@ -2229,7 +2229,7 @@ avr_create_property_section (void) sec = bfd_make_section (stdoutput, section_name); if (sec == NULL) as_fatal (_("Failed to create property section `%s'\n"), section_name); - bfd_set_section_flags (stdoutput, sec, flags); + bfd_set_section_flags (sec, flags); sec->output_section = sec; return sec; } @@ -2404,7 +2404,7 @@ avr_create_and_fill_property_section (void) return; prop_sec = avr_create_property_section (); - bfd_set_section_size (stdoutput, prop_sec, sec_size); + bfd_set_section_size (prop_sec, sec_size); subseg_set (prop_sec, 0); frag_base = frag_more (sec_size); diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c index 104ab6aec9e..5f10cb7fb4c 100644 --- a/gas/config/tc-bfin.c +++ b/gas/config/tc-bfin.c @@ -789,7 +789,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) valueT md_section_align (segT segment, valueT size) { - int boundary = bfd_get_section_alignment (stdoutput, segment); + int boundary = bfd_section_alignment (segment); return ((size + (1 << boundary) - 1) & -(1 << boundary)); } diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c index d2da2feafb0..7c3bf2e718f 100644 --- a/gas/config/tc-bpf.c +++ b/gas/config/tc-bpf.c @@ -189,7 +189,7 @@ md_begin (void) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c index 9f6c82e1f94..2eb679bb442 100644 --- a/gas/config/tc-d10v.c +++ b/gas/config/tc-d10v.c @@ -268,7 +268,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c index 086215e306e..a54945e1f3b 100644 --- a/gas/config/tc-d30v.c +++ b/gas/config/tc-d30v.c @@ -302,7 +302,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } @@ -1490,7 +1490,7 @@ d30v_align (int n, char *pfill, symbolS *label) if (pfill == NULL) { if (n > 2 - && (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + && (bfd_section_flags (now_seg) & SEC_CODE) != 0) { static char const nop[4] = { 0x00, 0xf0, 0x00, 0x00 }; diff --git a/gas/config/tc-epiphany.c b/gas/config/tc-epiphany.c index 5429fa9fb5f..753cb6e0bf9 100644 --- a/gas/config/tc-epiphany.c +++ b/gas/config/tc-epiphany.c @@ -152,7 +152,7 @@ md_begin (void) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c index 3703e29ccc8..5767eeb6162 100644 --- a/gas/config/tc-fr30.c +++ b/gas/config/tc-fr30.c @@ -154,7 +154,7 @@ md_operand (expressionS * expressionP) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c index 3112fce4f21..d8ff553294c 100644 --- a/gas/config/tc-frv.c +++ b/gas/config/tc-frv.c @@ -1225,7 +1225,7 @@ md_operand (expressionS *expressionP) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } @@ -1651,7 +1651,7 @@ frv_frob_file_section (bfd *abfd, asection *sec, void *ptr ATTRIBUTE_UNUSED) segment_info_type *seginfo = seg_info (sec); fixS *fixp; CGEN_CPU_DESC cd = gas_cgen_cpu_desc; - flagword flags = bfd_get_section_flags (abfd, sec); + flagword flags = bfd_section_flags (sec); /* Skip relocations in known sections (.ctors, .dtors, and .gcc_except_table) since we can fix those up by hand. */ diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c index 5ddc889a4da..c79c6d42255 100644 --- a/gas/config/tc-h8300.c +++ b/gas/config/tc-h8300.c @@ -2225,7 +2225,7 @@ md_convert_frag (bfd *headers ATTRIBUTE_UNUSED, valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & (-1U << align)); } diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index 82c71ebbfc5..fb6d82bc596 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -1608,7 +1608,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, valueT md_section_align (asection *segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); int align2 = (1 << align) - 1; return (size + align2) & ~align2; @@ -5962,7 +5962,7 @@ pa_build_unwind_subspace (struct call_info *call_info) char *name, *p; symbolS *symbolP; - if ((bfd_get_section_flags (stdoutput, now_seg) + if ((bfd_section_flags (now_seg) & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) != (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) return; @@ -6006,10 +6006,9 @@ pa_build_unwind_subspace (struct call_info *call_info) if (seg == ASEC_NULL) { seg = subseg_new (UNWIND_SECTION_NAME, 0); - bfd_set_section_flags (stdoutput, seg, - SEC_READONLY | SEC_HAS_CONTENTS - | SEC_LOAD | SEC_RELOC | SEC_ALLOC | SEC_DATA); - bfd_set_section_alignment (stdoutput, seg, 2); + bfd_set_section_flags (seg, (SEC_READONLY | SEC_HAS_CONTENTS | SEC_LOAD + | SEC_RELOC | SEC_ALLOC | SEC_DATA)); + bfd_set_section_alignment (seg, 2); } subseg_set (seg, 0); @@ -7533,14 +7532,13 @@ pa_subspace (int create_new) seg_info (section)->bss = 1; /* Now set the flags. */ - bfd_set_section_flags (stdoutput, section, applicable); + bfd_set_section_flags (section, applicable); /* Record any alignment request for this section. */ record_alignment (section, exact_log2 (alignment)); /* Set the starting offset for this section. */ - bfd_set_section_vma (stdoutput, section, - pa_subspace_start (space, quadrant)); + bfd_set_section_vma (section, pa_subspace_start (space, quadrant)); /* Now that all the flags are set, update an existing subspace, or create a new one. */ @@ -7614,7 +7612,7 @@ pa_spaces_begin (void) { text_section = segment; applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, segment, + bfd_set_section_flags (segment, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_READONLY @@ -7624,7 +7622,7 @@ pa_spaces_begin (void) { data_section = segment; applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, segment, + bfd_set_section_flags (segment, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_HAS_CONTENTS)); @@ -7634,13 +7632,13 @@ pa_spaces_begin (void) { bss_section = segment; applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, segment, + bfd_set_section_flags (segment, applicable & SEC_ALLOC); } else if (!strcmp (pa_def_subspaces[i].name, "$LIT$")) { applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, segment, + bfd_set_section_flags (segment, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY @@ -7649,7 +7647,7 @@ pa_spaces_begin (void) else if (!strcmp (pa_def_subspaces[i].name, "$MILLICODE$")) { applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, segment, + bfd_set_section_flags (segment, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY @@ -7658,7 +7656,7 @@ pa_spaces_begin (void) else if (!strcmp (pa_def_subspaces[i].name, "$UNWIND$")) { applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, segment, + bfd_set_section_flags (segment, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 2710dcec724..fec69c1397d 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -8105,7 +8105,7 @@ x86_cleanup (void) /* Create the .note.gnu.property section. */ sec = subseg_new (NOTE_GNU_PROPERTY_SECTION_NAME, 0); - bfd_set_section_flags (stdoutput, sec, + bfd_set_section_flags (sec, (SEC_ALLOC | SEC_LOAD | SEC_DATA @@ -8123,7 +8123,7 @@ x86_cleanup (void) alignment = 2; } - bfd_set_section_alignment (stdoutput, sec, alignment); + bfd_set_section_alignment (sec, alignment); elf_section_type (sec) = SHT_NOTE; /* GNU_PROPERTY_X86_ISA_1_USED: 4-byte type + 4-byte data size @@ -11939,7 +11939,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED, valueT size) work. */ int align; - align = bfd_get_section_alignment (stdoutput, segment); + align = bfd_section_alignment (segment); size = ((size + (1 << align) - 1) & (-((valueT) 1 << align))); } #endif @@ -12382,8 +12382,7 @@ handle_large_common (int small ATTRIBUTE_UNUSED) /* The .lbss section is for local .largecomm symbols. */ lbss_section = subseg_new (".lbss", 0); applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, lbss_section, - applicable & SEC_ALLOC); + bfd_set_section_flags (lbss_section, applicable & SEC_ALLOC); seg_info (lbss_section)->bss = 1; subseg_set (seg, subseg); diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index 8f25e557e09..0c618e811ee 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -1152,14 +1152,14 @@ obj_elf_vms_common (int ignore ATTRIBUTE_UNUSED) record_alignment (now_seg, log_align); - cur_size = bfd_section_size (stdoutput, now_seg); + cur_size = bfd_section_size (now_seg); if ((int) size > cur_size) { char *pfrag = frag_var (rs_fill, 1, 1, (relax_substateT)0, NULL, (valueT)size - (valueT)cur_size, NULL); *pfrag = 0; - bfd_section_size (stdoutput, now_seg) = size; + bfd_set_section_size (now_seg, size); } /* Switch back to current segment. */ @@ -3606,8 +3606,7 @@ start_unwind_section (const segT text_seg, int sec_index) else { set_section (sec_name); - bfd_set_section_flags (stdoutput, now_seg, - SEC_LOAD | SEC_ALLOC | SEC_READONLY); + bfd_set_section_flags (now_seg, SEC_LOAD | SEC_ALLOC | SEC_READONLY); } elf_linked_to_section (now_seg) = text_seg; @@ -7250,7 +7249,7 @@ md_begin (void) md.auto_align = 1; md.explicit_mode = md.default_explicit_mode; - bfd_set_section_alignment (stdoutput, text_section, 4); + bfd_set_section_alignment (text_section, 4); /* Make sure function pointers get initialized. */ target_big_endian = -1; @@ -7778,7 +7777,7 @@ ia64_frob_label (struct symbol *sym) return; } - if (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) + if (bfd_section_flags (now_seg) & SEC_CODE) { md.last_text_seg = now_seg; fix = XOBNEW (¬es, struct label_fix); @@ -7818,7 +7817,7 @@ void ia64_flush_pending_output (void) { if (!md.keep_pending_output - && bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) + && bfd_section_flags (now_seg) & SEC_CODE) { /* ??? This causes many unnecessary stop bits to be emitted. Unfortunately, it isn't clear if it is safe to remove this. */ @@ -10989,7 +10988,7 @@ ia64_pcrel_from_section (fixS *fix, segT sec) { unsigned long off = fix->fx_frag->fr_address + fix->fx_where; - if (bfd_get_section_flags (stdoutput, sec) & SEC_CODE) + if (bfd_section_flags (sec) & SEC_CODE) off &= ~0xfUL; return off; @@ -11946,9 +11945,7 @@ ia64_vms_note (void) /* Create the .note section. */ secp = subseg_new (".note", 0); - bfd_set_section_flags (stdoutput, - secp, - SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_flags (secp, SEC_HAS_CONTENTS | SEC_READONLY); /* Module header note (MHD). */ bname = xstrdup (lbasename (out_file_name)); @@ -11993,9 +11990,7 @@ ia64_vms_note (void) frag_align (3, 0, 0); secp = subseg_new (".vms_display_name_info", 0); - bfd_set_section_flags (stdoutput, - secp, - SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_flags (secp, SEC_HAS_CONTENTS | SEC_READONLY); /* This symbol should be passed on the command line and be variable according to language. */ diff --git a/gas/config/tc-ip2k.c b/gas/config/tc-ip2k.c index 0fcc0003d19..53b4d88f111 100644 --- a/gas/config/tc-ip2k.c +++ b/gas/config/tc-ip2k.c @@ -213,7 +213,7 @@ md_assemble (char * str) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c index 3275d301f7c..d2a0c598483 100644 --- a/gas/config/tc-iq2000.c +++ b/gas/config/tc-iq2000.c @@ -430,7 +430,7 @@ md_assemble (char * str) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } @@ -817,7 +817,7 @@ s_iq2000_end (int x ATTRIBUTE_UNUSED) else p = NULL; - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; @@ -916,7 +916,7 @@ s_iq2000_ent (int aent) if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-') get_number (); - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; diff --git a/gas/config/tc-lm32.c b/gas/config/tc-lm32.c index a547ba9b5b0..75a733a6f22 100644 --- a/gas/config/tc-lm32.c +++ b/gas/config/tc-lm32.c @@ -277,7 +277,7 @@ md_undefined_symbol (char * name ATTRIBUTE_UNUSED) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-m32c.c b/gas/config/tc-m32c.c index 851d4c1971a..3ea3e599740 100644 --- a/gas/config/tc-m32c.c +++ b/gas/config/tc-m32c.c @@ -392,7 +392,7 @@ md_operand (expressionS * exp) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c index c20cb72ce17..75ee9d93ded 100644 --- a/gas/config/tc-m32r.c +++ b/gas/config/tc-m32r.c @@ -713,7 +713,7 @@ md_begin (void) /* This is copied from perform_an_assembly_pass. */ applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, sbss_section, applicable & SEC_ALLOC); + bfd_set_section_flags (sbss_section, applicable & SEC_ALLOC); subseg_set (seg, subseg); @@ -1448,7 +1448,7 @@ md_operand (expressionS *expressionP) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c index 11514963bc8..1c36d5d98cb 100644 --- a/gas/config/tc-m68hc11.c +++ b/gas/config/tc-m68hc11.c @@ -583,7 +583,7 @@ md_atof (int type, char *litP, int *sizeP) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-mep.c b/gas/config/tc-mep.c index f53bb170223..c0d48e83543 100644 --- a/gas/config/tc-mep.c +++ b/gas/config/tc-mep.c @@ -1380,7 +1380,7 @@ md_assemble (char * str) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } @@ -1528,7 +1528,7 @@ md_estimate_size_before_relax (fragS * fragP, segT segment) || S_IS_WEAK (fragP->fr_symbol) #ifdef MEP_IVC2_SUPPORTED || (mep_cop == EF_MEP_COP_IVC2 - && bfd_get_section_flags (stdoutput, segment) & SEC_MEP_VLIW) + && bfd_section_flags (segment) & SEC_MEP_VLIW) #endif /* MEP_IVC2_SUPPORTED */ ) { @@ -1539,7 +1539,7 @@ md_estimate_size_before_relax (fragS * fragP, segT segment) } if (MEP_VLIW && ! MEP_VLIW64 - && (bfd_get_section_flags (stdoutput, segment) & SEC_MEP_VLIW)) + && (bfd_section_flags (segment) & SEC_MEP_VLIW)) { /* Use 32 bit branches for vliw32 so the vliw word is not split. */ switch (fragP->fr_cgen.insn->base->num) @@ -1572,7 +1572,7 @@ md_estimate_size_before_relax (fragS * fragP, segT segment) #ifdef MEP_IVC2_SUPPORTED if (mep_cop == EF_MEP_COP_IVC2 - && bfd_get_section_flags (stdoutput, segment) & SEC_MEP_VLIW) + && bfd_section_flags (segment) & SEC_MEP_VLIW) return 0; #endif /* MEP_IVC2_SUPPORTED */ @@ -1587,7 +1587,7 @@ mep_relax_frag (segT segment, fragS *fragP, long stretch) long rv = relax_frag (segment, fragP, stretch); #ifdef MEP_IVC2_SUPPORTED if (mep_cop == EF_MEP_COP_IVC2 - && bfd_get_section_flags (stdoutput, segment) & SEC_MEP_VLIW) + && bfd_section_flags (segment) & SEC_MEP_VLIW) return 0; #endif return rv; @@ -1624,7 +1624,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, int core_mode; #ifdef MEP_IVC2_SUPPORTED - if (bfd_get_section_flags (stdoutput, seg) & SEC_MEP_VLIW + if (bfd_section_flags (seg) & SEC_MEP_VLIW && mep_cop == EF_MEP_COP_IVC2) core_mode = 0; else @@ -2110,7 +2110,7 @@ mep_vtext_section (void) { flagword applicable = bfd_applicable_section_flags (stdoutput); vtext_section = subseg_new (VTEXT_SECTION_NAME, 0); - bfd_set_section_flags (stdoutput, vtext_section, + bfd_set_section_flags (vtext_section, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_READONLY | SEC_MEP_VLIW)); diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c index c9ab452b3e8..2f68d688ead 100644 --- a/gas/config/tc-microblaze.c +++ b/gas/config/tc-microblaze.c @@ -2011,8 +2011,7 @@ md_apply_fix (fixS * fixP, { if (S_IS_WEAK (fixP->fx_addsy) || (symbol_used_in_reloc_p (fixP->fx_addsy) - && (((bfd_get_section_flags (stdoutput, - S_GET_SEGMENT (fixP->fx_addsy)) + && (((bfd_section_flags (S_GET_SEGMENT (fixP->fx_addsy)) & SEC_LINK_ONCE) != 0) || !strncmp (segment_name (S_GET_SEGMENT (fixP->fx_addsy)), ".gnu.linkonce", diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index a386d11f6c2..b2e49730c0e 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -3859,9 +3859,9 @@ md_begin (void) if (strncmp (TARGET_OS, "elf", 3) != 0 && strncmp (TARGET_OS, "vxworks", 7) != 0) { - (void) bfd_set_section_alignment (stdoutput, text_section, 4); - (void) bfd_set_section_alignment (stdoutput, data_section, 4); - (void) bfd_set_section_alignment (stdoutput, bss_section, 4); + bfd_set_section_alignment (text_section, 4); + bfd_set_section_alignment (data_section, 4); + bfd_set_section_alignment (bss_section, 4); } /* Create a .reginfo section for register masks and a .mdebug @@ -3886,8 +3886,8 @@ md_begin (void) { sec = subseg_new (".reginfo", (subsegT) 0); - bfd_set_section_flags (stdoutput, sec, flags); - bfd_set_section_alignment (stdoutput, sec, HAVE_NEWABI ? 3 : 2); + bfd_set_section_flags (sec, flags); + bfd_set_section_alignment (sec, HAVE_NEWABI ? 3 : 2); mips_regmask_frag = frag_more (sizeof (Elf32_External_RegInfo)); } @@ -3896,8 +3896,8 @@ md_begin (void) /* The 64-bit ABI uses a .MIPS.options section rather than .reginfo section. */ sec = subseg_new (".MIPS.options", (subsegT) 0); - bfd_set_section_flags (stdoutput, sec, flags); - bfd_set_section_alignment (stdoutput, sec, 3); + bfd_set_section_flags (sec, flags); + bfd_set_section_alignment (sec, 3); /* Set up the option header. */ { @@ -3918,25 +3918,23 @@ md_begin (void) } sec = subseg_new (".MIPS.abiflags", (subsegT) 0); - bfd_set_section_flags (stdoutput, sec, + bfd_set_section_flags (sec, SEC_READONLY | SEC_DATA | SEC_ALLOC | SEC_LOAD); - bfd_set_section_alignment (stdoutput, sec, 3); + bfd_set_section_alignment (sec, 3); mips_flags_frag = frag_more (sizeof (Elf_External_ABIFlags_v0)); if (ECOFF_DEBUGGING) { sec = subseg_new (".mdebug", (subsegT) 0); - (void) bfd_set_section_flags (stdoutput, sec, - SEC_HAS_CONTENTS | SEC_READONLY); - (void) bfd_set_section_alignment (stdoutput, sec, 2); + bfd_set_section_flags (sec, SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_alignment (sec, 2); } else if (mips_flag_pdr) { pdr_seg = subseg_new (".pdr", (subsegT) 0); - (void) bfd_set_section_flags (stdoutput, pdr_seg, - SEC_READONLY | SEC_RELOC - | SEC_DEBUGGING); - (void) bfd_set_section_alignment (stdoutput, pdr_seg, 2); + bfd_set_section_flags (pdr_seg, + SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); + bfd_set_section_alignment (pdr_seg, 2); } subseg_set (seg, subseg); @@ -4468,7 +4466,7 @@ s_is_linkonce (symbolS *sym, segT from_seg) if (symseg != from_seg && !S_IS_LOCAL (sym)) { - if ((bfd_get_section_flags (stdoutput, symseg) & SEC_LINK_ONCE)) + if ((bfd_section_flags (symseg) & SEC_LINK_ONCE)) linkonce = TRUE; /* The GNU toolchain uses an extension for ELF: a section beginning with the magic string .gnu.linkonce is a @@ -6180,7 +6178,7 @@ match_float_constant (struct mips_arg_info *arg, expressionS *imm, } new_seg = subseg_new (newname, (subsegT) 0); - bfd_set_section_flags (stdoutput, new_seg, + bfd_set_section_flags (new_seg, SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA); frag_align (length == 4 ? 2 : 3, 0, 0); if (strncmp (TARGET_OS, "elf", 3) != 0) @@ -16128,7 +16126,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) && fixP->fx_done && fixP->fx_frag->fr_address >= text_section->vma && (fixP->fx_frag->fr_address - < text_section->vma + bfd_get_section_size (text_section)) + < text_section->vma + bfd_section_size (text_section)) && ((insn & 0xffff0000) == 0x10000000 /* beq $0,$0 */ || (insn & 0xffff0000) == 0x04010000 /* bgez $0 */ || (insn & 0xffff0000) == 0x04110000)) /* bgezal $0 */ @@ -16319,9 +16317,8 @@ s_change_sec (int sec) case 'r': seg = subseg_new (RDATA_SECTION_NAME, (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, (SEC_ALLOC | SEC_LOAD - | SEC_READONLY | SEC_RELOC - | SEC_DATA)); + bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY + | SEC_RELOC | SEC_DATA)); if (strncmp (TARGET_OS, "elf", 3) != 0) record_alignment (seg, 4); demand_empty_rest_of_line (); @@ -16329,7 +16326,7 @@ s_change_sec (int sec) case 's': seg = subseg_new (".sdata", (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, + bfd_set_section_flags (seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA); if (strncmp (TARGET_OS, "elf", 3) != 0) record_alignment (seg, 4); @@ -16338,7 +16335,7 @@ s_change_sec (int sec) case 'B': seg = subseg_new (".sbss", (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, SEC_ALLOC); + bfd_set_section_flags (seg, SEC_ALLOC); if (strncmp (TARGET_OS, "elf", 3) != 0) record_alignment (seg, 4); demand_empty_rest_of_line (); @@ -17603,7 +17600,7 @@ tc_get_register (int frame) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); /* We don't need to align ELF sections to the full alignment. However, Irix 5 may prefer that we align them at least to a 16 @@ -19760,7 +19757,7 @@ s_mips_end (int x ATTRIBUTE_UNUSED) else p = NULL; - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) == 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) == 0) as_warn (_(".end not in text section")); if (!cur_proc_ptr) @@ -19850,7 +19847,7 @@ s_mips_ent (int aent) || *input_line_pointer == '-') get_number (); - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) == 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) == 0) as_warn (_(".ent or .aent not in text section")); if (!aent && cur_proc_ptr) diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c index 317805923dc..1514b6d0607 100644 --- a/gas/config/tc-mmix.c +++ b/gas/config/tc-mmix.c @@ -2130,9 +2130,8 @@ s_bspec (int unused ATTRIBUTE_UNUSED) if (sec == NULL) as_fatal (_("can't create section %s"), newsecname); - if (!bfd_set_section_flags (stdoutput, sec, - bfd_get_section_flags (stdoutput, sec) - | SEC_READONLY)) + if (!bfd_set_section_flags (sec, + bfd_section_flags (sec) | SEC_READONLY)) as_fatal (_("can't set section flags for section %s"), newsecname); } @@ -2638,7 +2637,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) than just helping the user around this limitation here; hopefully the code using the local expression is around. Putting the LOCAL semantics in a relocation still seems right; a section didn't do. */ - if (bfd_section_size (section->owner, section) == 0) + if (bfd_section_size (section) == 0) as_bad_where (fixP->fx_file, fixP->fx_line, fixP->fx_r_type == BFD_RELOC_MMIX_LOCAL @@ -2708,7 +2707,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) resolve the relocation here. */ if (addsy != NULL && (bfd_is_und_section (addsec) - || strcmp (bfd_get_section_name (addsec->owner, addsec), + || strcmp (bfd_section_name (addsec), MMIX_REG_CONTENTS_SECTION_NAME) == 0)) { code = fixP->fx_r_type; @@ -2735,7 +2734,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) case BFD_RELOC_MMIX_BASE_PLUS_OFFSET: if (addsy != NULL - && strcmp (bfd_get_section_name (addsec->owner, addsec), + && strcmp (bfd_section_name (addsec), MMIX_REG_CONTENTS_SECTION_NAME) == 0) { /* This changed into a register; the relocation is for the @@ -2838,7 +2837,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) case BFD_RELOC_MMIX_REG: if (addsy != NULL && (bfd_is_und_section (addsec) - || strcmp (bfd_get_section_name (addsec->owner, addsec), + || strcmp (bfd_section_name (addsec), MMIX_REG_CONTENTS_SECTION_NAME) == 0)) { code = fixP->fx_r_type; @@ -3794,7 +3793,7 @@ mmix_frob_file (void) if (real_reg_section != NULL) { /* FIXME: Pass error state gracefully. */ - if (bfd_get_section_flags (stdoutput, real_reg_section) & SEC_HAS_CONTENTS) + if (bfd_section_flags (real_reg_section) & SEC_HAS_CONTENTS) as_fatal (_("register section has contents\n")); bfd_section_list_remove (stdoutput, real_reg_section); @@ -3924,7 +3923,7 @@ mmix_md_elf_section_change_hook (void) if (doing_bspec) as_bad (_("section change from within a BSPEC/ESPEC pair is not supported")); - last_alignment = bfd_get_section_alignment (now_seg->owner, now_seg); + last_alignment = bfd_section_alignment (now_seg); want_unaligned = 0; } diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c index 045016bcba0..ebc011b1a6d 100644 --- a/gas/config/tc-mn10200.c +++ b/gas/config/tc-mn10200.c @@ -675,7 +675,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index 15e6e27b244..1a41731379f 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -900,7 +900,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } @@ -2616,7 +2616,7 @@ mn10300_handle_align (fragS *frag) && now_seg != bss_section /* Do not create relocs for the merging sections - such relocs will prevent the contents from being merged. */ - && (bfd_get_section_flags (now_seg->owner, now_seg) & SEC_MERGE) == 0) + && (bfd_section_flags (now_seg) & SEC_MERGE) == 0) /* Create a new fixup to record the alignment request. The symbol is irrelevant but must be present so we use the absolute section symbol. The offset from the symbol is used to record the power-of-two alignment diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c index 5821b1c8110..56d20243499 100644 --- a/gas/config/tc-msp430.c +++ b/gas/config/tc-msp430.c @@ -4239,7 +4239,7 @@ md_assemble (char * str) valueT md_section_align (asection * seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-mt.c b/gas/config/tc-mt.c index bd518547e31..5b938aa2a93 100644 --- a/gas/config/tc-mt.c +++ b/gas/config/tc-mt.c @@ -333,7 +333,7 @@ md_assemble (char * str) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c index d01ca3d2026..36ed58a4538 100644 --- a/gas/config/tc-nds32.c +++ b/gas/config/tc-nds32.c @@ -3841,7 +3841,7 @@ do_nds32_seg (int i, subsegT sub) seg->s = subseg_new (seg->name, sub); if (OUTPUT_FLAVOR == bfd_target_elf_flavour) { - bfd_set_section_flags (stdoutput, seg->s, seg->flags); + bfd_set_section_flags (seg->s, seg->flags); if ((seg->flags & SEC_LOAD) == 0) seg_info (seg->s)->bss = 1; } @@ -6609,7 +6609,7 @@ md_operand (expressionS *expressionP) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & ((valueT) -1 << align)); } @@ -7569,7 +7569,7 @@ nds32_set_section_relocs (asection *sec, arelent ** relocs ATTRIBUTE_UNUSED, unsigned int n ATTRIBUTE_UNUSED) { bfd *abfd ATTRIBUTE_UNUSED = sec->owner; - if (bfd_get_section_flags (abfd, sec) & (flagword) SEC_RELOC) + if (bfd_section_flags (sec) & (flagword) SEC_RELOC) nds32_insertion_sort (sec->orelocation, sec->reloc_count, sizeof (arelent**), compar_relent); } diff --git a/gas/config/tc-or1k.c b/gas/config/tc-or1k.c index 28fa7c50104..e29d4dd77d0 100644 --- a/gas/config/tc-or1k.c +++ b/gas/config/tc-or1k.c @@ -165,7 +165,7 @@ md_operand (expressionS * expressionP) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 042c95b1889..156f62c6fc0 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -1975,9 +1975,7 @@ ppc_cleanup (void) /* Create the .PPC.EMB.apuinfo section. */ apuinfo_secp = subseg_new (APUINFO_SECTION_NAME, 0); - bfd_set_section_flags (stdoutput, - apuinfo_secp, - SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_flags (apuinfo_secp, SEC_HAS_CONTENTS | SEC_READONLY); p = frag_more (4); md_number_to_chars (p, (valueT) 8, 4); @@ -2703,7 +2701,7 @@ ppc_frob_file_before_adjust (void) toc = bfd_get_section_by_name (stdoutput, ".toc"); if (toc != NULL && toc_reloc_types != has_large_toc_reloc - && bfd_section_size (stdoutput, toc) > 0x10000) + && bfd_section_size (toc) > 0x10000) as_warn (_("TOC section size exceeds 64k")); } @@ -4681,14 +4679,14 @@ ppc_change_debug_section (unsigned int idx, subsegT subseg) const struct xcoff_dwsect_name *dw = &xcoff_dwsect_names[idx]; sec = subseg_new (dw->name, subseg); - oldflags = bfd_get_section_flags (stdoutput, sec); + oldflags = bfd_section_flags (sec); if (oldflags == SEC_NO_FLAGS) { /* Just created section. */ gas_assert (dw_sections[idx].sect == NULL); - bfd_set_section_flags (stdoutput, sec, SEC_DEBUGGING); - bfd_set_section_alignment (stdoutput, sec, 0); + bfd_set_section_flags (sec, SEC_DEBUGGING); + bfd_set_section_alignment (sec, 0); dw_sections[idx].sect = sec; } @@ -5804,11 +5802,10 @@ ppc_pdata (int ignore ATTRIBUTE_UNUSED) { pdata_section = subseg_new (".pdata", 0); - bfd_set_section_flags (stdoutput, pdata_section, - (SEC_ALLOC | SEC_LOAD | SEC_RELOC - | SEC_READONLY | SEC_DATA )); + bfd_set_section_flags (pdata_section, (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_READONLY | SEC_DATA)); - bfd_set_section_alignment (stdoutput, pdata_section, 2); + bfd_set_section_alignment (pdata_section, 2); } else { @@ -5837,11 +5834,10 @@ ppc_ydata (int ignore ATTRIBUTE_UNUSED) if (ydata_section == 0) { ydata_section = subseg_new (".ydata", 0); - bfd_set_section_flags (stdoutput, ydata_section, - (SEC_ALLOC | SEC_LOAD | SEC_RELOC - | SEC_READONLY | SEC_DATA )); + bfd_set_section_flags (ydata_section, (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_READONLY | SEC_DATA )); - bfd_set_section_alignment (stdoutput, ydata_section, 3); + bfd_set_section_alignment (ydata_section, 3); } else { @@ -5874,11 +5870,10 @@ ppc_reldata (int ignore ATTRIBUTE_UNUSED) { reldata_section = subseg_new (".reldata", 0); - bfd_set_section_flags (stdoutput, reldata_section, - (SEC_ALLOC | SEC_LOAD | SEC_RELOC - | SEC_DATA)); + bfd_set_section_flags (reldata_section, (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_DATA)); - bfd_set_section_alignment (stdoutput, reldata_section, 2); + bfd_set_section_alignment (reldata_section, 2); } else { @@ -5903,11 +5898,10 @@ ppc_rdata (int ignore ATTRIBUTE_UNUSED) if (rdata_section == 0) { rdata_section = subseg_new (".rdata", 0); - bfd_set_section_flags (stdoutput, rdata_section, - (SEC_ALLOC | SEC_LOAD | SEC_RELOC - | SEC_READONLY | SEC_DATA )); + bfd_set_section_flags (rdata_section, (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_READONLY | SEC_DATA )); - bfd_set_section_alignment (stdoutput, rdata_section, 2); + bfd_set_section_alignment (rdata_section, 2); } else { @@ -6261,13 +6255,13 @@ ppc_pe_section (int ignore ATTRIBUTE_UNUSED) if (flags != SEC_NO_FLAGS) { - if (! bfd_set_section_flags (stdoutput, sec, flags)) + if (!bfd_set_section_flags (sec, flags)) as_bad (_("error setting flags for \"%s\": %s"), - bfd_section_name (stdoutput, sec), + bfd_section_name (sec), bfd_errmsg (bfd_get_error ())); } - bfd_set_section_alignment (stdoutput, sec, align); + bfd_set_section_alignment (sec, align); } static void @@ -6298,11 +6292,10 @@ ppc_pe_tocd (int ignore ATTRIBUTE_UNUSED) { tocdata_section = subseg_new (".tocd", 0); /* FIXME: section flags won't work. */ - bfd_set_section_flags (stdoutput, tocdata_section, - (SEC_ALLOC | SEC_LOAD | SEC_RELOC - | SEC_READONLY | SEC_DATA)); + bfd_set_section_flags (tocdata_section, (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_READONLY | SEC_DATA)); - bfd_set_section_alignment (stdoutput, tocdata_section, 2); + bfd_set_section_alignment (tocdata_section, 2); } else { @@ -6573,8 +6566,7 @@ ppc_frob_symbol (symbolS *sym) /* This is a csect symbol. x_scnlen is the size of the csect. */ if (symbol_get_tc (sym)->next == (symbolS *) NULL) - a->x_csect.x_scnlen.l = (bfd_section_size (stdoutput, - S_GET_SEGMENT (sym)) + a->x_csect.x_scnlen.l = (bfd_section_size (S_GET_SEGMENT (sym)) - S_GET_VALUE (sym)); else { @@ -6622,8 +6614,7 @@ ppc_frob_symbol (symbolS *sym) || symbol_get_tc (next)->symbol_class != XMC_TC) { if (ppc_after_toc_frag == (fragS *) NULL) - a->x_csect.x_scnlen.l = (bfd_section_size (stdoutput, - data_section) + a->x_csect.x_scnlen.l = (bfd_section_size (data_section) - S_GET_VALUE (sym)); else a->x_csect.x_scnlen.l = (ppc_after_toc_frag->fr_address @@ -6787,12 +6778,12 @@ ppc_frob_section (asection *sec) static bfd_vma vma = 0; /* Dwarf sections start at 0. */ - if (bfd_get_section_flags (NULL, sec) & SEC_DEBUGGING) + if (bfd_section_flags (sec) & SEC_DEBUGGING) return; vma = md_section_align (sec, vma); - bfd_set_section_vma (stdoutput, sec, vma); - vma += bfd_section_size (stdoutput, sec); + bfd_set_section_vma (sec, vma); + vma += bfd_section_size (sec); } #endif /* OBJ_XCOFF */ @@ -6823,7 +6814,7 @@ md_section_align (asection *seg ATTRIBUTE_UNUSED, valueT addr) #ifdef OBJ_ELF return addr; #else - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); #endif @@ -6886,7 +6877,7 @@ ppc_fix_adjustable (fixS *fix) return 0; /* Always adjust symbols in debugging sections. */ - if (bfd_get_section_flags (stdoutput, symseg) & SEC_DEBUGGING) + if (bfd_section_flags (symseg) & SEC_DEBUGGING) return 1; if (ppc_toc_csect != (symbolS *) NULL @@ -7927,9 +7918,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) #else /* We want to use the offset within the toc, not the actual VMA of the symbol. */ - fixP->fx_addnumber = - - bfd_get_section_vma (stdoutput, S_GET_SEGMENT (fixP->fx_addsy)) - - S_GET_VALUE (ppc_toc_csect); + fixP->fx_addnumber = (- bfd_section_vma (S_GET_SEGMENT (fixP->fx_addsy)) + - S_GET_VALUE (ppc_toc_csect)); /* Set *valP to avoid errors. */ *valP = value; #endif diff --git a/gas/config/tc-pru.c b/gas/config/tc-pru.c index 12ed8cc834e..2e2058c1deb 100644 --- a/gas/config/tc-pru.c +++ b/gas/config/tc-pru.c @@ -1745,7 +1745,7 @@ md_assemble (char *op_str) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & (-((valueT) 1 << align))); } diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c index 878c03f97e8..9160cc027fb 100644 --- a/gas/config/tc-rl78.c +++ b/gas/config/tc-rl78.c @@ -1520,6 +1520,6 @@ md_apply_fix (struct fix * f ATTRIBUTE_UNUSED, valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c index 6b19f2f3971..5d2e69b8b30 100644 --- a/gas/config/tc-rx.c +++ b/gas/config/tc-rx.c @@ -509,7 +509,7 @@ parse_rx_section (char * name) obj_elf_change_section (name, type, 0, attr, 0, NULL, FALSE, FALSE); } - bfd_set_section_alignment (stdoutput, now_seg, align); + bfd_set_section_alignment (now_seg, align); } static void @@ -1290,7 +1290,7 @@ md_operand (expressionS * exp ATTRIBUTE_UNUSED) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-s12z.c b/gas/config/tc-s12z.c index 67e88d277a8..be4d4fb0952 100644 --- a/gas/config/tc-s12z.c +++ b/gas/config/tc-s12z.c @@ -187,7 +187,7 @@ md_atof (int type, char *litP, int *sizeP) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index f74497aa855..a4dae4fb16d 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -2084,7 +2084,7 @@ md_atof (int type, char *litp, int *sizep) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c index 648e0d22ebb..1393a188206 100644 --- a/gas/config/tc-score.c +++ b/gas/config/tc-score.c @@ -5300,7 +5300,7 @@ s3_pic_need_relax (symbolS *sym, asection *segtype) linkonce = FALSE; if (symsec != segtype && ! S_IS_LOCAL (sym)) { - if ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE) != 0) + if ((bfd_section_flags (symsec) & SEC_LINK_ONCE) != 0) linkonce = TRUE; /* The GNU toolchain uses an extension for ELF: a section @@ -5546,7 +5546,7 @@ static void s3_score_s_section (int ignore) { obj_elf_section (ignore); - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) record_alignment (now_seg, 2); } @@ -5569,14 +5569,14 @@ s3_s_change_sec (int sec) { case 'r': seg = subseg_new (s3_RDATA_SECTION_NAME, (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA)); + bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA)); if (strcmp (TARGET_OS, "elf") != 0) record_alignment (seg, 4); demand_empty_rest_of_line (); break; case 's': seg = subseg_new (".sdata", (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA); + bfd_set_section_flags (seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA); if (strcmp (TARGET_OS, "elf") != 0) record_alignment (seg, 4); demand_empty_rest_of_line (); @@ -5686,7 +5686,7 @@ s3_s_score_ent (int aent) s3_get_number (); #ifdef BFD_ASSEMBLER - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; @@ -5795,7 +5795,7 @@ s3_s_score_end (int x ATTRIBUTE_UNUSED) p = NULL; #ifdef BFD_ASSEMBLER - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; @@ -6128,15 +6128,16 @@ s3_s_score_lcomm (int bytes_p) if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour || OUTPUT_FLAVOR == bfd_target_elf_flavour) { /* For Score and Alpha ECOFF or ELF, small objects are put in .sbss. */ - if ((unsigned)temp <= bfd_get_gp_size (stdoutput)) - { - bss_seg = subseg_new (".sbss", 1); - seg_info (bss_seg)->bss = 1; + if ((unsigned) temp <= bfd_get_gp_size (stdoutput)) + { + bss_seg = subseg_new (".sbss", 1); + seg_info (bss_seg)->bss = 1; #ifdef BFD_ASSEMBLER - if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC)) - as_warn (_("error setting flags for \".sbss\": %s"), bfd_errmsg (bfd_get_error ())); + if (!bfd_set_section_flags (bss_seg, SEC_ALLOC)) + as_warn (_("error setting flags for \".sbss\": %s"), + bfd_errmsg (bfd_get_error ())); #endif - } + } } #endif @@ -6538,8 +6539,8 @@ s3_begin (void) seg = now_seg; subseg = now_subseg; s3_pdr_seg = subseg_new (".pdr", (subsegT) 0); - (void)bfd_set_section_flags (stdoutput, s3_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); - (void)bfd_set_section_alignment (stdoutput, s3_pdr_seg, 2); + bfd_set_section_flags (s3_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); + bfd_set_section_alignment (s3_pdr_seg, 2); subseg_set (seg, subseg); if (s3_USE_GLOBAL_POINTER_OPT) @@ -7076,7 +7077,7 @@ s3_pcrel_from (fixS * fixP) static valueT s3_section_align (segT segment ATTRIBUTE_UNUSED, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c index 90cd5e3962d..a615e149c9d 100644 --- a/gas/config/tc-score7.c +++ b/gas/config/tc-score7.c @@ -5188,7 +5188,7 @@ s7_pic_need_relax (symbolS *sym, asection *segtype) linkonce = FALSE; if (symsec != segtype && ! S_IS_LOCAL (sym)) { - if ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE) != 0) + if ((bfd_section_flags (symsec) & SEC_LINK_ONCE) != 0) linkonce = TRUE; /* The GNU toolchain uses an extension for ELF: a section @@ -5399,7 +5399,7 @@ static void s7_s_section (int ignore) { obj_elf_section (ignore); - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) record_alignment (now_seg, 2); } @@ -5422,14 +5422,14 @@ s7_s_change_sec (int sec) { case 'r': seg = subseg_new (s7_RDATA_SECTION_NAME, (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA)); + bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA)); if (strcmp (TARGET_OS, "elf") != 0) record_alignment (seg, 4); demand_empty_rest_of_line (); break; case 's': seg = subseg_new (".sdata", (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA); + bfd_set_section_flags (seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA); if (strcmp (TARGET_OS, "elf") != 0) record_alignment (seg, 4); demand_empty_rest_of_line (); @@ -5540,7 +5540,7 @@ s7_s_score_ent (int aent) s7_get_number (); #ifdef BFD_ASSEMBLER - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; @@ -5650,7 +5650,7 @@ s7_s_score_end (int x ATTRIBUTE_UNUSED) p = NULL; #ifdef BFD_ASSEMBLER - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; @@ -5993,7 +5993,7 @@ s7_s_score_lcomm (int bytes_p) bss_seg = subseg_new (".sbss", 1); seg_info (bss_seg)->bss = 1; #ifdef BFD_ASSEMBLER - if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC)) + if (!bfd_set_section_flags (bss_seg, SEC_ALLOC)) as_warn (_("error setting flags for \".sbss\": %s"), bfd_errmsg (bfd_get_error ())); #endif } @@ -6152,8 +6152,8 @@ s7_begin (void) seg = now_seg; subseg = now_subseg; s7_pdr_seg = subseg_new (".pdr", (subsegT) 0); - (void) bfd_set_section_flags (stdoutput, s7_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); - (void) bfd_set_section_alignment (stdoutput, s7_pdr_seg, 2); + bfd_set_section_flags (s7_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); + bfd_set_section_alignment (s7_pdr_seg, 2); subseg_set (seg, subseg); if (s7_USE_GLOBAL_POINTER_OPT) @@ -6628,7 +6628,7 @@ s7_pcrel_from (fixS * fixP) static valueT s7_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index c9d47df9f6e..c57f0661344 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -3162,8 +3162,8 @@ md_section_align (segT seg ATTRIBUTE_UNUSED, valueT size) #ifdef OBJ_ELF return size; #else /* ! OBJ_ELF */ - return ((size + (1 << bfd_get_section_alignment (stdoutput, seg)) - 1) - & -(1 << bfd_get_section_alignment (stdoutput, seg))); + return ((size + (1 << bfd_section_alignment (seg)) - 1) + & -(1 << bfd_section_alignment (seg))); #endif /* ! OBJ_ELF */ } diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index 347db08173a..4f7d675f60c 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -4001,7 +4001,7 @@ tc_gen_reloc (asection *section, fixS *fixp) } /* Nothing is aligned in DWARF debugging sections. */ - if (bfd_get_section_flags (stdoutput, section) & SEC_DEBUGGING) + if (bfd_section_flags (section) & SEC_DEBUGGING) switch (code) { case BFD_RELOC_16: code = BFD_RELOC_SPARC_UA16; break; diff --git a/gas/config/tc-spu.c b/gas/config/tc-spu.c index d3e3d8aebc3..bdb22e72ba7 100644 --- a/gas/config/tc-spu.c +++ b/gas/config/tc-spu.c @@ -904,7 +904,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp) valueT md_section_align (segT seg, valueT size) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); valueT mask = ((valueT) 1 << align) - 1; return (size + mask) & ~mask; diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c index f20d93b5b16..b5588b9c467 100644 --- a/gas/config/tc-tic4x.c +++ b/gas/config/tc-tic4x.c @@ -1001,9 +1001,9 @@ tic4x_sect (int x ATTRIBUTE_UNUSED) symbol_set_frag (line_label, frag_now); } - if (bfd_get_section_flags (stdoutput, seg) == SEC_NO_FLAGS) + if (bfd_section_flags (seg) == SEC_NO_FLAGS) { - if (!bfd_set_section_flags (stdoutput, seg, SEC_DATA)) + if (!bfd_set_section_flags (seg, SEC_DATA)) as_warn (_("Error setting flags for \"%s\": %s"), name, bfd_errmsg (bfd_get_error ())); } @@ -1104,7 +1104,7 @@ tic4x_usect (int x ATTRIBUTE_UNUSED) S_SET_VALUE (line_label, frag_now_fix ()); } seg_info (seg)->bss = 1; /* Uninitialised data. */ - if (!bfd_set_section_flags (stdoutput, seg, SEC_ALLOC)) + if (!bfd_set_section_flags (seg, SEC_ALLOC)) as_warn (_("Error setting flags for \"%s\": %s"), name, bfd_errmsg (bfd_get_error ())); tic4x_seg_alloc (name, seg, size, line_label); diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c index 3e1d32a02e4..72c8cf3967a 100644 --- a/gas/config/tc-tic54x.c +++ b/gas/config/tc-tic54x.c @@ -1391,7 +1391,7 @@ tic54x_usect (int x ATTRIBUTE_UNUSED) blocking_flag = alignment_flag = 0; seg = subseg_new (name, 0); - flags = bfd_get_section_flags (stdoutput, seg) | SEC_ALLOC; + flags = bfd_section_flags (seg) | SEC_ALLOC; if (alignment_flag) { @@ -1420,7 +1420,7 @@ tic54x_usect (int x ATTRIBUTE_UNUSED) if (blocking_flag) flags |= SEC_TIC54X_BLOCK; - if (!bfd_set_section_flags (stdoutput, seg, flags)) + if (!bfd_set_section_flags (seg, flags)) as_warn (_("Error setting flags for \"%s\": %s"), name, bfd_errmsg (bfd_get_error ())); @@ -3977,12 +3977,12 @@ static void emit_insn (tic54x_insn *insn) { int i; - flagword oldflags = bfd_get_section_flags (stdoutput, now_seg); + flagword oldflags = bfd_section_flags (now_seg); flagword flags = oldflags | SEC_CODE; - if (! bfd_set_section_flags (stdoutput, now_seg, flags)) + if (!bfd_set_section_flags (now_seg, flags)) as_warn (_("error setting flags for \"%s\": %s"), - bfd_section_name (stdoutput, now_seg), + bfd_section_name (now_seg), bfd_errmsg (bfd_get_error ())); for (i = 0; i < insn->words; i++) diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c index 108c2d42596..0433d9e409e 100644 --- a/gas/config/tc-tic6x.c +++ b/gas/config/tc-tic6x.c @@ -781,7 +781,7 @@ md_begin (void) /* This is copied from perform_an_assembly_pass. */ applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, sbss_section, applicable & SEC_ALLOC); + bfd_set_section_flags (sbss_section, applicable & SEC_ALLOC); subseg_set (seg, subseg); @@ -4483,7 +4483,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED, { /* Round up section sizes to ensure that text sections consist of whole fetch packets. */ - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & (-((valueT) 1 << align))); } diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c index e840e5dc85f..788a9f3b462 100644 --- a/gas/config/tc-tilegx.c +++ b/gas/config/tc-tilegx.c @@ -262,7 +262,7 @@ md_begin (void) as_warn (_("Could not set architecture and machine")); /* Guarantee text section is aligned. */ - bfd_set_section_alignment (stdoutput, text_section, + bfd_set_section_alignment (text_section, TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES); require_canonical_reg_names = 1; @@ -948,8 +948,8 @@ tilegx_flush_bundle (void) /* If the section seems to have no alignment set yet, go ahead and make it large enough to hold code. */ - if (bfd_get_section_alignment (stdoutput, now_seg) == 0) - bfd_set_section_alignment (stdoutput, now_seg, + if (bfd_section_alignment (now_seg) == 0) + bfd_set_section_alignment (now_seg, TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES); for (j = 0; j < current_bundle_index; j++) diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c index 146e270f7de..1c98a933583 100644 --- a/gas/config/tc-tilepro.c +++ b/gas/config/tc-tilepro.c @@ -207,7 +207,7 @@ md_begin (void) int i; /* Guarantee text section is aligned. */ - bfd_set_section_alignment (stdoutput, text_section, + bfd_set_section_alignment (text_section, TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES); require_canonical_reg_names = 1; @@ -838,8 +838,8 @@ tilepro_flush_bundle (void) /* If the section seems to have no alignment set yet, go ahead and make it large enough to hold code. */ - if (bfd_get_section_alignment (stdoutput, now_seg) == 0) - bfd_set_section_alignment (stdoutput, now_seg, + if (bfd_section_alignment (now_seg) == 0) + bfd_set_section_alignment (now_seg, TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES); for (j = 0; j < current_bundle_index; j++) diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index 12d5846487e..dfb43cbc16f 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -229,7 +229,7 @@ do_v850_seg (int i, subsegT sub) else { seg->s = subseg_new (seg->name, sub); - bfd_set_section_flags (stdoutput, seg->s, seg->flags); + bfd_set_section_flags (seg->s, seg->flags); if ((seg->flags & SEC_LOAD) == 0) seg_info (seg->s)->bss = 1; } @@ -1878,7 +1878,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } @@ -3740,8 +3740,8 @@ v850_md_end (void) enum v850_notes id; note_sec = subseg_new (V850_NOTE_SECNAME, 0); - bfd_set_section_flags (stdoutput, note_sec, SEC_HAS_CONTENTS | SEC_READONLY | SEC_MERGE); - bfd_set_section_alignment (stdoutput, note_sec, 2); + bfd_set_section_flags (note_sec, SEC_HAS_CONTENTS | SEC_READONLY | SEC_MERGE); + bfd_set_section_alignment (note_sec, 2); /* Provide default values for all of the notes. */ for (id = V850_NOTE_ALIGNMENT; id <= NUM_V850_NOTES; id++) diff --git a/gas/config/tc-visium.c b/gas/config/tc-visium.c index 68863112301..fbf59c9e017 100644 --- a/gas/config/tc-visium.c +++ b/gas/config/tc-visium.c @@ -222,7 +222,7 @@ visium_rdata (int xxx) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-wasm32.c b/gas/config/tc-wasm32.c index c57611c5a7d..3dc42f91df4 100644 --- a/gas/config/tc-wasm32.c +++ b/gas/config/tc-wasm32.c @@ -177,7 +177,7 @@ md_begin (void) valueT md_section_align (asection * seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-xc16x.c b/gas/config/tc-xc16x.c index 00bdb8316ee..23b9e687c86 100644 --- a/gas/config/tc-xc16x.c +++ b/gas/config/tc-xc16x.c @@ -234,7 +234,7 @@ md_atof (int type, char *litP, int *sizeP) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c index b3c124398cd..4f92c24d0df 100644 --- a/gas/config/tc-xgate.c +++ b/gas/config/tc-xgate.c @@ -466,7 +466,7 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED) valueT md_section_align (asection * seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c index fb874c58f9d..1c708b63625 100644 --- a/gas/config/tc-xstormy16.c +++ b/gas/config/tc-xstormy16.c @@ -277,7 +277,7 @@ xstormy16_cgen_record_fixup_exp (fragS * frag, valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index 320e7afca50..c68128e2897 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -4115,7 +4115,7 @@ get_is_linkonce_section (bfd *abfd ATTRIBUTE_UNUSED, segT sec) { flagword flags, link_once_flags; - flags = bfd_get_section_flags (abfd, sec); + flags = bfd_section_flags (sec); link_once_flags = (flags & SEC_LINK_ONCE); /* Flags might not be set yet. */ @@ -4980,7 +4980,7 @@ xtensa_mark_frags_for_org (void) segment_info_type *seginfo; fragS *fragP; flagword flags; - flags = bfd_get_section_flags (stdoutput, sec); + flags = bfd_section_flags (sec); if (flags & SEC_DEBUGGING) continue; if (!(flags & SEC_ALLOC)) @@ -5025,7 +5025,7 @@ xtensa_find_unmarked_state_frags (void) segment_info_type *seginfo; fragS *fragP; flagword flags; - flags = bfd_get_section_flags (stdoutput, sec); + flags = bfd_section_flags (sec); if (flags & SEC_DEBUGGING) continue; if (!(flags & SEC_ALLOC)) @@ -5073,7 +5073,7 @@ xtensa_find_unaligned_branch_targets (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *unused ATTRIBUTE_UNUSED) { - flagword flags = bfd_get_section_flags (abfd, sec); + flagword flags = bfd_section_flags (sec); segment_info_type *seginfo = seg_info (sec); fragS *frag = seginfo->frchainP->frch_root; @@ -5112,7 +5112,7 @@ xtensa_find_unaligned_loops (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *unused ATTRIBUTE_UNUSED) { - flagword flags = bfd_get_section_flags (abfd, sec); + flagword flags = bfd_section_flags (sec); segment_info_type *seginfo = seg_info (sec); fragS *frag = seginfo->frchainP->frch_root; xtensa_isa isa = xtensa_default_isa; @@ -8941,7 +8941,7 @@ xtensa_add_config_info (void) int sz; info_sec = subseg_new (".xtensa.info", 0); - bfd_set_section_flags (stdoutput, info_sec, SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_flags (info_sec, SEC_HAS_CONTENTS | SEC_READONLY); data = XNEWVEC (char, 100); sprintf (data, "USE_ABSOLUTE_LITERALS=%d\nABI=%d\n", @@ -11682,8 +11682,8 @@ cache_literal_section (bfd_boolean use_abs_literals) elf_group_name (seg) = group_name; - bfd_set_section_flags (stdoutput, seg, flags); - bfd_set_section_alignment (stdoutput, seg, 2); + bfd_set_section_flags (seg, flags); + bfd_set_section_alignment (seg, 2); } *pcached = seg; @@ -11814,7 +11814,7 @@ xtensa_create_property_segments (frag_predicate property_function, num_recs++; rec_size = num_recs * 8; - bfd_set_section_size (stdoutput, sec, rec_size); + bfd_set_section_size (sec, rec_size); if (num_recs) { @@ -11911,7 +11911,7 @@ xtensa_create_xproperty_segments (frag_flags_fn flag_fn, num_recs++; rec_size = num_recs * (8 + 4); - bfd_set_section_size (stdoutput, sec, rec_size); + bfd_set_section_size (sec, rec_size); /* elf_section_data (sec)->this_hdr.sh_entsize = 12; */ if (num_recs) @@ -11955,7 +11955,7 @@ xtensa_create_xproperty_segments (frag_flags_fn flag_fn, static bfd_boolean exclude_section_from_property_tables (segT sec) { - flagword flags = bfd_get_section_flags (stdoutput, sec); + flagword flags = bfd_section_flags (sec); /* Sections that don't contribute to the memory footprint are excluded. */ if ((flags & SEC_DEBUGGING) diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c index 9cb41a3cc9b..68e1b761cd6 100644 --- a/gas/config/tc-z8k.c +++ b/gas/config/tc-z8k.c @@ -1385,7 +1385,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, valueT md_section_align (segT seg, valueT size) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); valueT mask = ((valueT) 1 << align) - 1; return (size + mask) & ~mask; diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index f30734d384b..388123fd241 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -232,7 +232,7 @@ get_debugseg_name (segT seg, const char *base_name) if (!seg) return concat (base_name, NULL); - name = bfd_get_section_name (stdoutput, seg); + name = bfd_section_name (seg); if (name == NULL || *name == 0) return concat (base_name, NULL); @@ -281,7 +281,7 @@ is_now_linkonce_segment (void) if (compact_eh) return now_seg; - if ((bfd_get_section_flags (stdoutput, now_seg) + if ((bfd_section_flags (now_seg) & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE | SEC_LINK_DUPLICATES_SAME_CONTENTS)) != 0) @@ -306,16 +306,16 @@ make_debug_seg (segT cseg, char *name, int sflags) if (!cseg) flags = 0; else - flags = bfd_get_section_flags (stdoutput, cseg) - & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD - | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE - | SEC_LINK_DUPLICATES_SAME_CONTENTS); + flags = (bfd_section_flags (cseg) + & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD + | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE + | SEC_LINK_DUPLICATES_SAME_CONTENTS)); /* Add standard section flags. */ flags |= sflags; /* Apply possibly linked once flags to new generated segment, too. */ - if (!bfd_set_section_flags (stdoutput, r, flags)) + if (!bfd_set_section_flags (r, flags)) as_bad (_("bfd_set_section_flags: %s"), bfd_errmsg (bfd_get_error ())); @@ -1359,7 +1359,7 @@ get_cfi_seg (segT cseg, const char *base, flagword flags, int align) else { cseg = subseg_new (base, 0); - bfd_set_section_flags (stdoutput, cseg, flags); + bfd_set_section_flags (cseg, flags); } record_alignment (cseg, align); return cseg; diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 5f804f15413..90b47b02fc0 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -657,7 +657,7 @@ dwarf2_emit_label (symbolS *label) return; if (S_GET_SEGMENT (label) != now_seg) return; - if (!(bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE)) + if (!(bfd_section_flags (now_seg) & SEC_CODE)) return; if (files_in_use == 0 && debug_type != DEBUG_DWARF2) return; @@ -1594,7 +1594,7 @@ process_entries (segT seg, struct line_entry *e) that all of the sub-sections are merged into a proper .debug_line section before a debugger sees them. */ - sec_name = bfd_get_section_name (stdoutput, seg); + sec_name = bfd_section_name (seg); if (strcmp (sec_name, ".text") != 0) { name = concat (".debug_line", sec_name, (char *) NULL); @@ -2238,7 +2238,7 @@ dwarf2_finish (void) /* Create and switch to the line number section. */ line_seg = subseg_new (".debug_line", 0); - bfd_set_section_flags (stdoutput, line_seg, SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (line_seg, SEC_READONLY | SEC_DEBUGGING); /* For each subsection, chain the debug entries together. */ for (s = all_segs; s; s = s->next) @@ -2284,15 +2284,11 @@ dwarf2_finish (void) aranges_seg = subseg_new (".debug_aranges", 0); str_seg = subseg_new (".debug_str", 0); - bfd_set_section_flags (stdoutput, info_seg, - SEC_READONLY | SEC_DEBUGGING); - bfd_set_section_flags (stdoutput, abbrev_seg, - SEC_READONLY | SEC_DEBUGGING); - bfd_set_section_flags (stdoutput, aranges_seg, - SEC_READONLY | SEC_DEBUGGING); - bfd_set_section_flags (stdoutput, str_seg, - (SEC_READONLY | SEC_DEBUGGING - | SEC_MERGE | SEC_STRINGS)); + bfd_set_section_flags (info_seg, SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (abbrev_seg, SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (aranges_seg, SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (str_seg, (SEC_READONLY | SEC_DEBUGGING + | SEC_MERGE | SEC_STRINGS)); str_seg->entsize = 1; record_alignment (aranges_seg, ffs (2 * sizeof_address) - 1); @@ -2302,8 +2298,7 @@ dwarf2_finish (void) else { ranges_seg = subseg_new (".debug_ranges", 0); - bfd_set_section_flags (stdoutput, ranges_seg, - SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (ranges_seg, SEC_READONLY | SEC_DEBUGGING); record_alignment (ranges_seg, ffs (2 * sizeof_address) - 1); out_debug_ranges (ranges_seg); } diff --git a/gas/ecoff.c b/gas/ecoff.c index 09e8f0e6cf3..bacc89fe3af 100644 --- a/gas/ecoff.c +++ b/gas/ecoff.c @@ -3700,8 +3700,7 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, && first_proc_ptr != (proc_t *) NULL && local_first_lineno != (lineno_list_t *) NULL && ((S_GET_VALUE (first_proc_ptr->sym->as_sym) - + bfd_get_section_vma (stdoutput, - S_GET_SEGMENT (first_proc_ptr->sym->as_sym))) + + bfd_section_vma (S_GET_SEGMENT (first_proc_ptr->sym->as_sym))) != 0)) { first.file = local_first_lineno->file; @@ -3981,8 +3980,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, else sym_ptr->ecoff_sym.asym.value = (S_GET_VALUE (as_sym) - + bfd_get_section_vma (stdoutput, - S_GET_SEGMENT (as_sym)) + + bfd_section_vma (S_GET_SEGMENT (as_sym)) + sym_ptr->addend); sym_ptr->ecoff_sym.weakext = S_IS_WEAK (as_sym); @@ -4310,8 +4308,7 @@ ecoff_build_procs (const struct ecoff_debug_swap *backend, adr_sym = proc_ptr->sym->as_sym; adr = (S_GET_VALUE (adr_sym) - + bfd_get_section_vma (stdoutput, - S_GET_SEGMENT (adr_sym))); + + bfd_section_vma (S_GET_SEGMENT (adr_sym))); if (first) { /* This code used to force the adr of the very diff --git a/gas/read.c b/gas/read.c index 58d79b2787a..e53dd0232d9 100644 --- a/gas/read.c +++ b/gas/read.c @@ -742,7 +742,7 @@ assemble_one (char *line) static bfd_boolean in_bss (void) { - flagword flags = bfd_get_section_flags (stdoutput, now_seg); + flagword flags = bfd_section_flags (now_seg); return (flags & SEC_ALLOC) && !(flags & (SEC_LOAD | SEC_HAS_CONTENTS)); } @@ -2419,7 +2419,7 @@ s_linkonce (int ignore ATTRIBUTE_UNUSED) if ((bfd_applicable_section_flags (stdoutput) & SEC_LINK_ONCE) == 0) as_warn (_(".linkonce is not supported for this object file format")); - flags = bfd_get_section_flags (stdoutput, now_seg); + flags = bfd_section_flags (now_seg); flags |= SEC_LINK_ONCE; switch (type) { @@ -2438,7 +2438,7 @@ s_linkonce (int ignore ATTRIBUTE_UNUSED) flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS; break; } - if (!bfd_set_section_flags (stdoutput, now_seg, flags)) + if (!bfd_set_section_flags (now_seg, flags)) as_bad (_("bfd_set_section_flags: %s"), bfd_errmsg (bfd_get_error ())); } @@ -2464,7 +2464,7 @@ bss_alloc (symbolS *symbolP, addressT size, unsigned int align) { bss_seg = subseg_new (".sbss", 1); seg_info (bss_seg)->bss = 1; - if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC)) + if (!bfd_set_section_flags (bss_seg, SEC_ALLOC)) as_warn (_("error setting flags for \".sbss\": %s"), bfd_errmsg (bfd_get_error ())); } @@ -2957,9 +2957,9 @@ s_mri_sect (char *type ATTRIBUTE_UNUSED) flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_READONLY | SEC_ROM; if (flags != SEC_NO_FLAGS) { - if (!bfd_set_section_flags (stdoutput, seg, flags)) + if (!bfd_set_section_flags (seg, flags)) as_warn (_("error setting flags for \"%s\": %s"), - bfd_section_name (stdoutput, seg), + bfd_section_name (seg), bfd_errmsg (bfd_get_error ())); } } diff --git a/gas/stabs.c b/gas/stabs.c index 64811c1bb15..0217c422ec3 100644 --- a/gas/stabs.c +++ b/gas/stabs.c @@ -109,7 +109,7 @@ get_stab_string_offset (const char *string, const char *stabstr_secname, p = frag_more (1); *p = 0; retval = seg_info (seg)->stabu.stab_string_size = 1; - bfd_set_section_flags (stdoutput, seg, SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (seg, SEC_READONLY | SEC_DEBUGGING); } if (length > 0) @@ -336,7 +336,7 @@ s_stab_generic (int what, if (! seg_info (seg)->hadone) { - bfd_set_section_flags (stdoutput, seg, + bfd_set_section_flags (seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); #ifdef INIT_STAB_SECTION INIT_STAB_SECTION (seg); diff --git a/gas/subsegs.c b/gas/subsegs.c index a66af2d3f65..d438a10c696 100644 --- a/gas/subsegs.c +++ b/gas/subsegs.c @@ -65,7 +65,7 @@ subseg_change (segT seg, int subseg) { seginfo = XCNEW (segment_info_type); seginfo->bfd_section = seg; - bfd_set_section_userdata (stdoutput, seg, seginfo); + bfd_set_section_userdata (seg, seginfo); } } @@ -146,9 +146,7 @@ subseg_get (const char *segname, int force_new) { segT secptr; segment_info_type *seginfo; - const char *now_seg_name = (now_seg - ? bfd_get_section_name (stdoutput, now_seg) - : 0); + const char *now_seg_name = now_seg ? bfd_section_name (now_seg) : 0; if (!force_new && now_seg_name @@ -167,7 +165,7 @@ subseg_get (const char *segname, int force_new) secptr->output_section = secptr; seginfo = XCNEW (segment_info_type); seginfo->bfd_section = secptr; - bfd_set_section_userdata (stdoutput, secptr, seginfo); + bfd_set_section_userdata (secptr, seginfo); } return secptr; } @@ -260,7 +258,7 @@ section_symbol (segT sec) int subseg_text_p (segT sec) { - return (bfd_get_section_flags (stdoutput, sec) & SEC_CODE) != 0; + return (bfd_section_flags (sec) & SEC_CODE) != 0; } /* Return non zero if SEC has at least one byte of data. It is diff --git a/gas/subsegs.h b/gas/subsegs.h index d853f453aeb..2a956026fef 100644 --- a/gas/subsegs.h +++ b/gas/subsegs.h @@ -112,7 +112,7 @@ typedef struct segment_info_struct { #define seg_info(sec) \ - ((segment_info_type *) bfd_get_section_userdata (stdoutput, sec)) + ((segment_info_type *) bfd_section_userdata (sec)) extern symbolS *section_symbol (segT); diff --git a/gas/write.c b/gas/write.c index e9a17e4468b..9b5ae6ff32a 100644 --- a/gas/write.c +++ b/gas/write.c @@ -359,8 +359,8 @@ record_alignment (/* Segment to which alignment pertains. */ if (seg == absolute_section) return; - if (align > bfd_get_section_alignment (stdoutput, seg)) - bfd_set_section_alignment (stdoutput, seg, align); + if (align > bfd_section_alignment (seg)) + bfd_set_section_alignment (seg, align); } int @@ -369,7 +369,7 @@ get_recorded_alignment (segT seg) if (seg == absolute_section) return 0; - return bfd_get_section_alignment (stdoutput, seg); + return bfd_section_alignment (seg); } /* Reset the section indices after removing the gas created sections. */ @@ -555,7 +555,7 @@ relax_seg (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *xxx) } static void -size_seg (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) +size_seg (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *xxx ATTRIBUTE_UNUSED) { flagword flags; fragS *fragp; @@ -580,8 +580,8 @@ size_seg (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) else size = 0; - flags = bfd_get_section_flags (abfd, sec); - if (size == 0 && bfd_get_section_size (sec) != 0 && + flags = bfd_section_flags (sec); + if (size == 0 && bfd_section_size (sec) != 0 && (flags & SEC_HAS_CONTENTS) != 0) return; @@ -589,7 +589,7 @@ size_seg (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) flags |= SEC_HAS_CONTENTS; flags &= ~SEC_RELOC; - x = bfd_set_section_flags (abfd, sec, flags); + x = bfd_set_section_flags (sec, flags); gas_assert (x); /* If permitted, allow the backend to pad out the section @@ -598,7 +598,7 @@ size_seg (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) newsize = size; else newsize = md_section_align (sec, size); - x = bfd_set_section_size (abfd, sec, newsize); + x = bfd_set_section_size (sec, newsize); gas_assert (x); /* If the size had to be rounded up, add some padding in the last @@ -1215,7 +1215,8 @@ get_frag_for_reloc (fragS *last_frag, } static void -write_relocs (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) +write_relocs (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, + void *xxx ATTRIBUTE_UNUSED) { segment_info_type *seginfo = seg_info (sec); unsigned int n; @@ -1345,9 +1346,9 @@ write_relocs (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) if (n) { - flagword flags = bfd_get_section_flags (abfd, sec); + flagword flags = bfd_section_flags (sec); flags |= SEC_RELOC; - bfd_set_section_flags (abfd, sec, flags); + bfd_set_section_flags (sec, flags); bfd_set_reloc (stdoutput, sec, relocs, n); } @@ -1433,7 +1434,7 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) char *header; struct z_stream_s *strm; int x; - flagword flags = bfd_get_section_flags (abfd, sec); + flagword flags = bfd_section_flags (sec); unsigned int header_size, compression_header_size; if (seginfo == NULL @@ -1441,7 +1442,7 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) || (flags & (SEC_ALLOC | SEC_HAS_CONTENTS)) == SEC_ALLOC) return; - section_name = bfd_get_section_name (stdoutput, sec); + section_name = bfd_section_name (sec); if (strncmp (section_name, ".debug_", 7) != 0) return; @@ -1565,12 +1566,12 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) /* Update the section size and its name. */ bfd_update_compression_header (abfd, (bfd_byte *) header, sec); - x = bfd_set_section_size (abfd, sec, compressed_size); + x = bfd_set_section_size (sec, compressed_size); gas_assert (x); if (!compression_header_size) { compressed_name = concat (".z", section_name + 1, (char *) NULL); - bfd_section_name (stdoutput, sec) = compressed_name; + bfd_rename_section (sec, compressed_name); } } @@ -1599,7 +1600,7 @@ write_contents (bfd *abfd ATTRIBUTE_UNUSED, /* Write out the frags. */ if (seginfo == NULL - || !(bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS)) + || !(bfd_section_flags (sec) & SEC_HAS_CONTENTS)) return; for (f = seginfo->frchainP->frch_root; @@ -1815,7 +1816,7 @@ subsegs_finish_section (asection *s) do_not_pad_sections_to_alignment = 1; alignment = SUB_SEGMENT_ALIGN (now_seg, frchainP); - if ((bfd_get_section_flags (now_seg->owner, now_seg) & SEC_MERGE) + if ((bfd_section_flags (now_seg) & SEC_MERGE) && now_seg->entsize) { unsigned int entsize = now_seg->entsize; @@ -1875,7 +1876,7 @@ create_obj_attrs_section (void) s = subseg_new (name, 0); elf_section_type (s) = get_elf_backend_data (stdoutput)->obj_attrs_section_type; - bfd_set_section_flags (stdoutput, s, SEC_READONLY | SEC_DATA); + bfd_set_section_flags (s, SEC_READONLY | SEC_DATA); frag_now_fix (); p = frag_more (size); bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size); @@ -1959,9 +1960,8 @@ maybe_generate_build_notes (void) /* Create a GNU Build Attribute section. */ sec = subseg_new (GNU_BUILD_ATTRS_SECTION_NAME, FALSE); elf_section_type (sec) = SHT_NOTE; - bfd_set_section_flags (stdoutput, sec, - SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA); - bfd_set_section_alignment (stdoutput, sec, 2); + bfd_set_section_flags (sec, SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA); + bfd_set_section_alignment (sec, 2); /* Work out the size of the notes that we will create, and the relocation we should use. */ @@ -2041,7 +2041,7 @@ maybe_generate_build_notes (void) /* ...and another one to install the end address. */ create_note_reloc (sec, sym, total_size, desc2_offset, desc_reloc, - bfd_get_section_size (bsym->section), + bfd_section_size (bsym->section), note); total_size += note_size; diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 47549ad0b94..7057e37e8da 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,26 @@ +2019-09-18 Alan Modra <amodra@gmail.com> + + * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c, + * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c, + * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c, + * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h, + * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c, + * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c, + * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c, + * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c, + * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c, + * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c, + * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c, + * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c, + * solib-spu.c, * solib-svr4.c, * solib-target.c, + * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c, + * symmisc.c, * symtab.c, * target.c, * windows-nat.c, + * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c, + * mi/mi-interp.c: Update throughout for bfd section macro and + function changes. + * gcore (gcore_create_callback): Use bfd_set_section_lma. + * spu-tdep.c (spu_overlay_new_objfile): Likewise. + 2019-09-18 Tom Tromey <tom@tromey.com> * NEWS: Add entry. diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index 831e62fb863..a375c3b137d 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -452,7 +452,7 @@ aarch64_linux_core_read_vq (struct gdbarch *gdbarch, bfd *abfd) return 0; } - size_t size = bfd_section_size (abfd, sve_section); + size_t size = bfd_section_size (sve_section); /* Check extended state size. */ if (size < SVE_HEADER_SIZE) diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 5c494c8ed28..e17550fed77 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -2009,12 +2009,11 @@ arm_obj_section_from_vma (struct objfile *objfile, bfd_vma vma) struct obj_section *osect; ALL_OBJFILE_OSECTIONS (objfile, osect) - if (bfd_get_section_flags (objfile->obfd, - osect->the_bfd_section) & SEC_ALLOC) + if (bfd_section_flags (osect->the_bfd_section) & SEC_ALLOC) { bfd_vma start, size; - start = bfd_get_section_vma (objfile->obfd, osect->the_bfd_section); - size = bfd_get_section_size (osect->the_bfd_section); + start = bfd_section_vma (osect->the_bfd_section); + size = bfd_section_size (osect->the_bfd_section); if (start <= vma && vma < start + size) return osect; @@ -2054,8 +2053,8 @@ arm_exidx_new_objfile (struct objfile *objfile) gdb::byte_vector exidx_data; if (exidx) { - exidx_vma = bfd_section_vma (objfile->obfd, exidx); - exidx_data.resize (bfd_get_section_size (exidx)); + exidx_vma = bfd_section_vma (exidx); + exidx_data.resize (bfd_section_size (exidx)); if (!bfd_get_section_contents (objfile->obfd, exidx, exidx_data.data (), 0, @@ -2067,8 +2066,8 @@ arm_exidx_new_objfile (struct objfile *objfile) gdb::byte_vector extab_data; if (extab) { - extab_vma = bfd_section_vma (objfile->obfd, extab); - extab_data.resize (bfd_get_section_size (extab)); + extab_vma = bfd_section_vma (extab); + extab_data.resize (bfd_section_size (extab)); if (!bfd_get_section_contents (objfile->obfd, extab, extab_data.data (), 0, @@ -2100,7 +2099,7 @@ arm_exidx_new_objfile (struct objfile *objfile) sec = arm_obj_section_from_vma (objfile, idx); if (sec == NULL) continue; - idx -= bfd_get_section_vma (objfile->obfd, sec->the_bfd_section); + idx -= bfd_section_vma (sec->the_bfd_section); /* Determine address of exception table entry. */ if (val == 1) diff --git a/gdb/auto-load.c b/gdb/auto-load.c index 9798ab1a067..136d53ffe13 100644 --- a/gdb/auto-load.c +++ b/gdb/auto-load.c @@ -1116,7 +1116,7 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name) scripts_sect = bfd_get_section_by_name (abfd, section_name); if (scripts_sect == NULL - || (bfd_get_section_flags (abfd, scripts_sect) & SEC_HAS_CONTENTS) == 0) + || (bfd_section_flags (scripts_sect) & SEC_HAS_CONTENTS) == 0) return; if (!bfd_get_full_section_contents (abfd, scripts_sect, &data)) @@ -1128,7 +1128,7 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name) char *p = (char *) data; source_section_scripts (objfile, section_name, p, - p + bfd_get_section_size (scripts_sect)); + p + bfd_section_size (scripts_sect)); } } diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 143d02ab88d..74e0057d4ab 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -163,12 +163,10 @@ dump_bfd_file (const char *filename, const char *mode, gdb_bfd_ref_ptr obfd (bfd_openw_or_error (filename, target, mode)); osection = bfd_make_section_anyway (obfd.get (), ".newsec"); - bfd_set_section_size (obfd.get (), osection, len); - bfd_set_section_vma (obfd.get (), osection, vaddr); - bfd_set_section_alignment (obfd.get (), osection, 0); - bfd_set_section_flags (obfd.get (), osection, (SEC_HAS_CONTENTS - | SEC_ALLOC - | SEC_LOAD)); + bfd_set_section_size (osection, len); + bfd_set_section_vma (osection, vaddr); + bfd_set_section_alignment (osection, 0); + bfd_set_section_flags (osection, (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD)); osection->entsize = 0; if (!bfd_set_section_contents (obfd.get (), osection, buf, 0, len)) warning (_("writing dump file '%s' (%s)"), filename, @@ -403,15 +401,15 @@ static void restore_section_callback (bfd *ibfd, asection *isec, void *args) { struct callback_data *data = (struct callback_data *) args; - bfd_vma sec_start = bfd_section_vma (ibfd, isec); - bfd_size_type size = bfd_section_size (ibfd, isec); + bfd_vma sec_start = bfd_section_vma (isec); + bfd_size_type size = bfd_section_size (isec); bfd_vma sec_end = sec_start + size; bfd_size_type sec_offset = 0; bfd_size_type sec_load_count = size; int ret; /* Ignore non-loadable sections, eg. from elf files. */ - if (!(bfd_get_section_flags (ibfd, isec) & SEC_LOAD)) + if (!(bfd_section_flags (isec) & SEC_LOAD)) return; /* Does the section overlap with the desired restore range? */ @@ -420,7 +418,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args) { /* No, no useable data in this section. */ printf_filtered (_("skipping section %s...\n"), - bfd_section_name (ibfd, isec)); + bfd_section_name (isec)); return; } @@ -441,7 +439,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args) bfd_errmsg (bfd_get_error ())); printf_filtered ("Restoring section %s (0x%lx to 0x%lx)", - bfd_section_name (ibfd, isec), + bfd_section_name (isec), (unsigned long) sec_start, (unsigned long) sec_end); diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c index 9f7384bc146..fe74d26cab3 100644 --- a/gdb/coff-pe-read.c +++ b/gdb/coff-pe-read.c @@ -136,7 +136,7 @@ get_section_vmas (bfd *abfd, asection *sectp, void *context) bfd_get_section_vma() within memory. Store the offset. */ sections[sectix].vma_offset - = bfd_get_section_vma (abfd, sectp) - sections[sectix].rva_start; + = bfd_section_vma (sectp) - sections[sectix].rva_start; } } diff --git a/gdb/coffread.c b/gdb/coffread.c index a70461271e7..c44b69069e4 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -222,15 +222,15 @@ coff_locate_sections (bfd *abfd, asection *sectp, void *csip) const char *name; csi = (struct coff_symfile_info *) csip; - name = bfd_get_section_name (abfd, sectp); + name = bfd_section_name (sectp); if (strcmp (name, ".text") == 0) { - csi->textaddr = bfd_section_vma (abfd, sectp); - csi->textsize += bfd_section_size (abfd, sectp); + csi->textaddr = bfd_section_vma (sectp); + csi->textsize += bfd_section_size (sectp); } else if (startswith (name, ".text")) { - csi->textsize += bfd_section_size (abfd, sectp); + csi->textsize += bfd_section_size (sectp); } else if (strcmp (name, ".stabstr") == 0) { @@ -307,7 +307,7 @@ cs_section_address (struct coff_symbol *cs, bfd *abfd) args.resultp = § bfd_map_over_sections (abfd, find_targ_sec, &args); if (sect != NULL) - addr = bfd_get_section_vma (abfd, sect); + addr = bfd_section_vma (sect); return addr; } @@ -692,7 +692,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) bfd_get_section_contents? */ bfd_seek (abfd, abfd->where, 0); - stabstrsize = bfd_section_size (abfd, info->stabstrsect); + stabstrsize = bfd_section_size (info->stabstrsect); coffstab_build_psymtabs (objfile, info->textaddr, info->textsize, diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c index 3a765a345bf..a30c5573038 100644 --- a/gdb/compile/compile-object-load.c +++ b/gdb/compile/compile-object-load.c @@ -99,30 +99,30 @@ setup_sections (bfd *abfd, asection *sect, void *data_voidp) if (sect->output_section == NULL) sect->output_section = sect; - if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0) + if ((bfd_section_flags (sect) & SEC_ALLOC) == 0) return; /* Make the memory always readable. */ prot = GDB_MMAP_PROT_READ; - if ((bfd_get_section_flags (abfd, sect) & SEC_READONLY) == 0) + if ((bfd_section_flags (sect) & SEC_READONLY) == 0) prot |= GDB_MMAP_PROT_WRITE; - if ((bfd_get_section_flags (abfd, sect) & SEC_CODE) != 0) + if ((bfd_section_flags (sect) & SEC_CODE) != 0) prot |= GDB_MMAP_PROT_EXEC; if (compile_debug) fprintf_unfiltered (gdb_stdlog, "module \"%s\" section \"%s\" size %s prot %u\n", bfd_get_filename (abfd), - bfd_get_section_name (abfd, sect), + bfd_section_name (sect), paddress (target_gdbarch (), - bfd_get_section_size (sect)), + bfd_section_size (sect)), prot); } else prot = -1; if (sect == NULL - || (data->last_prot != prot && bfd_get_section_size (sect) != 0)) + || (data->last_prot != prot && bfd_section_size (sect) != 0)) { CORE_ADDR addr; asection *sect_iter; @@ -150,9 +150,8 @@ setup_sections (bfd *abfd, asection *sect, void *data_voidp) for (sect_iter = data->last_section_first; sect_iter != sect; sect_iter = sect_iter->next) - if ((bfd_get_section_flags (abfd, sect_iter) & SEC_ALLOC) != 0) - bfd_set_section_vma (abfd, sect_iter, - addr + bfd_get_section_vma (abfd, sect_iter)); + if ((bfd_section_flags (sect_iter) & SEC_ALLOC) != 0) + bfd_set_section_vma (sect_iter, addr + bfd_section_vma (sect_iter)); data->last_size = 0; data->last_section_first = sect; @@ -163,14 +162,14 @@ setup_sections (bfd *abfd, asection *sect, void *data_voidp) if (sect == NULL) return; - alignment = ((CORE_ADDR) 1) << bfd_get_section_alignment (abfd, sect); + alignment = ((CORE_ADDR) 1) << bfd_section_alignment (sect); data->last_max_alignment = std::max (data->last_max_alignment, alignment); data->last_size = (data->last_size + alignment - 1) & -alignment; - bfd_set_section_vma (abfd, sect, data->last_size); + bfd_set_section_vma (sect, data->last_size); - data->last_size += bfd_get_section_size (sect); + data->last_size += bfd_section_size (sect); data->last_size = (data->last_size + alignment - 1) & -alignment; } @@ -197,7 +196,7 @@ link_callbacks_warning (struct bfd_link_info *link_info, const char *xwarning, bfd_vma address) { warning (_("Compiled module \"%s\" section \"%s\": warning: %s"), - bfd_get_filename (abfd), bfd_get_section_name (abfd, section), + bfd_get_filename (abfd), bfd_section_name (section), xwarning); } @@ -210,7 +209,7 @@ link_callbacks_undefined_symbol (struct bfd_link_info *link_info, { warning (_("Cannot resolve relocation to \"%s\" " "from compiled module \"%s\" section \"%s\"."), - name, bfd_get_filename (abfd), bfd_get_section_name (abfd, section)); + name, bfd_get_filename (abfd), bfd_section_name (section)); } /* Helper for link_callbacks callbacks vector. */ @@ -233,7 +232,7 @@ link_callbacks_reloc_dangerous (struct bfd_link_info *link_info, { warning (_("Compiled module \"%s\" section \"%s\": dangerous " "relocation: %s\n"), - bfd_get_filename (abfd), bfd_get_section_name (abfd, section), + bfd_get_filename (abfd), bfd_section_name (section), message); } @@ -246,7 +245,7 @@ link_callbacks_unattached_reloc (struct bfd_link_info *link_info, { warning (_("Compiled module \"%s\" section \"%s\": unattached " "relocation: %s\n"), - bfd_get_filename (abfd), bfd_get_section_name (abfd, section), + bfd_get_filename (abfd), bfd_section_name (section), name); } @@ -324,11 +323,11 @@ copy_sections (bfd *abfd, asection *sect, void *data) struct bfd_link_order link_order; CORE_ADDR inferior_addr; - if ((bfd_get_section_flags (abfd, sect) & (SEC_ALLOC | SEC_LOAD)) + if ((bfd_section_flags (sect) & (SEC_ALLOC | SEC_LOAD)) != (SEC_ALLOC | SEC_LOAD)) return; - if (bfd_get_section_size (sect) == 0) + if (bfd_section_size (sect) == 0) return; /* Mostly a copy of bfd_simple_get_relocated_section_contents which GDB @@ -349,11 +348,11 @@ copy_sections (bfd *abfd, asection *sect, void *data) link_order.next = NULL; link_order.type = bfd_indirect_link_order; link_order.offset = 0; - link_order.size = bfd_get_section_size (sect); + link_order.size = bfd_section_size (sect); link_order.u.indirect.section = sect; gdb::unique_xmalloc_ptr<gdb_byte> sect_data - ((bfd_byte *) xmalloc (bfd_get_section_size (sect))); + ((bfd_byte *) xmalloc (bfd_section_size (sect))); sect_data_got = bfd_get_relocated_section_contents (abfd, &link_info, &link_order, @@ -362,19 +361,19 @@ copy_sections (bfd *abfd, asection *sect, void *data) if (sect_data_got == NULL) error (_("Cannot map compiled module \"%s\" section \"%s\": %s"), - bfd_get_filename (abfd), bfd_get_section_name (abfd, sect), + bfd_get_filename (abfd), bfd_section_name (sect), bfd_errmsg (bfd_get_error ())); gdb_assert (sect_data_got == sect_data.get ()); - inferior_addr = bfd_get_section_vma (abfd, sect); + inferior_addr = bfd_section_vma (sect); if (0 != target_write_memory (inferior_addr, sect_data.get (), - bfd_get_section_size (sect))) + bfd_section_size (sect))) error (_("Cannot write compiled module \"%s\" section \"%s\" " "to inferior memory range %s-%s."), - bfd_get_filename (abfd), bfd_get_section_name (abfd, sect), + bfd_get_filename (abfd), bfd_section_name (sect), paddress (target_gdbarch (), inferior_addr), paddress (target_gdbarch (), - inferior_addr + bfd_get_section_size (sect))); + inferior_addr + bfd_section_size (sect))); } /* Fetch the type of COMPILE_I_EXPR_PTR_TYPE and COMPILE_I_EXPR_VAL diff --git a/gdb/corelow.c b/gdb/corelow.c index 5e9634e9d79..b30b91b522d 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -289,10 +289,10 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg) bool fake_pid_p = false; struct inferior *inf; - if (!startswith (bfd_section_name (abfd, asect), ".reg/")) + if (!startswith (bfd_section_name (asect), ".reg/")) return; - core_tid = atoi (bfd_section_name (abfd, asect) + 5); + core_tid = atoi (bfd_section_name (asect) + 5); pid = bfd_core_file_pid (core_bfd); if (pid == 0) @@ -584,7 +584,7 @@ core_target::get_core_register_section (struct regcache *regcache, return; } - size = bfd_section_size (core_bfd, section); + size = bfd_section_size (section); if (size < section_min_size) { warning (_("Section `%s' in core file too small."), @@ -614,8 +614,7 @@ core_target::get_core_register_section (struct regcache *regcache, gdb_assert (m_core_vec != nullptr); m_core_vec->core_read_registers (regcache, contents, size, which, - ((CORE_ADDR) - bfd_section_vma (core_bfd, section))); + (CORE_ADDR) bfd_section_vma (section)); } /* Data passed to gdbarch_iterate_over_regset_sections's callback. */ @@ -727,7 +726,7 @@ add_to_spuid_list (bfd *abfd, asection *asect, void *list_p) = bfd_big_endian (abfd) ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE; int fd, pos = 0; - sscanf (bfd_section_name (abfd, asect), "SPU/%d/regs%n", &fd, &pos); + sscanf (bfd_section_name (asect), "SPU/%d/regs%n", &fd, &pos); if (pos == 0) return; @@ -768,7 +767,7 @@ core_target::xfer_partial (enum target_object object, const char *annex, if (section == NULL) return TARGET_XFER_E_IO; - size = bfd_section_size (core_bfd, section); + size = bfd_section_size (section); if (offset >= size) return TARGET_XFER_EOF; size -= offset; @@ -803,7 +802,7 @@ core_target::xfer_partial (enum target_object object, const char *annex, if (section == NULL) return TARGET_XFER_E_IO; - size = bfd_section_size (core_bfd, section); + size = bfd_section_size (section); if (offset >= size) return TARGET_XFER_EOF; size -= offset; @@ -883,7 +882,7 @@ core_target::xfer_partial (enum target_object object, const char *annex, if (section == NULL) return TARGET_XFER_E_IO; - size = bfd_section_size (core_bfd, section); + size = bfd_section_size (section); if (offset >= size) return TARGET_XFER_EOF; size -= offset; diff --git a/gdb/dbxread.c b/gdb/dbxread.c index dc0b2c727bf..564c5d3a414 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -207,10 +207,10 @@ find_text_range (bfd * sym_bfd, struct objfile *objfile) CORE_ADDR end = 0; for (sec = sym_bfd->sections; sec; sec = sec->next) - if (bfd_get_section_flags (sym_bfd, sec) & SEC_CODE) + if (bfd_section_flags (sec) & SEC_CODE) { - CORE_ADDR sec_start = bfd_section_vma (sym_bfd, sec); - CORE_ADDR sec_end = sec_start + bfd_section_size (sym_bfd, sec); + CORE_ADDR sec_start = bfd_section_vma (sec); + CORE_ADDR sec_end = sec_start + bfd_section_size (sec); if (found_any) { @@ -607,8 +607,8 @@ dbx_symfile_init (struct objfile *objfile) text_sect = bfd_get_section_by_name (sym_bfd, ".text"); if (!text_sect) error (_("Can't find .text section in symbol file")); - DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect); - DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect); + DBX_TEXT_ADDR (objfile) = bfd_section_vma (text_sect); + DBX_TEXT_SIZE (objfile) = bfd_section_size (text_sect); DBX_SYMBOL_SIZE (objfile) = obj_symbol_entry_size (sym_bfd); DBX_SYMCOUNT (objfile) = bfd_get_symcount (sym_bfd); @@ -781,7 +781,7 @@ fill_symbuf (bfd *sym_bfd) if (bfd_seek (sym_bfd, filepos, SEEK_SET) != 0) perror_with_name (bfd_get_filename (sym_bfd)); - symbuf_left = bfd_section_size (sym_bfd, (*symbuf_sections)[sect_idx]); + symbuf_left = bfd_section_size ((*symbuf_sections)[sect_idx]); symbol_table_offset = filepos - symbuf_read; ++sect_idx; } @@ -2980,7 +2980,7 @@ coffstab_build_psymtabs (struct objfile *objfile, = make_scoped_restore (&symbuf_sections); if (stabsects.size () == 1) { - stabsize = bfd_section_size (sym_bfd, stabsects[0]); + stabsize = bfd_section_size (stabsects[0]); DBX_SYMCOUNT (objfile) = stabsize / DBX_SYMBOL_SIZE (objfile); DBX_SYMTAB_OFFSET (objfile) = stabsects[0]->filepos; } @@ -2989,7 +2989,7 @@ coffstab_build_psymtabs (struct objfile *objfile, DBX_SYMCOUNT (objfile) = 0; for (asection *section : stabsects) { - stabsize = bfd_section_size (sym_bfd, section); + stabsize = bfd_section_size (section); DBX_SYMCOUNT (objfile) += stabsize / DBX_SYMBOL_SIZE (objfile); } @@ -2997,7 +2997,7 @@ coffstab_build_psymtabs (struct objfile *objfile, sect_idx = 1; symbuf_sections = &stabsects; - symbuf_left = bfd_section_size (sym_bfd, stabsects[0]); + symbuf_left = bfd_section_size (stabsects[0]); symbuf_read = 0; } @@ -3040,7 +3040,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect, #define ELF_STABS_SYMBOL_SIZE 12 /* XXX FIXME XXX */ DBX_SYMBOL_SIZE (objfile) = ELF_STABS_SYMBOL_SIZE; DBX_SYMCOUNT (objfile) - = bfd_section_size (objfile->obfd, stabsect) / DBX_SYMBOL_SIZE (objfile); + = bfd_section_size (stabsect) / DBX_SYMBOL_SIZE (objfile); DBX_STRINGTAB_SIZE (objfile) = stabstrsize; DBX_SYMTAB_OFFSET (objfile) = stabsect->filepos; DBX_STAB_SECTION (objfile) = stabsect; @@ -3067,7 +3067,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect, processing_acc_compilation = 1; symbuf_read = 0; - symbuf_left = bfd_section_size (objfile->obfd, stabsect); + symbuf_left = bfd_section_size (stabsect); scoped_restore restore_stabs_data = make_scoped_restore (&stabs_data); gdb::unique_xmalloc_ptr<gdb_byte> data_holder; @@ -3128,13 +3128,13 @@ stabsect_build_psymtabs (struct objfile *objfile, char *stab_name, text_sect = bfd_get_section_by_name (sym_bfd, text_name); if (!text_sect) error (_("Can't find %s section in symbol file"), text_name); - DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect); - DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect); + DBX_TEXT_ADDR (objfile) = bfd_section_vma (text_sect); + DBX_TEXT_SIZE (objfile) = bfd_section_size (text_sect); DBX_SYMBOL_SIZE (objfile) = sizeof (struct external_nlist); - DBX_SYMCOUNT (objfile) = bfd_section_size (sym_bfd, stabsect) + DBX_SYMCOUNT (objfile) = bfd_section_size (stabsect) / DBX_SYMBOL_SIZE (objfile); - DBX_STRINGTAB_SIZE (objfile) = bfd_section_size (sym_bfd, stabstrsect); + DBX_STRINGTAB_SIZE (objfile) = bfd_section_size (stabstrsect); DBX_SYMTAB_OFFSET (objfile) = stabsect->filepos; /* XXX - FIXME: POKING INSIDE BFD DATA STRUCTURES */ diff --git a/gdb/dicos-tdep.c b/gdb/dicos-tdep.c index 954428a1101..3ef9114b105 100644 --- a/gdb/dicos-tdep.c +++ b/gdb/dicos-tdep.c @@ -70,7 +70,7 @@ dicos_load_module_p (bfd *abfd, int header_size) if (!section) return 0; - if (bfd_section_size (abfd, section) != header_size) + if (bfd_section_size (section) != header_size) return 0; /* Dicos LMs always have a "Dicos_loadModuleInfo" symbol diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index e18b35e7dba..34b8cbcb768 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -1565,7 +1565,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding, base = 0; break; case DW_EH_PE_pcrel: - base = bfd_get_section_vma (unit->abfd, unit->dwarf_frame_section); + base = bfd_section_vma (unit->dwarf_frame_section); base += (buf - unit->dwarf_frame_buffer); break; case DW_EH_PE_datarel: diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index ea9904c4162..5e71ded2039 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2280,7 +2280,7 @@ get_section_name (const struct dwarf2_section_info *section) asection *sectp = get_section_bfd_section (section); gdb_assert (sectp != NULL); - return bfd_section_name (get_section_bfd_owner (section), sectp); + return bfd_section_name (sectp); } /* Return the name of the file SECTION is in. */ @@ -2315,7 +2315,7 @@ get_section_flags (const struct dwarf2_section_info *section) asection *sectp = get_section_bfd_section (section); gdb_assert (sectp != NULL); - return bfd_get_section_flags (sectp->owner, sectp); + return bfd_section_flags (sectp); } /* When loading sections, we look either for uncompressed section or for @@ -2340,7 +2340,7 @@ void dwarf2_per_objfile::locate_sections (bfd *abfd, asection *sectp, const dwarf2_debug_sections &names) { - flagword aflag = bfd_get_section_flags (abfd, sectp); + flagword aflag = bfd_section_flags (sectp); if ((aflag & SEC_HAS_CONTENTS) == 0) { @@ -2348,72 +2348,72 @@ dwarf2_per_objfile::locate_sections (bfd *abfd, asection *sectp, else if (section_is_p (sectp->name, &names.info)) { this->info.s.section = sectp; - this->info.size = bfd_get_section_size (sectp); + this->info.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.abbrev)) { this->abbrev.s.section = sectp; - this->abbrev.size = bfd_get_section_size (sectp); + this->abbrev.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.line)) { this->line.s.section = sectp; - this->line.size = bfd_get_section_size (sectp); + this->line.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.loc)) { this->loc.s.section = sectp; - this->loc.size = bfd_get_section_size (sectp); + this->loc.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.loclists)) { this->loclists.s.section = sectp; - this->loclists.size = bfd_get_section_size (sectp); + this->loclists.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.macinfo)) { this->macinfo.s.section = sectp; - this->macinfo.size = bfd_get_section_size (sectp); + this->macinfo.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.macro)) { this->macro.s.section = sectp; - this->macro.size = bfd_get_section_size (sectp); + this->macro.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.str)) { this->str.s.section = sectp; - this->str.size = bfd_get_section_size (sectp); + this->str.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.line_str)) { this->line_str.s.section = sectp; - this->line_str.size = bfd_get_section_size (sectp); + this->line_str.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.addr)) { this->addr.s.section = sectp; - this->addr.size = bfd_get_section_size (sectp); + this->addr.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.frame)) { this->frame.s.section = sectp; - this->frame.size = bfd_get_section_size (sectp); + this->frame.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.eh_frame)) { this->eh_frame.s.section = sectp; - this->eh_frame.size = bfd_get_section_size (sectp); + this->eh_frame.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.ranges)) { this->ranges.s.section = sectp; - this->ranges.size = bfd_get_section_size (sectp); + this->ranges.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.rnglists)) { this->rnglists.s.section = sectp; - this->rnglists.size = bfd_get_section_size (sectp); + this->rnglists.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.types)) { @@ -2421,28 +2421,28 @@ dwarf2_per_objfile::locate_sections (bfd *abfd, asection *sectp, memset (&type_section, 0, sizeof (type_section)); type_section.s.section = sectp; - type_section.size = bfd_get_section_size (sectp); + type_section.size = bfd_section_size (sectp); this->types.push_back (type_section); } else if (section_is_p (sectp->name, &names.gdb_index)) { this->gdb_index.s.section = sectp; - this->gdb_index.size = bfd_get_section_size (sectp); + this->gdb_index.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.debug_names)) { this->debug_names.s.section = sectp; - this->debug_names.size = bfd_get_section_size (sectp); + this->debug_names.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names.debug_aranges)) { this->debug_aranges.s.section = sectp; - this->debug_aranges.size = bfd_get_section_size (sectp); + this->debug_aranges.size = bfd_section_size (sectp); } - if ((bfd_get_section_flags (abfd, sectp) & (SEC_LOAD | SEC_ALLOC)) - && bfd_section_vma (abfd, sectp) == 0) + if ((bfd_section_flags (sectp) & (SEC_LOAD | SEC_ALLOC)) + && bfd_section_vma (sectp) == 0) this->has_section_at_zero = true; } @@ -2531,7 +2531,7 @@ dwarf2_read_section (struct objfile *objfile, dwarf2_section_info *info) { error (_("Dwarf Error: Can't read DWARF data" " in section %s [in module %s]"), - bfd_section_name (abfd, sectp), bfd_get_filename (abfd)); + bfd_section_name (sectp), bfd_get_filename (abfd)); } } @@ -2603,37 +2603,37 @@ locate_dwz_sections (bfd *abfd, asection *sectp, void *arg) if (section_is_p (sectp->name, &dwarf2_elf_names.abbrev)) { dwz_file->abbrev.s.section = sectp; - dwz_file->abbrev.size = bfd_get_section_size (sectp); + dwz_file->abbrev.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &dwarf2_elf_names.info)) { dwz_file->info.s.section = sectp; - dwz_file->info.size = bfd_get_section_size (sectp); + dwz_file->info.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &dwarf2_elf_names.str)) { dwz_file->str.s.section = sectp; - dwz_file->str.size = bfd_get_section_size (sectp); + dwz_file->str.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &dwarf2_elf_names.line)) { dwz_file->line.s.section = sectp; - dwz_file->line.size = bfd_get_section_size (sectp); + dwz_file->line.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &dwarf2_elf_names.macro)) { dwz_file->macro.s.section = sectp; - dwz_file->macro.size = bfd_get_section_size (sectp); + dwz_file->macro.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &dwarf2_elf_names.gdb_index)) { dwz_file->gdb_index.s.section = sectp; - dwz_file->gdb_index.size = bfd_get_section_size (sectp); + dwz_file->gdb_index.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &dwarf2_elf_names.debug_names)) { dwz_file->debug_names.s.section = sectp; - dwz_file->debug_names.size = bfd_get_section_size (sectp); + dwz_file->debug_names.size = bfd_section_size (sectp); } } @@ -12311,7 +12311,7 @@ locate_v1_virtual_dwo_sections (asection *sectp, if (sections->abbrev.s.section != NULL) return 0; sections->abbrev.s.section = sectp; - sections->abbrev.size = bfd_get_section_size (sectp); + sections->abbrev.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->info_dwo) || section_is_p (sectp->name, &names->types_dwo)) @@ -12320,7 +12320,7 @@ locate_v1_virtual_dwo_sections (asection *sectp, if (sections->info_or_types.s.section != NULL) return 0; sections->info_or_types.s.section = sectp; - sections->info_or_types.size = bfd_get_section_size (sectp); + sections->info_or_types.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->line_dwo)) { @@ -12328,7 +12328,7 @@ locate_v1_virtual_dwo_sections (asection *sectp, if (sections->line.s.section != NULL) return 0; sections->line.s.section = sectp; - sections->line.size = bfd_get_section_size (sectp); + sections->line.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->loc_dwo)) { @@ -12336,7 +12336,7 @@ locate_v1_virtual_dwo_sections (asection *sectp, if (sections->loc.s.section != NULL) return 0; sections->loc.s.section = sectp; - sections->loc.size = bfd_get_section_size (sectp); + sections->loc.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->macinfo_dwo)) { @@ -12344,7 +12344,7 @@ locate_v1_virtual_dwo_sections (asection *sectp, if (sections->macinfo.s.section != NULL) return 0; sections->macinfo.s.section = sectp; - sections->macinfo.size = bfd_get_section_size (sectp); + sections->macinfo.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->macro_dwo)) { @@ -12352,7 +12352,7 @@ locate_v1_virtual_dwo_sections (asection *sectp, if (sections->macro.s.section != NULL) return 0; sections->macro.s.section = sectp; - sections->macro.size = bfd_get_section_size (sectp); + sections->macro.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->str_offsets_dwo)) { @@ -12360,7 +12360,7 @@ locate_v1_virtual_dwo_sections (asection *sectp, if (sections->str_offsets.s.section != NULL) return 0; sections->str_offsets.s.section = sectp; - sections->str_offsets.size = bfd_get_section_size (sectp); + sections->str_offsets.size = bfd_section_size (sectp); } else { @@ -12558,11 +12558,11 @@ create_dwp_v2_section (struct dwarf2_per_objfile *dwarf2_per_objfile, bounds of the real section. This is a pretty-rare event, so just flag an error (easier) instead of a warning and trying to cope. */ if (sectp == NULL - || offset + size > bfd_get_section_size (sectp)) + || offset + size > bfd_section_size (sectp)) { error (_("Dwarf Error: Bad DWP V2 section info, doesn't fit" " in section %s [in module %s]"), - sectp ? bfd_section_name (abfd, sectp) : "<unknown>", + sectp ? bfd_section_name (sectp) : "<unknown>", objfile_name (dwarf2_per_objfile->objfile)); } @@ -12933,42 +12933,42 @@ dwarf2_locate_dwo_sections (bfd *abfd, asection *sectp, void *dwo_sections_ptr) if (section_is_p (sectp->name, &names->abbrev_dwo)) { dwo_sections->abbrev.s.section = sectp; - dwo_sections->abbrev.size = bfd_get_section_size (sectp); + dwo_sections->abbrev.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->info_dwo)) { dwo_sections->info.s.section = sectp; - dwo_sections->info.size = bfd_get_section_size (sectp); + dwo_sections->info.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->line_dwo)) { dwo_sections->line.s.section = sectp; - dwo_sections->line.size = bfd_get_section_size (sectp); + dwo_sections->line.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->loc_dwo)) { dwo_sections->loc.s.section = sectp; - dwo_sections->loc.size = bfd_get_section_size (sectp); + dwo_sections->loc.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->macinfo_dwo)) { dwo_sections->macinfo.s.section = sectp; - dwo_sections->macinfo.size = bfd_get_section_size (sectp); + dwo_sections->macinfo.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->macro_dwo)) { dwo_sections->macro.s.section = sectp; - dwo_sections->macro.size = bfd_get_section_size (sectp); + dwo_sections->macro.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->str_dwo)) { dwo_sections->str.s.section = sectp; - dwo_sections->str.size = bfd_get_section_size (sectp); + dwo_sections->str.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->str_offsets_dwo)) { dwo_sections->str_offsets.s.section = sectp; - dwo_sections->str_offsets.size = bfd_get_section_size (sectp); + dwo_sections->str_offsets.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->types_dwo)) { @@ -12976,7 +12976,7 @@ dwarf2_locate_dwo_sections (bfd *abfd, asection *sectp, void *dwo_sections_ptr) memset (&type_section, 0, sizeof (type_section)); type_section.s.section = sectp; - type_section.size = bfd_get_section_size (sectp); + type_section.size = bfd_section_size (sectp); dwo_sections->types.push_back (type_section); } } @@ -13040,17 +13040,17 @@ dwarf2_locate_common_dwp_sections (bfd *abfd, asection *sectp, if (section_is_p (sectp->name, &names->str_dwo)) { dwp_file->sections.str.s.section = sectp; - dwp_file->sections.str.size = bfd_get_section_size (sectp); + dwp_file->sections.str.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->cu_index)) { dwp_file->sections.cu_index.s.section = sectp; - dwp_file->sections.cu_index.size = bfd_get_section_size (sectp); + dwp_file->sections.cu_index.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->tu_index)) { dwp_file->sections.tu_index.s.section = sectp; - dwp_file->sections.tu_index.size = bfd_get_section_size (sectp); + dwp_file->sections.tu_index.size = bfd_section_size (sectp); } } @@ -13075,42 +13075,42 @@ dwarf2_locate_v2_dwp_sections (bfd *abfd, asection *sectp, void *dwp_file_ptr) if (section_is_p (sectp->name, &names->abbrev_dwo)) { dwp_file->sections.abbrev.s.section = sectp; - dwp_file->sections.abbrev.size = bfd_get_section_size (sectp); + dwp_file->sections.abbrev.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->info_dwo)) { dwp_file->sections.info.s.section = sectp; - dwp_file->sections.info.size = bfd_get_section_size (sectp); + dwp_file->sections.info.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->line_dwo)) { dwp_file->sections.line.s.section = sectp; - dwp_file->sections.line.size = bfd_get_section_size (sectp); + dwp_file->sections.line.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->loc_dwo)) { dwp_file->sections.loc.s.section = sectp; - dwp_file->sections.loc.size = bfd_get_section_size (sectp); + dwp_file->sections.loc.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->macinfo_dwo)) { dwp_file->sections.macinfo.s.section = sectp; - dwp_file->sections.macinfo.size = bfd_get_section_size (sectp); + dwp_file->sections.macinfo.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->macro_dwo)) { dwp_file->sections.macro.s.section = sectp; - dwp_file->sections.macro.size = bfd_get_section_size (sectp); + dwp_file->sections.macro.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->str_offsets_dwo)) { dwp_file->sections.str_offsets.s.section = sectp; - dwp_file->sections.str_offsets.size = bfd_get_section_size (sectp); + dwp_file->sections.str_offsets.size = bfd_section_size (sectp); } else if (section_is_p (sectp->name, &names->types_dwo)) { dwp_file->sections.types.s.section = sectp; - dwp_file->sections.types.size = bfd_get_section_size (sectp); + dwp_file->sections.types.size = bfd_section_size (sectp); } } diff --git a/gdb/elfread.c b/gdb/elfread.c index 630550b80dc..901710f2833 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -125,7 +125,7 @@ elf_symfile_segments (bfd *abfd) { int j; - if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0) + if ((bfd_section_flags (sect) & SEC_ALLOC) == 0) continue; Elf_Internal_Shdr *this_hdr = &elf_section_data (sect)->this_hdr; @@ -146,10 +146,10 @@ elf_symfile_segments (bfd *abfd) RealView) use SHT_NOBITS for uninitialized data. Since it is uninitialized, it doesn't need a program header. Such binaries are not relocatable. */ - if (bfd_get_section_size (sect) > 0 && j == num_segments - && (bfd_get_section_flags (abfd, sect) & SEC_LOAD) != 0) + if (bfd_section_size (sect) > 0 && j == num_segments + && (bfd_section_flags (sect) & SEC_LOAD) != 0) warning (_("Loadable section \"%s\" outside of ELF segments"), - bfd_section_name (abfd, sect)); + bfd_section_name (sect)); } return data; @@ -289,12 +289,12 @@ elf_symtab_read (minimal_symbol_reader &reader, covers the stub's address. */ for (sect = abfd->sections; sect != NULL; sect = sect->next) { - if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0) + if ((bfd_section_flags (sect) & SEC_ALLOC) == 0) continue; - if (symaddr >= bfd_get_section_vma (abfd, sect) - && symaddr < bfd_get_section_vma (abfd, sect) - + bfd_get_section_size (sect)) + if (symaddr >= bfd_section_vma (sect) + && symaddr < bfd_section_vma (sect) + + bfd_section_size (sect)) break; } if (!sect) @@ -591,9 +591,9 @@ elf_rel_plt_read (minimal_symbol_reader &reader, if (section == NULL) return false; - return (bfd_get_section_vma (obfd, section) <= address - && (address < bfd_get_section_vma (obfd, section) - + bfd_get_section_size (section))); + return (bfd_section_vma (section) <= address + && (address < bfd_section_vma (section) + + bfd_section_size (section))); }; reloc_count = relplt->size / elf_section_data (relplt)->this_hdr.sh_entsize; @@ -1236,7 +1236,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) elfstab_build_psymtabs (objfile, ei.stabsect, str_sect->filepos, - bfd_section_size (abfd, str_sect)); + bfd_section_size (str_sect)); } if (dwarf2_has_info (objfile, NULL)) diff --git a/gdb/exec.c b/gdb/exec.c index 4e4cacffda0..6bdf9abb3e4 100644 --- a/gdb/exec.c +++ b/gdb/exec.c @@ -454,14 +454,14 @@ add_to_section_table (bfd *abfd, struct bfd_section *asect, encountered on sparc-solaris 2.10 a shared library with an empty .bss section to which a symbol named "_end" was attached. The address of this symbol still needs to be relocated. */ - aflag = bfd_get_section_flags (abfd, asect); + aflag = bfd_section_flags (asect); if (!(aflag & SEC_ALLOC)) return; (*table_pp)->owner = NULL; (*table_pp)->the_bfd_section = asect; - (*table_pp)->addr = bfd_section_vma (abfd, asect); - (*table_pp)->endaddr = (*table_pp)->addr + bfd_section_size (abfd, asect); + (*table_pp)->addr = bfd_section_vma (asect); + (*table_pp)->endaddr = (*table_pp)->addr + bfd_section_size (asect); (*table_pp)++; } @@ -571,7 +571,7 @@ add_target_sections_of_objfile (struct objfile *objfile) /* Compute the number of sections to add. */ ALL_OBJFILE_OSECTIONS (objfile, osect) { - if (bfd_get_section_size (osect->the_bfd_section) == 0) + if (bfd_section_size (osect->the_bfd_section) == 0) continue; count++; } @@ -585,7 +585,7 @@ add_target_sections_of_objfile (struct objfile *objfile) ALL_OBJFILE_OSECTIONS (objfile, osect) { - if (bfd_get_section_size (osect->the_bfd_section) == 0) + if (bfd_section_size (osect->the_bfd_section) == 0) continue; gdb_assert (ts < table->sections + space + count); @@ -665,7 +665,7 @@ exec_read_partial_read_only (gdb_byte *readbuf, ULONGEST offset, continue; vma = s->vma; - size = bfd_get_section_size (s); + size = bfd_section_size (s); if (vma <= offset && offset < (vma + size)) { ULONGEST amt; @@ -705,9 +705,7 @@ section_table_available_memory (CORE_ADDR memaddr, ULONGEST len, for (target_section *p = sections; p < sections_end; p++) { - if ((bfd_get_section_flags (p->the_bfd_section->owner, - p->the_bfd_section) - & SEC_READONLY) == 0) + if ((bfd_section_flags (p->the_bfd_section) & SEC_READONLY) == 0) continue; /* Copy the meta-data, adjusted. */ @@ -894,17 +892,16 @@ print_section_info (struct target_section_table *t, bfd *abfd) for (p = t->sections; p < t->sections_end; p++) { struct bfd_section *psect = p->the_bfd_section; - bfd *pbfd = psect->owner; - if ((bfd_get_section_flags (pbfd, psect) & (SEC_ALLOC | SEC_LOAD)) + if ((bfd_section_flags (psect) & (SEC_ALLOC | SEC_LOAD)) != (SEC_ALLOC | SEC_LOAD)) continue; - if (bfd_get_section_vma (pbfd, psect) <= abfd->start_address - && abfd->start_address < (bfd_get_section_vma (pbfd, psect) - + bfd_get_section_size (psect))) + if (bfd_section_vma (psect) <= abfd->start_address + && abfd->start_address < (bfd_section_vma (psect) + + bfd_section_size (psect))) { - displacement = p->addr - bfd_get_section_vma (pbfd, psect); + displacement = p->addr - bfd_section_vma (psect); break; } } @@ -935,7 +932,7 @@ print_section_info (struct target_section_table *t, bfd *abfd) if (info_verbose) printf_filtered (" @ %s", hex_string_custom (psect->filepos, 8)); - printf_filtered (" is %s", bfd_section_name (pbfd, psect)); + printf_filtered (" is %s", bfd_section_name (psect)); if (pbfd != abfd) printf_filtered (" in %s", bfd_get_filename (pbfd)); printf_filtered ("\n"); @@ -975,9 +972,8 @@ set_section_command (const char *args, int from_tty) table = current_target_sections; for (p = table->sections; p < table->sections_end; p++) { - if (!strncmp (secname, bfd_section_name (p->bfd, - p->the_bfd_section), seclen) - && bfd_section_name (p->bfd, p->the_bfd_section)[seclen] == '\0') + if (!strncmp (secname, bfd_section_name (p->the_bfd_section), seclen) + && bfd_section_name (p->the_bfd_section)[seclen] == '\0') { offset = secaddr - p->addr; p->addr += offset; diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c index e81c6c99bff..9422e3c1a7e 100644 --- a/gdb/fbsd-tdep.c +++ b/gdb/fbsd-tdep.c @@ -502,10 +502,10 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr) thread_section_name section_name (".thrmisc", thr->ptid); section = bfd_get_section_by_name (core_bfd, section_name.c_str ()); - if (section != NULL && bfd_section_size (core_bfd, section) > 0) + if (section != NULL && bfd_section_size (section) > 0) { /* Truncate the name if it is longer than "buf". */ - size = bfd_section_size (core_bfd, section); + size = bfd_section_size (section); if (size > sizeof buf - 1) size = sizeof buf - 1; if (bfd_get_section_contents (core_bfd, section, buf, (file_ptr) 0, @@ -1058,7 +1058,7 @@ fbsd_core_info_proc_files (struct gdbarch *gdbarch) return; } - size_t note_size = bfd_get_section_size (section); + size_t note_size = bfd_section_size (section); if (note_size < 4) error (_("malformed core note - too short for header")); @@ -1191,7 +1191,7 @@ fbsd_core_info_proc_mappings (struct gdbarch *gdbarch) return; } - note_size = bfd_get_section_size (section); + note_size = bfd_section_size (section); if (note_size < 4) error (_("malformed core note - too short for header")); @@ -1239,7 +1239,7 @@ fbsd_core_vnode_path (struct gdbarch *gdbarch, int fd) if (section == NULL) return nullptr; - note_size = bfd_get_section_size (section); + note_size = bfd_section_size (section); if (note_size < 4) error (_("malformed core note - too short for header")); @@ -1344,7 +1344,7 @@ fbsd_core_info_proc_status (struct gdbarch *gdbarch) * structure size, then it must be long enough to access the last * field used (ki_rusage_ch.ru_majflt) which is the size of a long. */ - note_size = bfd_get_section_size (section); + note_size = bfd_section_size (section); if (note_size < (4 + kp->ki_rusage_ch + kp->ru_majflt + long_bit / TARGET_CHAR_BIT)) error (_("malformed core note - too short")); diff --git a/gdb/gcore.c b/gdb/gcore.c index eb108feb790..f283ed4580d 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -95,9 +95,9 @@ write_gcore_file_1 (bfd *obfd) error (_("Failed to create 'note' section for corefile: %s"), bfd_errmsg (bfd_get_error ())); - bfd_set_section_vma (obfd, note_sec, 0); - bfd_set_section_alignment (obfd, note_sec, 0); - bfd_set_section_size (obfd, note_sec, note_size); + bfd_set_section_vma (note_sec, 0); + bfd_set_section_alignment (note_sec, 0); + bfd_set_section_size (note_sec, note_size); /* Now create the memory/load sections. */ if (gcore_memory_sections (obfd) == 0) @@ -332,11 +332,11 @@ derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top) for (sec = abfd->sections; sec; sec = sec->next) { - if (bfd_get_section_flags (abfd, sec) & SEC_DATA - || strcmp (".bss", bfd_section_name (abfd, sec)) == 0) + if (bfd_section_flags (sec) & SEC_DATA + || strcmp (".bss", bfd_section_name (sec)) == 0) { - sec_vaddr = bfd_get_section_vma (abfd, sec); - sec_size = bfd_get_section_size (sec); + sec_vaddr = bfd_section_vma (sec); + sec_size = bfd_section_size (sec); if (sec_vaddr + sec_size > top_of_data_memory) top_of_data_memory = sec_vaddr + sec_size; } @@ -365,17 +365,17 @@ make_output_phdrs (bfd *obfd, asection *osec, void *ignored) int p_type = 0; /* FIXME: these constants may only be applicable for ELF. */ - if (startswith (bfd_section_name (obfd, osec), "load")) + if (startswith (bfd_section_name (osec), "load")) p_type = PT_LOAD; - else if (startswith (bfd_section_name (obfd, osec), "note")) + else if (startswith (bfd_section_name (osec), "note")) p_type = PT_NOTE; else p_type = PT_NULL; p_flags |= PF_R; /* Segment is readable. */ - if (!(bfd_get_section_flags (obfd, osec) & SEC_READONLY)) + if (!(bfd_section_flags (osec) & SEC_READONLY)) p_flags |= PF_W; /* Segment is writable. */ - if (bfd_get_section_flags (obfd, osec) & SEC_CODE) + if (bfd_section_flags (osec) & SEC_CODE) p_flags |= PF_X; /* Segment is executable. */ bfd_record_phdr (obfd, p_type, 1, p_flags, 0, 0, 0, 0, 1, &osec); @@ -417,8 +417,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read, { bfd *abfd = objfile->obfd; asection *asec = objsec->the_bfd_section; - bfd_vma align = (bfd_vma) 1 << bfd_get_section_alignment (abfd, - asec); + bfd_vma align = (bfd_vma) 1 << bfd_section_alignment (asec); bfd_vma start = obj_section_addr (objsec) & -align; bfd_vma end = (obj_section_endaddr (objsec) + align - 1) & -align; @@ -464,9 +463,9 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read, plongest (size), paddress (target_gdbarch (), vaddr)); } - bfd_set_section_size (obfd, osec, size); - bfd_set_section_vma (obfd, osec, vaddr); - bfd_section_lma (obfd, osec) = 0; /* ??? bfd_set_section_lma? */ + bfd_set_section_size (osec, size); + bfd_set_section_vma (osec, vaddr); + bfd_set_section_lma (osec, 0); return 0; } @@ -482,9 +481,8 @@ objfile_find_memory_regions (struct target_ops *self, for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, objsec) { - bfd *ibfd = objfile->obfd; asection *isec = objsec->the_bfd_section; - flagword flags = bfd_get_section_flags (ibfd, isec); + flagword flags = bfd_section_flags (isec); /* Separate debug info files are irrelevant for gcore. */ if (objfile->separate_debug_objfile_backlink != NULL) @@ -492,7 +490,7 @@ objfile_find_memory_regions (struct target_ops *self, if ((flags & SEC_ALLOC) || (flags & SEC_LOAD)) { - int size = bfd_section_size (ibfd, isec); + int size = bfd_section_size (isec); int ret; ret = (*func) (obj_section_addr (objsec), size, @@ -530,15 +528,15 @@ objfile_find_memory_regions (struct target_ops *self, static void gcore_copy_callback (bfd *obfd, asection *osec, void *ignored) { - bfd_size_type size, total_size = bfd_section_size (obfd, osec); + bfd_size_type size, total_size = bfd_section_size (osec); file_ptr offset = 0; /* Read-only sections are marked; we don't have to copy their contents. */ - if ((bfd_get_section_flags (obfd, osec) & SEC_LOAD) == 0) + if ((bfd_section_flags (osec) & SEC_LOAD) == 0) return; /* Only interested in "load" sections. */ - if (!startswith (bfd_section_name (obfd, osec), "load")) + if (!startswith (bfd_section_name (osec), "load")) return; size = std::min (total_size, (bfd_size_type) MAX_COPY_BYTES); @@ -549,13 +547,13 @@ gcore_copy_callback (bfd *obfd, asection *osec, void *ignored) if (size > total_size) size = total_size; - if (target_read_memory (bfd_section_vma (obfd, osec) + offset, + if (target_read_memory (bfd_section_vma (osec) + offset, memhunk.data (), size) != 0) { warning (_("Memory read failed for corefile " "section, %s bytes at %s."), plongest (size), - paddress (target_gdbarch (), bfd_section_vma (obfd, osec))); + paddress (target_gdbarch (), bfd_section_vma (osec))); break; } if (!bfd_set_section_contents (obfd, osec, memhunk.data (), diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index a17460a8a00..8a67d5e97d7 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -480,7 +480,7 @@ static void free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore) { struct gdb_bfd_section_data *sect - = (struct gdb_bfd_section_data *) bfd_get_section_userdata (abfd, sectp); + = (struct gdb_bfd_section_data *) bfd_section_userdata (sectp); if (sect != NULL && sect->data != NULL) { @@ -626,14 +626,13 @@ get_section_descriptor (asection *section) { struct gdb_bfd_section_data *result; - result = ((struct gdb_bfd_section_data *) - bfd_get_section_userdata (section->owner, section)); + result = (struct gdb_bfd_section_data *) bfd_section_userdata (section); if (result == NULL) { result = ((struct gdb_bfd_section_data *) bfd_zalloc (section->owner, sizeof (*result))); - bfd_set_section_userdata (section->owner, section, result); + bfd_set_section_userdata (section, result); } return result; @@ -671,9 +670,9 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size) /* Only try to mmap sections which are large enough: we don't want to waste space due to fragmentation. */ - if (bfd_get_section_size (sectp) > 4 * pagesize) + if (bfd_section_size (sectp) > 4 * pagesize) { - descriptor->size = bfd_get_section_size (sectp); + descriptor->size = bfd_section_size (sectp); descriptor->data = bfd_mmap (abfd, 0, descriptor->size, PROT_READ, MAP_PRIVATE, sectp->filepos, &descriptor->map_addr, @@ -697,14 +696,14 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size) /* Handle compressed sections, or ordinary uncompressed sections in the no-mmap case. */ - descriptor->size = bfd_get_section_size (sectp); + descriptor->size = bfd_section_size (sectp); descriptor->data = NULL; data = NULL; if (!bfd_get_full_section_contents (abfd, sectp, &data)) { warning (_("Can't read data for section '%s' in file '%s'"), - bfd_get_section_name (abfd, sectp), + bfd_section_name (sectp), bfd_get_filename (abfd)); /* Set size to 0 to prevent further attempts to read the invalid section. */ diff --git a/gdb/gdb_bfd.h b/gdb/gdb_bfd.h index aa67fc0a140..674880d07ff 100644 --- a/gdb/gdb_bfd.h +++ b/gdb/gdb_bfd.h @@ -106,7 +106,7 @@ void gdb_bfd_record_inclusion (bfd *includer, bfd *includee); /* Try to read or map the contents of the section SECT. If successful, the section data is returned and *SIZE is set to the size of the section data; - this may not be the same as the size according to bfd_get_section_size if the + this may not be the same as the size according to bfd_section_size if the section was compressed. The returned section data is associated with the BFD and will be destroyed when the BFD is destroyed. There is no other way to free it; for temporary uses of section data, see bfd_malloc_and_get_section. diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index b1f71883ec3..249d5c91bd1 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -380,7 +380,7 @@ read_unwind_info (struct objfile *objfile) if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0 || strcmp (unwind_sec->name, ".PARISC.unwind") == 0) { - unwind_size = bfd_section_size (objfile->obfd, unwind_sec); + unwind_size = bfd_section_size (unwind_sec); unwind_entries = unwind_size / UNWIND_ENTRY_SIZE; total_entries += unwind_entries; @@ -393,7 +393,7 @@ read_unwind_info (struct objfile *objfile) if (stub_unwind_sec) { - stub_unwind_size = bfd_section_size (objfile->obfd, stub_unwind_sec); + stub_unwind_size = bfd_section_size (stub_unwind_sec); stub_entries = stub_unwind_size / STUB_UNWIND_ENTRY_SIZE; } else @@ -421,7 +421,7 @@ read_unwind_info (struct objfile *objfile) if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0 || strcmp (unwind_sec->name, ".PARISC.unwind") == 0) { - unwind_size = bfd_section_size (objfile->obfd, unwind_sec); + unwind_size = bfd_section_size (unwind_sec); unwind_entries = unwind_size / UNWIND_ENTRY_SIZE; internalize_unwinds (objfile, &ui->table[index], unwind_sec, diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c index 0e3ba82b764..25c3cfcbb98 100644 --- a/gdb/i386-cygwin-tdep.c +++ b/gdb/i386-cygwin-tdep.c @@ -110,14 +110,14 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj) if (!startswith (sect->name, ".module")) return; - buf = (gdb_byte *) xmalloc (bfd_get_section_size (sect) + 1); + buf = (gdb_byte *) xmalloc (bfd_section_size (sect) + 1); if (!buf) { printf_unfiltered ("memory allocation failed for %s\n", sect->name); goto out; } if (!bfd_get_section_contents (abfd, sect, - buf, 0, bfd_get_section_size (sect))) + buf, 0, bfd_section_size (sect))) goto out; @@ -130,7 +130,7 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj) module_name_size = extract_unsigned_integer (buf + 8, 4, byte_order); - if (12 + module_name_size > bfd_get_section_size (sect)) + if (12 + module_name_size > bfd_section_size (sect)) goto out; module_name = (char *) buf + 12; @@ -240,7 +240,7 @@ i386_cygwin_osabi_sniffer (bfd *abfd) { asection *section = bfd_get_section_by_name (abfd, ".reg"); if (section - && bfd_section_size (abfd, section) == I386_WINDOWS_SIZEOF_GREGSET) + && bfd_section_size (section) == I386_WINDOWS_SIZEOF_GREGSET) return GDB_OSABI_CYGWIN; } diff --git a/gdb/i386-fbsd-tdep.c b/gdb/i386-fbsd-tdep.c index 3848bf890d4..04d0a641b72 100644 --- a/gdb/i386-fbsd-tdep.c +++ b/gdb/i386-fbsd-tdep.c @@ -233,7 +233,7 @@ i386fbsd_core_read_xcr0 (bfd *abfd) if (xstate) { - size_t size = bfd_section_size (abfd, xstate); + size_t size = bfd_section_size (xstate); /* Check extended state size. */ if (size < X86_XSTATE_AVX_SIZE) diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 760d00008f4..c41013984ee 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -646,7 +646,7 @@ i386_linux_core_read_xcr0 (bfd *abfd) if (xstate) { - size_t size = bfd_section_size (abfd, xstate); + size_t size = bfd_section_size (xstate); /* Check extended state size. */ if (size < X86_XSTATE_AVX_SIZE) diff --git a/gdb/jit.c b/gdb/jit.c index 4722d6c6ce4..af01b4d6c4f 100644 --- a/gdb/jit.c +++ b/gdb/jit.c @@ -910,12 +910,12 @@ JITed symbol file is not an object file, ignoring it.\n")); addresses that we care about. */ section_addr_info sai; for (sec = nbfd->sections; sec != NULL; sec = sec->next) - if ((bfd_get_section_flags (nbfd.get (), sec) & (SEC_ALLOC|SEC_LOAD)) != 0) + if ((bfd_section_flags (sec) & (SEC_ALLOC|SEC_LOAD)) != 0) { /* We assume that these virtual addresses are absolute, and do not treat them as offsets. */ - sai.emplace_back (bfd_get_section_vma (nbfd.get (), sec), - bfd_get_section_name (nbfd.get (), sec), + sai.emplace_back (bfd_section_vma (sec), + bfd_section_name (sec), sec->index); } diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index ff888a90678..63a9bd32dfd 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -1046,7 +1046,7 @@ linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args) addr_size_bits = gdbarch_addr_bit (core_gdbarch); addr_size = addr_size_bits / 8; - note_size = bfd_get_section_size (section); + note_size = bfd_section_size (section); if (note_size < 2 * addr_size) error (_("malformed core note - too short for header")); diff --git a/gdb/machoread.c b/gdb/machoread.c index d7471e9572c..1795982a3e8 100644 --- a/gdb/machoread.c +++ b/gdb/machoread.c @@ -575,7 +575,7 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd, sec->name, sym->name, paddress (arch, res)); } - bfd_set_section_vma (abfd.get (), sec, res); + bfd_set_section_vma (sec, res); sections_rebased[sec->index] = 1; } } @@ -854,8 +854,7 @@ macho_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) { if (strcmp (asect->name, dsect->name) != 0) break; - bfd_set_section_size (dsym_bfd.get (), dsect, - bfd_get_section_size (asect)); + bfd_set_section_size (dsect, bfd_section_size (asect)); } /* Add the dsym file as a separate file. */ diff --git a/gdb/maint.c b/gdb/maint.c index b8eb93827c8..ec9f4abb264 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -335,8 +335,8 @@ print_bfd_section_info (bfd *abfd, asection *asect, void *datum) { - flagword flags = bfd_get_section_flags (abfd, asect); - const char *name = bfd_section_name (abfd, asect); + flagword flags = bfd_section_flags (asect); + const char *name = bfd_section_name (asect); maint_print_section_data *print_data = (maint_print_section_data *) datum; const char *arg = print_data->arg; @@ -348,8 +348,8 @@ print_bfd_section_info (bfd *abfd, int addr_size = gdbarch_addr_bit (gdbarch) / 8; CORE_ADDR addr, endaddr; - addr = bfd_section_vma (abfd, asect); - endaddr = addr + bfd_section_size (abfd, asect); + addr = bfd_section_vma (asect); + endaddr = addr + bfd_section_size (asect); print_section_index (abfd, asect, print_data->index_digits); maint_print_section_info (name, flags, addr, endaddr, asect->filepos, addr_size); @@ -366,8 +366,8 @@ print_objfile_section_info (bfd *abfd, struct obj_section *asect, maint_print_section_data *print_data) { - flagword flags = bfd_get_section_flags (abfd, asect->the_bfd_section); - const char *name = bfd_section_name (abfd, asect->the_bfd_section); + flagword flags = bfd_section_flags (asect->the_bfd_section); + const char *name = bfd_section_name (asect->the_bfd_section); const char *string = print_data->arg; if (string == NULL || *string == '\0' diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index dffef8fd1a4..0956fbdb675 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -2338,7 +2338,7 @@ parse_partial_symbols (minimal_symbol_reader &reader, the text section (and fh->adr) really starts at zero. */ text_sect = bfd_get_section_by_name (cur_bfd, ".text"); if (text_sect != NULL - && (bfd_get_section_flags (cur_bfd, text_sect) & SEC_RELOC)) + && (bfd_section_flags (text_sect) & SEC_RELOC)) relocatable = 1; extern_tab = XOBNEWVEC (&objfile->objfile_obstack, EXTR, hdr->iextMax); diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 9033a61950d..7659e280382 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -1179,8 +1179,7 @@ mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr, sec = find_pc_section (memaddr); if (sec != NULL && sec->objfile != NULL) { - flagword flags = bfd_get_section_flags (sec->objfile->obfd, - sec->the_bfd_section); + flagword flags = bfd_section_flags (sec->the_bfd_section); if (flags & SEC_CODE) mi_uiout->field_string ("type", "code"); diff --git a/gdb/minidebug.c b/gdb/minidebug.c index 6c67b4e04b3..2a60741dfaf 100644 --- a/gdb/minidebug.c +++ b/gdb/minidebug.c @@ -87,7 +87,7 @@ lzma_open (struct bfd *nbfd, void *open_closure) struct gdb_lzma_stream *lstream; size_t pos; - size = bfd_get_section_size (section); + size = bfd_section_size (section); offset = section->filepos + size - LZMA_STREAM_HEADER_SIZE; if (size < LZMA_STREAM_HEADER_SIZE || bfd_seek (section->owner, offset, SEEK_SET) != 0 diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 08d027917d8..eab284da130 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -562,7 +562,7 @@ mips_linux_core_read_description (struct gdbarch *gdbarch, if (! section) return NULL; - switch (bfd_section_size (abfd, section)) + switch (bfd_section_size (section)) { case sizeof (mips_elf_gregset_t): return mips_tdesc_gp32; diff --git a/gdb/mips-sde-tdep.c b/gdb/mips-sde-tdep.c index cf1ce378737..791a5991ad5 100644 --- a/gdb/mips-sde-tdep.c +++ b/gdb/mips-sde-tdep.c @@ -208,7 +208,7 @@ mips_sde_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, enum gdb_osabi *os_ident_ptr = (enum gdb_osabi *) obj; const char *name; - name = bfd_get_section_name (abfd, sect); + name = bfd_section_name (sect); /* The presence of a section with a ".sde" prefix is indicative of an SDE binary. */ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 37a1b2a0b8f..6870db82024 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -7975,7 +7975,7 @@ static void mips_find_abi_section (bfd *abfd, asection *sect, void *obj) { enum mips_abi *abip = (enum mips_abi *) obj; - const char *name = bfd_get_section_name (abfd, sect); + const char *name = bfd_section_name (sect); if (*abip != MIPS_ABI_UNKNOWN) return; @@ -8003,7 +8003,7 @@ static void mips_find_long_section (bfd *abfd, asection *sect, void *obj) { int *lbp = (int *) obj; - const char *name = bfd_get_section_name (abfd, sect); + const char *name = bfd_section_name (sect); if (startswith (name, ".gcc_compiled_long32")) *lbp = 32; diff --git a/gdb/mipsread.c b/gdb/mipsread.c index b25abe5a481..b5f7f6cde4b 100644 --- a/gdb/mipsread.c +++ b/gdb/mipsread.c @@ -200,10 +200,10 @@ read_alphacoff_dynamic_symtab (minimal_symbol_reader &reader, || si.dyninfo_sect == NULL || si.got_sect == NULL) return; - gdb::byte_vector sym_sec (bfd_get_section_size (si.sym_sect)); - gdb::byte_vector str_sec (bfd_get_section_size (si.str_sect)); - gdb::byte_vector dyninfo_sec (bfd_get_section_size (si.dyninfo_sect)); - gdb::byte_vector got_sec (bfd_get_section_size (si.got_sect)); + gdb::byte_vector sym_sec (bfd_section_size (si.sym_sect)); + gdb::byte_vector str_sec (bfd_section_size (si.str_sect)); + gdb::byte_vector dyninfo_sec (bfd_section_size (si.dyninfo_sect)); + gdb::byte_vector got_sec (bfd_section_size (si.got_sect)); if (!bfd_get_section_contents (abfd, si.sym_sect, sym_sec.data (), (file_ptr) 0, sym_sec.size ())) diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c index 0c610d28419..41b4e257373 100644 --- a/gdb/nto-tdep.c +++ b/gdb/nto-tdep.c @@ -319,8 +319,8 @@ nto_sniff_abi_note_section (bfd *abfd, asection *sect, void *obj) const char *name; const unsigned sizeof_Elf_Nhdr = 12; - sectname = bfd_get_section_name (abfd, sect); - sectsize = bfd_section_size (abfd, sect); + sectname = bfd_section_name (sect); + sectsize = bfd_section_size (sect); if (sectsize > 128) sectsize = 128; diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 7cbcbbd01b0..90c4650bd47 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -271,7 +271,7 @@ add_to_objfile_sections_full (struct bfd *abfd, struct bfd_section *asect, { flagword aflag; - aflag = bfd_get_section_flags (abfd, asect); + aflag = bfd_section_flags (asect); if (!(aflag & SEC_ALLOC)) return; } @@ -1119,15 +1119,15 @@ static int insert_section_p (const struct bfd *abfd, const struct bfd_section *section) { - const bfd_vma lma = bfd_section_lma (abfd, section); + const bfd_vma lma = bfd_section_lma (section); - if (overlay_debugging && lma != 0 && lma != bfd_section_vma (abfd, section) + if (overlay_debugging && lma != 0 && lma != bfd_section_vma (section) && (bfd_get_file_flags (abfd) & BFD_IN_MEMORY) == 0) /* This is an overlay section. IN_MEMORY check is needed to avoid discarding sections from the "system supplied DSO" (aka vdso) on some Linux systems (e.g. Fedora 11). */ return 0; - if ((bfd_get_section_flags (abfd, section) & SEC_THREAD_LOCAL) != 0) + if ((bfd_section_flags (section) & SEC_THREAD_LOCAL) != 0) /* This is a TLS section. */ return 0; @@ -1220,10 +1220,10 @@ filter_overlapping_sections (struct obj_section **map, int map_size) " (A) section `%s' from `%s' [%s, %s)\n" " (B) section `%s' from `%s' [%s, %s).\n" "Will ignore section B"), - bfd_section_name (abfd1, bfds1), objfile_name (objf1), + bfd_section_name (bfds1), objfile_name (objf1), paddress (gdbarch, sect1_addr), paddress (gdbarch, sect1_endaddr), - bfd_section_name (abfd2, bfds2), objfile_name (objf2), + bfd_section_name (bfds2), objfile_name (objf2), paddress (gdbarch, sect2_addr), paddress (gdbarch, sect2_endaddr)); } diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 239aba2c2a1..68d36d408e1 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -143,14 +143,14 @@ struct obj_section /* The memory address of section S (vma + offset). */ #define obj_section_addr(s) \ - (bfd_get_section_vma ((s)->objfile->obfd, s->the_bfd_section) \ + (bfd_section_vma (s->the_bfd_section) \ + obj_section_offset (s)) /* The one-passed-the-end memory address of section S (vma + size + offset). */ #define obj_section_endaddr(s) \ - (bfd_get_section_vma ((s)->objfile->obfd, s->the_bfd_section) \ - + bfd_get_section_size ((s)->the_bfd_section) \ + (bfd_section_vma (s->the_bfd_section) \ + + bfd_section_size ((s)->the_bfd_section) \ + obj_section_offset (s)) /* The "objstats" structure provides a place for gdb to record some diff --git a/gdb/osabi.c b/gdb/osabi.c index 5d4bbcdff84..cdf72a7664f 100644 --- a/gdb/osabi.c +++ b/gdb/osabi.c @@ -416,7 +416,7 @@ check_note (bfd *abfd, asection *sect, char *note, unsigned int *sectsize, gdb_assert (notesz <= MAX_NOTESZ); /* Check whether SECT is big enough to comtain the complete note. */ - if (notesz > bfd_section_size (abfd, sect)) + if (notesz > bfd_section_size (sect)) return 0; /* Check the note name. */ @@ -445,8 +445,8 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, void *obj) unsigned int sectsize; char *note; - name = bfd_get_section_name (abfd, sect); - sectsize = bfd_section_size (abfd, sect); + name = bfd_section_name (sect); + sectsize = bfd_section_size (sect); /* Limit the amount of data to read. */ if (sectsize > MAX_NOTESZ) diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 82277a03f89..c6181c9dd48 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1558,7 +1558,7 @@ ppc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc) static int ppc_linux_spu_section (bfd *abfd, asection *asect, void *user_data) { - return startswith (bfd_section_name (abfd, asect), "SPU/"); + return startswith (bfd_section_name (asect), "SPU/"); } static const struct target_desc * @@ -1580,7 +1580,7 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch, if (! section) return NULL; - switch (bfd_section_size (abfd, section)) + switch (bfd_section_size (section)) { case 48 * 4: features.wordsize = 4; diff --git a/gdb/ppc64-tdep.c b/gdb/ppc64-tdep.c index b29d04c1354..6a7aabf877a 100644 --- a/gdb/ppc64-tdep.c +++ b/gdb/ppc64-tdep.c @@ -593,8 +593,8 @@ ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, s->the_bfd_section, &buf, addr - s->addr, 8); if (res != 0) - return extract_unsigned_integer (buf, 8, byte_order) - - bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr; + return (extract_unsigned_integer (buf, 8, byte_order) + - bfd_section_vma (s->the_bfd_section) + s->addr); } return addr; diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index d402d8733dd..b55459e4ad1 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1435,8 +1435,7 @@ record_btrace_target::xfer_partial (enum target_object object, if (section != NULL) { /* Check if the section we found is readonly. */ - if ((bfd_get_section_flags (section->the_bfd_section->owner, - section->the_bfd_section) + if ((bfd_section_flags (section->the_bfd_section) & SEC_READONLY) != 0) { /* Truncate the request to fit into this section. */ diff --git a/gdb/record-full.c b/gdb/record-full.c index c1d124f5192..0c6cb621630 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -2350,9 +2350,9 @@ record_full_restore (void) osec ? "succeeded" : "failed"); if (osec == NULL) return; - osec_size = bfd_section_size (core_bfd, osec); + osec_size = bfd_section_size (osec); if (record_debug) - fprintf_unfiltered (gdb_stdlog, "%s", bfd_section_name (core_bfd, osec)); + fprintf_unfiltered (gdb_stdlog, "%s", bfd_section_name (osec)); /* Check the magic code. */ bfdcore_read (core_bfd, osec, &magic, sizeof (magic), &bfd_offset); @@ -2599,10 +2599,9 @@ record_full_base_target::save_record (const char *recfilename) error (_("Failed to create 'precord' section for corefile %s: %s"), recfilename, bfd_errmsg (bfd_get_error ())); - bfd_set_section_size (obfd.get (), osec, save_size); - bfd_set_section_vma (obfd.get (), osec, 0); - bfd_set_section_alignment (obfd.get (), osec, 0); - bfd_section_lma (obfd.get (), osec) = 0; + bfd_set_section_size (osec, save_size); + bfd_set_section_vma (osec, 0); + bfd_set_section_alignment (osec, 0); /* Save corefile state. */ write_gcore_file (obfd.get ()); diff --git a/gdb/remote.c b/gdb/remote.c index e39366d8b20..980864e0707 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8749,9 +8749,7 @@ remote_target::remote_xfer_live_readonly_partial (gdb_byte *readbuf, secp = target_section_by_addr (this, memaddr); if (secp != NULL - && (bfd_get_section_flags (secp->the_bfd_section->owner, - secp->the_bfd_section) - & SEC_READONLY)) + && (bfd_section_flags (secp->the_bfd_section) & SEC_READONLY)) { struct target_section *p; ULONGEST memend = memaddr + len; @@ -10656,11 +10654,11 @@ compare_sections_command (const char *args, int from_tty) if (read_only && (s->flags & SEC_READONLY) == 0) continue; /* Skip writeable sections */ - size = bfd_get_section_size (s); + size = bfd_section_size (s); if (size == 0) continue; /* Skip zero-length section. */ - sectname = bfd_get_section_name (exec_bfd, s); + sectname = bfd_section_name (s); if (args && strcmp (args, sectname) != 0) continue; /* Not the section selected by user. */ @@ -13059,7 +13057,6 @@ void remote_target::trace_set_readonly_regions () { asection *s; - bfd *abfd = NULL; bfd_size_type size; bfd_vma vma; int anysecs = 0; @@ -13083,8 +13080,8 @@ remote_target::trace_set_readonly_regions () continue; anysecs = 1; - vma = bfd_get_section_vma (abfd, s); - size = bfd_get_section_size (s); + vma = bfd_section_vma (s); + size = bfd_section_size (s); sprintf_vma (tmp1, vma); sprintf_vma (tmp2, vma + size); sec_length = 1 + strlen (tmp1) + 1 + strlen (tmp2); diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c index 4964f591a5a..f2ff2557368 100644 --- a/gdb/rs6000-aix-tdep.c +++ b/gdb/rs6000-aix-tdep.c @@ -1110,7 +1110,7 @@ rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch, if (ldinfo_sec == NULL) error (_("cannot find .ldinfo section from core file: %s"), bfd_errmsg (bfd_get_error ())); - ldinfo_size = bfd_get_section_size (ldinfo_sec); + ldinfo_size = bfd_section_size (ldinfo_sec); gdb::byte_vector ldinfo_buf (ldinfo_size); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 328b41cc595..47a232f6c6a 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -3866,7 +3866,7 @@ bfd_uses_spe_extensions (bfd *abfd) if (!sect) return 0; - size = bfd_get_section_size (sect); + size = bfd_section_size (sect); contents = (gdb_byte *) xmalloc (size); if (!bfd_get_section_contents (abfd, sect, contents, 0, size)) { diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index 02ae28b4ea7..ab3889ba45a 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -346,7 +346,7 @@ s390_core_read_description (struct gdbarch *gdbarch, te = (hwcap & HWCAP_S390_TE); gs = (hwcap & HWCAP_S390_GS); - switch (bfd_section_size (abfd, section)) + switch (bfd_section_size (section)) { case s390_sizeof_gregset: if (high_gprs) diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 871efc59bca..463c0a0bd73 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -697,9 +697,7 @@ s390_load (struct s390_prologue_data *data, struct target_section *secp; secp = target_section_by_addr (current_top_target (), addr.k); if (secp != NULL - && (bfd_get_section_flags (secp->the_bfd_section->owner, - secp->the_bfd_section) - & SEC_READONLY)) + && (bfd_section_flags (secp->the_bfd_section) & SEC_READONLY)) return pv_constant (read_memory_integer (addr.k, size, data->byte_order)); } diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index 1a25a0d4a93..8308190d90c 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -303,15 +303,13 @@ solib_aix_bss_data_overlap (bfd *abfd) section after the .data section (the problem has only been observed when using the GNU linker, and the default linker script always places the .data and .bss sections in that order). */ - if (bfd_section_vma (abfd, bss_sect) - < bfd_section_vma (abfd, data_sect)) + if (bfd_section_vma (bss_sect) < bfd_section_vma (data_sect)) return 0; - if (bfd_section_vma (abfd, bss_sect) - < bfd_section_vma (abfd, data_sect) + bfd_get_section_size (data_sect)) - return ((bfd_section_vma (abfd, data_sect) - + bfd_get_section_size (data_sect)) - - bfd_section_vma (abfd, bss_sect)); + if (bfd_section_vma (bss_sect) + < bfd_section_vma (data_sect) + bfd_section_size (data_sect)) + return (bfd_section_vma (data_sect) + bfd_section_size (data_sect) + - bfd_section_vma (bss_sect)); return 0; } @@ -324,7 +322,7 @@ solib_aix_relocate_section_addresses (struct so_list *so, { struct bfd_section *bfd_sect = sec->the_bfd_section; bfd *abfd = bfd_sect->owner; - const char *section_name = bfd_section_name (abfd, bfd_sect); + const char *section_name = bfd_section_name (bfd_sect); lm_info_aix *info = (lm_info_aix *) so->lm_info; if (strcmp (section_name, ".text") == 0) @@ -355,17 +353,17 @@ solib_aix_relocate_section_addresses (struct so_list *so, CORE_ADDR data_offset = 0; if (data_sect != NULL) - data_offset = info->data_addr - bfd_section_vma (abfd, data_sect); + data_offset = info->data_addr - bfd_section_vma (data_sect); - sec->addr = bfd_section_vma (abfd, bfd_sect) + data_offset; + sec->addr = bfd_section_vma (bfd_sect) + data_offset; sec->addr += solib_aix_bss_data_overlap (abfd); - sec->endaddr = sec->addr + bfd_section_size (abfd, bfd_sect); + sec->endaddr = sec->addr + bfd_section_size (bfd_sect); } else { /* All other sections should not be relocated. */ - sec->addr = bfd_section_vma (abfd, bfd_sect); - sec->endaddr = sec->addr + bfd_section_size (abfd, bfd_sect); + sec->addr = bfd_section_vma (bfd_sect); + sec->endaddr = sec->addr + bfd_section_size (bfd_sect); } } @@ -414,7 +412,7 @@ solib_aix_get_section_offsets (struct objfile *objfile, = objfile->sections[objfile->sect_index_text].the_bfd_section; offsets->offsets[objfile->sect_index_text] - = info->text_addr + sect->filepos - bfd_section_vma (abfd, sect); + = info->text_addr + sect->filepos - bfd_section_vma (sect); } /* .data */ @@ -425,7 +423,7 @@ solib_aix_get_section_offsets (struct objfile *objfile, = objfile->sections[objfile->sect_index_data].the_bfd_section; offsets->offsets[objfile->sect_index_data] - = info->data_addr - bfd_section_vma (abfd, sect); + = info->data_addr - bfd_section_vma (sect); } /* .bss @@ -661,8 +659,7 @@ data_obj_section_from_objfile (struct objfile *objfile) struct obj_section *osect; ALL_OBJFILE_OSECTIONS (objfile, osect) - if (strcmp (bfd_section_name (objfile->obfd, osect->the_bfd_section), - ".data") == 0) + if (strcmp (bfd_section_name (osect->the_bfd_section), ".data") == 0) return osect; return NULL; diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index 59b195f491e..70d6f2e314b 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -438,12 +438,12 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr) such fallback to the file VMA address without the possibility of having the section relocated to its actual in-memory address. */ - dyn_addr = bfd_section_vma (abfd, sect); + dyn_addr = bfd_section_vma (sect); } /* Read in .dynamic from the BFD. We will get the actual value from memory later. */ - sect_size = bfd_section_size (abfd, sect); + sect_size = bfd_section_size (sect); buf = bufstart = (gdb_byte *) alloca (sect_size); if (!bfd_get_section_contents (abfd, sect, buf, 0, sect_size)) @@ -807,7 +807,7 @@ enable_break (void) /* Read the contents of the .interp section into a local buffer; the contents specify the dynamic linker this program uses. */ - interp_sect_size = bfd_section_size (exec_bfd, interp_sect); + interp_sect_size = bfd_section_size (interp_sect); buf = (char *) alloca (interp_sect_size); bfd_get_section_contents (exec_bfd, interp_sect, buf, 0, interp_sect_size); @@ -839,24 +839,20 @@ enable_break (void) interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".text"); if (interp_sect) { - info->interp_text_sect_low - = bfd_section_vma (tmp_bfd.get (), interp_sect); + info->interp_text_sect_low = bfd_section_vma (interp_sect); info->interp_text_sect_low += displacement_from_map (ldm, info->interp_text_sect_low); info->interp_text_sect_high - = info->interp_text_sect_low - + bfd_section_size (tmp_bfd.get (), interp_sect); + = info->interp_text_sect_low + bfd_section_size (interp_sect); } interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".plt"); if (interp_sect) { - info->interp_plt_sect_low = - bfd_section_vma (tmp_bfd.get (), interp_sect); + info->interp_plt_sect_low = bfd_section_vma (interp_sect); info->interp_plt_sect_low += displacement_from_map (ldm, info->interp_plt_sect_low); - info->interp_plt_sect_high = - info->interp_plt_sect_low + bfd_section_size (tmp_bfd.get (), - interp_sect); + info->interp_plt_sect_high + = info->interp_plt_sect_low + bfd_section_size (interp_sect); } addr = gdb_bfd_lookup_symbol (tmp_bfd.get (), cmp_name, diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index fdd4b345305..08fa5768676 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -546,7 +546,7 @@ enable_break2 (void) /* Read the contents of the .interp section into a local buffer; the contents specify the dynamic linker this program uses. */ - interp_sect_size = bfd_section_size (exec_bfd, interp_sect); + interp_sect_size = bfd_section_size (interp_sect); buf = (char *) alloca (interp_sect_size); bfd_get_section_contents (exec_bfd, interp_sect, buf, 0, interp_sect_size); @@ -603,24 +603,20 @@ enable_break2 (void) interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".text"); if (interp_sect) { - interp_text_sect_low - = bfd_section_vma (tmp_bfd.get (), interp_sect); + interp_text_sect_low = bfd_section_vma (interp_sect); interp_text_sect_low += displacement_from_map (ldm, interp_text_sect_low); interp_text_sect_high - = interp_text_sect_low + bfd_section_size (tmp_bfd.get (), - interp_sect); + = interp_text_sect_low + bfd_section_size (interp_sect); } interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".plt"); if (interp_sect) { - interp_plt_sect_low = - bfd_section_vma (tmp_bfd.get (), interp_sect); + interp_plt_sect_low = bfd_section_vma (interp_sect); interp_plt_sect_low += displacement_from_map (ldm, interp_plt_sect_low); interp_plt_sect_high = - interp_plt_sect_low + bfd_section_size (tmp_bfd.get (), - interp_sect); + interp_plt_sect_low + bfd_section_size (interp_sect); } addr = gdb_bfd_lookup_symbol (tmp_bfd.get (), cmp_name, "_dl_debug_addr"); diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c index c5e0acaf02a..49e470adb62 100644 --- a/gdb/solib-spu.c +++ b/gdb/solib-spu.c @@ -364,7 +364,7 @@ spu_bfd_open (const char *pathname) spu_name = bfd_get_section_by_name (abfd.get (), ".note.spu_name"); if (spu_name) { - int sect_size = bfd_section_size (abfd.get (), spu_name); + int sect_size = bfd_section_size (spu_name); if (sect_size > 20) { diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index ffae26bfc5f..e04fde942d1 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -234,7 +234,7 @@ lm_addr_check (const struct so_list *so, bfd *abfd) if (dyninfo_sect == NULL) goto set_addr; - dynaddr = bfd_section_vma (abfd, dyninfo_sect); + dynaddr = bfd_section_vma (dyninfo_sect); if (dynaddr + l_addr != l_dynaddr) { @@ -559,7 +559,7 @@ find_program_interpreter (void) interp_sect = bfd_get_section_by_name (exec_bfd, ".interp"); if (interp_sect != NULL) { - int sect_size = bfd_section_size (exec_bfd, interp_sect); + int sect_size = bfd_section_size (interp_sect); gdb::byte_vector buf (sect_size); bfd_get_section_contents (exec_bfd, interp_sect, buf.data (), 0, @@ -618,12 +618,12 @@ scan_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr, such fallback to the file VMA address without the possibility of having the section relocated to its actual in-memory address. */ - dyn_addr = bfd_section_vma (abfd, sect); + dyn_addr = bfd_section_vma (sect); } /* Read in .dynamic from the BFD. We will get the actual value from memory later. */ - sect_size = bfd_section_size (abfd, sect); + sect_size = bfd_section_size (sect); buf = bufstart = (gdb_byte *) alloca (sect_size); if (!bfd_get_section_contents (abfd, sect, buf, 0, sect_size)) @@ -2255,20 +2255,18 @@ enable_break (struct svr4_info *info, int from_tty) interp_sect = bfd_get_section_by_name (tmp_bfd, ".text"); if (interp_sect) { - info->interp_text_sect_low = - bfd_section_vma (tmp_bfd, interp_sect) + load_addr; - info->interp_text_sect_high = - info->interp_text_sect_low - + bfd_section_size (tmp_bfd, interp_sect); + info->interp_text_sect_low + = bfd_section_vma (interp_sect) + load_addr; + info->interp_text_sect_high + = info->interp_text_sect_low + bfd_section_size (interp_sect); } interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt"); if (interp_sect) { - info->interp_plt_sect_low = - bfd_section_vma (tmp_bfd, interp_sect) + load_addr; - info->interp_plt_sect_high = - info->interp_plt_sect_low - + bfd_section_size (tmp_bfd, interp_sect); + info->interp_plt_sect_low + = bfd_section_vma (interp_sect) + load_addr; + info->interp_plt_sect_high + = info->interp_plt_sect_low + bfd_section_size (interp_sect); } svr4_create_solib_event_breakpoints (info, target_gdbarch (), sym_addr); @@ -2392,20 +2390,18 @@ enable_break (struct svr4_info *info, int from_tty) interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".text"); if (interp_sect) { - info->interp_text_sect_low = - bfd_section_vma (tmp_bfd.get (), interp_sect) + load_addr; - info->interp_text_sect_high = - info->interp_text_sect_low - + bfd_section_size (tmp_bfd.get (), interp_sect); + info->interp_text_sect_low + = bfd_section_vma (interp_sect) + load_addr; + info->interp_text_sect_high + = info->interp_text_sect_low + bfd_section_size (interp_sect); } interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".plt"); if (interp_sect) { - info->interp_plt_sect_low = - bfd_section_vma (tmp_bfd.get (), interp_sect) + load_addr; - info->interp_plt_sect_high = - info->interp_plt_sect_low - + bfd_section_size (tmp_bfd.get (), interp_sect); + info->interp_plt_sect_low + = bfd_section_vma (interp_sect) + load_addr; + info->interp_plt_sect_high + = info->interp_plt_sect_low + bfd_section_size (interp_sect); } /* Now try to set a breakpoint in the dynamic linker. */ @@ -2733,7 +2729,7 @@ svr4_exec_displacement (CORE_ADDR *displacementp) gdb_byte *buf_filesz_p = (gdb_byte *) &phdrp->p_filesz; CORE_ADDR filesz; - content2 = (bfd_get_section_flags (exec_bfd, plt2_asect) + content2 = (bfd_section_flags (plt2_asect) & SEC_HAS_CONTENTS) != 0; filesz = extract_unsigned_integer (buf_filesz_p, 4, @@ -2742,9 +2738,9 @@ svr4_exec_displacement (CORE_ADDR *displacementp) /* PLT2_ASECT is from on-disk file (exec_bfd) while FILESZ is from the in-memory image. */ if (content2) - filesz += bfd_get_section_size (plt2_asect); + filesz += bfd_section_size (plt2_asect); else - filesz -= bfd_get_section_size (plt2_asect); + filesz -= bfd_section_size (plt2_asect); store_unsigned_integer (buf_filesz_p, 4, byte_order, filesz); @@ -2867,7 +2863,7 @@ svr4_exec_displacement (CORE_ADDR *displacementp) gdb_byte *buf_filesz_p = (gdb_byte *) &phdrp->p_filesz; CORE_ADDR filesz; - content2 = (bfd_get_section_flags (exec_bfd, plt2_asect) + content2 = (bfd_section_flags (plt2_asect) & SEC_HAS_CONTENTS) != 0; filesz = extract_unsigned_integer (buf_filesz_p, 8, @@ -2876,9 +2872,9 @@ svr4_exec_displacement (CORE_ADDR *displacementp) /* PLT2_ASECT is from on-disk file (exec_bfd) while FILESZ is from the in-memory image. */ if (content2) - filesz += bfd_get_section_size (plt2_asect); + filesz += bfd_section_size (plt2_asect); else - filesz -= bfd_get_section_size (plt2_asect); + filesz -= bfd_section_size (plt2_asect); store_unsigned_integer (buf_filesz_p, 8, byte_order, filesz); @@ -2972,8 +2968,7 @@ svr4_relocate_main_executable (void) for (asect = exec_bfd->sections; asect != NULL; asect = asect->next) exec_set_section_address (bfd_get_filename (exec_bfd), asect->index, - (bfd_section_vma (exec_bfd, asect) - + displacement)); + bfd_section_vma (asect) + displacement); } } diff --git a/gdb/solib-target.c b/gdb/solib-target.c index 1ccbc27b2bc..3fd180850c1 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -323,7 +323,7 @@ solib_target_relocate_section_addresses (struct so_list *so, for (i = 0, sect = so->abfd->sections; sect != NULL; i++, sect = sect->next) - if ((bfd_get_section_flags (so->abfd, sect) & SEC_ALLOC)) + if ((bfd_section_flags (sect) & SEC_ALLOC)) num_alloc_sections++; if (num_alloc_sections != li->section_bases.size ()) @@ -341,14 +341,14 @@ Could not relocate shared library \"%s\": wrong number of ALLOC sections"), sect != NULL; i++, sect = sect->next) { - if (!(bfd_get_section_flags (so->abfd, sect) & SEC_ALLOC)) + if (!(bfd_section_flags (sect) & SEC_ALLOC)) continue; - if (bfd_section_size (so->abfd, sect) > 0) + if (bfd_section_size (sect) > 0) { CORE_ADDR low, high; low = li->section_bases[i]; - high = low + bfd_section_size (so->abfd, sect) - 1; + high = low + bfd_section_size (sect) - 1; if (low < so->addr_low) so->addr_low = low; diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c index 9dbb6337344..635366b4f1d 100644 --- a/gdb/spu-linux-nat.c +++ b/gdb/spu-linux-nat.c @@ -363,7 +363,7 @@ spu_bfd_open (ULONGEST addr) spu_name = bfd_get_section_by_name (nbfd.get (), ".note.spu_name"); if (spu_name) { - int sect_size = bfd_section_size (nbfd.get (), spu_name); + int sect_size = bfd_section_size (spu_name); if (sect_size > 20) { char *buf = (char *)alloca (sect_size - 20 + 1); diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index d01f3af3009..5360efb12f7 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -1833,7 +1833,7 @@ spu_get_overlay_table (struct objfile *objfile) continue; ALL_OBJFILE_OSECTIONS (objfile, osect) - if (vma == bfd_section_vma (objfile->obfd, osect->the_bfd_section) + if (vma == bfd_section_vma (osect->the_bfd_section) && pos == osect->the_bfd_section->filepos) { int ndx = osect - objfile->sections; @@ -1921,9 +1921,9 @@ spu_overlay_new_objfile (struct objfile *objfile) int ndx = osect - objfile->sections; if (ovly_table[ndx].mapped_ptr == 0) - bfd_section_lma (obfd, bsect) = bfd_section_vma (obfd, bsect); + bfd_set_section_lma (bsect, bfd_section_vma (bsect)); else - bfd_section_lma (obfd, bsect) = SPU_OVERLAY_LMA + bsect->filepos; + bfd_set_section_lma (bsect, SPU_OVERLAY_LMA + bsect->filepos); } } diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c index 05542c13915..82fb17ed165 100644 --- a/gdb/symfile-mem.c +++ b/gdb/symfile-mem.c @@ -111,9 +111,9 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, section_addr_info sai; for (sec = nbfd->sections; sec != NULL; sec = sec->next) - if ((bfd_get_section_flags (nbfd, sec) & (SEC_ALLOC|SEC_LOAD)) != 0) - sai.emplace_back (bfd_get_section_vma (nbfd, sec) + loadbase, - bfd_get_section_name (nbfd, sec), + if ((bfd_section_flags (sec) & (SEC_ALLOC|SEC_LOAD)) != 0) + sai.emplace_back (bfd_section_vma (sec) + loadbase, + bfd_section_name (sec), sec->index); if (from_tty) diff --git a/gdb/symfile.c b/gdb/symfile.c index 5252c727aa5..b914b05a175 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -200,15 +200,14 @@ find_lowest_section (bfd *abfd, asection *sect, void *obj) { asection **lowest = (asection **) obj; - if (0 == (bfd_get_section_flags (abfd, sect) & (SEC_ALLOC | SEC_LOAD))) + if (0 == (bfd_section_flags (sect) & (SEC_ALLOC | SEC_LOAD))) return; if (!*lowest) *lowest = sect; /* First loadable section */ - else if (bfd_section_vma (abfd, *lowest) > bfd_section_vma (abfd, sect)) + else if (bfd_section_vma (*lowest) > bfd_section_vma (sect)) *lowest = sect; /* A lower loadable section */ - else if (bfd_section_vma (abfd, *lowest) == bfd_section_vma (abfd, sect) - && (bfd_section_size (abfd, (*lowest)) - <= bfd_section_size (abfd, sect))) + else if (bfd_section_vma (*lowest) == bfd_section_vma (sect) + && (bfd_section_size (*lowest) <= bfd_section_size (sect))) *lowest = sect; } @@ -228,10 +227,10 @@ build_section_addr_info_from_section_table (const struct target_section *start, struct bfd_section *asect = stp->the_bfd_section; bfd *abfd = asect->owner; - if (bfd_get_section_flags (abfd, asect) & (SEC_ALLOC | SEC_LOAD) + if (bfd_section_flags (asect) & (SEC_ALLOC | SEC_LOAD) && sap.size () < end - start) sap.emplace_back (stp->addr, - bfd_section_name (abfd, asect), + bfd_section_name (asect), gdb_bfd_section_index (abfd, asect)); } @@ -247,9 +246,9 @@ build_section_addr_info_from_bfd (bfd *abfd) section_addr_info sap; for (sec = abfd->sections; sec != NULL; sec = sec->next) - if (bfd_get_section_flags (abfd, sec) & (SEC_ALLOC | SEC_LOAD)) - sap.emplace_back (bfd_get_section_vma (abfd, sec), - bfd_get_section_name (abfd, sec), + if (bfd_section_flags (sec) & (SEC_ALLOC | SEC_LOAD)) + sap.emplace_back (bfd_section_vma (sec), + bfd_section_name (sec), gdb_bfd_section_index (abfd, sec)); return sap; @@ -353,10 +352,10 @@ place_section (bfd *abfd, asection *sect, void *obj) struct place_section_arg *arg = (struct place_section_arg *) obj; CORE_ADDR *offsets = arg->offsets->offsets, start_addr; int done; - ULONGEST align = ((ULONGEST) 1) << bfd_get_section_alignment (abfd, sect); + ULONGEST align = ((ULONGEST) 1) << bfd_section_alignment (sect); /* We are only interested in allocated sections. */ - if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0) + if ((bfd_section_flags (sect) & SEC_ALLOC) == 0) return; /* If the user specified an offset, honor it. */ @@ -380,7 +379,7 @@ place_section (bfd *abfd, asection *sect, void *obj) continue; /* We can only conflict with allocated sections. */ - if ((bfd_get_section_flags (abfd, cur_sec) & SEC_ALLOC) == 0) + if ((bfd_section_flags (cur_sec) & SEC_ALLOC) == 0) continue; /* If the section offset is 0, either the section has not been placed @@ -390,10 +389,10 @@ place_section (bfd *abfd, asection *sect, void *obj) continue; /* If this section would overlap us, then we must move up. */ - if (start_addr + bfd_get_section_size (sect) > offsets[indx] - && start_addr < offsets[indx] + bfd_get_section_size (cur_sec)) + if (start_addr + bfd_section_size (sect) > offsets[indx] + && start_addr < offsets[indx] + bfd_section_size (cur_sec)) { - start_addr = offsets[indx] + bfd_get_section_size (cur_sec); + start_addr = offsets[indx] + bfd_section_size (cur_sec); start_addr = (start_addr + align - 1) & -align; done = 0; break; @@ -405,7 +404,7 @@ place_section (bfd *abfd, asection *sect, void *obj) while (!done); offsets[gdb_bfd_section_index (abfd, sect)] = start_addr; - arg->lowest = start_addr + bfd_get_section_size (sect); + arg->lowest = start_addr + bfd_section_size (sect); } /* Store section_addr_info as prepared (made relative and with SECTINDEX @@ -510,7 +509,7 @@ addr_info_make_relative (section_addr_info *addrs, bfd *abfd) lower_offset = 0; } else - lower_offset = bfd_section_vma (bfd_get_filename (abfd), lower_sect); + lower_offset = bfd_section_vma (lower_sect); /* Create ADDRS_TO_ABFD_ADDRS array to map the sections in ADDRS to sections in ABFD. Section names are not unique - there can be multiple sections of @@ -658,7 +657,7 @@ default_symfile_offsets (struct objfile *objfile, for (cur_sec = abfd->sections; cur_sec != NULL; cur_sec = cur_sec->next) /* We do not expect this to happen; just skip this step if the relocatable file has a section with an assigned VMA. */ - if (bfd_section_vma (abfd, cur_sec) != 0) + if (bfd_section_vma (cur_sec) != 0) break; if (cur_sec == NULL) @@ -700,10 +699,10 @@ default_symfile_offsets (struct objfile *objfile, for (cur_sec = abfd->sections; cur_sec != NULL; cur_sec = cur_sec->next) { - if ((bfd_get_section_flags (abfd, cur_sec) & SEC_ALLOC) == 0) + if ((bfd_section_flags (cur_sec) & SEC_ALLOC) == 0) continue; - bfd_set_section_vma (abfd, cur_sec, offsets[cur_sec->index]); + bfd_set_section_vma (cur_sec, offsets[cur_sec->index]); exec_set_section_address (bfd_get_filename (abfd), cur_sec->index, offsets[cur_sec->index]); @@ -740,7 +739,7 @@ default_symfile_segments (bfd *abfd) /* Make sure there is at least one loadable section in the file. */ for (sect = abfd->sections; sect != NULL; sect = sect->next) { - if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0) + if ((bfd_section_flags (sect) & SEC_ALLOC) == 0) continue; break; @@ -748,8 +747,8 @@ default_symfile_segments (bfd *abfd) if (sect == NULL) return NULL; - low = bfd_get_section_vma (abfd, sect); - high = low + bfd_get_section_size (sect); + low = bfd_section_vma (sect); + high = low + bfd_section_size (sect); data = XCNEW (struct symfile_segment_data); data->num_segments = 1; @@ -763,14 +762,14 @@ default_symfile_segments (bfd *abfd) { CORE_ADDR vma; - if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0) + if ((bfd_section_flags (sect) & SEC_ALLOC) == 0) continue; - vma = bfd_get_section_vma (abfd, sect); + vma = bfd_section_vma (sect); if (vma < low) low = vma; - if (vma + bfd_get_section_size (sect) > high) - high = vma + bfd_get_section_size (sect); + if (vma + bfd_section_size (sect) > high) + high = vma + bfd_section_size (sect); data->segment_info[i] = 1; } @@ -872,9 +871,9 @@ init_entry_point_info (struct objfile *objfile) { struct bfd_section *sect = osect->the_bfd_section; - if (entry_point >= bfd_get_section_vma (objfile->obfd, sect) - && entry_point < (bfd_get_section_vma (objfile->obfd, sect) - + bfd_get_section_size (sect))) + if (entry_point >= bfd_section_vma (sect) + && entry_point < (bfd_section_vma (sect) + + bfd_section_size (sect))) { ei->the_bfd_section_index = gdb_bfd_section_index (objfile->obfd, sect); @@ -1878,7 +1877,7 @@ add_section_size_callback (bfd *abfd, asection *asec, void *data) { bfd_size_type *sum = (bfd_size_type *) data; - *sum += bfd_get_section_size (asec); + *sum += bfd_section_size (asec); } /* Opaque data for load_progress. */ @@ -2001,16 +2000,16 @@ static void load_section_callback (bfd *abfd, asection *asec, void *data) { struct load_section_data *args = (struct load_section_data *) data; - bfd_size_type size = bfd_get_section_size (asec); - const char *sect_name = bfd_get_section_name (abfd, asec); + bfd_size_type size = bfd_section_size (asec); + const char *sect_name = bfd_section_name (asec); - if ((bfd_get_section_flags (abfd, asec) & SEC_LOAD) == 0) + if ((bfd_section_flags (asec) & SEC_LOAD) == 0) return; if (size == 0) return; - ULONGEST begin = bfd_section_lma (abfd, asec) + args->load_offset; + ULONGEST begin = bfd_section_lma (asec) + args->load_offset; ULONGEST end = begin + size; gdb_byte *buffer = (gdb_byte *) xmalloc (size); bfd_get_section_contents (abfd, asec, buffer, 0, size); @@ -2988,9 +2987,8 @@ section_is_overlay (struct obj_section *section) { asection *bfd_section = section->the_bfd_section; - if (bfd_section_lma (abfd, bfd_section) != 0 - && bfd_section_lma (abfd, bfd_section) - != bfd_section_vma (abfd, bfd_section)) + if (bfd_section_lma (bfd_section) != 0 + && bfd_section_lma (bfd_section) != bfd_section_vma (bfd_section)) return 1; } @@ -3061,15 +3059,14 @@ pc_in_unmapped_range (CORE_ADDR pc, struct obj_section *section) { if (section_is_overlay (section)) { - bfd *abfd = section->objfile->obfd; asection *bfd_section = section->the_bfd_section; /* We assume the LMA is relocated by the same offset as the VMA. */ - bfd_vma size = bfd_get_section_size (bfd_section); + bfd_vma size = bfd_section_size (bfd_section); CORE_ADDR offset = obj_section_offset (section); - if (bfd_get_section_lma (abfd, bfd_section) + offset <= pc - && pc < bfd_get_section_lma (abfd, bfd_section) + offset + size) + if (bfd_section_lma (bfd_section) + offset <= pc + && pc < bfd_section_lma (bfd_section) + offset + size) return 1; } @@ -3117,8 +3114,8 @@ overlay_unmapped_address (CORE_ADDR pc, struct obj_section *section) { asection *bfd_section = section->the_bfd_section; - return pc + bfd_section_lma (abfd, bfd_section) - - bfd_section_vma (abfd, bfd_section); + return (pc + bfd_section_lma (bfd_section) + - bfd_section_vma (bfd_section)); } return pc; @@ -3135,8 +3132,8 @@ overlay_mapped_address (CORE_ADDR pc, struct obj_section *section) { asection *bfd_section = section->the_bfd_section; - return pc + bfd_section_vma (abfd, bfd_section) - - bfd_section_lma (abfd, bfd_section); + return (pc + bfd_section_vma (bfd_section) + - bfd_section_lma (bfd_section)); } return pc; @@ -3241,10 +3238,10 @@ list_overlays_command (const char *args, int from_tty) bfd_vma lma, vma; int size; - vma = bfd_section_vma (objfile->obfd, osect->the_bfd_section); - lma = bfd_section_lma (objfile->obfd, osect->the_bfd_section); - size = bfd_get_section_size (osect->the_bfd_section); - name = bfd_section_name (objfile->obfd, osect->the_bfd_section); + vma = bfd_section_vma (osect->the_bfd_section); + lma = bfd_section_lma (osect->the_bfd_section); + size = bfd_section_size (osect->the_bfd_section); + name = bfd_section_name (osect->the_bfd_section); printf_filtered ("Section %s, loaded at ", name); fputs_filtered (paddress (gdbarch, lma), gdb_stdout); @@ -3282,8 +3279,7 @@ map_overlay_command (const char *args, int from_tty) /* First, find a section matching the user supplied argument. */ for (objfile *obj_file : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (obj_file, sec) - if (!strcmp (bfd_section_name (obj_file->obfd, sec->the_bfd_section), - args)) + if (!strcmp (bfd_section_name (sec->the_bfd_section), args)) { /* Now, check to see if the section is an overlay. */ if (!section_is_overlay (sec)) @@ -3301,8 +3297,7 @@ map_overlay_command (const char *args, int from_tty) { if (info_verbose) printf_unfiltered (_("Note: section %s unmapped by overlap\n"), - bfd_section_name (obj_file->obfd, - sec2->the_bfd_section)); + bfd_section_name (sec2->the_bfd_section)); sec2->ovly_mapped = 0; /* sec2 overlaps sec: unmap sec2. */ } return; @@ -3330,7 +3325,7 @@ unmap_overlay_command (const char *args, int from_tty) /* First, find a section matching the user supplied argument. */ for (objfile *objfile : current_program_space->objfiles ()) ALL_OBJFILE_OSECTIONS (objfile, sec) - if (!strcmp (bfd_section_name (objfile->obfd, sec->the_bfd_section), args)) + if (!strcmp (bfd_section_name (sec->the_bfd_section), args)) { if (!sec->ovly_mapped) error (_("Section %s is not mapped"), args); @@ -3539,14 +3534,14 @@ simple_overlay_update_1 (struct obj_section *osect) enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); for (i = 0; i < cache_novlys; i++) - if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect) - && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)) + if (cache_ovly_table[i][VMA] == bfd_section_vma (bsect) + && cache_ovly_table[i][LMA] == bfd_section_lma (bsect)) { read_target_long_array (cache_ovly_table_base + i * word_size, (unsigned int *) cache_ovly_table[i], 4, word_size, byte_order); - if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect) - && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)) + if (cache_ovly_table[i][VMA] == bfd_section_vma (bsect) + && cache_ovly_table[i][LMA] == bfd_section_lma (bsect)) { osect->ovly_mapped = cache_ovly_table[i][MAPPED]; return 1; @@ -3607,8 +3602,8 @@ simple_overlay_update (struct obj_section *osect) asection *bsect = osect->the_bfd_section; for (i = 0; i < cache_novlys; i++) - if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect) - && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect)) + if (cache_ovly_table[i][VMA] == bfd_section_vma (bsect) + && cache_ovly_table[i][LMA] == bfd_section_lma (bsect)) { /* obj_section matches i'th entry in ovly_table. */ osect->ovly_mapped = cache_ovly_table[i][MAPPED]; break; /* finished with inner for loop: break out. */ diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 7666de390cd..4699fd09206 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -244,8 +244,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) { if (section->the_bfd_section != NULL) fprintf_filtered (outfile, " section %s", - bfd_section_name (objfile->obfd, - section->the_bfd_section)); + bfd_section_name (section->the_bfd_section)); else fprintf_filtered (outfile, " spurious section %ld", (long) (section - objfile->sections)); @@ -525,8 +524,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, outfile); if (section) fprintf_filtered (outfile, " section %s\n", - bfd_section_name (section->the_bfd_section->owner, - section->the_bfd_section)); + bfd_section_name (section->the_bfd_section)); else fprintf_filtered (outfile, "\n"); return; @@ -596,8 +594,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, outfile); if (section) fprintf_filtered (outfile, " section %s", - bfd_section_name (section->the_bfd_section->owner, - section->the_bfd_section)); + bfd_section_name (section->the_bfd_section)); break; case LOC_REGISTER: @@ -638,8 +635,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, outfile); if (section) fprintf_filtered (outfile, " section %s", - bfd_section_name (section->the_bfd_section->owner, - section->the_bfd_section)); + bfd_section_name (section->the_bfd_section)); break; case LOC_BLOCK: @@ -655,8 +651,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, outfile); if (section) fprintf_filtered (outfile, " section %s", - bfd_section_name (section->the_bfd_section->owner, - section->the_bfd_section)); + bfd_section_name (section->the_bfd_section)); break; case LOC_COMPUTED: diff --git a/gdb/symtab.c b/gdb/symtab.c index e2edad4fb11..35eab08cb37 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1033,20 +1033,17 @@ matching_obj_sections (struct obj_section *obj_first, have the same size, address, and name. We can't compare section indexes, which would be more reliable, because some sections may have been stripped. */ - if (bfd_get_section_size (first) != bfd_get_section_size (second)) + if (bfd_section_size (first) != bfd_section_size (second)) return 0; /* In-memory addresses may start at a different offset, relativize them. */ - if (bfd_get_section_vma (first->owner, first) - - bfd_get_start_address (first->owner) - != bfd_get_section_vma (second->owner, second) - - bfd_get_start_address (second->owner)) + if (bfd_section_vma (first) - bfd_get_start_address (first->owner) + != bfd_section_vma (second) - bfd_get_start_address (second->owner)) return 0; - if (bfd_get_section_name (first->owner, first) == NULL - || bfd_get_section_name (second->owner, second) == NULL - || strcmp (bfd_get_section_name (first->owner, first), - bfd_get_section_name (second->owner, second)) != 0) + if (bfd_section_name (first) == NULL + || bfd_section_name (second) == NULL + || strcmp (bfd_section_name (first), bfd_section_name (second)) != 0) return 0; /* Otherwise check that they are in corresponding objfiles. */ diff --git a/gdb/target.c b/gdb/target.c index 599e22a724c..78bdfeb49a4 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1042,9 +1042,7 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object, secp = target_section_by_addr (ops, memaddr); if (secp != NULL - && (bfd_get_section_flags (secp->the_bfd_section->owner, - secp->the_bfd_section) - & SEC_READONLY)) + && (bfd_section_flags (secp->the_bfd_section) & SEC_READONLY)) { table = target_get_section_table (ops); return section_table_xfer_memory_partial (readbuf, writebuf, diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index c4fde913af3..26030e0a928 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -794,8 +794,7 @@ windows_make_so (const char *name, LPVOID load_addr) file header and the section alignment. */ cygwin_load_start = (CORE_ADDR) (uintptr_t) ((char *) load_addr + 0x1000); - cygwin_load_end = cygwin_load_start + bfd_section_size (abfd.get (), - text); + cygwin_load_end = cygwin_load_start + bfd_section_size (text); } #endif diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index a17031a110e..2fa27066539 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -267,9 +267,9 @@ find_targ_sec (bfd *abfd, asection *sect, void *obj) if (sect->target_index == args->targ_index) { /* This is the section. Figure out what SECT_OFF_* code it is. */ - if (bfd_get_section_flags (abfd, sect) & SEC_CODE) + if (bfd_section_flags (sect) & SEC_CODE) *args->resultp = SECT_OFF_TEXT (objfile); - else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD) + else if (bfd_section_flags (sect) & SEC_LOAD) *args->resultp = SECT_OFF_DATA (objfile); else *args->resultp = gdb_bfd_section_index (abfd, sect); @@ -2354,7 +2354,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader, section. */ bfd_sect = secnum_to_bfd_section (symbol.n_scnum, objfile); if (bfd_sect) - toc_offset -= bfd_section_vma (objfile->obfd, bfd_sect); + toc_offset -= bfd_section_vma (bfd_sect); break; case XMC_TC: @@ -2952,7 +2952,7 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags) secp = bfd_get_section_by_name (abfd, ".debug"); if (secp) { - length = bfd_section_size (abfd, secp); + length = bfd_section_size (secp); if (length) { debugsec @@ -3029,8 +3029,7 @@ xcoff_symfile_offsets (struct objfile *objfile, if (objfile->num_sections == 0) return; /* Is that even possible? Better safe than sorry. */ - first_section_name - = bfd_section_name (objfile->obfd, objfile->sections[0].the_bfd_section); + first_section_name = bfd_section_name (objfile->sections[0].the_bfd_section); if (objfile->sect_index_text == 0 && strcmp (first_section_name, ".text") != 0) @@ -3089,7 +3088,7 @@ xcoff_get_core_n_import_files (bfd *abfd) if (sect == NULL) return -1; /* Not a core file. */ - for (offset = 0; offset < bfd_get_section_size (sect);) + for (offset = 0; offset < bfd_section_size (sect);) { int next; diff --git a/gprof/ChangeLog b/gprof/ChangeLog index a2ebab5e04b..84285aa30de 100644 --- a/gprof/ChangeLog +++ b/gprof/ChangeLog @@ -1,3 +1,8 @@ +2019-09-18 Alan Modra <amodra@gmail.com> + + * corefile.c, * symtab.c: Update throughout for bfd section + macro and function changes. + 2019-09-18 Simon Marchi <simon.marchi@polymtl.ca> * Makefile.in: Re-generate. diff --git a/gprof/corefile.c b/gprof/corefile.c index 3f350f5f6b2..ba6fd9c54f2 100644 --- a/gprof/corefile.c +++ b/gprof/corefile.c @@ -271,17 +271,17 @@ core_init (const char * aout_name) void core_get_text_space (bfd *cbfd) { - core_text_space = malloc (bfd_get_section_size (core_text_sect)); + core_text_space = malloc (bfd_section_size (core_text_sect)); if (!core_text_space) { fprintf (stderr, _("%s: ran out room for %lu bytes of text space\n"), - whoami, (unsigned long) bfd_get_section_size (core_text_sect)); + whoami, (unsigned long) bfd_section_size (core_text_sect)); done (1); } if (!bfd_get_section_contents (cbfd, core_text_sect, core_text_space, - 0, bfd_get_section_size (core_text_sect))) + 0, bfd_section_size (core_text_sect))) { bfd_perror ("bfd_get_section_contents"); free (core_text_space); @@ -675,7 +675,7 @@ core_create_function_syms (void) sym_sec = core_syms[i]->section; symtab.limit->addr = core_syms[i]->value; if (sym_sec) - symtab.limit->addr += bfd_get_section_vma (sym_sec->owner, sym_sec); + symtab.limit->addr += bfd_section_vma (sym_sec); if (found) { @@ -734,8 +734,8 @@ core_create_function_syms (void) section containing the symbol, if available. */ min_vma = MIN (symtab.limit->addr, min_vma); if (sym_sec) - max_vma = MAX (bfd_get_section_vma (sym_sec->owner, sym_sec) - + bfd_section_size (sym_sec->owner, sym_sec) - 1, + max_vma = MAX (bfd_section_vma (sym_sec) + + bfd_section_size (sym_sec) - 1, max_vma); else max_vma = MAX (symtab.limit->addr, max_vma); @@ -787,7 +787,7 @@ core_create_line_syms (void) ltab.len = 0; prev_line_num = 0; - vma_high = core_text_sect->vma + bfd_get_section_size (core_text_sect); + vma_high = core_text_sect->vma + bfd_section_size (core_text_sect); for (vma = core_text_sect->vma; vma < vma_high; vma += min_insn_size) { unsigned int len; diff --git a/gprof/symtab.c b/gprof/symtab.c index 70eb41573bc..eb63aa926a2 100644 --- a/gprof/symtab.c +++ b/gprof/symtab.c @@ -149,7 +149,7 @@ symtab_finalize (Sym_Table *tab) if (tab->len > 0 && dst[-1].end_addr == 0) dst[-1].end_addr - = core_text_sect->vma + bfd_get_section_size (core_text_sect) - 1; + = core_text_sect->vma + bfd_section_size (core_text_sect) - 1; DBG (AOUTDEBUG | IDDEBUG, printf ("[symtab_finalize]: removed %d duplicate entries\n", diff --git a/ld/ChangeLog b/ld/ChangeLog index e8f9ed73659..2abb558b9c1 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,5 +1,18 @@ 2019-09-18 Alan Modra <amodra@gmail.com> + * ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c, + * emultempl/aarch64elf.em, * emultempl/aix.em, + * emultempl/armcoff.em, * emultempl/armelf.em, + * emultempl/cr16elf.em, * emultempl/cskyelf.em, + * emultempl/m68hc1xelf.em, * emultempl/m68kelf.em, + * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, + * emultempl/mmo.em, * emultempl/msp430.em, + * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, + * emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update + throughout for bfd section macro and function changes. + +2019-09-18 Alan Modra <amodra@gmail.com> + * ldcref.c (check_reloc_refs): Update bfd_get_section to bfd_asymbol_section. diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em index 7ffb17e7a9c..bd5c8887826 100644 --- a/ld/emultempl/aarch64elf.em +++ b/ld/emultempl/aarch64elf.em @@ -178,7 +178,7 @@ elf${ELFSIZE}_aarch64_add_stub_section (const char *stub_sec_name, /* Long branch stubs contain a 64-bit address, so the section requires 8 byte alignment. */ - bfd_set_section_alignment (stub_file->the_bfd, stub_sec, 3); + bfd_set_section_alignment (stub_sec, 3); output_section = input_section->output_section; os = lang_output_section_get (output_section); diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em index 8151a9d5e93..1ce8376a52a 100644 --- a/ld/emultempl/aix.em +++ b/ld/emultempl/aix.em @@ -895,7 +895,7 @@ gld${EMULATION_NAME}_before_allocation (void) if (is == NULL) { einfo (_("%F%P: can't find %s in output section\n"), - bfd_get_section_name (sec->owner, sec)); + bfd_section_name (sec)); } /* Now figure out where the section should go. */ diff --git a/ld/emultempl/armcoff.em b/ld/emultempl/armcoff.em index 20122aa03f9..180e1faa27c 100644 --- a/ld/emultempl/armcoff.em +++ b/ld/emultempl/armcoff.em @@ -176,8 +176,7 @@ gld${EMULATION_NAME}_finish (void) /* Special procesing is required for a Thumb entry symbol. The bottom bit of its address must be set. */ val = (h->u.def.value - + bfd_get_section_vma (link_info.output_bfd, - h->u.def.section->output_section) + + bfd_section_vma (h->u.def.section->output_section) + h->u.def.section->output_offset); val |= 1; diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em index bb32bbbda41..0cbfcc70b32 100644 --- a/ld/emultempl/armelf.em +++ b/ld/emultempl/armelf.em @@ -232,7 +232,7 @@ elf32_arm_add_stub_section (const char * stub_sec_name, if (stub_sec == NULL) goto err_ret; - bfd_set_section_alignment (stub_file->the_bfd, stub_sec, alignment_power); + bfd_set_section_alignment (stub_sec, alignment_power); os = lang_output_section_get (output_section); @@ -478,8 +478,7 @@ gld${EMULATION_NAME}_finish (void) /* Special procesing is required for a Thumb entry symbol. The bottom bit of its address must be set. */ val = (h->u.def.value - + bfd_get_section_vma (link_info.output_bfd, - h->u.def.section->output_section) + + bfd_section_vma (h->u.def.section->output_section) + h->u.def.section->output_offset); val |= 1; diff --git a/ld/emultempl/cr16elf.em b/ld/emultempl/cr16elf.em index 197f0c6391f..9cdd356e356 100644 --- a/ld/emultempl/cr16elf.em +++ b/ld/emultempl/cr16elf.em @@ -75,14 +75,12 @@ cr16_elf_after_open (void) relsec = bfd_make_section (abfd, ".emreloc"); if (relsec == NULL - || ! bfd_set_section_flags (abfd, relsec, - (SEC_ALLOC - | SEC_LOAD - | SEC_HAS_CONTENTS - | SEC_IN_MEMORY)) - || ! bfd_set_section_alignment (abfd, relsec, 2) - || ! bfd_set_section_size (abfd, relsec, - datasec->reloc_count * 8)) + || !bfd_set_section_flags (relsec, (SEC_ALLOC + | SEC_LOAD + | SEC_HAS_CONTENTS + | SEC_IN_MEMORY)) + || !bfd_set_section_alignment (relsec, 2) + || !bfd_set_section_size (relsec, datasec->reloc_count * 8)) einfo (_("%F%P: %pB: can not create .emreloc section: %E\n")); } @@ -99,11 +97,11 @@ cr16_elf_after_open (void) static void check_sections (bfd *abfd, asection *sec, void *datasec) { - if ((strncmp (bfd_get_section_name (abfd, sec), ".data.rel", 9) == 0) + if ((strncmp (bfd_section_name (sec), ".data.rel", 9) == 0) && sec != datasec && sec->reloc_count == 0 ) einfo (_("%X%P: %pB: section %s has relocs; can not use --embedded-relocs\n"), - abfd, bfd_get_section_name (abfd, sec)); + abfd, bfd_section_name (sec)); } static void diff --git a/ld/emultempl/cskyelf.em b/ld/emultempl/cskyelf.em index 10d037c80d6..91848086550 100644 --- a/ld/emultempl/cskyelf.em +++ b/ld/emultempl/cskyelf.em @@ -180,10 +180,10 @@ elf32_csky_add_stub_section (const char *stub_sec_name, if (stub_sec == NULL) goto err_ret; - bfd_set_section_alignment (stub_file->the_bfd, stub_sec, 3); + bfd_set_section_alignment (stub_sec, 3); output_section = input_section->output_section; - secname = bfd_get_section_name (output_section->owner, output_section); + secname = bfd_section_name (output_section); os = lang_output_section_find (secname); info.input_section = input_section; diff --git a/ld/emultempl/m68hc1xelf.em b/ld/emultempl/m68hc1xelf.em index b55989e0e66..b63e4e92d97 100644 --- a/ld/emultempl/m68hc1xelf.em +++ b/ld/emultempl/m68hc1xelf.em @@ -212,10 +212,8 @@ hook_in_stub (struct hook_stub_info *info, lang_statement_union_type **lp) case lang_input_section_enum: if (l->input_section.section == info->input_section - || strcmp (bfd_get_section_name (l->input_section.section->owner, - l->input_section.section), - bfd_get_section_name (info->input_section->owner, - info->input_section)) == 0) + || strcmp (bfd_section_name (l->input_section.section), + bfd_section_name (info->input_section)) == 0) { /* We've found our section. Insert the stub immediately before its associated input section. */ diff --git a/ld/emultempl/m68kelf.em b/ld/emultempl/m68kelf.em index add8fd21dc1..c8d9eea934b 100644 --- a/ld/emultempl/m68kelf.em +++ b/ld/emultempl/m68kelf.em @@ -102,9 +102,8 @@ m68k_elf_after_open (void) | SEC_HAS_CONTENTS | SEC_IN_MEMORY)); if (relsec == NULL - || ! bfd_set_section_alignment (abfd, relsec, 2) - || ! bfd_set_section_size (abfd, relsec, - datasec->reloc_count * 12)) + || !bfd_set_section_alignment (relsec, 2) + || !bfd_set_section_size (relsec, datasec->reloc_count * 12)) einfo (_("%F%P: %pB: can not create .emreloc section: %E\n")); } @@ -123,11 +122,11 @@ m68k_elf_after_open (void) static void check_sections (bfd *abfd, asection *sec, void *datasec) { - if ((bfd_get_section_flags (abfd, sec) & SEC_DATA) + if ((bfd_section_flags (sec) & SEC_DATA) && sec != datasec && sec->reloc_count != 0) einfo (_("%X%P: %pB: section %s has relocs; can not use --embedded-relocs\n"), - abfd, bfd_get_section_name (abfd, sec)); + abfd, bfd_section_name (sec)); } #endif /* SUPPORT_EMBEDDED_RELOCS */ diff --git a/ld/emultempl/mipself.em b/ld/emultempl/mipself.em index 108d33faf33..48944d5309b 100644 --- a/ld/emultempl/mipself.em +++ b/ld/emultempl/mipself.em @@ -168,7 +168,7 @@ mips_add_stub_section (const char *stub_sec_name, asection *input_section, /* Set the flags. */ flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_KEEP); - if (!bfd_set_section_flags (stub_bfd, stub_sec, flags)) + if (!bfd_set_section_flags (stub_sec, flags)) goto err_ret; os = lang_output_section_get (output_section); diff --git a/ld/emultempl/mmix-elfnmmo.em b/ld/emultempl/mmix-elfnmmo.em index 736988b0cff..7cb4087a935 100644 --- a/ld/emultempl/mmix-elfnmmo.em +++ b/ld/emultempl/mmix-elfnmmo.em @@ -103,14 +103,14 @@ mmix_after_allocation (void) } /* Set vma to correspond to first such register number * 8. */ - bfd_set_section_vma (link_info.output_bfd, sec, (bfd_vma) regvma); + bfd_set_section_vma (sec, (bfd_vma) regvma); /* Simplify symbol output for the register section (without contents; created for register symbols) by setting the output offset to 0. This section is only present when there are register symbols. */ sec = bfd_get_section_by_name (link_info.output_bfd, MMIX_REG_SECTION_NAME); if (sec != NULL) - bfd_set_section_vma (sec->owner, sec, 0); + bfd_set_section_vma (sec, 0); if (!_bfd_mmix_after_linker_allocation (link_info.output_bfd, &link_info)) { diff --git a/ld/emultempl/mmo.em b/ld/emultempl/mmo.em index 62ee144416b..fff48942bc4 100644 --- a/ld/emultempl/mmo.em +++ b/ld/emultempl/mmo.em @@ -192,10 +192,10 @@ mmo_place_orphan (asection *s, paper over the bug similarly. */ static void -mmo_wipe_sec_reloc_flag (bfd *abfd, asection *sec, void *ptr ATTRIBUTE_UNUSED) +mmo_wipe_sec_reloc_flag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, + void *ptr ATTRIBUTE_UNUSED) { - bfd_set_section_flags (abfd, sec, - bfd_get_section_flags (abfd, sec) & ~SEC_RELOC); + bfd_set_section_flags (sec, bfd_section_flags (sec) & ~SEC_RELOC); } /* Iterate with bfd_map_over_sections over mmo_wipe_sec_reloc_flag... */ diff --git a/ld/emultempl/msp430.em b/ld/emultempl/msp430.em index 765a9ea288a..8f254895289 100644 --- a/ld/emultempl/msp430.em +++ b/ld/emultempl/msp430.em @@ -382,10 +382,10 @@ change_output_section (lang_statement_union_type ** head, } static void -add_region_prefix (bfd *abfd, asection *s, - ATTRIBUTE_UNUSED void *unused) +add_region_prefix (bfd *abfd ATTRIBUTE_UNUSED, asection *s, + void *unused ATTRIBUTE_UNUSED) { - const char *curr_name = bfd_get_section_name (abfd, s); + const char *curr_name = bfd_section_name (s); int region = REGION_NONE; if (strncmp (curr_name, ".text", 5) == 0) @@ -404,10 +404,10 @@ add_region_prefix (bfd *abfd, asection *s, case REGION_NONE: break; case REGION_UPPER: - bfd_rename_section (abfd, s, concat (".upper", curr_name, NULL)); + bfd_rename_section (s, concat (".upper", curr_name, NULL)); break; case REGION_LOWER: - bfd_rename_section (abfd, s, concat (".lower", curr_name, NULL)); + bfd_rename_section (s, concat (".lower", curr_name, NULL)); break; case REGION_EITHER: s->name = concat (".either", curr_name, NULL); @@ -538,7 +538,8 @@ gld${EMULATION_NAME}_handle_option (int optc) } static void -eval_upper_either_sections (bfd *abfd, asection *s, void *data) +eval_upper_either_sections (bfd *abfd ATTRIBUTE_UNUSED, + asection *s, void *data) { const char * base_sec_name; const char * curr_name; @@ -560,7 +561,7 @@ eval_upper_either_sections (bfd *abfd, asection *s, void *data) return; base_sec_name = (const char *) data; - curr_name = bfd_get_section_name (abfd, s); + curr_name = bfd_section_name (s); /* Only concerned with .either input sections in the upper output section. */ either_name = concat (".either", base_sec_name, NULL); @@ -620,7 +621,8 @@ eval_upper_either_sections (bfd *abfd, asection *s, void *data) } static void -eval_lower_either_sections (bfd *abfd, asection *s, void *data) +eval_lower_either_sections (bfd *abfd ATTRIBUTE_UNUSED, + asection *s, void *data) { const char * base_sec_name; const char * curr_name; @@ -640,7 +642,7 @@ eval_lower_either_sections (bfd *abfd, asection *s, void *data) return; base_sec_name = (const char *) data; - curr_name = bfd_get_section_name (abfd, s); + curr_name = bfd_section_name (s); /* Only concerned with .either input sections in the lower or "default" output section i.e. not in the upper output section. */ diff --git a/ld/emultempl/nios2elf.em b/ld/emultempl/nios2elf.em index 02eb06fb578..816da6ca722 100644 --- a/ld/emultempl/nios2elf.em +++ b/ld/emultempl/nios2elf.em @@ -181,7 +181,7 @@ nios2elf_add_stub_section (const char *stub_sec_name, asection *input_section, goto err_ret; output_section = input_section->output_section; - secname = bfd_get_section_name (output_section->owner, output_section); + secname = bfd_section_name (output_section); os = lang_output_section_find (secname); info.input_section = input_section; diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 2e78f26ad8b..70f771cebd7 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -1920,8 +1920,7 @@ gld_${EMULATION_NAME}_finish (void) /* Special procesing is required for a Thumb entry symbol. The bottom bit of its address must be set. */ val = (h->u.def.value - + bfd_get_section_vma (link_info.output_bfd, - h->u.def.section->output_section) + + bfd_section_vma (h->u.def.section->output_section) + h->u.def.section->output_offset); val |= 1; @@ -2182,7 +2181,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s, ls = &(*pl)->input_section; - lname = bfd_get_section_name (ls->section->owner, ls->section); + lname = bfd_section_name (ls->section); if (strchr (lname, '\$') != NULL && (dollar == NULL || strcmp (orig_secname, lname) < 0)) break; diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em index 601ef11c201..6d150d211a9 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em @@ -1979,7 +1979,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s, ls = &(*pl)->input_section; - lname = bfd_get_section_name (ls->section->owner, ls->section); + lname = bfd_section_name (ls->section); if (strchr (lname, '\$') != NULL && (dollar == NULL || strcmp (orig_secname, lname) < 0)) break; diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index 6df2a20cfce..ee71f256c65 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -421,12 +421,11 @@ ppc_add_stub_section (const char *stub_sec_name, asection *input_section) stub_sec = bfd_make_section_anyway_with_flags (stub_file->the_bfd, stub_sec_name, flags); if (stub_sec == NULL - || !bfd_set_section_alignment (stub_file->the_bfd, stub_sec, - (params.plt_stub_align > 5 - ? params.plt_stub_align - : params.plt_stub_align < -5 - ? -params.plt_stub_align - : 5))) + || !bfd_set_section_alignment (stub_sec, (params.plt_stub_align > 5 + ? params.plt_stub_align + : params.plt_stub_align < -5 + ? -params.plt_stub_align + : 5))) goto err_ret; output_section = input_section->output_section; diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em index c826363f5c9..569df615ce0 100644 --- a/ld/emultempl/xtensaelf.em +++ b/ld/emultempl/xtensaelf.em @@ -127,9 +127,9 @@ replace_insn_sec_with_prop_sec (bfd *abfd, /* Create a property table section for it. */ prop_sec_name = strdup (prop_sec_name); prop_sec = bfd_make_section_with_flags - (abfd, prop_sec_name, bfd_get_section_flags (abfd, insn_sec)); + (abfd, prop_sec_name, bfd_section_flags (insn_sec)); if (prop_sec == NULL - || ! bfd_set_section_alignment (abfd, prop_sec, 2)) + || !bfd_set_section_alignment (prop_sec, 2)) { *error_message = _("could not create new section"); goto cleanup; @@ -247,7 +247,7 @@ replace_instruction_table_sections (bfd *abfd, asection *sec) char *owned_prop_sec_name = NULL; const char *sec_name; - sec_name = bfd_get_section_name (abfd, sec); + sec_name = bfd_section_name (sec); if (strcmp (sec_name, INSN_SEC_BASE_NAME) == 0) { insn_sec_name = INSN_SEC_BASE_NAME; @@ -1293,10 +1293,10 @@ static bfd_boolean is_inconsistent_linkonce_section (asection *sec) { bfd *abfd = sec->owner; - const char *sec_name = bfd_get_section_name (abfd, sec); + const char *sec_name = bfd_section_name (sec); const char *name; - if ((bfd_get_section_flags (abfd, sec) & SEC_LINK_ONCE) == 0 + if ((bfd_section_flags (sec) & SEC_LINK_ONCE) == 0 || strncmp (sec_name, ".gnu.linkonce.", linkonce_len) != 0) return FALSE; diff --git a/ld/ldcref.c b/ld/ldcref.c index fff852a89ab..576cf7e388f 100644 --- a/ld/ldcref.c +++ b/ld/ldcref.c @@ -574,7 +574,7 @@ check_nocrossref (struct cref_hash_entry *h, void *ignore ATTRIBUTE_UNUSED) defsec = hl->u.def.section->output_section; if (defsec == NULL) return TRUE; - defsecname = bfd_get_section_name (defsec->owner, defsec); + defsecname = bfd_section_name (defsec); for (ncrs = nocrossref_list; ncrs != NULL; ncrs = ncrs->next) for (ncr = ncrs->list; ncr != NULL; ncr = ncr->next) @@ -658,10 +658,10 @@ check_reloc_refs (bfd *abfd, asection *sec, void *iarg) arelent **p, **pend; outsec = sec->output_section; - outsecname = bfd_get_section_name (outsec->owner, outsec); + outsecname = bfd_section_name (outsec); outdefsec = info->defsec->output_section; - outdefsecname = bfd_get_section_name (outdefsec->owner, outdefsec); + outdefsecname = bfd_section_name (outdefsec); /* The section where the symbol is defined is permitted. */ if (strcmp (outsecname, outdefsecname) == 0) diff --git a/ld/ldctor.c b/ld/ldctor.c index 608ca6c1f35..a6a6aa9e1e0 100644 --- a/ld/ldctor.c +++ b/ld/ldctor.c @@ -293,7 +293,7 @@ ldctor_build_sets (void) /* See PR 20911 for a reproducer. */ if (p->elements->section->owner == NULL) einfo (_("%X%P: special section %s does not support reloc %s for set %s\n"), - bfd_get_section_name (link_info.output_bfd, p->elements->section), + bfd_section_name (p->elements->section), bfd_get_reloc_code_name (p->reloc), p->h->root.string); else diff --git a/ld/ldelf.c b/ld/ldelf.c index 3b0f3ada8c2..8d4a2e58a1b 100644 --- a/ld/ldelf.c +++ b/ld/ldelf.c @@ -1065,7 +1065,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, for (s = abfd->sections; s && type < COMPACT_EH_HDR; s = s->next) { - const char *name = bfd_get_section_name (abfd, s); + const char *name = bfd_section_name (s); if (bfd_is_abs_section (s->output_section)) continue; @@ -1112,7 +1112,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd, bed->dynamic_sec_flags | SEC_READONLY); if (s != NULL - && bfd_set_section_alignment (elfbfd, s, 2)) + && bfd_set_section_alignment (s, 2)) { htab->eh_info.hdr_sec = s; warn_eh_frame = FALSE; @@ -1382,7 +1382,7 @@ ldelf_setup_build_id (bfd *ibfd) flags = (SEC_ALLOC | SEC_LOAD | SEC_IN_MEMORY | SEC_LINKER_CREATED | SEC_READONLY | SEC_DATA); s = bfd_make_section_with_flags (ibfd, ".note.gnu.build-id", flags); - if (s != NULL && bfd_set_section_alignment (ibfd, s, 2)) + if (s != NULL && bfd_set_section_alignment (s, 2)) { struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd); t->o->build_id.after_write_object_contents = &write_build_id; diff --git a/ld/ldlang.c b/ld/ldlang.c index 76e862a6409..a3843623fb4 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -319,7 +319,7 @@ walk_wild_section_general (lang_wild_statement_type *ptr, if (sec->spec.name != NULL) { - const char *sname = bfd_get_section_name (file->the_bfd, s); + const char *sname = bfd_section_name (s); skip = name_match (sec->spec.name, sname) != 0; } @@ -452,10 +452,8 @@ compare_section (sort_type sort, asection *asec, asection *bsec) abort (); case by_init_priority: - ainit_priority - = get_init_priority (bfd_get_section_name (asec->owner, asec)); - binit_priority - = get_init_priority (bfd_get_section_name (bsec->owner, bsec)); + ainit_priority = get_init_priority (bfd_section_name (asec)); + binit_priority = get_init_priority (bfd_section_name (bsec)); if (ainit_priority == 0 || binit_priority == 0) goto sort_by_name; ret = ainit_priority - binit_priority; @@ -465,28 +463,24 @@ compare_section (sort_type sort, asection *asec, asection *bsec) goto sort_by_name; case by_alignment_name: - ret = (bfd_section_alignment (bsec->owner, bsec) - - bfd_section_alignment (asec->owner, asec)); + ret = bfd_section_alignment (bsec) - bfd_section_alignment (asec); if (ret) break; /* Fall through. */ case by_name: sort_by_name: - ret = strcmp (bfd_get_section_name (asec->owner, asec), - bfd_get_section_name (bsec->owner, bsec)); + ret = strcmp (bfd_section_name (asec), bfd_section_name (bsec)); break; case by_name_alignment: - ret = strcmp (bfd_get_section_name (asec->owner, asec), - bfd_get_section_name (bsec->owner, bsec)); + ret = strcmp (bfd_section_name (asec), bfd_section_name (bsec)); if (ret) break; /* Fall through. */ case by_alignment: - ret = (bfd_section_alignment (bsec->owner, bsec) - - bfd_section_alignment (asec->owner, asec)); + ret = bfd_section_alignment (bsec) - bfd_section_alignment (asec); break; } @@ -610,7 +604,7 @@ walk_wild_section_specs1_wild1 (lang_wild_statement_type *ptr, for (s = file->the_bfd->sections; s != NULL; s = s->next) { - const char *sname = bfd_get_section_name (file->the_bfd, s); + const char *sname = bfd_section_name (s); bfd_boolean skip = !match_simple_wild (wildsec0->spec.name, sname); if (!skip) @@ -647,7 +641,7 @@ walk_wild_section_specs2_wild1 (lang_wild_statement_type *ptr, walk_wild_consider_section (ptr, file, s, sec0, callback, data); else { - const char *sname = bfd_get_section_name (file->the_bfd, s); + const char *sname = bfd_section_name (s); bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname); if (!skip) @@ -682,7 +676,7 @@ walk_wild_section_specs3_wild2 (lang_wild_statement_type *ptr, walk_wild_consider_section (ptr, file, s, sec0, callback, data); else { - const char *sname = bfd_get_section_name (file->the_bfd, s); + const char *sname = bfd_section_name (s); bfd_boolean skip = !match_simple_wild (wildsec1->spec.name, sname); if (!skip) @@ -734,7 +728,7 @@ walk_wild_section_specs4_wild2 (lang_wild_statement_type *ptr, walk_wild_consider_section (ptr, file, s, sec1, callback, data); else { - const char *sname = bfd_get_section_name (file->the_bfd, s); + const char *sname = bfd_section_name (s); bfd_boolean skip = !match_simple_wild (wildsec2->spec.name, sname); @@ -5314,9 +5308,8 @@ lang_size_sections_1 " section %s\n"), os->name); input = os->children.head->input_section.section; - bfd_set_section_vma (os->bfd_section->owner, - os->bfd_section, - bfd_section_vma (input->owner, input)); + bfd_set_section_vma (os->bfd_section, + bfd_section_vma (input)); if (!(os->bfd_section->flags & SEC_FIXED_SIZE)) os->bfd_section->size = input->size; break; @@ -5371,13 +5364,11 @@ lang_size_sections_1 if (command_line.check_section_addresses) einfo (_("%F%P: error: no memory region specified" " for loadable section `%s'\n"), - bfd_get_section_name (link_info.output_bfd, - os->bfd_section)); + bfd_section_name (os->bfd_section)); else einfo (_("%P: warning: no memory region specified" " for loadable section `%s'\n"), - bfd_get_section_name (link_info.output_bfd, - os->bfd_section)); + bfd_section_name (os->bfd_section)); } newdot = os->region->current; @@ -5406,7 +5397,7 @@ lang_size_sections_1 os->name, (unsigned long) dotdelta); } - bfd_set_section_vma (0, os->bfd_section, newdot); + bfd_set_section_vma (os->bfd_section, newdot); os->bfd_section->output_offset = 0; } @@ -6464,8 +6455,7 @@ lang_end (void) bfd_vma val; val = (h->u.def.value - + bfd_get_section_vma (link_info.output_bfd, - h->u.def.section->output_section) + + bfd_section_vma (h->u.def.section->output_section) + h->u.def.section->output_offset); if (!bfd_set_start_address (link_info.output_bfd, val)) einfo (_("%F%P: %s: can't set start address\n"), entry_symbol.name); @@ -6496,10 +6486,9 @@ lang_end (void) einfo (_("%P: warning: cannot find entry symbol %s;" " defaulting to %V\n"), entry_symbol.name, - bfd_get_section_vma (link_info.output_bfd, ts)); - if (!(bfd_set_start_address - (link_info.output_bfd, - bfd_get_section_vma (link_info.output_bfd, ts)))) + bfd_section_vma (ts)); + if (!bfd_set_start_address (link_info.output_bfd, + bfd_section_vma (ts))) einfo (_("%F%P: can't set start address\n")); } else diff --git a/ld/pe-dll.c b/ld/pe-dll.c index 577b911da8a..3cfbc39e5bd 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -1014,33 +1014,31 @@ build_filler_bfd (int include_edata) { edata_s = bfd_make_section_old_way (filler_bfd, ".edata"); if (edata_s == NULL - || !bfd_set_section_flags (filler_bfd, edata_s, - (SEC_HAS_CONTENTS - | SEC_ALLOC - | SEC_LOAD - | SEC_KEEP - | SEC_IN_MEMORY))) + || !bfd_set_section_flags (edata_s, (SEC_HAS_CONTENTS + | SEC_ALLOC + | SEC_LOAD + | SEC_KEEP + | SEC_IN_MEMORY))) { einfo (_("%X%P: can not create .edata section: %E\n")); return; } - bfd_set_section_size (filler_bfd, edata_s, edata_sz); + bfd_set_section_size (edata_s, edata_sz); } reloc_s = bfd_make_section_old_way (filler_bfd, ".reloc"); if (reloc_s == NULL - || !bfd_set_section_flags (filler_bfd, reloc_s, - (SEC_HAS_CONTENTS - | SEC_ALLOC - | SEC_LOAD - | SEC_KEEP - | SEC_IN_MEMORY))) + || !bfd_set_section_flags (reloc_s, (SEC_HAS_CONTENTS + | SEC_ALLOC + | SEC_LOAD + | SEC_KEEP + | SEC_IN_MEMORY))) { einfo (_("%X%P: can not create .reloc section: %E\n")); return; } - bfd_set_section_size (filler_bfd, reloc_s, 0); + bfd_set_section_size (reloc_s, 0); ldlang_add_file (filler_file); } @@ -1303,7 +1301,7 @@ pe_walk_relocs (struct bfd_link_info *info, { arelent **relocs; int relsize, nrelocs, i; - int flags = bfd_get_section_flags (b, s); + int flags = bfd_section_flags (s); /* Skip discarded linkonce sections. */ if (flags & SEC_LINK_ONCE @@ -1947,8 +1945,8 @@ quick_section (bfd *abfd, const char *name, int flags, int align) asymbol *sym; sec = bfd_make_section_old_way (abfd, name); - bfd_set_section_flags (abfd, sec, flags | SEC_ALLOC | SEC_LOAD | SEC_KEEP); - bfd_set_section_alignment (abfd, sec, align); + bfd_set_section_flags (sec, flags | SEC_ALLOC | SEC_LOAD | SEC_KEEP); + bfd_set_section_alignment (sec, align); /* Remember to undo this before trying to link internally! */ sec->output_section = sec; @@ -2072,7 +2070,7 @@ make_head (bfd *parent) pointer to the list points to the *end* of this section, which is the start of the list of sections from other objects. */ - bfd_set_section_size (abfd, id2, 20); + bfd_set_section_size (id2, 20); d2 = xmalloc (20); id2->contents = d2; memset (d2, 0, 20); @@ -2084,16 +2082,16 @@ make_head (bfd *parent) save_relocs (id2); if (pe_use_nul_prefixed_import_tables) - bfd_set_section_size (abfd, id5, PE_IDATA5_SIZE); + bfd_set_section_size (id5, PE_IDATA5_SIZE); else - bfd_set_section_size (abfd, id5, 0); + bfd_set_section_size (id5, 0); d5 = xmalloc (PE_IDATA5_SIZE); id5->contents = d5; memset (d5, 0, PE_IDATA5_SIZE); if (pe_use_nul_prefixed_import_tables) - bfd_set_section_size (abfd, id4, PE_IDATA4_SIZE); + bfd_set_section_size (id4, PE_IDATA4_SIZE); else - bfd_set_section_size (abfd, id4, 0); + bfd_set_section_size (id4, 0); d4 = xmalloc (PE_IDATA4_SIZE); id4->contents = d4; memset (d4, 0, PE_IDATA4_SIZE); @@ -2154,12 +2152,12 @@ make_tail (bfd *parent) id7 = quick_section (abfd, ".idata$7", SEC_HAS_CONTENTS, 2); quick_symbol (abfd, U (""), dll_symname, "_iname", id7, BSF_GLOBAL, 0); - bfd_set_section_size (abfd, id4, PE_IDATA4_SIZE); + bfd_set_section_size (id4, PE_IDATA4_SIZE); d4 = xmalloc (PE_IDATA4_SIZE); id4->contents = d4; memset (d4, 0, PE_IDATA4_SIZE); - bfd_set_section_size (abfd, id5, PE_IDATA5_SIZE); + bfd_set_section_size (id5, PE_IDATA5_SIZE); d5 = xmalloc (PE_IDATA5_SIZE); id5->contents = d5; memset (d5, 0, PE_IDATA5_SIZE); @@ -2167,7 +2165,7 @@ make_tail (bfd *parent) len = strlen (dll_filename) + 1; if (len & 1) len++; - bfd_set_section_size (abfd, id7, len); + bfd_set_section_size (id7, len); d7 = xmalloc (len); id7->contents = d7; strcpy ((char *) d7, dll_filename); @@ -2339,7 +2337,7 @@ make_one (def_file_export *exp, bfd *parent, bfd_boolean include_jmp_stub) if (include_jmp_stub) { - bfd_set_section_size (abfd, tx, jmp_byte_count); + bfd_set_section_size (tx, jmp_byte_count); td = xmalloc (jmp_byte_count); tx->contents = td; memcpy (td, jmp_bytes, jmp_byte_count); @@ -2374,16 +2372,16 @@ make_one (def_file_export *exp, bfd *parent, bfd_boolean include_jmp_stub) save_relocs (tx); } else - bfd_set_section_size (abfd, tx, 0); + bfd_set_section_size (tx, 0); - bfd_set_section_size (abfd, id7, 4); + bfd_set_section_size (id7, 4); d7 = xmalloc (4); id7->contents = d7; memset (d7, 0, 4); quick_reloc (abfd, 0, BFD_RELOC_RVA, 5); save_relocs (id7); - bfd_set_section_size (abfd, id5, PE_IDATA5_SIZE); + bfd_set_section_size (id5, PE_IDATA5_SIZE); d5 = xmalloc (PE_IDATA5_SIZE); id5->contents = d5; memset (d5, 0, PE_IDATA5_SIZE); @@ -2400,7 +2398,7 @@ make_one (def_file_export *exp, bfd *parent, bfd_boolean include_jmp_stub) save_relocs (id5); } - bfd_set_section_size (abfd, id4, PE_IDATA4_SIZE); + bfd_set_section_size (id4, PE_IDATA4_SIZE); d4 = xmalloc (PE_IDATA4_SIZE); id4->contents = d4; memset (d4, 0, PE_IDATA4_SIZE); @@ -2420,7 +2418,7 @@ make_one (def_file_export *exp, bfd *parent, bfd_boolean include_jmp_stub) if (exp->flag_noname) { len = 0; - bfd_set_section_size (abfd, id6, 0); + bfd_set_section_size (id6, 0); } else { @@ -2433,7 +2431,7 @@ make_one (def_file_export *exp, bfd *parent, bfd_boolean include_jmp_stub) len = 2 + strlen (exp->name) + 1; if (len & 1) len++; - bfd_set_section_size (abfd, id6, len); + bfd_set_section_size (id6, len); d6 = xmalloc (len); id6->contents = d6; memset (d6, 0, len); @@ -2491,7 +2489,7 @@ make_singleton_name_thunk (const char *import, bfd *parent) quick_symbol (abfd, "__nm_", import, "", UNDSEC, BSF_GLOBAL, 0); /* We need space for the real thunk and for the null terminator. */ - bfd_set_section_size (abfd, id4, PE_IDATA4_SIZE * 2); + bfd_set_section_size (id4, PE_IDATA4_SIZE * 2); d4 = xmalloc (PE_IDATA4_SIZE * 2); id4->contents = d4; memset (d4, 0, PE_IDATA4_SIZE * 2); @@ -2568,7 +2566,7 @@ make_import_fixup_entry (const char *name, quick_symbol (abfd, U (""), symname, "_iname", UNDSEC, BSF_GLOBAL, 0); quick_symbol (abfd, "", fixup_name, "", UNDSEC, BSF_GLOBAL, 0); - bfd_set_section_size (abfd, id2, 20); + bfd_set_section_size (id2, 20); d2 = xmalloc (20); id2->contents = d2; memset (d2, 0, 20); @@ -2643,7 +2641,7 @@ make_runtime_pseudo_reloc (const char *name ATTRIBUTE_UNUSED, quick_symbol (abfd, "__imp_", name, "", UNDSEC, BSF_GLOBAL, 0); - bfd_set_section_size (abfd, rt_rel, size); + bfd_set_section_size (rt_rel, size); rt_rel_d = xmalloc (size); rt_rel->contents = rt_rel_d; memset (rt_rel_d, 0, size); @@ -2660,7 +2658,7 @@ make_runtime_pseudo_reloc (const char *name ATTRIBUTE_UNUSED, } else { - bfd_set_section_size (abfd, rt_rel, 8); + bfd_set_section_size (rt_rel, 8); rt_rel_d = xmalloc (8); rt_rel->contents = rt_rel_d; memset (rt_rel_d, 0, 8); @@ -2708,7 +2706,7 @@ pe_create_runtime_relocator_reference (bfd *parent) quick_symbol (abfd, "", U ("_pei386_runtime_relocator"), "", UNDSEC, BSF_NO_FLAGS, 0); - bfd_set_section_size (abfd, extern_rt_rel, PE_IDATA5_SIZE); + bfd_set_section_size (extern_rt_rel, PE_IDATA5_SIZE); extern_rt_rel_d = xcalloc (1, PE_IDATA5_SIZE); extern_rt_rel->contents = extern_rt_rel_d; @@ -3571,7 +3569,7 @@ pe_dll_fill_sections (bfd *abfd, struct bfd_link_info *info) generate_reloc (abfd, info); if (reloc_sz > 0) { - bfd_set_section_size (filler_bfd, reloc_s, reloc_sz); + bfd_set_section_size (reloc_s, reloc_sz); /* Resize the sections. */ lang_reset_memory_regions (); @@ -3603,7 +3601,7 @@ pe_exe_fill_sections (bfd *abfd, struct bfd_link_info *info) generate_reloc (abfd, info); if (reloc_sz > 0) { - bfd_set_section_size (filler_bfd, reloc_s, reloc_sz); + bfd_set_section_size (reloc_s, reloc_sz); /* Resize the sections. */ lang_reset_memory_regions (); diff --git a/libctf/ChangeLog b/libctf/ChangeLog index e56e2c0b866..8a82ed0565f 100644 --- a/libctf/ChangeLog +++ b/libctf/ChangeLog @@ -1,3 +1,7 @@ +2019-09-18 Alan Modra <amodra@gmail.com> + + * ctf-open-bfd.c: Update throughout for bfd section macro changes. + 2019-09-09 Phil Blundell <pb@pbcl.net> binutils 2.33 branch created. diff --git a/libctf/ctf-open-bfd.c b/libctf/ctf-open-bfd.c index bb2d7e64de2..6a0c15531ef 100644 --- a/libctf/ctf-open-bfd.c +++ b/libctf/ctf-open-bfd.c @@ -100,7 +100,7 @@ ctf_bfdopen (struct bfd *abfd, int *errp) ctfsect.cts_name = _CTF_SECTION; ctfsect.cts_entsize = 1; - ctfsect.cts_size = bfd_section_size (abfd, ctf_asect); + ctfsect.cts_size = bfd_section_size (ctf_asect); ctfsect.cts_data = contents; if ((arc = ctf_bfdopen_ctfsect (abfd, &ctfsect, errp)) != NULL) @@ -157,7 +157,7 @@ ctf_bfdopen_ctfsect (struct bfd *abfd _libctf_unused_, } strsect.cts_data = contents; strsect.cts_name = (char *) strsect.cts_data + strhdr->sh_name; - strsect.cts_size = bfd_section_size (abfd, str_asect); + strsect.cts_size = bfd_section_size (str_asect); strsect.cts_entsize = strhdr->sh_size; strsectp = &strsect; @@ -170,7 +170,7 @@ ctf_bfdopen_ctfsect (struct bfd *abfd _libctf_unused_, symsect.cts_name = (char *) strsect.cts_data + symhdr->sh_name; symsect.cts_entsize = symhdr->sh_size; - symsect.cts_size = bfd_section_size (abfd, sym_asect); + symsect.cts_size = bfd_section_size (sym_asect); symsect.cts_data = contents; symsectp = &symsect; } diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index d5b412275fc..0d8abcd7ff2 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2019-09-18 Alan Modra <amodra@gmail.com> + + * arc-ext.c: Update throughout for bfd section macro changes. + 2019-09-18 Simon Marchi <simon.marchi@polymtl.ca> * Makefile.in: Re-generate. diff --git a/opcodes/arc-ext.c b/opcodes/arc-ext.c index bf578871d76..cfb13aa0e1d 100644 --- a/opcodes/arc-ext.c +++ b/opcodes/arc-ext.c @@ -438,7 +438,7 @@ build_ARC_extmap (bfd *text_bfd) sizeof (".gnu.linkonce.arcextmap.") - 1) || !strcmp (sect->name,".arcextmap")) { - bfd_size_type count = bfd_get_section_size (sect); + bfd_size_type count = bfd_section_size (sect); unsigned char* buffer = xmalloc (count); if (buffer) diff --git a/sim/ChangeLog b/sim/ChangeLog index d16f2cfa57c..191e2370a98 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,11 @@ +2019-09-18 Alan Modra <amodra@gmail.com> + + * common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c, + * erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c, + * m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c, + * rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c, + * rx/trace.c: Update throughout for bfd section macro changes. + 2019-06-13 Stafford Horne <shorne@gmail.com> * or1k/cpu.c: Regenerate. diff --git a/sim/common/sim-load.c b/sim/common/sim-load.c index c198027824d..ff06497d5c6 100644 --- a/sim/common/sim-load.c +++ b/sim/common/sim-load.c @@ -101,7 +101,7 @@ sim_load_file (SIM_DESC sd, const char *myname, host_callback *callback, { bfd_size_type size; - size = bfd_get_section_size (s); + size = bfd_section_size (s); if (size > 0) { unsigned char *buffer; @@ -119,13 +119,13 @@ sim_load_file (SIM_DESC sd, const char *myname, host_callback *callback, return NULL; } if (lma_p) - lma = bfd_section_lma (result_bfd, s); + lma = bfd_section_lma (s); else - lma = bfd_section_vma (result_bfd, s); + lma = bfd_section_vma (s); if (verbose_p) { xprintf (callback, "Loading section %s, size 0x%lx %s ", - bfd_get_section_name (result_bfd, s), + bfd_section_name (s), (unsigned long) size, (lma_p ? "lma" : "vma")); xprintf_bfd_vma (callback, lma); diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c index c94b2f77ac3..e83a2e4d0c8 100644 --- a/sim/common/sim-utils.c +++ b/sim/common/sim-utils.c @@ -263,11 +263,11 @@ sim_analyze_program (SIM_DESC sd, const char *prog_name, bfd *prog_bfd) STATE_START_ADDR (sd) = bfd_get_start_address (prog_bfd); for (s = prog_bfd->sections; s; s = s->next) - if (strcmp (bfd_get_section_name (prog_bfd, s), ".text") == 0) + if (strcmp (bfd_section_name (s), ".text") == 0) { STATE_TEXT_SECTION (sd) = s; - STATE_TEXT_START (sd) = bfd_get_section_vma (prog_bfd, s); - STATE_TEXT_END (sd) = STATE_TEXT_START (sd) + bfd_section_size (prog_bfd, s); + STATE_TEXT_START (sd) = bfd_section_vma (s); + STATE_TEXT_END (sd) = STATE_TEXT_START (sd) + bfd_section_size (s); break; } diff --git a/sim/cris/sim-if.c b/sim/cris/sim-if.c index 1a5d421caff..ebfb0e586b4 100644 --- a/sim/cris/sim-if.c +++ b/sim/cris/sim-if.c @@ -315,17 +315,17 @@ cris_set_section_offset_iterator (bfd *abfd, asection *s, void *vp) SIM_DESC sd = p->sd; int offset = p->offset; - if ((bfd_get_section_flags (abfd, s) & SEC_ALLOC)) + if ((bfd_section_flags (s) & SEC_ALLOC)) { - bfd_vma vma = bfd_get_section_vma (abfd, s); + bfd_vma vma = bfd_section_vma (s); - bfd_set_section_vma (abfd, s, vma + offset); + bfd_set_section_vma (s, vma + offset); } /* This seems clumsy and inaccurate, but let's stick to doing it the same way as sim_analyze_program for consistency. */ - if (strcmp (bfd_get_section_name (abfd, s), ".text") == 0) - STATE_TEXT_START (sd) = bfd_get_section_vma (abfd, s); + if (strcmp (bfd_section_name (s), ".text") == 0) + STATE_TEXT_START (sd) = bfd_section_vma (s); } /* Adjust the start-address, LMA and VMA of a SD. Must be called @@ -360,10 +360,10 @@ get_progbounds_iterator (bfd *abfd ATTRIBUTE_UNUSED, asection *s, void *vp) { struct progbounds *pbp = (struct progbounds *) vp; - if ((bfd_get_section_flags (abfd, s) & SEC_ALLOC)) + if ((bfd_section_flags (s) & SEC_ALLOC)) { - bfd_size_type sec_size = bfd_get_section_size (s); - bfd_size_type sec_start = bfd_get_section_vma (abfd, s); + bfd_size_type sec_size = bfd_section_size (s); + bfd_size_type sec_start = bfd_section_vma (s); bfd_size_type sec_end = sec_start + sec_size; if (sec_end > pbp->endmem) @@ -372,7 +372,7 @@ get_progbounds_iterator (bfd *abfd ATTRIBUTE_UNUSED, asection *s, void *vp) if (sec_start < pbp->startmem) pbp->startmem = sec_start; - if ((bfd_get_section_flags (abfd, s) & SEC_LOAD)) + if ((bfd_section_flags (s) & SEC_LOAD)) { if (sec_end > pbp->end_loadmem) pbp->end_loadmem = sec_end; diff --git a/sim/erc32/func.c b/sim/erc32/func.c index d6a51b15910..a0c85a09139 100644 --- a/sim/erc32/func.c +++ b/sim/erc32/func.c @@ -1051,14 +1051,14 @@ bfd_load (const char *fname) if (sis_verbose) printf("loading %s:", fname); for (section = pbfd->sections; section; section = section->next) { - if (bfd_get_section_flags(pbfd, section) & SEC_ALLOC) { + if (bfd_section_flags (section) & SEC_ALLOC) { bfd_vma section_address; unsigned long section_size; const char *section_name; - section_name = bfd_get_section_name(pbfd, section); + section_name = bfd_section_name (section); - section_address = bfd_get_section_vma(pbfd, section); + section_address = bfd_section_vma (section); /* * Adjust sections from a.out files, since they don't carry their * addresses with. @@ -1084,14 +1084,14 @@ bfd_load (const char *fname) } } - section_size = bfd_section_size(pbfd, section); + section_size = bfd_section_size (section); if (sis_verbose) printf("\nsection %s at 0x%08lx (0x%lx bytes)", section_name, section_address, section_size); /* Text, data or lit */ - if (bfd_get_section_flags(pbfd, section) & SEC_LOAD) { + if (bfd_section_flags (section) & SEC_LOAD) { file_ptr fptr; fptr = 0; diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c index 2698b2e28e7..71312d36442 100644 --- a/sim/lm32/sim-if.c +++ b/sim/lm32/sim-if.c @@ -50,21 +50,18 @@ find_base (bfd *prog_bfd) found = 0; for (s = prog_bfd->sections; s; s = s->next) { - if ((strcmp (bfd_get_section_name (prog_bfd, s), ".boot") == 0) - || (strcmp (bfd_get_section_name (prog_bfd, s), ".text") == 0) - || (strcmp (bfd_get_section_name (prog_bfd, s), ".data") == 0) - || (strcmp (bfd_get_section_name (prog_bfd, s), ".bss") == 0)) + if ((strcmp (bfd_section_name (s), ".boot") == 0) + || (strcmp (bfd_section_name (s), ".text") == 0) + || (strcmp (bfd_section_name (s), ".data") == 0) + || (strcmp (bfd_section_name (s), ".bss") == 0)) { if (!found) { - base = bfd_get_section_vma (prog_bfd, s); + base = bfd_section_vma (s); found = 1; } else - base = - bfd_get_section_vma (prog_bfd, - s) < base ? bfd_get_section_vma (prog_bfd, - s) : base; + base = bfd_section_vma (s) < base ? bfd_section_vma (s) : base; } } return base & ~(0xffffUL); diff --git a/sim/m32c/load.c b/sim/m32c/load.c index 3937fea0883..c6a3b2dcaa9 100644 --- a/sim/m32c/load.c +++ b/sim/m32c/load.c @@ -74,11 +74,11 @@ m32c_load (bfd * prog) remains as a reminder. */ if ((s->flags & SEC_ALLOC) && !(s->flags & SEC_READONLY)) { - if (strcmp (bfd_get_section_name (prog, s), ".stack")) + if (strcmp (bfd_section_name (s), ".stack")) { int secend = - bfd_get_section_size (s) + bfd_section_lma (prog, s); - if (heaptop < secend && bfd_section_lma (prog, s) < 0x10000) + bfd_section_size (s) + bfd_section_lma (s); + if (heaptop < secend && bfd_section_lma (s) < 0x10000) { heaptop = heapbottom = secend; } @@ -91,14 +91,14 @@ m32c_load (bfd * prog) bfd_size_type size; bfd_vma base; - size = bfd_get_section_size (s); + size = bfd_section_size (s); if (size <= 0) continue; - base = bfd_section_lma (prog, s); + base = bfd_section_lma (s); if (verbose) fprintf (stderr, "[load a=%08x s=%08x %s]\n", - (int) base, (int) size, bfd_get_section_name (prog, s)); + (int) base, (int) size, bfd_section_name (s)); buf = (char *) malloc (size); bfd_get_section_contents (prog, s, buf, 0, size); mem_put_blk (base, buf, size); diff --git a/sim/m32c/trace.c b/sim/m32c/trace.c index e507c978b83..bc75d15e3c9 100644 --- a/sim/m32c/trace.c +++ b/sim/m32c/trace.c @@ -231,7 +231,7 @@ sim_disasm_one (void) if (s->flags & SEC_CODE || code_section == 0) { code_section = s; - code_base = bfd_section_lma (current_bfd, s); + code_base = bfd_section_lma (s); break; } } diff --git a/sim/m68hc11/interp.c b/sim/m68hc11/interp.c index 9e8ccab1807..a5131d2a977 100644 --- a/sim/m68hc11/interp.c +++ b/sim/m68hc11/interp.c @@ -344,15 +344,15 @@ sim_prepare_for_program (SIM_DESC sd, bfd* abfd) { bfd_size_type size; - size = bfd_get_section_size (s); + size = bfd_section_size (s); if (size > 0) { bfd_vma lma; if (STATE_LOAD_AT_LMA_P (sd)) - lma = bfd_section_lma (abfd, s); + lma = bfd_section_lma (s); else - lma = bfd_section_vma (abfd, s); + lma = bfd_section_vma (s); if (lma <= 0xFFFE && lma+size >= 0x10000) cpu->cpu_use_elf_start = 0; diff --git a/sim/ppc/hw_htab.c b/sim/ppc/hw_htab.c index cf275ff7025..e7b6371e1dd 100644 --- a/sim/ppc/hw_htab.c +++ b/sim/ppc/hw_htab.c @@ -391,16 +391,16 @@ htab_sum_binary(bfd *abfd, PTR data) { htab_binary_sizes *sizes = (htab_binary_sizes*)data; - unsigned_word size = bfd_get_section_size (sec); - unsigned_word vma = bfd_get_section_vma (abfd, sec); - unsigned_word ra = bfd_get_section_lma (abfd, sec); + unsigned_word size = bfd_section_size (sec); + unsigned_word vma = bfd_section_vma (sec); + unsigned_word ra = bfd_section_lma (sec); /* skip the section if no memory to allocate */ - if (! (bfd_get_section_flags(abfd, sec) & SEC_ALLOC)) + if (! (bfd_section_flags (sec) & SEC_ALLOC)) return; - if ((bfd_get_section_flags (abfd, sec) & SEC_CODE) - || (bfd_get_section_flags (abfd, sec) & SEC_READONLY)) { + if ((bfd_section_flags (sec) & SEC_CODE) + || (bfd_section_flags (sec) & SEC_READONLY)) { if (sizes->text_bound < vma + size) sizes->text_bound = ALIGN_PAGE(vma + size); if (sizes->text_base > vma) @@ -408,8 +408,8 @@ htab_sum_binary(bfd *abfd, if (sizes->text_ra > ra) sizes->text_ra = FLOOR_PAGE(ra); } - else if ((bfd_get_section_flags (abfd, sec) & SEC_DATA) - || (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)) { + else if ((bfd_section_flags (sec) & SEC_DATA) + || (bfd_section_flags (sec) & SEC_ALLOC)) { if (sizes->data_bound < vma + size) sizes->data_bound = ALIGN_PAGE(vma + size); if (sizes->data_base > vma) @@ -432,41 +432,41 @@ htab_dma_binary(bfd *abfd, device *me = sizes->me; /* skip the section if no memory to allocate */ - if (! (bfd_get_section_flags(abfd, sec) & SEC_ALLOC)) + if (! (bfd_section_flags (sec) & SEC_ALLOC)) return; /* check/ignore any sections of size zero */ - section_size = bfd_get_section_size (sec); + section_size = bfd_section_size (sec); if (section_size == 0) return; /* if nothing to load, ignore this one */ - if (! (bfd_get_section_flags(abfd, sec) & SEC_LOAD)) + if (! (bfd_section_flags (sec) & SEC_LOAD)) return; /* find where it is to go */ - section_vma = bfd_get_section_vma(abfd, sec); + section_vma = bfd_section_vma (sec); section_ra = 0; - if ((bfd_get_section_flags (abfd, sec) & SEC_CODE) - || (bfd_get_section_flags (abfd, sec) & SEC_READONLY)) + if ((bfd_section_flags (sec) & SEC_CODE) + || (bfd_section_flags (sec) & SEC_READONLY)) section_ra = (section_vma - sizes->text_base + sizes->text_ra); - else if ((bfd_get_section_flags (abfd, sec) & SEC_DATA)) + else if ((bfd_section_flags (sec) & SEC_DATA)) section_ra = (section_vma - sizes->data_base + sizes->data_ra); else return; /* just ignore it */ DTRACE(htab, ("load - name=%-7s vma=0x%.8lx size=%6ld ra=0x%.8lx flags=%3lx(%s%s%s%s%s )\n", - bfd_get_section_name(abfd, sec), + bfd_section_name (sec), (long)section_vma, (long)section_size, (long)section_ra, - (long)bfd_get_section_flags(abfd, sec), - bfd_get_section_flags(abfd, sec) & SEC_LOAD ? " LOAD" : "", - bfd_get_section_flags(abfd, sec) & SEC_CODE ? " CODE" : "", - bfd_get_section_flags(abfd, sec) & SEC_DATA ? " DATA" : "", - bfd_get_section_flags(abfd, sec) & SEC_ALLOC ? " ALLOC" : "", - bfd_get_section_flags(abfd, sec) & SEC_READONLY ? " READONLY" : "" + (long)bfd_section_flags (sec), + bfd_section_flags (sec) & SEC_LOAD ? " LOAD" : "", + bfd_section_flags (sec) & SEC_CODE ? " CODE" : "", + bfd_section_flags (sec) & SEC_DATA ? " DATA" : "", + bfd_section_flags (sec) & SEC_ALLOC ? " ALLOC" : "", + bfd_section_flags (sec) & SEC_READONLY ? " READONLY" : "" )); /* dma in the sections data */ diff --git a/sim/ppc/hw_init.c b/sim/ppc/hw_init.c index 0e7403bb6c5..779c95c5a24 100644 --- a/sim/ppc/hw_init.c +++ b/sim/ppc/hw_init.c @@ -324,39 +324,39 @@ update_for_binary_section(bfd *abfd, device *me = (device*)obj; /* skip the section if no memory to allocate */ - if (! (bfd_get_section_flags(abfd, the_section) & SEC_ALLOC)) + if (! (bfd_section_flags (the_section) & SEC_ALLOC)) return; /* check/ignore any sections of size zero */ - section_size = bfd_get_section_size (the_section); + section_size = bfd_section_size (the_section); if (section_size == 0) return; /* find where it is to go */ - section_vma = bfd_get_section_vma(abfd, the_section); + section_vma = bfd_section_vma (the_section); DTRACE(binary, ("name=%-7s, vma=0x%.8lx, size=%6ld, flags=%3lx(%s%s%s%s%s )\n", - bfd_get_section_name(abfd, the_section), + bfd_section_name (the_section), (long)section_vma, (long)section_size, - (long)bfd_get_section_flags(abfd, the_section), - bfd_get_section_flags(abfd, the_section) & SEC_LOAD ? " LOAD" : "", - bfd_get_section_flags(abfd, the_section) & SEC_CODE ? " CODE" : "", - bfd_get_section_flags(abfd, the_section) & SEC_DATA ? " DATA" : "", - bfd_get_section_flags(abfd, the_section) & SEC_ALLOC ? " ALLOC" : "", - bfd_get_section_flags(abfd, the_section) & SEC_READONLY ? " READONLY" : "" + (long)bfd_section_flags (the_section), + bfd_section_flags (the_section) & SEC_LOAD ? " LOAD" : "", + bfd_section_flags (the_section) & SEC_CODE ? " CODE" : "", + bfd_section_flags (the_section) & SEC_DATA ? " DATA" : "", + bfd_section_flags (the_section) & SEC_ALLOC ? " ALLOC" : "", + bfd_section_flags (the_section) & SEC_READONLY ? " READONLY" : "" )); /* If there is an .interp section, it means it needs a shared library interpreter. */ - if (strcmp(".interp", bfd_get_section_name(abfd, the_section)) == 0) + if (strcmp(".interp", bfd_section_name (the_section)) == 0) error("Shared libraries are not yet supported.\n"); /* determine the devices access */ access = access_read; - if (bfd_get_section_flags(abfd, the_section) & SEC_CODE) + if (bfd_section_flags (the_section) & SEC_CODE) access |= access_exec; - if (!(bfd_get_section_flags(abfd, the_section) & SEC_READONLY)) + if (!(bfd_section_flags (the_section) & SEC_READONLY)) access |= access_write; /* if claim specified, allocate region from the memory device */ @@ -386,7 +386,7 @@ update_for_binary_section(bfd *abfd, me); /* if a load dma in the required data */ - if (bfd_get_section_flags(abfd, the_section) & SEC_LOAD) { + if (bfd_section_flags (the_section) & SEC_LOAD) { void *section_init = zalloc(section_size); if (!bfd_get_section_contents(abfd, the_section, diff --git a/sim/rl78/load.c b/sim/rl78/load.c index c8c8ab89517..34ae923bcb7 100644 --- a/sim/rl78/load.c +++ b/sim/rl78/load.c @@ -56,7 +56,7 @@ find_section_name_by_offset (bfd *abfd, file_ptr filepos) for (s = abfd->sections; s; s = s->next) if (s->filepos == filepos) - return bfd_get_section_name (abfd, s); + return bfd_section_name (s); return "(unknown)"; } diff --git a/sim/rl78/trace.c b/sim/rl78/trace.c index fd999a15134..1a97527377b 100644 --- a/sim/rl78/trace.c +++ b/sim/rl78/trace.c @@ -224,7 +224,7 @@ sim_get_current_source_location (const char ** pfilename, if (s->flags & SEC_CODE || code_section == 0) { code_section = s; - code_base = bfd_section_lma (current_bfd, s); + code_base = bfd_section_lma (s); break; } } diff --git a/sim/rx/gdb-if.c b/sim/rx/gdb-if.c index ef88146a5e9..68e4b96ed63 100644 --- a/sim/rx/gdb-if.c +++ b/sim/rx/gdb-if.c @@ -164,14 +164,14 @@ build_swap_list (struct bfd *abfd) struct swap_list *sl; bfd_size_type size; - size = bfd_get_section_size (s); + size = bfd_section_size (s); if (size <= 0) continue; sl = malloc (sizeof (struct swap_list)); assert (sl != NULL); sl->next = swap_list; - sl->start = bfd_section_lma (abfd, s); + sl->start = bfd_section_lma (s); sl->end = sl->start + size; swap_list = sl; } diff --git a/sim/rx/load.c b/sim/rx/load.c index 65451ca8216..a9b596bbc58 100644 --- a/sim/rx/load.c +++ b/sim/rx/load.c @@ -52,7 +52,7 @@ find_section_name_by_offset (bfd *abfd, file_ptr filepos) for (s = abfd->sections; s; s = s->next) if (s->filepos == filepos) - return bfd_get_section_name (abfd, s); + return bfd_section_name (s); return "(unknown)"; } diff --git a/sim/rx/trace.c b/sim/rx/trace.c index ed65d19a8f9..a4ea680bff8 100644 --- a/sim/rx/trace.c +++ b/sim/rx/trace.c @@ -228,7 +228,7 @@ sim_get_current_source_location (const char ** pfilename, if (s->flags & SEC_CODE || code_section == 0) { code_section = s; - code_base = bfd_section_lma (current_bfd, s); + code_base = bfd_section_lma (s); break; } } |