aboutsummaryrefslogtreecommitdiff
path: root/gdb
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 /gdb
parent5dfda3562a69686c43aad4fb0269cc9d5ec010d5 (diff)
downloadgdb-fd3619828e94a24a92cddec42cbc0ab33352eeb4.zip
gdb-fd3619828e94a24a92cddec42cbc0ab33352eeb4.tar.gz
gdb-fd3619828e94a24a92cddec42cbc0ab33352eeb4.tar.bz2
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various bfd section macros and functions. The bfd is hardly ever used and if needed for the bfd_set_section_* or bfd_rename_section functions can be found via section->owner except for the com, und, abs, and ind std_section special sections. Those sections shouldn't be modified anyway. The patch also removes various bfd_get_section_<field> macros, replacing their use with bfd_section_<field>, and adds bfd_set_section_lma. I've also fixed a minor bug in gas where compressed section renaming was done directly rather than calling bfd_rename_section. This would have broken bfd_get_section_by_name and similar functions, but that hardly mattered at such a late stage in gas processing. bfd/ * bfd-in.h (bfd_get_section_name, bfd_get_section_vma), (bfd_get_section_lma, bfd_get_section_alignment), (bfd_get_section_size, bfd_get_section_flags), (bfd_get_section_userdata): Delete. (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment): Lose bfd parameter. (bfd_section_flags, bfd_section_userdata): New. (bfd_is_com_section): Rename parameter. * section.c (bfd_set_section_userdata, bfd_set_section_vma), (bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section), (bfd_set_section_size): Delete bfd parameter, rename section parameter. (bfd_set_section_lma): New. * bfd-in2.h: Regenerate. * mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param, update callers. * aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c, * elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c, * mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c, * peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c, * xcofflink.c: Update throughout for bfd section macro and function changes. binutils/ * addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c, * objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c, * od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c, * resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update throughout for bfd section macro and function changes. gas/ * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for bfd section macro and function changes. * write.c (compress_debug): Use bfd_rename_section. gdb/ * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c, * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c, * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c, * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h, * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c, * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c, * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c, * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c, * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c, * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c, * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c, * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c, * solib-spu.c, * solib-svr4.c, * solib-target.c, * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c, * symmisc.c, * symtab.c, * target.c, * windows-nat.c, * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c, * mi/mi-interp.c: Update throughout for bfd section macro and function changes. * gcore (gcore_create_callback): Use bfd_set_section_lma. * spu-tdep.c (spu_overlay_new_objfile): Likewise. gprof/ * corefile.c, * symtab.c: Update throughout for bfd section macro and function changes. ld/ * ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/cr16elf.em, * emultempl/cskyelf.em, * emultempl/m68hc1xelf.em, * emultempl/m68kelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update throughout for bfd section macro and function changes. libctf/ * ctf-open-bfd.c: Update throughout for bfd section macro changes. opcodes/ * arc-ext.c: Update throughout for bfd section macro changes. sim/ * common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c, * erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c, * m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c, * rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c, * rx/trace.c: Update throughout for bfd section macro changes.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog23
-rw-r--r--gdb/aarch64-linux-tdep.c2
-rw-r--r--gdb/arm-tdep.c17
-rw-r--r--gdb/auto-load.c4
-rw-r--r--gdb/cli/cli-dump.c20
-rw-r--r--gdb/coff-pe-read.c2
-rw-r--r--gdb/coffread.c12
-rw-r--r--gdb/compile/compile-object-load.c49
-rw-r--r--gdb/corelow.c17
-rw-r--r--gdb/dbxread.c30
-rw-r--r--gdb/dicos-tdep.c2
-rw-r--r--gdb/dwarf2-frame.c2
-rw-r--r--gdb/dwarf2read.c120
-rw-r--r--gdb/elfread.c24
-rw-r--r--gdb/exec.c34
-rw-r--r--gdb/fbsd-tdep.c12
-rw-r--r--gdb/gcore.c46
-rw-r--r--gdb/gdb_bfd.c15
-rw-r--r--gdb/gdb_bfd.h2
-rw-r--r--gdb/hppa-tdep.c6
-rw-r--r--gdb/i386-cygwin-tdep.c8
-rw-r--r--gdb/i386-fbsd-tdep.c2
-rw-r--r--gdb/i386-linux-tdep.c2
-rw-r--r--gdb/jit.c6
-rw-r--r--gdb/linux-tdep.c2
-rw-r--r--gdb/machoread.c5
-rw-r--r--gdb/maint.c12
-rw-r--r--gdb/mdebugread.c2
-rw-r--r--gdb/mi/mi-interp.c3
-rw-r--r--gdb/minidebug.c2
-rw-r--r--gdb/mips-linux-tdep.c2
-rw-r--r--gdb/mips-sde-tdep.c2
-rw-r--r--gdb/mips-tdep.c4
-rw-r--r--gdb/mipsread.c8
-rw-r--r--gdb/nto-tdep.c4
-rw-r--r--gdb/objfiles.c12
-rw-r--r--gdb/objfiles.h6
-rw-r--r--gdb/osabi.c6
-rw-r--r--gdb/ppc-linux-tdep.c4
-rw-r--r--gdb/ppc64-tdep.c4
-rw-r--r--gdb/record-btrace.c3
-rw-r--r--gdb/record-full.c11
-rw-r--r--gdb/remote.c13
-rw-r--r--gdb/rs6000-aix-tdep.c2
-rw-r--r--gdb/rs6000-tdep.c2
-rw-r--r--gdb/s390-linux-tdep.c2
-rw-r--r--gdb/s390-tdep.c4
-rw-r--r--gdb/solib-aix.c31
-rw-r--r--gdb/solib-dsbt.c20
-rw-r--r--gdb/solib-frv.c14
-rw-r--r--gdb/solib-spu.c2
-rw-r--r--gdb/solib-svr4.c59
-rw-r--r--gdb/solib-target.c8
-rw-r--r--gdb/spu-linux-nat.c2
-rw-r--r--gdb/spu-tdep.c6
-rw-r--r--gdb/symfile-mem.c6
-rw-r--r--gdb/symfile.c119
-rw-r--r--gdb/symmisc.c15
-rw-r--r--gdb/symtab.c15
-rw-r--r--gdb/target.c4
-rw-r--r--gdb/windows-nat.c3
-rw-r--r--gdb/xcoffread.c13
62 files changed, 429 insertions, 460 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 47549ad..7057e37 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,26 @@
+2019-09-18 Alan Modra <amodra@gmail.com>
+
+ * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
+ * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
+ * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
+ * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
+ * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
+ * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
+ * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
+ * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
+ * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
+ * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
+ * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
+ * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
+ * solib-spu.c, * solib-svr4.c, * solib-target.c,
+ * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
+ * symmisc.c, * symtab.c, * target.c, * windows-nat.c,
+ * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
+ * mi/mi-interp.c: Update throughout for bfd section macro and
+ function changes.
+ * gcore (gcore_create_callback): Use bfd_set_section_lma.
+ * spu-tdep.c (spu_overlay_new_objfile): Likewise.
+
2019-09-18 Tom Tromey <tom@tromey.com>
* NEWS: Add entry.
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 831e62f..a375c3b 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -452,7 +452,7 @@ aarch64_linux_core_read_vq (struct gdbarch *gdbarch, bfd *abfd)
return 0;
}
- size_t size = bfd_section_size (abfd, sve_section);
+ size_t size = bfd_section_size (sve_section);
/* Check extended state size. */
if (size < SVE_HEADER_SIZE)
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 5c494c8..e17550f 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -2009,12 +2009,11 @@ arm_obj_section_from_vma (struct objfile *objfile, bfd_vma vma)
struct obj_section *osect;
ALL_OBJFILE_OSECTIONS (objfile, osect)
- if (bfd_get_section_flags (objfile->obfd,
- osect->the_bfd_section) & SEC_ALLOC)
+ if (bfd_section_flags (osect->the_bfd_section) & SEC_ALLOC)
{
bfd_vma start, size;
- start = bfd_get_section_vma (objfile->obfd, osect->the_bfd_section);
- size = bfd_get_section_size (osect->the_bfd_section);
+ start = bfd_section_vma (osect->the_bfd_section);
+ size = bfd_section_size (osect->the_bfd_section);
if (start <= vma && vma < start + size)
return osect;
@@ -2054,8 +2053,8 @@ arm_exidx_new_objfile (struct objfile *objfile)
gdb::byte_vector exidx_data;
if (exidx)
{
- exidx_vma = bfd_section_vma (objfile->obfd, exidx);
- exidx_data.resize (bfd_get_section_size (exidx));
+ exidx_vma = bfd_section_vma (exidx);
+ exidx_data.resize (bfd_section_size (exidx));
if (!bfd_get_section_contents (objfile->obfd, exidx,
exidx_data.data (), 0,
@@ -2067,8 +2066,8 @@ arm_exidx_new_objfile (struct objfile *objfile)
gdb::byte_vector extab_data;
if (extab)
{
- extab_vma = bfd_section_vma (objfile->obfd, extab);
- extab_data.resize (bfd_get_section_size (extab));
+ extab_vma = bfd_section_vma (extab);
+ extab_data.resize (bfd_section_size (extab));
if (!bfd_get_section_contents (objfile->obfd, extab,
extab_data.data (), 0,
@@ -2100,7 +2099,7 @@ arm_exidx_new_objfile (struct objfile *objfile)
sec = arm_obj_section_from_vma (objfile, idx);
if (sec == NULL)
continue;
- idx -= bfd_get_section_vma (objfile->obfd, sec->the_bfd_section);
+ idx -= bfd_section_vma (sec->the_bfd_section);
/* Determine address of exception table entry. */
if (val == 1)
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 9798ab1..136d53f 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -1116,7 +1116,7 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name)
scripts_sect = bfd_get_section_by_name (abfd, section_name);
if (scripts_sect == NULL
- || (bfd_get_section_flags (abfd, scripts_sect) & SEC_HAS_CONTENTS) == 0)
+ || (bfd_section_flags (scripts_sect) & SEC_HAS_CONTENTS) == 0)
return;
if (!bfd_get_full_section_contents (abfd, scripts_sect, &data))
@@ -1128,7 +1128,7 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name)
char *p = (char *) data;
source_section_scripts (objfile, section_name, p,
- p + bfd_get_section_size (scripts_sect));
+ p + bfd_section_size (scripts_sect));
}
}
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 143d02a..74e0057 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -163,12 +163,10 @@ dump_bfd_file (const char *filename, const char *mode,
gdb_bfd_ref_ptr obfd (bfd_openw_or_error (filename, target, mode));
osection = bfd_make_section_anyway (obfd.get (), ".newsec");
- bfd_set_section_size (obfd.get (), osection, len);
- bfd_set_section_vma (obfd.get (), osection, vaddr);
- bfd_set_section_alignment (obfd.get (), osection, 0);
- bfd_set_section_flags (obfd.get (), osection, (SEC_HAS_CONTENTS
- | SEC_ALLOC
- | SEC_LOAD));
+ bfd_set_section_size (osection, len);
+ bfd_set_section_vma (osection, vaddr);
+ bfd_set_section_alignment (osection, 0);
+ bfd_set_section_flags (osection, (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD));
osection->entsize = 0;
if (!bfd_set_section_contents (obfd.get (), osection, buf, 0, len))
warning (_("writing dump file '%s' (%s)"), filename,
@@ -403,15 +401,15 @@ static void
restore_section_callback (bfd *ibfd, asection *isec, void *args)
{
struct callback_data *data = (struct callback_data *) args;
- bfd_vma sec_start = bfd_section_vma (ibfd, isec);
- bfd_size_type size = bfd_section_size (ibfd, isec);
+ bfd_vma sec_start = bfd_section_vma (isec);
+ bfd_size_type size = bfd_section_size (isec);
bfd_vma sec_end = sec_start + size;
bfd_size_type sec_offset = 0;
bfd_size_type sec_load_count = size;
int ret;
/* Ignore non-loadable sections, eg. from elf files. */
- if (!(bfd_get_section_flags (ibfd, isec) & SEC_LOAD))
+ if (!(bfd_section_flags (isec) & SEC_LOAD))
return;
/* Does the section overlap with the desired restore range? */
@@ -420,7 +418,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args)
{
/* No, no useable data in this section. */
printf_filtered (_("skipping section %s...\n"),
- bfd_section_name (ibfd, isec));
+ bfd_section_name (isec));
return;
}
@@ -441,7 +439,7 @@ restore_section_callback (bfd *ibfd, asection *isec, void *args)
bfd_errmsg (bfd_get_error ()));
printf_filtered ("Restoring section %s (0x%lx to 0x%lx)",
- bfd_section_name (ibfd, isec),
+ bfd_section_name (isec),
(unsigned long) sec_start,
(unsigned long) sec_end);
diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
index 9f7384b..fe74d26 100644
--- a/gdb/coff-pe-read.c
+++ b/gdb/coff-pe-read.c
@@ -136,7 +136,7 @@ get_section_vmas (bfd *abfd, asection *sectp, void *context)
bfd_get_section_vma() within memory. Store the offset. */
sections[sectix].vma_offset
- = bfd_get_section_vma (abfd, sectp) - sections[sectix].rva_start;
+ = bfd_section_vma (sectp) - sections[sectix].rva_start;
}
}
diff --git a/gdb/coffread.c b/gdb/coffread.c
index a704612..c44b690 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -222,15 +222,15 @@ coff_locate_sections (bfd *abfd, asection *sectp, void *csip)
const char *name;
csi = (struct coff_symfile_info *) csip;
- name = bfd_get_section_name (abfd, sectp);
+ name = bfd_section_name (sectp);
if (strcmp (name, ".text") == 0)
{
- csi->textaddr = bfd_section_vma (abfd, sectp);
- csi->textsize += bfd_section_size (abfd, sectp);
+ csi->textaddr = bfd_section_vma (sectp);
+ csi->textsize += bfd_section_size (sectp);
}
else if (startswith (name, ".text"))
{
- csi->textsize += bfd_section_size (abfd, sectp);
+ csi->textsize += bfd_section_size (sectp);
}
else if (strcmp (name, ".stabstr") == 0)
{
@@ -307,7 +307,7 @@ cs_section_address (struct coff_symbol *cs, bfd *abfd)
args.resultp = &sect;
bfd_map_over_sections (abfd, find_targ_sec, &args);
if (sect != NULL)
- addr = bfd_get_section_vma (abfd, sect);
+ addr = bfd_section_vma (sect);
return addr;
}
@@ -692,7 +692,7 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
bfd_get_section_contents? */
bfd_seek (abfd, abfd->where, 0);
- stabstrsize = bfd_section_size (abfd, info->stabstrsect);
+ stabstrsize = bfd_section_size (info->stabstrsect);
coffstab_build_psymtabs (objfile,
info->textaddr, info->textsize,
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 3a765a3..a30c557 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -99,30 +99,30 @@ setup_sections (bfd *abfd, asection *sect, void *data_voidp)
if (sect->output_section == NULL)
sect->output_section = sect;
- if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0)
+ if ((bfd_section_flags (sect) & SEC_ALLOC) == 0)
return;
/* Make the memory always readable. */
prot = GDB_MMAP_PROT_READ;
- if ((bfd_get_section_flags (abfd, sect) & SEC_READONLY) == 0)
+ if ((bfd_section_flags (sect) & SEC_READONLY) == 0)
prot |= GDB_MMAP_PROT_WRITE;
- if ((bfd_get_section_flags (abfd, sect) & SEC_CODE) != 0)
+ if ((bfd_section_flags (sect) & SEC_CODE) != 0)
prot |= GDB_MMAP_PROT_EXEC;
if (compile_debug)
fprintf_unfiltered (gdb_stdlog,
"module \"%s\" section \"%s\" size %s prot %u\n",
bfd_get_filename (abfd),
- bfd_get_section_name (abfd, sect),
+ bfd_section_name (sect),
paddress (target_gdbarch (),
- bfd_get_section_size (sect)),
+ bfd_section_size (sect)),
prot);
}
else
prot = -1;
if (sect == NULL
- || (data->last_prot != prot && bfd_get_section_size (sect) != 0))
+ || (data->last_prot != prot && bfd_section_size (sect) != 0))
{
CORE_ADDR addr;
asection *sect_iter;
@@ -150,9 +150,8 @@ setup_sections (bfd *abfd, asection *sect, void *data_voidp)
for (sect_iter = data->last_section_first; sect_iter != sect;
sect_iter = sect_iter->next)
- if ((bfd_get_section_flags (abfd, sect_iter) & SEC_ALLOC) != 0)
- bfd_set_section_vma (abfd, sect_iter,
- addr + bfd_get_section_vma (abfd, sect_iter));
+ if ((bfd_section_flags (sect_iter) & SEC_ALLOC) != 0)
+ bfd_set_section_vma (sect_iter, addr + bfd_section_vma (sect_iter));
data->last_size = 0;
data->last_section_first = sect;
@@ -163,14 +162,14 @@ setup_sections (bfd *abfd, asection *sect, void *data_voidp)
if (sect == NULL)
return;
- alignment = ((CORE_ADDR) 1) << bfd_get_section_alignment (abfd, sect);
+ alignment = ((CORE_ADDR) 1) << bfd_section_alignment (sect);
data->last_max_alignment = std::max (data->last_max_alignment, alignment);
data->last_size = (data->last_size + alignment - 1) & -alignment;
- bfd_set_section_vma (abfd, sect, data->last_size);
+ bfd_set_section_vma (sect, data->last_size);
- data->last_size += bfd_get_section_size (sect);
+ data->last_size += bfd_section_size (sect);
data->last_size = (data->last_size + alignment - 1) & -alignment;
}
@@ -197,7 +196,7 @@ link_callbacks_warning (struct bfd_link_info *link_info, const char *xwarning,
bfd_vma address)
{
warning (_("Compiled module \"%s\" section \"%s\": warning: %s"),
- bfd_get_filename (abfd), bfd_get_section_name (abfd, section),
+ bfd_get_filename (abfd), bfd_section_name (section),
xwarning);
}
@@ -210,7 +209,7 @@ link_callbacks_undefined_symbol (struct bfd_link_info *link_info,
{
warning (_("Cannot resolve relocation to \"%s\" "
"from compiled module \"%s\" section \"%s\"."),
- name, bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
+ name, bfd_get_filename (abfd), bfd_section_name (section));
}
/* Helper for link_callbacks callbacks vector. */
@@ -233,7 +232,7 @@ link_callbacks_reloc_dangerous (struct bfd_link_info *link_info,
{
warning (_("Compiled module \"%s\" section \"%s\": dangerous "
"relocation: %s\n"),
- bfd_get_filename (abfd), bfd_get_section_name (abfd, section),
+ bfd_get_filename (abfd), bfd_section_name (section),
message);
}
@@ -246,7 +245,7 @@ link_callbacks_unattached_reloc (struct bfd_link_info *link_info,
{
warning (_("Compiled module \"%s\" section \"%s\": unattached "
"relocation: %s\n"),
- bfd_get_filename (abfd), bfd_get_section_name (abfd, section),
+ bfd_get_filename (abfd), bfd_section_name (section),
name);
}
@@ -324,11 +323,11 @@ copy_sections (bfd *abfd, asection *sect, void *data)
struct bfd_link_order link_order;
CORE_ADDR inferior_addr;
- if ((bfd_get_section_flags (abfd, sect) & (SEC_ALLOC | SEC_LOAD))
+ if ((bfd_section_flags (sect) & (SEC_ALLOC | SEC_LOAD))
!= (SEC_ALLOC | SEC_LOAD))
return;
- if (bfd_get_section_size (sect) == 0)
+ if (bfd_section_size (sect) == 0)
return;
/* Mostly a copy of bfd_simple_get_relocated_section_contents which GDB
@@ -349,11 +348,11 @@ copy_sections (bfd *abfd, asection *sect, void *data)
link_order.next = NULL;
link_order.type = bfd_indirect_link_order;
link_order.offset = 0;
- link_order.size = bfd_get_section_size (sect);
+ link_order.size = bfd_section_size (sect);
link_order.u.indirect.section = sect;
gdb::unique_xmalloc_ptr<gdb_byte> sect_data
- ((bfd_byte *) xmalloc (bfd_get_section_size (sect)));
+ ((bfd_byte *) xmalloc (bfd_section_size (sect)));
sect_data_got = bfd_get_relocated_section_contents (abfd, &link_info,
&link_order,
@@ -362,19 +361,19 @@ copy_sections (bfd *abfd, asection *sect, void *data)
if (sect_data_got == NULL)
error (_("Cannot map compiled module \"%s\" section \"%s\": %s"),
- bfd_get_filename (abfd), bfd_get_section_name (abfd, sect),
+ bfd_get_filename (abfd), bfd_section_name (sect),
bfd_errmsg (bfd_get_error ()));
gdb_assert (sect_data_got == sect_data.get ());
- inferior_addr = bfd_get_section_vma (abfd, sect);
+ inferior_addr = bfd_section_vma (sect);
if (0 != target_write_memory (inferior_addr, sect_data.get (),
- bfd_get_section_size (sect)))
+ bfd_section_size (sect)))
error (_("Cannot write compiled module \"%s\" section \"%s\" "
"to inferior memory range %s-%s."),
- bfd_get_filename (abfd), bfd_get_section_name (abfd, sect),
+ bfd_get_filename (abfd), bfd_section_name (sect),
paddress (target_gdbarch (), inferior_addr),
paddress (target_gdbarch (),
- inferior_addr + bfd_get_section_size (sect)));
+ inferior_addr + bfd_section_size (sect)));
}
/* Fetch the type of COMPILE_I_EXPR_PTR_TYPE and COMPILE_I_EXPR_VAL
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 5e9634e9..b30b91b 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -289,10 +289,10 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg)
bool fake_pid_p = false;
struct inferior *inf;
- if (!startswith (bfd_section_name (abfd, asect), ".reg/"))
+ if (!startswith (bfd_section_name (asect), ".reg/"))
return;
- core_tid = atoi (bfd_section_name (abfd, asect) + 5);
+ core_tid = atoi (bfd_section_name (asect) + 5);
pid = bfd_core_file_pid (core_bfd);
if (pid == 0)
@@ -584,7 +584,7 @@ core_target::get_core_register_section (struct regcache *regcache,
return;
}
- size = bfd_section_size (core_bfd, section);
+ size = bfd_section_size (section);
if (size < section_min_size)
{
warning (_("Section `%s' in core file too small."),
@@ -614,8 +614,7 @@ core_target::get_core_register_section (struct regcache *regcache,
gdb_assert (m_core_vec != nullptr);
m_core_vec->core_read_registers (regcache, contents, size, which,
- ((CORE_ADDR)
- bfd_section_vma (core_bfd, section)));
+ (CORE_ADDR) bfd_section_vma (section));
}
/* Data passed to gdbarch_iterate_over_regset_sections's callback. */
@@ -727,7 +726,7 @@ add_to_spuid_list (bfd *abfd, asection *asect, void *list_p)
= bfd_big_endian (abfd) ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
int fd, pos = 0;
- sscanf (bfd_section_name (abfd, asect), "SPU/%d/regs%n", &fd, &pos);
+ sscanf (bfd_section_name (asect), "SPU/%d/regs%n", &fd, &pos);
if (pos == 0)
return;
@@ -768,7 +767,7 @@ core_target::xfer_partial (enum target_object object, const char *annex,
if (section == NULL)
return TARGET_XFER_E_IO;
- size = bfd_section_size (core_bfd, section);
+ size = bfd_section_size (section);
if (offset >= size)
return TARGET_XFER_EOF;
size -= offset;
@@ -803,7 +802,7 @@ core_target::xfer_partial (enum target_object object, const char *annex,
if (section == NULL)
return TARGET_XFER_E_IO;
- size = bfd_section_size (core_bfd, section);
+ size = bfd_section_size (section);
if (offset >= size)
return TARGET_XFER_EOF;
size -= offset;
@@ -883,7 +882,7 @@ core_target::xfer_partial (enum target_object object, const char *annex,
if (section == NULL)
return TARGET_XFER_E_IO;
- size = bfd_section_size (core_bfd, section);
+ size = bfd_section_size (section);
if (offset >= size)
return TARGET_XFER_EOF;
size -= offset;
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index dc0b2c7..564c5d3 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -207,10 +207,10 @@ find_text_range (bfd * sym_bfd, struct objfile *objfile)
CORE_ADDR end = 0;
for (sec = sym_bfd->sections; sec; sec = sec->next)
- if (bfd_get_section_flags (sym_bfd, sec) & SEC_CODE)
+ if (bfd_section_flags (sec) & SEC_CODE)
{
- CORE_ADDR sec_start = bfd_section_vma (sym_bfd, sec);
- CORE_ADDR sec_end = sec_start + bfd_section_size (sym_bfd, sec);
+ CORE_ADDR sec_start = bfd_section_vma (sec);
+ CORE_ADDR sec_end = sec_start + bfd_section_size (sec);
if (found_any)
{
@@ -607,8 +607,8 @@ dbx_symfile_init (struct objfile *objfile)
text_sect = bfd_get_section_by_name (sym_bfd, ".text");
if (!text_sect)
error (_("Can't find .text section in symbol file"));
- DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect);
- DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect);
+ DBX_TEXT_ADDR (objfile) = bfd_section_vma (text_sect);
+ DBX_TEXT_SIZE (objfile) = bfd_section_size (text_sect);
DBX_SYMBOL_SIZE (objfile) = obj_symbol_entry_size (sym_bfd);
DBX_SYMCOUNT (objfile) = bfd_get_symcount (sym_bfd);
@@ -781,7 +781,7 @@ fill_symbuf (bfd *sym_bfd)
if (bfd_seek (sym_bfd, filepos, SEEK_SET) != 0)
perror_with_name (bfd_get_filename (sym_bfd));
- symbuf_left = bfd_section_size (sym_bfd, (*symbuf_sections)[sect_idx]);
+ symbuf_left = bfd_section_size ((*symbuf_sections)[sect_idx]);
symbol_table_offset = filepos - symbuf_read;
++sect_idx;
}
@@ -2980,7 +2980,7 @@ coffstab_build_psymtabs (struct objfile *objfile,
= make_scoped_restore (&symbuf_sections);
if (stabsects.size () == 1)
{
- stabsize = bfd_section_size (sym_bfd, stabsects[0]);
+ stabsize = bfd_section_size (stabsects[0]);
DBX_SYMCOUNT (objfile) = stabsize / DBX_SYMBOL_SIZE (objfile);
DBX_SYMTAB_OFFSET (objfile) = stabsects[0]->filepos;
}
@@ -2989,7 +2989,7 @@ coffstab_build_psymtabs (struct objfile *objfile,
DBX_SYMCOUNT (objfile) = 0;
for (asection *section : stabsects)
{
- stabsize = bfd_section_size (sym_bfd, section);
+ stabsize = bfd_section_size (section);
DBX_SYMCOUNT (objfile) += stabsize / DBX_SYMBOL_SIZE (objfile);
}
@@ -2997,7 +2997,7 @@ coffstab_build_psymtabs (struct objfile *objfile,
sect_idx = 1;
symbuf_sections = &stabsects;
- symbuf_left = bfd_section_size (sym_bfd, stabsects[0]);
+ symbuf_left = bfd_section_size (stabsects[0]);
symbuf_read = 0;
}
@@ -3040,7 +3040,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
#define ELF_STABS_SYMBOL_SIZE 12 /* XXX FIXME XXX */
DBX_SYMBOL_SIZE (objfile) = ELF_STABS_SYMBOL_SIZE;
DBX_SYMCOUNT (objfile)
- = bfd_section_size (objfile->obfd, stabsect) / DBX_SYMBOL_SIZE (objfile);
+ = bfd_section_size (stabsect) / DBX_SYMBOL_SIZE (objfile);
DBX_STRINGTAB_SIZE (objfile) = stabstrsize;
DBX_SYMTAB_OFFSET (objfile) = stabsect->filepos;
DBX_STAB_SECTION (objfile) = stabsect;
@@ -3067,7 +3067,7 @@ elfstab_build_psymtabs (struct objfile *objfile, asection *stabsect,
processing_acc_compilation = 1;
symbuf_read = 0;
- symbuf_left = bfd_section_size (objfile->obfd, stabsect);
+ symbuf_left = bfd_section_size (stabsect);
scoped_restore restore_stabs_data = make_scoped_restore (&stabs_data);
gdb::unique_xmalloc_ptr<gdb_byte> data_holder;
@@ -3128,13 +3128,13 @@ stabsect_build_psymtabs (struct objfile *objfile, char *stab_name,
text_sect = bfd_get_section_by_name (sym_bfd, text_name);
if (!text_sect)
error (_("Can't find %s section in symbol file"), text_name);
- DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect);
- DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect);
+ DBX_TEXT_ADDR (objfile) = bfd_section_vma (text_sect);
+ DBX_TEXT_SIZE (objfile) = bfd_section_size (text_sect);
DBX_SYMBOL_SIZE (objfile) = sizeof (struct external_nlist);
- DBX_SYMCOUNT (objfile) = bfd_section_size (sym_bfd, stabsect)
+ DBX_SYMCOUNT (objfile) = bfd_section_size (stabsect)
/ DBX_SYMBOL_SIZE (objfile);
- DBX_STRINGTAB_SIZE (objfile) = bfd_section_size (sym_bfd, stabstrsect);
+ DBX_STRINGTAB_SIZE (objfile) = bfd_section_size (stabstrsect);
DBX_SYMTAB_OFFSET (objfile) = stabsect->filepos; /* XXX - FIXME: POKING
INSIDE BFD DATA
STRUCTURES */
diff --git a/gdb/dicos-tdep.c b/gdb/dicos-tdep.c
index 954428a..3ef9114 100644
--- a/gdb/dicos-tdep.c
+++ b/gdb/dicos-tdep.c
@@ -70,7 +70,7 @@ dicos_load_module_p (bfd *abfd, int header_size)
if (!section)
return 0;
- if (bfd_section_size (abfd, section) != header_size)
+ if (bfd_section_size (section) != header_size)
return 0;
/* Dicos LMs always have a "Dicos_loadModuleInfo" symbol
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index e18b35e..34b8cbc 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1565,7 +1565,7 @@ read_encoded_value (struct comp_unit *unit, gdb_byte encoding,
base = 0;
break;
case DW_EH_PE_pcrel:
- base = bfd_get_section_vma (unit->abfd, unit->dwarf_frame_section);
+ base = bfd_section_vma (unit->dwarf_frame_section);
base += (buf - unit->dwarf_frame_buffer);
break;
case DW_EH_PE_datarel:
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index ea9904c..5e71ded 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2280,7 +2280,7 @@ get_section_name (const struct dwarf2_section_info *section)
asection *sectp = get_section_bfd_section (section);
gdb_assert (sectp != NULL);
- return bfd_section_name (get_section_bfd_owner (section), sectp);
+ return bfd_section_name (sectp);
}
/* Return the name of the file SECTION is in. */
@@ -2315,7 +2315,7 @@ get_section_flags (const struct dwarf2_section_info *section)
asection *sectp = get_section_bfd_section (section);
gdb_assert (sectp != NULL);
- return bfd_get_section_flags (sectp->owner, sectp);
+ return bfd_section_flags (sectp);
}
/* When loading sections, we look either for uncompressed section or for
@@ -2340,7 +2340,7 @@ void
dwarf2_per_objfile::locate_sections (bfd *abfd, asection *sectp,
const dwarf2_debug_sections &names)
{
- flagword aflag = bfd_get_section_flags (abfd, sectp);
+ flagword aflag = bfd_section_flags (sectp);
if ((aflag & SEC_HAS_CONTENTS) == 0)
{
@@ -2348,72 +2348,72 @@ dwarf2_per_objfile::locate_sections (bfd *abfd, asection *sectp,
else if (section_is_p (sectp->name, &names.info))
{
this->info.s.section = sectp;
- this->info.size = bfd_get_section_size (sectp);
+ this->info.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.abbrev))
{
this->abbrev.s.section = sectp;
- this->abbrev.size = bfd_get_section_size (sectp);
+ this->abbrev.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.line))
{
this->line.s.section = sectp;
- this->line.size = bfd_get_section_size (sectp);
+ this->line.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.loc))
{
this->loc.s.section = sectp;
- this->loc.size = bfd_get_section_size (sectp);
+ this->loc.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.loclists))
{
this->loclists.s.section = sectp;
- this->loclists.size = bfd_get_section_size (sectp);
+ this->loclists.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.macinfo))
{
this->macinfo.s.section = sectp;
- this->macinfo.size = bfd_get_section_size (sectp);
+ this->macinfo.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.macro))
{
this->macro.s.section = sectp;
- this->macro.size = bfd_get_section_size (sectp);
+ this->macro.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.str))
{
this->str.s.section = sectp;
- this->str.size = bfd_get_section_size (sectp);
+ this->str.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.line_str))
{
this->line_str.s.section = sectp;
- this->line_str.size = bfd_get_section_size (sectp);
+ this->line_str.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.addr))
{
this->addr.s.section = sectp;
- this->addr.size = bfd_get_section_size (sectp);
+ this->addr.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.frame))
{
this->frame.s.section = sectp;
- this->frame.size = bfd_get_section_size (sectp);
+ this->frame.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.eh_frame))
{
this->eh_frame.s.section = sectp;
- this->eh_frame.size = bfd_get_section_size (sectp);
+ this->eh_frame.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.ranges))
{
this->ranges.s.section = sectp;
- this->ranges.size = bfd_get_section_size (sectp);
+ this->ranges.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.rnglists))
{
this->rnglists.s.section = sectp;
- this->rnglists.size = bfd_get_section_size (sectp);
+ this->rnglists.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.types))
{
@@ -2421,28 +2421,28 @@ dwarf2_per_objfile::locate_sections (bfd *abfd, asection *sectp,
memset (&type_section, 0, sizeof (type_section));
type_section.s.section = sectp;
- type_section.size = bfd_get_section_size (sectp);
+ type_section.size = bfd_section_size (sectp);
this->types.push_back (type_section);
}
else if (section_is_p (sectp->name, &names.gdb_index))
{
this->gdb_index.s.section = sectp;
- this->gdb_index.size = bfd_get_section_size (sectp);
+ this->gdb_index.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.debug_names))
{
this->debug_names.s.section = sectp;
- this->debug_names.size = bfd_get_section_size (sectp);
+ this->debug_names.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names.debug_aranges))
{
this->debug_aranges.s.section = sectp;
- this->debug_aranges.size = bfd_get_section_size (sectp);
+ this->debug_aranges.size = bfd_section_size (sectp);
}
- if ((bfd_get_section_flags (abfd, sectp) & (SEC_LOAD | SEC_ALLOC))
- && bfd_section_vma (abfd, sectp) == 0)
+ if ((bfd_section_flags (sectp) & (SEC_LOAD | SEC_ALLOC))
+ && bfd_section_vma (sectp) == 0)
this->has_section_at_zero = true;
}
@@ -2531,7 +2531,7 @@ dwarf2_read_section (struct objfile *objfile, dwarf2_section_info *info)
{
error (_("Dwarf Error: Can't read DWARF data"
" in section %s [in module %s]"),
- bfd_section_name (abfd, sectp), bfd_get_filename (abfd));
+ bfd_section_name (sectp), bfd_get_filename (abfd));
}
}
@@ -2603,37 +2603,37 @@ locate_dwz_sections (bfd *abfd, asection *sectp, void *arg)
if (section_is_p (sectp->name, &dwarf2_elf_names.abbrev))
{
dwz_file->abbrev.s.section = sectp;
- dwz_file->abbrev.size = bfd_get_section_size (sectp);
+ dwz_file->abbrev.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &dwarf2_elf_names.info))
{
dwz_file->info.s.section = sectp;
- dwz_file->info.size = bfd_get_section_size (sectp);
+ dwz_file->info.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &dwarf2_elf_names.str))
{
dwz_file->str.s.section = sectp;
- dwz_file->str.size = bfd_get_section_size (sectp);
+ dwz_file->str.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &dwarf2_elf_names.line))
{
dwz_file->line.s.section = sectp;
- dwz_file->line.size = bfd_get_section_size (sectp);
+ dwz_file->line.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &dwarf2_elf_names.macro))
{
dwz_file->macro.s.section = sectp;
- dwz_file->macro.size = bfd_get_section_size (sectp);
+ dwz_file->macro.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &dwarf2_elf_names.gdb_index))
{
dwz_file->gdb_index.s.section = sectp;
- dwz_file->gdb_index.size = bfd_get_section_size (sectp);
+ dwz_file->gdb_index.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &dwarf2_elf_names.debug_names))
{
dwz_file->debug_names.s.section = sectp;
- dwz_file->debug_names.size = bfd_get_section_size (sectp);
+ dwz_file->debug_names.size = bfd_section_size (sectp);
}
}
@@ -12311,7 +12311,7 @@ locate_v1_virtual_dwo_sections (asection *sectp,
if (sections->abbrev.s.section != NULL)
return 0;
sections->abbrev.s.section = sectp;
- sections->abbrev.size = bfd_get_section_size (sectp);
+ sections->abbrev.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->info_dwo)
|| section_is_p (sectp->name, &names->types_dwo))
@@ -12320,7 +12320,7 @@ locate_v1_virtual_dwo_sections (asection *sectp,
if (sections->info_or_types.s.section != NULL)
return 0;
sections->info_or_types.s.section = sectp;
- sections->info_or_types.size = bfd_get_section_size (sectp);
+ sections->info_or_types.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->line_dwo))
{
@@ -12328,7 +12328,7 @@ locate_v1_virtual_dwo_sections (asection *sectp,
if (sections->line.s.section != NULL)
return 0;
sections->line.s.section = sectp;
- sections->line.size = bfd_get_section_size (sectp);
+ sections->line.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->loc_dwo))
{
@@ -12336,7 +12336,7 @@ locate_v1_virtual_dwo_sections (asection *sectp,
if (sections->loc.s.section != NULL)
return 0;
sections->loc.s.section = sectp;
- sections->loc.size = bfd_get_section_size (sectp);
+ sections->loc.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->macinfo_dwo))
{
@@ -12344,7 +12344,7 @@ locate_v1_virtual_dwo_sections (asection *sectp,
if (sections->macinfo.s.section != NULL)
return 0;
sections->macinfo.s.section = sectp;
- sections->macinfo.size = bfd_get_section_size (sectp);
+ sections->macinfo.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->macro_dwo))
{
@@ -12352,7 +12352,7 @@ locate_v1_virtual_dwo_sections (asection *sectp,
if (sections->macro.s.section != NULL)
return 0;
sections->macro.s.section = sectp;
- sections->macro.size = bfd_get_section_size (sectp);
+ sections->macro.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->str_offsets_dwo))
{
@@ -12360,7 +12360,7 @@ locate_v1_virtual_dwo_sections (asection *sectp,
if (sections->str_offsets.s.section != NULL)
return 0;
sections->str_offsets.s.section = sectp;
- sections->str_offsets.size = bfd_get_section_size (sectp);
+ sections->str_offsets.size = bfd_section_size (sectp);
}
else
{
@@ -12558,11 +12558,11 @@ create_dwp_v2_section (struct dwarf2_per_objfile *dwarf2_per_objfile,
bounds of the real section. This is a pretty-rare event, so just
flag an error (easier) instead of a warning and trying to cope. */
if (sectp == NULL
- || offset + size > bfd_get_section_size (sectp))
+ || offset + size > bfd_section_size (sectp))
{
error (_("Dwarf Error: Bad DWP V2 section info, doesn't fit"
" in section %s [in module %s]"),
- sectp ? bfd_section_name (abfd, sectp) : "<unknown>",
+ sectp ? bfd_section_name (sectp) : "<unknown>",
objfile_name (dwarf2_per_objfile->objfile));
}
@@ -12933,42 +12933,42 @@ dwarf2_locate_dwo_sections (bfd *abfd, asection *sectp, void *dwo_sections_ptr)
if (section_is_p (sectp->name, &names->abbrev_dwo))
{
dwo_sections->abbrev.s.section = sectp;
- dwo_sections->abbrev.size = bfd_get_section_size (sectp);
+ dwo_sections->abbrev.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->info_dwo))
{
dwo_sections->info.s.section = sectp;
- dwo_sections->info.size = bfd_get_section_size (sectp);
+ dwo_sections->info.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->line_dwo))
{
dwo_sections->line.s.section = sectp;
- dwo_sections->line.size = bfd_get_section_size (sectp);
+ dwo_sections->line.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->loc_dwo))
{
dwo_sections->loc.s.section = sectp;
- dwo_sections->loc.size = bfd_get_section_size (sectp);
+ dwo_sections->loc.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->macinfo_dwo))
{
dwo_sections->macinfo.s.section = sectp;
- dwo_sections->macinfo.size = bfd_get_section_size (sectp);
+ dwo_sections->macinfo.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->macro_dwo))
{
dwo_sections->macro.s.section = sectp;
- dwo_sections->macro.size = bfd_get_section_size (sectp);
+ dwo_sections->macro.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->str_dwo))
{
dwo_sections->str.s.section = sectp;
- dwo_sections->str.size = bfd_get_section_size (sectp);
+ dwo_sections->str.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->str_offsets_dwo))
{
dwo_sections->str_offsets.s.section = sectp;
- dwo_sections->str_offsets.size = bfd_get_section_size (sectp);
+ dwo_sections->str_offsets.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->types_dwo))
{
@@ -12976,7 +12976,7 @@ dwarf2_locate_dwo_sections (bfd *abfd, asection *sectp, void *dwo_sections_ptr)
memset (&type_section, 0, sizeof (type_section));
type_section.s.section = sectp;
- type_section.size = bfd_get_section_size (sectp);
+ type_section.size = bfd_section_size (sectp);
dwo_sections->types.push_back (type_section);
}
}
@@ -13040,17 +13040,17 @@ dwarf2_locate_common_dwp_sections (bfd *abfd, asection *sectp,
if (section_is_p (sectp->name, &names->str_dwo))
{
dwp_file->sections.str.s.section = sectp;
- dwp_file->sections.str.size = bfd_get_section_size (sectp);
+ dwp_file->sections.str.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->cu_index))
{
dwp_file->sections.cu_index.s.section = sectp;
- dwp_file->sections.cu_index.size = bfd_get_section_size (sectp);
+ dwp_file->sections.cu_index.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->tu_index))
{
dwp_file->sections.tu_index.s.section = sectp;
- dwp_file->sections.tu_index.size = bfd_get_section_size (sectp);
+ dwp_file->sections.tu_index.size = bfd_section_size (sectp);
}
}
@@ -13075,42 +13075,42 @@ dwarf2_locate_v2_dwp_sections (bfd *abfd, asection *sectp, void *dwp_file_ptr)
if (section_is_p (sectp->name, &names->abbrev_dwo))
{
dwp_file->sections.abbrev.s.section = sectp;
- dwp_file->sections.abbrev.size = bfd_get_section_size (sectp);
+ dwp_file->sections.abbrev.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->info_dwo))
{
dwp_file->sections.info.s.section = sectp;
- dwp_file->sections.info.size = bfd_get_section_size (sectp);
+ dwp_file->sections.info.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->line_dwo))
{
dwp_file->sections.line.s.section = sectp;
- dwp_file->sections.line.size = bfd_get_section_size (sectp);
+ dwp_file->sections.line.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->loc_dwo))
{
dwp_file->sections.loc.s.section = sectp;
- dwp_file->sections.loc.size = bfd_get_section_size (sectp);
+ dwp_file->sections.loc.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->macinfo_dwo))
{
dwp_file->sections.macinfo.s.section = sectp;
- dwp_file->sections.macinfo.size = bfd_get_section_size (sectp);
+ dwp_file->sections.macinfo.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->macro_dwo))
{
dwp_file->sections.macro.s.section = sectp;
- dwp_file->sections.macro.size = bfd_get_section_size (sectp);
+ dwp_file->sections.macro.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->str_offsets_dwo))
{
dwp_file->sections.str_offsets.s.section = sectp;
- dwp_file->sections.str_offsets.size = bfd_get_section_size (sectp);
+ dwp_file->sections.str_offsets.size = bfd_section_size (sectp);
}
else if (section_is_p (sectp->name, &names->types_dwo))
{
dwp_file->sections.types.s.section = sectp;
- dwp_file->sections.types.size = bfd_get_section_size (sectp);
+ dwp_file->sections.types.size = bfd_section_size (sectp);
}
}
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 630550b..901710f 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -125,7 +125,7 @@ elf_symfile_segments (bfd *abfd)
{
int j;
- if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0)
+ if ((bfd_section_flags (sect) & SEC_ALLOC) == 0)
continue;
Elf_Internal_Shdr *this_hdr = &elf_section_data (sect)->this_hdr;
@@ -146,10 +146,10 @@ elf_symfile_segments (bfd *abfd)
RealView) use SHT_NOBITS for uninitialized data. Since it is
uninitialized, it doesn't need a program header. Such
binaries are not relocatable. */
- if (bfd_get_section_size (sect) > 0 && j == num_segments
- && (bfd_get_section_flags (abfd, sect) & SEC_LOAD) != 0)
+ if (bfd_section_size (sect) > 0 && j == num_segments
+ && (bfd_section_flags (sect) & SEC_LOAD) != 0)
warning (_("Loadable section \"%s\" outside of ELF segments"),
- bfd_section_name (abfd, sect));
+ bfd_section_name (sect));
}
return data;
@@ -289,12 +289,12 @@ elf_symtab_read (minimal_symbol_reader &reader,
covers the stub's address. */
for (sect = abfd->sections; sect != NULL; sect = sect->next)
{
- if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0)
+ if ((bfd_section_flags (sect) & SEC_ALLOC) == 0)
continue;
- if (symaddr >= bfd_get_section_vma (abfd, sect)
- && symaddr < bfd_get_section_vma (abfd, sect)
- + bfd_get_section_size (sect))
+ if (symaddr >= bfd_section_vma (sect)
+ && symaddr < bfd_section_vma (sect)
+ + bfd_section_size (sect))
break;
}
if (!sect)
@@ -591,9 +591,9 @@ elf_rel_plt_read (minimal_symbol_reader &reader,
if (section == NULL)
return false;
- return (bfd_get_section_vma (obfd, section) <= address
- && (address < bfd_get_section_vma (obfd, section)
- + bfd_get_section_size (section)));
+ return (bfd_section_vma (section) <= address
+ && (address < bfd_section_vma (section)
+ + bfd_section_size (section)));
};
reloc_count = relplt->size / elf_section_data (relplt)->this_hdr.sh_entsize;
@@ -1236,7 +1236,7 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
elfstab_build_psymtabs (objfile,
ei.stabsect,
str_sect->filepos,
- bfd_section_size (abfd, str_sect));
+ bfd_section_size (str_sect));
}
if (dwarf2_has_info (objfile, NULL))
diff --git a/gdb/exec.c b/gdb/exec.c
index 4e4cacf..6bdf9ab 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -454,14 +454,14 @@ add_to_section_table (bfd *abfd, struct bfd_section *asect,
encountered on sparc-solaris 2.10 a shared library with an empty .bss
section to which a symbol named "_end" was attached. The address
of this symbol still needs to be relocated. */
- aflag = bfd_get_section_flags (abfd, asect);
+ aflag = bfd_section_flags (asect);
if (!(aflag & SEC_ALLOC))
return;
(*table_pp)->owner = NULL;
(*table_pp)->the_bfd_section = asect;
- (*table_pp)->addr = bfd_section_vma (abfd, asect);
- (*table_pp)->endaddr = (*table_pp)->addr + bfd_section_size (abfd, asect);
+ (*table_pp)->addr = bfd_section_vma (asect);
+ (*table_pp)->endaddr = (*table_pp)->addr + bfd_section_size (asect);
(*table_pp)++;
}
@@ -571,7 +571,7 @@ add_target_sections_of_objfile (struct objfile *objfile)
/* Compute the number of sections to add. */
ALL_OBJFILE_OSECTIONS (objfile, osect)
{
- if (bfd_get_section_size (osect->the_bfd_section) == 0)
+ if (bfd_section_size (osect->the_bfd_section) == 0)
continue;
count++;
}
@@ -585,7 +585,7 @@ add_target_sections_of_objfile (struct objfile *objfile)
ALL_OBJFILE_OSECTIONS (objfile, osect)
{
- if (bfd_get_section_size (osect->the_bfd_section) == 0)
+ if (bfd_section_size (osect->the_bfd_section) == 0)
continue;
gdb_assert (ts < table->sections + space + count);
@@ -665,7 +665,7 @@ exec_read_partial_read_only (gdb_byte *readbuf, ULONGEST offset,
continue;
vma = s->vma;
- size = bfd_get_section_size (s);
+ size = bfd_section_size (s);
if (vma <= offset && offset < (vma + size))
{
ULONGEST amt;
@@ -705,9 +705,7 @@ section_table_available_memory (CORE_ADDR memaddr, ULONGEST len,
for (target_section *p = sections; p < sections_end; p++)
{
- if ((bfd_get_section_flags (p->the_bfd_section->owner,
- p->the_bfd_section)
- & SEC_READONLY) == 0)
+ if ((bfd_section_flags (p->the_bfd_section) & SEC_READONLY) == 0)
continue;
/* Copy the meta-data, adjusted. */
@@ -894,17 +892,16 @@ print_section_info (struct target_section_table *t, bfd *abfd)
for (p = t->sections; p < t->sections_end; p++)
{
struct bfd_section *psect = p->the_bfd_section;
- bfd *pbfd = psect->owner;
- if ((bfd_get_section_flags (pbfd, psect) & (SEC_ALLOC | SEC_LOAD))
+ if ((bfd_section_flags (psect) & (SEC_ALLOC | SEC_LOAD))
!= (SEC_ALLOC | SEC_LOAD))
continue;
- if (bfd_get_section_vma (pbfd, psect) <= abfd->start_address
- && abfd->start_address < (bfd_get_section_vma (pbfd, psect)
- + bfd_get_section_size (psect)))
+ if (bfd_section_vma (psect) <= abfd->start_address
+ && abfd->start_address < (bfd_section_vma (psect)
+ + bfd_section_size (psect)))
{
- displacement = p->addr - bfd_get_section_vma (pbfd, psect);
+ displacement = p->addr - bfd_section_vma (psect);
break;
}
}
@@ -935,7 +932,7 @@ print_section_info (struct target_section_table *t, bfd *abfd)
if (info_verbose)
printf_filtered (" @ %s",
hex_string_custom (psect->filepos, 8));
- printf_filtered (" is %s", bfd_section_name (pbfd, psect));
+ printf_filtered (" is %s", bfd_section_name (psect));
if (pbfd != abfd)
printf_filtered (" in %s", bfd_get_filename (pbfd));
printf_filtered ("\n");
@@ -975,9 +972,8 @@ set_section_command (const char *args, int from_tty)
table = current_target_sections;
for (p = table->sections; p < table->sections_end; p++)
{
- if (!strncmp (secname, bfd_section_name (p->bfd,
- p->the_bfd_section), seclen)
- && bfd_section_name (p->bfd, p->the_bfd_section)[seclen] == '\0')
+ if (!strncmp (secname, bfd_section_name (p->the_bfd_section), seclen)
+ && bfd_section_name (p->the_bfd_section)[seclen] == '\0')
{
offset = secaddr - p->addr;
p->addr += offset;
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index e81c6c9..9422e3c 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -502,10 +502,10 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr)
thread_section_name section_name (".thrmisc", thr->ptid);
section = bfd_get_section_by_name (core_bfd, section_name.c_str ());
- if (section != NULL && bfd_section_size (core_bfd, section) > 0)
+ if (section != NULL && bfd_section_size (section) > 0)
{
/* Truncate the name if it is longer than "buf". */
- size = bfd_section_size (core_bfd, section);
+ size = bfd_section_size (section);
if (size > sizeof buf - 1)
size = sizeof buf - 1;
if (bfd_get_section_contents (core_bfd, section, buf, (file_ptr) 0,
@@ -1058,7 +1058,7 @@ fbsd_core_info_proc_files (struct gdbarch *gdbarch)
return;
}
- size_t note_size = bfd_get_section_size (section);
+ size_t note_size = bfd_section_size (section);
if (note_size < 4)
error (_("malformed core note - too short for header"));
@@ -1191,7 +1191,7 @@ fbsd_core_info_proc_mappings (struct gdbarch *gdbarch)
return;
}
- note_size = bfd_get_section_size (section);
+ note_size = bfd_section_size (section);
if (note_size < 4)
error (_("malformed core note - too short for header"));
@@ -1239,7 +1239,7 @@ fbsd_core_vnode_path (struct gdbarch *gdbarch, int fd)
if (section == NULL)
return nullptr;
- note_size = bfd_get_section_size (section);
+ note_size = bfd_section_size (section);
if (note_size < 4)
error (_("malformed core note - too short for header"));
@@ -1344,7 +1344,7 @@ fbsd_core_info_proc_status (struct gdbarch *gdbarch)
* structure size, then it must be long enough to access the last
* field used (ki_rusage_ch.ru_majflt) which is the size of a long.
*/
- note_size = bfd_get_section_size (section);
+ note_size = bfd_section_size (section);
if (note_size < (4 + kp->ki_rusage_ch + kp->ru_majflt
+ long_bit / TARGET_CHAR_BIT))
error (_("malformed core note - too short"));
diff --git a/gdb/gcore.c b/gdb/gcore.c
index eb108fe..f283ed4 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -95,9 +95,9 @@ write_gcore_file_1 (bfd *obfd)
error (_("Failed to create 'note' section for corefile: %s"),
bfd_errmsg (bfd_get_error ()));
- bfd_set_section_vma (obfd, note_sec, 0);
- bfd_set_section_alignment (obfd, note_sec, 0);
- bfd_set_section_size (obfd, note_sec, note_size);
+ bfd_set_section_vma (note_sec, 0);
+ bfd_set_section_alignment (note_sec, 0);
+ bfd_set_section_size (note_sec, note_size);
/* Now create the memory/load sections. */
if (gcore_memory_sections (obfd) == 0)
@@ -332,11 +332,11 @@ derive_heap_segment (bfd *abfd, bfd_vma *bottom, bfd_vma *top)
for (sec = abfd->sections; sec; sec = sec->next)
{
- if (bfd_get_section_flags (abfd, sec) & SEC_DATA
- || strcmp (".bss", bfd_section_name (abfd, sec)) == 0)
+ if (bfd_section_flags (sec) & SEC_DATA
+ || strcmp (".bss", bfd_section_name (sec)) == 0)
{
- sec_vaddr = bfd_get_section_vma (abfd, sec);
- sec_size = bfd_get_section_size (sec);
+ sec_vaddr = bfd_section_vma (sec);
+ sec_size = bfd_section_size (sec);
if (sec_vaddr + sec_size > top_of_data_memory)
top_of_data_memory = sec_vaddr + sec_size;
}
@@ -365,17 +365,17 @@ make_output_phdrs (bfd *obfd, asection *osec, void *ignored)
int p_type = 0;
/* FIXME: these constants may only be applicable for ELF. */
- if (startswith (bfd_section_name (obfd, osec), "load"))
+ if (startswith (bfd_section_name (osec), "load"))
p_type = PT_LOAD;
- else if (startswith (bfd_section_name (obfd, osec), "note"))
+ else if (startswith (bfd_section_name (osec), "note"))
p_type = PT_NOTE;
else
p_type = PT_NULL;
p_flags |= PF_R; /* Segment is readable. */
- if (!(bfd_get_section_flags (obfd, osec) & SEC_READONLY))
+ if (!(bfd_section_flags (osec) & SEC_READONLY))
p_flags |= PF_W; /* Segment is writable. */
- if (bfd_get_section_flags (obfd, osec) & SEC_CODE)
+ if (bfd_section_flags (osec) & SEC_CODE)
p_flags |= PF_X; /* Segment is executable. */
bfd_record_phdr (obfd, p_type, 1, p_flags, 0, 0, 0, 0, 1, &osec);
@@ -417,8 +417,7 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
{
bfd *abfd = objfile->obfd;
asection *asec = objsec->the_bfd_section;
- bfd_vma align = (bfd_vma) 1 << bfd_get_section_alignment (abfd,
- asec);
+ bfd_vma align = (bfd_vma) 1 << bfd_section_alignment (asec);
bfd_vma start = obj_section_addr (objsec) & -align;
bfd_vma end = (obj_section_endaddr (objsec) + align - 1) & -align;
@@ -464,9 +463,9 @@ gcore_create_callback (CORE_ADDR vaddr, unsigned long size, int read,
plongest (size), paddress (target_gdbarch (), vaddr));
}
- bfd_set_section_size (obfd, osec, size);
- bfd_set_section_vma (obfd, osec, vaddr);
- bfd_section_lma (obfd, osec) = 0; /* ??? bfd_set_section_lma? */
+ bfd_set_section_size (osec, size);
+ bfd_set_section_vma (osec, vaddr);
+ bfd_set_section_lma (osec, 0);
return 0;
}
@@ -482,9 +481,8 @@ objfile_find_memory_regions (struct target_ops *self,
for (objfile *objfile : current_program_space->objfiles ())
ALL_OBJFILE_OSECTIONS (objfile, objsec)
{
- bfd *ibfd = objfile->obfd;
asection *isec = objsec->the_bfd_section;
- flagword flags = bfd_get_section_flags (ibfd, isec);
+ flagword flags = bfd_section_flags (isec);
/* Separate debug info files are irrelevant for gcore. */
if (objfile->separate_debug_objfile_backlink != NULL)
@@ -492,7 +490,7 @@ objfile_find_memory_regions (struct target_ops *self,
if ((flags & SEC_ALLOC) || (flags & SEC_LOAD))
{
- int size = bfd_section_size (ibfd, isec);
+ int size = bfd_section_size (isec);
int ret;
ret = (*func) (obj_section_addr (objsec), size,
@@ -530,15 +528,15 @@ objfile_find_memory_regions (struct target_ops *self,
static void
gcore_copy_callback (bfd *obfd, asection *osec, void *ignored)
{
- bfd_size_type size, total_size = bfd_section_size (obfd, osec);
+ bfd_size_type size, total_size = bfd_section_size (osec);
file_ptr offset = 0;
/* Read-only sections are marked; we don't have to copy their contents. */
- if ((bfd_get_section_flags (obfd, osec) & SEC_LOAD) == 0)
+ if ((bfd_section_flags (osec) & SEC_LOAD) == 0)
return;
/* Only interested in "load" sections. */
- if (!startswith (bfd_section_name (obfd, osec), "load"))
+ if (!startswith (bfd_section_name (osec), "load"))
return;
size = std::min (total_size, (bfd_size_type) MAX_COPY_BYTES);
@@ -549,13 +547,13 @@ gcore_copy_callback (bfd *obfd, asection *osec, void *ignored)
if (size > total_size)
size = total_size;
- if (target_read_memory (bfd_section_vma (obfd, osec) + offset,
+ if (target_read_memory (bfd_section_vma (osec) + offset,
memhunk.data (), size) != 0)
{
warning (_("Memory read failed for corefile "
"section, %s bytes at %s."),
plongest (size),
- paddress (target_gdbarch (), bfd_section_vma (obfd, osec)));
+ paddress (target_gdbarch (), bfd_section_vma (osec)));
break;
}
if (!bfd_set_section_contents (obfd, osec, memhunk.data (),
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index a17460a..8a67d5e 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -480,7 +480,7 @@ static void
free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore)
{
struct gdb_bfd_section_data *sect
- = (struct gdb_bfd_section_data *) bfd_get_section_userdata (abfd, sectp);
+ = (struct gdb_bfd_section_data *) bfd_section_userdata (sectp);
if (sect != NULL && sect->data != NULL)
{
@@ -626,14 +626,13 @@ get_section_descriptor (asection *section)
{
struct gdb_bfd_section_data *result;
- result = ((struct gdb_bfd_section_data *)
- bfd_get_section_userdata (section->owner, section));
+ result = (struct gdb_bfd_section_data *) bfd_section_userdata (section);
if (result == NULL)
{
result = ((struct gdb_bfd_section_data *)
bfd_zalloc (section->owner, sizeof (*result)));
- bfd_set_section_userdata (section->owner, section, result);
+ bfd_set_section_userdata (section, result);
}
return result;
@@ -671,9 +670,9 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
/* Only try to mmap sections which are large enough: we don't want
to waste space due to fragmentation. */
- if (bfd_get_section_size (sectp) > 4 * pagesize)
+ if (bfd_section_size (sectp) > 4 * pagesize)
{
- descriptor->size = bfd_get_section_size (sectp);
+ descriptor->size = bfd_section_size (sectp);
descriptor->data = bfd_mmap (abfd, 0, descriptor->size, PROT_READ,
MAP_PRIVATE, sectp->filepos,
&descriptor->map_addr,
@@ -697,14 +696,14 @@ gdb_bfd_map_section (asection *sectp, bfd_size_type *size)
/* Handle compressed sections, or ordinary uncompressed sections in
the no-mmap case. */
- descriptor->size = bfd_get_section_size (sectp);
+ descriptor->size = bfd_section_size (sectp);
descriptor->data = NULL;
data = NULL;
if (!bfd_get_full_section_contents (abfd, sectp, &data))
{
warning (_("Can't read data for section '%s' in file '%s'"),
- bfd_get_section_name (abfd, sectp),
+ bfd_section_name (sectp),
bfd_get_filename (abfd));
/* Set size to 0 to prevent further attempts to read the invalid
section. */
diff --git a/gdb/gdb_bfd.h b/gdb/gdb_bfd.h
index aa67fc0..674880d 100644
--- a/gdb/gdb_bfd.h
+++ b/gdb/gdb_bfd.h
@@ -106,7 +106,7 @@ void gdb_bfd_record_inclusion (bfd *includer, bfd *includee);
/* Try to read or map the contents of the section SECT. If successful, the
section data is returned and *SIZE is set to the size of the section data;
- this may not be the same as the size according to bfd_get_section_size if the
+ this may not be the same as the size according to bfd_section_size if the
section was compressed. The returned section data is associated with the BFD
and will be destroyed when the BFD is destroyed. There is no other way to
free it; for temporary uses of section data, see bfd_malloc_and_get_section.
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index b1f7188..249d5c9 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -380,7 +380,7 @@ read_unwind_info (struct objfile *objfile)
if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
|| strcmp (unwind_sec->name, ".PARISC.unwind") == 0)
{
- unwind_size = bfd_section_size (objfile->obfd, unwind_sec);
+ unwind_size = bfd_section_size (unwind_sec);
unwind_entries = unwind_size / UNWIND_ENTRY_SIZE;
total_entries += unwind_entries;
@@ -393,7 +393,7 @@ read_unwind_info (struct objfile *objfile)
if (stub_unwind_sec)
{
- stub_unwind_size = bfd_section_size (objfile->obfd, stub_unwind_sec);
+ stub_unwind_size = bfd_section_size (stub_unwind_sec);
stub_entries = stub_unwind_size / STUB_UNWIND_ENTRY_SIZE;
}
else
@@ -421,7 +421,7 @@ read_unwind_info (struct objfile *objfile)
if (strcmp (unwind_sec->name, "$UNWIND_START$") == 0
|| strcmp (unwind_sec->name, ".PARISC.unwind") == 0)
{
- unwind_size = bfd_section_size (objfile->obfd, unwind_sec);
+ unwind_size = bfd_section_size (unwind_sec);
unwind_entries = unwind_size / UNWIND_ENTRY_SIZE;
internalize_unwinds (objfile, &ui->table[index], unwind_sec,
diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c
index 0e3ba82..25c3cfc 100644
--- a/gdb/i386-cygwin-tdep.c
+++ b/gdb/i386-cygwin-tdep.c
@@ -110,14 +110,14 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
if (!startswith (sect->name, ".module"))
return;
- buf = (gdb_byte *) xmalloc (bfd_get_section_size (sect) + 1);
+ buf = (gdb_byte *) xmalloc (bfd_section_size (sect) + 1);
if (!buf)
{
printf_unfiltered ("memory allocation failed for %s\n", sect->name);
goto out;
}
if (!bfd_get_section_contents (abfd, sect,
- buf, 0, bfd_get_section_size (sect)))
+ buf, 0, bfd_section_size (sect)))
goto out;
@@ -130,7 +130,7 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj)
module_name_size =
extract_unsigned_integer (buf + 8, 4, byte_order);
- if (12 + module_name_size > bfd_get_section_size (sect))
+ if (12 + module_name_size > bfd_section_size (sect))
goto out;
module_name = (char *) buf + 12;
@@ -240,7 +240,7 @@ i386_cygwin_osabi_sniffer (bfd *abfd)
{
asection *section = bfd_get_section_by_name (abfd, ".reg");
if (section
- && bfd_section_size (abfd, section) == I386_WINDOWS_SIZEOF_GREGSET)
+ && bfd_section_size (section) == I386_WINDOWS_SIZEOF_GREGSET)
return GDB_OSABI_CYGWIN;
}
diff --git a/gdb/i386-fbsd-tdep.c b/gdb/i386-fbsd-tdep.c
index 3848bf8..04d0a64 100644
--- a/gdb/i386-fbsd-tdep.c
+++ b/gdb/i386-fbsd-tdep.c
@@ -233,7 +233,7 @@ i386fbsd_core_read_xcr0 (bfd *abfd)
if (xstate)
{
- size_t size = bfd_section_size (abfd, xstate);
+ size_t size = bfd_section_size (xstate);
/* Check extended state size. */
if (size < X86_XSTATE_AVX_SIZE)
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 760d000..c410139 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -646,7 +646,7 @@ i386_linux_core_read_xcr0 (bfd *abfd)
if (xstate)
{
- size_t size = bfd_section_size (abfd, xstate);
+ size_t size = bfd_section_size (xstate);
/* Check extended state size. */
if (size < X86_XSTATE_AVX_SIZE)
diff --git a/gdb/jit.c b/gdb/jit.c
index 4722d6c..af01b4d 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -910,12 +910,12 @@ JITed symbol file is not an object file, ignoring it.\n"));
addresses that we care about. */
section_addr_info sai;
for (sec = nbfd->sections; sec != NULL; sec = sec->next)
- if ((bfd_get_section_flags (nbfd.get (), sec) & (SEC_ALLOC|SEC_LOAD)) != 0)
+ if ((bfd_section_flags (sec) & (SEC_ALLOC|SEC_LOAD)) != 0)
{
/* We assume that these virtual addresses are absolute, and do not
treat them as offsets. */
- sai.emplace_back (bfd_get_section_vma (nbfd.get (), sec),
- bfd_get_section_name (nbfd.get (), sec),
+ sai.emplace_back (bfd_section_vma (sec),
+ bfd_section_name (sec),
sec->index);
}
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index ff888a9..63a9bd3 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1046,7 +1046,7 @@ linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args)
addr_size_bits = gdbarch_addr_bit (core_gdbarch);
addr_size = addr_size_bits / 8;
- note_size = bfd_get_section_size (section);
+ note_size = bfd_section_size (section);
if (note_size < 2 * addr_size)
error (_("malformed core note - too short for header"));
diff --git a/gdb/machoread.c b/gdb/machoread.c
index d7471e9..1795982 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -575,7 +575,7 @@ macho_add_oso_symfile (oso_el *oso, const gdb_bfd_ref_ptr &abfd,
sec->name, sym->name,
paddress (arch, res));
}
- bfd_set_section_vma (abfd.get (), sec, res);
+ bfd_set_section_vma (sec, res);
sections_rebased[sec->index] = 1;
}
}
@@ -854,8 +854,7 @@ macho_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags)
{
if (strcmp (asect->name, dsect->name) != 0)
break;
- bfd_set_section_size (dsym_bfd.get (), dsect,
- bfd_get_section_size (asect));
+ bfd_set_section_size (dsect, bfd_section_size (asect));
}
/* Add the dsym file as a separate file. */
diff --git a/gdb/maint.c b/gdb/maint.c
index b8eb938..ec9f4ab 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -335,8 +335,8 @@ print_bfd_section_info (bfd *abfd,
asection *asect,
void *datum)
{
- flagword flags = bfd_get_section_flags (abfd, asect);
- const char *name = bfd_section_name (abfd, asect);
+ flagword flags = bfd_section_flags (asect);
+ const char *name = bfd_section_name (asect);
maint_print_section_data *print_data = (maint_print_section_data *) datum;
const char *arg = print_data->arg;
@@ -348,8 +348,8 @@ print_bfd_section_info (bfd *abfd,
int addr_size = gdbarch_addr_bit (gdbarch) / 8;
CORE_ADDR addr, endaddr;
- addr = bfd_section_vma (abfd, asect);
- endaddr = addr + bfd_section_size (abfd, asect);
+ addr = bfd_section_vma (asect);
+ endaddr = addr + bfd_section_size (asect);
print_section_index (abfd, asect, print_data->index_digits);
maint_print_section_info (name, flags, addr, endaddr,
asect->filepos, addr_size);
@@ -366,8 +366,8 @@ print_objfile_section_info (bfd *abfd,
struct obj_section *asect,
maint_print_section_data *print_data)
{
- flagword flags = bfd_get_section_flags (abfd, asect->the_bfd_section);
- const char *name = bfd_section_name (abfd, asect->the_bfd_section);
+ flagword flags = bfd_section_flags (asect->the_bfd_section);
+ const char *name = bfd_section_name (asect->the_bfd_section);
const char *string = print_data->arg;
if (string == NULL || *string == '\0'
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index dffef8f..0956fbd 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -2338,7 +2338,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
the text section (and fh->adr) really starts at zero. */
text_sect = bfd_get_section_by_name (cur_bfd, ".text");
if (text_sect != NULL
- && (bfd_get_section_flags (cur_bfd, text_sect) & SEC_RELOC))
+ && (bfd_section_flags (text_sect) & SEC_RELOC))
relocatable = 1;
extern_tab = XOBNEWVEC (&objfile->objfile_obstack, EXTR, hdr->iextMax);
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 9033a61..7659e28 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -1179,8 +1179,7 @@ mi_memory_changed (struct inferior *inferior, CORE_ADDR memaddr,
sec = find_pc_section (memaddr);
if (sec != NULL && sec->objfile != NULL)
{
- flagword flags = bfd_get_section_flags (sec->objfile->obfd,
- sec->the_bfd_section);
+ flagword flags = bfd_section_flags (sec->the_bfd_section);
if (flags & SEC_CODE)
mi_uiout->field_string ("type", "code");
diff --git a/gdb/minidebug.c b/gdb/minidebug.c
index 6c67b4e..2a60741 100644
--- a/gdb/minidebug.c
+++ b/gdb/minidebug.c
@@ -87,7 +87,7 @@ lzma_open (struct bfd *nbfd, void *open_closure)
struct gdb_lzma_stream *lstream;
size_t pos;
- size = bfd_get_section_size (section);
+ size = bfd_section_size (section);
offset = section->filepos + size - LZMA_STREAM_HEADER_SIZE;
if (size < LZMA_STREAM_HEADER_SIZE
|| bfd_seek (section->owner, offset, SEEK_SET) != 0
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index 08d0279..eab284d 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -562,7 +562,7 @@ mips_linux_core_read_description (struct gdbarch *gdbarch,
if (! section)
return NULL;
- switch (bfd_section_size (abfd, section))
+ switch (bfd_section_size (section))
{
case sizeof (mips_elf_gregset_t):
return mips_tdesc_gp32;
diff --git a/gdb/mips-sde-tdep.c b/gdb/mips-sde-tdep.c
index cf1ce37..791a599 100644
--- a/gdb/mips-sde-tdep.c
+++ b/gdb/mips-sde-tdep.c
@@ -208,7 +208,7 @@ mips_sde_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect,
enum gdb_osabi *os_ident_ptr = (enum gdb_osabi *) obj;
const char *name;
- name = bfd_get_section_name (abfd, sect);
+ name = bfd_section_name (sect);
/* The presence of a section with a ".sde" prefix is indicative
of an SDE binary. */
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 37a1b2a..6870db8 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -7975,7 +7975,7 @@ static void
mips_find_abi_section (bfd *abfd, asection *sect, void *obj)
{
enum mips_abi *abip = (enum mips_abi *) obj;
- const char *name = bfd_get_section_name (abfd, sect);
+ const char *name = bfd_section_name (sect);
if (*abip != MIPS_ABI_UNKNOWN)
return;
@@ -8003,7 +8003,7 @@ static void
mips_find_long_section (bfd *abfd, asection *sect, void *obj)
{
int *lbp = (int *) obj;
- const char *name = bfd_get_section_name (abfd, sect);
+ const char *name = bfd_section_name (sect);
if (startswith (name, ".gcc_compiled_long32"))
*lbp = 32;
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index b25abe5..b5f7f6c 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -200,10 +200,10 @@ read_alphacoff_dynamic_symtab (minimal_symbol_reader &reader,
|| si.dyninfo_sect == NULL || si.got_sect == NULL)
return;
- gdb::byte_vector sym_sec (bfd_get_section_size (si.sym_sect));
- gdb::byte_vector str_sec (bfd_get_section_size (si.str_sect));
- gdb::byte_vector dyninfo_sec (bfd_get_section_size (si.dyninfo_sect));
- gdb::byte_vector got_sec (bfd_get_section_size (si.got_sect));
+ gdb::byte_vector sym_sec (bfd_section_size (si.sym_sect));
+ gdb::byte_vector str_sec (bfd_section_size (si.str_sect));
+ gdb::byte_vector dyninfo_sec (bfd_section_size (si.dyninfo_sect));
+ gdb::byte_vector got_sec (bfd_section_size (si.got_sect));
if (!bfd_get_section_contents (abfd, si.sym_sect, sym_sec.data (),
(file_ptr) 0, sym_sec.size ()))
diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
index 0c610d2..41b4e25 100644
--- a/gdb/nto-tdep.c
+++ b/gdb/nto-tdep.c
@@ -319,8 +319,8 @@ nto_sniff_abi_note_section (bfd *abfd, asection *sect, void *obj)
const char *name;
const unsigned sizeof_Elf_Nhdr = 12;
- sectname = bfd_get_section_name (abfd, sect);
- sectsize = bfd_section_size (abfd, sect);
+ sectname = bfd_section_name (sect);
+ sectsize = bfd_section_size (sect);
if (sectsize > 128)
sectsize = 128;
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 7cbcbbd..90c4650 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -271,7 +271,7 @@ add_to_objfile_sections_full (struct bfd *abfd, struct bfd_section *asect,
{
flagword aflag;
- aflag = bfd_get_section_flags (abfd, asect);
+ aflag = bfd_section_flags (asect);
if (!(aflag & SEC_ALLOC))
return;
}
@@ -1119,15 +1119,15 @@ static int
insert_section_p (const struct bfd *abfd,
const struct bfd_section *section)
{
- const bfd_vma lma = bfd_section_lma (abfd, section);
+ const bfd_vma lma = bfd_section_lma (section);
- if (overlay_debugging && lma != 0 && lma != bfd_section_vma (abfd, section)
+ if (overlay_debugging && lma != 0 && lma != bfd_section_vma (section)
&& (bfd_get_file_flags (abfd) & BFD_IN_MEMORY) == 0)
/* This is an overlay section. IN_MEMORY check is needed to avoid
discarding sections from the "system supplied DSO" (aka vdso)
on some Linux systems (e.g. Fedora 11). */
return 0;
- if ((bfd_get_section_flags (abfd, section) & SEC_THREAD_LOCAL) != 0)
+ if ((bfd_section_flags (section) & SEC_THREAD_LOCAL) != 0)
/* This is a TLS section. */
return 0;
@@ -1220,10 +1220,10 @@ filter_overlapping_sections (struct obj_section **map, int map_size)
" (A) section `%s' from `%s' [%s, %s)\n"
" (B) section `%s' from `%s' [%s, %s).\n"
"Will ignore section B"),
- bfd_section_name (abfd1, bfds1), objfile_name (objf1),
+ bfd_section_name (bfds1), objfile_name (objf1),
paddress (gdbarch, sect1_addr),
paddress (gdbarch, sect1_endaddr),
- bfd_section_name (abfd2, bfds2), objfile_name (objf2),
+ bfd_section_name (bfds2), objfile_name (objf2),
paddress (gdbarch, sect2_addr),
paddress (gdbarch, sect2_endaddr));
}
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 239aba2..68d36d4 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -143,14 +143,14 @@ struct obj_section
/* The memory address of section S (vma + offset). */
#define obj_section_addr(s) \
- (bfd_get_section_vma ((s)->objfile->obfd, s->the_bfd_section) \
+ (bfd_section_vma (s->the_bfd_section) \
+ obj_section_offset (s))
/* The one-passed-the-end memory address of section S
(vma + size + offset). */
#define obj_section_endaddr(s) \
- (bfd_get_section_vma ((s)->objfile->obfd, s->the_bfd_section) \
- + bfd_get_section_size ((s)->the_bfd_section) \
+ (bfd_section_vma (s->the_bfd_section) \
+ + bfd_section_size ((s)->the_bfd_section) \
+ obj_section_offset (s))
/* The "objstats" structure provides a place for gdb to record some
diff --git a/gdb/osabi.c b/gdb/osabi.c
index 5d4bbcd..cdf72a7 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -416,7 +416,7 @@ check_note (bfd *abfd, asection *sect, char *note, unsigned int *sectsize,
gdb_assert (notesz <= MAX_NOTESZ);
/* Check whether SECT is big enough to comtain the complete note. */
- if (notesz > bfd_section_size (abfd, sect))
+ if (notesz > bfd_section_size (sect))
return 0;
/* Check the note name. */
@@ -445,8 +445,8 @@ generic_elf_osabi_sniff_abi_tag_sections (bfd *abfd, asection *sect, void *obj)
unsigned int sectsize;
char *note;
- name = bfd_get_section_name (abfd, sect);
- sectsize = bfd_section_size (abfd, sect);
+ name = bfd_section_name (sect);
+ sectsize = bfd_section_size (sect);
/* Limit the amount of data to read. */
if (sectsize > MAX_NOTESZ)
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 82277a0..c6181c9 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1558,7 +1558,7 @@ ppc_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
static int
ppc_linux_spu_section (bfd *abfd, asection *asect, void *user_data)
{
- return startswith (bfd_section_name (abfd, asect), "SPU/");
+ return startswith (bfd_section_name (asect), "SPU/");
}
static const struct target_desc *
@@ -1580,7 +1580,7 @@ ppc_linux_core_read_description (struct gdbarch *gdbarch,
if (! section)
return NULL;
- switch (bfd_section_size (abfd, section))
+ switch (bfd_section_size (section))
{
case 48 * 4:
features.wordsize = 4;
diff --git a/gdb/ppc64-tdep.c b/gdb/ppc64-tdep.c
index b29d04c..6a7aabf 100644
--- a/gdb/ppc64-tdep.c
+++ b/gdb/ppc64-tdep.c
@@ -593,8 +593,8 @@ ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
s->the_bfd_section,
&buf, addr - s->addr, 8);
if (res != 0)
- return extract_unsigned_integer (buf, 8, byte_order)
- - bfd_section_vma (s->bfd, s->the_bfd_section) + s->addr;
+ return (extract_unsigned_integer (buf, 8, byte_order)
+ - bfd_section_vma (s->the_bfd_section) + s->addr);
}
return addr;
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index d402d87..b55459e 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1435,8 +1435,7 @@ record_btrace_target::xfer_partial (enum target_object object,
if (section != NULL)
{
/* Check if the section we found is readonly. */
- if ((bfd_get_section_flags (section->the_bfd_section->owner,
- section->the_bfd_section)
+ if ((bfd_section_flags (section->the_bfd_section)
& SEC_READONLY) != 0)
{
/* Truncate the request to fit into this section. */
diff --git a/gdb/record-full.c b/gdb/record-full.c
index c1d124f..0c6cb62 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2350,9 +2350,9 @@ record_full_restore (void)
osec ? "succeeded" : "failed");
if (osec == NULL)
return;
- osec_size = bfd_section_size (core_bfd, osec);
+ osec_size = bfd_section_size (osec);
if (record_debug)
- fprintf_unfiltered (gdb_stdlog, "%s", bfd_section_name (core_bfd, osec));
+ fprintf_unfiltered (gdb_stdlog, "%s", bfd_section_name (osec));
/* Check the magic code. */
bfdcore_read (core_bfd, osec, &magic, sizeof (magic), &bfd_offset);
@@ -2599,10 +2599,9 @@ record_full_base_target::save_record (const char *recfilename)
error (_("Failed to create 'precord' section for corefile %s: %s"),
recfilename,
bfd_errmsg (bfd_get_error ()));
- bfd_set_section_size (obfd.get (), osec, save_size);
- bfd_set_section_vma (obfd.get (), osec, 0);
- bfd_set_section_alignment (obfd.get (), osec, 0);
- bfd_section_lma (obfd.get (), osec) = 0;
+ bfd_set_section_size (osec, save_size);
+ bfd_set_section_vma (osec, 0);
+ bfd_set_section_alignment (osec, 0);
/* Save corefile state. */
write_gcore_file (obfd.get ());
diff --git a/gdb/remote.c b/gdb/remote.c
index e39366d..980864e 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8749,9 +8749,7 @@ remote_target::remote_xfer_live_readonly_partial (gdb_byte *readbuf,
secp = target_section_by_addr (this, memaddr);
if (secp != NULL
- && (bfd_get_section_flags (secp->the_bfd_section->owner,
- secp->the_bfd_section)
- & SEC_READONLY))
+ && (bfd_section_flags (secp->the_bfd_section) & SEC_READONLY))
{
struct target_section *p;
ULONGEST memend = memaddr + len;
@@ -10656,11 +10654,11 @@ compare_sections_command (const char *args, int from_tty)
if (read_only && (s->flags & SEC_READONLY) == 0)
continue; /* Skip writeable sections */
- size = bfd_get_section_size (s);
+ size = bfd_section_size (s);
if (size == 0)
continue; /* Skip zero-length section. */
- sectname = bfd_get_section_name (exec_bfd, s);
+ sectname = bfd_section_name (s);
if (args && strcmp (args, sectname) != 0)
continue; /* Not the section selected by user. */
@@ -13059,7 +13057,6 @@ void
remote_target::trace_set_readonly_regions ()
{
asection *s;
- bfd *abfd = NULL;
bfd_size_type size;
bfd_vma vma;
int anysecs = 0;
@@ -13083,8 +13080,8 @@ remote_target::trace_set_readonly_regions ()
continue;
anysecs = 1;
- vma = bfd_get_section_vma (abfd, s);
- size = bfd_get_section_size (s);
+ vma = bfd_section_vma (s);
+ size = bfd_section_size (s);
sprintf_vma (tmp1, vma);
sprintf_vma (tmp2, vma + size);
sec_length = 1 + strlen (tmp1) + 1 + strlen (tmp2);
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 4964f59..f2ff255 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -1110,7 +1110,7 @@ rs6000_aix_core_xfer_shared_libraries_aix (struct gdbarch *gdbarch,
if (ldinfo_sec == NULL)
error (_("cannot find .ldinfo section from core file: %s"),
bfd_errmsg (bfd_get_error ()));
- ldinfo_size = bfd_get_section_size (ldinfo_sec);
+ ldinfo_size = bfd_section_size (ldinfo_sec);
gdb::byte_vector ldinfo_buf (ldinfo_size);
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 328b41c..47a232f 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -3866,7 +3866,7 @@ bfd_uses_spe_extensions (bfd *abfd)
if (!sect)
return 0;
- size = bfd_get_section_size (sect);
+ size = bfd_section_size (sect);
contents = (gdb_byte *) xmalloc (size);
if (!bfd_get_section_contents (abfd, sect, contents, 0, size))
{
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 02ae28b..ab3889b 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -346,7 +346,7 @@ s390_core_read_description (struct gdbarch *gdbarch,
te = (hwcap & HWCAP_S390_TE);
gs = (hwcap & HWCAP_S390_GS);
- switch (bfd_section_size (abfd, section))
+ switch (bfd_section_size (section))
{
case s390_sizeof_gregset:
if (high_gprs)
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 871efc5..463c0a0 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -697,9 +697,7 @@ s390_load (struct s390_prologue_data *data,
struct target_section *secp;
secp = target_section_by_addr (current_top_target (), addr.k);
if (secp != NULL
- && (bfd_get_section_flags (secp->the_bfd_section->owner,
- secp->the_bfd_section)
- & SEC_READONLY))
+ && (bfd_section_flags (secp->the_bfd_section) & SEC_READONLY))
return pv_constant (read_memory_integer (addr.k, size,
data->byte_order));
}
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 1a25a0d..8308190 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -303,15 +303,13 @@ solib_aix_bss_data_overlap (bfd *abfd)
section after the .data section (the problem has only been
observed when using the GNU linker, and the default linker
script always places the .data and .bss sections in that order). */
- if (bfd_section_vma (abfd, bss_sect)
- < bfd_section_vma (abfd, data_sect))
+ if (bfd_section_vma (bss_sect) < bfd_section_vma (data_sect))
return 0;
- if (bfd_section_vma (abfd, bss_sect)
- < bfd_section_vma (abfd, data_sect) + bfd_get_section_size (data_sect))
- return ((bfd_section_vma (abfd, data_sect)
- + bfd_get_section_size (data_sect))
- - bfd_section_vma (abfd, bss_sect));
+ if (bfd_section_vma (bss_sect)
+ < bfd_section_vma (data_sect) + bfd_section_size (data_sect))
+ return (bfd_section_vma (data_sect) + bfd_section_size (data_sect)
+ - bfd_section_vma (bss_sect));
return 0;
}
@@ -324,7 +322,7 @@ solib_aix_relocate_section_addresses (struct so_list *so,
{
struct bfd_section *bfd_sect = sec->the_bfd_section;
bfd *abfd = bfd_sect->owner;
- const char *section_name = bfd_section_name (abfd, bfd_sect);
+ const char *section_name = bfd_section_name (bfd_sect);
lm_info_aix *info = (lm_info_aix *) so->lm_info;
if (strcmp (section_name, ".text") == 0)
@@ -355,17 +353,17 @@ solib_aix_relocate_section_addresses (struct so_list *so,
CORE_ADDR data_offset = 0;
if (data_sect != NULL)
- data_offset = info->data_addr - bfd_section_vma (abfd, data_sect);
+ data_offset = info->data_addr - bfd_section_vma (data_sect);
- sec->addr = bfd_section_vma (abfd, bfd_sect) + data_offset;
+ sec->addr = bfd_section_vma (bfd_sect) + data_offset;
sec->addr += solib_aix_bss_data_overlap (abfd);
- sec->endaddr = sec->addr + bfd_section_size (abfd, bfd_sect);
+ sec->endaddr = sec->addr + bfd_section_size (bfd_sect);
}
else
{
/* All other sections should not be relocated. */
- sec->addr = bfd_section_vma (abfd, bfd_sect);
- sec->endaddr = sec->addr + bfd_section_size (abfd, bfd_sect);
+ sec->addr = bfd_section_vma (bfd_sect);
+ sec->endaddr = sec->addr + bfd_section_size (bfd_sect);
}
}
@@ -414,7 +412,7 @@ solib_aix_get_section_offsets (struct objfile *objfile,
= objfile->sections[objfile->sect_index_text].the_bfd_section;
offsets->offsets[objfile->sect_index_text]
- = info->text_addr + sect->filepos - bfd_section_vma (abfd, sect);
+ = info->text_addr + sect->filepos - bfd_section_vma (sect);
}
/* .data */
@@ -425,7 +423,7 @@ solib_aix_get_section_offsets (struct objfile *objfile,
= objfile->sections[objfile->sect_index_data].the_bfd_section;
offsets->offsets[objfile->sect_index_data]
- = info->data_addr - bfd_section_vma (abfd, sect);
+ = info->data_addr - bfd_section_vma (sect);
}
/* .bss
@@ -661,8 +659,7 @@ data_obj_section_from_objfile (struct objfile *objfile)
struct obj_section *osect;
ALL_OBJFILE_OSECTIONS (objfile, osect)
- if (strcmp (bfd_section_name (objfile->obfd, osect->the_bfd_section),
- ".data") == 0)
+ if (strcmp (bfd_section_name (osect->the_bfd_section), ".data") == 0)
return osect;
return NULL;
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 59b195f..70d6f2e 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -438,12 +438,12 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
such fallback to the file VMA address without the possibility of
having the section relocated to its actual in-memory address. */
- dyn_addr = bfd_section_vma (abfd, sect);
+ dyn_addr = bfd_section_vma (sect);
}
/* Read in .dynamic from the BFD. We will get the actual value
from memory later. */
- sect_size = bfd_section_size (abfd, sect);
+ sect_size = bfd_section_size (sect);
buf = bufstart = (gdb_byte *) alloca (sect_size);
if (!bfd_get_section_contents (abfd, sect,
buf, 0, sect_size))
@@ -807,7 +807,7 @@ enable_break (void)
/* Read the contents of the .interp section into a local buffer;
the contents specify the dynamic linker this program uses. */
- interp_sect_size = bfd_section_size (exec_bfd, interp_sect);
+ interp_sect_size = bfd_section_size (interp_sect);
buf = (char *) alloca (interp_sect_size);
bfd_get_section_contents (exec_bfd, interp_sect,
buf, 0, interp_sect_size);
@@ -839,24 +839,20 @@ enable_break (void)
interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".text");
if (interp_sect)
{
- info->interp_text_sect_low
- = bfd_section_vma (tmp_bfd.get (), interp_sect);
+ info->interp_text_sect_low = bfd_section_vma (interp_sect);
info->interp_text_sect_low
+= displacement_from_map (ldm, info->interp_text_sect_low);
info->interp_text_sect_high
- = info->interp_text_sect_low
- + bfd_section_size (tmp_bfd.get (), interp_sect);
+ = info->interp_text_sect_low + bfd_section_size (interp_sect);
}
interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".plt");
if (interp_sect)
{
- info->interp_plt_sect_low =
- bfd_section_vma (tmp_bfd.get (), interp_sect);
+ info->interp_plt_sect_low = bfd_section_vma (interp_sect);
info->interp_plt_sect_low
+= displacement_from_map (ldm, info->interp_plt_sect_low);
- info->interp_plt_sect_high =
- info->interp_plt_sect_low + bfd_section_size (tmp_bfd.get (),
- interp_sect);
+ info->interp_plt_sect_high
+ = info->interp_plt_sect_low + bfd_section_size (interp_sect);
}
addr = gdb_bfd_lookup_symbol (tmp_bfd.get (), cmp_name,
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index fdd4b34..08fa576 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -546,7 +546,7 @@ enable_break2 (void)
/* Read the contents of the .interp section into a local buffer;
the contents specify the dynamic linker this program uses. */
- interp_sect_size = bfd_section_size (exec_bfd, interp_sect);
+ interp_sect_size = bfd_section_size (interp_sect);
buf = (char *) alloca (interp_sect_size);
bfd_get_section_contents (exec_bfd, interp_sect,
buf, 0, interp_sect_size);
@@ -603,24 +603,20 @@ enable_break2 (void)
interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".text");
if (interp_sect)
{
- interp_text_sect_low
- = bfd_section_vma (tmp_bfd.get (), interp_sect);
+ interp_text_sect_low = bfd_section_vma (interp_sect);
interp_text_sect_low
+= displacement_from_map (ldm, interp_text_sect_low);
interp_text_sect_high
- = interp_text_sect_low + bfd_section_size (tmp_bfd.get (),
- interp_sect);
+ = interp_text_sect_low + bfd_section_size (interp_sect);
}
interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".plt");
if (interp_sect)
{
- interp_plt_sect_low =
- bfd_section_vma (tmp_bfd.get (), interp_sect);
+ interp_plt_sect_low = bfd_section_vma (interp_sect);
interp_plt_sect_low
+= displacement_from_map (ldm, interp_plt_sect_low);
interp_plt_sect_high =
- interp_plt_sect_low + bfd_section_size (tmp_bfd.get (),
- interp_sect);
+ interp_plt_sect_low + bfd_section_size (interp_sect);
}
addr = gdb_bfd_lookup_symbol (tmp_bfd.get (), cmp_name, "_dl_debug_addr");
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index c5e0aca..49e470a 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -364,7 +364,7 @@ spu_bfd_open (const char *pathname)
spu_name = bfd_get_section_by_name (abfd.get (), ".note.spu_name");
if (spu_name)
{
- int sect_size = bfd_section_size (abfd.get (), spu_name);
+ int sect_size = bfd_section_size (spu_name);
if (sect_size > 20)
{
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index ffae26b..e04fde9 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -234,7 +234,7 @@ lm_addr_check (const struct so_list *so, bfd *abfd)
if (dyninfo_sect == NULL)
goto set_addr;
- dynaddr = bfd_section_vma (abfd, dyninfo_sect);
+ dynaddr = bfd_section_vma (dyninfo_sect);
if (dynaddr + l_addr != l_dynaddr)
{
@@ -559,7 +559,7 @@ find_program_interpreter (void)
interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
if (interp_sect != NULL)
{
- int sect_size = bfd_section_size (exec_bfd, interp_sect);
+ int sect_size = bfd_section_size (interp_sect);
gdb::byte_vector buf (sect_size);
bfd_get_section_contents (exec_bfd, interp_sect, buf.data (), 0,
@@ -618,12 +618,12 @@ scan_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr,
such fallback to the file VMA address without the possibility of
having the section relocated to its actual in-memory address. */
- dyn_addr = bfd_section_vma (abfd, sect);
+ dyn_addr = bfd_section_vma (sect);
}
/* Read in .dynamic from the BFD. We will get the actual value
from memory later. */
- sect_size = bfd_section_size (abfd, sect);
+ sect_size = bfd_section_size (sect);
buf = bufstart = (gdb_byte *) alloca (sect_size);
if (!bfd_get_section_contents (abfd, sect,
buf, 0, sect_size))
@@ -2255,20 +2255,18 @@ enable_break (struct svr4_info *info, int from_tty)
interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
if (interp_sect)
{
- info->interp_text_sect_low =
- bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
- info->interp_text_sect_high =
- info->interp_text_sect_low
- + bfd_section_size (tmp_bfd, interp_sect);
+ info->interp_text_sect_low
+ = bfd_section_vma (interp_sect) + load_addr;
+ info->interp_text_sect_high
+ = info->interp_text_sect_low + bfd_section_size (interp_sect);
}
interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt");
if (interp_sect)
{
- info->interp_plt_sect_low =
- bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
- info->interp_plt_sect_high =
- info->interp_plt_sect_low
- + bfd_section_size (tmp_bfd, interp_sect);
+ info->interp_plt_sect_low
+ = bfd_section_vma (interp_sect) + load_addr;
+ info->interp_plt_sect_high
+ = info->interp_plt_sect_low + bfd_section_size (interp_sect);
}
svr4_create_solib_event_breakpoints (info, target_gdbarch (), sym_addr);
@@ -2392,20 +2390,18 @@ enable_break (struct svr4_info *info, int from_tty)
interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".text");
if (interp_sect)
{
- info->interp_text_sect_low =
- bfd_section_vma (tmp_bfd.get (), interp_sect) + load_addr;
- info->interp_text_sect_high =
- info->interp_text_sect_low
- + bfd_section_size (tmp_bfd.get (), interp_sect);
+ info->interp_text_sect_low
+ = bfd_section_vma (interp_sect) + load_addr;
+ info->interp_text_sect_high
+ = info->interp_text_sect_low + bfd_section_size (interp_sect);
}
interp_sect = bfd_get_section_by_name (tmp_bfd.get (), ".plt");
if (interp_sect)
{
- info->interp_plt_sect_low =
- bfd_section_vma (tmp_bfd.get (), interp_sect) + load_addr;
- info->interp_plt_sect_high =
- info->interp_plt_sect_low
- + bfd_section_size (tmp_bfd.get (), interp_sect);
+ info->interp_plt_sect_low
+ = bfd_section_vma (interp_sect) + load_addr;
+ info->interp_plt_sect_high
+ = info->interp_plt_sect_low + bfd_section_size (interp_sect);
}
/* Now try to set a breakpoint in the dynamic linker. */
@@ -2733,7 +2729,7 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
gdb_byte *buf_filesz_p = (gdb_byte *) &phdrp->p_filesz;
CORE_ADDR filesz;
- content2 = (bfd_get_section_flags (exec_bfd, plt2_asect)
+ content2 = (bfd_section_flags (plt2_asect)
& SEC_HAS_CONTENTS) != 0;
filesz = extract_unsigned_integer (buf_filesz_p, 4,
@@ -2742,9 +2738,9 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
/* PLT2_ASECT is from on-disk file (exec_bfd) while
FILESZ is from the in-memory image. */
if (content2)
- filesz += bfd_get_section_size (plt2_asect);
+ filesz += bfd_section_size (plt2_asect);
else
- filesz -= bfd_get_section_size (plt2_asect);
+ filesz -= bfd_section_size (plt2_asect);
store_unsigned_integer (buf_filesz_p, 4, byte_order,
filesz);
@@ -2867,7 +2863,7 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
gdb_byte *buf_filesz_p = (gdb_byte *) &phdrp->p_filesz;
CORE_ADDR filesz;
- content2 = (bfd_get_section_flags (exec_bfd, plt2_asect)
+ content2 = (bfd_section_flags (plt2_asect)
& SEC_HAS_CONTENTS) != 0;
filesz = extract_unsigned_integer (buf_filesz_p, 8,
@@ -2876,9 +2872,9 @@ svr4_exec_displacement (CORE_ADDR *displacementp)
/* PLT2_ASECT is from on-disk file (exec_bfd) while
FILESZ is from the in-memory image. */
if (content2)
- filesz += bfd_get_section_size (plt2_asect);
+ filesz += bfd_section_size (plt2_asect);
else
- filesz -= bfd_get_section_size (plt2_asect);
+ filesz -= bfd_section_size (plt2_asect);
store_unsigned_integer (buf_filesz_p, 8, byte_order,
filesz);
@@ -2972,8 +2968,7 @@ svr4_relocate_main_executable (void)
for (asect = exec_bfd->sections; asect != NULL; asect = asect->next)
exec_set_section_address (bfd_get_filename (exec_bfd), asect->index,
- (bfd_section_vma (exec_bfd, asect)
- + displacement));
+ bfd_section_vma (asect) + displacement);
}
}
diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index 1ccbc27..3fd1808 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -323,7 +323,7 @@ solib_target_relocate_section_addresses (struct so_list *so,
for (i = 0, sect = so->abfd->sections;
sect != NULL;
i++, sect = sect->next)
- if ((bfd_get_section_flags (so->abfd, sect) & SEC_ALLOC))
+ if ((bfd_section_flags (sect) & SEC_ALLOC))
num_alloc_sections++;
if (num_alloc_sections != li->section_bases.size ())
@@ -341,14 +341,14 @@ Could not relocate shared library \"%s\": wrong number of ALLOC sections"),
sect != NULL;
i++, sect = sect->next)
{
- if (!(bfd_get_section_flags (so->abfd, sect) & SEC_ALLOC))
+ if (!(bfd_section_flags (sect) & SEC_ALLOC))
continue;
- if (bfd_section_size (so->abfd, sect) > 0)
+ if (bfd_section_size (sect) > 0)
{
CORE_ADDR low, high;
low = li->section_bases[i];
- high = low + bfd_section_size (so->abfd, sect) - 1;
+ high = low + bfd_section_size (sect) - 1;
if (low < so->addr_low)
so->addr_low = low;
diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c
index 9dbb633..635366b 100644
--- a/gdb/spu-linux-nat.c
+++ b/gdb/spu-linux-nat.c
@@ -363,7 +363,7 @@ spu_bfd_open (ULONGEST addr)
spu_name = bfd_get_section_by_name (nbfd.get (), ".note.spu_name");
if (spu_name)
{
- int sect_size = bfd_section_size (nbfd.get (), spu_name);
+ int sect_size = bfd_section_size (spu_name);
if (sect_size > 20)
{
char *buf = (char *)alloca (sect_size - 20 + 1);
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index d01f3af..5360efb 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1833,7 +1833,7 @@ spu_get_overlay_table (struct objfile *objfile)
continue;
ALL_OBJFILE_OSECTIONS (objfile, osect)
- if (vma == bfd_section_vma (objfile->obfd, osect->the_bfd_section)
+ if (vma == bfd_section_vma (osect->the_bfd_section)
&& pos == osect->the_bfd_section->filepos)
{
int ndx = osect - objfile->sections;
@@ -1921,9 +1921,9 @@ spu_overlay_new_objfile (struct objfile *objfile)
int ndx = osect - objfile->sections;
if (ovly_table[ndx].mapped_ptr == 0)
- bfd_section_lma (obfd, bsect) = bfd_section_vma (obfd, bsect);
+ bfd_set_section_lma (bsect, bfd_section_vma (bsect));
else
- bfd_section_lma (obfd, bsect) = SPU_OVERLAY_LMA + bsect->filepos;
+ bfd_set_section_lma (bsect, SPU_OVERLAY_LMA + bsect->filepos);
}
}
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index 05542c1..82fb17e 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -111,9 +111,9 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
section_addr_info sai;
for (sec = nbfd->sections; sec != NULL; sec = sec->next)
- if ((bfd_get_section_flags (nbfd, sec) & (SEC_ALLOC|SEC_LOAD)) != 0)
- sai.emplace_back (bfd_get_section_vma (nbfd, sec) + loadbase,
- bfd_get_section_name (nbfd, sec),
+ if ((bfd_section_flags (sec) & (SEC_ALLOC|SEC_LOAD)) != 0)
+ sai.emplace_back (bfd_section_vma (sec) + loadbase,
+ bfd_section_name (sec),
sec->index);
if (from_tty)
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 5252c72..b914b05 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -200,15 +200,14 @@ find_lowest_section (bfd *abfd, asection *sect, void *obj)
{
asection **lowest = (asection **) obj;
- if (0 == (bfd_get_section_flags (abfd, sect) & (SEC_ALLOC | SEC_LOAD)))
+ if (0 == (bfd_section_flags (sect) & (SEC_ALLOC | SEC_LOAD)))
return;
if (!*lowest)
*lowest = sect; /* First loadable section */
- else if (bfd_section_vma (abfd, *lowest) > bfd_section_vma (abfd, sect))
+ else if (bfd_section_vma (*lowest) > bfd_section_vma (sect))
*lowest = sect; /* A lower loadable section */
- else if (bfd_section_vma (abfd, *lowest) == bfd_section_vma (abfd, sect)
- && (bfd_section_size (abfd, (*lowest))
- <= bfd_section_size (abfd, sect)))
+ else if (bfd_section_vma (*lowest) == bfd_section_vma (sect)
+ && (bfd_section_size (*lowest) <= bfd_section_size (sect)))
*lowest = sect;
}
@@ -228,10 +227,10 @@ build_section_addr_info_from_section_table (const struct target_section *start,
struct bfd_section *asect = stp->the_bfd_section;
bfd *abfd = asect->owner;
- if (bfd_get_section_flags (abfd, asect) & (SEC_ALLOC | SEC_LOAD)
+ if (bfd_section_flags (asect) & (SEC_ALLOC | SEC_LOAD)
&& sap.size () < end - start)
sap.emplace_back (stp->addr,
- bfd_section_name (abfd, asect),
+ bfd_section_name (asect),
gdb_bfd_section_index (abfd, asect));
}
@@ -247,9 +246,9 @@ build_section_addr_info_from_bfd (bfd *abfd)
section_addr_info sap;
for (sec = abfd->sections; sec != NULL; sec = sec->next)
- if (bfd_get_section_flags (abfd, sec) & (SEC_ALLOC | SEC_LOAD))
- sap.emplace_back (bfd_get_section_vma (abfd, sec),
- bfd_get_section_name (abfd, sec),
+ if (bfd_section_flags (sec) & (SEC_ALLOC | SEC_LOAD))
+ sap.emplace_back (bfd_section_vma (sec),
+ bfd_section_name (sec),
gdb_bfd_section_index (abfd, sec));
return sap;
@@ -353,10 +352,10 @@ place_section (bfd *abfd, asection *sect, void *obj)
struct place_section_arg *arg = (struct place_section_arg *) obj;
CORE_ADDR *offsets = arg->offsets->offsets, start_addr;
int done;
- ULONGEST align = ((ULONGEST) 1) << bfd_get_section_alignment (abfd, sect);
+ ULONGEST align = ((ULONGEST) 1) << bfd_section_alignment (sect);
/* We are only interested in allocated sections. */
- if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0)
+ if ((bfd_section_flags (sect) & SEC_ALLOC) == 0)
return;
/* If the user specified an offset, honor it. */
@@ -380,7 +379,7 @@ place_section (bfd *abfd, asection *sect, void *obj)
continue;
/* We can only conflict with allocated sections. */
- if ((bfd_get_section_flags (abfd, cur_sec) & SEC_ALLOC) == 0)
+ if ((bfd_section_flags (cur_sec) & SEC_ALLOC) == 0)
continue;
/* If the section offset is 0, either the section has not been placed
@@ -390,10 +389,10 @@ place_section (bfd *abfd, asection *sect, void *obj)
continue;
/* If this section would overlap us, then we must move up. */
- if (start_addr + bfd_get_section_size (sect) > offsets[indx]
- && start_addr < offsets[indx] + bfd_get_section_size (cur_sec))
+ if (start_addr + bfd_section_size (sect) > offsets[indx]
+ && start_addr < offsets[indx] + bfd_section_size (cur_sec))
{
- start_addr = offsets[indx] + bfd_get_section_size (cur_sec);
+ start_addr = offsets[indx] + bfd_section_size (cur_sec);
start_addr = (start_addr + align - 1) & -align;
done = 0;
break;
@@ -405,7 +404,7 @@ place_section (bfd *abfd, asection *sect, void *obj)
while (!done);
offsets[gdb_bfd_section_index (abfd, sect)] = start_addr;
- arg->lowest = start_addr + bfd_get_section_size (sect);
+ arg->lowest = start_addr + bfd_section_size (sect);
}
/* Store section_addr_info as prepared (made relative and with SECTINDEX
@@ -510,7 +509,7 @@ addr_info_make_relative (section_addr_info *addrs, bfd *abfd)
lower_offset = 0;
}
else
- lower_offset = bfd_section_vma (bfd_get_filename (abfd), lower_sect);
+ lower_offset = bfd_section_vma (lower_sect);
/* Create ADDRS_TO_ABFD_ADDRS array to map the sections in ADDRS to sections
in ABFD. Section names are not unique - there can be multiple sections of
@@ -658,7 +657,7 @@ default_symfile_offsets (struct objfile *objfile,
for (cur_sec = abfd->sections; cur_sec != NULL; cur_sec = cur_sec->next)
/* We do not expect this to happen; just skip this step if the
relocatable file has a section with an assigned VMA. */
- if (bfd_section_vma (abfd, cur_sec) != 0)
+ if (bfd_section_vma (cur_sec) != 0)
break;
if (cur_sec == NULL)
@@ -700,10 +699,10 @@ default_symfile_offsets (struct objfile *objfile,
for (cur_sec = abfd->sections; cur_sec != NULL;
cur_sec = cur_sec->next)
{
- if ((bfd_get_section_flags (abfd, cur_sec) & SEC_ALLOC) == 0)
+ if ((bfd_section_flags (cur_sec) & SEC_ALLOC) == 0)
continue;
- bfd_set_section_vma (abfd, cur_sec, offsets[cur_sec->index]);
+ bfd_set_section_vma (cur_sec, offsets[cur_sec->index]);
exec_set_section_address (bfd_get_filename (abfd),
cur_sec->index,
offsets[cur_sec->index]);
@@ -740,7 +739,7 @@ default_symfile_segments (bfd *abfd)
/* Make sure there is at least one loadable section in the file. */
for (sect = abfd->sections; sect != NULL; sect = sect->next)
{
- if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0)
+ if ((bfd_section_flags (sect) & SEC_ALLOC) == 0)
continue;
break;
@@ -748,8 +747,8 @@ default_symfile_segments (bfd *abfd)
if (sect == NULL)
return NULL;
- low = bfd_get_section_vma (abfd, sect);
- high = low + bfd_get_section_size (sect);
+ low = bfd_section_vma (sect);
+ high = low + bfd_section_size (sect);
data = XCNEW (struct symfile_segment_data);
data->num_segments = 1;
@@ -763,14 +762,14 @@ default_symfile_segments (bfd *abfd)
{
CORE_ADDR vma;
- if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0)
+ if ((bfd_section_flags (sect) & SEC_ALLOC) == 0)
continue;
- vma = bfd_get_section_vma (abfd, sect);
+ vma = bfd_section_vma (sect);
if (vma < low)
low = vma;
- if (vma + bfd_get_section_size (sect) > high)
- high = vma + bfd_get_section_size (sect);
+ if (vma + bfd_section_size (sect) > high)
+ high = vma + bfd_section_size (sect);
data->segment_info[i] = 1;
}
@@ -872,9 +871,9 @@ init_entry_point_info (struct objfile *objfile)
{
struct bfd_section *sect = osect->the_bfd_section;
- if (entry_point >= bfd_get_section_vma (objfile->obfd, sect)
- && entry_point < (bfd_get_section_vma (objfile->obfd, sect)
- + bfd_get_section_size (sect)))
+ if (entry_point >= bfd_section_vma (sect)
+ && entry_point < (bfd_section_vma (sect)
+ + bfd_section_size (sect)))
{
ei->the_bfd_section_index
= gdb_bfd_section_index (objfile->obfd, sect);
@@ -1878,7 +1877,7 @@ add_section_size_callback (bfd *abfd, asection *asec, void *data)
{
bfd_size_type *sum = (bfd_size_type *) data;
- *sum += bfd_get_section_size (asec);
+ *sum += bfd_section_size (asec);
}
/* Opaque data for load_progress. */
@@ -2001,16 +2000,16 @@ static void
load_section_callback (bfd *abfd, asection *asec, void *data)
{
struct load_section_data *args = (struct load_section_data *) data;
- bfd_size_type size = bfd_get_section_size (asec);
- const char *sect_name = bfd_get_section_name (abfd, asec);
+ bfd_size_type size = bfd_section_size (asec);
+ const char *sect_name = bfd_section_name (asec);
- if ((bfd_get_section_flags (abfd, asec) & SEC_LOAD) == 0)
+ if ((bfd_section_flags (asec) & SEC_LOAD) == 0)
return;
if (size == 0)
return;
- ULONGEST begin = bfd_section_lma (abfd, asec) + args->load_offset;
+ ULONGEST begin = bfd_section_lma (asec) + args->load_offset;
ULONGEST end = begin + size;
gdb_byte *buffer = (gdb_byte *) xmalloc (size);
bfd_get_section_contents (abfd, asec, buffer, 0, size);
@@ -2988,9 +2987,8 @@ section_is_overlay (struct obj_section *section)
{
asection *bfd_section = section->the_bfd_section;
- if (bfd_section_lma (abfd, bfd_section) != 0
- && bfd_section_lma (abfd, bfd_section)
- != bfd_section_vma (abfd, bfd_section))
+ if (bfd_section_lma (bfd_section) != 0
+ && bfd_section_lma (bfd_section) != bfd_section_vma (bfd_section))
return 1;
}
@@ -3061,15 +3059,14 @@ pc_in_unmapped_range (CORE_ADDR pc, struct obj_section *section)
{
if (section_is_overlay (section))
{
- bfd *abfd = section->objfile->obfd;
asection *bfd_section = section->the_bfd_section;
/* We assume the LMA is relocated by the same offset as the VMA. */
- bfd_vma size = bfd_get_section_size (bfd_section);
+ bfd_vma size = bfd_section_size (bfd_section);
CORE_ADDR offset = obj_section_offset (section);
- if (bfd_get_section_lma (abfd, bfd_section) + offset <= pc
- && pc < bfd_get_section_lma (abfd, bfd_section) + offset + size)
+ if (bfd_section_lma (bfd_section) + offset <= pc
+ && pc < bfd_section_lma (bfd_section) + offset + size)
return 1;
}
@@ -3117,8 +3114,8 @@ overlay_unmapped_address (CORE_ADDR pc, struct obj_section *section)
{
asection *bfd_section = section->the_bfd_section;
- return pc + bfd_section_lma (abfd, bfd_section)
- - bfd_section_vma (abfd, bfd_section);
+ return (pc + bfd_section_lma (bfd_section)
+ - bfd_section_vma (bfd_section));
}
return pc;
@@ -3135,8 +3132,8 @@ overlay_mapped_address (CORE_ADDR pc, struct obj_section *section)
{
asection *bfd_section = section->the_bfd_section;
- return pc + bfd_section_vma (abfd, bfd_section)
- - bfd_section_lma (abfd, bfd_section);
+ return (pc + bfd_section_vma (bfd_section)
+ - bfd_section_lma (bfd_section));
}
return pc;
@@ -3241,10 +3238,10 @@ list_overlays_command (const char *args, int from_tty)
bfd_vma lma, vma;
int size;
- vma = bfd_section_vma (objfile->obfd, osect->the_bfd_section);
- lma = bfd_section_lma (objfile->obfd, osect->the_bfd_section);
- size = bfd_get_section_size (osect->the_bfd_section);
- name = bfd_section_name (objfile->obfd, osect->the_bfd_section);
+ vma = bfd_section_vma (osect->the_bfd_section);
+ lma = bfd_section_lma (osect->the_bfd_section);
+ size = bfd_section_size (osect->the_bfd_section);
+ name = bfd_section_name (osect->the_bfd_section);
printf_filtered ("Section %s, loaded at ", name);
fputs_filtered (paddress (gdbarch, lma), gdb_stdout);
@@ -3282,8 +3279,7 @@ map_overlay_command (const char *args, int from_tty)
/* First, find a section matching the user supplied argument. */
for (objfile *obj_file : current_program_space->objfiles ())
ALL_OBJFILE_OSECTIONS (obj_file, sec)
- if (!strcmp (bfd_section_name (obj_file->obfd, sec->the_bfd_section),
- args))
+ if (!strcmp (bfd_section_name (sec->the_bfd_section), args))
{
/* Now, check to see if the section is an overlay. */
if (!section_is_overlay (sec))
@@ -3301,8 +3297,7 @@ map_overlay_command (const char *args, int from_tty)
{
if (info_verbose)
printf_unfiltered (_("Note: section %s unmapped by overlap\n"),
- bfd_section_name (obj_file->obfd,
- sec2->the_bfd_section));
+ bfd_section_name (sec2->the_bfd_section));
sec2->ovly_mapped = 0; /* sec2 overlaps sec: unmap sec2. */
}
return;
@@ -3330,7 +3325,7 @@ unmap_overlay_command (const char *args, int from_tty)
/* First, find a section matching the user supplied argument. */
for (objfile *objfile : current_program_space->objfiles ())
ALL_OBJFILE_OSECTIONS (objfile, sec)
- if (!strcmp (bfd_section_name (objfile->obfd, sec->the_bfd_section), args))
+ if (!strcmp (bfd_section_name (sec->the_bfd_section), args))
{
if (!sec->ovly_mapped)
error (_("Section %s is not mapped"), args);
@@ -3539,14 +3534,14 @@ simple_overlay_update_1 (struct obj_section *osect)
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
for (i = 0; i < cache_novlys; i++)
- if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
- && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect))
+ if (cache_ovly_table[i][VMA] == bfd_section_vma (bsect)
+ && cache_ovly_table[i][LMA] == bfd_section_lma (bsect))
{
read_target_long_array (cache_ovly_table_base + i * word_size,
(unsigned int *) cache_ovly_table[i],
4, word_size, byte_order);
- if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
- && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect))
+ if (cache_ovly_table[i][VMA] == bfd_section_vma (bsect)
+ && cache_ovly_table[i][LMA] == bfd_section_lma (bsect))
{
osect->ovly_mapped = cache_ovly_table[i][MAPPED];
return 1;
@@ -3607,8 +3602,8 @@ simple_overlay_update (struct obj_section *osect)
asection *bsect = osect->the_bfd_section;
for (i = 0; i < cache_novlys; i++)
- if (cache_ovly_table[i][VMA] == bfd_section_vma (obfd, bsect)
- && cache_ovly_table[i][LMA] == bfd_section_lma (obfd, bsect))
+ if (cache_ovly_table[i][VMA] == bfd_section_vma (bsect)
+ && cache_ovly_table[i][LMA] == bfd_section_lma (bsect))
{ /* obj_section matches i'th entry in ovly_table. */
osect->ovly_mapped = cache_ovly_table[i][MAPPED];
break; /* finished with inner for loop: break out. */
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 7666de3..4699fd0 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -244,8 +244,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
{
if (section->the_bfd_section != NULL)
fprintf_filtered (outfile, " section %s",
- bfd_section_name (objfile->obfd,
- section->the_bfd_section));
+ bfd_section_name (section->the_bfd_section));
else
fprintf_filtered (outfile, " spurious section %ld",
(long) (section - objfile->sections));
@@ -525,8 +524,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
outfile);
if (section)
fprintf_filtered (outfile, " section %s\n",
- bfd_section_name (section->the_bfd_section->owner,
- section->the_bfd_section));
+ bfd_section_name (section->the_bfd_section));
else
fprintf_filtered (outfile, "\n");
return;
@@ -596,8 +594,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
outfile);
if (section)
fprintf_filtered (outfile, " section %s",
- bfd_section_name (section->the_bfd_section->owner,
- section->the_bfd_section));
+ bfd_section_name (section->the_bfd_section));
break;
case LOC_REGISTER:
@@ -638,8 +635,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
outfile);
if (section)
fprintf_filtered (outfile, " section %s",
- bfd_section_name (section->the_bfd_section->owner,
- section->the_bfd_section));
+ bfd_section_name (section->the_bfd_section));
break;
case LOC_BLOCK:
@@ -655,8 +651,7 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol,
outfile);
if (section)
fprintf_filtered (outfile, " section %s",
- bfd_section_name (section->the_bfd_section->owner,
- section->the_bfd_section));
+ bfd_section_name (section->the_bfd_section));
break;
case LOC_COMPUTED:
diff --git a/gdb/symtab.c b/gdb/symtab.c
index e2edad4..35eab08 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1033,20 +1033,17 @@ matching_obj_sections (struct obj_section *obj_first,
have the same size, address, and name. We can't compare section indexes,
which would be more reliable, because some sections may have been
stripped. */
- if (bfd_get_section_size (first) != bfd_get_section_size (second))
+ if (bfd_section_size (first) != bfd_section_size (second))
return 0;
/* In-memory addresses may start at a different offset, relativize them. */
- if (bfd_get_section_vma (first->owner, first)
- - bfd_get_start_address (first->owner)
- != bfd_get_section_vma (second->owner, second)
- - bfd_get_start_address (second->owner))
+ if (bfd_section_vma (first) - bfd_get_start_address (first->owner)
+ != bfd_section_vma (second) - bfd_get_start_address (second->owner))
return 0;
- if (bfd_get_section_name (first->owner, first) == NULL
- || bfd_get_section_name (second->owner, second) == NULL
- || strcmp (bfd_get_section_name (first->owner, first),
- bfd_get_section_name (second->owner, second)) != 0)
+ if (bfd_section_name (first) == NULL
+ || bfd_section_name (second) == NULL
+ || strcmp (bfd_section_name (first), bfd_section_name (second)) != 0)
return 0;
/* Otherwise check that they are in corresponding objfiles. */
diff --git a/gdb/target.c b/gdb/target.c
index 599e22a..78bdfeb 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1042,9 +1042,7 @@ memory_xfer_partial_1 (struct target_ops *ops, enum target_object object,
secp = target_section_by_addr (ops, memaddr);
if (secp != NULL
- && (bfd_get_section_flags (secp->the_bfd_section->owner,
- secp->the_bfd_section)
- & SEC_READONLY))
+ && (bfd_section_flags (secp->the_bfd_section) & SEC_READONLY))
{
table = target_get_section_table (ops);
return section_table_xfer_memory_partial (readbuf, writebuf,
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index c4fde91..26030e0 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -794,8 +794,7 @@ windows_make_so (const char *name, LPVOID load_addr)
file header and the section alignment. */
cygwin_load_start = (CORE_ADDR) (uintptr_t) ((char *)
load_addr + 0x1000);
- cygwin_load_end = cygwin_load_start + bfd_section_size (abfd.get (),
- text);
+ cygwin_load_end = cygwin_load_start + bfd_section_size (text);
}
#endif
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index a17031a..2fa2706 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -267,9 +267,9 @@ find_targ_sec (bfd *abfd, asection *sect, void *obj)
if (sect->target_index == args->targ_index)
{
/* This is the section. Figure out what SECT_OFF_* code it is. */
- if (bfd_get_section_flags (abfd, sect) & SEC_CODE)
+ if (bfd_section_flags (sect) & SEC_CODE)
*args->resultp = SECT_OFF_TEXT (objfile);
- else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
+ else if (bfd_section_flags (sect) & SEC_LOAD)
*args->resultp = SECT_OFF_DATA (objfile);
else
*args->resultp = gdb_bfd_section_index (abfd, sect);
@@ -2354,7 +2354,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
section. */
bfd_sect = secnum_to_bfd_section (symbol.n_scnum, objfile);
if (bfd_sect)
- toc_offset -= bfd_section_vma (objfile->obfd, bfd_sect);
+ toc_offset -= bfd_section_vma (bfd_sect);
break;
case XMC_TC:
@@ -2952,7 +2952,7 @@ xcoff_initial_scan (struct objfile *objfile, symfile_add_flags symfile_flags)
secp = bfd_get_section_by_name (abfd, ".debug");
if (secp)
{
- length = bfd_section_size (abfd, secp);
+ length = bfd_section_size (secp);
if (length)
{
debugsec
@@ -3029,8 +3029,7 @@ xcoff_symfile_offsets (struct objfile *objfile,
if (objfile->num_sections == 0)
return; /* Is that even possible? Better safe than sorry. */
- first_section_name
- = bfd_section_name (objfile->obfd, objfile->sections[0].the_bfd_section);
+ first_section_name = bfd_section_name (objfile->sections[0].the_bfd_section);
if (objfile->sect_index_text == 0
&& strcmp (first_section_name, ".text") != 0)
@@ -3089,7 +3088,7 @@ xcoff_get_core_n_import_files (bfd *abfd)
if (sect == NULL)
return -1; /* Not a core file. */
- for (offset = 0; offset < bfd_get_section_size (sect);)
+ for (offset = 0; offset < bfd_section_size (sect);)
{
int next;