aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-09-16 20:25:17 +0930
committerAlan Modra <amodra@gmail.com>2019-09-19 09:40:13 +0930
commitfd3619828e94a24a92cddec42cbc0ab33352eeb4 (patch)
tree496b4a1d9bc015f6d1177758a811afa3f6e6895e /ld/emultempl
parent5dfda3562a69686c43aad4fb0269cc9d5ec010d5 (diff)
downloadbinutils-fd3619828e94a24a92cddec42cbc0ab33352eeb4.zip
binutils-fd3619828e94a24a92cddec42cbc0ab33352eeb4.tar.gz
binutils-fd3619828e94a24a92cddec42cbc0ab33352eeb4.tar.bz2
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various bfd section macros and functions. The bfd is hardly ever used and if needed for the bfd_set_section_* or bfd_rename_section functions can be found via section->owner except for the com, und, abs, and ind std_section special sections. Those sections shouldn't be modified anyway. The patch also removes various bfd_get_section_<field> macros, replacing their use with bfd_section_<field>, and adds bfd_set_section_lma. I've also fixed a minor bug in gas where compressed section renaming was done directly rather than calling bfd_rename_section. This would have broken bfd_get_section_by_name and similar functions, but that hardly mattered at such a late stage in gas processing. bfd/ * bfd-in.h (bfd_get_section_name, bfd_get_section_vma), (bfd_get_section_lma, bfd_get_section_alignment), (bfd_get_section_size, bfd_get_section_flags), (bfd_get_section_userdata): Delete. (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment): Lose bfd parameter. (bfd_section_flags, bfd_section_userdata): New. (bfd_is_com_section): Rename parameter. * section.c (bfd_set_section_userdata, bfd_set_section_vma), (bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section), (bfd_set_section_size): Delete bfd parameter, rename section parameter. (bfd_set_section_lma): New. * bfd-in2.h: Regenerate. * mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param, update callers. * aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c, * elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c, * mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c, * peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c, * xcofflink.c: Update throughout for bfd section macro and function changes. binutils/ * addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c, * objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c, * od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c, * resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update throughout for bfd section macro and function changes. gas/ * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for bfd section macro and function changes. * write.c (compress_debug): Use bfd_rename_section. gdb/ * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c, * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c, * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c, * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h, * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c, * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c, * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c, * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c, * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c, * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c, * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c, * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c, * solib-spu.c, * solib-svr4.c, * solib-target.c, * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c, * symmisc.c, * symtab.c, * target.c, * windows-nat.c, * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c, * mi/mi-interp.c: Update throughout for bfd section macro and function changes. * gcore (gcore_create_callback): Use bfd_set_section_lma. * spu-tdep.c (spu_overlay_new_objfile): Likewise. gprof/ * corefile.c, * symtab.c: Update throughout for bfd section macro and function changes. ld/ * ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/cr16elf.em, * emultempl/cskyelf.em, * emultempl/m68hc1xelf.em, * emultempl/m68kelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update throughout for bfd section macro and function changes. libctf/ * ctf-open-bfd.c: Update throughout for bfd section macro changes. opcodes/ * arc-ext.c: Update throughout for bfd section macro changes. sim/ * common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c, * erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c, * m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c, * rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c, * rx/trace.c: Update throughout for bfd section macro changes.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/aarch64elf.em2
-rw-r--r--ld/emultempl/aix.em2
-rw-r--r--ld/emultempl/armcoff.em3
-rw-r--r--ld/emultempl/armelf.em5
-rw-r--r--ld/emultempl/cr16elf.em18
-rw-r--r--ld/emultempl/cskyelf.em4
-rw-r--r--ld/emultempl/m68hc1xelf.em6
-rw-r--r--ld/emultempl/m68kelf.em9
-rw-r--r--ld/emultempl/mipself.em2
-rw-r--r--ld/emultempl/mmix-elfnmmo.em4
-rw-r--r--ld/emultempl/mmo.em6
-rw-r--r--ld/emultempl/msp430.em20
-rw-r--r--ld/emultempl/nios2elf.em2
-rw-r--r--ld/emultempl/pe.em5
-rw-r--r--ld/emultempl/pep.em2
-rw-r--r--ld/emultempl/ppc64elf.em11
-rw-r--r--ld/emultempl/xtensaelf.em10
17 files changed, 52 insertions, 59 deletions
diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em
index 7ffb17e..bd5c888 100644
--- a/ld/emultempl/aarch64elf.em
+++ b/ld/emultempl/aarch64elf.em
@@ -178,7 +178,7 @@ elf${ELFSIZE}_aarch64_add_stub_section (const char *stub_sec_name,
/* Long branch stubs contain a 64-bit address, so the section requires
8 byte alignment. */
- bfd_set_section_alignment (stub_file->the_bfd, stub_sec, 3);
+ bfd_set_section_alignment (stub_sec, 3);
output_section = input_section->output_section;
os = lang_output_section_get (output_section);
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index 8151a9d..1ce8376 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -895,7 +895,7 @@ gld${EMULATION_NAME}_before_allocation (void)
if (is == NULL)
{
einfo (_("%F%P: can't find %s in output section\n"),
- bfd_get_section_name (sec->owner, sec));
+ bfd_section_name (sec));
}
/* Now figure out where the section should go. */
diff --git a/ld/emultempl/armcoff.em b/ld/emultempl/armcoff.em
index 20122aa..180e1fa 100644
--- a/ld/emultempl/armcoff.em
+++ b/ld/emultempl/armcoff.em
@@ -176,8 +176,7 @@ gld${EMULATION_NAME}_finish (void)
/* Special procesing is required for a Thumb entry symbol. The
bottom bit of its address must be set. */
val = (h->u.def.value
- + bfd_get_section_vma (link_info.output_bfd,
- h->u.def.section->output_section)
+ + bfd_section_vma (h->u.def.section->output_section)
+ h->u.def.section->output_offset);
val |= 1;
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index bb32bbb..0cbfcc7 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -232,7 +232,7 @@ elf32_arm_add_stub_section (const char * stub_sec_name,
if (stub_sec == NULL)
goto err_ret;
- bfd_set_section_alignment (stub_file->the_bfd, stub_sec, alignment_power);
+ bfd_set_section_alignment (stub_sec, alignment_power);
os = lang_output_section_get (output_section);
@@ -478,8 +478,7 @@ gld${EMULATION_NAME}_finish (void)
/* Special procesing is required for a Thumb entry symbol. The
bottom bit of its address must be set. */
val = (h->u.def.value
- + bfd_get_section_vma (link_info.output_bfd,
- h->u.def.section->output_section)
+ + bfd_section_vma (h->u.def.section->output_section)
+ h->u.def.section->output_offset);
val |= 1;
diff --git a/ld/emultempl/cr16elf.em b/ld/emultempl/cr16elf.em
index 197f0c6..9cdd356 100644
--- a/ld/emultempl/cr16elf.em
+++ b/ld/emultempl/cr16elf.em
@@ -75,14 +75,12 @@ cr16_elf_after_open (void)
relsec = bfd_make_section (abfd, ".emreloc");
if (relsec == NULL
- || ! bfd_set_section_flags (abfd, relsec,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY))
- || ! bfd_set_section_alignment (abfd, relsec, 2)
- || ! bfd_set_section_size (abfd, relsec,
- datasec->reloc_count * 8))
+ || !bfd_set_section_flags (relsec, (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY))
+ || !bfd_set_section_alignment (relsec, 2)
+ || !bfd_set_section_size (relsec, datasec->reloc_count * 8))
einfo (_("%F%P: %pB: can not create .emreloc section: %E\n"));
}
@@ -99,11 +97,11 @@ cr16_elf_after_open (void)
static void
check_sections (bfd *abfd, asection *sec, void *datasec)
{
- if ((strncmp (bfd_get_section_name (abfd, sec), ".data.rel", 9) == 0)
+ if ((strncmp (bfd_section_name (sec), ".data.rel", 9) == 0)
&& sec != datasec
&& sec->reloc_count == 0 )
einfo (_("%X%P: %pB: section %s has relocs; can not use --embedded-relocs\n"),
- abfd, bfd_get_section_name (abfd, sec));
+ abfd, bfd_section_name (sec));
}
static void
diff --git a/ld/emultempl/cskyelf.em b/ld/emultempl/cskyelf.em
index 10d037c..9184808 100644
--- a/ld/emultempl/cskyelf.em
+++ b/ld/emultempl/cskyelf.em
@@ -180,10 +180,10 @@ elf32_csky_add_stub_section (const char *stub_sec_name,
if (stub_sec == NULL)
goto err_ret;
- bfd_set_section_alignment (stub_file->the_bfd, stub_sec, 3);
+ bfd_set_section_alignment (stub_sec, 3);
output_section = input_section->output_section;
- secname = bfd_get_section_name (output_section->owner, output_section);
+ secname = bfd_section_name (output_section);
os = lang_output_section_find (secname);
info.input_section = input_section;
diff --git a/ld/emultempl/m68hc1xelf.em b/ld/emultempl/m68hc1xelf.em
index b55989e..b63e4e9 100644
--- a/ld/emultempl/m68hc1xelf.em
+++ b/ld/emultempl/m68hc1xelf.em
@@ -212,10 +212,8 @@ hook_in_stub (struct hook_stub_info *info, lang_statement_union_type **lp)
case lang_input_section_enum:
if (l->input_section.section == info->input_section
- || strcmp (bfd_get_section_name (l->input_section.section->owner,
- l->input_section.section),
- bfd_get_section_name (info->input_section->owner,
- info->input_section)) == 0)
+ || strcmp (bfd_section_name (l->input_section.section),
+ bfd_section_name (info->input_section)) == 0)
{
/* We've found our section. Insert the stub immediately
before its associated input section. */
diff --git a/ld/emultempl/m68kelf.em b/ld/emultempl/m68kelf.em
index add8fd2..c8d9eea 100644
--- a/ld/emultempl/m68kelf.em
+++ b/ld/emultempl/m68kelf.em
@@ -102,9 +102,8 @@ m68k_elf_after_open (void)
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY));
if (relsec == NULL
- || ! bfd_set_section_alignment (abfd, relsec, 2)
- || ! bfd_set_section_size (abfd, relsec,
- datasec->reloc_count * 12))
+ || !bfd_set_section_alignment (relsec, 2)
+ || !bfd_set_section_size (relsec, datasec->reloc_count * 12))
einfo (_("%F%P: %pB: can not create .emreloc section: %E\n"));
}
@@ -123,11 +122,11 @@ m68k_elf_after_open (void)
static void
check_sections (bfd *abfd, asection *sec, void *datasec)
{
- if ((bfd_get_section_flags (abfd, sec) & SEC_DATA)
+ if ((bfd_section_flags (sec) & SEC_DATA)
&& sec != datasec
&& sec->reloc_count != 0)
einfo (_("%X%P: %pB: section %s has relocs; can not use --embedded-relocs\n"),
- abfd, bfd_get_section_name (abfd, sec));
+ abfd, bfd_section_name (sec));
}
#endif /* SUPPORT_EMBEDDED_RELOCS */
diff --git a/ld/emultempl/mipself.em b/ld/emultempl/mipself.em
index 108d33f..48944d5 100644
--- a/ld/emultempl/mipself.em
+++ b/ld/emultempl/mipself.em
@@ -168,7 +168,7 @@ mips_add_stub_section (const char *stub_sec_name, asection *input_section,
/* Set the flags. */
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE
| SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_KEEP);
- if (!bfd_set_section_flags (stub_bfd, stub_sec, flags))
+ if (!bfd_set_section_flags (stub_sec, flags))
goto err_ret;
os = lang_output_section_get (output_section);
diff --git a/ld/emultempl/mmix-elfnmmo.em b/ld/emultempl/mmix-elfnmmo.em
index 736988b..7cb4087 100644
--- a/ld/emultempl/mmix-elfnmmo.em
+++ b/ld/emultempl/mmix-elfnmmo.em
@@ -103,14 +103,14 @@ mmix_after_allocation (void)
}
/* Set vma to correspond to first such register number * 8. */
- bfd_set_section_vma (link_info.output_bfd, sec, (bfd_vma) regvma);
+ bfd_set_section_vma (sec, (bfd_vma) regvma);
/* Simplify symbol output for the register section (without contents;
created for register symbols) by setting the output offset to 0.
This section is only present when there are register symbols. */
sec = bfd_get_section_by_name (link_info.output_bfd, MMIX_REG_SECTION_NAME);
if (sec != NULL)
- bfd_set_section_vma (sec->owner, sec, 0);
+ bfd_set_section_vma (sec, 0);
if (!_bfd_mmix_after_linker_allocation (link_info.output_bfd, &link_info))
{
diff --git a/ld/emultempl/mmo.em b/ld/emultempl/mmo.em
index 62ee144..fff4894 100644
--- a/ld/emultempl/mmo.em
+++ b/ld/emultempl/mmo.em
@@ -192,10 +192,10 @@ mmo_place_orphan (asection *s,
paper over the bug similarly. */
static void
-mmo_wipe_sec_reloc_flag (bfd *abfd, asection *sec, void *ptr ATTRIBUTE_UNUSED)
+mmo_wipe_sec_reloc_flag (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
+ void *ptr ATTRIBUTE_UNUSED)
{
- bfd_set_section_flags (abfd, sec,
- bfd_get_section_flags (abfd, sec) & ~SEC_RELOC);
+ bfd_set_section_flags (sec, bfd_section_flags (sec) & ~SEC_RELOC);
}
/* Iterate with bfd_map_over_sections over mmo_wipe_sec_reloc_flag... */
diff --git a/ld/emultempl/msp430.em b/ld/emultempl/msp430.em
index 765a9ea..8f25489 100644
--- a/ld/emultempl/msp430.em
+++ b/ld/emultempl/msp430.em
@@ -382,10 +382,10 @@ change_output_section (lang_statement_union_type ** head,
}
static void
-add_region_prefix (bfd *abfd, asection *s,
- ATTRIBUTE_UNUSED void *unused)
+add_region_prefix (bfd *abfd ATTRIBUTE_UNUSED, asection *s,
+ void *unused ATTRIBUTE_UNUSED)
{
- const char *curr_name = bfd_get_section_name (abfd, s);
+ const char *curr_name = bfd_section_name (s);
int region = REGION_NONE;
if (strncmp (curr_name, ".text", 5) == 0)
@@ -404,10 +404,10 @@ add_region_prefix (bfd *abfd, asection *s,
case REGION_NONE:
break;
case REGION_UPPER:
- bfd_rename_section (abfd, s, concat (".upper", curr_name, NULL));
+ bfd_rename_section (s, concat (".upper", curr_name, NULL));
break;
case REGION_LOWER:
- bfd_rename_section (abfd, s, concat (".lower", curr_name, NULL));
+ bfd_rename_section (s, concat (".lower", curr_name, NULL));
break;
case REGION_EITHER:
s->name = concat (".either", curr_name, NULL);
@@ -538,7 +538,8 @@ gld${EMULATION_NAME}_handle_option (int optc)
}
static void
-eval_upper_either_sections (bfd *abfd, asection *s, void *data)
+eval_upper_either_sections (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *s, void *data)
{
const char * base_sec_name;
const char * curr_name;
@@ -560,7 +561,7 @@ eval_upper_either_sections (bfd *abfd, asection *s, void *data)
return;
base_sec_name = (const char *) data;
- curr_name = bfd_get_section_name (abfd, s);
+ curr_name = bfd_section_name (s);
/* Only concerned with .either input sections in the upper output section. */
either_name = concat (".either", base_sec_name, NULL);
@@ -620,7 +621,8 @@ eval_upper_either_sections (bfd *abfd, asection *s, void *data)
}
static void
-eval_lower_either_sections (bfd *abfd, asection *s, void *data)
+eval_lower_either_sections (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *s, void *data)
{
const char * base_sec_name;
const char * curr_name;
@@ -640,7 +642,7 @@ eval_lower_either_sections (bfd *abfd, asection *s, void *data)
return;
base_sec_name = (const char *) data;
- curr_name = bfd_get_section_name (abfd, s);
+ curr_name = bfd_section_name (s);
/* Only concerned with .either input sections in the lower or "default"
output section i.e. not in the upper output section. */
diff --git a/ld/emultempl/nios2elf.em b/ld/emultempl/nios2elf.em
index 02eb06f..816da6c 100644
--- a/ld/emultempl/nios2elf.em
+++ b/ld/emultempl/nios2elf.em
@@ -181,7 +181,7 @@ nios2elf_add_stub_section (const char *stub_sec_name, asection *input_section,
goto err_ret;
output_section = input_section->output_section;
- secname = bfd_get_section_name (output_section->owner, output_section);
+ secname = bfd_section_name (output_section);
os = lang_output_section_find (secname);
info.input_section = input_section;
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 2e78f26..70f771c 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1920,8 +1920,7 @@ gld_${EMULATION_NAME}_finish (void)
/* Special procesing is required for a Thumb entry symbol. The
bottom bit of its address must be set. */
val = (h->u.def.value
- + bfd_get_section_vma (link_info.output_bfd,
- h->u.def.section->output_section)
+ + bfd_section_vma (h->u.def.section->output_section)
+ h->u.def.section->output_offset);
val |= 1;
@@ -2182,7 +2181,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
ls = &(*pl)->input_section;
- lname = bfd_get_section_name (ls->section->owner, ls->section);
+ lname = bfd_section_name (ls->section);
if (strchr (lname, '\$') != NULL
&& (dollar == NULL || strcmp (orig_secname, lname) < 0))
break;
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 601ef11..6d150d2 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -1979,7 +1979,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
ls = &(*pl)->input_section;
- lname = bfd_get_section_name (ls->section->owner, ls->section);
+ lname = bfd_section_name (ls->section);
if (strchr (lname, '\$') != NULL
&& (dollar == NULL || strcmp (orig_secname, lname) < 0))
break;
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index 6df2a20..ee71f25 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -421,12 +421,11 @@ ppc_add_stub_section (const char *stub_sec_name, asection *input_section)
stub_sec = bfd_make_section_anyway_with_flags (stub_file->the_bfd,
stub_sec_name, flags);
if (stub_sec == NULL
- || !bfd_set_section_alignment (stub_file->the_bfd, stub_sec,
- (params.plt_stub_align > 5
- ? params.plt_stub_align
- : params.plt_stub_align < -5
- ? -params.plt_stub_align
- : 5)))
+ || !bfd_set_section_alignment (stub_sec, (params.plt_stub_align > 5
+ ? params.plt_stub_align
+ : params.plt_stub_align < -5
+ ? -params.plt_stub_align
+ : 5)))
goto err_ret;
output_section = input_section->output_section;
diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em
index c826363..569df61 100644
--- a/ld/emultempl/xtensaelf.em
+++ b/ld/emultempl/xtensaelf.em
@@ -127,9 +127,9 @@ replace_insn_sec_with_prop_sec (bfd *abfd,
/* Create a property table section for it. */
prop_sec_name = strdup (prop_sec_name);
prop_sec = bfd_make_section_with_flags
- (abfd, prop_sec_name, bfd_get_section_flags (abfd, insn_sec));
+ (abfd, prop_sec_name, bfd_section_flags (insn_sec));
if (prop_sec == NULL
- || ! bfd_set_section_alignment (abfd, prop_sec, 2))
+ || !bfd_set_section_alignment (prop_sec, 2))
{
*error_message = _("could not create new section");
goto cleanup;
@@ -247,7 +247,7 @@ replace_instruction_table_sections (bfd *abfd, asection *sec)
char *owned_prop_sec_name = NULL;
const char *sec_name;
- sec_name = bfd_get_section_name (abfd, sec);
+ sec_name = bfd_section_name (sec);
if (strcmp (sec_name, INSN_SEC_BASE_NAME) == 0)
{
insn_sec_name = INSN_SEC_BASE_NAME;
@@ -1293,10 +1293,10 @@ static bfd_boolean
is_inconsistent_linkonce_section (asection *sec)
{
bfd *abfd = sec->owner;
- const char *sec_name = bfd_get_section_name (abfd, sec);
+ const char *sec_name = bfd_section_name (sec);
const char *name;
- if ((bfd_get_section_flags (abfd, sec) & SEC_LINK_ONCE) == 0
+ if ((bfd_section_flags (sec) & SEC_LINK_ONCE) == 0
|| strncmp (sec_name, ".gnu.linkonce.", linkonce_len) != 0)
return FALSE;