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.
This commit is contained in:
Alan Modra 2019-09-16 20:25:17 +09:30
parent 5dfda3562a
commit fd3619828e
305 changed files with 1915 additions and 1994 deletions

View File

@ -1,3 +1,48 @@
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> 2019-09-18 Alan Modra <amodra@gmail.com>
* bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section. * bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section.

View File

@ -3108,18 +3108,18 @@ aout_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
break; break;
case N_TEXT | N_EXT: case N_TEXT | N_EXT:
section = obj_textsec (abfd); section = obj_textsec (abfd);
value -= bfd_get_section_vma (abfd, section); value -= bfd_section_vma (section);
break; break;
case N_DATA | N_EXT: case N_DATA | N_EXT:
case N_SETV | N_EXT: case N_SETV | N_EXT:
/* Treat N_SETV symbols as N_DATA symbol; see comment in /* Treat N_SETV symbols as N_DATA symbol; see comment in
translate_from_native_sym_flags. */ translate_from_native_sym_flags. */
section = obj_datasec (abfd); section = obj_datasec (abfd);
value -= bfd_get_section_vma (abfd, section); value -= bfd_section_vma (section);
break; break;
case N_BSS | N_EXT: case N_BSS | N_EXT:
section = obj_bsssec (abfd); section = obj_bsssec (abfd);
value -= bfd_get_section_vma (abfd, section); value -= bfd_section_vma (section);
break; break;
case N_INDR | N_EXT: case N_INDR | N_EXT:
/* An indirect symbol. The next symbol is the symbol /* 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: case N_SETT: case N_SETT | N_EXT:
section = obj_textsec (abfd); section = obj_textsec (abfd);
flags |= BSF_CONSTRUCTOR; flags |= BSF_CONSTRUCTOR;
value -= bfd_get_section_vma (abfd, section); value -= bfd_section_vma (section);
break; break;
case N_SETD: case N_SETD | N_EXT: case N_SETD: case N_SETD | N_EXT:
section = obj_datasec (abfd); section = obj_datasec (abfd);
flags |= BSF_CONSTRUCTOR; flags |= BSF_CONSTRUCTOR;
value -= bfd_get_section_vma (abfd, section); value -= bfd_section_vma (section);
break; break;
case N_SETB: case N_SETB | N_EXT: case N_SETB: case N_SETB | N_EXT:
section = obj_bsssec (abfd); section = obj_bsssec (abfd);
flags |= BSF_CONSTRUCTOR; flags |= BSF_CONSTRUCTOR;
value -= bfd_get_section_vma (abfd, section); value -= bfd_section_vma (section);
break; break;
case N_WARNING: case N_WARNING:
/* A warning symbol. The next symbol is the one to warn /* 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; break;
case N_WEAKT: case N_WEAKT:
section = obj_textsec (abfd); section = obj_textsec (abfd);
value -= bfd_get_section_vma (abfd, section); value -= bfd_section_vma (section);
flags = BSF_WEAK; flags = BSF_WEAK;
break; break;
case N_WEAKD: case N_WEAKD:
section = obj_datasec (abfd); section = obj_datasec (abfd);
value -= bfd_get_section_vma (abfd, section); value -= bfd_section_vma (section);
flags = BSF_WEAK; flags = BSF_WEAK;
break; break;
case N_WEAKB: case N_WEAKB:
section = obj_bsssec (abfd); section = obj_bsssec (abfd);
value -= bfd_get_section_vma (abfd, section); value -= bfd_section_vma (section);
flags = BSF_WEAK; flags = BSF_WEAK;
break; break;
} }
@ -3899,8 +3899,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo,
(*flaginfo->info->callbacks->reloc_overflow) (*flaginfo->info->callbacks->reloc_overflow)
(flaginfo->info, NULL, (flaginfo->info, NULL,
(p->type == bfd_section_reloc_link_order (p->type == bfd_section_reloc_link_order
? bfd_section_name (flaginfo->output_bfd, ? bfd_section_name (pr->u.section)
pr->u.section)
: pr->u.name), : pr->u.name),
howto->name, pr->addend, NULL, NULL, (bfd_vma) 0); howto->name, pr->addend, NULL, NULL, (bfd_vma) 0);
break; break;
@ -4314,7 +4313,7 @@ aout_link_input_section_std (struct aout_final_link_info *flaginfo,
asection *s; asection *s;
s = aout_reloc_index_to_section (input_bfd, r_index); 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->callbacks->reloc_overflow)
(flaginfo->info, (h ? &h->root : NULL), name, howto->name, (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; asection *s;
s = aout_reloc_index_to_section (input_bfd, r_index); 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->callbacks->reloc_overflow)
(flaginfo->info, (h ? &h->root : NULL), name, (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; return FALSE;
PUT_WORD (output_bfd, strtab_index, outsym->e_strx); PUT_WORD (output_bfd, strtab_index, outsym->e_strx);
PUT_WORD (output_bfd, PUT_WORD (output_bfd,
(bfd_get_section_vma (output_bfd, (bfd_section_vma (obj_textsec (input_bfd)->output_section)
obj_textsec (input_bfd)->output_section)
+ obj_textsec (input_bfd)->output_offset), + obj_textsec (input_bfd)->output_offset),
outsym->e_value); outsym->e_value);
++obj_aout_external_sym_count (output_bfd); ++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) BFD_ASSERT (bfd_is_abs_section (output_section)
|| output_section->owner == output_bfd); || output_section->owner == output_bfd);
val = (hresolve->root.u.def.value val = (hresolve->root.u.def.value
+ bfd_get_section_vma (output_bfd, output_section) + bfd_section_vma (output_section)
+ input_section->output_offset); + input_section->output_offset);
/* Get the correct type based on the section. If /* Get the correct type based on the section. If

View File

@ -299,21 +299,15 @@ typedef struct bfd_section *sec_ptr;
? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
: ~ (bfd_vma) 0) : ~ (bfd_vma) 0)
#define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name) #define bfd_section_name(sec) ((sec)->name)
#define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma) #define bfd_section_size(sec) ((sec)->size)
#define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma) #define bfd_section_vma(sec) ((sec)->vma)
#define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \ #define bfd_section_lma(sec) ((sec)->lma)
(ptr)->alignment_power) #define bfd_section_alignment(sec) ((sec)->alignment_power)
#define bfd_section_name(bfd, ptr) ((ptr)->name) #define bfd_section_flags(sec) ((sec)->flags)
#define bfd_section_size(bfd, ptr) ((ptr)->size) #define bfd_section_userdata(sec) ((sec)->userdata)
#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_is_com_section(sec) (((sec)->flags & SEC_IS_COMMON) != 0)
#define bfd_get_section_limit_octets(bfd, sec) \ #define bfd_get_section_limit_octets(bfd, sec) \
((bfd)->direction != write_direction && (sec)->rawsize != 0 \ ((bfd)->direction != write_direction && (sec)->rawsize != 0 \

View File

@ -306,21 +306,15 @@ typedef struct bfd_section *sec_ptr;
? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \ ? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
: ~ (bfd_vma) 0) : ~ (bfd_vma) 0)
#define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name) #define bfd_section_name(sec) ((sec)->name)
#define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma) #define bfd_section_size(sec) ((sec)->size)
#define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma) #define bfd_section_vma(sec) ((sec)->vma)
#define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \ #define bfd_section_lma(sec) ((sec)->lma)
(ptr)->alignment_power) #define bfd_section_alignment(sec) ((sec)->alignment_power)
#define bfd_section_name(bfd, ptr) ((ptr)->name) #define bfd_section_flags(sec) ((sec)->flags)
#define bfd_section_size(bfd, ptr) ((ptr)->size) #define bfd_section_userdata(sec) ((sec)->userdata)
#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_is_com_section(sec) (((sec)->flags & SEC_IS_COMMON) != 0)
#define bfd_get_section_limit_octets(bfd, sec) \ #define bfd_get_section_limit_octets(bfd, sec) \
((bfd)->direction != write_direction && (sec)->rawsize != 0 \ ((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 would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
compilers will complain about comma expressions that have no effect. */ compilers will complain about comma expressions that have no effect. */
static inline bfd_boolean static inline bfd_boolean
bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_set_section_userdata (asection *sec, void *val)
void * val)
{ {
ptr->userdata = val; sec->userdata = val;
return TRUE; return TRUE;
} }
static inline bfd_boolean 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; sec->vma = sec->lma = val;
ptr->user_set_vma = TRUE; sec->user_set_vma = TRUE;
return TRUE; return TRUE;
} }
static inline bfd_boolean static inline bfd_boolean
bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_set_section_lma (asection *sec, bfd_vma val)
unsigned int 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; return TRUE;
} }
@ -1963,11 +1962,10 @@ asection *bfd_make_section_with_flags
asection *bfd_make_section (bfd *, const char *name); asection *bfd_make_section (bfd *, const char *name);
bfd_boolean bfd_set_section_flags bfd_boolean bfd_set_section_flags (asection *sec, flagword flags);
(bfd *abfd, asection *sec, flagword flags);
void bfd_rename_section void bfd_rename_section
(bfd *abfd, asection *sec, const char *newname); (asection *sec, const char *newname);
void bfd_map_over_sections void bfd_map_over_sections
(bfd *abfd, (bfd *abfd,
@ -1979,8 +1977,7 @@ asection *bfd_sections_find_if
bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj), bfd_boolean (*operation) (bfd *abfd, asection *sect, void *obj),
void *obj); void *obj);
bfd_boolean bfd_set_section_size bfd_boolean bfd_set_section_size (asection *sec, bfd_size_type val);
(bfd *abfd, asection *sec, bfd_size_type val);
bfd_boolean bfd_set_section_contents bfd_boolean bfd_set_section_contents
(bfd *abfd, asection *section, const void *data, (bfd *abfd, asection *section, const void *data,

View File

@ -2342,7 +2342,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
bfd_put_32 (abfd, 1 << sec->alignment_power, bfd_put_32 (abfd, 1 << sec->alignment_power,
&echdr->ch_addralign); &echdr->ch_addralign);
/* bfd_log2 (alignof (Elf32_Chdr)) */ /* bfd_log2 (alignof (Elf32_Chdr)) */
bfd_set_section_alignment (abfd, sec, 2); bfd_set_section_alignment (sec, 2);
} }
else else
{ {
@ -2354,7 +2354,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
bfd_put_64 (abfd, 1 << sec->alignment_power, bfd_put_64 (abfd, 1 << sec->alignment_power,
&echdr->ch_addralign); &echdr->ch_addralign);
/* bfd_log2 (alignof (Elf64_Chdr)) */ /* bfd_log2 (alignof (Elf64_Chdr)) */
bfd_set_section_alignment (abfd, sec, 3); bfd_set_section_alignment (sec, 3);
} }
} }
else else
@ -2368,7 +2368,7 @@ bfd_update_compression_header (bfd *abfd, bfd_byte *contents,
memcpy (contents, "ZLIB", 4); memcpy (contents, "ZLIB", 4);
bfd_putb64 (sec->size, contents + 4); bfd_putb64 (sec->size, contents + 4);
/* No way to keep the original alignment, just use 1 always. */ /* 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; 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) if (!use_memmove)
{ {
contents = (bfd_byte *) bfd_malloc (size); contents = (bfd_byte *) bfd_malloc (size);

View File

@ -426,7 +426,7 @@ alpha_ecoff_object_p (bfd *abfd)
size = sec->line_filepos * 8; size = sec->line_filepos * 8;
BFD_ASSERT (size == sec->size BFD_ASSERT (size == sec->size
|| size + 8 == sec->size); || size + 8 == sec->size);
if (! bfd_set_section_size (abfd, sec, size)) if (!bfd_set_section_size (sec, size))
return NULL; return NULL;
} }
} }
@ -1237,7 +1237,7 @@ alpha_convert_external_reloc (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Compute a new r_symndx value. */ /* Compute a new r_symndx value. */
hsec = h->root.u.def.section; 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; r_symndx = (unsigned long) -1;
switch (name[1]) switch (name[1])
@ -1928,8 +1928,7 @@ alpha_relocate_section (bfd *output_bfd,
if (r_extern) if (r_extern)
name = sym_hashes[r_symndx]->root.root.string; name = sym_hashes[r_symndx]->root.root.string;
else else
name = bfd_section_name (input_bfd, name = bfd_section_name (symndx_to_section[r_symndx]);
symndx_to_section[r_symndx]);
(*info->callbacks->reloc_overflow) (*info->callbacks->reloc_overflow)
(info, NULL, name, alpha_howto_table[r_type].name, (info, NULL, name, alpha_howto_table[r_type].name,
(bfd_vma) 0, input_bfd, input_section, (bfd_vma) 0, input_bfd, input_section,

View File

@ -1989,7 +1989,7 @@ bfd_arm_get_bfd_for_interworking (bfd * abfd,
sec = bfd_make_section_with_flags (abfd, ARM2THUMB_GLUE_SECTION_NAME, sec = bfd_make_section_with_flags (abfd, ARM2THUMB_GLUE_SECTION_NAME,
flags); flags);
if (sec == NULL if (sec == NULL
|| ! bfd_set_section_alignment (abfd, sec, 2)) || !bfd_set_section_alignment (sec, 2))
return FALSE; return FALSE;
} }
@ -2003,7 +2003,7 @@ bfd_arm_get_bfd_for_interworking (bfd * abfd,
flags); flags);
if (sec == NULL if (sec == NULL
|| ! bfd_set_section_alignment (abfd, sec, 2)) || !bfd_set_section_alignment (sec, 2))
return FALSE; return FALSE;
} }

View File

@ -1012,8 +1012,7 @@ mips_relocate_section (bfd *output_bfd,
/* Compute a new r_symndx value. */ /* Compute a new r_symndx value. */
s = h->root.u.def.section; s = h->root.u.def.section;
name = bfd_get_section_name (output_bfd, name = bfd_section_name (s->output_section);
s->output_section);
int_rel.r_symndx = -1; int_rel.r_symndx = -1;
switch (name[1]) switch (name[1])
@ -1223,7 +1222,7 @@ mips_relocate_section (bfd *output_bfd,
if (int_rel.r_extern) if (int_rel.r_extern)
name = NULL; name = NULL;
else else
name = bfd_section_name (input_bfd, s); name = bfd_section_name (s);
(*info->callbacks->reloc_overflow) (*info->callbacks->reloc_overflow)
(info, (h ? &h->root : NULL), name, howto->name, (info, (h ? &h->root : NULL), name, howto->name,
(bfd_vma) 0, input_bfd, input_section, (bfd_vma) 0, input_bfd, input_section,

View File

@ -959,7 +959,7 @@ xcoff64_write_object_contents (bfd *abfd)
if (text_sec != NULL) if (text_sec != NULL)
{ {
internal_a.o_sntext = text_sec->target_index; 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 else
{ {
@ -970,7 +970,7 @@ xcoff64_write_object_contents (bfd *abfd)
if (data_sec != NULL) if (data_sec != NULL)
{ {
internal_a.o_sndata = data_sec->target_index; 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 else
{ {

View File

@ -1696,7 +1696,7 @@ coff_set_custom_section_alignment (bfd *abfd ATTRIBUTE_UNUSED,
for (i = 0; i < table_size; ++i) 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 if (alignment_table[i].comparison_length == (unsigned int) -1
? strcmp (alignment_table[i].name, secname) == 0 ? strcmp (alignment_table[i].name, secname) == 0
@ -1759,17 +1759,17 @@ coff_new_section_hook (bfd * abfd, asection * section)
#ifdef RS6000COFF_C #ifdef RS6000COFF_C
if (bfd_xcoff_text_align_power (abfd) != 0 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); section->alignment_power = bfd_xcoff_text_align_power (abfd);
else if (bfd_xcoff_data_align_power (abfd) != 0 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); section->alignment_power = bfd_xcoff_data_align_power (abfd);
else else
{ {
int i; int i;
for (i = 0; i < XCOFF_DWSECT_NBR_NAMES; 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) xcoff_dwsect_names[i].name) == 0)
{ {
section->alignment_power = 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 incremented in coff_set_section_contents. This is right for
SVR3.2. */ SVR3.2. */
if (strcmp (current->name, _LIB) == 0) if (strcmp (current->name, _LIB) == 0)
(void) bfd_set_section_vma (abfd, current, 0); bfd_set_section_vma (current, 0);
#endif #endif
#ifdef ALIGN_SECTIONS_IN_FILE #ifdef ALIGN_SECTIONS_IN_FILE
@ -4011,7 +4011,7 @@ coff_write_object_contents (bfd * abfd)
if (text_sec != NULL) if (text_sec != NULL)
{ {
internal_a.o_sntext = text_sec->target_index; 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 else
{ {
@ -4021,7 +4021,7 @@ coff_write_object_contents (bfd * abfd)
if (data_sec != NULL) if (data_sec != NULL)
{ {
internal_a.o_sndata = data_sec->target_index; 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 else
{ {
@ -4390,8 +4390,7 @@ coff_slurp_line_table (bfd *abfd, asection *asect)
PR 17521: file: 078-10659-0.004. */ PR 17521: file: 078-10659-0.004. */
continue; continue;
else else
cache_ptr->u.offset = (dst.l_addr.l_paddr cache_ptr->u.offset = dst.l_addr.l_paddr - bfd_section_vma (asect);
- bfd_section_vma (abfd, asect));
cache_ptr++; cache_ptr++;
} }
@ -4886,7 +4885,7 @@ coff_classify_symbol (bfd *abfd,
name = _bfd_coff_internal_syment_name (abfd, syment, buf) name = _bfd_coff_internal_syment_name (abfd, syment, buf)
sec = coff_section_from_bfd_index (abfd, syment->n_scnum); sec = coff_section_from_bfd_index (abfd, syment->n_scnum);
if (sec != NULL && name != NULL 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; return COFF_SYMBOL_PE_SECTION;
} }
#endif #endif

View File

@ -217,7 +217,7 @@ make_a_section_from_file (bfd *abfd,
break; break;
} }
if (new_name != NULL) if (new_name != NULL)
bfd_rename_section (abfd, return_section, new_name); bfd_rename_section (return_section, new_name);
} }
return result; return result;
@ -2366,7 +2366,7 @@ coff_find_nearest_line_with_names (bfd *abfd,
bfd_vma maxdiff; bfd_vma maxdiff;
/* Look through the C_FILE symbols to find the best one. */ /* 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; *filename_ptr = (char *) p->u.syment._n._n_n._n_offset;
maxdiff = (bfd_vma) 0 - (bfd_vma) 1; maxdiff = (bfd_vma) 0 - (bfd_vma) 1;
while (1) while (1)
@ -2658,7 +2658,7 @@ _bfd_coff_section_already_linked (bfd *abfd,
if ((flags & SEC_GROUP) != 0) if ((flags & SEC_GROUP) != 0)
return FALSE; return FALSE;
name = bfd_get_section_name (abfd, sec); name = bfd_section_name (sec);
s_comdat = bfd_coff_get_comdat_section (abfd, sec); s_comdat = bfd_coff_get_comdat_section (abfd, sec);
if (s_comdat != NULL) if (s_comdat != NULL)

View File

@ -2846,8 +2846,7 @@ _bfd_coff_reloc_link_order (bfd *output_bfd,
(*flaginfo->info->callbacks->reloc_overflow) (*flaginfo->info->callbacks->reloc_overflow)
(flaginfo->info, NULL, (flaginfo->info, NULL,
(link_order->type == bfd_section_reloc_link_order (link_order->type == bfd_section_reloc_link_order
? bfd_section_name (output_bfd, ? bfd_section_name (link_order->u.reloc.p->u.section)
link_order->u.reloc.p->u.section)
: link_order->u.reloc.p->u.name), : link_order->u.reloc.p->u.name),
howto->name, link_order->u.reloc.p->addend, howto->name, link_order->u.reloc.p->addend,
(bfd *) NULL, (asection *) NULL, (bfd_vma) 0); (bfd *) NULL, (asection *) NULL, (bfd_vma) 0);

View File

@ -155,8 +155,7 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec,
return 0; return 0;
} }
free (uncompressed_buffer); free (uncompressed_buffer);
bfd_set_section_alignment (abfd, sec, bfd_set_section_alignment (sec, orig_uncompressed_alignment_pow);
orig_uncompressed_alignment_pow);
sec->contents = buffer; sec->contents = buffer;
sec->compress_status = COMPRESS_SECTION_DONE; 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 && filesize < sz
/* PR 24753: Linker created sections can be larger than /* PR 24753: Linker created sections can be larger than
the file size, eg if they are being used to hold stubs. */ 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 /* The MMO file format supports its own special compression
technique, but it uses COMPRESS_SECTION_NONE when loading technique, but it uses COMPRESS_SECTION_NONE when loading
a section's contents. */ a section's contents. */
@ -552,7 +551,7 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec)
sec->compressed_size = sec->size; sec->compressed_size = sec->size;
sec->size = uncompressed_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; sec->compress_status = DECOMPRESS_SECTION_SIZED;
return TRUE; return TRUE;

View File

@ -1676,10 +1676,10 @@ ecoff_slurp_reloc_table (bfd *abfd,
abort (); abort ();
rptr->sym_ptr_ptr = sec->symbol_ptr_ptr; 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 /* Let the backend select the howto field and do any other
required processing. */ required processing. */
@ -2431,7 +2431,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
strncpy (section.s_name, current->name, sizeof section.s_name); strncpy (section.s_name, current->name, sizeof section.s_name);
/* This seems to be correct for Irix 4 shared libraries. */ /* 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)) if (streq (current->name, _LIB))
section.s_vaddr = 0; section.s_vaddr = 0;
else else
@ -2682,8 +2682,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
if (reloc->howto == NULL) if (reloc->howto == NULL)
continue; continue;
in.r_vaddr = (reloc->address in.r_vaddr = reloc->address + bfd_section_vma (current);
+ bfd_get_section_vma (abfd, current));
in.r_type = reloc->howto->type; in.r_type = reloc->howto->type;
if ((sym->flags & BSF_SECTION_SYM) == 0) if ((sym->flags & BSF_SECTION_SYM) == 0)
@ -2719,7 +2718,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd)
{ _RCONST, RELOC_SECTION_RCONST } { _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++) for (j = 0; j < ARRAY_SIZE (section_symndx); j++)
if (streq (name, section_symndx[j].name)) if (streq (name, section_symndx[j].name))
@ -4010,7 +4009,7 @@ ecoff_reloc_link_order (bfd *output_bfd,
(*info->callbacks->reloc_overflow) (*info->callbacks->reloc_overflow)
(info, NULL, (info, NULL,
(link_order->type == bfd_section_reloc_link_order (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), : link_order->u.reloc.p->u.name),
rel.howto->name, addend, NULL, NULL, (bfd_vma) 0); rel.howto->name, addend, NULL, NULL, (bfd_vma) 0);
break; break;
@ -4025,8 +4024,7 @@ ecoff_reloc_link_order (bfd *output_bfd,
rel.addend = 0; rel.addend = 0;
/* Move the information into an internal_reloc structure. */ /* Move the information into an internal_reloc structure. */
in.r_vaddr = (rel.address in.r_vaddr = rel.address + bfd_section_vma (output_section);
+ bfd_get_section_vma (output_bfd, output_section));
in.r_type = rel.howto->type; in.r_type = rel.howto->type;
if (type == bfd_symbol_reloc_link_order) if (type == bfd_symbol_reloc_link_order)
@ -4076,7 +4074,7 @@ ecoff_reloc_link_order (bfd *output_bfd,
{ _RCONST, RELOC_SECTION_RCONST } { _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++) for (i = 0; i < ARRAY_SIZE (section_symndx); i++)
if (streq (name, section_symndx[i].name)) 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; 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++) for (i = 0; i < ARRAY_SIZE (section_storage_classes); i++)
if (streq (name, section_storage_classes[i].name)) if (streq (name, section_storage_classes[i].name))

View File

@ -1109,7 +1109,7 @@ add_eh_frame_hdr_terminator (asection *sec,
if (!sec->rawsize) if (!sec->rawsize)
sec->rawsize = sec->size; 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. */ /* 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) 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") if (strcmp (name, ".eh_frame_entry")
&& !bfd_is_abs_section (o->output_section)) && !bfd_is_abs_section (o->output_section))

View File

@ -881,7 +881,7 @@ elf_hppa_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
{ {
const char *name; const char *name;
name = bfd_get_section_name (abfd, sec); name = bfd_section_name (sec);
if (strcmp (name, ".PARISC.unwind") == 0) if (strcmp (name, ".PARISC.unwind") == 0)
{ {

View File

@ -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, s = bfd_make_section_with_flags (abfd, rel_sec,
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->irelifunc = s; htab->irelifunc = s;
} }
@ -73,7 +72,7 @@ _bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info)
for static executables. */ for static executables. */
s = bfd_make_section_with_flags (abfd, ".iplt", pltflags); s = bfd_make_section_with_flags (abfd, ".iplt", pltflags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
htab->iplt = s; htab->iplt = s;
@ -82,8 +81,7 @@ _bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info)
? ".rela.iplt" : ".rel.iplt"), ? ".rela.iplt" : ".rel.iplt"),
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->irelplt = s; htab->irelplt = s;
@ -94,8 +92,7 @@ _bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info)
else else
s = bfd_make_section_with_flags (abfd, ".igot", flags); s = bfd_make_section_with_flags (abfd, ".igot", flags);
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->igotplt = s; htab->igotplt = s;
} }

View File

@ -413,7 +413,7 @@ mn10200_elf_relocate_section (bfd *output_bfd,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (r) switch (r)

View File

@ -725,7 +725,7 @@ _bfd_mn10300_elf_create_got_section (bfd * abfd,
s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags); s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
htab->splt = s; htab->splt = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
/* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the /* 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); s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
htab->sgot = s; htab->sgot = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
if (bed->want_got_plt) 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); s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
htab->sgotplt = s; htab->sgotplt = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
} }
@ -2125,7 +2125,7 @@ mn10300_elf_relocate_section (bfd *output_bfd,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (r) switch (r)
@ -4821,7 +4821,7 @@ _bfd_mn10300_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
flags | SEC_READONLY); flags | SEC_READONLY);
htab->root.srelplt = s; htab->root.srelplt = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
if (! _bfd_mn10300_elf_create_got_section (abfd, info)) 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"), ? ".rela.bss" : ".rel.bss"),
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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")) 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 entry. The entries in the .rela.plt section
really apply to the .got section, which we really apply to the .got section, which we
created ourselves and so know is not readonly. */ created ourselves and so know is not readonly. */
outname = bfd_get_section_name (output_bfd, outname = bfd_section_name (s->output_section);
s->output_section);
target = bfd_get_section_by_name (output_bfd, outname + 5); target = bfd_get_section_by_name (output_bfd, outname + 5);
if (target != NULL if (target != NULL
&& (target->flags & SEC_READONLY) != 0 && (target->flags & SEC_READONLY) != 0

View File

@ -695,12 +695,12 @@ _bfd_elf_convert_gnu_properties (bfd *ibfd, asection *isec,
align_shift = bed->s->elfclass == ELFCLASS64 ? 3 : 2; align_shift = bed->s->elfclass == ELFCLASS64 ? 3 : 2;
/* Get the output .note.gnu.property section size. */ /* 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. */ /* 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); contents = (bfd_byte *) bfd_malloc (size);
free (*ptr); free (*ptr);

View File

@ -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", s = bfd_make_section_with_flags (abfd, ".rela.ifunc",
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->irelifunc = s; 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", s = bfd_make_section_with_flags (abfd, ".iplt",
flags | SEC_CODE | SEC_READONLY); flags | SEC_CODE | SEC_READONLY);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
htab->iplt = s; htab->iplt = s;
s = bfd_make_section_with_flags (abfd, ".rela.iplt", flags | SEC_READONLY); s = bfd_make_section_with_flags (abfd, ".rela.iplt", flags | SEC_READONLY);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->irelplt = s; htab->irelplt = s;
s = bfd_make_section_with_flags (abfd, ".igot.plt", flags); s = bfd_make_section_with_flags (abfd, ".igot.plt", flags);
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->igotplt = s; htab->igotplt = s;

View File

@ -97,7 +97,7 @@ elf_vxworks_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info,
| SEC_READONLY | SEC_READONLY
| SEC_LINKER_CREATED); | SEC_LINKER_CREATED);
if (s == NULL 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; return FALSE;
*srelplt2_out = s; *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: case DT_VX_WRS_TLS_DATA_ALIGN:
sec = bfd_get_section_by_name (output_bfd, ".tls_data"); sec = bfd_get_section_by_name (output_bfd, ".tls_data");
dyn->d_un.d_val dyn->d_un.d_val = (bfd_size_type) 1 << bfd_section_alignment (sec);
= (bfd_size_type)1 << bfd_get_section_alignment (output_bfd,
sec);
break; break;
case DT_VX_WRS_TLS_VARS_START: case DT_VX_WRS_TLS_VARS_START:

View File

@ -547,7 +547,7 @@ bfd_elf_sym_name (bfd *abfd,
if (name == NULL) if (name == NULL)
name = "(null)"; name = "(null)";
else if (sym_sec && *name == '\0') else if (sym_sec && *name == '\0')
name = bfd_section_name (abfd, sym_sec); name = bfd_section_name (sym_sec);
return name; return name;
} }
@ -1049,10 +1049,9 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
newsect->filepos = hdr->sh_offset; newsect->filepos = hdr->sh_offset;
if (! bfd_set_section_vma (abfd, newsect, hdr->sh_addr) if (!bfd_set_section_vma (newsect, hdr->sh_addr)
|| ! bfd_set_section_size (abfd, newsect, hdr->sh_size) || !bfd_set_section_size (newsect, hdr->sh_size)
|| ! bfd_set_section_alignment (abfd, newsect, || !bfd_set_section_alignment (newsect, bfd_log2 (hdr->sh_addralign)))
bfd_log2 (hdr->sh_addralign)))
return FALSE; return FALSE;
flags = SEC_NO_FLAGS; flags = SEC_NO_FLAGS;
@ -1142,7 +1141,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
if (! bed->elf_backend_section_flags (&flags, hdr)) if (! bed->elf_backend_section_flags (&flags, hdr))
return FALSE; return FALSE;
if (! bfd_set_section_flags (abfd, newsect, flags)) if (!bfd_set_section_flags (newsect, flags))
return FALSE; return FALSE;
/* We do not parse the PT_NOTE segments as we are interested even in the /* 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); char *new_name = convert_zdebug_to_debug (abfd, name);
if (new_name == NULL) if (new_name == NULL)
return FALSE; return FALSE;
bfd_rename_section (abfd, newsect, new_name); bfd_rename_section (newsect, new_name);
} }
} }
else else
@ -5542,7 +5541,7 @@ assign_file_positions_for_load_sections (bfd *abfd,
{ {
unsigned int secalign; unsigned int secalign;
secalign = bfd_get_section_alignment (abfd, *secpp); secalign = bfd_section_alignment (*secpp);
if (secalign > align_power) if (secalign > align_power)
align_power = secalign; align_power = secalign;
} }
@ -5696,7 +5695,7 @@ assign_file_positions_for_load_sections (bfd *abfd,
sec = *secpp; sec = *secpp;
this_hdr = &elf_section_data (sec)->this_hdr; 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 if ((p->p_type == PT_LOAD
|| p->p_type == PT_TLS) || p->p_type == PT_TLS)
@ -6835,8 +6834,7 @@ rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
|| (segment->p_paddr \ || (segment->p_paddr \
? segment->p_paddr != section->lma \ ? segment->p_paddr != section->lma \
: segment->p_vaddr != section->vma) \ : segment->p_vaddr != section->vma) \
|| (strcmp (bfd_get_section_name (ibfd, section), ".dynamic") \ || (strcmp (bfd_section_name (section), ".dynamic") == 0)) \
== 0)) \
&& (segment->p_type != PT_LOAD || !section->segment_mark)) && (segment->p_type != PT_LOAD || !section->segment_mark))
/* If the output section of a section in the input segment is NULL, /* If the output section of a section in the input segment is NULL,

View File

@ -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) 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))
== (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
only_data_sections = FALSE; only_data_sections = FALSE;

View File

@ -3817,7 +3817,8 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
htab->srofixup = bfd_make_section_with_flags (dynobj, ".rofixup", htab->srofixup = bfd_make_section_with_flags (dynobj, ".rofixup",
(SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
| SEC_IN_MEMORY | SEC_LINKER_CREATED | SEC_READONLY)); | 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; return FALSE;
} }
@ -3845,7 +3846,7 @@ create_ifunc_sections (struct bfd_link_info *info)
s = bfd_make_section_anyway_with_flags (dynobj, ".iplt", s = bfd_make_section_anyway_with_flags (dynobj, ".iplt",
flags | SEC_READONLY | SEC_CODE); flags | SEC_READONLY | SEC_CODE);
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (dynobj, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
htab->root.iplt = s; htab->root.iplt = s;
} }
@ -3856,7 +3857,7 @@ create_ifunc_sections (struct bfd_link_info *info)
RELOC_SECTION (htab, ".iplt"), RELOC_SECTION (htab, ".iplt"),
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
htab->root.irelplt = s; 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); s = bfd_make_section_anyway_with_flags (dynobj, ".igot.plt", flags);
if (s == NULL 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; return FALSE;
htab->root.igotplt = s; 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); sec = bfd_make_section_anyway_with_flags (abfd, name, ARM_GLUE_SECTION_FLAGS);
if (sec == NULL if (sec == NULL
|| !bfd_set_section_alignment (abfd, sec, 2)) || !bfd_set_section_alignment (sec, 2))
return FALSE; return FALSE;
/* Set the gc mark to prevent the section from being removed by garbage /* 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 name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
if (r_symndx != STN_UNDEF if (r_symndx != STN_UNDEF
@ -13552,10 +13553,10 @@ adjust_exidx_size(asection *exidx_sec, int adjust)
if (!exidx_sec->rawsize) if (!exidx_sec->rawsize)
exidx_sec->rawsize = exidx_sec->size; 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; out_sec = exidx_sec->output_section;
/* Adjust size of 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. */ /* 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; flagword flags;
flags = bfd_get_section_flags (dynobj, sreloc); flags = bfd_section_flags (sreloc);
flags &= ~(SEC_LOAD | SEC_ALLOC); 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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) if (s == htab->root.splt)
{ {
@ -17951,7 +17952,7 @@ elf32_arm_fake_sections (bfd * abfd, Elf_Internal_Shdr * hdr, asection * sec)
{ {
const char * name; const char * name;
name = bfd_get_section_name (abfd, sec); name = bfd_section_name (sec);
if (is_arm_elf_unwind_section_name (abfd, name)) 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") if (strcmp (sec->name, ".glue_7")
&& strcmp (sec->name, ".glue_7t")) && 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))
== (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
only_data_sections = FALSE; only_data_sections = FALSE;

View File

@ -1465,7 +1465,7 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {
@ -2354,8 +2354,7 @@ avr_property_record_compare (const void *ap, const void *bp)
return (a->offset - b->offset); return (a->offset - b->offset);
if (a->section != b->section) if (a->section != b->section)
return (bfd_get_section_vma (a->section->owner, a->section) return bfd_section_vma (a->section) - bfd_section_vma (b->section);
- bfd_get_section_vma (b->section->owner, b->section));
return (a->type - b->type); 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. */ /* Return true if ADDRESS is within the vma range of SECTION from ABFD. */
static bfd_boolean 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_vma vma;
bfd_size_type size; bfd_size_type size;
vma = bfd_get_section_vma (abfd, section); vma = bfd_section_vma (section);
if (address < vma) if (address < vma)
return FALSE; return FALSE;
@ -3985,7 +3984,7 @@ struct avr_find_section_data
perform any checks, and just returns. */ perform any checks, and just returns. */
static void static void
avr_find_section_for_address (bfd *abfd, avr_find_section_for_address (bfd *abfd ATTRIBUTE_UNUSED,
asection *section, void *data) asection *section, void *data)
{ {
struct avr_find_section_data *fs_data struct avr_find_section_data *fs_data
@ -3996,11 +3995,11 @@ avr_find_section_for_address (bfd *abfd,
return; return;
/* If this section isn't part of the addressable code content, skip it. */ /* If this section isn't part of the addressable code content, skip it. */
if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0 if ((bfd_section_flags (section) & SEC_ALLOC) == 0
&& (bfd_get_section_flags (abfd, section) & SEC_CODE) == 0) && (bfd_section_flags (section) & SEC_CODE) == 0)
return; 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; fs_data->section = section;
} }
@ -4023,7 +4022,7 @@ avr_elf32_load_records_from_section (bfd *abfd, asection *sec)
fs_data.section = NULL; fs_data.section = NULL;
size = bfd_get_section_size (sec); size = bfd_section_size (sec);
contents = bfd_malloc (size); contents = bfd_malloc (size);
bfd_get_section_contents (abfd, sec, contents, 0, size); bfd_get_section_contents (abfd, sec, contents, 0, size);
ptr = contents; ptr = contents;
@ -4126,8 +4125,7 @@ avr_elf32_load_records_from_section (bfd *abfd, asection *sec)
{ {
/* Try to find section and offset from address. */ /* Try to find section and offset from address. */
if (fs_data.section != NULL if (fs_data.section != NULL
&& !avr_is_section_for_address (abfd, fs_data.section, && !avr_is_section_for_address (fs_data.section, address))
address))
fs_data.section = NULL; fs_data.section = NULL;
if (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].section = fs_data.section;
r_list->records [i].offset 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); r_list->records [i].type = *((bfd_byte *) ptr);

View File

@ -1601,7 +1601,7 @@ bfin_relocate_section (bfd * output_bfd,
if (name == NULL) if (name == NULL)
return FALSE; return FALSE;
if (*name == '\0') if (*name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
if (r == bfd_reloc_overflow) if (r == bfd_reloc_overflow)
@ -2560,7 +2560,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {
@ -2778,8 +2778,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
bfd_vma offset; bfd_vma offset;
addend += bfinfdpic_got_section (info)->output_section->vma; addend += bfinfdpic_got_section (info)->output_section->vma;
if ((bfd_get_section_flags (output_bfd, if ((bfd_section_flags (input_section->output_section)
input_section->output_section)
& (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{ {
if (_bfinfdpic_osec_readonly_p (output_bfd, if (_bfinfdpic_osec_readonly_p (output_bfd,
@ -2807,8 +2806,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
picrel); picrel);
} }
} }
else if ((bfd_get_section_flags (output_bfd, else if ((bfd_section_flags (input_section->output_section)
input_section->output_section)
& (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{ {
bfd_vma offset; bfd_vma offset;
@ -2901,8 +2899,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
if (osec) if (osec)
addend += osec->output_section->vma; addend += osec->output_section->vma;
if (IS_FDPIC (input_bfd) if (IS_FDPIC (input_bfd)
&& (bfd_get_section_flags (output_bfd, && (bfd_section_flags (input_section->output_section)
input_section->output_section)
& (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{ {
if (_bfinfdpic_osec_readonly_p (output_bfd, if (_bfinfdpic_osec_readonly_p (output_bfd,
@ -2939,8 +2936,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
} }
else else
{ {
if ((bfd_get_section_flags (output_bfd, if ((bfd_section_flags (input_section->output_section)
input_section->output_section)
& (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{ {
if (_bfinfdpic_osec_readonly_p (output_bfd, 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); s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
elf_hash_table (info)->sgot = s; elf_hash_table (info)->sgot = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
if (bed->want_got_sym) 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", s = bfd_make_section_anyway_with_flags (abfd, ".rel.got",
(flags | SEC_READONLY)); (flags | SEC_READONLY));
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 2)) || !bfd_set_section_alignment (s, 2))
return FALSE; return FALSE;
bfinfdpic_gotrel_section (info) = s; 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", s = bfd_make_section_anyway_with_flags (abfd, ".rofixup",
(flags | SEC_READONLY)); (flags | SEC_READONLY));
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 2)) || !bfd_set_section_alignment (s, 2))
return FALSE; return FALSE;
bfinfdpic_gotfixup_section (info) = s; 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); s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
/* Blackfin-specific: remember it. */ /* Blackfin-specific: remember it. */
bfinfdpic_plt_section (info) = s; 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", s = bfd_make_section_anyway_with_flags (abfd, ".rel.plt",
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
/* Blackfin-specific: remember it. */ /* Blackfin-specific: remember it. */
bfinfdpic_pltrel_section (info) = s; bfinfdpic_pltrel_section (info) = s;
@ -3355,7 +3351,7 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
".rela.bss", ".rela.bss",
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
} }
} }
@ -4616,7 +4612,7 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_BFIN_FUNCDESC_VALUE: case R_BFIN_FUNCDESC_VALUE:
picrel->relocsfdv++; picrel->relocsfdv++;
if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) if (bfd_section_flags (sec) & SEC_ALLOC)
picrel->relocs32--; picrel->relocs32--;
/* Fall through. */ /* Fall through. */
@ -4625,7 +4621,7 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info,
break; break;
picrel->sym++; picrel->sym++;
if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) if (bfd_section_flags (sec) & SEC_ALLOC)
picrel->relocs32++; picrel->relocs32++;
break; break;
@ -5064,9 +5060,9 @@ bfin_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Apply the required alignment. */ /* Apply the required alignment. */
s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); 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; 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ of the dynobj section names depend upon the input files. */
name = bfd_get_section_name (dynobj, s); name = bfd_section_name (s);
strip = FALSE; strip = FALSE;

View File

@ -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); s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
htab->sgot= s; htab->sgot= s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
if (bed->want_got_plt) 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); s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
htab->sgotplt = s; htab->sgotplt = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; 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 name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (r) switch (r)
@ -2241,7 +2241,7 @@ _bfd_cr16_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
flags | SEC_READONLY); flags | SEC_READONLY);
htab->srelplt = s; htab->srelplt = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
if (! _bfd_cr16_elf_create_got_section (abfd, info)) 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"), ? ".rela.bss" : ".rel.bss"),
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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) 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 entry. The entries in the .rela.plt section
really apply to the .got section, which we really apply to the .got section, which we
created ourselves and so know is not readonly. */ created ourselves and so know is not readonly. */
outname = bfd_get_section_name (output_bfd, outname = bfd_section_name (s->output_section);
s->output_section);
target = bfd_get_section_by_name (output_bfd, outname + 5); target = bfd_get_section_by_name (output_bfd, outname + 5);
if (target != NULL if (target != NULL
&& (target->flags & SEC_READONLY) != 0 && (target->flags & SEC_READONLY) != 0

View File

@ -763,7 +763,7 @@ elf32_cr16c_relocate_section (bfd *output_bfd,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (r) switch (r)
@ -827,9 +827,9 @@ elf32_cr16c_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED,
asection *sec, asection *sec,
int *retval) int *retval)
{ {
if (strcmp (bfd_get_section_name (abfd, sec), ".fcommon") == 0) if (strcmp (bfd_section_name (sec), ".fcommon") == 0)
*retval = SHN_CR16C_FCOMMON; *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; *retval = SHN_CR16C_NCOMMON;
else else
return FALSE; return FALSE;

View File

@ -1044,7 +1044,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
symname = (bfd_elf_string_from_elf_section symname = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (symname == NULL) if (symname == NULL)
symname = bfd_section_name (input_bfd, sec); symname = bfd_section_name (sec);
} }
else 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) if ((got = bfd_get_section_by_name (abfd, ".got")) == NULL)
return (bfd_vma) -1; return (bfd_vma) -1;
plt_sec_size = bfd_section_size (plt->owner, plt); plt_sec_size = bfd_section_size (plt);
plt_entry_size plt_entry_size
= (bfd_get_mach (abfd) == bfd_mach_cris_v32 = (bfd_get_mach (abfd) == bfd_mach_cris_v32
? PLT_ENTRY_SIZE_V32 : PLT_ENTRY_SIZE); ? 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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) if (strcmp (name, ".plt") == 0)
{ {

View File

@ -905,7 +905,7 @@ elf32_crx_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (r) switch (r)

View File

@ -2092,7 +2092,7 @@ csky_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->elf.hplt != NULL) if (htab->elf.hplt != NULL)
strip_section = FALSE; 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 ) if (s->size != 0 )
relocs = TRUE; relocs = TRUE;
@ -5070,7 +5070,7 @@ csky_elf_relocate_section (bfd * output_bfd,
if (name == NULL) if (name == NULL)
break; break;
if (*name == '\0') if (*name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
(*info->callbacks->reloc_overflow) (*info->callbacks->reloc_overflow)
(info, (info,

View File

@ -482,7 +482,7 @@ elf32_d10v_relocate_section (bfd *output_bfd,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') 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, r = _bfd_final_link_relocate (howto, input_bfd, input_section,

View File

@ -518,7 +518,7 @@ epiphany_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {

View File

@ -549,7 +549,7 @@ fr30_elf_relocate_section (bfd *output_bfd,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {

View File

@ -2736,7 +2736,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (input_bfd, symtab_hdr->sh_link, sym->st_name);
if (name == NULL || name[0] == 0) if (name == NULL || name[0] == 0)
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
else else
{ {
@ -3566,8 +3566,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
&& (!h || FRVFDPIC_FUNCDESC_LOCAL (info, h))) && (!h || FRVFDPIC_FUNCDESC_LOCAL (info, h)))
{ {
addend += frvfdpic_got_section (info)->output_section->vma; addend += frvfdpic_got_section (info)->output_section->vma;
if ((bfd_get_section_flags (output_bfd, if ((bfd_section_flags (input_section->output_section)
input_section->output_section)
& (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{ {
bfd_vma offset; bfd_vma offset;
@ -3597,8 +3596,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
picrel); picrel);
} }
} }
else if ((bfd_get_section_flags (output_bfd, else if ((bfd_section_flags (input_section->output_section)
input_section->output_section)
& (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{ {
bfd_vma offset; bfd_vma offset;
@ -3691,8 +3689,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
if (osec) if (osec)
addend += osec->output_section->vma; addend += osec->output_section->vma;
if (IS_FDPIC (input_bfd) if (IS_FDPIC (input_bfd)
&& (bfd_get_section_flags (output_bfd, && (bfd_section_flags (input_section->output_section)
input_section->output_section)
& (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{ {
if (_frvfdpic_osec_readonly_p (output_bfd, if (_frvfdpic_osec_readonly_p (output_bfd,
@ -3732,8 +3729,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
} }
else else
{ {
if ((bfd_get_section_flags (output_bfd, if ((bfd_section_flags (input_section->output_section)
input_section->output_section)
& (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)) & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD))
{ {
bfd_vma offset; 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); s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
elf_hash_table (info)->sgot = s; elf_hash_table (info)->sgot = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
if (bed->want_got_sym) if (bed->want_got_sym)
@ -4230,14 +4226,14 @@ _frv_create_got_section (bfd *abfd, struct bfd_link_info *info)
(flags | SEC_READONLY)); (flags | SEC_READONLY));
elf_hash_table (info)->srelgot = s; elf_hash_table (info)->srelgot = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 2)) || !bfd_set_section_alignment (s, 2))
return FALSE; return FALSE;
/* Machine-specific. */ /* Machine-specific. */
s = bfd_make_section_anyway_with_flags (abfd, ".rofixup", s = bfd_make_section_anyway_with_flags (abfd, ".rofixup",
(flags | SEC_READONLY)); (flags | SEC_READONLY));
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 2)) || !bfd_set_section_alignment (s, 2))
return FALSE; return FALSE;
frvfdpic_gotfixup_section (info) = s; 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); s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
/* FRV-specific: remember it. */ /* FRV-specific: remember it. */
frvfdpic_plt_section (info) = s; 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", s = bfd_make_section_anyway_with_flags (abfd, ".rel.plt",
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
/* FRV-specific: remember it. */ /* FRV-specific: remember it. */
frvfdpic_pltrel_section (info) = s; 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"), ? ".rela.bss" : ".rel.bss"),
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
} }
} }
@ -6137,7 +6133,7 @@ elf32_frv_check_relocs (bfd *abfd,
case R_FRV_FUNCDESC_VALUE: case R_FRV_FUNCDESC_VALUE:
picrel->relocsfdv++; picrel->relocsfdv++;
if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) if (bfd_section_flags (sec) & SEC_ALLOC)
picrel->relocs32--; picrel->relocs32--;
/* Fall through. */ /* Fall through. */
@ -6146,7 +6142,7 @@ elf32_frv_check_relocs (bfd *abfd,
break; break;
picrel->sym = 1; picrel->sym = 1;
if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) if (bfd_section_flags (sec) & SEC_ALLOC)
picrel->relocs32++; picrel->relocs32++;
break; break;

View File

@ -389,7 +389,7 @@ ft32_elf_relocate_section (bfd *output_bfd,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {

View File

@ -502,7 +502,7 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (r) switch (r)

View File

@ -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 /* Make space for the plt stub at the end of the .plt
section. We want this stub right at the end, up section. We want this stub right at the end, up
against the .got section. */ against the .got section. */
int gotalign = bfd_section_alignment (dynobj, htab->etab.sgot); int gotalign = bfd_section_alignment (htab->etab.sgot);
int pltalign = bfd_section_alignment (dynobj, sec); int pltalign = bfd_section_alignment (sec);
bfd_size_type mask; bfd_size_type mask;
if (gotalign > pltalign) if (gotalign > pltalign)
(void) bfd_set_section_alignment (dynobj, sec, gotalign); bfd_set_section_alignment (sec, gotalign);
mask = ((bfd_size_type) 1 << gotalign) - 1; mask = ((bfd_size_type) 1 << gotalign) - 1;
sec->size = (sec->size + sizeof (plt_stub) + mask) & ~mask; 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.sdynbss
|| sec == htab->etab.sdynrelro) || 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) if (sec->size != 0)
{ {
@ -4151,7 +4151,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
if (sym_name == NULL) if (sym_name == NULL)
return FALSE; return FALSE;
if (*sym_name == '\0') if (*sym_name == '\0')
sym_name = bfd_section_name (input_bfd, sym_sec); sym_name = bfd_section_name (sym_sec);
_bfd_error_handler _bfd_error_handler
(_("%pB:%s has both normal and TLS relocs"), (_("%pB:%s has both normal and TLS relocs"),
input_bfd, sym_name); input_bfd, sym_name);
@ -4201,7 +4201,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
if (sym_name == NULL) if (sym_name == NULL)
return FALSE; return FALSE;
if (*sym_name == '\0') 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; howto = elf_hppa_howto_table + r_type;

View File

@ -1948,7 +1948,7 @@ elf_i386_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
{ {
const char *name; 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 /* This is an ugly, but unfortunately necessary hack that is
needed when producing EFI binaries on x86. It tells needed when producing EFI binaries on x86. It tells
@ -3429,7 +3429,7 @@ check_relocation_error:
if (name == NULL) if (name == NULL)
return FALSE; return FALSE;
if (*name == '\0') if (*name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
if (r == bfd_reloc_overflow) if (r == bfd_reloc_overflow)

View File

@ -1435,7 +1435,7 @@ ip2k_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {

View File

@ -625,7 +625,7 @@ iq2000_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {

View File

@ -195,8 +195,7 @@ create_rofixup_section (bfd *dynobj, struct bfd_link_info *info)
| SEC_LINKER_CREATED | SEC_LINKER_CREATED
| SEC_READONLY)); | SEC_READONLY));
if (lm32fdpic_fixup32_section (info) == NULL if (lm32fdpic_fixup32_section (info) == NULL
|| ! bfd_set_section_alignment (dynobj, || !bfd_set_section_alignment (lm32fdpic_fixup32_section (info), 2))
lm32fdpic_fixup32_section (info), 2))
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -821,7 +820,7 @@ lm32_elf_relocate_section (bfd *output_bfd,
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {
@ -1036,7 +1035,7 @@ lm32_elf_relocate_section (bfd *output_bfd,
if ((!h) || (h && h->root.type != bfd_link_hash_undefweak)) if ((!h) || (h && h->root.type != bfd_link_hash_undefweak))
{ {
/* Only create .rofixup entries for relocs in loadable sections. */ /* 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)) & (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 name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (r) 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 /* Strip this section if we don't need it; see the
comment below. */ 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) if (s->size != 0 && s != htab->root.srelplt)
relocs = TRUE; relocs = TRUE;
@ -2255,7 +2254,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
/* Don't generate entries for weak symbols. */ /* Don't generate entries for weak symbols. */
if (!h || (h && h->root.type != bfd_link_hash_undefweak)) 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)) 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)) if (!strcmp (current->name, h->root.root.string))
break; 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. */ /* Will this have an entry in the GOT. */
if (ELF32_R_TYPE (internal_relocs->r_info) == R_LM32_16_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); s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
htab->root.splt = s; htab->root.splt = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
if (bed->want_plt_sym) if (bed->want_plt_sym)
@ -2408,7 +2407,7 @@ lm32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
flags | SEC_READONLY); flags | SEC_READONLY);
htab->root.srelplt = s; htab->root.srelplt = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
if (htab->root.sgot == NULL if (htab->root.sgot == NULL
@ -2447,7 +2446,7 @@ lm32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
flags | SEC_READONLY); flags | SEC_READONLY);
htab->srelbss = s; htab->srelbss = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
} }
} }

View File

@ -450,7 +450,7 @@ m32c_elf_relocate_section
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {
@ -709,7 +709,7 @@ m32c_elf_check_relocs
flags); flags);
elf_hash_table (info)->splt = splt; elf_hash_table (info)->splt = splt;
if (splt == NULL if (splt == NULL
|| ! bfd_set_section_alignment (dynobj, splt, 1)) || !bfd_set_section_alignment (splt, 1))
return FALSE; return FALSE;
} }

View File

@ -1322,7 +1322,7 @@ _bfd_m32r_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED,
asection *sec, asection *sec,
int *retval) int *retval)
{ {
if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) if (strcmp (bfd_section_name (sec), ".scommon") == 0)
{ {
*retval = SHN_M32R_SCOMMON; *retval = SHN_M32R_SCOMMON;
return TRUE; return TRUE;
@ -1407,7 +1407,7 @@ m32r_elf_add_symbol_hook (bfd *abfd,
flags); flags);
if (s == NULL) if (s == NULL)
return FALSE; return FALSE;
if (! bfd_set_section_alignment (abfd, s, 2)) if (!bfd_set_section_alignment (s, 2))
return FALSE; 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); s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
htab->root.splt = s; htab->root.splt = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
if (bed->want_plt_sym) if (bed->want_plt_sym)
@ -1654,7 +1654,7 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
flags | SEC_READONLY); flags | SEC_READONLY);
htab->root.srelplt = s; htab->root.srelplt = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
if (htab->root.sgot == NULL if (htab->root.sgot == NULL
@ -1693,7 +1693,7 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
flags | SEC_READONLY); flags | SEC_READONLY);
htab->srelbss = s; htab->srelbss = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; 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 /* Strip this section if we don't need it; see the
comment below. */ 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) if (s->size != 0 && s != htab->root.srelplt)
relocs = TRUE; relocs = TRUE;
@ -2954,7 +2954,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
const char *name; const char *name;
BFD_ASSERT (sec != NULL); BFD_ASSERT (sec != NULL);
name = bfd_get_section_name (sec->owner, sec); name = bfd_section_name (sec);
if ( strcmp (name, ".sdata") == 0 if ( strcmp (name, ".sdata") == 0
|| strcmp (name, ".sbss") == 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 name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
if (errmsg != NULL) if (errmsg != NULL)

View File

@ -267,7 +267,7 @@ elf32_m68hc11_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info)
section != NULL; section != NULL;
section = section->next) section = section->next)
{ {
const char* name = bfd_get_section_name (input_bfd, section); const char *name = bfd_section_name (section);
if (!strcmp (name, ".tramp")) if (!strcmp (name, ".tramp"))
htab->tramp_section = section; htab->tramp_section = section;
@ -1014,7 +1014,7 @@ elf32_m68hc11_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') 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) if (is_far && ELF32_R_TYPE (rel->r_info) == R_M68HC11_16)

View File

@ -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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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) if (strcmp (name, ".plt") == 0)
{ {
@ -3938,7 +3938,7 @@ elf_m68k_relocate_section (bfd *output_bfd,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
_bfd_error_handler _bfd_error_handler
@ -3973,7 +3973,7 @@ elf_m68k_relocate_section (bfd *output_bfd,
if (name == NULL) if (name == NULL)
return FALSE; return FALSE;
if (*name == '\0') if (*name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
if (r == bfd_reloc_overflow) if (r == bfd_reloc_overflow)

View File

@ -536,7 +536,7 @@ mcore_elf_relocate_section (bfd * output_bfd,
break; break;
if (* name == '\0') if (* name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
(*info->callbacks->reloc_overflow) (*info->callbacks->reloc_overflow)

View File

@ -477,7 +477,7 @@ mep_elf_relocate_section
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {

View File

@ -1519,7 +1519,7 @@ elf_metag_relocate_section (bfd *output_bfd,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 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 /* Strip this section if we don't need it; see the
comment below. */ 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) if (s->size != 0 && s != htab->etab.srelplt)
relocs = TRUE; relocs = TRUE;

View File

@ -1071,7 +1071,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
/* Only relocate if the symbol is defined. */ /* Only relocate if the symbol is defined. */
if (sec) if (sec)
{ {
name = bfd_get_section_name (sec->owner, sec); name = bfd_section_name (sec);
if (strcmp (name, ".sdata2") == 0 if (strcmp (name, ".sdata2") == 0
|| strcmp (name, ".sbss2") == 0) || strcmp (name, ".sbss2") == 0)
@ -1119,7 +1119,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
/* Only relocate if the symbol is defined. */ /* Only relocate if the symbol is defined. */
if (sec) if (sec)
{ {
name = bfd_get_section_name (sec->owner, sec); name = bfd_section_name (sec);
if (strcmp (name, ".sdata") == 0 if (strcmp (name, ".sdata") == 0
|| strcmp (name, ".sbss") == 0) || strcmp (name, ".sbss") == 0)
@ -1608,7 +1608,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
if (errmsg != NULL) 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)); s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two));
if (power_of_two > s->alignment_power) 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; 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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) if (strncmp (name, ".rela", 5) == 0)
{ {
@ -3501,7 +3501,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
put into .sbss. */ put into .sbss. */
*secp = bfd_make_section_old_way (abfd, ".sbss"); *secp = bfd_make_section_old_way (abfd, ".sbss");
if (*secp == NULL if (*secp == NULL
|| ! bfd_set_section_flags (abfd, *secp, SEC_IS_COMMON)) || !bfd_set_section_flags (*secp, SEC_IS_COMMON))
return FALSE; return FALSE;
*valp = sym->st_size; *valp = sym->st_size;

View File

@ -243,7 +243,7 @@ moxie_elf_relocate_section (bfd *output_bfd,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {

View File

@ -1314,7 +1314,7 @@ elf32_msp430_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {
@ -1691,7 +1691,7 @@ msp430_elf_relax_delete_bytes (bfd * abfd, asection * sec, bfd_vma addr,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(abfd, symtab_hdr->sh_link, isym->st_name); (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) if (isym->st_shndx != sec_shndx)
continue; continue;

View File

@ -346,7 +346,7 @@ mt_elf_relocate_section
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {

View File

@ -3723,11 +3723,11 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
/* _bfd_elf_create_got_section will create it for us. */ /* _bfd_elf_create_got_section will create it for us. */
ehtab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); ehtab->srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
if (ehtab->srelgot == NULL 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_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
| SEC_IN_MEMORY | SEC_LINKER_CREATED | SEC_IN_MEMORY | SEC_LINKER_CREATED
| SEC_READONLY)) | SEC_READONLY))
|| !bfd_set_section_alignment (dynobj, ehtab->srelgot, 2)) || !bfd_set_section_alignment (ehtab->srelgot, 2))
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -3769,8 +3769,8 @@ nds32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
s = bfd_make_section (abfd, ".plt"); s = bfd_make_section (abfd, ".plt");
ehtab->splt = s; ehtab->splt = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_flags (abfd, s, pltflags) || !bfd_set_section_flags (s, pltflags)
|| !bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
if (bed->want_plt_sym) 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"); bed->default_use_rela_p ? ".rela.plt" : ".rel.plt");
ehtab->srelplt = s; ehtab->srelplt = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || !bfd_set_section_flags (s, flags | SEC_READONLY)
|| !bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
if (ehtab->sgot == NULL && !create_got_section (abfd, info)) 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) 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)) if ((secflags & (SEC_DATA | SEC_LINKER_CREATED))
|| ((secflags & SEC_HAS_CONTENTS) != SEC_HAS_CONTENTS)) || ((secflags & SEC_HAS_CONTENTS) != SEC_HAS_CONTENTS))
continue; continue;
secname = bfd_get_section_name (abfd, sec); secname = bfd_section_name (sec);
relname = (char *) bfd_malloc ((bfd_size_type) strlen (secname) + 6); relname = (char *) bfd_malloc ((bfd_size_type) strlen (secname) + 6);
strcpy (relname, ".rela"); strcpy (relname, ".rela");
strcat (relname, secname); strcat (relname, secname);
@ -3819,8 +3819,8 @@ nds32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
continue; continue;
s = bfd_make_section (abfd, relname); s = bfd_make_section (abfd, relname);
if (s == NULL if (s == NULL
|| !bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || !bfd_set_section_flags (s, flags | SEC_READONLY)
|| !bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
} }
@ -3835,7 +3835,7 @@ nds32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
s = bfd_make_section (abfd, ".dynbss"); s = bfd_make_section (abfd, ".dynbss");
htab->sdynbss = s; htab->sdynbss = s;
if (s == NULL 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; return FALSE;
/* The .rel[a].bss section holds copy relocs. This section is not /* The .rel[a].bss section holds copy relocs. This section is not
normally needed. We need to create it here, though, so that the 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")); ? ".rela.bss" : ".rel.bss"));
htab->srelbss = s; htab->srelbss = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_flags (abfd, s, flags | SEC_READONLY) || !bfd_set_section_flags (s, flags | SEC_READONLY)
|| !bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
} }
} }
@ -4065,9 +4065,9 @@ nds32_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Apply the required alignment. */ /* Apply the required alignment. */
s->size = BFD_ALIGN (s->size, (bfd_size_type) (1 << power_of_two)); 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; return FALSE;
} }
@ -4525,7 +4525,7 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
{ {
got_size += s->size; 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) if (s->size != 0 && s != elf_hash_table (info)->srelplt)
relocs = TRUE; relocs = TRUE;
@ -5571,8 +5571,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
return FALSE; return FALSE;
BFD_ASSERT (strncmp (name, ".rela", 5) == 0 BFD_ASSERT (strncmp (name, ".rela", 5) == 0
&& strcmp (bfd_get_section_name (input_bfd, && strcmp (bfd_section_name (input_section),
input_section),
name + 5) == 0); name + 5) == 0);
sreloc = bfd_get_section_by_name (dynobj, name); sreloc = bfd_get_section_by_name (dynobj, name);
@ -6166,7 +6165,7 @@ check_reloc:
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (input_bfd, symtab_hdr->sh_link, sym->st_name);
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
if (errmsg != NULL) if (errmsg != NULL)
@ -7390,7 +7389,7 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
return FALSE; return FALSE;
BFD_ASSERT (strncmp (name, ".rela", 5) == 0 BFD_ASSERT (strncmp (name, ".rela", 5) == 0
&& strcmp (bfd_get_section_name (abfd, sec), && strcmp (bfd_section_name (sec),
name + 5) == 0); name + 5) == 0);
sreloc = bfd_get_section_by_name (dynobj, name); 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) if ((sec->flags & SEC_ALLOC) != 0)
flags |= SEC_ALLOC | SEC_LOAD; flags |= SEC_ALLOC | SEC_LOAD;
if (sreloc == NULL if (sreloc == NULL
|| !bfd_set_section_flags (dynobj, sreloc, flags) || !bfd_set_section_flags (sreloc, flags)
|| !bfd_set_section_alignment (dynobj, sreloc, 2)) || !bfd_set_section_alignment (sreloc, 2))
return FALSE; return FALSE;
elf_section_type (sreloc) = SHT_RELA; elf_section_type (sreloc) = SHT_RELA;

View File

@ -3846,7 +3846,7 @@ nios2_elf32_relocate_section (bfd *output_bfd,
(input_bfd, symtab_hdr->sh_link, (input_bfd, symtab_hdr->sh_link,
sym->st_name)); sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
/* xgettext:c-format */ /* xgettext:c-format */
format = _("unable to reach %s (at %#" PRIx64 ") from " format = _("unable to reach %s (at %#" PRIx64 ") from "
@ -4484,7 +4484,7 @@ nios2_elf32_relocate_section (bfd *output_bfd,
symtab_hdr->sh_link, symtab_hdr->sh_link,
sym->st_name); sym->st_name);
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (r) switch (r)
@ -4554,7 +4554,7 @@ static bfd_boolean
nios2_elf32_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, nios2_elf32_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
Elf_Internal_Shdr *hdr, asection *sec) 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) if ((sec->flags & SEC_SMALL_DATA)
|| strcmp (name, ".sdata") == 0 || 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, /* In order for the two loads in .PLTresolve to share the same %hiadj,
_GLOBAL_OFFSET_TABLE_ must be aligned to a 16-byte boundary. */ _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; return FALSE;
/* The Nios II ABI specifies that GOT-relative relocations are relative /* 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 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 to a 16-byte boundary. This is because the addresses for these loads
include the -(.plt+4) PIC correction. */ 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: /* Implement elf_backend_copy_indirect_symbol:
@ -5429,8 +5429,8 @@ nios2_elf32_adjust_dynamic_symbol (struct bfd_link_info *info,
/* Align dynbss. */ /* Align dynbss. */
s->size = BFD_ALIGN (s->size, (bfd_size_type)1 << align2); s->size = BFD_ALIGN (s->size, (bfd_size_type)1 << align2);
if (align2 > bfd_get_section_alignment (dynobj, s) if (align2 > bfd_section_alignment (s)
&& !bfd_set_section_alignment (dynobj, s, align2)) && !bfd_set_section_alignment (s, align2))
return FALSE; return FALSE;
/* Define the symbol as being at this point in the section. */ /* 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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")) if (CONST_STRNEQ (name, ".rela"))
{ {

View File

@ -1303,7 +1303,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {
@ -2064,8 +2064,7 @@ or1k_elf_check_relocs (bfd *abfd,
return FALSE; return FALSE;
if (strncmp (name, ".rela", 5) != 0 if (strncmp (name, ".rela", 5) != 0
|| strcmp (bfd_get_section_name (abfd, sec), || strcmp (bfd_section_name (sec), name + 5) != 0)
name + 5) != 0)
{ {
_bfd_error_handler _bfd_error_handler
/* xgettext:c-format */ /* 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 /* Strip this section if we don't need it; see the
comment below. */ 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) if (s->size != 0 && s != htab->root.srelplt)
relocs = TRUE; relocs = TRUE;

View File

@ -1329,14 +1329,14 @@ ppc_elf_section_from_shdr (bfd *abfd,
return FALSE; return FALSE;
newsect = hdr->bfd_section; newsect = hdr->bfd_section;
flags = bfd_get_section_flags (abfd, newsect); flags = bfd_section_flags (newsect);
if (hdr->sh_flags & SHF_EXCLUDE) if (hdr->sh_flags & SHF_EXCLUDE)
flags |= SEC_EXCLUDE; flags |= SEC_EXCLUDE;
if (hdr->sh_type == SHT_ORDERED) if (hdr->sh_type == SHT_ORDERED)
flags |= SEC_SORT_ENTRIES; flags |= SEC_SORT_ENTRIES;
bfd_set_section_flags (abfd, newsect, flags); bfd_set_section_flags (newsect, flags);
return TRUE; 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. */ /* Set the output section size, if it exists. */
asec = bfd_get_section_by_name (abfd, APUINFO_SECTION_NAME); 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; ibfd = abfd;
/* xgettext:c-format */ /* xgettext:c-format */
@ -2337,7 +2337,7 @@ ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info)
executable. */ executable. */
flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS
| SEC_IN_MEMORY | SEC_LINKER_CREATED); | 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; return FALSE;
} }
@ -2390,7 +2390,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info)
if (p2align < htab->params->plt_stub_align) if (p2align < htab->params->plt_stub_align)
p2align = htab->params->plt_stub_align; p2align = htab->params->plt_stub_align;
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, p2align)) || !bfd_set_section_alignment (s, p2align))
return FALSE; return FALSE;
if (!info->no_ld_generated_unwind_info) 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); s = bfd_make_section_anyway_with_flags (abfd, ".eh_frame", flags);
htab->glink_eh_frame = s; htab->glink_eh_frame = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 2)) || !bfd_set_section_alignment (s, 2))
return FALSE; 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); s = bfd_make_section_anyway_with_flags (abfd, ".iplt", flags);
htab->elf.iplt = s; htab->elf.iplt = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 4)) || !bfd_set_section_alignment (s, 4))
return FALSE; return FALSE;
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS 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); s = bfd_make_section_anyway_with_flags (abfd, ".rela.iplt", flags);
htab->elf.irelplt = s; htab->elf.irelplt = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 2)) || ! bfd_set_section_alignment (s, 2))
return FALSE; return FALSE;
/* Local plt entries. */ /* 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", htab->pltlocal = bfd_make_section_anyway_with_flags (abfd, ".branch_lt",
flags); flags);
if (htab->pltlocal == NULL if (htab->pltlocal == NULL
|| ! bfd_set_section_alignment (abfd, htab->pltlocal, 2)) || !bfd_set_section_alignment (htab->pltlocal, 2))
return FALSE; return FALSE;
if (bfd_link_pic (info)) if (bfd_link_pic (info))
@ -2435,7 +2435,7 @@ ppc_elf_create_glink (bfd *abfd, struct bfd_link_info *info)
htab->relpltlocal htab->relpltlocal
= bfd_make_section_anyway_with_flags (abfd, ".rela.branch_lt", flags); = bfd_make_section_anyway_with_flags (abfd, ".rela.branch_lt", flags);
if (htab->relpltlocal == NULL if (htab->relpltlocal == NULL
|| ! bfd_set_section_alignment (abfd, htab->relpltlocal, 2)) || !bfd_set_section_alignment (htab->relpltlocal, 2))
return FALSE; 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); s = bfd_make_section_anyway_with_flags (abfd, ".rela.sbss", flags);
htab->relsbss = s; htab->relsbss = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 2)) || !bfd_set_section_alignment (s, 2))
return FALSE; return FALSE;
} }
@ -2500,7 +2500,7 @@ ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
if (htab->plt_type == PLT_VXWORKS) if (htab->plt_type == PLT_VXWORKS)
/* The VxWorks PLT is a loaded section with contents. */ /* The VxWorks PLT is a loaded section with contents. */
flags |= SEC_HAS_CONTENTS | SEC_LOAD | SEC_READONLY; 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. */ /* 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; linker_section_ptr->lsect = lsect;
*ptr_linker_section_ptr = linker_section_ptr; *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; return FALSE;
linker_section_ptr->offset = lsect->section->size; linker_section_ptr->offset = lsect->section->size;
lsect->section->size += 4; 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. */ /* The new PLT is a loaded section. */
if (htab->elf.splt != NULL 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; return -1;
/* The new GOT is not executable. */ /* The new GOT is not executable. */
if (htab->elf.sgot != NULL 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; return -1;
} }
else else
{ {
/* Stop an unused .glink section from affecting .text alignment. */ /* Stop an unused .glink section from affecting .text alignment. */
if (htab->glink != NULL if (htab->glink != NULL
&& !bfd_set_section_alignment (htab->elf.dynobj, htab->glink, 0)) && !bfd_set_section_alignment (htab->glink, 0))
return -1; return -1;
} }
return htab->plt_type == PLT_NEW; 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; strip_section = (s->flags & SEC_KEEP) == 0;
} }
else if (CONST_STRNEQ (bfd_get_section_name (htab->elf.dynobj, s), else if (CONST_STRNEQ (bfd_section_name (s), ".rela"))
".rela"))
{ {
if (s->size != 0) if (s->size != 0)
{ {
@ -8394,10 +8393,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
unresolved_reloc = TRUE; unresolved_reloc = TRUE;
break; break;
} }
BFD_ASSERT (strcmp (bfd_get_section_name (sec->owner, sec), BFD_ASSERT (strcmp (bfd_section_name (sec), ".got") == 0
".got") == 0 || strcmp (bfd_section_name (sec), ".cgot") == 0);
|| strcmp (bfd_get_section_name (sec->owner, sec),
".cgot") == 0);
addend -= sec->output_section->vma + sec->output_offset + 0x8000; addend -= sec->output_section->vma + sec->output_offset + 0x8000;
break; break;
@ -8512,7 +8509,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
} }
addend -= SYM_VAL (sda); 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 if (!(strcmp (name, ".sdata") == 0
|| strcmp (name, ".sbss") == 0)) || strcmp (name, ".sbss") == 0))
{ {
@ -8543,7 +8540,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
} }
addend -= SYM_VAL (sda); 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 if (!(strcmp (name, ".sdata2") == 0
|| strcmp (name, ".sbss2") == 0)) || strcmp (name, ".sbss2") == 0))
{ {
@ -8618,7 +8615,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
break; break;
} }
name = bfd_get_section_name (output_bfd, sec->output_section); name = bfd_section_name (sec->output_section);
if (strcmp (name, ".sdata") == 0 if (strcmp (name, ".sdata") == 0
|| strcmp (name, ".sbss") == 0) || strcmp (name, ".sbss") == 0)
{ {
@ -8725,7 +8722,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
break; break;
} }
name = bfd_get_section_name (output_bfd, sec->output_section); name = bfd_section_name (sec->output_section);
if (strcmp (name, ".sdata") == 0 if (strcmp (name, ".sdata") == 0
|| strcmp (name, ".sbss") == 0) || strcmp (name, ".sbss") == 0)
sda = htab->sdata[0].sym; sda = htab->sdata[0].sym;

View File

@ -905,7 +905,7 @@ pru_elf32_relocate_section (bfd *output_bfd,
symtab_hdr->sh_link, symtab_hdr->sh_link,
sym->st_name); sym->st_name);
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (r) switch (r)

View File

@ -726,7 +726,7 @@ rl78_elf_relocate_section
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {
@ -1349,7 +1349,7 @@ rl78_elf_check_relocs
flags); flags);
elf_hash_table (info)->splt = splt; elf_hash_table (info)->splt = splt;
if (splt == NULL if (splt == NULL
|| ! bfd_set_section_alignment (dynobj, splt, 1)) || !bfd_set_section_alignment (splt, 1))
return FALSE; return FALSE;
} }

View File

@ -543,7 +543,7 @@ rx_elf_relocate_section
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {

View File

@ -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 /* Strip this section if we don't need it; see the
comment below. */ 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) if (s->size != 0)
relocs = TRUE; relocs = TRUE;
@ -3254,7 +3254,7 @@ elf_s390_relocate_section (bfd *output_bfd,
if (name == NULL) if (name == NULL)
return FALSE; return FALSE;
if (*name == '\0') if (*name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
if (r == bfd_reloc_overflow) if (r == bfd_reloc_overflow)

View File

@ -1257,8 +1257,8 @@ score_elf_rel_dyn_section (bfd *dynobj, bfd_boolean create_p)
| SEC_LINKER_CREATED | SEC_LINKER_CREATED
| SEC_READONLY)); | SEC_READONLY));
if (sreloc == NULL if (sreloc == NULL
|| ! bfd_set_section_alignment (dynobj, sreloc, || !bfd_set_section_alignment (sreloc,
SCORE_ELF_LOG_FILE_ALIGN (dynobj))) SCORE_ELF_LOG_FILE_ALIGN (dynobj)))
return NULL; return NULL;
} }
return sreloc; return sreloc;
@ -1431,7 +1431,7 @@ score_elf_create_got_section (bfd *abfd,
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
elf_hash_table (info)->sgot = s; elf_hash_table (info)->sgot = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 4)) || !bfd_set_section_alignment (s, 4))
return FALSE; return FALSE;
/* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the /* 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, asection *sec,
int *retval) int *retval)
{ {
if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) if (strcmp (bfd_section_name (sec), ".scommon") == 0)
{ {
*retval = SHN_SCORE_SCOMMON; *retval = SHN_SCORE_SCOMMON;
return TRUE; 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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")) 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. */ the linker now does not create empty output sections. */
if (s->output_section != NULL if (s->output_section != NULL
&& strcmp (name, && strcmp (name,
bfd_get_section_name (s->output_section->owner, bfd_section_name (s->output_section)) == 0)
s->output_section)) == 0)
s->flags |= SEC_EXCLUDE; s->flags |= SEC_EXCLUDE;
} }
else 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 assert a DT_TEXTREL entry rather than testing whether
there exists a relocation to a read only section or there exists a relocation to a read only section or
not. */ 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); target = bfd_get_section_by_name (output_bfd, outname + 4);
if ((target != NULL if ((target != NULL
&& (target->flags & SEC_READONLY) != 0 && (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"); s = bfd_get_linker_section (abfd, ".dynamic");
if (s != NULL) if (s != NULL)
{ {
if (!bfd_set_section_flags (abfd, s, flags)) if (!bfd_set_section_flags (s, flags))
return FALSE; 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, s = bfd_make_section_anyway_with_flags (abfd, SCORE_ELF_STUB_SECTION_NAME,
flags | SEC_CODE); flags | SEC_CODE);
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 2)) || !bfd_set_section_alignment (s, 2))
return FALSE; return FALSE;
} }
@ -3709,7 +3708,7 @@ s3_bfd_score_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
{ {
const char *name; const char *name;
name = bfd_get_section_name (abfd, sec); name = bfd_section_name (sec);
if (strcmp (name, ".got") == 0 if (strcmp (name, ".got") == 0
|| strcmp (name, ".srdata") == 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) 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) if (strcmp (name, ".sdata") == 0)
{ {

View File

@ -1114,8 +1114,8 @@ score_elf_rel_dyn_section (bfd *dynobj, bfd_boolean create_p)
| SEC_LINKER_CREATED | SEC_LINKER_CREATED
| SEC_READONLY)); | SEC_READONLY));
if (sreloc == NULL if (sreloc == NULL
|| ! bfd_set_section_alignment (dynobj, sreloc, || !bfd_set_section_alignment (sreloc,
SCORE_ELF_LOG_FILE_ALIGN (dynobj))) SCORE_ELF_LOG_FILE_ALIGN (dynobj)))
return NULL; return NULL;
} }
return sreloc; return sreloc;
@ -1289,7 +1289,7 @@ score_elf_create_got_section (bfd *abfd,
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
elf_hash_table (info)->sgot = s; elf_hash_table (info)->sgot = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 4)) || !bfd_set_section_alignment (s, 4))
return FALSE; return FALSE;
/* Define the symbol _GLOBAL_OFFSET_TABLE_. We don't do this in the /* 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, asection *sec,
int *retval) int *retval)
{ {
if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) if (strcmp (bfd_section_name (sec), ".scommon") == 0)
{ {
*retval = SHN_SCORE_SCOMMON; *retval = SHN_SCORE_SCOMMON;
return TRUE; 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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")) 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. */ the linker now does not create empty output sections. */
if (s->output_section != NULL if (s->output_section != NULL
&& strcmp (name, && strcmp (name,
bfd_get_section_name (s->output_section->owner, bfd_section_name (s->output_section)) == 0)
s->output_section)) == 0)
s->flags |= SEC_EXCLUDE; s->flags |= SEC_EXCLUDE;
} }
else 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 assert a DT_TEXTREL entry rather than testing whether
there exists a relocation to a read only section or there exists a relocation to a read only section or
not. */ 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); target = bfd_get_section_by_name (output_bfd, outname + 4);
if ((target != NULL if ((target != NULL
&& (target->flags & SEC_READONLY) != 0 && (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"); s = bfd_get_linker_section (abfd, ".dynamic");
if (s != NULL) if (s != NULL)
{ {
if (!bfd_set_section_flags (abfd, s, flags)) if (!bfd_set_section_flags (s, flags))
return FALSE; 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, s = bfd_make_section_anyway_with_flags (abfd, SCORE_ELF_STUB_SECTION_NAME,
flags | SEC_CODE); flags | SEC_CODE);
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 2)) || !bfd_set_section_alignment (s, 2))
return FALSE; return FALSE;
} }
@ -3520,7 +3519,7 @@ s7_bfd_score_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
{ {
const char *name; const char *name;
name = bfd_get_section_name (abfd, sec); name = bfd_section_name (sec);
if (strcmp (name, ".got") == 0 if (strcmp (name, ".got") == 0
|| strcmp (name, ".srdata") == 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) 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) if (strcmp (name, ".sdata") == 0)
{ {

View File

@ -2324,7 +2324,7 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
| SEC_IN_MEMORY | SEC_IN_MEMORY
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (htab->sfuncdesc == NULL if (htab->sfuncdesc == NULL
|| ! bfd_set_section_alignment (dynobj, htab->sfuncdesc, 2)) || !bfd_set_section_alignment (htab->sfuncdesc, 2))
return FALSE; return FALSE;
htab->srelfuncdesc = bfd_make_section_anyway_with_flags (dynobj, 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_LINKER_CREATED
| SEC_READONLY)); | SEC_READONLY));
if (htab->srelfuncdesc == NULL if (htab->srelfuncdesc == NULL
|| ! bfd_set_section_alignment (dynobj, htab->srelfuncdesc, 2)) || !bfd_set_section_alignment (htab->srelfuncdesc, 2))
return FALSE; return FALSE;
/* Also create .rofixup. */ /* Also create .rofixup. */
@ -2346,7 +2346,7 @@ create_got_section (bfd *dynobj, struct bfd_link_info *info)
| SEC_LINKER_CREATED | SEC_LINKER_CREATED
| SEC_READONLY)); | SEC_READONLY));
if (htab->srofixup == NULL if (htab->srofixup == NULL
|| ! bfd_set_section_alignment (dynobj, htab->srofixup, 2)) || !bfd_set_section_alignment (htab->srofixup, 2))
return FALSE; return FALSE;
return TRUE; 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); s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
htab->root.splt = s; htab->root.splt = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
if (bed->want_plt_sym) if (bed->want_plt_sym)
@ -2433,7 +2433,7 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
flags | SEC_READONLY); flags | SEC_READONLY);
htab->root.srelplt = s; htab->root.srelplt = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; return FALSE;
if (htab->root.sgot == NULL if (htab->root.sgot == NULL
@ -2473,7 +2473,7 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
flags | SEC_READONLY); flags | SEC_READONLY);
htab->srelbss = s; htab->srelbss = s;
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, ptralign)) || !bfd_set_section_alignment (s, ptralign))
return FALSE; 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 /* Strip this section if we don't need it; see the
comment below. */ 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) if (s->size != 0 && s != htab->root.srelplt && s != htab->srelplt2)
relocs = TRUE; 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 symname = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (input_bfd, symtab_hdr->sh_link, sym->st_name);
if (symname == NULL || *symname == '\0') if (symname == NULL || *symname == '\0')
symname = bfd_section_name (input_bfd, sec); symname = bfd_section_name (sec);
relocation = (sec->output_section->vma relocation = (sec->output_section->vma
+ sec->output_offset + sec->output_offset
@ -5170,7 +5170,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (name == NULL) if (name == NULL)
return FALSE; return FALSE;
if (*name == '\0') if (*name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
(*info->callbacks->reloc_overflow) (*info->callbacks->reloc_overflow)
(info, (h ? &h->root : NULL), name, howto->name, (info, (h ? &h->root : NULL), name, howto->name,

View File

@ -585,7 +585,7 @@ spu_elf_create_sections (struct bfd_link_info *info)
flags = SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY; flags = SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
s = bfd_make_section_anyway_with_flags (ibfd, SPU_PTNOTE_SPUNAME, flags); s = bfd_make_section_anyway_with_flags (ibfd, SPU_PTNOTE_SPUNAME, flags);
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (ibfd, s, 4)) || !bfd_set_section_alignment (s, 4))
return FALSE; return FALSE;
/* Because we didn't set SEC_LINKER_CREATED we need to set the /* Because we didn't set SEC_LINKER_CREATED we need to set the
proper section type. */ 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 = 12 + ((sizeof (SPU_PLUGIN_NAME) + 3) & -4);
size += (name_len + 3) & -4; size += (name_len + 3) & -4;
if (!bfd_set_section_size (ibfd, s, size)) if (!bfd_set_section_size (s, size))
return FALSE; return FALSE;
data = bfd_zalloc (ibfd, size); 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 flags = (SEC_LOAD | SEC_ALLOC | SEC_READONLY | SEC_HAS_CONTENTS
| SEC_IN_MEMORY | SEC_LINKER_CREATED); | SEC_IN_MEMORY | SEC_LINKER_CREATED);
s = bfd_make_section_anyway_with_flags (ibfd, ".fixup", flags); 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; return FALSE;
htab->sfixup = s; 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); stub = bfd_make_section_anyway_with_flags (ibfd, ".stub", flags);
htab->stub_sec[0] = stub; htab->stub_sec[0] = stub;
if (stub == NULL if (stub == NULL
|| !bfd_set_section_alignment (ibfd, stub, || !bfd_set_section_alignment (stub,
ovl_stub_size_log2 (htab->params))) ovl_stub_size_log2 (htab->params)))
return 0; return 0;
stub->size = htab->stub_count[0] * ovl_stub_size (htab->params); 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); stub = bfd_make_section_anyway_with_flags (ibfd, ".stub", flags);
htab->stub_sec[ovl] = stub; htab->stub_sec[ovl] = stub;
if (stub == NULL if (stub == NULL
|| !bfd_set_section_alignment (ibfd, stub, || !bfd_set_section_alignment (stub,
ovl_stub_size_log2 (htab->params))) ovl_stub_size_log2 (htab->params)))
return 0; return 0;
stub->size = htab->stub_count[ovl] * ovl_stub_size (htab->params); 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; flags = SEC_ALLOC;
htab->ovtab = bfd_make_section_anyway_with_flags (ibfd, ".ovtab", flags); htab->ovtab = bfd_make_section_anyway_with_flags (ibfd, ".ovtab", flags);
if (htab->ovtab == NULL if (htab->ovtab == NULL
|| !bfd_set_section_alignment (ibfd, htab->ovtab, 4)) || !bfd_set_section_alignment (htab->ovtab, 4))
return 0; return 0;
htab->ovtab->size = (16 + 16 + (16 << htab->fromelem_size_log2)) 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; flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
htab->init = bfd_make_section_anyway_with_flags (ibfd, ".ovini", flags); htab->init = bfd_make_section_anyway_with_flags (ibfd, ".ovini", flags);
if (htab->init == NULL if (htab->init == NULL
|| !bfd_set_section_alignment (ibfd, htab->init, 4)) || !bfd_set_section_alignment (htab->init, 4))
return 0; return 0;
htab->init->size = 16; 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; flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY;
htab->ovtab = bfd_make_section_anyway_with_flags (ibfd, ".ovtab", flags); htab->ovtab = bfd_make_section_anyway_with_flags (ibfd, ".ovtab", flags);
if (htab->ovtab == NULL if (htab->ovtab == NULL
|| !bfd_set_section_alignment (ibfd, htab->ovtab, 4)) || !bfd_set_section_alignment (htab->ovtab, 4))
return 0; return 0;
htab->ovtab->size = htab->num_overlays * 16 + 16 + htab->num_buf * 4; 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); htab->toe = bfd_make_section_anyway_with_flags (ibfd, ".toe", SEC_ALLOC);
if (htab->toe == NULL if (htab->toe == NULL
|| !bfd_set_section_alignment (ibfd, htab->toe, 4)) || !bfd_set_section_alignment (htab->toe, 4))
return 0; return 0;
htab->toe->size = 16; htab->toe->size = 16;
@ -5049,7 +5049,7 @@ spu_elf_relocate_section (bfd *output_bfd,
(_("%pB(%s+%#" PRIx64 "): " (_("%pB(%s+%#" PRIx64 "): "
"unresolvable %s relocation against symbol `%s'"), "unresolvable %s relocation against symbol `%s'"),
input_bfd, input_bfd,
bfd_get_section_name (input_bfd, input_section), bfd_section_name (input_section),
(uint64_t) rel->r_offset, (uint64_t) rel->r_offset,
howto->name, howto->name,
sym_name); sym_name);
@ -5436,7 +5436,7 @@ spu_elf_modify_program_headers (bfd *abfd, struct bfd_link_info *info)
} }
bfd_boolean 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); struct spu_link_hash_table *htab = spu_hash_table (info);
if (htab->params->emit_fixups) 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 */ /* We always have a NULL fixup as a sentinel */
size = (fixup_count + 1) * FIXUP_RECORD_SIZE; 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; return FALSE;
sfixup->contents = (bfd_byte *) bfd_zalloc (info->input_bfds, size); sfixup->contents = (bfd_byte *) bfd_zalloc (info->input_bfds, size);
if (sfixup->contents == NULL) if (sfixup->contents == NULL)

View File

@ -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", htab->dsbt = bfd_make_section_anyway_with_flags (dynobj, ".dsbt",
flags); flags);
if (htab->dsbt == NULL if (htab->dsbt == NULL
|| ! bfd_set_section_alignment (dynobj, htab->dsbt, 2) || !bfd_set_section_alignment (htab->dsbt, 2)
|| ! bfd_set_section_alignment (dynobj, htab->elf.splt, 5)) || !bfd_set_section_alignment (htab->elf.splt, 5))
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -1992,7 +1992,7 @@ elf32_tic6x_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
{ {
const char * name; const char * name;
name = bfd_get_section_name (abfd, sec); name = bfd_section_name (sec);
if (is_tic6x_elf_unwind_section_name (name)) if (is_tic6x_elf_unwind_section_name (name))
{ {
@ -2683,7 +2683,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
if (name == NULL) if (name == NULL)
return FALSE; return FALSE;
if (*name == '\0') if (*name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (r) switch (r)
@ -3016,7 +3016,7 @@ elf32_tic6x_add_symbol_hook (bfd *abfd,
*secp = bfd_make_section_old_way (abfd, ".scommon"); *secp = bfd_make_section_old_way (abfd, ".scommon");
(*secp)->flags |= SEC_IS_COMMON; (*secp)->flags |= SEC_IS_COMMON;
*valp = sym->st_size; *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; break;
} }
@ -3072,7 +3072,7 @@ elf32_tic6x_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED,
asection *sec, asection *sec,
int *retval) int *retval)
{ {
if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) if (strcmp (bfd_section_name (sec), ".scommon") == 0)
{ {
*retval = SHN_TIC6X_SCOMMON; *retval = SHN_TIC6X_SCOMMON;
return TRUE; 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) if (s == htab->elf.splt && s->size > 0)
s->size = (s->size + 31) & ~(bfd_vma)31; 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 if (s->size != 0
&& s != htab->elf.srelplt) && s != htab->elf.srelplt)
@ -3992,10 +3992,10 @@ elf32_tic6x_adjust_exidx_size (asection *exidx_sec, int adjust)
if (!exidx_sec->rawsize) if (!exidx_sec->rawsize)
exidx_sec->rawsize = exidx_sec->size; 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; out_sec = exidx_sec->output_section;
/* Adjust size of 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. */ /* Insert an EXIDX_CANTUNWIND marker at the end of a section. */

View File

@ -1229,13 +1229,13 @@ tilepro_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
(bed->dynamic_sec_flags (bed->dynamic_sec_flags
| SEC_READONLY)); | SEC_READONLY));
if (s == NULL 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; return FALSE;
htab->srelgot = s; htab->srelgot = s;
s = s_got = bfd_make_section_with_flags (abfd, ".got", flags); s = s_got = bfd_make_section_with_flags (abfd, ".got", flags);
if (s == NULL 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; return FALSE;
htab->sgot = s; 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); s = bfd_make_section_with_flags (abfd, ".got.plt", flags);
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->sgotplt = s; 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 name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (r_type) switch (r_type)

View File

@ -177,7 +177,7 @@ v850_elf_check_relocs (bfd *abfd,
if (h && h->root.type == bfd_link_hash_common if (h && h->root.type == bfd_link_hash_common
&& h->root.u.c.p && 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; asection * section;
@ -2269,7 +2269,7 @@ v850_elf_relocate_section (bfd *output_bfd,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch ((int) r) switch ((int) r)
@ -2372,11 +2372,11 @@ v850_elf_make_note_section (bfd * abfd)
if (s == NULL) if (s == NULL)
return NULL; return NULL;
if (!bfd_set_section_alignment (abfd, s, 2)) if (!bfd_set_section_alignment (s, 2))
return NULL; return NULL;
/* Allocate space for all known notes. */ /* 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; return NULL;
data = bfd_zalloc (abfd, NUM_V850_NOTES * SIZEOF_V850_NOTE); 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) if ((inotes = bfd_get_section_by_name (ibfd, V850_NOTE_SECNAME)) == NULL)
return; 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 * icont;
bfd_byte * ocont; bfd_byte * ocont;
@ -2457,7 +2457,7 @@ v850_elf_copy_notes (bfd *ibfd, bfd *obfd)
return; return;
/* Copy/overwrite notes from the input to the output. */ /* 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 * icont;
bfd_byte * ocont; 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) if ((icont = elf_section_data (inotes)->this_hdr.contents) == NULL)
BFD_ASSERT (bfd_malloc_and_get_section (ibfd, inotes, & icont)); 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) if (notes == NULL || notes->contents == NULL)
return; 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++) for (id = V850_NOTE_ALIGNMENT; id <= NUM_V850_NOTES; id++)
print_v850_note (abfd, file, notes->contents, 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, asection *sec,
int *retval) int *retval)
{ {
if (strcmp (bfd_get_section_name (abfd, sec), ".scommon") == 0) if (strcmp (bfd_section_name (sec), ".scommon") == 0)
*retval = SHN_V850_SCOMMON; *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; *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; *retval = SHN_V850_ZCOMMON;
else else
return FALSE; return FALSE;
@ -3162,10 +3162,9 @@ v850_elf_section_from_shdr (bfd *abfd,
case SHT_V850_SCOMMON: case SHT_V850_SCOMMON:
case SHT_V850_TCOMMON: case SHT_V850_TCOMMON:
case SHT_V850_ZCOMMON: case SHT_V850_ZCOMMON:
if (! bfd_set_section_flags (abfd, hdr->bfd_section, if (!bfd_set_section_flags (hdr->bfd_section,
(bfd_get_section_flags (abfd, (bfd_section_flags (hdr->bfd_section)
hdr->bfd_section) | SEC_IS_COMMON)))
| SEC_IS_COMMON)))
return FALSE; return FALSE;
} }
@ -3182,7 +3181,7 @@ v850_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
{ {
const char * name; const char * name;
name = bfd_get_section_name (abfd, sec); name = bfd_section_name (sec);
if (strcmp (name, ".scommon") == 0) if (strcmp (name, ".scommon") == 0)
hdr->sh_type = SHT_V850_SCOMMON; hdr->sh_type = SHT_V850_SCOMMON;

View File

@ -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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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) 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 section, then we probably need a DT_TEXTREL
entry. .rela.plt is actually associated with entry. .rela.plt is actually associated with
.got.plt, which is never readonly. */ .got.plt, which is never readonly. */
outname = bfd_get_section_name (output_bfd, outname = bfd_section_name (s->output_section);
s->output_section);
target = bfd_get_section_by_name (output_bfd, outname + 5); target = bfd_get_section_by_name (output_bfd, outname + 5);
if (target != NULL if (target != NULL
&& (target->flags & SEC_READONLY) != 0 && (target->flags & SEC_READONLY) != 0
@ -1633,7 +1632,7 @@ elf_vax_relocate_section (bfd *output_bfd,
if (name == NULL) if (name == NULL)
return FALSE; return FALSE;
if (*name == '\0') if (*name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
info->callbacks->reloc_overflow info->callbacks->reloc_overflow
(info, (h ? &h->root : NULL), name, howto->name, (info, (h ? &h->root : NULL), name, howto->name,

View File

@ -599,7 +599,7 @@ visium_elf_relocate_section (bfd *output_bfd,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {

View File

@ -471,7 +471,7 @@ xstormy16_elf_check_relocs (bfd *abfd,
flags); flags);
elf_hash_table (info)->splt = splt; elf_hash_table (info)->splt = splt;
if (splt == NULL if (splt == NULL
|| ! bfd_set_section_alignment (dynobj, splt, 1)) || !bfd_set_section_alignment (splt, 1))
return FALSE; return FALSE;
} }
@ -834,7 +834,7 @@ xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (ELF32_R_TYPE (rel->r_info)) switch (ELF32_R_TYPE (rel->r_info))

View File

@ -1320,21 +1320,21 @@ elf_xtensa_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
/* Mark the ".got.plt" section READONLY. */ /* Mark the ".got.plt" section READONLY. */
if (htab->elf.sgotplt == NULL if (htab->elf.sgotplt == NULL
|| ! bfd_set_section_flags (dynobj, htab->elf.sgotplt, flags)) || !bfd_set_section_flags (htab->elf.sgotplt, flags))
return FALSE; return FALSE;
/* Create ".got.loc" (literal tables for use by dynamic linker). */ /* Create ".got.loc" (literal tables for use by dynamic linker). */
htab->sgotloc = bfd_make_section_anyway_with_flags (dynobj, ".got.loc", htab->sgotloc = bfd_make_section_anyway_with_flags (dynobj, ".got.loc",
flags); flags);
if (htab->sgotloc == NULL if (htab->sgotloc == NULL
|| ! bfd_set_section_alignment (dynobj, htab->sgotloc, 2)) || !bfd_set_section_alignment (htab->sgotloc, 2))
return FALSE; return FALSE;
/* Create ".xt.lit.plt" (literal table for ".got.plt*"). */ /* Create ".xt.lit.plt" (literal table for ".got.plt*"). */
htab->spltlittbl = bfd_make_section_anyway_with_flags (dynobj, ".xt.lit.plt", htab->spltlittbl = bfd_make_section_anyway_with_flags (dynobj, ".xt.lit.plt",
noalloc_flags); noalloc_flags);
if (htab->spltlittbl == NULL if (htab->spltlittbl == NULL
|| ! bfd_set_section_alignment (dynobj, htab->spltlittbl, 2)) || !bfd_set_section_alignment (htab->spltlittbl, 2))
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -1366,14 +1366,14 @@ add_extra_plt_sections (struct bfd_link_info *info, int count)
sprintf (sname, ".plt.%u", chunk); sprintf (sname, ".plt.%u", chunk);
s = bfd_make_section_anyway_with_flags (dynobj, sname, flags | SEC_CODE); s = bfd_make_section_anyway_with_flags (dynobj, sname, flags | SEC_CODE);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (dynobj, s, 2)) || !bfd_set_section_alignment (s, 2))
return FALSE; return FALSE;
sname = (char *) bfd_malloc (14); sname = (char *) bfd_malloc (14);
sprintf (sname, ".got.plt.%u", chunk); sprintf (sname, ".got.plt.%u", chunk);
s = bfd_make_section_anyway_with_flags (dynobj, sname, flags); s = bfd_make_section_anyway_with_flags (dynobj, sname, flags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (dynobj, s, 2)) || !bfd_set_section_alignment (s, 2))
return FALSE; 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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")) if (CONST_STRNEQ (name, ".rela"))
{ {
@ -2687,7 +2687,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
if (r_symndx != STN_UNDEF if (r_symndx != STN_UNDEF
@ -11244,7 +11244,7 @@ xtensa_make_property_section (asection *sec, const char *base_name)
if (! prop_sec) if (! prop_sec)
{ {
flagword flags = (SEC_RELOC | SEC_HAS_CONTENTS | SEC_READONLY); 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)); & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES));
prop_sec = bfd_make_section_anyway_with_flags prop_sec = bfd_make_section_anyway_with_flags

View File

@ -1168,9 +1168,8 @@ elf64_alpha_section_from_shdr (bfd *abfd,
if (hdr->sh_type == SHT_ALPHA_DEBUG) if (hdr->sh_type == SHT_ALPHA_DEBUG)
{ {
if (! bfd_set_section_flags (abfd, newsect, if (!bfd_set_section_flags (newsect,
(bfd_get_section_flags (abfd, newsect) bfd_section_flags (newsect) | SEC_DEBUGGING))
| SEC_DEBUGGING)))
return FALSE; return FALSE;
} }
@ -1196,7 +1195,7 @@ elf64_alpha_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
{ {
register const char *name; register const char *name;
name = bfd_get_section_name (abfd, sec); name = bfd_section_name (sec);
if (strcmp (name, ".mdebug") == 0) if (strcmp (name, ".mdebug") == 0)
{ {
@ -1270,7 +1269,7 @@ elf64_alpha_create_got_section (bfd *abfd,
| SEC_LINKER_CREATED); | SEC_LINKER_CREATED);
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3)) || !bfd_set_section_alignment (s, 3))
return FALSE; return FALSE;
alpha_elf_tdata (abfd)->got = s; 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)); | (elf64_alpha_use_secureplt ? SEC_READONLY : 0));
s = bfd_make_section_anyway_with_flags (abfd, ".plt", flags); s = bfd_make_section_anyway_with_flags (abfd, ".plt", flags);
elf_hash_table (info)->splt = s; 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; return FALSE;
/* Define the symbol _PROCEDURE_LINKAGE_TABLE_ at the start of the /* 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); | SEC_LINKER_CREATED | SEC_READONLY);
s = bfd_make_section_anyway_with_flags (abfd, ".rela.plt", flags); s = bfd_make_section_anyway_with_flags (abfd, ".rela.plt", flags);
elf_hash_table (info)->srelplt = s; 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; return FALSE;
if (elf64_alpha_use_secureplt) 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; flags = SEC_ALLOC | SEC_LINKER_CREATED;
s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags); s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
elf_hash_table (info)->sgotplt = s; 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; 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); s = bfd_make_section_anyway_with_flags (abfd, ".rela.got", flags);
elf_hash_table (info)->srelgot = s; elf_hash_table (info)->srelgot = s;
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3)) || !bfd_set_section_alignment (s, 3))
return FALSE; return FALSE;
/* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the /* 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; h->esym.asym.sc = scUndefined;
else else
{ {
name = bfd_section_name (output_section->owner, output_section); name = bfd_section_name (output_section);
if (strcmp (name, ".text") == 0) if (strcmp (name, ".text") == 0)
h->esym.asym.sc = scText; 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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")) if (CONST_STRNEQ (name, ".rela"))
{ {
@ -4508,7 +4507,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (name == NULL) if (name == NULL)
name = _("<unknown>"); name = _("<unknown>");
else if (name[0] == 0) else if (name[0] == 0)
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
_bfd_error_handler _bfd_error_handler
/* xgettext:c-format */ /* xgettext:c-format */
@ -4779,7 +4778,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
if (name == NULL) if (name == NULL)
return FALSE; return FALSE;
if (*name == '\0') if (*name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
(*info->callbacks->reloc_overflow) (*info->callbacks->reloc_overflow)
(info, (h ? &h->root.root : NULL), name, howto->name, (info, (h ? &h->root.root : NULL), name, howto->name,

View File

@ -407,7 +407,7 @@ bpf_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
name = bfd_elf_string_from_elf_section name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name); (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 else
{ {

View File

@ -422,7 +422,7 @@ get_reloc_section (bfd *abfd,
| SEC_LINKER_CREATED | SEC_LINKER_CREATED
| SEC_READONLY)); | SEC_READONLY));
if (srel == NULL if (srel == NULL
|| !bfd_set_section_alignment (dynobj, srel, 3)) || !bfd_set_section_alignment (srel, 3))
return FALSE; return FALSE;
} }
@ -1159,7 +1159,7 @@ get_opd (bfd *abfd,
| SEC_IN_MEMORY | SEC_IN_MEMORY
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (!opd if (!opd
|| !bfd_set_section_alignment (abfd, opd, 3)) || !bfd_set_section_alignment (opd, 3))
{ {
BFD_ASSERT (0); BFD_ASSERT (0);
return FALSE; return FALSE;
@ -1195,7 +1195,7 @@ get_plt (bfd *abfd,
| SEC_IN_MEMORY | SEC_IN_MEMORY
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (!plt if (!plt
|| !bfd_set_section_alignment (abfd, plt, 3)) || !bfd_set_section_alignment (plt, 3))
{ {
BFD_ASSERT (0); BFD_ASSERT (0);
return FALSE; return FALSE;
@ -1231,7 +1231,7 @@ get_dlt (bfd *abfd,
| SEC_IN_MEMORY | SEC_IN_MEMORY
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (!dlt if (!dlt
|| !bfd_set_section_alignment (abfd, dlt, 3)) || !bfd_set_section_alignment (dlt, 3))
{ {
BFD_ASSERT (0); BFD_ASSERT (0);
return FALSE; return FALSE;
@ -1267,7 +1267,7 @@ get_stub (bfd *abfd,
| SEC_READONLY | SEC_READONLY
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (!stub if (!stub
|| !bfd_set_section_alignment (abfd, stub, 3)) || !bfd_set_section_alignment (stub, 3))
{ {
BFD_ASSERT (0); BFD_ASSERT (0);
return FALSE; return FALSE;
@ -1347,7 +1347,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd,
| SEC_READONLY | SEC_READONLY
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3)) || !bfd_set_section_alignment (s, 3))
return FALSE; return FALSE;
hppa_info->dlt_rel_sec = s; hppa_info->dlt_rel_sec = s;
@ -1358,7 +1358,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd,
| SEC_READONLY | SEC_READONLY
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3)) || !bfd_set_section_alignment (s, 3))
return FALSE; return FALSE;
hppa_info->plt_rel_sec = s; hppa_info->plt_rel_sec = s;
@ -1369,7 +1369,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd,
| SEC_READONLY | SEC_READONLY
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3)) || !bfd_set_section_alignment (s, 3))
return FALSE; return FALSE;
hppa_info->other_rel_sec = s; hppa_info->other_rel_sec = s;
@ -1380,7 +1380,7 @@ elf64_hppa_create_dynamic_sections (bfd *abfd,
| SEC_READONLY | SEC_READONLY
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3)) || !bfd_set_section_alignment (s, 3))
return FALSE; return FALSE;
hppa_info->opd_rel_sec = s; 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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) 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 entry. The entries in the .rela.plt section
really apply to the .got section, which we really apply to the .got section, which we
created ourselves and so know is not readonly. */ created ourselves and so know is not readonly. */
outname = bfd_get_section_name (output_bfd, outname = bfd_section_name (sec->output_section);
sec->output_section);
target = bfd_get_section_by_name (output_bfd, outname + 4); target = bfd_get_section_by_name (output_bfd, outname + 4);
if (target != NULL if (target != NULL
&& (target->flags & SEC_READONLY) != 0 && (target->flags & SEC_READONLY) != 0
@ -3938,7 +3937,7 @@ elf64_hppa_relocate_section (bfd *output_bfd,
if (sym_name == NULL) if (sym_name == NULL)
return FALSE; return FALSE;
if (*sym_name == '\0') if (*sym_name == '\0')
sym_name = bfd_section_name (input_bfd, sym_sec); sym_name = bfd_section_name (sym_sec);
} }
(*info->callbacks->reloc_overflow) (*info->callbacks->reloc_overflow)

View File

@ -840,7 +840,7 @@ elf64_ia64_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr,
{ {
const char *name; const char *name;
name = bfd_get_section_name (abfd, sec); name = bfd_section_name (sec);
if (is_unwind_section_name (abfd, name)) 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", s = bfd_make_section_anyway_with_flags (abfd, ".dynamic",
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
s = bfd_make_section_anyway_with_flags (abfd, ".plt", flags | SEC_READONLY); s = bfd_make_section_anyway_with_flags (abfd, ".plt", flags | SEC_READONLY);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
ia64_info->root.splt = s; ia64_info->root.splt = s;
@ -1307,7 +1307,7 @@ elf64_ia64_create_dynamic_sections (bfd *abfd,
| SEC_IN_MEMORY | SEC_IN_MEMORY
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 0)) || !bfd_set_section_alignment (s, 0))
return FALSE; return FALSE;
/* Create a fixup section. */ /* Create a fixup section. */
@ -1317,7 +1317,7 @@ elf64_ia64_create_dynamic_sections (bfd *abfd,
| SEC_IN_MEMORY | SEC_IN_MEMORY
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3)) || !bfd_set_section_alignment (s, 3))
return FALSE; return FALSE;
ia64_info->fixups_sec = s; ia64_info->fixups_sec = s;
@ -1328,7 +1328,7 @@ elf64_ia64_create_dynamic_sections (bfd *abfd,
| SEC_IN_MEMORY | SEC_IN_MEMORY
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3)) || !bfd_set_section_alignment (s, 3))
return FALSE; return FALSE;
s->size = sizeof (struct elf64_vms_transfer); s->size = sizeof (struct elf64_vms_transfer);
ia64_info->transfer_sec = s; ia64_info->transfer_sec = s;
@ -1340,7 +1340,7 @@ elf64_ia64_create_dynamic_sections (bfd *abfd,
| SEC_IN_MEMORY | SEC_IN_MEMORY
| SEC_READONLY)); | SEC_READONLY));
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, 3)) || !bfd_set_section_alignment (s, 3))
return FALSE; return FALSE;
ia64_info->note_sec = s; 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", got = bfd_make_section_anyway_with_flags (dynobj, ".got",
flags | SEC_SMALL_DATA); flags | SEC_SMALL_DATA);
if (got == NULL if (got == NULL
|| !bfd_set_section_alignment (dynobj, got, 3)) || !bfd_set_section_alignment (got, 3))
return NULL; return NULL;
ia64_info->root.sgot = got; ia64_info->root.sgot = got;
} }
@ -1774,7 +1774,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info,
: SEC_READONLY) : SEC_READONLY)
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (!fptr if (!fptr
|| !bfd_set_section_alignment (dynobj, fptr, 4)) || !bfd_set_section_alignment (fptr, 4))
{ {
BFD_ASSERT (0); BFD_ASSERT (0);
return NULL; return NULL;
@ -1792,7 +1792,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info,
| SEC_LINKER_CREATED | SEC_LINKER_CREATED
| SEC_READONLY)); | SEC_READONLY));
if (fptr_rel == NULL if (fptr_rel == NULL
|| !bfd_set_section_alignment (dynobj, fptr_rel, 3)) || !bfd_set_section_alignment (fptr_rel, 3))
{ {
BFD_ASSERT (0); BFD_ASSERT (0);
return NULL; return NULL;
@ -1827,7 +1827,7 @@ get_pltoff (bfd *abfd, struct elf64_ia64_link_hash_table *ia64_info)
| SEC_SMALL_DATA | SEC_SMALL_DATA
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (!pltoff if (!pltoff
|| !bfd_set_section_alignment (dynobj, pltoff, 4)) || !bfd_set_section_alignment (pltoff, 4))
{ {
BFD_ASSERT (0); BFD_ASSERT (0);
return NULL; return NULL;
@ -1855,11 +1855,9 @@ get_reloc_section (bfd *abfd,
return NULL; return NULL;
BFD_ASSERT ((CONST_STRNEQ (srel_name, ".rela") BFD_ASSERT ((CONST_STRNEQ (srel_name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec), && strcmp (bfd_section_name (sec), srel_name+5) == 0)
srel_name+5) == 0)
|| (CONST_STRNEQ (srel_name, ".rel") || (CONST_STRNEQ (srel_name, ".rel")
&& strcmp (bfd_get_section_name (abfd, sec), && strcmp (bfd_section_name (sec), srel_name+4) == 0));
srel_name+4) == 0));
dynobj = ia64_info->root.dynobj; dynobj = ia64_info->root.dynobj;
if (!dynobj) if (!dynobj)
@ -1875,7 +1873,7 @@ get_reloc_section (bfd *abfd,
| SEC_LINKER_CREATED | SEC_LINKER_CREATED
| SEC_READONLY)); | SEC_READONLY));
if (srel == NULL if (srel == NULL
|| !bfd_set_section_alignment (dynobj, srel, 3)) || !bfd_set_section_alignment (srel, 3))
return NULL; 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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) if (strcmp (name, ".got.plt") == 0)
strip = FALSE; strip = FALSE;
@ -4501,8 +4499,8 @@ elf64_vms_section_from_shdr (bfd *abfd,
{ {
asection *newsect = hdr->bfd_section; asection *newsect = hdr->bfd_section;
if (! bfd_set_section_flags if (!bfd_set_section_flags (newsect,
(abfd, newsect, bfd_get_section_flags (abfd, newsect) | secflags)) bfd_section_flags (newsect) | secflags))
return FALSE; return FALSE;
} }
@ -4629,7 +4627,7 @@ elf64_vms_section_processing (bfd *abfd ATTRIBUTE_UNUSED,
{ {
if (hdr->bfd_section != NULL) 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) if (strcmp (name, ".text") == 0)
hdr->sh_flags |= SHF_IA_64_VMS_SHARED; 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; 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) ".IA_64.unwind_info") == 0)
unwind_info_sect_idx = elf_section_data (s)->this_idx; unwind_info_sect_idx = elf_section_data (s)->this_idx;

View File

@ -1414,7 +1414,7 @@ mmix_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
symtab_hdr->sh_link, symtab_hdr->sh_link,
sym->st_name); sym->st_name);
if (name == NULL) if (name == NULL)
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
else else
{ {
@ -1606,9 +1606,9 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section,
return bfd_reloc_undefined; return bfd_reloc_undefined;
/* Check that we're not relocating against a register symbol. */ /* 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 MMIX_REG_CONTENTS_SECTION_NAME) == 0
|| strcmp (bfd_get_section_name (symsec->owner, symsec), || strcmp (bfd_section_name (symsec),
MMIX_REG_SECTION_NAME) == 0) MMIX_REG_SECTION_NAME) == 0)
{ {
/* Note: This is separated out into two messages in order /* 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) if (symsec == NULL)
return bfd_reloc_undefined; 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) MMIX_REG_CONTENTS_SECTION_NAME) == 0)
{ {
if ((srel & 7) != 0 || srel < 32*8 || srel > 255*8) 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; srel /= 8;
} }
else if (strcmp (bfd_get_section_name (symsec->owner, symsec), else if (strcmp (bfd_section_name (symsec),
MMIX_REG_SECTION_NAME) == 0) MMIX_REG_SECTION_NAME) == 0)
{ {
if (srel < 0 || srel > 255) if (srel < 0 || srel > 255)
@ -1704,9 +1704,9 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section,
accidentally handling it. */ accidentally handling it. */
if (!bfd_is_abs_section (symsec) if (!bfd_is_abs_section (symsec)
&& !bfd_is_und_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 MMIX_REG_CONTENTS_SECTION_NAME) != 0
&& strcmp (bfd_get_section_name (symsec->owner, symsec), && strcmp (bfd_section_name (symsec),
MMIX_REG_SECTION_NAME) != 0) MMIX_REG_SECTION_NAME) != 0)
{ {
_bfd_error_handler _bfd_error_handler
@ -1722,10 +1722,8 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section,
first_global = 255; first_global = 255;
else else
{ {
first_global first_global = bfd_section_vma (regsec) / 8;
= bfd_get_section_vma (input_section->output_section->owner, if (strcmp (bfd_section_name (symsec),
regsec) / 8;
if (strcmp (bfd_get_section_name (symsec->owner, symsec),
MMIX_REG_CONTENTS_SECTION_NAME) == 0) MMIX_REG_CONTENTS_SECTION_NAME) == 0)
{ {
if ((srel & 7) != 0 || srel < 32*8 || srel > 255*8) 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 those flags, as that is what currently happens for usual
GREG allocations, and that works. */ GREG allocations, and that works. */
if (allocated_gregs_section == NULL if (allocated_gregs_section == NULL
|| !bfd_set_section_alignment (bpo_greg_owner, || !bfd_set_section_alignment (allocated_gregs_section, 3))
allocated_gregs_section,
3))
return FALSE; return FALSE;
gregdata = (struct bpo_greg_section_info *) gregdata = (struct bpo_greg_section_info *)
@ -2123,7 +2119,7 @@ mmix_elf_section_from_bfd_section (bfd * abfd ATTRIBUTE_UNUSED,
asection * sec, asection * sec,
int * retval) 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; *retval = SHN_REGISTER;
else else
return FALSE; return FALSE;
@ -2222,7 +2218,7 @@ mmix_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (reg_section != NULL) if (reg_section != NULL)
{ {
/* FIXME: Pass error state gracefully. */ /* 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")); _bfd_abort (__FILE__, __LINE__, _("register section has contents\n"));
/* Really remove the section, if it hasn't already been done. */ /* 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. */ /* Set the zeroth-order estimate for the GREGs size. */
gregs_size = n_gregs * 8; 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; return FALSE;
/* Allocate and set up the GREG arrays. They're filled in at relaxation /* Allocate and set up the GREG arrays. They're filled in at relaxation

View File

@ -3487,7 +3487,7 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info)
htab->sfpr = bfd_make_section_anyway_with_flags (dynobj, ".sfpr", htab->sfpr = bfd_make_section_anyway_with_flags (dynobj, ".sfpr",
flags); flags);
if (htab->sfpr == NULL if (htab->sfpr == NULL
|| !bfd_set_section_alignment (dynobj, htab->sfpr, 2)) || !bfd_set_section_alignment (htab->sfpr, 2))
return FALSE; 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", htab->glink = bfd_make_section_anyway_with_flags (dynobj, ".glink",
flags); flags);
if (htab->glink == NULL if (htab->glink == NULL
|| !bfd_set_section_alignment (dynobj, htab->glink, 3)) || !bfd_set_section_alignment (htab->glink, 3))
return FALSE; return FALSE;
/* The part of .glink used by global entry stubs, separate so that /* 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", htab->global_entry = bfd_make_section_anyway_with_flags (dynobj, ".glink",
flags); flags);
if (htab->global_entry == NULL if (htab->global_entry == NULL
|| !bfd_set_section_alignment (dynobj, htab->global_entry, 2)) || !bfd_set_section_alignment (htab->global_entry, 2))
return FALSE; return FALSE;
if (!info->no_ld_generated_unwind_info) if (!info->no_ld_generated_unwind_info)
@ -3517,14 +3517,14 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info)
".eh_frame", ".eh_frame",
flags); flags);
if (htab->glink_eh_frame == NULL 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; return FALSE;
} }
flags = SEC_ALLOC | SEC_LINKER_CREATED; flags = SEC_ALLOC | SEC_LINKER_CREATED;
htab->elf.iplt = bfd_make_section_anyway_with_flags (dynobj, ".iplt", flags); htab->elf.iplt = bfd_make_section_anyway_with_flags (dynobj, ".iplt", flags);
if (htab->elf.iplt == NULL if (htab->elf.iplt == NULL
|| !bfd_set_section_alignment (dynobj, htab->elf.iplt, 3)) || !bfd_set_section_alignment (htab->elf.iplt, 3))
return FALSE; return FALSE;
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
@ -3532,7 +3532,7 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info)
htab->elf.irelplt htab->elf.irelplt
= bfd_make_section_anyway_with_flags (dynobj, ".rela.iplt", flags); = bfd_make_section_anyway_with_flags (dynobj, ".rela.iplt", flags);
if (htab->elf.irelplt == NULL if (htab->elf.irelplt == NULL
|| !bfd_set_section_alignment (dynobj, htab->elf.irelplt, 3)) || !bfd_set_section_alignment (htab->elf.irelplt, 3))
return FALSE; return FALSE;
/* Create branch lookup table for plt_branch stubs. */ /* 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", htab->brlt = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt",
flags); flags);
if (htab->brlt == NULL if (htab->brlt == NULL
|| !bfd_set_section_alignment (dynobj, htab->brlt, 3)) || !bfd_set_section_alignment (htab->brlt, 3))
return FALSE; return FALSE;
/* Local plt entries, put in .branch_lt but a separate section for /* 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", htab->pltlocal = bfd_make_section_anyway_with_flags (dynobj, ".branch_lt",
flags); flags);
if (htab->pltlocal == NULL if (htab->pltlocal == NULL
|| !bfd_set_section_alignment (dynobj, htab->pltlocal, 3)) || !bfd_set_section_alignment (htab->pltlocal, 3))
return FALSE; return FALSE;
if (!bfd_link_pic (info)) if (!bfd_link_pic (info))
@ -3560,13 +3560,13 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info)
htab->relbrlt htab->relbrlt
= bfd_make_section_anyway_with_flags (dynobj, ".rela.branch_lt", flags); = bfd_make_section_anyway_with_flags (dynobj, ".rela.branch_lt", flags);
if (htab->relbrlt == NULL if (htab->relbrlt == NULL
|| !bfd_set_section_alignment (dynobj, htab->relbrlt, 3)) || !bfd_set_section_alignment (htab->relbrlt, 3))
return FALSE; return FALSE;
htab->relpltlocal htab->relpltlocal
= bfd_make_section_anyway_with_flags (dynobj, ".rela.branch_lt", flags); = bfd_make_section_anyway_with_flags (dynobj, ".rela.branch_lt", flags);
if (htab->relpltlocal == NULL if (htab->relpltlocal == NULL
|| !bfd_set_section_alignment (dynobj, htab->relpltlocal, 3)) || !bfd_set_section_alignment (htab->relpltlocal, 3))
return FALSE; return FALSE;
return TRUE; 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); got = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
if (!got if (!got
|| !bfd_set_section_alignment (abfd, got, 3)) || !bfd_set_section_alignment (got, 3))
return FALSE; return FALSE;
relgot = bfd_make_section_anyway_with_flags (abfd, ".rela.got", relgot = bfd_make_section_anyway_with_flags (abfd, ".rela.got",
flags | SEC_READONLY); flags | SEC_READONLY);
if (!relgot if (!relgot
|| !bfd_set_section_alignment (abfd, relgot, 3)) || !bfd_set_section_alignment (relgot, 3))
return FALSE; return FALSE;
ppc64_elf_tdata (abfd)->got = got; ppc64_elf_tdata (abfd)->got = got;

View File

@ -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 /* Strip this section if we don't need it; see the
comment below. */ 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) if (s->size != 0 && s != htab->elf.srelplt)
relocs = TRUE; relocs = TRUE;
@ -3203,7 +3203,7 @@ elf_s390_relocate_section (bfd *output_bfd,
if (name == NULL) if (name == NULL)
return FALSE; return FALSE;
if (*name == '\0') if (*name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
if (r == bfd_reloc_overflow) if (r == bfd_reloc_overflow)

View File

@ -748,7 +748,7 @@ elf64_sparc_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
{ {
const char *name; const char *name;
name = bfd_get_section_name (abfd, sec); name = bfd_section_name (sec);
if (strcmp (name, ".stab") == 0) if (strcmp (name, ".stab") == 0)
{ {

View File

@ -3989,7 +3989,7 @@ check_relocation_error:
if (name == NULL) if (name == NULL)
return FALSE; return FALSE;
if (*name == '\0') if (*name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
if (r == bfd_reloc_overflow) if (r == bfd_reloc_overflow)

View File

@ -162,13 +162,13 @@ _bfd_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
(bed->dynamic_sec_flags (bed->dynamic_sec_flags
| SEC_READONLY)); | SEC_READONLY));
if (s == NULL 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; return FALSE;
htab->srelgot = s; htab->srelgot = s;
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
if (s == NULL 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; return FALSE;
htab->sgot = s; 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); s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->sgotplt = s; 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", s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version_d",
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version", s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version",
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 1)) || !bfd_set_section_alignment (s, 1))
return FALSE; return FALSE;
s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version_r", s = bfd_make_section_anyway_with_flags (abfd, ".gnu.version_r",
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
s = bfd_make_section_anyway_with_flags (abfd, ".dynsym", s = bfd_make_section_anyway_with_flags (abfd, ".dynsym",
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
elf_hash_table (info)->dynsym = s; 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); s = bfd_make_section_anyway_with_flags (abfd, ".dynamic", flags);
if (s == NULL 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; return FALSE;
/* The special symbol _DYNAMIC is always set to the start of the /* 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", s = bfd_make_section_anyway_with_flags (abfd, ".hash",
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry; 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", s = bfd_make_section_anyway_with_flags (abfd, ".gnu.hash",
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
/* For 64-bit ELF, .gnu.hash is a non-uniform entity size section: /* 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 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); s = bfd_make_section_anyway_with_flags (abfd, ".plt", pltflags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
htab->splt = s; htab->splt = s;
@ -415,7 +414,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
? ".rela.plt" : ".rel.plt"), ? ".rela.plt" : ".rel.plt"),
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
htab->srelplt = s; htab->srelplt = s;
@ -466,7 +465,7 @@ _bfd_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
? ".rela.bss" : ".rel.bss"), ? ".rela.bss" : ".rel.bss"),
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL 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; return FALSE;
htab->srelbss = s; 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"), ? ".rela.data.rel.ro" : ".rel.data.rel.ro"),
flags | SEC_READONLY)); flags | SEC_READONLY));
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->sreldynrelro = s; 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 know the symbol alignment requirement, we start with the
maximum alignment and check low bits of the symbol address maximum alignment and check low bits of the symbol address
for the minimum alignment. */ 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; mask = ((bfd_vma) 1 << power_of_two) - 1;
while ((h->root.u.def.value & mask) != 0) 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; --power_of_two;
} }
if (power_of_two > bfd_get_section_alignment (dynbss->owner, if (power_of_two > bfd_section_alignment (dynbss))
dynbss))
{ {
/* Adjust the section alignment if needed. */ /* Adjust the section alignment if needed. */
if (! bfd_set_section_alignment (dynbss->owner, dynbss, if (!bfd_set_section_alignment (dynbss, power_of_two))
power_of_two))
return FALSE; return FALSE;
} }
@ -3949,7 +3945,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
{ {
const char *name; const char *name;
name = bfd_get_section_name (abfd, s); name = bfd_section_name (s);
if (CONST_STRNEQ (name, ".gnu.warning.")) if (CONST_STRNEQ (name, ".gnu.warning."))
{ {
char *msg; char *msg;
@ -11393,8 +11389,7 @@ elf_reloc_link_order (bfd *output_bfd,
case bfd_reloc_overflow: case bfd_reloc_overflow:
if (link_order->type == bfd_section_reloc_link_order) if (link_order->type == bfd_section_reloc_link_order)
sym_name = bfd_section_name (output_bfd, sym_name = bfd_section_name (link_order->u.reloc.p->u.section);
link_order->u.reloc.p->u.section);
else else
sym_name = link_order->u.reloc.p->u.name; sym_name = link_order->u.reloc.p->u.name;
(*info->callbacks->reloc_overflow) (info, NULL, sym_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); 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. */ /* Skip this section later on. */
o->map_head.link_order = NULL; o->map_head.link_order = NULL;
if (attr_size) 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) 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)) && init_reloc_cookie_rels (&cookie, info, ibfd, sec))
{ {
_bfd_elf_parse_eh_frame_entry (info, sec, &cookie); _bfd_elf_parse_eh_frame_entry (info, sec, &cookie);
@ -14444,7 +14439,7 @@ get_dynamic_reloc_section_name (bfd * abfd,
bfd_boolean is_rela) bfd_boolean is_rela)
{ {
char *name; 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"; const char *prefix = is_rela ? ".rela" : ".rel";
if (old_name == NULL) 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 section named "auto" we'll get ".relauto" which is
seen to be a .rela section. */ seen to be a .rela section. */
elf_section_type (reloc_sec) = is_rela ? SHT_RELA : SHT_REL; 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; reloc_sec = NULL;
} }
} }

View File

@ -6790,7 +6790,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
if (r_symndx != 0 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) 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))
== (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
only_data_sections = FALSE; only_data_sections = FALSE;
@ -7519,13 +7519,13 @@ aarch64_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
(bed->dynamic_sec_flags (bed->dynamic_sec_flags
| SEC_READONLY)); | SEC_READONLY));
if (s == NULL 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; return FALSE;
htab->srelgot = s; htab->srelgot = s;
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
if (s == NULL 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; return FALSE;
htab->sgot = s; htab->sgot = s;
htab->sgot->size += GOT_ENTRY_SIZE; 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); s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->sgotplt = s; 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 /* Strip this section if we don't need it; see the
comment below. */ 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) if (s->size != 0 && s != htab->root.srelplt)
relocs = TRUE; relocs = TRUE;

View File

@ -956,7 +956,7 @@ elfNN_ia64_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr,
{ {
const char *name; const char *name;
name = bfd_get_section_name (abfd, sec); name = bfd_section_name (sec);
if (is_unwind_section_name (abfd, name)) if (is_unwind_section_name (abfd, name))
{ {
@ -1561,11 +1561,10 @@ elfNN_ia64_create_dynamic_sections (bfd *abfd,
return FALSE; return FALSE;
{ {
flagword flags = bfd_get_section_flags (abfd, ia64_info->root.sgot); flagword flags = bfd_section_flags (ia64_info->root.sgot);
bfd_set_section_flags (abfd, ia64_info->root.sgot, bfd_set_section_flags (ia64_info->root.sgot, SEC_SMALL_DATA | flags);
SEC_SMALL_DATA | flags);
/* The .got section is always aligned at 8 bytes. */ /* 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; return FALSE;
} }
@ -1579,7 +1578,7 @@ elfNN_ia64_create_dynamic_sections (bfd *abfd,
| SEC_LINKER_CREATED | SEC_LINKER_CREATED
| SEC_READONLY)); | SEC_READONLY));
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, LOG_SECTION_ALIGN)) || !bfd_set_section_alignment (s, LOG_SECTION_ALIGN))
return FALSE; return FALSE;
ia64_info->rel_pltoff_sec = s; ia64_info->rel_pltoff_sec = s;
@ -1977,11 +1976,11 @@ get_got (bfd *abfd, struct bfd_link_info *info,
got = ia64_info->root.sgot; got = ia64_info->root.sgot;
/* The .got section is always aligned at 8 bytes. */ /* 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; return NULL;
flags = bfd_get_section_flags (abfd, got); flags = bfd_section_flags (got);
if (! bfd_set_section_flags (abfd, got, SEC_SMALL_DATA | flags)) if (!bfd_set_section_flags (got, SEC_SMALL_DATA | flags))
return NULL; return NULL;
} }
@ -2016,7 +2015,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info,
? 0 : SEC_READONLY) ? 0 : SEC_READONLY)
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (!fptr if (!fptr
|| !bfd_set_section_alignment (abfd, fptr, 4)) || !bfd_set_section_alignment (fptr, 4))
{ {
BFD_ASSERT (0); BFD_ASSERT (0);
return NULL; return NULL;
@ -2034,8 +2033,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info,
| SEC_LINKER_CREATED | SEC_LINKER_CREATED
| SEC_READONLY)); | SEC_READONLY));
if (fptr_rel == NULL if (fptr_rel == NULL
|| !bfd_set_section_alignment (abfd, fptr_rel, || !bfd_set_section_alignment (fptr_rel, LOG_SECTION_ALIGN))
LOG_SECTION_ALIGN))
{ {
BFD_ASSERT (0); BFD_ASSERT (0);
return NULL; return NULL;
@ -2071,7 +2069,7 @@ get_pltoff (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED,
| SEC_SMALL_DATA | SEC_SMALL_DATA
| SEC_LINKER_CREATED)); | SEC_LINKER_CREATED));
if (!pltoff if (!pltoff
|| !bfd_set_section_alignment (abfd, pltoff, 4)) || !bfd_set_section_alignment (pltoff, 4))
{ {
BFD_ASSERT (0); BFD_ASSERT (0);
return NULL; return NULL;
@ -2112,8 +2110,7 @@ get_reloc_section (bfd *abfd,
| SEC_LINKER_CREATED | SEC_LINKER_CREATED
| SEC_READONLY)); | SEC_READONLY));
if (srel == NULL if (srel == NULL
|| !bfd_set_section_alignment (dynobj, srel, || !bfd_set_section_alignment (srel, LOG_SECTION_ALIGN))
LOG_SECTION_ALIGN))
return NULL; 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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) if (strcmp (name, ".got.plt") == 0)
strip = FALSE; strip = FALSE;

View File

@ -310,13 +310,13 @@ riscv_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
(bed->dynamic_sec_flags (bed->dynamic_sec_flags
| SEC_READONLY)); | SEC_READONLY));
if (s == NULL 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; return FALSE;
htab->srelgot = s; htab->srelgot = s;
s = s_got = bfd_make_section_anyway_with_flags (abfd, ".got", flags); s = s_got = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
if (s == NULL 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; return FALSE;
htab->sgot = s; 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); s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->sgotplt = s; htab->sgotplt = s;
@ -1840,7 +1839,7 @@ riscv_elf_relocate_section (bfd *output_bfd,
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
resolved_to_zero = (h != NULL 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) 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))
== (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS))
only_data_sections = FALSE; only_data_sections = FALSE;

View File

@ -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")); _("%F%P: failed to create GNU property section\n"));
align = (bfd_get_mach (ebfd) & bfd_mach_aarch64_ilp32) ? 2 : 3; align = (bfd_get_mach (ebfd) & bfd_mach_aarch64_ilp32) ? 2 : 3;
if (!bfd_set_section_alignment (ebfd, sec, align)) if (!bfd_set_section_alignment (sec, align))
{ info->callbacks->einfo (_("%F%pA: failed to align section\n"),
info->callbacks->einfo (_("%F%pA: failed to align section\n"), sec);
sec);
}
elf_section_type (sec) = SHT_NOTE; elf_section_type (sec) = SHT_NOTE;
} }

View File

@ -1726,7 +1726,7 @@ section_allows_mips16_refs_p (asection *section)
{ {
const char *name; const char *name;
name = bfd_get_section_name (section->owner, section); name = bfd_section_name (section);
return (FN_STUB_P (name) return (FN_STUB_P (name)
|| CALL_STUB_P (name) || CALL_STUB_P (name)
|| CALL_FP_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. */ /* Make sure that any padding goes before the stub. */
align = input_section->alignment_power; align = input_section->alignment_power;
if (!bfd_set_section_alignment (s->owner, s, align)) if (!bfd_set_section_alignment (s, align))
return FALSE; return FALSE;
if (align > 3) if (align > 3)
s->size = (1 << align) - 8; 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; asection *input_section = stub->h->root.root.u.def.section;
s = htab->add_stub_section (".text", NULL, s = htab->add_stub_section (".text", NULL,
input_section->output_section); 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; return FALSE;
htab->strampoline = s; 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; h->esym.asym.sc = scUndefined;
else else
{ {
name = bfd_section_name (output_section->owner, output_section); name = bfd_section_name (output_section);
if (strcmp (name, ".text") == 0) if (strcmp (name, ".text") == 0)
h->esym.asym.sc = scText; 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_LINKER_CREATED
| SEC_READONLY)); | SEC_READONLY));
if (sreloc == NULL if (sreloc == NULL
|| ! bfd_set_section_alignment (dynobj, sreloc, || !bfd_set_section_alignment (sreloc,
MIPS_ELF_LOG_FILE_ALIGN (dynobj))) MIPS_ELF_LOG_FILE_ALIGN (dynobj)))
return NULL; return NULL;
} }
return sreloc; return sreloc;
@ -5201,8 +5201,7 @@ mips_elf_create_compact_rel_section
s = bfd_make_section_anyway_with_flags (abfd, ".compact_rel", flags); s = bfd_make_section_anyway_with_flags (abfd, ".compact_rel", flags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, MIPS_ELF_LOG_FILE_ALIGN (abfd)))
MIPS_ELF_LOG_FILE_ALIGN (abfd)))
return FALSE; return FALSE;
s->size = sizeof (Elf32_External_compact_rel); 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. */ in the function stub generation and in the linker script. */
s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); s = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, 4)) || !bfd_set_section_alignment (s, 4))
return FALSE; return FALSE;
htab->root.sgot = s; htab->root.sgot = s;
@ -5537,7 +5536,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
symtab_hdr->sh_link, symtab_hdr->sh_link,
sym->st_name); sym->st_name);
if (*namep == NULL || **namep == '\0') 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 /* For relocations against a section symbol and ones against no
symbol (absolute relocations) infer the ISA mode from the addend. */ 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; sec = NULL;
for (o = input_bfd->sections; o != NULL; o = o->next) 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; sec = h->call_fp_stub;
break; break;
@ -7385,7 +7384,7 @@ _bfd_mips_elf_section_processing (bfd *abfd, Elf_Internal_Shdr *hdr)
if (hdr->bfd_section != NULL) 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 /* .sbss is not handled specially here because the GNU/Linux
prelinker can convert .sbss from NOBITS to PROGBITS and prelinker can convert .sbss from NOBITS to PROGBITS and
@ -7514,10 +7513,9 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
if (flags) if (flags)
{ {
if (! bfd_set_section_flags (abfd, hdr->bfd_section, if (!bfd_set_section_flags (hdr->bfd_section,
(bfd_get_section_flags (abfd, (bfd_section_flags (hdr->bfd_section)
hdr->bfd_section) | flags)))
| flags)))
return FALSE; return FALSE;
} }
@ -7624,7 +7622,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
bfd_boolean bfd_boolean
_bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec) _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) if (strcmp (name, ".liblist") == 0)
{ {
@ -7764,12 +7762,12 @@ bfd_boolean
_bfd_mips_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED, _bfd_mips_elf_section_from_bfd_section (bfd *abfd ATTRIBUTE_UNUSED,
asection *sec, int *retval) 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; *retval = SHN_MIPS_SCOMMON;
return TRUE; return TRUE;
} }
if (strcmp (bfd_get_section_name (abfd, sec), ".acommon") == 0) if (strcmp (bfd_section_name (sec), ".acommon") == 0)
{ {
*retval = SHN_MIPS_ACOMMON; *retval = SHN_MIPS_ACOMMON;
return TRUE; 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"); s = bfd_get_linker_section (abfd, ".dynamic");
if (s != NULL) if (s != NULL)
{ {
if (! bfd_set_section_flags (abfd, s, flags)) if (!bfd_set_section_flags (s, flags))
return FALSE; 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), MIPS_ELF_STUB_SECTION_NAME (abfd),
flags | SEC_CODE); flags | SEC_CODE);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, MIPS_ELF_LOG_FILE_ALIGN (abfd)))
MIPS_ELF_LOG_FILE_ALIGN (abfd)))
return FALSE; return FALSE;
htab->sstubs = s; 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", s = bfd_make_section_anyway_with_flags (abfd, ".rld_map",
flags &~ (flagword) SEC_READONLY); flags &~ (flagword) SEC_READONLY);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, MIPS_ELF_LOG_FILE_ALIGN (abfd)))
MIPS_ELF_LOG_FILE_ALIGN (abfd)))
return FALSE; return FALSE;
} }
@ -8069,24 +8065,24 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
/* Change alignments of some sections. */ /* Change alignments of some sections. */
s = bfd_get_linker_section (abfd, ".hash"); s = bfd_get_linker_section (abfd, ".hash");
if (s != NULL) 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"); s = bfd_get_linker_section (abfd, ".dynsym");
if (s != NULL) 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"); s = bfd_get_linker_section (abfd, ".dynstr");
if (s != NULL) 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"); s = bfd_get_section_by_name (abfd, ".reginfo");
if (s != NULL) 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"); s = bfd_get_linker_section (abfd, ".dynamic");
if (s != NULL) 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)) 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. */ /* Check for the mips16 stub sections. */
name = bfd_get_section_name (abfd, sec); name = bfd_section_name (sec);
if (FN_STUB_P (name)) if (FN_STUB_P (name))
{ {
unsigned long r_symndx; 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 Encourage better cache usage by aligning. We do this
lazily to avoid pessimizing traditional objects. */ lazily to avoid pessimizing traditional objects. */
if (!htab->is_vxworks if (!htab->is_vxworks
&& !bfd_set_section_alignment (dynobj, htab->root.splt, 5)) && !bfd_set_section_alignment (htab->root.splt, 5))
return FALSE; return FALSE;
/* Make sure that .got.plt is word-aligned. We do this lazily /* Make sure that .got.plt is word-aligned. We do this lazily
for the same reason as above. */ 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))) MIPS_ELF_LOG_FILE_ALIGN (dynobj)))
return FALSE; return FALSE;
@ -9588,7 +9584,7 @@ _bfd_mips_elf_always_size_sections (bfd *output_bfd,
sect = bfd_get_section_by_name (output_bfd, ".reginfo"); sect = bfd_get_section_by_name (output_bfd, ".reginfo");
if (sect != NULL) 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; 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"); sect = bfd_get_section_by_name (output_bfd, ".MIPS.abiflags");
if (sect != NULL) if (sect != NULL)
{ {
bfd_set_section_size (output_bfd, sect, bfd_set_section_size (sect, sizeof (Elf_External_ABIFlags_v0));
sizeof (Elf_External_ABIFlags_v0));
sect->flags |= SEC_FIXED_SIZE | SEC_HAS_CONTENTS; 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 /* It's OK to base decisions on the section name, because none
of the dynobj section names depend upon the input files. */ 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) if ((s->flags & SEC_LINKER_CREATED) == 0)
continue; continue;
@ -10048,8 +10043,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
assert a DT_TEXTREL entry rather than testing whether assert a DT_TEXTREL entry rather than testing whether
there exists a relocation to a read only section or there exists a relocation to a read only section or
not. */ not. */
outname = bfd_get_section_name (output_bfd, outname = bfd_section_name (s->output_section);
s->output_section);
target = bfd_get_section_by_name (output_bfd, outname + 4); target = bfd_get_section_by_name (output_bfd, outname + 4);
if ((target != NULL if ((target != NULL
&& (target->flags & SEC_READONLY) != 0 && (target->flags & SEC_READONLY) != 0
@ -12445,7 +12439,7 @@ _bfd_mips_final_write_processing (bfd *abfd)
case SHT_MIPS_GPTAB: case SHT_MIPS_GPTAB:
BFD_ASSERT ((*hdrpp)->bfd_section != NULL); 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 BFD_ASSERT (name != NULL
&& CONST_STRNEQ (name, ".gptab.")); && CONST_STRNEQ (name, ".gptab."));
sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1); 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: case SHT_MIPS_CONTENT:
BFD_ASSERT ((*hdrpp)->bfd_section != NULL); 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 BFD_ASSERT (name != NULL
&& CONST_STRNEQ (name, ".MIPS.content")); && CONST_STRNEQ (name, ".MIPS.content"));
sec = bfd_get_section_by_name (abfd, sec = bfd_get_section_by_name (abfd,
@ -12475,7 +12469,7 @@ _bfd_mips_final_write_processing (bfd *abfd)
case SHT_MIPS_EVENTS: case SHT_MIPS_EVENTS:
BFD_ASSERT ((*hdrpp)->bfd_section != NULL); 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); BFD_ASSERT (name != NULL);
if (CONST_STRNEQ (name, ".MIPS.events")) if (CONST_STRNEQ (name, ".MIPS.events"))
sec = bfd_get_section_by_name (abfd, 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) for (o = sub->sections; o != NULL; o = o->next)
if (!o->gc_mark if (!o->gc_mark
&& MIPS_ELF_ABIFLAGS_SECTION_NAME_P && MIPS_ELF_ABIFLAGS_SECTION_NAME_P (bfd_section_name (o)))
(bfd_get_section_name (sub, o)))
{ {
if (!_bfd_elf_gc_mark (info, o, gc_mark_hook)) if (!_bfd_elf_gc_mark (info, o, gc_mark_hook))
return FALSE; return FALSE;
@ -15024,7 +15017,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
".rtproc", ".rtproc",
flags); flags);
if (rtproc_sec == NULL if (rtproc_sec == NULL
|| ! bfd_set_section_alignment (abfd, rtproc_sec, 4)) || !bfd_set_section_alignment (rtproc_sec, 4))
return FALSE; return FALSE;
} }

View File

@ -1263,15 +1263,14 @@ create_ifunc_sections (bfd *abfd, struct bfd_link_info *info)
s = bfd_make_section_with_flags (abfd, ".iplt", pltflags); s = bfd_make_section_with_flags (abfd, ".iplt", pltflags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || !bfd_set_section_alignment (s, bed->plt_alignment))
return FALSE; return FALSE;
htab->iplt = s; htab->iplt = s;
s = bfd_make_section_with_flags (abfd, ".rela.iplt", s = bfd_make_section_with_flags (abfd, ".rela.iplt",
flags | SEC_READONLY); flags | SEC_READONLY);
if (s == NULL if (s == NULL
|| ! bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->irelplt = s; htab->irelplt = s;
@ -4164,8 +4163,7 @@ do_relocation:
|| r_type == R_SPARC_UA32 || r_type == R_SPARC_UA32
|| r_type == R_SPARC_DISP32) || r_type == R_SPARC_DISP32)
&& (((input_section->flags & SEC_DEBUGGING) != 0 && (((input_section->flags & SEC_DEBUGGING) != 0
&& strcmp (bfd_section_name (input_bfd, && strcmp (bfd_section_name (input_section),
input_section),
".stab") == 0) ".stab") == 0)
|| _bfd_elf_section_offset (output_bfd, info, || _bfd_elf_section_offset (output_bfd, info,
input_section, input_section,
@ -4194,7 +4192,7 @@ do_relocation:
if (name == NULL) if (name == NULL)
return FALSE; return FALSE;
if (*name == '\0') if (*name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
(*info->callbacks->reloc_overflow) (*info->callbacks->reloc_overflow)
(info, (h ? &h->root : NULL), name, howto->name, (info, (h ? &h->root : NULL), name, howto->name,

View File

@ -1438,13 +1438,13 @@ tilegx_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
(bed->dynamic_sec_flags (bed->dynamic_sec_flags
| SEC_READONLY)); | SEC_READONLY));
if (s == NULL 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; return FALSE;
htab->srelgot = s; htab->srelgot = s;
s = s_got = bfd_make_section_anyway_with_flags (abfd, ".got", flags); s = s_got = bfd_make_section_anyway_with_flags (abfd, ".got", flags);
if (s == NULL 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; return FALSE;
htab->sgot = s; 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); s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags);
if (s == NULL if (s == NULL
|| !bfd_set_section_alignment (abfd, s, || !bfd_set_section_alignment (s, bed->s->log_file_align))
bed->s->log_file_align))
return FALSE; return FALSE;
htab->sgotplt = s; 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 name = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name)); (input_bfd, symtab_hdr->sh_link, sym->st_name));
if (name == NULL || *name == '\0') if (name == NULL || *name == '\0')
name = bfd_section_name (input_bfd, sec); name = bfd_section_name (sec);
} }
switch (r_type) switch (r_type)

View File

@ -1238,7 +1238,7 @@ _bfd_x86_elf_size_dynamic_sections (bfd *output_bfd,
{ {
/* Strip these too. */ /* 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 if (s->size != 0
&& s != htab->elf.srelplt && 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 it is empty. Update its section alignment now since it
is non-empty. */ is non-empty. */
if (s == htab->elf.iplt) if (s == htab->elf.iplt)
bfd_set_section_alignment (s->owner, s, bfd_set_section_alignment (s, htab->plt.iplt_alignment);
htab->plt.iplt_alignment);
/* Allocate memory for the section contents. We use bfd_zalloc /* Allocate memory for the section contents. We use bfd_zalloc
here in case unused entries are not reclaimed before the here in case unused entries are not reclaimed before the
@ -2625,7 +2624,7 @@ _bfd_x86_elf_link_setup_gnu_properties
if (sec == NULL) if (sec == NULL)
info->callbacks->einfo (_("%F%P: failed to create GNU property section\n")); 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: error_alignment:
info->callbacks->einfo (_("%F%pA: failed to align section\n"), 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 instead of in create_dynamic_sections so that they are always
properly aligned even if create_dynamic_sections isn't called. */ properly aligned even if create_dynamic_sections isn't called. */
sec = htab->elf.sgot; sec = htab->elf.sgot;
if (!bfd_set_section_alignment (dynobj, sec, got_align)) if (!bfd_set_section_alignment (sec, got_align))
goto error_alignment; goto error_alignment;
sec = htab->elf.sgotplt; sec = htab->elf.sgotplt;
if (!bfd_set_section_alignment (dynobj, sec, got_align)) if (!bfd_set_section_alignment (sec, got_align))
goto error_alignment; goto error_alignment;
/* Create the ifunc sections here so that check_relocs can be /* 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); = bfd_log2 (htab->non_lazy_plt->plt_entry_size);
sec = pltsec; sec = pltsec;
if (!bfd_set_section_alignment (sec->owner, sec, if (!bfd_set_section_alignment (sec, plt_alignment))
plt_alignment))
goto error_alignment; goto error_alignment;
/* Create the GOT procedure linkage table. */ /* Create the GOT procedure linkage table. */
@ -2892,8 +2890,7 @@ error_alignment:
if (sec == NULL) if (sec == NULL)
info->callbacks->einfo (_("%F%P: failed to create GOT PLT section\n")); info->callbacks->einfo (_("%F%P: failed to create GOT PLT section\n"));
if (!bfd_set_section_alignment (dynobj, sec, if (!bfd_set_section_alignment (sec, non_lazy_plt_alignment))
non_lazy_plt_alignment))
goto error_alignment; goto error_alignment;
htab->plt_got = sec; htab->plt_got = sec;
@ -2913,8 +2910,7 @@ error_alignment:
if (sec == NULL) if (sec == NULL)
info->callbacks->einfo (_("%F%P: failed to create IBT-enabled PLT section\n")); info->callbacks->einfo (_("%F%P: failed to create IBT-enabled PLT section\n"));
if (!bfd_set_section_alignment (dynobj, sec, if (!bfd_set_section_alignment (sec, plt_alignment))
plt_alignment))
goto error_alignment; goto error_alignment;
} }
else if (htab->params->bndplt && ABI_64_P (dynobj)) else if (htab->params->bndplt && ABI_64_P (dynobj))
@ -2928,8 +2924,7 @@ error_alignment:
if (sec == NULL) if (sec == NULL)
info->callbacks->einfo (_("%F%P: failed to create BND PLT section\n")); info->callbacks->einfo (_("%F%P: failed to create BND PLT section\n"));
if (!bfd_set_section_alignment (dynobj, sec, if (!bfd_set_section_alignment (sec, non_lazy_plt_alignment))
non_lazy_plt_alignment))
goto error_alignment; goto error_alignment;
} }
@ -2949,7 +2944,7 @@ error_alignment:
if (sec == NULL) if (sec == NULL)
info->callbacks->einfo (_("%F%P: failed to create PLT .eh_frame section\n")); 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; goto error_alignment;
htab->plt_eh_frame = sec; htab->plt_eh_frame = sec;
@ -2962,7 +2957,7 @@ error_alignment:
if (sec == NULL) if (sec == NULL)
info->callbacks->einfo (_("%F%P: failed to create GOT PLT .eh_frame section\n")); 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; goto error_alignment;
htab->plt_got_eh_frame = sec; htab->plt_got_eh_frame = sec;
@ -2976,7 +2971,7 @@ error_alignment:
if (sec == NULL) if (sec == NULL)
info->callbacks->einfo (_("%F%P: failed to create the second PLT .eh_frame section\n")); 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; goto error_alignment;
htab->plt_second_eh_frame = sec; htab->plt_second_eh_frame = sec;
@ -2995,7 +2990,7 @@ error_alignment:
section backwards, resulting in a warning and section lma not section backwards, resulting in a warning and section lma not
being set properly. It later leads to a "File truncated" being set properly. It later leads to a "File truncated"
error. */ error. */
if (!bfd_set_section_alignment (sec->owner, sec, 0)) if (!bfd_set_section_alignment (sec, 0))
goto error_alignment; goto error_alignment;
htab->plt.iplt_alignment = (normal_target htab->plt.iplt_alignment = (normal_target

View File

@ -109,7 +109,7 @@ msdos_object_p (bfd *abfd)
return NULL; return NULL;
} }
bfd_set_section_size (abfd, section, size); bfd_set_section_size (section, size);
section->alignment_power = 4; section->alignment_power = 4;
return abfd->xvec; return abfd->xvec;
@ -135,16 +135,16 @@ msdos_write_object_contents (bfd *abfd)
{ {
if (sec->size == 0) if (sec->size == 0)
continue; 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) if (sec_vma > high_vma)
high_vma = sec_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) file_ptr sec_end = (sizeof (hdr)
+ bfd_get_section_vma (abfd, sec) + bfd_section_vma (sec)
+ sec->size); + sec->size);
if (sec_end > outfile_size) if (sec_end > outfile_size)
outfile_size = sec_end; outfile_size = sec_end;
@ -195,9 +195,9 @@ msdos_set_section_contents (bfd *abfd,
if (count == 0) if (count == 0)
return TRUE; 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 if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
|| bfd_bwrite (location, count, abfd) != count) || bfd_bwrite (location, count, abfd) != count)

View File

@ -2396,7 +2396,7 @@ _bfd_generic_reloc_link_order (bfd *abfd,
(*info->callbacks->reloc_overflow) (*info->callbacks->reloc_overflow)
(info, NULL, (info, NULL,
(link_order->type == bfd_section_reloc_link_order (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), : link_order->u.reloc.p->u.name),
r->howto->name, link_order->u.reloc.p->addend, r->howto->name, link_order->u.reloc.p->addend,
NULL, NULL, 0); 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 into a single large link once section, which defeats the purpose
of having link once sections in the first place. */ 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); already_linked_list = bfd_section_already_linked_table_lookup (name);

View File

@ -437,7 +437,7 @@ bfd_mach_o_convert_section_name_to_mach_o (bfd *abfd ATTRIBUTE_UNUSED,
bfd_mach_o_section *section) bfd_mach_o_section *section)
{ {
const mach_o_section_name_xlat *xlat; 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 *segname;
const char *dot; const char *dot;
unsigned int len; unsigned int len;
@ -2583,13 +2583,13 @@ bfd_mach_o_mangle_sections (bfd *abfd, bfd_mach_o_data_struct *mdata)
target_index = 0; target_index = 0;
for (sec = abfd->sections; sec; sec = sec->next) 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); bfd_mach_o_section *msect = bfd_mach_o_get_mach_o_section (sec);
mdata->sections[target_index] = msect; mdata->sections[target_index] = msect;
msect->addr = bfd_get_section_vma (abfd, sec); msect->addr = bfd_section_vma (sec);
msect->size = bfd_get_section_size (sec); msect->size = bfd_section_size (sec);
/* Use the largest alignment set, in case it was bumped after the /* Use the largest alignment set, in case it was bumped after the
section was created. */ 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); bfd_mach_o_section *s = bfd_mach_o_get_mach_o_section (sec);
/* Create default flags. */ /* Create default flags. */
bfd_flags = bfd_get_section_flags (abfd, sec); bfd_flags = bfd_section_flags (sec);
if ((bfd_flags & SEC_CODE) == SEC_CODE) if ((bfd_flags & SEC_CODE) == SEC_CODE)
s->flags = BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS s->flags = BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS
| BFD_MACH_O_S_ATTR_SOME_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) for (s = seg->sect_head; s != NULL; s = s->next)
{ {
asection *sec = s->bfdsection; asection *sec = s->bfdsection;
flagword flags = bfd_get_section_flags (abfd, sec); flagword flags = bfd_section_flags (sec);
/* Adjust segment size. */ /* Adjust segment size. */
seg->vmsize = FILE_ALIGN (seg->vmsize, s->align); 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_new_section_hook (bfd *abfd, asection *sec)
{ {
bfd_mach_o_section *s; 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); s = bfd_mach_o_get_mach_o_section (sec);
if (s == NULL) 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->flags = xlat->macho_sectype | xlat->macho_secattr;
s->align = xlat->sectalign > bfdalign ? xlat->sectalign s->align = xlat->sectalign > bfdalign ? xlat->sectalign
: bfdalign; : bfdalign;
(void) bfd_set_section_alignment (abfd, sec, s->align); bfd_set_section_alignment (sec, s->align);
bfd_flags = bfd_get_section_flags (abfd, sec); bfd_flags = bfd_section_flags (sec);
if (bfd_flags == SEC_NO_FLAGS) if (bfd_flags == SEC_NO_FLAGS)
bfd_set_section_flags (abfd, sec, xlat->bfd_flags); bfd_set_section_flags (sec, xlat->bfd_flags);
} }
else else
/* Create default flags. */ /* Create default flags. */
@ -3540,13 +3540,12 @@ bfd_mach_o_new_section_hook (bfd *abfd, asection *sec)
} }
static void static void
bfd_mach_o_init_section_from_mach_o (bfd *abfd, asection *sec, bfd_mach_o_init_section_from_mach_o (asection *sec, unsigned long prot)
unsigned long prot)
{ {
flagword flags; flagword flags;
bfd_mach_o_section *section; 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); section = bfd_mach_o_get_mach_o_section (sec);
/* TODO: see if we should use the xlat system for doing this by /* 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) if (section->nreloc != 0)
flags |= SEC_RELOC; flags |= SEC_RELOC;
bfd_set_section_flags (abfd, sec, flags); bfd_set_section_flags (sec, flags);
sec->vma = section->addr; sec->vma = section->addr;
sec->lma = 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->reserved2 = bfd_h_get_32 (abfd, raw.reserved2);
section->reserved3 = 0; 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; 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->reserved2 = bfd_h_get_32 (abfd, raw.reserved2);
section->reserved3 = bfd_h_get_32 (abfd, raw.reserved3); 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; return sec;
} }

View File

@ -596,7 +596,7 @@ static bfd_boolean
mmo_section_has_contents (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *p ATTRIBUTE_UNUSED) 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). */ /* 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 /* 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) 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; 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. */ /* 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)) != (SEC_LOAD | SEC_ALLOC))
return; return;
@ -657,10 +657,10 @@ static void
mmo_find_sec_w_addr_grow (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *p) 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; 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. */ /* 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)) != (SEC_LOAD | SEC_ALLOC))
return; return;
@ -700,12 +700,11 @@ mmo_decide_section (bfd *abfd, bfd_vma vma)
if (sec == NULL) if (sec == NULL)
return 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; return NULL;
if (! bfd_set_section_flags (abfd, sec, if (!bfd_set_section_flags (sec, (bfd_section_flags (sec)
bfd_get_section_flags (abfd, sec) | SEC_CODE | SEC_LOAD | SEC_ALLOC)))
| SEC_CODE | SEC_LOAD | SEC_ALLOC))
return NULL; return NULL;
} }
else if ((vma >> 56) == 0x20) else if ((vma >> 56) == 0x20)
@ -715,12 +714,11 @@ mmo_decide_section (bfd *abfd, bfd_vma vma)
if (sec == NULL) if (sec == NULL)
return 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; return NULL;
if (! bfd_set_section_flags (abfd, sec, if (!bfd_set_section_flags (sec, (bfd_section_flags (sec)
bfd_get_section_flags (abfd, sec) | SEC_LOAD | SEC_ALLOC)))
| SEC_LOAD | SEC_ALLOC))
return NULL; 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++); sprintf (sec_name, ".MMIX.sec.%d", abfd->tdata.mmo_data->sec_no++);
sec = mmo_make_section (abfd, sec_name); 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; return NULL;
if (! bfd_set_section_flags (abfd, sec, if (!bfd_set_section_flags (sec, (bfd_section_flags (sec)
bfd_get_section_flags (abfd, sec) | SEC_LOAD | SEC_ALLOC)))
| SEC_LOAD | SEC_ALLOC))
return NULL; return NULL;
return sec; 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 /* Add in the section flags we found to those bfd entered during this
process and set the contents. */ process and set the contents. */
if (! bfd_set_section_flags (abfd, sec, if (!bfd_set_section_flags (sec,
bfd_sec_flags_from_mmo_flags (flags) (bfd_sec_flags_from_mmo_flags (flags)
| bfd_get_section_flags (abfd, sec) | bfd_section_flags (sec)
| (section_length != 0 ? SEC_HAS_CONTENTS : 0)) | (section_length != 0 ? SEC_HAS_CONTENTS : 0)))
|| ! bfd_set_section_size (abfd, sec, sec->size + section_length) || !bfd_set_section_size (sec, sec->size + section_length)
/* Set VMA only for the first occurrence. */ /* Set VMA only for the first occurrence. */
|| (! sec->user_set_vma || (!sec->user_set_vma && !bfd_set_section_vma (sec, section_vma)))
&& ! bfd_set_section_vma (abfd, sec, section_vma)))
{ {
/* If we get an error for any of the calls above, signal more than /* If we get an error for any of the calls above, signal more than
just a format error for the spec section. */ 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 /* We get here for the first time (at other times too) for this
section. Say we have contents. */ section. Say we have contents. */
if (! bfd_set_section_flags (sec->owner, sec, if (!bfd_set_section_flags (sec, (bfd_section_flags (sec)
bfd_get_section_flags (sec->owner, sec) | SEC_HAS_CONTENTS)))
| SEC_HAS_CONTENTS))
return NULL; return NULL;
} }
} }
@ -2070,18 +2065,16 @@ mmo_scan (bfd *abfd)
section flags must be set then. */ section flags must be set then. */
sec = bfd_get_section_by_name (abfd, MMO_TEXT_SECTION_NAME); sec = bfd_get_section_by_name (abfd, MMO_TEXT_SECTION_NAME);
if (sec != NULL if (sec != NULL
&& (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) && (bfd_section_flags (sec) & SEC_HAS_CONTENTS)
&& ! bfd_set_section_flags (abfd, sec, && !bfd_set_section_flags (sec, (bfd_section_flags (sec)
bfd_get_section_flags (abfd, sec) | SEC_ALLOC | SEC_LOAD | SEC_CODE)))
| SEC_ALLOC | SEC_LOAD | SEC_CODE))
error = TRUE; error = TRUE;
sec = bfd_get_section_by_name (abfd, MMO_DATA_SECTION_NAME); sec = bfd_get_section_by_name (abfd, MMO_DATA_SECTION_NAME);
if (sec != NULL if (sec != NULL
&& (bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS) && (bfd_section_flags (sec) & SEC_HAS_CONTENTS)
&& ! bfd_set_section_flags (abfd, sec, && !bfd_set_section_flags (sec, (bfd_section_flags (sec)
bfd_get_section_flags (abfd, sec) | SEC_ALLOC | SEC_LOAD)))
| SEC_ALLOC | SEC_LOAD))
error = TRUE; error = TRUE;
/* Free whatever resources we took. */ /* Free whatever resources we took. */
@ -2432,7 +2425,7 @@ bfd_sec_flags_from_mmo_flags (flagword flags)
static bfd_boolean static bfd_boolean
mmo_has_leading_or_trailing_zero_tetra_p (bfd *abfd, asection *sec) 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) if (sec->size < 4)
return FALSE; return FALSE;
@ -2464,7 +2457,7 @@ mmo_internal_write_section (bfd *abfd, asection *sec)
if (strcmp (sec->name, MMO_TEXT_SECTION_NAME) == 0) 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 /* Because leading and trailing zeros are omitted in output, we need to
specify the section boundaries so they're correct when the file 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) 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. */ /* Same goes as for MMO_TEXT_SECTION_NAME above. */
if (sec->size != 0 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 /* Ignore sections that are just allocated or empty; we write out
_contents_ here. */ _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) && sec->size != 0)
{ {
if (!mmo_write_section_description (abfd, sec)) 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 /* Writing a LOP_LOC ends the LOP_SPEC data, and makes data actually
loaded. */ loaded. */
if (bfd_get_section_flags (abfd, sec) & SEC_LOAD) if (bfd_section_flags (sec) & SEC_LOAD)
return (! abfd->tdata.mmo_data->have_error return (! abfd->tdata.mmo_data->have_error
&& mmo_write_loc_chunk_list (abfd, && mmo_write_loc_chunk_list (abfd,
mmo_section_data (sec)->head)); mmo_section_data (sec)->head));
@ -2646,10 +2639,9 @@ EXAMPLE
for all alien sections; perhaps mmo.em should clear that flag. Might for all alien sections; perhaps mmo.em should clear that flag. Might
be related to weak references. */ be related to weak references. */
mmo_write_tetra (abfd, mmo_write_tetra (abfd,
mmo_sec_flags_from_bfd_flags mmo_sec_flags_from_bfd_flags (bfd_section_flags (sec)));
(bfd_get_section_flags (abfd, sec)));
mmo_write_octa (abfd, sec->size); 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; return TRUE;
} }
@ -3171,7 +3163,7 @@ mmo_write_section_unless_reg_contents (bfd *abfd, asection *sec, void *p)
/* Exclude the convenience register section. */ /* Exclude the convenience register section. */
if (strcmp (sec->name, MMIX_REG_SECTION_NAME) == 0) 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 sure it hasn't got contents. It seems impossible to
make it carry contents, so we don't have a test-case for make it carry contents, so we don't have a test-case for

View File

@ -1218,7 +1218,7 @@ bfd_get_debug_link_info_1 (bfd *abfd, void *crc32_out)
if (sect == NULL) if (sect == NULL)
return 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. */ /* PR 22794: Make sure that the section has a reasonable size. */
if (size < 8 || size >= bfd_get_size (abfd)) 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) if (sect == NULL)
return NULL; return NULL;
size = bfd_get_section_size (sect); size = bfd_section_size (sect);
if (size < 8 || size >= bfd_get_size (abfd)) if (size < 8 || size >= bfd_get_size (abfd))
return NULL; 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. */ /* BuildID value is stored after the filename. */
name = (char *) contents; name = (char *) contents;
buildid_offset = strnlen (name, size) + 1; buildid_offset = strnlen (name, size) + 1;
if (buildid_offset >= bfd_get_section_size (sect)) if (buildid_offset >= bfd_section_size (sect))
return NULL; return NULL;
*buildid_len = size - buildid_offset; *buildid_len = size - buildid_offset;
@ -1727,14 +1727,14 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
debuglink_size &= ~3; debuglink_size &= ~3;
debuglink_size += 4; 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 ? */ /* XXX Should we delete the section from the bfd ? */
return NULL; return NULL;
/* PR 21193: Ensure that the section has 4-byte alignment for the CRC. /* PR 21193: Ensure that the section has 4-byte alignment for the CRC.
Note - despite the name of the function being called, we are Note - despite the name of the function being called, we are
setting an alignment power, not a byte alignment value. */ setting an alignment power, not a byte alignment value. */
bfd_set_section_alignment (abfd, sect, 2); bfd_set_section_alignment (sect, 2);
return sect; return sect;
} }
@ -1872,7 +1872,7 @@ get_build_id (bfd *abfd)
return NULL; return NULL;
} }
size = bfd_get_section_size (sect); size = bfd_section_size (sect);
/* FIXME: Should we support smaller build-id notes ? */ /* FIXME: Should we support smaller build-id notes ? */
if (size < 0x24) if (size < 0x24)
{ {
@ -1890,7 +1890,7 @@ get_build_id (bfd *abfd)
/* FIXME: Paranoia - allow for compressed build-id sections. /* FIXME: Paranoia - allow for compressed build-id sections.
Maybe we should complain if this size is different from Maybe we should complain if this size is different from
the one obtained above... */ the one obtained above... */
size = bfd_get_section_size (sect); size = bfd_section_size (sect);
if (size < sizeof (Elf_External_Note)) if (size < sizeof (Elf_External_Note))
{ {
bfd_set_error (bfd_error_invalid_operation); bfd_set_error (bfd_error_invalid_operation);

View File

@ -2802,17 +2802,17 @@ aout_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
break; break;
case N_TEXT | N_EXT: case N_TEXT | N_EXT:
section = obj_textsec (abfd); section = obj_textsec (abfd);
value -= bfd_get_section_vma (abfd, section); value -= bfd_section_vma (section);
break; break;
case N_DATA | N_EXT: case N_DATA | N_EXT:
/* Treat N_SETV symbols as N_DATA symbol; see comment in /* Treat N_SETV symbols as N_DATA symbol; see comment in
translate_from_native_sym_flags. */ translate_from_native_sym_flags. */
section = obj_datasec (abfd); section = obj_datasec (abfd);
value -= bfd_get_section_vma (abfd, section); value -= bfd_section_vma (section);
break; break;
case N_BSS | N_EXT: case N_BSS | N_EXT:
section = obj_bsssec (abfd); section = obj_bsssec (abfd);
value -= bfd_get_section_vma (abfd, section); value -= bfd_section_vma (section);
break; break;
} }
@ -3151,8 +3151,7 @@ aout_link_reloc_link_order (struct aout_final_link_info *flaginfo,
(*flaginfo->info->callbacks->reloc_overflow) (*flaginfo->info->callbacks->reloc_overflow)
(flaginfo->info, NULL, (flaginfo->info, NULL,
(p->type == bfd_section_reloc_link_order (p->type == bfd_section_reloc_link_order
? bfd_section_name (flaginfo->output_bfd, ? bfd_section_name (pr->u.section)
pr->u.section)
: pr->u.name), : pr->u.name),
howto->name, pr->addend, NULL, howto->name, pr->addend, NULL,
(asection *) NULL, (bfd_vma) 0); (asection *) NULL, (bfd_vma) 0);
@ -3477,7 +3476,7 @@ pdp11_aout_link_input_section (struct aout_final_link_info *flaginfo,
asection *s; asection *s;
s = aout_reloc_type_to_section (input_bfd, r_type); 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->callbacks->reloc_overflow)
(flaginfo->info, (h ? &h->root : NULL), name, howto->name, (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; return FALSE;
PUT_WORD (output_bfd, strtab_index, outsym->e_strx); PUT_WORD (output_bfd, strtab_index, outsym->e_strx);
PUT_WORD (output_bfd, PUT_WORD (output_bfd,
(bfd_get_section_vma (output_bfd, (bfd_section_vma (obj_textsec (input_bfd)->output_section)
obj_textsec (input_bfd)->output_section)
+ obj_textsec (input_bfd)->output_offset), + obj_textsec (input_bfd)->output_offset),
outsym->e_value); outsym->e_value);
++obj_aout_external_sym_count (output_bfd); ++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) BFD_ASSERT (bfd_is_abs_section (output_section)
|| output_section->owner == output_bfd); || output_section->owner == output_bfd);
val = (hresolve->root.u.def.value val = (hresolve->root.u.def.value
+ bfd_get_section_vma (output_bfd, output_section) + bfd_section_vma (output_section)
+ input_section->output_offset); + input_section->output_offset);
/* Get the correct type based on the section. If /* Get the correct type based on the section. If

View File

@ -770,7 +770,7 @@ pex64_bfd_print_pdata_section (bfd *abfd, void *vfile, asection *pdata_section)
if (PEX64_IS_RUNTIME_FUNCTION_CHAINED (&rf)) if (PEX64_IS_RUNTIME_FUNCTION_CHAINED (&rf))
{ {
bfd_vma altent = PEX64_GET_UNWINDDATA_UNIFIED_RVA (&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; struct pex64_runtime_function arf;
fprintf (file, "\t shares information with "); fprintf (file, "\t shares information with ");

View File

@ -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; 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. */ /* Check that we will not run out of space. */
BFD_ASSERT (vars->data + size < vars->bim->buffer + vars->bim->size); BFD_ASSERT (vars->data + size < vars->bim->buffer + vars->bim->size);
/* Set the section size and contents. The actual /* Set the section size and contents. The actual
contents are filled in by our parent. */ 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->contents = vars->data;
sec->target_index = vars->sec_index ++; sec->target_index = vars->sec_index ++;

View File

@ -1526,8 +1526,7 @@ _bfd_clear_contents (reloc_howto_type *howto,
/* For a range list, use 1 instead of 0 as placeholder. 0 /* For a range list, use 1 instead of 0 as placeholder. 0
would terminate the list, hiding any later entries. */ would terminate the list, hiding any later entries. */
if (strcmp (bfd_get_section_name (input_bfd, input_section), if (strcmp (bfd_section_name (input_section), ".debug_ranges") == 0
".debug_ranges") == 0
&& (howto->dst_mask & 1) != 0) && (howto->dst_mask & 1) != 0)
x |= 1; x |= 1;

Some files were not shown because too many files have changed in this diff Show More