diff options
author | Alan Modra <amodra@gmail.com> | 2019-09-16 20:25:17 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-09-19 09:40:13 +0930 |
commit | fd3619828e94a24a92cddec42cbc0ab33352eeb4 (patch) | |
tree | 496b4a1d9bc015f6d1177758a811afa3f6e6895e /gas | |
parent | 5dfda3562a69686c43aad4fb0269cc9d5ec010d5 (diff) | |
download | gdb-fd3619828e94a24a92cddec42cbc0ab33352eeb4.zip gdb-fd3619828e94a24a92cddec42cbc0ab33352eeb4.tar.gz gdb-fd3619828e94a24a92cddec42cbc0ab33352eeb4.tar.bz2 |
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
Diffstat (limited to 'gas')
73 files changed, 358 insertions, 370 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 3d61530..819585d 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,33 @@ 2019-09-18 Alan Modra <amodra@gmail.com> + * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, + * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, + * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, + * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, + * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, + * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, + * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, + * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, + * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, + * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, + * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, + * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, + * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, + * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, + * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, + * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, + * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, + * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, + * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, + * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, + * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, + * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, + * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for + bfd section macro and function changes. + * write.c (compress_debug): Use bfd_rename_section. + +2019-09-18 Alan Modra <amodra@gmail.com> + * symbols.c (S_IS_LOCAL): Update bfd_get_section to bfd_asymbol_section. @@ -1147,13 +1147,13 @@ perform_an_assembly_pass (int argc, char ** argv) /* @@ FIXME -- we're setting the RELOC flag so that sections are assumed to have relocs, otherwise we don't find out in time. */ applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, text_section, + bfd_set_section_flags (text_section, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_READONLY)); - bfd_set_section_flags (stdoutput, data_section, + bfd_set_section_flags (data_section, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA)); - bfd_set_section_flags (stdoutput, bss_section, applicable & SEC_ALLOC); + bfd_set_section_flags (bss_section, applicable & SEC_ALLOC); seg_info (bss_section)->bss = 1; #endif subseg_new (BFD_ABS_SECTION_NAME, 0); @@ -1360,7 +1360,7 @@ main (int argc, char ** argv) segT gnustack; gnustack = subseg_new (".note.GNU-stack", 0); - bfd_set_section_flags (stdoutput, gnustack, + bfd_set_section_flags (gnustack, SEC_READONLY | (flag_execstack ? SEC_CODE : 0)); } @@ -226,7 +226,7 @@ COMMON subsegT now_subseg; /* Segment our instructions emit to. */ COMMON segT now_seg; -#define segment_name(SEG) bfd_get_section_name (stdoutput, SEG) +#define segment_name(SEG) bfd_section_name (SEG) extern segT reg_section, expr_section; /* Shouldn't these be eliminated someday? */ diff --git a/gas/config/obj-coff-seh.c b/gas/config/obj-coff-seh.c index 183be79..b24e435 100644 --- a/gas/config/obj-coff-seh.c +++ b/gas/config/obj-coff-seh.c @@ -48,7 +48,7 @@ get_pxdata_name (segT seg, const char *base_name) const char *name,*dollar, *dot; char *sname; - name = bfd_get_section_name (stdoutput, seg); + name = bfd_section_name (seg); dollar = strchr (name, '$'); dot = strchr (name + 1, '.'); @@ -95,16 +95,16 @@ make_pxdata_seg (segT cseg, char *name) r = subseg_new (name, 0); /* Check if code segment is marked as linked once. */ - flags = bfd_get_section_flags (stdoutput, cseg) - & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD - | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE - | SEC_LINK_DUPLICATES_SAME_CONTENTS); + flags = (bfd_section_flags (cseg) + & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD + | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE + | SEC_LINK_DUPLICATES_SAME_CONTENTS)); /* Add standard section flags. */ flags |= SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA; /* Apply possibly linked once flags to new generated segment, too. */ - if (!bfd_set_section_flags (stdoutput, r, flags)) + if (!bfd_set_section_flags (r, flags)) as_bad (_("bfd_set_section_flags: %s"), bfd_errmsg (bfd_get_error ())); @@ -161,8 +161,8 @@ seh_validate_seg (const char *directive) const char *cseg_name, *nseg_name; if (seh_ctx_cur->code_seg == now_seg) return 1; - cseg_name = bfd_get_section_name (stdoutput, seh_ctx_cur->code_seg); - nseg_name = bfd_get_section_name (stdoutput, now_seg); + cseg_name = bfd_section_name (seh_ctx_cur->code_seg); + nseg_name = bfd_section_name (now_seg); as_bad (_("%s used in segment '%s' instead of expected '%s'"), directive, nseg_name, cseg_name); ignore_rest_of_line (); diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index c4e1d71..d1dd0f0 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -205,13 +205,12 @@ obj_coff_common_parse (int ignore ATTRIBUTE_UNUSED, symbolS *symbolP, addressT s char numbuff[20]; sec = subseg_new (".drectve", 0); - oldflags = bfd_get_section_flags (stdoutput, sec); + oldflags = bfd_section_flags (sec); if (oldflags == SEC_NO_FLAGS) { - if (!bfd_set_section_flags (stdoutput, sec, - TC_COFF_SECTION_DEFAULT_ATTRIBUTES)) + if (!bfd_set_section_flags (sec, TC_COFF_SECTION_DEFAULT_ATTRIBUTES)) as_warn (_("error setting flags for \"%s\": %s"), - bfd_section_name (stdoutput, sec), + bfd_section_name (sec), bfd_errmsg (bfd_get_error ())); } @@ -554,7 +553,7 @@ obj_coff_ident (int ignore ATTRIBUTE_UNUSED) that shouldn't be loaded into memory, which requires linker changes... For now, until proven otherwise, use .rdata. */ sec = subseg_new (".rdata$zzz", 0); - bfd_set_section_flags (stdoutput, sec, + bfd_set_section_flags (sec, ((SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA) & bfd_applicable_section_flags (stdoutput))); } @@ -774,8 +773,7 @@ obj_coff_endef (int ignore ATTRIBUTE_UNUSED) if (S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_EFCN || S_GET_STORAGE_CLASS (def_symbol_in_progress) == C_LABEL - || (streq (bfd_get_section_name (stdoutput, - S_GET_SEGMENT (def_symbol_in_progress)), + || (streq (bfd_section_name (S_GET_SEGMENT (def_symbol_in_progress)), "*DEBUG*") && !SF_GET_TAG (def_symbol_in_progress)) || S_GET_SEGMENT (def_symbol_in_progress) == absolute_section @@ -1480,7 +1478,7 @@ coff_adjust_section_syms (bfd *abfd ATTRIBUTE_UNUSED, fixp = fixp->fx_next; } } - if (bfd_get_section_size (sec) == 0 + if (bfd_section_size (sec) == 0 && nrelocs == 0 && nlnno == 0 && sec != text_section @@ -1657,7 +1655,7 @@ obj_coff_section (int ignore ATTRIBUTE_UNUSED) if (alignment >= 0) sec->alignment_power = alignment; - oldflags = bfd_get_section_flags (stdoutput, sec); + oldflags = bfd_section_flags (sec); if (oldflags == SEC_NO_FLAGS) { /* Set section flags for a new section just created by subseg_new. @@ -1673,9 +1671,9 @@ obj_coff_section (int ignore ATTRIBUTE_UNUSED) flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; #endif - if (! bfd_set_section_flags (stdoutput, sec, flags)) + if (!bfd_set_section_flags (sec, flags)) as_warn (_("error setting flags for \"%s\": %s"), - bfd_section_name (stdoutput, sec), + bfd_section_name (sec), bfd_errmsg (bfd_get_error ())); } else if (flags != SEC_NO_FLAGS) @@ -1713,7 +1711,7 @@ coff_frob_section (segT sec) supposedly because standard COFF has no other way of encoding alignment for sections. If your COFF flavor has a different way of encoding section alignment, then skip this step, as TICOFF does. */ - bfd_vma size = bfd_get_section_size (sec); + bfd_vma size = bfd_section_size (sec); #if !defined(TICOFF) bfd_vma align_power = (bfd_vma) sec->alignment_power + OCTETS_PER_BYTE_POWER; bfd_vma mask = ((bfd_vma) 1 << align_power) - 1; @@ -1724,7 +1722,7 @@ coff_frob_section (segT sec) fragS *last; new_size = (size + mask) & ~mask; - bfd_set_section_size (stdoutput, sec, new_size); + bfd_set_section_size (sec, new_size); /* If the size had to be rounded up, add some padding in the last non-empty frag. */ @@ -1751,7 +1749,7 @@ coff_frob_section (segT sec) unsigned char sclass = C_STAT; #ifdef OBJ_XCOFF - if (bfd_get_section_flags (stdoutput, sec) & SEC_DEBUGGING) + if (bfd_section_flags (sec) & SEC_DEBUGGING) sclass = C_DWARF; #endif S_SET_STORAGE_CLASS (secsym, sclass); @@ -1772,9 +1770,9 @@ coff_frob_section (segT sec) strsec = sec; sec = subseg_get (STAB_SECTION_NAME, 0); /* size is already rounded up, since other section will be listed first */ - size = bfd_get_section_size (strsec); + size = bfd_section_size (strsec); - n_entries = bfd_get_section_size (sec) / 12 - 1; + n_entries = bfd_section_size (sec) / 12 - 1; /* Find first non-empty frag. It should be large enough. */ fragp = seg_info (sec)->frchainP->frch_root; diff --git a/gas/config/obj-ecoff.c b/gas/config/obj-ecoff.c index b62176f..a5616f3 100644 --- a/gas/config/obj-ecoff.c +++ b/gas/config/obj-ecoff.c @@ -90,15 +90,15 @@ ecoff_frob_file_before_fix (void) } if (i == n_names) { - bfd_set_section_vma (stdoutput, sec, addr); - addr += bfd_section_size (stdoutput, sec); + bfd_set_section_vma (sec, addr); + addr += bfd_section_size (sec); } } for (i = 0; i < n_names; i++) if (secs[i]) { - bfd_set_section_vma (stdoutput, secs[i], addr); - addr += bfd_section_size (stdoutput, secs[i]); + bfd_set_section_vma (secs[i], addr); + addr += bfd_section_size (secs[i]); } for (i = n_names - 1; i >= 0; i--) if (secs[i]) diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index bdf3da8..5629358 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -737,7 +737,7 @@ obj_elf_change_section (const char *name, if (type == SHT_NOBITS) seg_info (sec)->bss = 1; - bfd_set_section_flags (stdoutput, sec, flags); + bfd_set_section_flags (sec, flags); if (flags & SEC_MERGE) sec->entsize = entsize; elf_group_name (sec) = group_name; @@ -1859,9 +1859,7 @@ obj_elf_version (int ignore ATTRIBUTE_UNUSED) /* Create the .note section. */ note_secp = subseg_new (".note", 0); - bfd_set_section_flags (stdoutput, - note_secp, - SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_flags (note_secp, SEC_HAS_CONTENTS | SEC_READONLY); record_alignment (note_secp, 2); /* Process the version string. */ @@ -2140,9 +2138,8 @@ obj_elf_ident (int ignore ATTRIBUTE_UNUSED) { char *p; comment_section = subseg_new (".comment", 0); - bfd_set_section_flags (stdoutput, comment_section, - SEC_READONLY | SEC_HAS_CONTENTS - | SEC_MERGE | SEC_STRINGS); + bfd_set_section_flags (comment_section, (SEC_READONLY | SEC_HAS_CONTENTS + | SEC_MERGE | SEC_STRINGS)); comment_section->entsize = 1; #ifdef md_elf_section_change_hook md_elf_section_change_hook (); @@ -2170,7 +2167,7 @@ obj_elf_init_stab_section (segT seg) /* Force the section to align to a longword boundary. Without this, UnixWare ar crashes. */ - bfd_set_section_alignment (stdoutput, seg, 2); + bfd_set_section_alignment (seg, 2); /* Make space for this first symbol. */ p = frag_more (12); @@ -2204,10 +2201,10 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) name = concat (sec->name, "str", NULL); strsec = bfd_get_section_by_name (abfd, name); if (strsec) - strsz = bfd_section_size (abfd, strsec); + strsz = bfd_section_size (strsec); else strsz = 0; - nsyms = bfd_section_size (abfd, sec) / 12 - 1; + nsyms = bfd_section_size (sec) / 12 - 1; p = seg_info (sec)->stabu.p; gas_assert (p != 0); @@ -2490,8 +2487,8 @@ elf_adjust_symtab (void) sec_name = ".group"; s = subseg_force_new (sec_name, 0); if (s == NULL - || !bfd_set_section_flags (stdoutput, s, flags) - || !bfd_set_section_alignment (stdoutput, s, 2)) + || !bfd_set_section_flags (s, flags) + || !bfd_set_section_alignment (s, 2)) { as_fatal (_("can't create group: %s"), bfd_errmsg (bfd_get_error ())); @@ -2598,7 +2595,7 @@ elf_frob_file_after_relocs (void) group = elf_sec_group (head); subseg_set (group, 0); - bfd_set_section_size (stdoutput, group, size); + bfd_set_section_size (group, size); group->contents = (unsigned char *) frag_more (size); frag_now->fr_fix = frag_now_fix_octets (); frag_wane (frag_now); @@ -2656,8 +2653,8 @@ elf_frob_file_after_relocs (void) to force the ELF backend to allocate a file position, and then write out the data. FIXME: Is this really the best way to do this? */ - bfd_set_section_size - (stdoutput, sec, bfd_ecoff_debug_size (stdoutput, &debug, debug_swap)); + bfd_set_section_size (sec, bfd_ecoff_debug_size (stdoutput, &debug, + debug_swap)); /* Pass BUF to bfd_set_section_contents because this will eventually become a call to fwrite, and ISO C prohibits diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c index 185949e..07c7831 100644 --- a/gas/config/obj-macho.c +++ b/gas/config/obj-macho.c @@ -227,7 +227,7 @@ obj_mach_o_make_or_get_sect (char * segname, char * sectname, /* Sub-segments don't exists as is on Mach-O. */ sec = subseg_new (name, 0); - oldflags = bfd_get_section_flags (stdoutput, sec); + oldflags = bfd_section_flags (sec); msect = bfd_mach_o_get_mach_o_section (sec); if (oldflags == SEC_NO_FLAGS) @@ -245,9 +245,9 @@ obj_mach_o_make_or_get_sect (char * segname, char * sectname, flags |= SEC_DEBUGGING; /* New, so just use the defaults or what's specified. */ - if (! bfd_set_section_flags (stdoutput, sec, flags)) + if (!bfd_set_section_flags (sec, flags)) as_warn (_("failed to set flags for \"%s\": %s"), - bfd_section_name (stdoutput, sec), + bfd_section_name (sec), bfd_errmsg (bfd_get_error ())); strncpy (msect->segname, segname, BFD_MACH_O_SEGNAME_SIZE); @@ -1697,7 +1697,7 @@ static void obj_mach_o_set_section_vma (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *v_p) { bfd_mach_o_section *ms = bfd_mach_o_get_mach_o_section (sec); - unsigned bfd_align = bfd_get_section_alignment (abfd, sec); + unsigned bfd_align = bfd_section_alignment (sec); obj_mach_o_set_vma_data *p = (struct obj_mach_o_set_vma_data *)v_p; unsigned sectype = (ms->flags & BFD_MACH_O_SECTION_TYPE_MASK); unsigned zf; @@ -1719,16 +1719,16 @@ obj_mach_o_set_section_vma (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *v_p /* We know the section size now - so make a vma for the section just based on order. */ - ms->size = bfd_get_section_size (sec); + ms->size = bfd_section_size (sec); /* Make sure that the align agrees, and set to the largest value chosen. */ ms->align = ms->align > bfd_align ? ms->align : bfd_align; - bfd_set_section_alignment (abfd, sec, ms->align); + bfd_set_section_alignment (sec, ms->align); p->vma += (1 << ms->align) - 1; p->vma &= ~((1 << ms->align) - 1); ms->addr = p->vma; - bfd_set_section_vma (abfd, sec, p->vma); + bfd_set_section_vma (sec, p->vma); p->vma += ms->size; } @@ -1752,7 +1752,7 @@ static void obj_mach_o_set_indirect_symbols (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) { - bfd_vma sect_size = bfd_section_size (abfd, sec); + bfd_vma sect_size = bfd_section_size (sec); bfd_mach_o_section *ms = bfd_mach_o_get_mach_o_section (sec); unsigned lazy = 0; diff --git a/gas/config/obj-som.c b/gas/config/obj-som.c index edd49dc..20213b8 100644 --- a/gas/config/obj-som.c +++ b/gas/config/obj-som.c @@ -224,14 +224,14 @@ obj_som_init_stab_section (segT seg) of the various stabs spaces/subspaces need to be "small". We reserve range 72/73 which appear to work well. */ obj_set_section_attributes (space, 1, 1, 72, 2); - bfd_set_section_alignment (stdoutput, space, 2); + bfd_set_section_alignment (space, 2); /* Set the containing space for both stab sections to be $GDB_DEBUG$ (just created above). Also set some attributes which BFD does not understand. In particular, access bits, sort keys, and load quadrant. */ obj_set_subsection_attributes (seg, space, 0x1f, 73, 0, 0, 0, 0); - bfd_set_section_alignment (stdoutput, seg, 2); + bfd_set_section_alignment (seg, 2); /* Make some space for the first special stab entry and zero the memory. It contains information about the length of this file's @@ -254,7 +254,7 @@ obj_som_init_stab_section (segT seg) quadrant. */ seg = bfd_get_section_by_name (stdoutput, "$GDB_STRINGS$"); obj_set_subsection_attributes (seg, space, 0x1f, 72, 0, 0, 0, 0); - bfd_set_section_alignment (stdoutput, seg, 2); + bfd_set_section_alignment (seg, 2); subseg_set (saved_seg, saved_subseg); } @@ -273,10 +273,10 @@ adjust_stab_sections (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) strsec = bfd_get_section_by_name (abfd, "$GDB_STRINGS$"); if (strsec) - strsz = bfd_section_size (abfd, strsec); + strsz = bfd_section_size (strsec); else strsz = 0; - nsyms = bfd_section_size (abfd, sec) / 12 - 1; + nsyms = bfd_section_size (sec) / 12 - 1; p = seg_info (sec)->stabu.p; gas_assert (p != 0); diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 735ecd6..522efeb 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -7363,7 +7363,7 @@ aarch64_init_frag (fragS * fragP, int max_chars) /* PR 21809: Do not set a mapping state for debug sections - it just confuses other tools. */ - if (bfd_get_section_flags (NULL, now_seg) & SEC_DEBUGGING) + if (bfd_section_flags (now_seg) & SEC_DEBUGGING) return; switch (fragP->fr_type) diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index 7f80036..70ceba0 100644 --- a/gas/config/tc-alpha.c +++ b/gas/config/tc-alpha.c @@ -1205,10 +1205,9 @@ create_literal_section (const char *name, *secp = new_sec = subseg_new (name, 0); subseg_set (current_section, current_subsec); - bfd_set_section_alignment (stdoutput, new_sec, 4); - bfd_set_section_flags (stdoutput, new_sec, - SEC_RELOC | SEC_ALLOC | SEC_LOAD | SEC_READONLY - | SEC_DATA); + bfd_set_section_alignment (new_sec, 4); + bfd_set_section_flags (new_sec, (SEC_RELOC | SEC_ALLOC | SEC_LOAD + | SEC_READONLY | SEC_DATA)); S_CLEAR_EXTERNAL (*symp = section_symbol (new_sec)); } @@ -3985,8 +3984,8 @@ s_alpha_stab (int n) if (alpha_flag_mdebug < 0) { segT sec = subseg_new (".mdebug", 0); - bfd_set_section_flags (stdoutput, sec, SEC_HAS_CONTENTS | SEC_READONLY); - bfd_set_section_alignment (stdoutput, sec, 3); + bfd_set_section_flags (sec, SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_alignment (sec, 3); ecoff_read_begin_hook (); @@ -5301,7 +5300,7 @@ maybe_set_gp (asection *sec) if (!sec) return; - vma = bfd_get_section_vma (sec->owner, sec); + vma = bfd_section_vma (sec); if (vma && vma < alpha_gp_value) alpha_gp_value = vma; } @@ -5515,8 +5514,8 @@ md_begin (void) if (ECOFF_DEBUGGING) { segT sec = subseg_new (".mdebug", (subsegT) 0); - bfd_set_section_flags (stdoutput, sec, SEC_HAS_CONTENTS | SEC_READONLY); - bfd_set_section_alignment (stdoutput, sec, 3); + bfd_set_section_flags (sec, SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_alignment (sec, 3); } #endif @@ -5563,7 +5562,7 @@ md_assemble (char *str) valueT md_section_align (segT seg, valueT size) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); valueT mask = ((valueT) 1 << align) - 1; return (size + mask) & ~mask; diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index c1d5ea3..c73906b 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -2706,7 +2706,7 @@ valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & (-((valueT) 1 << align))); } @@ -4529,8 +4529,7 @@ arc_set_ext_seg (void) if (!arcext_section) { arcext_section = subseg_new (".arcextmap", 0); - bfd_set_section_flags (stdoutput, arcext_section, - SEC_READONLY | SEC_HAS_CONTENTS); + bfd_set_section_flags (arcext_section, SEC_READONLY | SEC_HAS_CONTENTS); } else subseg_set (arcext_section, 0); diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index 32a15f6..b0f1507 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -22878,7 +22878,7 @@ arm_frob_label (symbolS * sym) out of the jump table, and chaos would ensue. */ if (label_is_thumb_function_name && (S_GET_NAME (sym)[0] != '.' || S_GET_NAME (sym)[1] != 'L') - && (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + && (bfd_section_flags (now_seg) & SEC_CODE) != 0) { /* When the address of a Thumb function is taken the bottom bit of that address should be set. This will allow @@ -26491,7 +26491,7 @@ arm_init_frag (fragS * fragP, int max_chars) /* PR 21809: Do not set a mapping state for debug sections - it just confuses other tools. */ - if (bfd_get_section_flags (NULL, now_seg) & SEC_DEBUGGING) + if (bfd_section_flags (now_seg) & SEC_DEBUGGING) return; frag_thumb_mode = fragP->tc_frag_data.thumb_mode ^ MODE_RECORDED; @@ -30019,9 +30019,8 @@ md_begin (void) if (sec != NULL) { - bfd_set_section_flags - (stdoutput, sec, SEC_READONLY | SEC_DEBUGGING /* | SEC_HAS_CONTENTS */); - bfd_set_section_size (stdoutput, sec, 0); + bfd_set_section_flags (sec, SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_size (sec, 0); bfd_set_section_contents (stdoutput, sec, NULL, 0, 0); } } diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c index df0833c..36262ad 100644 --- a/gas/config/tc-avr.c +++ b/gas/config/tc-avr.c @@ -1429,7 +1429,7 @@ avr_operands (struct avr_opcodes_s *opcode, char **line) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & (-1UL << align)); } @@ -2229,7 +2229,7 @@ avr_create_property_section (void) sec = bfd_make_section (stdoutput, section_name); if (sec == NULL) as_fatal (_("Failed to create property section `%s'\n"), section_name); - bfd_set_section_flags (stdoutput, sec, flags); + bfd_set_section_flags (sec, flags); sec->output_section = sec; return sec; } @@ -2404,7 +2404,7 @@ avr_create_and_fill_property_section (void) return; prop_sec = avr_create_property_section (); - bfd_set_section_size (stdoutput, prop_sec, sec_size); + bfd_set_section_size (prop_sec, sec_size); subseg_set (prop_sec, 0); frag_base = frag_more (sec_size); diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c index 104ab6a..5f10cb7 100644 --- a/gas/config/tc-bfin.c +++ b/gas/config/tc-bfin.c @@ -789,7 +789,7 @@ md_apply_fix (fixS *fixP, valueT *valueP, segT seg ATTRIBUTE_UNUSED) valueT md_section_align (segT segment, valueT size) { - int boundary = bfd_get_section_alignment (stdoutput, segment); + int boundary = bfd_section_alignment (segment); return ((size + (1 << boundary) - 1) & -(1 << boundary)); } diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c index d2da2fe..7c3bf2e 100644 --- a/gas/config/tc-bpf.c +++ b/gas/config/tc-bpf.c @@ -189,7 +189,7 @@ md_begin (void) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c index 9f6c82e..2eb679b 100644 --- a/gas/config/tc-d10v.c +++ b/gas/config/tc-d10v.c @@ -268,7 +268,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c index 086215e..a54945e 100644 --- a/gas/config/tc-d30v.c +++ b/gas/config/tc-d30v.c @@ -302,7 +302,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } @@ -1490,7 +1490,7 @@ d30v_align (int n, char *pfill, symbolS *label) if (pfill == NULL) { if (n > 2 - && (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + && (bfd_section_flags (now_seg) & SEC_CODE) != 0) { static char const nop[4] = { 0x00, 0xf0, 0x00, 0x00 }; diff --git a/gas/config/tc-epiphany.c b/gas/config/tc-epiphany.c index 5429fa9..753cb6e 100644 --- a/gas/config/tc-epiphany.c +++ b/gas/config/tc-epiphany.c @@ -152,7 +152,7 @@ md_begin (void) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c index 3703e29..5767eeb 100644 --- a/gas/config/tc-fr30.c +++ b/gas/config/tc-fr30.c @@ -154,7 +154,7 @@ md_operand (expressionS * expressionP) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c index 3112fce..d8ff553 100644 --- a/gas/config/tc-frv.c +++ b/gas/config/tc-frv.c @@ -1225,7 +1225,7 @@ md_operand (expressionS *expressionP) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } @@ -1651,7 +1651,7 @@ frv_frob_file_section (bfd *abfd, asection *sec, void *ptr ATTRIBUTE_UNUSED) segment_info_type *seginfo = seg_info (sec); fixS *fixp; CGEN_CPU_DESC cd = gas_cgen_cpu_desc; - flagword flags = bfd_get_section_flags (abfd, sec); + flagword flags = bfd_section_flags (sec); /* Skip relocations in known sections (.ctors, .dtors, and .gcc_except_table) since we can fix those up by hand. */ diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c index 5ddc889..c79c6d4 100644 --- a/gas/config/tc-h8300.c +++ b/gas/config/tc-h8300.c @@ -2225,7 +2225,7 @@ md_convert_frag (bfd *headers ATTRIBUTE_UNUSED, valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & (-1U << align)); } diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index 82c71eb..fb6d82b 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -1608,7 +1608,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, valueT md_section_align (asection *segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); int align2 = (1 << align) - 1; return (size + align2) & ~align2; @@ -5962,7 +5962,7 @@ pa_build_unwind_subspace (struct call_info *call_info) char *name, *p; symbolS *symbolP; - if ((bfd_get_section_flags (stdoutput, now_seg) + if ((bfd_section_flags (now_seg) & (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) != (SEC_ALLOC | SEC_LOAD | SEC_READONLY)) return; @@ -6006,10 +6006,9 @@ pa_build_unwind_subspace (struct call_info *call_info) if (seg == ASEC_NULL) { seg = subseg_new (UNWIND_SECTION_NAME, 0); - bfd_set_section_flags (stdoutput, seg, - SEC_READONLY | SEC_HAS_CONTENTS - | SEC_LOAD | SEC_RELOC | SEC_ALLOC | SEC_DATA); - bfd_set_section_alignment (stdoutput, seg, 2); + bfd_set_section_flags (seg, (SEC_READONLY | SEC_HAS_CONTENTS | SEC_LOAD + | SEC_RELOC | SEC_ALLOC | SEC_DATA)); + bfd_set_section_alignment (seg, 2); } subseg_set (seg, 0); @@ -7533,14 +7532,13 @@ pa_subspace (int create_new) seg_info (section)->bss = 1; /* Now set the flags. */ - bfd_set_section_flags (stdoutput, section, applicable); + bfd_set_section_flags (section, applicable); /* Record any alignment request for this section. */ record_alignment (section, exact_log2 (alignment)); /* Set the starting offset for this section. */ - bfd_set_section_vma (stdoutput, section, - pa_subspace_start (space, quadrant)); + bfd_set_section_vma (section, pa_subspace_start (space, quadrant)); /* Now that all the flags are set, update an existing subspace, or create a new one. */ @@ -7614,7 +7612,7 @@ pa_spaces_begin (void) { text_section = segment; applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, segment, + bfd_set_section_flags (segment, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_READONLY @@ -7624,7 +7622,7 @@ pa_spaces_begin (void) { data_section = segment; applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, segment, + bfd_set_section_flags (segment, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_HAS_CONTENTS)); @@ -7634,13 +7632,13 @@ pa_spaces_begin (void) { bss_section = segment; applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, segment, + bfd_set_section_flags (segment, applicable & SEC_ALLOC); } else if (!strcmp (pa_def_subspaces[i].name, "$LIT$")) { applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, segment, + bfd_set_section_flags (segment, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY @@ -7649,7 +7647,7 @@ pa_spaces_begin (void) else if (!strcmp (pa_def_subspaces[i].name, "$MILLICODE$")) { applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, segment, + bfd_set_section_flags (segment, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY @@ -7658,7 +7656,7 @@ pa_spaces_begin (void) else if (!strcmp (pa_def_subspaces[i].name, "$UNWIND$")) { applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, segment, + bfd_set_section_flags (segment, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 2710dce..fec69c1 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -8105,7 +8105,7 @@ x86_cleanup (void) /* Create the .note.gnu.property section. */ sec = subseg_new (NOTE_GNU_PROPERTY_SECTION_NAME, 0); - bfd_set_section_flags (stdoutput, sec, + bfd_set_section_flags (sec, (SEC_ALLOC | SEC_LOAD | SEC_DATA @@ -8123,7 +8123,7 @@ x86_cleanup (void) alignment = 2; } - bfd_set_section_alignment (stdoutput, sec, alignment); + bfd_set_section_alignment (sec, alignment); elf_section_type (sec) = SHT_NOTE; /* GNU_PROPERTY_X86_ISA_1_USED: 4-byte type + 4-byte data size @@ -11939,7 +11939,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED, valueT size) work. */ int align; - align = bfd_get_section_alignment (stdoutput, segment); + align = bfd_section_alignment (segment); size = ((size + (1 << align) - 1) & (-((valueT) 1 << align))); } #endif @@ -12382,8 +12382,7 @@ handle_large_common (int small ATTRIBUTE_UNUSED) /* The .lbss section is for local .largecomm symbols. */ lbss_section = subseg_new (".lbss", 0); applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, lbss_section, - applicable & SEC_ALLOC); + bfd_set_section_flags (lbss_section, applicable & SEC_ALLOC); seg_info (lbss_section)->bss = 1; subseg_set (seg, subseg); diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index 8f25e55..0c618e8 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -1152,14 +1152,14 @@ obj_elf_vms_common (int ignore ATTRIBUTE_UNUSED) record_alignment (now_seg, log_align); - cur_size = bfd_section_size (stdoutput, now_seg); + cur_size = bfd_section_size (now_seg); if ((int) size > cur_size) { char *pfrag = frag_var (rs_fill, 1, 1, (relax_substateT)0, NULL, (valueT)size - (valueT)cur_size, NULL); *pfrag = 0; - bfd_section_size (stdoutput, now_seg) = size; + bfd_set_section_size (now_seg, size); } /* Switch back to current segment. */ @@ -3606,8 +3606,7 @@ start_unwind_section (const segT text_seg, int sec_index) else { set_section (sec_name); - bfd_set_section_flags (stdoutput, now_seg, - SEC_LOAD | SEC_ALLOC | SEC_READONLY); + bfd_set_section_flags (now_seg, SEC_LOAD | SEC_ALLOC | SEC_READONLY); } elf_linked_to_section (now_seg) = text_seg; @@ -7250,7 +7249,7 @@ md_begin (void) md.auto_align = 1; md.explicit_mode = md.default_explicit_mode; - bfd_set_section_alignment (stdoutput, text_section, 4); + bfd_set_section_alignment (text_section, 4); /* Make sure function pointers get initialized. */ target_big_endian = -1; @@ -7778,7 +7777,7 @@ ia64_frob_label (struct symbol *sym) return; } - if (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) + if (bfd_section_flags (now_seg) & SEC_CODE) { md.last_text_seg = now_seg; fix = XOBNEW (¬es, struct label_fix); @@ -7818,7 +7817,7 @@ void ia64_flush_pending_output (void) { if (!md.keep_pending_output - && bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) + && bfd_section_flags (now_seg) & SEC_CODE) { /* ??? This causes many unnecessary stop bits to be emitted. Unfortunately, it isn't clear if it is safe to remove this. */ @@ -10989,7 +10988,7 @@ ia64_pcrel_from_section (fixS *fix, segT sec) { unsigned long off = fix->fx_frag->fr_address + fix->fx_where; - if (bfd_get_section_flags (stdoutput, sec) & SEC_CODE) + if (bfd_section_flags (sec) & SEC_CODE) off &= ~0xfUL; return off; @@ -11946,9 +11945,7 @@ ia64_vms_note (void) /* Create the .note section. */ secp = subseg_new (".note", 0); - bfd_set_section_flags (stdoutput, - secp, - SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_flags (secp, SEC_HAS_CONTENTS | SEC_READONLY); /* Module header note (MHD). */ bname = xstrdup (lbasename (out_file_name)); @@ -11993,9 +11990,7 @@ ia64_vms_note (void) frag_align (3, 0, 0); secp = subseg_new (".vms_display_name_info", 0); - bfd_set_section_flags (stdoutput, - secp, - SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_flags (secp, SEC_HAS_CONTENTS | SEC_READONLY); /* This symbol should be passed on the command line and be variable according to language. */ diff --git a/gas/config/tc-ip2k.c b/gas/config/tc-ip2k.c index 0fcc000..53b4d88 100644 --- a/gas/config/tc-ip2k.c +++ b/gas/config/tc-ip2k.c @@ -213,7 +213,7 @@ md_assemble (char * str) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c index 3275d30..d2a0c59 100644 --- a/gas/config/tc-iq2000.c +++ b/gas/config/tc-iq2000.c @@ -430,7 +430,7 @@ md_assemble (char * str) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } @@ -817,7 +817,7 @@ s_iq2000_end (int x ATTRIBUTE_UNUSED) else p = NULL; - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; @@ -916,7 +916,7 @@ s_iq2000_ent (int aent) if (ISDIGIT (*input_line_pointer) || *input_line_pointer == '-') get_number (); - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; diff --git a/gas/config/tc-lm32.c b/gas/config/tc-lm32.c index a547ba9..75a733a 100644 --- a/gas/config/tc-lm32.c +++ b/gas/config/tc-lm32.c @@ -277,7 +277,7 @@ md_undefined_symbol (char * name ATTRIBUTE_UNUSED) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-m32c.c b/gas/config/tc-m32c.c index 851d4c1..3ea3e59 100644 --- a/gas/config/tc-m32c.c +++ b/gas/config/tc-m32c.c @@ -392,7 +392,7 @@ md_operand (expressionS * exp) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c index c20cb72..75ee9d9 100644 --- a/gas/config/tc-m32r.c +++ b/gas/config/tc-m32r.c @@ -713,7 +713,7 @@ md_begin (void) /* This is copied from perform_an_assembly_pass. */ applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, sbss_section, applicable & SEC_ALLOC); + bfd_set_section_flags (sbss_section, applicable & SEC_ALLOC); subseg_set (seg, subseg); @@ -1448,7 +1448,7 @@ md_operand (expressionS *expressionP) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c index 1151496..1c36d5d 100644 --- a/gas/config/tc-m68hc11.c +++ b/gas/config/tc-m68hc11.c @@ -583,7 +583,7 @@ md_atof (int type, char *litP, int *sizeP) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-mep.c b/gas/config/tc-mep.c index f53bb17..c0d48e8 100644 --- a/gas/config/tc-mep.c +++ b/gas/config/tc-mep.c @@ -1380,7 +1380,7 @@ md_assemble (char * str) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } @@ -1528,7 +1528,7 @@ md_estimate_size_before_relax (fragS * fragP, segT segment) || S_IS_WEAK (fragP->fr_symbol) #ifdef MEP_IVC2_SUPPORTED || (mep_cop == EF_MEP_COP_IVC2 - && bfd_get_section_flags (stdoutput, segment) & SEC_MEP_VLIW) + && bfd_section_flags (segment) & SEC_MEP_VLIW) #endif /* MEP_IVC2_SUPPORTED */ ) { @@ -1539,7 +1539,7 @@ md_estimate_size_before_relax (fragS * fragP, segT segment) } if (MEP_VLIW && ! MEP_VLIW64 - && (bfd_get_section_flags (stdoutput, segment) & SEC_MEP_VLIW)) + && (bfd_section_flags (segment) & SEC_MEP_VLIW)) { /* Use 32 bit branches for vliw32 so the vliw word is not split. */ switch (fragP->fr_cgen.insn->base->num) @@ -1572,7 +1572,7 @@ md_estimate_size_before_relax (fragS * fragP, segT segment) #ifdef MEP_IVC2_SUPPORTED if (mep_cop == EF_MEP_COP_IVC2 - && bfd_get_section_flags (stdoutput, segment) & SEC_MEP_VLIW) + && bfd_section_flags (segment) & SEC_MEP_VLIW) return 0; #endif /* MEP_IVC2_SUPPORTED */ @@ -1587,7 +1587,7 @@ mep_relax_frag (segT segment, fragS *fragP, long stretch) long rv = relax_frag (segment, fragP, stretch); #ifdef MEP_IVC2_SUPPORTED if (mep_cop == EF_MEP_COP_IVC2 - && bfd_get_section_flags (stdoutput, segment) & SEC_MEP_VLIW) + && bfd_section_flags (segment) & SEC_MEP_VLIW) return 0; #endif return rv; @@ -1624,7 +1624,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, int core_mode; #ifdef MEP_IVC2_SUPPORTED - if (bfd_get_section_flags (stdoutput, seg) & SEC_MEP_VLIW + if (bfd_section_flags (seg) & SEC_MEP_VLIW && mep_cop == EF_MEP_COP_IVC2) core_mode = 0; else @@ -2110,7 +2110,7 @@ mep_vtext_section (void) { flagword applicable = bfd_applicable_section_flags (stdoutput); vtext_section = subseg_new (VTEXT_SECTION_NAME, 0); - bfd_set_section_flags (stdoutput, vtext_section, + bfd_set_section_flags (vtext_section, applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_READONLY | SEC_MEP_VLIW)); diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c index c9ab452..2f68d68 100644 --- a/gas/config/tc-microblaze.c +++ b/gas/config/tc-microblaze.c @@ -2011,8 +2011,7 @@ md_apply_fix (fixS * fixP, { if (S_IS_WEAK (fixP->fx_addsy) || (symbol_used_in_reloc_p (fixP->fx_addsy) - && (((bfd_get_section_flags (stdoutput, - S_GET_SEGMENT (fixP->fx_addsy)) + && (((bfd_section_flags (S_GET_SEGMENT (fixP->fx_addsy)) & SEC_LINK_ONCE) != 0) || !strncmp (segment_name (S_GET_SEGMENT (fixP->fx_addsy)), ".gnu.linkonce", diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index a386d11..b2e4973 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -3859,9 +3859,9 @@ md_begin (void) if (strncmp (TARGET_OS, "elf", 3) != 0 && strncmp (TARGET_OS, "vxworks", 7) != 0) { - (void) bfd_set_section_alignment (stdoutput, text_section, 4); - (void) bfd_set_section_alignment (stdoutput, data_section, 4); - (void) bfd_set_section_alignment (stdoutput, bss_section, 4); + bfd_set_section_alignment (text_section, 4); + bfd_set_section_alignment (data_section, 4); + bfd_set_section_alignment (bss_section, 4); } /* Create a .reginfo section for register masks and a .mdebug @@ -3886,8 +3886,8 @@ md_begin (void) { sec = subseg_new (".reginfo", (subsegT) 0); - bfd_set_section_flags (stdoutput, sec, flags); - bfd_set_section_alignment (stdoutput, sec, HAVE_NEWABI ? 3 : 2); + bfd_set_section_flags (sec, flags); + bfd_set_section_alignment (sec, HAVE_NEWABI ? 3 : 2); mips_regmask_frag = frag_more (sizeof (Elf32_External_RegInfo)); } @@ -3896,8 +3896,8 @@ md_begin (void) /* The 64-bit ABI uses a .MIPS.options section rather than .reginfo section. */ sec = subseg_new (".MIPS.options", (subsegT) 0); - bfd_set_section_flags (stdoutput, sec, flags); - bfd_set_section_alignment (stdoutput, sec, 3); + bfd_set_section_flags (sec, flags); + bfd_set_section_alignment (sec, 3); /* Set up the option header. */ { @@ -3918,25 +3918,23 @@ md_begin (void) } sec = subseg_new (".MIPS.abiflags", (subsegT) 0); - bfd_set_section_flags (stdoutput, sec, + bfd_set_section_flags (sec, SEC_READONLY | SEC_DATA | SEC_ALLOC | SEC_LOAD); - bfd_set_section_alignment (stdoutput, sec, 3); + bfd_set_section_alignment (sec, 3); mips_flags_frag = frag_more (sizeof (Elf_External_ABIFlags_v0)); if (ECOFF_DEBUGGING) { sec = subseg_new (".mdebug", (subsegT) 0); - (void) bfd_set_section_flags (stdoutput, sec, - SEC_HAS_CONTENTS | SEC_READONLY); - (void) bfd_set_section_alignment (stdoutput, sec, 2); + bfd_set_section_flags (sec, SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_alignment (sec, 2); } else if (mips_flag_pdr) { pdr_seg = subseg_new (".pdr", (subsegT) 0); - (void) bfd_set_section_flags (stdoutput, pdr_seg, - SEC_READONLY | SEC_RELOC - | SEC_DEBUGGING); - (void) bfd_set_section_alignment (stdoutput, pdr_seg, 2); + bfd_set_section_flags (pdr_seg, + SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); + bfd_set_section_alignment (pdr_seg, 2); } subseg_set (seg, subseg); @@ -4468,7 +4466,7 @@ s_is_linkonce (symbolS *sym, segT from_seg) if (symseg != from_seg && !S_IS_LOCAL (sym)) { - if ((bfd_get_section_flags (stdoutput, symseg) & SEC_LINK_ONCE)) + if ((bfd_section_flags (symseg) & SEC_LINK_ONCE)) linkonce = TRUE; /* The GNU toolchain uses an extension for ELF: a section beginning with the magic string .gnu.linkonce is a @@ -6180,7 +6178,7 @@ match_float_constant (struct mips_arg_info *arg, expressionS *imm, } new_seg = subseg_new (newname, (subsegT) 0); - bfd_set_section_flags (stdoutput, new_seg, + bfd_set_section_flags (new_seg, SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_DATA); frag_align (length == 4 ? 2 : 3, 0, 0); if (strncmp (TARGET_OS, "elf", 3) != 0) @@ -16128,7 +16126,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED) && fixP->fx_done && fixP->fx_frag->fr_address >= text_section->vma && (fixP->fx_frag->fr_address - < text_section->vma + bfd_get_section_size (text_section)) + < text_section->vma + bfd_section_size (text_section)) && ((insn & 0xffff0000) == 0x10000000 /* beq $0,$0 */ || (insn & 0xffff0000) == 0x04010000 /* bgez $0 */ || (insn & 0xffff0000) == 0x04110000)) /* bgezal $0 */ @@ -16319,9 +16317,8 @@ s_change_sec (int sec) case 'r': seg = subseg_new (RDATA_SECTION_NAME, (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, (SEC_ALLOC | SEC_LOAD - | SEC_READONLY | SEC_RELOC - | SEC_DATA)); + bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY + | SEC_RELOC | SEC_DATA)); if (strncmp (TARGET_OS, "elf", 3) != 0) record_alignment (seg, 4); demand_empty_rest_of_line (); @@ -16329,7 +16326,7 @@ s_change_sec (int sec) case 's': seg = subseg_new (".sdata", (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, + bfd_set_section_flags (seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA); if (strncmp (TARGET_OS, "elf", 3) != 0) record_alignment (seg, 4); @@ -16338,7 +16335,7 @@ s_change_sec (int sec) case 'B': seg = subseg_new (".sbss", (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, SEC_ALLOC); + bfd_set_section_flags (seg, SEC_ALLOC); if (strncmp (TARGET_OS, "elf", 3) != 0) record_alignment (seg, 4); demand_empty_rest_of_line (); @@ -17603,7 +17600,7 @@ tc_get_register (int frame) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); /* We don't need to align ELF sections to the full alignment. However, Irix 5 may prefer that we align them at least to a 16 @@ -19760,7 +19757,7 @@ s_mips_end (int x ATTRIBUTE_UNUSED) else p = NULL; - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) == 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) == 0) as_warn (_(".end not in text section")); if (!cur_proc_ptr) @@ -19850,7 +19847,7 @@ s_mips_ent (int aent) || *input_line_pointer == '-') get_number (); - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) == 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) == 0) as_warn (_(".ent or .aent not in text section")); if (!aent && cur_proc_ptr) diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c index 3178059..1514b6d 100644 --- a/gas/config/tc-mmix.c +++ b/gas/config/tc-mmix.c @@ -2130,9 +2130,8 @@ s_bspec (int unused ATTRIBUTE_UNUSED) if (sec == NULL) as_fatal (_("can't create section %s"), newsecname); - if (!bfd_set_section_flags (stdoutput, sec, - bfd_get_section_flags (stdoutput, sec) - | SEC_READONLY)) + if (!bfd_set_section_flags (sec, + bfd_section_flags (sec) | SEC_READONLY)) as_fatal (_("can't set section flags for section %s"), newsecname); } @@ -2638,7 +2637,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) than just helping the user around this limitation here; hopefully the code using the local expression is around. Putting the LOCAL semantics in a relocation still seems right; a section didn't do. */ - if (bfd_section_size (section->owner, section) == 0) + if (bfd_section_size (section) == 0) as_bad_where (fixP->fx_file, fixP->fx_line, fixP->fx_r_type == BFD_RELOC_MMIX_LOCAL @@ -2708,7 +2707,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) resolve the relocation here. */ if (addsy != NULL && (bfd_is_und_section (addsec) - || strcmp (bfd_get_section_name (addsec->owner, addsec), + || strcmp (bfd_section_name (addsec), MMIX_REG_CONTENTS_SECTION_NAME) == 0)) { code = fixP->fx_r_type; @@ -2735,7 +2734,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) case BFD_RELOC_MMIX_BASE_PLUS_OFFSET: if (addsy != NULL - && strcmp (bfd_get_section_name (addsec->owner, addsec), + && strcmp (bfd_section_name (addsec), MMIX_REG_CONTENTS_SECTION_NAME) == 0) { /* This changed into a register; the relocation is for the @@ -2838,7 +2837,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixP) case BFD_RELOC_MMIX_REG: if (addsy != NULL && (bfd_is_und_section (addsec) - || strcmp (bfd_get_section_name (addsec->owner, addsec), + || strcmp (bfd_section_name (addsec), MMIX_REG_CONTENTS_SECTION_NAME) == 0)) { code = fixP->fx_r_type; @@ -3794,7 +3793,7 @@ mmix_frob_file (void) if (real_reg_section != NULL) { /* FIXME: Pass error state gracefully. */ - if (bfd_get_section_flags (stdoutput, real_reg_section) & SEC_HAS_CONTENTS) + if (bfd_section_flags (real_reg_section) & SEC_HAS_CONTENTS) as_fatal (_("register section has contents\n")); bfd_section_list_remove (stdoutput, real_reg_section); @@ -3924,7 +3923,7 @@ mmix_md_elf_section_change_hook (void) if (doing_bspec) as_bad (_("section change from within a BSPEC/ESPEC pair is not supported")); - last_alignment = bfd_get_section_alignment (now_seg->owner, now_seg); + last_alignment = bfd_section_alignment (now_seg); want_unaligned = 0; } diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c index 045016b..ebc011b 100644 --- a/gas/config/tc-mn10200.c +++ b/gas/config/tc-mn10200.c @@ -675,7 +675,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index 15e6e27..1a41731 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -900,7 +900,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } @@ -2616,7 +2616,7 @@ mn10300_handle_align (fragS *frag) && now_seg != bss_section /* Do not create relocs for the merging sections - such relocs will prevent the contents from being merged. */ - && (bfd_get_section_flags (now_seg->owner, now_seg) & SEC_MERGE) == 0) + && (bfd_section_flags (now_seg) & SEC_MERGE) == 0) /* Create a new fixup to record the alignment request. The symbol is irrelevant but must be present so we use the absolute section symbol. The offset from the symbol is used to record the power-of-two alignment diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c index 5821b1c..56d2024 100644 --- a/gas/config/tc-msp430.c +++ b/gas/config/tc-msp430.c @@ -4239,7 +4239,7 @@ md_assemble (char * str) valueT md_section_align (asection * seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-mt.c b/gas/config/tc-mt.c index bd51854..5b938aa 100644 --- a/gas/config/tc-mt.c +++ b/gas/config/tc-mt.c @@ -333,7 +333,7 @@ md_assemble (char * str) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c index d01ca3d..36ed58a 100644 --- a/gas/config/tc-nds32.c +++ b/gas/config/tc-nds32.c @@ -3841,7 +3841,7 @@ do_nds32_seg (int i, subsegT sub) seg->s = subseg_new (seg->name, sub); if (OUTPUT_FLAVOR == bfd_target_elf_flavour) { - bfd_set_section_flags (stdoutput, seg->s, seg->flags); + bfd_set_section_flags (seg->s, seg->flags); if ((seg->flags & SEC_LOAD) == 0) seg_info (seg->s)->bss = 1; } @@ -6609,7 +6609,7 @@ md_operand (expressionS *expressionP) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & ((valueT) -1 << align)); } @@ -7569,7 +7569,7 @@ nds32_set_section_relocs (asection *sec, arelent ** relocs ATTRIBUTE_UNUSED, unsigned int n ATTRIBUTE_UNUSED) { bfd *abfd ATTRIBUTE_UNUSED = sec->owner; - if (bfd_get_section_flags (abfd, sec) & (flagword) SEC_RELOC) + if (bfd_section_flags (sec) & (flagword) SEC_RELOC) nds32_insertion_sort (sec->orelocation, sec->reloc_count, sizeof (arelent**), compar_relent); } diff --git a/gas/config/tc-or1k.c b/gas/config/tc-or1k.c index 28fa7c5..e29d4dd 100644 --- a/gas/config/tc-or1k.c +++ b/gas/config/tc-or1k.c @@ -165,7 +165,7 @@ md_operand (expressionS * expressionP) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 042c95b..156f62c 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -1975,9 +1975,7 @@ ppc_cleanup (void) /* Create the .PPC.EMB.apuinfo section. */ apuinfo_secp = subseg_new (APUINFO_SECTION_NAME, 0); - bfd_set_section_flags (stdoutput, - apuinfo_secp, - SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_flags (apuinfo_secp, SEC_HAS_CONTENTS | SEC_READONLY); p = frag_more (4); md_number_to_chars (p, (valueT) 8, 4); @@ -2703,7 +2701,7 @@ ppc_frob_file_before_adjust (void) toc = bfd_get_section_by_name (stdoutput, ".toc"); if (toc != NULL && toc_reloc_types != has_large_toc_reloc - && bfd_section_size (stdoutput, toc) > 0x10000) + && bfd_section_size (toc) > 0x10000) as_warn (_("TOC section size exceeds 64k")); } @@ -4681,14 +4679,14 @@ ppc_change_debug_section (unsigned int idx, subsegT subseg) const struct xcoff_dwsect_name *dw = &xcoff_dwsect_names[idx]; sec = subseg_new (dw->name, subseg); - oldflags = bfd_get_section_flags (stdoutput, sec); + oldflags = bfd_section_flags (sec); if (oldflags == SEC_NO_FLAGS) { /* Just created section. */ gas_assert (dw_sections[idx].sect == NULL); - bfd_set_section_flags (stdoutput, sec, SEC_DEBUGGING); - bfd_set_section_alignment (stdoutput, sec, 0); + bfd_set_section_flags (sec, SEC_DEBUGGING); + bfd_set_section_alignment (sec, 0); dw_sections[idx].sect = sec; } @@ -5804,11 +5802,10 @@ ppc_pdata (int ignore ATTRIBUTE_UNUSED) { pdata_section = subseg_new (".pdata", 0); - bfd_set_section_flags (stdoutput, pdata_section, - (SEC_ALLOC | SEC_LOAD | SEC_RELOC - | SEC_READONLY | SEC_DATA )); + bfd_set_section_flags (pdata_section, (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_READONLY | SEC_DATA)); - bfd_set_section_alignment (stdoutput, pdata_section, 2); + bfd_set_section_alignment (pdata_section, 2); } else { @@ -5837,11 +5834,10 @@ ppc_ydata (int ignore ATTRIBUTE_UNUSED) if (ydata_section == 0) { ydata_section = subseg_new (".ydata", 0); - bfd_set_section_flags (stdoutput, ydata_section, - (SEC_ALLOC | SEC_LOAD | SEC_RELOC - | SEC_READONLY | SEC_DATA )); + bfd_set_section_flags (ydata_section, (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_READONLY | SEC_DATA )); - bfd_set_section_alignment (stdoutput, ydata_section, 3); + bfd_set_section_alignment (ydata_section, 3); } else { @@ -5874,11 +5870,10 @@ ppc_reldata (int ignore ATTRIBUTE_UNUSED) { reldata_section = subseg_new (".reldata", 0); - bfd_set_section_flags (stdoutput, reldata_section, - (SEC_ALLOC | SEC_LOAD | SEC_RELOC - | SEC_DATA)); + bfd_set_section_flags (reldata_section, (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_DATA)); - bfd_set_section_alignment (stdoutput, reldata_section, 2); + bfd_set_section_alignment (reldata_section, 2); } else { @@ -5903,11 +5898,10 @@ ppc_rdata (int ignore ATTRIBUTE_UNUSED) if (rdata_section == 0) { rdata_section = subseg_new (".rdata", 0); - bfd_set_section_flags (stdoutput, rdata_section, - (SEC_ALLOC | SEC_LOAD | SEC_RELOC - | SEC_READONLY | SEC_DATA )); + bfd_set_section_flags (rdata_section, (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_READONLY | SEC_DATA )); - bfd_set_section_alignment (stdoutput, rdata_section, 2); + bfd_set_section_alignment (rdata_section, 2); } else { @@ -6261,13 +6255,13 @@ ppc_pe_section (int ignore ATTRIBUTE_UNUSED) if (flags != SEC_NO_FLAGS) { - if (! bfd_set_section_flags (stdoutput, sec, flags)) + if (!bfd_set_section_flags (sec, flags)) as_bad (_("error setting flags for \"%s\": %s"), - bfd_section_name (stdoutput, sec), + bfd_section_name (sec), bfd_errmsg (bfd_get_error ())); } - bfd_set_section_alignment (stdoutput, sec, align); + bfd_set_section_alignment (sec, align); } static void @@ -6298,11 +6292,10 @@ ppc_pe_tocd (int ignore ATTRIBUTE_UNUSED) { tocdata_section = subseg_new (".tocd", 0); /* FIXME: section flags won't work. */ - bfd_set_section_flags (stdoutput, tocdata_section, - (SEC_ALLOC | SEC_LOAD | SEC_RELOC - | SEC_READONLY | SEC_DATA)); + bfd_set_section_flags (tocdata_section, (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_READONLY | SEC_DATA)); - bfd_set_section_alignment (stdoutput, tocdata_section, 2); + bfd_set_section_alignment (tocdata_section, 2); } else { @@ -6573,8 +6566,7 @@ ppc_frob_symbol (symbolS *sym) /* This is a csect symbol. x_scnlen is the size of the csect. */ if (symbol_get_tc (sym)->next == (symbolS *) NULL) - a->x_csect.x_scnlen.l = (bfd_section_size (stdoutput, - S_GET_SEGMENT (sym)) + a->x_csect.x_scnlen.l = (bfd_section_size (S_GET_SEGMENT (sym)) - S_GET_VALUE (sym)); else { @@ -6622,8 +6614,7 @@ ppc_frob_symbol (symbolS *sym) || symbol_get_tc (next)->symbol_class != XMC_TC) { if (ppc_after_toc_frag == (fragS *) NULL) - a->x_csect.x_scnlen.l = (bfd_section_size (stdoutput, - data_section) + a->x_csect.x_scnlen.l = (bfd_section_size (data_section) - S_GET_VALUE (sym)); else a->x_csect.x_scnlen.l = (ppc_after_toc_frag->fr_address @@ -6787,12 +6778,12 @@ ppc_frob_section (asection *sec) static bfd_vma vma = 0; /* Dwarf sections start at 0. */ - if (bfd_get_section_flags (NULL, sec) & SEC_DEBUGGING) + if (bfd_section_flags (sec) & SEC_DEBUGGING) return; vma = md_section_align (sec, vma); - bfd_set_section_vma (stdoutput, sec, vma); - vma += bfd_section_size (stdoutput, sec); + bfd_set_section_vma (sec, vma); + vma += bfd_section_size (sec); } #endif /* OBJ_XCOFF */ @@ -6823,7 +6814,7 @@ md_section_align (asection *seg ATTRIBUTE_UNUSED, valueT addr) #ifdef OBJ_ELF return addr; #else - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); #endif @@ -6886,7 +6877,7 @@ ppc_fix_adjustable (fixS *fix) return 0; /* Always adjust symbols in debugging sections. */ - if (bfd_get_section_flags (stdoutput, symseg) & SEC_DEBUGGING) + if (bfd_section_flags (symseg) & SEC_DEBUGGING) return 1; if (ppc_toc_csect != (symbolS *) NULL @@ -7927,9 +7918,8 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg) #else /* We want to use the offset within the toc, not the actual VMA of the symbol. */ - fixP->fx_addnumber = - - bfd_get_section_vma (stdoutput, S_GET_SEGMENT (fixP->fx_addsy)) - - S_GET_VALUE (ppc_toc_csect); + fixP->fx_addnumber = (- bfd_section_vma (S_GET_SEGMENT (fixP->fx_addsy)) + - S_GET_VALUE (ppc_toc_csect)); /* Set *valP to avoid errors. */ *valP = value; #endif diff --git a/gas/config/tc-pru.c b/gas/config/tc-pru.c index 12ed8cc..2e2058c 100644 --- a/gas/config/tc-pru.c +++ b/gas/config/tc-pru.c @@ -1745,7 +1745,7 @@ md_assemble (char *op_str) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & (-((valueT) 1 << align))); } diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c index 878c03f..9160cc0 100644 --- a/gas/config/tc-rl78.c +++ b/gas/config/tc-rl78.c @@ -1520,6 +1520,6 @@ md_apply_fix (struct fix * f ATTRIBUTE_UNUSED, valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c index 6b19f2f..5d2e69b 100644 --- a/gas/config/tc-rx.c +++ b/gas/config/tc-rx.c @@ -509,7 +509,7 @@ parse_rx_section (char * name) obj_elf_change_section (name, type, 0, attr, 0, NULL, FALSE, FALSE); } - bfd_set_section_alignment (stdoutput, now_seg, align); + bfd_set_section_alignment (now_seg, align); } static void @@ -1290,7 +1290,7 @@ md_operand (expressionS * exp ATTRIBUTE_UNUSED) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-s12z.c b/gas/config/tc-s12z.c index 67e88d2..be4d4fb 100644 --- a/gas/config/tc-s12z.c +++ b/gas/config/tc-s12z.c @@ -187,7 +187,7 @@ md_atof (int type, char *litP, int *sizeP) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index f74497a..a4dae4f 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -2084,7 +2084,7 @@ md_atof (int type, char *litp, int *sizep) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c index 648e0d2..1393a18 100644 --- a/gas/config/tc-score.c +++ b/gas/config/tc-score.c @@ -5300,7 +5300,7 @@ s3_pic_need_relax (symbolS *sym, asection *segtype) linkonce = FALSE; if (symsec != segtype && ! S_IS_LOCAL (sym)) { - if ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE) != 0) + if ((bfd_section_flags (symsec) & SEC_LINK_ONCE) != 0) linkonce = TRUE; /* The GNU toolchain uses an extension for ELF: a section @@ -5546,7 +5546,7 @@ static void s3_score_s_section (int ignore) { obj_elf_section (ignore); - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) record_alignment (now_seg, 2); } @@ -5569,14 +5569,14 @@ s3_s_change_sec (int sec) { case 'r': seg = subseg_new (s3_RDATA_SECTION_NAME, (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA)); + bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA)); if (strcmp (TARGET_OS, "elf") != 0) record_alignment (seg, 4); demand_empty_rest_of_line (); break; case 's': seg = subseg_new (".sdata", (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA); + bfd_set_section_flags (seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA); if (strcmp (TARGET_OS, "elf") != 0) record_alignment (seg, 4); demand_empty_rest_of_line (); @@ -5686,7 +5686,7 @@ s3_s_score_ent (int aent) s3_get_number (); #ifdef BFD_ASSEMBLER - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; @@ -5795,7 +5795,7 @@ s3_s_score_end (int x ATTRIBUTE_UNUSED) p = NULL; #ifdef BFD_ASSEMBLER - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; @@ -6128,15 +6128,16 @@ s3_s_score_lcomm (int bytes_p) if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour || OUTPUT_FLAVOR == bfd_target_elf_flavour) { /* For Score and Alpha ECOFF or ELF, small objects are put in .sbss. */ - if ((unsigned)temp <= bfd_get_gp_size (stdoutput)) - { - bss_seg = subseg_new (".sbss", 1); - seg_info (bss_seg)->bss = 1; + if ((unsigned) temp <= bfd_get_gp_size (stdoutput)) + { + bss_seg = subseg_new (".sbss", 1); + seg_info (bss_seg)->bss = 1; #ifdef BFD_ASSEMBLER - if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC)) - as_warn (_("error setting flags for \".sbss\": %s"), bfd_errmsg (bfd_get_error ())); + if (!bfd_set_section_flags (bss_seg, SEC_ALLOC)) + as_warn (_("error setting flags for \".sbss\": %s"), + bfd_errmsg (bfd_get_error ())); #endif - } + } } #endif @@ -6538,8 +6539,8 @@ s3_begin (void) seg = now_seg; subseg = now_subseg; s3_pdr_seg = subseg_new (".pdr", (subsegT) 0); - (void)bfd_set_section_flags (stdoutput, s3_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); - (void)bfd_set_section_alignment (stdoutput, s3_pdr_seg, 2); + bfd_set_section_flags (s3_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); + bfd_set_section_alignment (s3_pdr_seg, 2); subseg_set (seg, subseg); if (s3_USE_GLOBAL_POINTER_OPT) @@ -7076,7 +7077,7 @@ s3_pcrel_from (fixS * fixP) static valueT s3_section_align (segT segment ATTRIBUTE_UNUSED, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c index 90cd5e3..a615e14 100644 --- a/gas/config/tc-score7.c +++ b/gas/config/tc-score7.c @@ -5188,7 +5188,7 @@ s7_pic_need_relax (symbolS *sym, asection *segtype) linkonce = FALSE; if (symsec != segtype && ! S_IS_LOCAL (sym)) { - if ((bfd_get_section_flags (stdoutput, symsec) & SEC_LINK_ONCE) != 0) + if ((bfd_section_flags (symsec) & SEC_LINK_ONCE) != 0) linkonce = TRUE; /* The GNU toolchain uses an extension for ELF: a section @@ -5399,7 +5399,7 @@ static void s7_s_section (int ignore) { obj_elf_section (ignore); - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) record_alignment (now_seg, 2); } @@ -5422,14 +5422,14 @@ s7_s_change_sec (int sec) { case 'r': seg = subseg_new (s7_RDATA_SECTION_NAME, (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA)); + bfd_set_section_flags (seg, (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_RELOC | SEC_DATA)); if (strcmp (TARGET_OS, "elf") != 0) record_alignment (seg, 4); demand_empty_rest_of_line (); break; case 's': seg = subseg_new (".sdata", (subsegT) get_absolute_expression ()); - bfd_set_section_flags (stdoutput, seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA); + bfd_set_section_flags (seg, SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_DATA); if (strcmp (TARGET_OS, "elf") != 0) record_alignment (seg, 4); demand_empty_rest_of_line (); @@ -5540,7 +5540,7 @@ s7_s_score_ent (int aent) s7_get_number (); #ifdef BFD_ASSEMBLER - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; @@ -5650,7 +5650,7 @@ s7_s_score_end (int x ATTRIBUTE_UNUSED) p = NULL; #ifdef BFD_ASSEMBLER - if ((bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) != 0) + if ((bfd_section_flags (now_seg) & SEC_CODE) != 0) maybe_text = 1; else maybe_text = 0; @@ -5993,7 +5993,7 @@ s7_s_score_lcomm (int bytes_p) bss_seg = subseg_new (".sbss", 1); seg_info (bss_seg)->bss = 1; #ifdef BFD_ASSEMBLER - if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC)) + if (!bfd_set_section_flags (bss_seg, SEC_ALLOC)) as_warn (_("error setting flags for \".sbss\": %s"), bfd_errmsg (bfd_get_error ())); #endif } @@ -6152,8 +6152,8 @@ s7_begin (void) seg = now_seg; subseg = now_subseg; s7_pdr_seg = subseg_new (".pdr", (subsegT) 0); - (void) bfd_set_section_flags (stdoutput, s7_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); - (void) bfd_set_section_alignment (stdoutput, s7_pdr_seg, 2); + bfd_set_section_flags (s7_pdr_seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); + bfd_set_section_alignment (s7_pdr_seg, 2); subseg_set (seg, subseg); if (s7_USE_GLOBAL_POINTER_OPT) @@ -6628,7 +6628,7 @@ s7_pcrel_from (fixS * fixP) static valueT s7_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index c9d47df..c57f066 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -3162,8 +3162,8 @@ md_section_align (segT seg ATTRIBUTE_UNUSED, valueT size) #ifdef OBJ_ELF return size; #else /* ! OBJ_ELF */ - return ((size + (1 << bfd_get_section_alignment (stdoutput, seg)) - 1) - & -(1 << bfd_get_section_alignment (stdoutput, seg))); + return ((size + (1 << bfd_section_alignment (seg)) - 1) + & -(1 << bfd_section_alignment (seg))); #endif /* ! OBJ_ELF */ } diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index 347db08..4f7d675 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -4001,7 +4001,7 @@ tc_gen_reloc (asection *section, fixS *fixp) } /* Nothing is aligned in DWARF debugging sections. */ - if (bfd_get_section_flags (stdoutput, section) & SEC_DEBUGGING) + if (bfd_section_flags (section) & SEC_DEBUGGING) switch (code) { case BFD_RELOC_16: code = BFD_RELOC_SPARC_UA16; break; diff --git a/gas/config/tc-spu.c b/gas/config/tc-spu.c index d3e3d8a..bdb22e7 100644 --- a/gas/config/tc-spu.c +++ b/gas/config/tc-spu.c @@ -904,7 +904,7 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp) valueT md_section_align (segT seg, valueT size) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); valueT mask = ((valueT) 1 << align) - 1; return (size + mask) & ~mask; diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c index f20d93b..b5588b9 100644 --- a/gas/config/tc-tic4x.c +++ b/gas/config/tc-tic4x.c @@ -1001,9 +1001,9 @@ tic4x_sect (int x ATTRIBUTE_UNUSED) symbol_set_frag (line_label, frag_now); } - if (bfd_get_section_flags (stdoutput, seg) == SEC_NO_FLAGS) + if (bfd_section_flags (seg) == SEC_NO_FLAGS) { - if (!bfd_set_section_flags (stdoutput, seg, SEC_DATA)) + if (!bfd_set_section_flags (seg, SEC_DATA)) as_warn (_("Error setting flags for \"%s\": %s"), name, bfd_errmsg (bfd_get_error ())); } @@ -1104,7 +1104,7 @@ tic4x_usect (int x ATTRIBUTE_UNUSED) S_SET_VALUE (line_label, frag_now_fix ()); } seg_info (seg)->bss = 1; /* Uninitialised data. */ - if (!bfd_set_section_flags (stdoutput, seg, SEC_ALLOC)) + if (!bfd_set_section_flags (seg, SEC_ALLOC)) as_warn (_("Error setting flags for \"%s\": %s"), name, bfd_errmsg (bfd_get_error ())); tic4x_seg_alloc (name, seg, size, line_label); diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c index 3e1d32a..72c8cf3 100644 --- a/gas/config/tc-tic54x.c +++ b/gas/config/tc-tic54x.c @@ -1391,7 +1391,7 @@ tic54x_usect (int x ATTRIBUTE_UNUSED) blocking_flag = alignment_flag = 0; seg = subseg_new (name, 0); - flags = bfd_get_section_flags (stdoutput, seg) | SEC_ALLOC; + flags = bfd_section_flags (seg) | SEC_ALLOC; if (alignment_flag) { @@ -1420,7 +1420,7 @@ tic54x_usect (int x ATTRIBUTE_UNUSED) if (blocking_flag) flags |= SEC_TIC54X_BLOCK; - if (!bfd_set_section_flags (stdoutput, seg, flags)) + if (!bfd_set_section_flags (seg, flags)) as_warn (_("Error setting flags for \"%s\": %s"), name, bfd_errmsg (bfd_get_error ())); @@ -3977,12 +3977,12 @@ static void emit_insn (tic54x_insn *insn) { int i; - flagword oldflags = bfd_get_section_flags (stdoutput, now_seg); + flagword oldflags = bfd_section_flags (now_seg); flagword flags = oldflags | SEC_CODE; - if (! bfd_set_section_flags (stdoutput, now_seg, flags)) + if (!bfd_set_section_flags (now_seg, flags)) as_warn (_("error setting flags for \"%s\": %s"), - bfd_section_name (stdoutput, now_seg), + bfd_section_name (now_seg), bfd_errmsg (bfd_get_error ())); for (i = 0; i < insn->words; i++) diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c index 108c2d4..0433d9e 100644 --- a/gas/config/tc-tic6x.c +++ b/gas/config/tc-tic6x.c @@ -781,7 +781,7 @@ md_begin (void) /* This is copied from perform_an_assembly_pass. */ applicable = bfd_applicable_section_flags (stdoutput); - bfd_set_section_flags (stdoutput, sbss_section, applicable & SEC_ALLOC); + bfd_set_section_flags (sbss_section, applicable & SEC_ALLOC); subseg_set (seg, subseg); @@ -4483,7 +4483,7 @@ md_section_align (segT segment ATTRIBUTE_UNUSED, { /* Round up section sizes to ensure that text sections consist of whole fetch packets. */ - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & (-((valueT) 1 << align))); } diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c index e840e5d..788a9f3 100644 --- a/gas/config/tc-tilegx.c +++ b/gas/config/tc-tilegx.c @@ -262,7 +262,7 @@ md_begin (void) as_warn (_("Could not set architecture and machine")); /* Guarantee text section is aligned. */ - bfd_set_section_alignment (stdoutput, text_section, + bfd_set_section_alignment (text_section, TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES); require_canonical_reg_names = 1; @@ -948,8 +948,8 @@ tilegx_flush_bundle (void) /* If the section seems to have no alignment set yet, go ahead and make it large enough to hold code. */ - if (bfd_get_section_alignment (stdoutput, now_seg) == 0) - bfd_set_section_alignment (stdoutput, now_seg, + if (bfd_section_alignment (now_seg) == 0) + bfd_set_section_alignment (now_seg, TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES); for (j = 0; j < current_bundle_index; j++) diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c index 146e270..1c98a93 100644 --- a/gas/config/tc-tilepro.c +++ b/gas/config/tc-tilepro.c @@ -207,7 +207,7 @@ md_begin (void) int i; /* Guarantee text section is aligned. */ - bfd_set_section_alignment (stdoutput, text_section, + bfd_set_section_alignment (text_section, TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES); require_canonical_reg_names = 1; @@ -838,8 +838,8 @@ tilepro_flush_bundle (void) /* If the section seems to have no alignment set yet, go ahead and make it large enough to hold code. */ - if (bfd_get_section_alignment (stdoutput, now_seg) == 0) - bfd_set_section_alignment (stdoutput, now_seg, + if (bfd_section_alignment (now_seg) == 0) + bfd_set_section_alignment (now_seg, TILEPRO_LOG2_BUNDLE_ALIGNMENT_IN_BYTES); for (j = 0; j < current_bundle_index; j++) diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index 12d5846..dfb43cb 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -229,7 +229,7 @@ do_v850_seg (int i, subsegT sub) else { seg->s = subseg_new (seg->name, sub); - bfd_set_section_flags (stdoutput, seg->s, seg->flags); + bfd_set_section_flags (seg->s, seg->flags); if ((seg->flags & SEC_LOAD) == 0) seg_info (seg->s)->bss = 1; } @@ -1878,7 +1878,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } @@ -3740,8 +3740,8 @@ v850_md_end (void) enum v850_notes id; note_sec = subseg_new (V850_NOTE_SECNAME, 0); - bfd_set_section_flags (stdoutput, note_sec, SEC_HAS_CONTENTS | SEC_READONLY | SEC_MERGE); - bfd_set_section_alignment (stdoutput, note_sec, 2); + bfd_set_section_flags (note_sec, SEC_HAS_CONTENTS | SEC_READONLY | SEC_MERGE); + bfd_set_section_alignment (note_sec, 2); /* Provide default values for all of the notes. */ for (id = V850_NOTE_ALIGNMENT; id <= NUM_V850_NOTES; id++) diff --git a/gas/config/tc-visium.c b/gas/config/tc-visium.c index 6886311..fbf59c9 100644 --- a/gas/config/tc-visium.c +++ b/gas/config/tc-visium.c @@ -222,7 +222,7 @@ visium_rdata (int xxx) valueT md_section_align (asection *seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-wasm32.c b/gas/config/tc-wasm32.c index c57611c..3dc42f9 100644 --- a/gas/config/tc-wasm32.c +++ b/gas/config/tc-wasm32.c @@ -177,7 +177,7 @@ md_begin (void) valueT md_section_align (asection * seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-xc16x.c b/gas/config/tc-xc16x.c index 00bdb83..23b9e68 100644 --- a/gas/config/tc-xc16x.c +++ b/gas/config/tc-xc16x.c @@ -234,7 +234,7 @@ md_atof (int type, char *litP, int *sizeP) valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-xgate.c b/gas/config/tc-xgate.c index b3c1243..4f92c24 100644 --- a/gas/config/tc-xgate.c +++ b/gas/config/tc-xgate.c @@ -466,7 +466,7 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED) valueT md_section_align (asection * seg, valueT addr) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); return ((addr + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c index fb874c5..1c708b6 100644 --- a/gas/config/tc-xstormy16.c +++ b/gas/config/tc-xstormy16.c @@ -277,7 +277,7 @@ xstormy16_cgen_record_fixup_exp (fragS * frag, valueT md_section_align (segT segment, valueT size) { - int align = bfd_get_section_alignment (stdoutput, segment); + int align = bfd_section_alignment (segment); return ((size + (1 << align) - 1) & -(1 << align)); } diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index 320e7af..c68128e 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -4115,7 +4115,7 @@ get_is_linkonce_section (bfd *abfd ATTRIBUTE_UNUSED, segT sec) { flagword flags, link_once_flags; - flags = bfd_get_section_flags (abfd, sec); + flags = bfd_section_flags (sec); link_once_flags = (flags & SEC_LINK_ONCE); /* Flags might not be set yet. */ @@ -4980,7 +4980,7 @@ xtensa_mark_frags_for_org (void) segment_info_type *seginfo; fragS *fragP; flagword flags; - flags = bfd_get_section_flags (stdoutput, sec); + flags = bfd_section_flags (sec); if (flags & SEC_DEBUGGING) continue; if (!(flags & SEC_ALLOC)) @@ -5025,7 +5025,7 @@ xtensa_find_unmarked_state_frags (void) segment_info_type *seginfo; fragS *fragP; flagword flags; - flags = bfd_get_section_flags (stdoutput, sec); + flags = bfd_section_flags (sec); if (flags & SEC_DEBUGGING) continue; if (!(flags & SEC_ALLOC)) @@ -5073,7 +5073,7 @@ xtensa_find_unaligned_branch_targets (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *unused ATTRIBUTE_UNUSED) { - flagword flags = bfd_get_section_flags (abfd, sec); + flagword flags = bfd_section_flags (sec); segment_info_type *seginfo = seg_info (sec); fragS *frag = seginfo->frchainP->frch_root; @@ -5112,7 +5112,7 @@ xtensa_find_unaligned_loops (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *unused ATTRIBUTE_UNUSED) { - flagword flags = bfd_get_section_flags (abfd, sec); + flagword flags = bfd_section_flags (sec); segment_info_type *seginfo = seg_info (sec); fragS *frag = seginfo->frchainP->frch_root; xtensa_isa isa = xtensa_default_isa; @@ -8941,7 +8941,7 @@ xtensa_add_config_info (void) int sz; info_sec = subseg_new (".xtensa.info", 0); - bfd_set_section_flags (stdoutput, info_sec, SEC_HAS_CONTENTS | SEC_READONLY); + bfd_set_section_flags (info_sec, SEC_HAS_CONTENTS | SEC_READONLY); data = XNEWVEC (char, 100); sprintf (data, "USE_ABSOLUTE_LITERALS=%d\nABI=%d\n", @@ -11682,8 +11682,8 @@ cache_literal_section (bfd_boolean use_abs_literals) elf_group_name (seg) = group_name; - bfd_set_section_flags (stdoutput, seg, flags); - bfd_set_section_alignment (stdoutput, seg, 2); + bfd_set_section_flags (seg, flags); + bfd_set_section_alignment (seg, 2); } *pcached = seg; @@ -11814,7 +11814,7 @@ xtensa_create_property_segments (frag_predicate property_function, num_recs++; rec_size = num_recs * 8; - bfd_set_section_size (stdoutput, sec, rec_size); + bfd_set_section_size (sec, rec_size); if (num_recs) { @@ -11911,7 +11911,7 @@ xtensa_create_xproperty_segments (frag_flags_fn flag_fn, num_recs++; rec_size = num_recs * (8 + 4); - bfd_set_section_size (stdoutput, sec, rec_size); + bfd_set_section_size (sec, rec_size); /* elf_section_data (sec)->this_hdr.sh_entsize = 12; */ if (num_recs) @@ -11955,7 +11955,7 @@ xtensa_create_xproperty_segments (frag_flags_fn flag_fn, static bfd_boolean exclude_section_from_property_tables (segT sec) { - flagword flags = bfd_get_section_flags (stdoutput, sec); + flagword flags = bfd_section_flags (sec); /* Sections that don't contribute to the memory footprint are excluded. */ if ((flags & SEC_DEBUGGING) diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c index 9cb41a3..68e1b76 100644 --- a/gas/config/tc-z8k.c +++ b/gas/config/tc-z8k.c @@ -1385,7 +1385,7 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, valueT md_section_align (segT seg, valueT size) { - int align = bfd_get_section_alignment (stdoutput, seg); + int align = bfd_section_alignment (seg); valueT mask = ((valueT) 1 << align) - 1; return (size + mask) & ~mask; diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c index f30734d..388123f 100644 --- a/gas/dw2gencfi.c +++ b/gas/dw2gencfi.c @@ -232,7 +232,7 @@ get_debugseg_name (segT seg, const char *base_name) if (!seg) return concat (base_name, NULL); - name = bfd_get_section_name (stdoutput, seg); + name = bfd_section_name (seg); if (name == NULL || *name == 0) return concat (base_name, NULL); @@ -281,7 +281,7 @@ is_now_linkonce_segment (void) if (compact_eh) return now_seg; - if ((bfd_get_section_flags (stdoutput, now_seg) + if ((bfd_section_flags (now_seg) & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE | SEC_LINK_DUPLICATES_SAME_CONTENTS)) != 0) @@ -306,16 +306,16 @@ make_debug_seg (segT cseg, char *name, int sflags) if (!cseg) flags = 0; else - flags = bfd_get_section_flags (stdoutput, cseg) - & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD - | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE - | SEC_LINK_DUPLICATES_SAME_CONTENTS); + flags = (bfd_section_flags (cseg) + & (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD + | SEC_LINK_DUPLICATES_ONE_ONLY | SEC_LINK_DUPLICATES_SAME_SIZE + | SEC_LINK_DUPLICATES_SAME_CONTENTS)); /* Add standard section flags. */ flags |= sflags; /* Apply possibly linked once flags to new generated segment, too. */ - if (!bfd_set_section_flags (stdoutput, r, flags)) + if (!bfd_set_section_flags (r, flags)) as_bad (_("bfd_set_section_flags: %s"), bfd_errmsg (bfd_get_error ())); @@ -1359,7 +1359,7 @@ get_cfi_seg (segT cseg, const char *base, flagword flags, int align) else { cseg = subseg_new (base, 0); - bfd_set_section_flags (stdoutput, cseg, flags); + bfd_set_section_flags (cseg, flags); } record_alignment (cseg, align); return cseg; diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 5f804f1..90b47b0 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -657,7 +657,7 @@ dwarf2_emit_label (symbolS *label) return; if (S_GET_SEGMENT (label) != now_seg) return; - if (!(bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE)) + if (!(bfd_section_flags (now_seg) & SEC_CODE)) return; if (files_in_use == 0 && debug_type != DEBUG_DWARF2) return; @@ -1594,7 +1594,7 @@ process_entries (segT seg, struct line_entry *e) that all of the sub-sections are merged into a proper .debug_line section before a debugger sees them. */ - sec_name = bfd_get_section_name (stdoutput, seg); + sec_name = bfd_section_name (seg); if (strcmp (sec_name, ".text") != 0) { name = concat (".debug_line", sec_name, (char *) NULL); @@ -2238,7 +2238,7 @@ dwarf2_finish (void) /* Create and switch to the line number section. */ line_seg = subseg_new (".debug_line", 0); - bfd_set_section_flags (stdoutput, line_seg, SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (line_seg, SEC_READONLY | SEC_DEBUGGING); /* For each subsection, chain the debug entries together. */ for (s = all_segs; s; s = s->next) @@ -2284,15 +2284,11 @@ dwarf2_finish (void) aranges_seg = subseg_new (".debug_aranges", 0); str_seg = subseg_new (".debug_str", 0); - bfd_set_section_flags (stdoutput, info_seg, - SEC_READONLY | SEC_DEBUGGING); - bfd_set_section_flags (stdoutput, abbrev_seg, - SEC_READONLY | SEC_DEBUGGING); - bfd_set_section_flags (stdoutput, aranges_seg, - SEC_READONLY | SEC_DEBUGGING); - bfd_set_section_flags (stdoutput, str_seg, - (SEC_READONLY | SEC_DEBUGGING - | SEC_MERGE | SEC_STRINGS)); + bfd_set_section_flags (info_seg, SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (abbrev_seg, SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (aranges_seg, SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (str_seg, (SEC_READONLY | SEC_DEBUGGING + | SEC_MERGE | SEC_STRINGS)); str_seg->entsize = 1; record_alignment (aranges_seg, ffs (2 * sizeof_address) - 1); @@ -2302,8 +2298,7 @@ dwarf2_finish (void) else { ranges_seg = subseg_new (".debug_ranges", 0); - bfd_set_section_flags (stdoutput, ranges_seg, - SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (ranges_seg, SEC_READONLY | SEC_DEBUGGING); record_alignment (ranges_seg, ffs (2 * sizeof_address) - 1); out_debug_ranges (ranges_seg); } diff --git a/gas/ecoff.c b/gas/ecoff.c index 09e8f0e..bacc89f 100644 --- a/gas/ecoff.c +++ b/gas/ecoff.c @@ -3700,8 +3700,7 @@ ecoff_build_lineno (const struct ecoff_debug_swap *backend, && first_proc_ptr != (proc_t *) NULL && local_first_lineno != (lineno_list_t *) NULL && ((S_GET_VALUE (first_proc_ptr->sym->as_sym) - + bfd_get_section_vma (stdoutput, - S_GET_SEGMENT (first_proc_ptr->sym->as_sym))) + + bfd_section_vma (S_GET_SEGMENT (first_proc_ptr->sym->as_sym))) != 0)) { first.file = local_first_lineno->file; @@ -3981,8 +3980,7 @@ ecoff_build_symbols (const struct ecoff_debug_swap *backend, else sym_ptr->ecoff_sym.asym.value = (S_GET_VALUE (as_sym) - + bfd_get_section_vma (stdoutput, - S_GET_SEGMENT (as_sym)) + + bfd_section_vma (S_GET_SEGMENT (as_sym)) + sym_ptr->addend); sym_ptr->ecoff_sym.weakext = S_IS_WEAK (as_sym); @@ -4310,8 +4308,7 @@ ecoff_build_procs (const struct ecoff_debug_swap *backend, adr_sym = proc_ptr->sym->as_sym; adr = (S_GET_VALUE (adr_sym) - + bfd_get_section_vma (stdoutput, - S_GET_SEGMENT (adr_sym))); + + bfd_section_vma (S_GET_SEGMENT (adr_sym))); if (first) { /* This code used to force the adr of the very @@ -742,7 +742,7 @@ assemble_one (char *line) static bfd_boolean in_bss (void) { - flagword flags = bfd_get_section_flags (stdoutput, now_seg); + flagword flags = bfd_section_flags (now_seg); return (flags & SEC_ALLOC) && !(flags & (SEC_LOAD | SEC_HAS_CONTENTS)); } @@ -2419,7 +2419,7 @@ s_linkonce (int ignore ATTRIBUTE_UNUSED) if ((bfd_applicable_section_flags (stdoutput) & SEC_LINK_ONCE) == 0) as_warn (_(".linkonce is not supported for this object file format")); - flags = bfd_get_section_flags (stdoutput, now_seg); + flags = bfd_section_flags (now_seg); flags |= SEC_LINK_ONCE; switch (type) { @@ -2438,7 +2438,7 @@ s_linkonce (int ignore ATTRIBUTE_UNUSED) flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS; break; } - if (!bfd_set_section_flags (stdoutput, now_seg, flags)) + if (!bfd_set_section_flags (now_seg, flags)) as_bad (_("bfd_set_section_flags: %s"), bfd_errmsg (bfd_get_error ())); } @@ -2464,7 +2464,7 @@ bss_alloc (symbolS *symbolP, addressT size, unsigned int align) { bss_seg = subseg_new (".sbss", 1); seg_info (bss_seg)->bss = 1; - if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC)) + if (!bfd_set_section_flags (bss_seg, SEC_ALLOC)) as_warn (_("error setting flags for \".sbss\": %s"), bfd_errmsg (bfd_get_error ())); } @@ -2957,9 +2957,9 @@ s_mri_sect (char *type ATTRIBUTE_UNUSED) flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_READONLY | SEC_ROM; if (flags != SEC_NO_FLAGS) { - if (!bfd_set_section_flags (stdoutput, seg, flags)) + if (!bfd_set_section_flags (seg, flags)) as_warn (_("error setting flags for \"%s\": %s"), - bfd_section_name (stdoutput, seg), + bfd_section_name (seg), bfd_errmsg (bfd_get_error ())); } } diff --git a/gas/stabs.c b/gas/stabs.c index 64811c1..0217c42 100644 --- a/gas/stabs.c +++ b/gas/stabs.c @@ -109,7 +109,7 @@ get_stab_string_offset (const char *string, const char *stabstr_secname, p = frag_more (1); *p = 0; retval = seg_info (seg)->stabu.stab_string_size = 1; - bfd_set_section_flags (stdoutput, seg, SEC_READONLY | SEC_DEBUGGING); + bfd_set_section_flags (seg, SEC_READONLY | SEC_DEBUGGING); } if (length > 0) @@ -336,7 +336,7 @@ s_stab_generic (int what, if (! seg_info (seg)->hadone) { - bfd_set_section_flags (stdoutput, seg, + bfd_set_section_flags (seg, SEC_READONLY | SEC_RELOC | SEC_DEBUGGING); #ifdef INIT_STAB_SECTION INIT_STAB_SECTION (seg); diff --git a/gas/subsegs.c b/gas/subsegs.c index a66af2d..d438a10 100644 --- a/gas/subsegs.c +++ b/gas/subsegs.c @@ -65,7 +65,7 @@ subseg_change (segT seg, int subseg) { seginfo = XCNEW (segment_info_type); seginfo->bfd_section = seg; - bfd_set_section_userdata (stdoutput, seg, seginfo); + bfd_set_section_userdata (seg, seginfo); } } @@ -146,9 +146,7 @@ subseg_get (const char *segname, int force_new) { segT secptr; segment_info_type *seginfo; - const char *now_seg_name = (now_seg - ? bfd_get_section_name (stdoutput, now_seg) - : 0); + const char *now_seg_name = now_seg ? bfd_section_name (now_seg) : 0; if (!force_new && now_seg_name @@ -167,7 +165,7 @@ subseg_get (const char *segname, int force_new) secptr->output_section = secptr; seginfo = XCNEW (segment_info_type); seginfo->bfd_section = secptr; - bfd_set_section_userdata (stdoutput, secptr, seginfo); + bfd_set_section_userdata (secptr, seginfo); } return secptr; } @@ -260,7 +258,7 @@ section_symbol (segT sec) int subseg_text_p (segT sec) { - return (bfd_get_section_flags (stdoutput, sec) & SEC_CODE) != 0; + return (bfd_section_flags (sec) & SEC_CODE) != 0; } /* Return non zero if SEC has at least one byte of data. It is diff --git a/gas/subsegs.h b/gas/subsegs.h index d853f45..2a95602 100644 --- a/gas/subsegs.h +++ b/gas/subsegs.h @@ -112,7 +112,7 @@ typedef struct segment_info_struct { #define seg_info(sec) \ - ((segment_info_type *) bfd_get_section_userdata (stdoutput, sec)) + ((segment_info_type *) bfd_section_userdata (sec)) extern symbolS *section_symbol (segT); diff --git a/gas/write.c b/gas/write.c index e9a17e4..9b5ae6f 100644 --- a/gas/write.c +++ b/gas/write.c @@ -359,8 +359,8 @@ record_alignment (/* Segment to which alignment pertains. */ if (seg == absolute_section) return; - if (align > bfd_get_section_alignment (stdoutput, seg)) - bfd_set_section_alignment (stdoutput, seg, align); + if (align > bfd_section_alignment (seg)) + bfd_set_section_alignment (seg, align); } int @@ -369,7 +369,7 @@ get_recorded_alignment (segT seg) if (seg == absolute_section) return 0; - return bfd_get_section_alignment (stdoutput, seg); + return bfd_section_alignment (seg); } /* Reset the section indices after removing the gas created sections. */ @@ -555,7 +555,7 @@ relax_seg (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *xxx) } static void -size_seg (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) +size_seg (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, void *xxx ATTRIBUTE_UNUSED) { flagword flags; fragS *fragp; @@ -580,8 +580,8 @@ size_seg (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) else size = 0; - flags = bfd_get_section_flags (abfd, sec); - if (size == 0 && bfd_get_section_size (sec) != 0 && + flags = bfd_section_flags (sec); + if (size == 0 && bfd_section_size (sec) != 0 && (flags & SEC_HAS_CONTENTS) != 0) return; @@ -589,7 +589,7 @@ size_seg (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) flags |= SEC_HAS_CONTENTS; flags &= ~SEC_RELOC; - x = bfd_set_section_flags (abfd, sec, flags); + x = bfd_set_section_flags (sec, flags); gas_assert (x); /* If permitted, allow the backend to pad out the section @@ -598,7 +598,7 @@ size_seg (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) newsize = size; else newsize = md_section_align (sec, size); - x = bfd_set_section_size (abfd, sec, newsize); + x = bfd_set_section_size (sec, newsize); gas_assert (x); /* If the size had to be rounded up, add some padding in the last @@ -1215,7 +1215,8 @@ get_frag_for_reloc (fragS *last_frag, } static void -write_relocs (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) +write_relocs (bfd *abfd ATTRIBUTE_UNUSED, asection *sec, + void *xxx ATTRIBUTE_UNUSED) { segment_info_type *seginfo = seg_info (sec); unsigned int n; @@ -1345,9 +1346,9 @@ write_relocs (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) if (n) { - flagword flags = bfd_get_section_flags (abfd, sec); + flagword flags = bfd_section_flags (sec); flags |= SEC_RELOC; - bfd_set_section_flags (abfd, sec, flags); + bfd_set_section_flags (sec, flags); bfd_set_reloc (stdoutput, sec, relocs, n); } @@ -1433,7 +1434,7 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) char *header; struct z_stream_s *strm; int x; - flagword flags = bfd_get_section_flags (abfd, sec); + flagword flags = bfd_section_flags (sec); unsigned int header_size, compression_header_size; if (seginfo == NULL @@ -1441,7 +1442,7 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) || (flags & (SEC_ALLOC | SEC_HAS_CONTENTS)) == SEC_ALLOC) return; - section_name = bfd_get_section_name (stdoutput, sec); + section_name = bfd_section_name (sec); if (strncmp (section_name, ".debug_", 7) != 0) return; @@ -1565,12 +1566,12 @@ compress_debug (bfd *abfd, asection *sec, void *xxx ATTRIBUTE_UNUSED) /* Update the section size and its name. */ bfd_update_compression_header (abfd, (bfd_byte *) header, sec); - x = bfd_set_section_size (abfd, sec, compressed_size); + x = bfd_set_section_size (sec, compressed_size); gas_assert (x); if (!compression_header_size) { compressed_name = concat (".z", section_name + 1, (char *) NULL); - bfd_section_name (stdoutput, sec) = compressed_name; + bfd_rename_section (sec, compressed_name); } } @@ -1599,7 +1600,7 @@ write_contents (bfd *abfd ATTRIBUTE_UNUSED, /* Write out the frags. */ if (seginfo == NULL - || !(bfd_get_section_flags (abfd, sec) & SEC_HAS_CONTENTS)) + || !(bfd_section_flags (sec) & SEC_HAS_CONTENTS)) return; for (f = seginfo->frchainP->frch_root; @@ -1815,7 +1816,7 @@ subsegs_finish_section (asection *s) do_not_pad_sections_to_alignment = 1; alignment = SUB_SEGMENT_ALIGN (now_seg, frchainP); - if ((bfd_get_section_flags (now_seg->owner, now_seg) & SEC_MERGE) + if ((bfd_section_flags (now_seg) & SEC_MERGE) && now_seg->entsize) { unsigned int entsize = now_seg->entsize; @@ -1875,7 +1876,7 @@ create_obj_attrs_section (void) s = subseg_new (name, 0); elf_section_type (s) = get_elf_backend_data (stdoutput)->obj_attrs_section_type; - bfd_set_section_flags (stdoutput, s, SEC_READONLY | SEC_DATA); + bfd_set_section_flags (s, SEC_READONLY | SEC_DATA); frag_now_fix (); p = frag_more (size); bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size); @@ -1959,9 +1960,8 @@ maybe_generate_build_notes (void) /* Create a GNU Build Attribute section. */ sec = subseg_new (GNU_BUILD_ATTRS_SECTION_NAME, FALSE); elf_section_type (sec) = SHT_NOTE; - bfd_set_section_flags (stdoutput, sec, - SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA); - bfd_set_section_alignment (stdoutput, sec, 2); + bfd_set_section_flags (sec, SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA); + bfd_set_section_alignment (sec, 2); /* Work out the size of the notes that we will create, and the relocation we should use. */ @@ -2041,7 +2041,7 @@ maybe_generate_build_notes (void) /* ...and another one to install the end address. */ create_note_reloc (sec, sym, total_size, desc2_offset, desc_reloc, - bfd_get_section_size (bsym->section), + bfd_section_size (bsym->section), note); total_size += note_size; |