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 /bfd | |
parent | 5dfda3562a69686c43aad4fb0269cc9d5ec010d5 (diff) | |
download | gdb-fd3619828e94a24a92cddec42cbc0ab33352eeb4.zip gdb-fd3619828e94a24a92cddec42cbc0ab33352eeb4.tar.gz gdb-fd3619828e94a24a92cddec42cbc0ab33352eeb4.tar.bz2 |
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.
Diffstat (limited to 'bfd')
104 files changed, 740 insertions, 791 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 63f6c4c..8fff6a6 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 859153b..8923ca7 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 5a30344..e55e3e9 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 6542d40..425f0c6 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, @@ -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 ee4a3ee..d36921b 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 5237bfb..cbc5257 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 a2dd9e1..c6fe679 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 1c80a9d..091da1f 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 dd3189f..948bb70 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 80a9a2a..ba7bb5e 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 7bcc1ca..2115e9c 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 32de099..8f96d06 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 c06fa5e..30adba0 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 6919ac3..c2cb77b 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 cc98cae..2035d4c9c 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 89054e4..58948e3 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 cfccb96..b234c16 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 acc3c54..30828f1 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 198eece..199e617 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 ef8abeb..d7cd7e6 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 a7f574c..8fe17bf 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: @@ -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 493f32d..91537ef 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 e29a60a..1c4887a 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 e75ac9f..f04cc94 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 d73bfda..6efee04 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 7d0a0e5..72642e5 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 9a2fda0..35bacbb 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 5d23056..9c07b6d 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 306a0e4..6d15b2b 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 b3451b6..16897b3 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 a03ce63..bd07ad6 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 4bd417d..c45f0b3 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 6a13767..0d299c6 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 8c6a97d..7770687 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 d673724..b8e69e5 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 a2f06d5..ba7c8b2 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 a61adbc..f065449 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 d7a61d7..9248ef5 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 43e7be6..6e5131f 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 6e47027..e95f1a5 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 5233dbb..0601f14 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 b12c788..e3f03cc 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 2f182e7..edd04b9 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 6a99678..8739ca8 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 177be5d..559578d 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 7bca458..3a58ff3 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 414e6f3..f46e3bc 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 f68f9dc..e3df8c5 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 8d1700b..c187d83 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 9834d89..9b6048f 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 fe5fd8f..4dcc8d4 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 ca6aa13..d120d05 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 27ffea2..013355a 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 5d787eb..698e4e5 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 0d1336c..4cf0b7c 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 5e5834a..9765a33 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 d9be74f..054f165 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 8fa7ea3..ba95515 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 e130784..7978244 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 7bdccdb..7e22d96 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 1bbf64f..3d499ca 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 51a5fb1..e625435 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 91900b8..c572f70 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 f66e37c..e75d999 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 87ec847..258349c 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 832561d..249b3aa 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 74e1546..21df3c8 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 2af7050..80162d8 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 76271ce..35e4b84 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 05a9326..ef106b3 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 8a7bf7e..306b18b 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 4908601..84ec83b 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 3e11f08..67c45a1 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 7781158..25e91d8 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 0ae9f35..aa2aa11 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 18ed456..69d57a2 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 345710e..14119dd 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 6bc6dfd..4ffcde9 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 50b051a..8bf9623 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 e5c8003..16e66f9 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 8f18be0..2169e2b 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 7132b6b..6f3bd0d 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 65471dd..da10178 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 1d04ae9..ccf904a 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 1f69280..e7290aa 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 8ad5268..496e42e 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 e479884..735e83f 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 2149fbc..41af167 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 634f911..d8165d1 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 9c4ab4c..18f332f 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 2518371..143b8eb 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 7d70087..117e410 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; } @@ -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 d14dfe9..b537dfd 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 238f514..a0c3ac0 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 2588e6c..c0b9735 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 679474e..1e2b104 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 8eac73d..0c67ecd 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 74feb73..3a9cb26 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; @@ -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 8d2a2df..4dde056 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 1a2f87c..5269172 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 |