instead of bfd_make_section*.
* aix386-core.c: Likewise.
* aix5ppc-core.c: Likewise.
* aout-adobe.c: Likewise.
* aoutf1.h: Likewise.
* binary.c: Likewise.
* cisco-core.c: Likewise.
* coff-arm.c: Likewise.
* coff-h8300.c: Likewise.
* elf.c: Likewise.
* elf32-bfin.c: Likewise.
* elf32-m32c.c: Likewise.
* hppabsd-core.c: Likewise.
* hpux-core.c: Likewise.
* i386linux.c: Likewise.
* ieee.c: Likewise.
* ihex.c: Likewise.
* irix-core.c: Likewise.
* lynx-core.c: Likewise.
* m68klinux.c: Likewise.
* mach-o.c: Likewise.
* netbsd-core.c: Likewise.
* nlmcode.h: Likewise.
* opncls.c: Likewise.
* osf-core.c: Likewise.
* peXXigen.c: Likewise.
* ppcboot.c: Likewise.
* ptrace-core.c: Likewise.
* rs6000-core.c: Likewise.
* sco5-core.c: Likewise.
* sparclinux.c: Likewise.
* srec.c: Likewise.
* sunos.c: Likewise.
* trad-core.c: Likewise.
* xcofflink.c: Likewise.
* xsym.c: Likewise.
+2006-06-01 Alan Modra <amodra@bigpond.net.au>
+
+ * stabs.c (_bfd_link_section_stabs): Use bfd_make_section*_with_flags
+ instead of bfd_make_section*.
+ * aix386-core.c: Likewise.
+ * aix5ppc-core.c: Likewise.
+ * aout-adobe.c: Likewise.
+ * aoutf1.h: Likewise.
+ * binary.c: Likewise.
+ * cisco-core.c: Likewise.
+ * coff-arm.c: Likewise.
+ * coff-h8300.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-bfin.c: Likewise.
+ * elf32-m32c.c: Likewise.
+ * hppabsd-core.c: Likewise.
+ * hpux-core.c: Likewise.
+ * i386linux.c: Likewise.
+ * ieee.c: Likewise.
+ * ihex.c: Likewise.
+ * irix-core.c: Likewise.
+ * lynx-core.c: Likewise.
+ * m68klinux.c: Likewise.
+ * mach-o.c: Likewise.
+ * netbsd-core.c: Likewise.
+ * nlmcode.h: Likewise.
+ * opncls.c: Likewise.
+ * osf-core.c: Likewise.
+ * peXXigen.c: Likewise.
+ * ppcboot.c: Likewise.
+ * ptrace-core.c: Likewise.
+ * rs6000-core.c: Likewise.
+ * sco5-core.c: Likewise.
+ * sparclinux.c: Likewise.
+ * srec.c: Likewise.
+ * sunos.c: Likewise.
+ * trad-core.c: Likewise.
+ * xcofflink.c: Likewise.
+ * xsym.c: Likewise.
+
2006-05-31 Daniel Jacobowitz <dan@codesourcery.com>
* Makefile.am (INCLUDES): Use @INCINTL@.
This was based on trad-core.c, which was written by John Gilmore of
Cygnus Support.
Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2000,
- 2001, 2002, 2004
+ 2001, 2002, 2004, 2006
Free Software Foundation, Inc.
Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>.
Converted to back end form by Ian Lance Taylor <ian@cygnus.com>.
struct trad_core_struct coredata;
struct corehdr internal_core;
} *mergem;
+ flagword flags;
amt = sizeof (longbuf);
if (bfd_bread ((PTR) longbuf, amt, abfd) != amt)
core_hdr (abfd) = core;
/* Create the sections. */
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
+ flags = SEC_HAS_CONTENTS;
+ core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
+ flags);
if (core_regsec (abfd) == NULL)
goto loser;
- core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
core_regsec (abfd)->size = sizeof (core->cd_regs);
core_regsec (abfd)->vma = (bfd_vma) -1;
core_regsec (abfd)->filepos =
(file_ptr) offsetof (struct corehdr, cd_regs[0]);
- core_reg2sec (abfd) = bfd_make_section_anyway (abfd, ".reg2");
+ flags = SEC_HAS_CONTENTS;
+ core_reg2sec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg2",
+ flags);
if (core_reg2sec (abfd) == NULL)
/* bfd_release frees everything allocated after it's arg. */
goto loser;
- core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
core_reg2sec (abfd)->size = sizeof (core->cd_fpregs);
core_reg2sec (abfd)->vma = (bfd_vma) -1;
core_reg2sec (abfd)->filepos =
flags = SEC_ALLOC + SEC_HAS_CONTENTS;
break;
}
- core_section (abfd, n) = bfd_make_section_anyway (abfd, sname);
+ core_section (abfd, n) = bfd_make_section_anyway_with_flags (abfd,
+ sname,
+ flags);
if (core_section (abfd, n) == NULL)
goto loser;
- core_section (abfd, n)->flags = flags;
core_section (abfd, n)->size = core->cd_segs[i].cs_len;
core_section (abfd, n)->vma = core->cd_segs[i].cs_address;
core_section (abfd, n)->filepos = core->cd_segs[i].cs_offset;
/* IBM RS/6000 "XCOFF" back-end for BFD.
- Copyright 2001, 2002, 2003, 2004, 2005
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by Tom Rix
Contributed by Red Hat Inc.
bfd_size_type i;
struct vm_infox vminfo;
const bfd_target *return_value = NULL;
+ flagword flags;
/* Get the header. */
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
abfd->tdata.any = new_core_hdr;
/* .stack section. */
- sec = bfd_make_section_anyway (abfd, ".stack");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".stack", flags);
if (NULL == sec)
return return_value;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec->size = core.c_size;
sec->vma = core.c_stackorg;
sec->filepos = core.c_stack;
/* .reg section for all registers. */
- sec = bfd_make_section_anyway (abfd, ".reg");
+ flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".reg", flags);
if (NULL == sec)
return return_value;
- sec->flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
sec->size = sizeof (struct __context64);
sec->vma = 0;
sec->filepos = 0;
To actually find out how long this section is in this particular
core dump would require going down the whole list of struct
ld_info's. See if we can just fake it. */
- sec = bfd_make_section_anyway (abfd, ".ldinfo");
+ flags = SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".ldinfo", flags);
if (NULL == sec)
return return_value;
- sec->flags = SEC_HAS_CONTENTS;
sec->size = core.c_lsize;
sec->vma = 0;
sec->filepos = core.c_loader;
regions. */
/* .data section from executable. */
- sec = bfd_make_section_anyway (abfd, ".data");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
if (NULL == sec)
return return_value;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec->size = core.c_datasize;
sec->vma = core.c_dataorg;
sec->filepos = core.c_data;
if (ldinfo.ldinfo_core)
{
- sec = bfd_make_section_anyway (abfd, ".data");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
if (NULL == sec)
return return_value;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec->size = ldinfo.ldinfo_datasize;
sec->vma = ldinfo.ldinfo_dataorg;
sec->filepos = ldinfo.ldinfo_core;
if (vminfo.vminfo_offset)
{
- sec = bfd_make_section_anyway (abfd, ".vmdata");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_anyway_with_flags (abfd, ".vmdata", flags);
if (NULL == sec)
return return_value;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec->size = vminfo.vminfo_size;
sec->vma = vminfo.vminfo_addr;
sec->filepos = vminfo.vminfo_offset;
/* BFD back-end for a.out.adobe binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005
+ 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by Cygnus Support. Based on bout.c.
/* First one is called ".text" or whatever; subsequent ones are
".text1", ".text2", ... */
bfd_set_error (bfd_error_no_error);
- sect = bfd_make_section (abfd, section_name);
+ sect = bfd_make_section_with_flags (abfd, section_name, flags);
trynum = 0;
while (!sect)
/* Some other error -- slide into the sunset. */
return NULL;
sprintf (try_again, "%s%d", section_name, ++trynum);
- sect = bfd_make_section (abfd, try_again);
+ sect = bfd_make_section_with_flags (abfd, try_again, flags);
}
/* Fix the name, if it is a sprintf'd name. */
sect->name = newname;
}
- /* Now set the section's attributes. */
- bfd_set_section_flags (abfd, sect, flags);
/* Assumed big-endian. */
sect->size = ((ext->e_size[0] << 8)
| ext->e_size[1] << 8
/* A.out "format 1" file handling code for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002, 2003, 2004, 2005
+ 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by Cygnus Support.
struct internal_sunos_core internal_sunos_core;
char external_core[1];
} *mergem;
+ flagword flags;
if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
!= sizeof (longbuf))
abfd->tdata.sun_core_data->hdr = core;
/* Create the sections. */
- core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack");
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ core_stacksec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack",
+ flags);
if (core_stacksec (abfd) == NULL)
/* bfd_release frees everything allocated after it's arg. */
goto loser;
- core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data",
+ flags);
if (core_datasec (abfd) == NULL)
goto loser;
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
+ flags = SEC_HAS_CONTENTS;
+ core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
+ flags);
if (core_regsec (abfd) == NULL)
goto loser;
- core_reg2sec (abfd) = bfd_make_section_anyway (abfd, ".reg2");
+ flags = SEC_HAS_CONTENTS;
+ core_reg2sec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg2",
+ flags);
if (core_reg2sec (abfd) == NULL)
goto loser;
- core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
- core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
-
core_stacksec (abfd)->size = core->c_ssize;
core_datasec (abfd)->size = core->c_dsize;
core_regsec (abfd)->size = core->c_regs_size;
/* BFD back-end for binary objects.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005 Free Software Foundation, Inc.
+ 2004, 2005, 2006 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
This file is part of BFD, the Binary File Descriptor library.
{
struct stat statbuf;
asection *sec;
+ flagword flags;
if (abfd->target_defaulted)
{
}
/* One data section. */
- sec = bfd_make_section (abfd, ".data");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_with_flags (abfd, ".data", flags);
if (sec == NULL)
return NULL;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
sec->vma = 0;
sec->size = statbuf.st_size;
sec->filepos = 0;
/* BFD back-end for CISCO crash dumps.
- Copyright 1994, 1997, 1999, 2000, 2001, 2002, 2004
+ Copyright 1994, 1997, 1999, 2000, 2001, 2002, 2004, 2006
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
sec_ptr asect;
struct stat statbuf;
bfd_size_type amt;
+ flagword flags;
if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0)
return NULL;
/* Create a ".data" section that maps the entire file, which is
essentially a dump of the target system's RAM. */
- asect = bfd_make_section_anyway (abfd, ".data");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
+ asect = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
if (asect == NULL)
goto error_return;
- asect->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
/* The size of memory is the size of the core file itself. */
asect->size = statbuf.st_size;
asect->vma = rambase;
/* Create a ".crash" section to allow access to the saved
crash information. */
- asect = bfd_make_section_anyway (abfd, ".crash");
+ flags = SEC_HAS_CONTENTS;
+ asect = bfd_make_section_anyway_with_flags (abfd, ".crash", flags);
if (asect == NULL)
goto error_return;
- asect->flags = SEC_HAS_CONTENTS;
asect->vma = 0;
asect->filepos = crashinfo_offset;
asect->size = sizeof (crashinfo);
/* Create a ".reg" section to allow access to the saved
registers. */
- asect = bfd_make_section_anyway (abfd, ".reg");
+ asect = bfd_make_section_anyway_with_flags (abfd, ".reg", flags);
if (asect == NULL)
goto error_return;
- asect->flags = SEC_HAS_CONTENTS;
asect->vma = 0;
asect->filepos = bfd_get_32 (abfd, crashinfo.registers) - rambase;
/* Since we don't know the exact size of the saved register info,
if (sec == NULL)
{
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
-
- sec = bfd_make_section (abfd, ARM2THUMB_GLUE_SECTION_NAME);
-
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_CODE | SEC_READONLY);
+ sec = bfd_make_section_with_flags (abfd, ARM2THUMB_GLUE_SECTION_NAME,
+ flags);
if (sec == NULL
- || ! bfd_set_section_flags (abfd, sec, flags)
|| ! bfd_set_section_alignment (abfd, sec, 2))
return FALSE;
}
if (sec == NULL)
{
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY;
-
- sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME);
+ flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
+ | SEC_CODE | SEC_READONLY);
+ sec = bfd_make_section_with_flags (abfd, THUMB2ARM_GLUE_SECTION_NAME,
+ flags);
if (sec == NULL
- || ! bfd_set_section_flags (abfd, sec, flags)
|| ! bfd_set_section_alignment (abfd, sec, 2))
return FALSE;
}
/* Make sure the appropriate flags are set, including SEC_IN_MEMORY. */
flags = (SEC_ALLOC | SEC_LOAD
| SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_READONLY);
- htab->vectors_sec = bfd_make_section (abfd, ".vectors");
+ htab->vectors_sec = bfd_make_section_with_flags (abfd, ".vectors",
+ flags);
/* If the section wasn't created, or we couldn't set the flags,
quit quickly now, rather than dying a painful death later. */
- if (!htab->vectors_sec
- || !bfd_set_section_flags (abfd, htab->vectors_sec, flags))
+ if (!htab->vectors_sec)
return FALSE;
/* Also create the vector hash table. */
if (bfd_get_section_by_name (abfd, name) != NULL)
return TRUE;
- sect2 = bfd_make_section (abfd, name);
+ sect2 = bfd_make_section_with_flags (abfd, name, sect->flags);
if (sect2 == NULL)
return FALSE;
sect2->size = sect->size;
sect2->filepos = sect->filepos;
- sect2->flags = sect->flags;
sect2->alignment_power = sect->alignment_power;
return TRUE;
}
return FALSE;
memcpy (threaded_name, buf, len);
- sect = bfd_make_section_anyway (abfd, threaded_name);
+ sect = bfd_make_section_anyway_with_flags (abfd, threaded_name,
+ SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->size = size;
sect->filepos = filepos;
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
return elfcore_maybe_make_sect (abfd, name, sect);
return FALSE;
memcpy (name, buf, len);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_reg);
#endif
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
if (!elfcore_maybe_make_sect (abfd, ".reg", sect))
return FALSE;
memcpy (name, buf, len);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_fpreg);
#endif
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
return elfcore_maybe_make_sect (abfd, ".reg2", sect);
memcpy (name, buf, len);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->filepos = (note->descpos
+ offsetof (struct win32_pstatus,
data.thread_info.thread_context));
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
if (pstatus.data.thread_info.is_active_thread)
memcpy (name, buf, len);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->size = note->descsz;
sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
break;
case NT_AUXV:
{
- asection *sect = bfd_make_section_anyway (abfd, ".auxv");
+ asection *sect = bfd_make_section_anyway_with_flags (abfd, ".auxv",
+ SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->size = note->descsz;
sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
return TRUE;
return FALSE;
strcpy (name, buf);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->size = note->descsz;
sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
return (elfcore_maybe_make_sect (abfd, ".qnx_core_status", sect));
return FALSE;
strcpy (name, buf);
- sect = bfd_make_section_anyway (abfd, name);
+ sect = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (sect == NULL)
return FALSE;
sect->size = note->descsz;
sect->filepos = note->descpos;
- sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2;
/* This is the current thread. */
srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
if (srelgot == NULL)
{
- srelgot = bfd_make_section (dynobj, ".rela.got");
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED
+ | SEC_READONLY);
+ srelgot = bfd_make_section_with_flags (dynobj, ".rela.got",
+ flags);
if (srelgot == NULL
- || !bfd_set_section_flags (dynobj, srelgot,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY))
|| !bfd_set_section_alignment (dynobj, srelgot, 2))
return FALSE;
}
if (bed->plt_readonly)
pltflags |= SEC_READONLY;
- s = bfd_make_section (abfd, ".plt");
+ s = bfd_make_section_with_flags (abfd, ".plt", pltflags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, pltflags)
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
return FALSE;
/* Blackfin-specific: remember it. */
}
/* Blackfin-specific: we want rel relocations for the plt. */
- s = bfd_make_section (abfd, ".rel.plt");
+ s = bfd_make_section_with_flags (abfd, ".rel.plt", flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
/* Blackfin-specific: remember it. */
image and use a R_*_COPY reloc to tell the dynamic linker to
initialize them at run time. The linker script puts the .dynbss
section into the .bss section of the final image. */
- s = bfd_make_section (abfd, ".dynbss");
- if (s == NULL
- || ! bfd_set_section_flags (abfd, s, SEC_ALLOC | SEC_LINKER_CREATED))
+ s = bfd_make_section_with_flags (abfd, ".dynbss",
+ SEC_ALLOC | SEC_LINKER_CREATED);
+ if (s == NULL)
return FALSE;
/* The .rel[a].bss section holds copy relocs. This section is not
copy relocs. */
if (! info->shared)
{
- s = bfd_make_section (abfd,
- (bed->default_use_rela_p
- ? ".rela.bss" : ".rel.bss"));
+ s = bfd_make_section_with_flags (abfd,
+ (bed->default_use_rela_p
+ ? ".rela.bss" : ".rel.bss"),
+ flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE;
}
splt = bfd_get_section_by_name (dynobj, ".plt");
if (splt == NULL)
{
- splt = bfd_make_section (dynobj, ".plt");
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_LINKER_CREATED
+ | SEC_READONLY | SEC_CODE);
+ splt = bfd_make_section_with_flags (dynobj, ".plt", flags);
if (splt == NULL
- || ! bfd_set_section_flags (dynobj, splt,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY
- | SEC_CODE))
|| ! bfd_set_section_alignment (dynobj, splt, 1))
return FALSE;
}
/* BFD back-end for HPPA BSD core files.
- Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
+ 2006 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
{
asection *asect;
- asect = bfd_make_section (abfd, name);
+ asect = bfd_make_section_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->filepos = offset;
asect->alignment_power = alignment_power;
/* BFD back-end for HP/UX core files.
- Copyright 1993, 1994, 1996, 1998, 1999, 2001, 2002, 2003, 2004
+ Copyright 1993, 1994, 1996, 1998, 1999, 2001, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
Written by Stu Grossman, Cygnus Support.
Converted to back-end form by Ian Lance Taylor, Cygnus SUpport
strcpy (newname, name);
- asect = bfd_make_section_anyway (abfd, newname);
+ asect = bfd_make_section_anyway_with_flags (abfd, newname, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->vma = vma;
asect->filepos = bfd_tell (abfd);
/* We choose to use the name ".linux-dynamic" for the fixup table.
Why not? */
- s = bfd_make_section (abfd, ".linux-dynamic");
+ s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
s->size = 0;
sprintf (tmp, " fsec%4d", index);
section = bfd_make_section (abfd, tmp);
ieee->section_table[index] = section;
- section->flags = SEC_NO_FLAGS;
section->target_index = index;
ieee->section_table[index] = section;
}
ieee_data_type *ieee = IEEE_DATA (abfd);
asection *sec;
file_ptr debug_end;
+ flagword flags;
if (ieee->w.r.debug_information_part == 0)
return TRUE;
- sec = bfd_make_section (abfd, ".debug");
+ flags = SEC_DEBUGGING | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_with_flags (abfd, ".debug", flags);
if (sec == NULL)
return FALSE;
- sec->flags |= SEC_DEBUGGING | SEC_HAS_CONTENTS;
sec->filepos = ieee->w.r.debug_information_part;
debug_end = ieee_part_after (ieee, ieee->w.r.debug_information_part);
/* BFD back-end for Intel Hex objects.
- Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
+ 2006 Free Software Foundation, Inc.
Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library.
char secbuf[20];
char *secname;
bfd_size_type amt;
+ flagword flags;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
amt = strlen (secbuf) + 1;
if (secname == NULL)
goto error_return;
strcpy (secname, secbuf);
- sec = bfd_make_section (abfd, secname);
+ flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
+ sec = bfd_make_section_with_flags (abfd, secname, flags);
if (sec == NULL)
goto error_return;
- sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
sec->vma = extbase + segbase + addr;
sec->lma = extbase + segbase + addr;
sec->size = len;
/* BFD back-end for Irix core files.
- Copyright 1993, 1994, 1996, 1999, 2001, 2002, 2004
+ Copyright 1993, 1994, 1996, 1999, 2001, 2002, 2004, 2006
Free Software Foundation, Inc.
Written by Stu Grossman, Cygnus Support.
Converted to back-end form by Ian Lance Taylor, Cygnus Support
{
asection *asect;
- asect = bfd_make_section_anyway (abfd, name);
+ asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
/* BFD back end for Lynx core files
- Copyright 1993, 1994, 1995, 2001, 2002, 2004
+ Copyright 1993, 1994, 1995, 2001, 2002, 2004, 2006
Free Software Foundation, Inc.
Written by Stu Grossman of Cygnus Support.
strcpy (newname, name);
- asect = bfd_make_section (abfd, newname);
+ asect = bfd_make_section_with_flags (abfd, newname, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
/* We choose to use the name ".linux-dynamic" for the fixup table.
Why not? */
- s = bfd_make_section (abfd, ".linux-dynamic");
+ s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
s->size = 0;
/* Mach-O support for BFD.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
char *sname;
const char *prefix = "LC_SEGMENT";
unsigned int snamelen;
+ flagword flags;
snamelen = strlen (prefix) + 1
+ strlen (section->segname) + 1
return NULL;
sprintf (sname, "%s.%s.%s", prefix, section->segname, section->sectname);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ flags = SEC_ALLOC;
+ if (!(section->flags & BFD_MACH_O_S_ZEROFILL))
+ flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, flags);
if (bfdsec == NULL)
return NULL;
bfdsec->filepos = section->offset;
bfdsec->alignment_power = section->align;
- if (section->flags & BFD_MACH_O_S_ZEROFILL)
- bfdsec->flags = SEC_ALLOC;
- else
- bfdsec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
-
return bfdsec;
}
return -1;
strcpy (sname, prefix);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
bfdsec->size = command->len - 8;
bfdsec->filepos = command->offset + 8;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec;
return -1;
strcpy (sname, prefix);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
bfdsec->size = command->len - 8;
bfdsec->filepos = command->offset + 8;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec;
j++;
}
- bfdsec = bfd_make_section (abfd, sname);
+ bfdsec = bfd_make_section_with_flags (abfd, sname, SEC_HAS_CONTENTS);
bfdsec->vma = 0;
bfdsec->lma = 0;
bfdsec->size = cmd->flavours[i].size;
bfdsec->filepos = cmd->flavours[i].offset;
bfdsec->alignment_power = 0x0;
- bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec;
}
return -1;
strcpy (sname, prefix);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
bfdsec->size = seg->nsyms * 12;
bfdsec->filepos = seg->symoff;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
seg->stabs_segment = bfdsec;
return -1;
strcpy (sname, prefix);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
bfdsec->size = seg->strsize;
bfdsec->filepos = seg->stroff;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
seg->stabstr_segment = bfdsec;
char *sname;
const char *prefix = "LC_SEGMENT";
unsigned int snamelen;
+ flagword flags;
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT);
return -1;
sprintf (sname, "%s.%s", prefix, seg->segname);
- bfdsec = bfd_make_section_anyway (abfd, sname);
+ flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, sname, flags);
if (bfdsec == NULL)
return -1;
bfdsec->size = seg->filesize;
bfdsec->filepos = seg->fileoff;
bfdsec->alignment_power = 0x0;
- bfdsec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
seg->segment = bfdsec;
/* BFD back end for NetBSD style core files
Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005
+ 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by Paul Kranenburg, EUR
flags = SEC_ALLOC + SEC_HAS_CONTENTS;
break;
}
- asect = bfd_make_section_anyway (abfd, sname);
+ asect = bfd_make_section_anyway_with_flags (abfd, sname, flags);
if (asect == NULL)
goto punt;
- asect->flags = flags;
asect->size = coreseg.c_size;
asect->vma = coreseg.c_addr;
asect->filepos = offset;
asect->size = wcookie_offset;
/* And create the .wcookie section. */
- asect = bfd_make_section_anyway (abfd, ".wcookie");
+ flags = SEC_ALLOC + SEC_HAS_CONTENTS;
+ asect = bfd_make_section_anyway_with_flags (abfd, ".wcookie",
+ flags);
if (asect == NULL)
goto punt;
- asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
asect->size = coreseg.c_size - wcookie_offset;
asect->vma = 0;
asect->filepos = offset + wcookie_offset;
/* NLM (NetWare Loadable Module) executable support for BFD.
Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005 Free Software Foundation, Inc.
+ 2005, 2006 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, using ELF support as the
template.
{
asection *newsect;
- newsect = bfd_make_section (abfd, name);
+ newsect = bfd_make_section_with_flags (abfd, name, flags);
if (newsect == NULL)
return FALSE;
newsect->vma = 0; /* NLM's are relocatable. */
newsect->size = size;
newsect->filepos = offset;
- newsect->flags = flags;
newsect->alignment_power = bfd_log2 ((bfd_vma) 0); /* FIXME */
return TRUE;
{
asection *sect;
bfd_size_type debuglink_size;
+ flagword flags;
if (abfd == NULL || filename == NULL)
{
return NULL;
}
- sect = bfd_make_section (abfd, GNU_DEBUGLINK);
+ flags = SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING;
+ sect = bfd_make_section_with_flags (abfd, GNU_DEBUGLINK, flags);
if (sect == NULL)
return NULL;
- if (! bfd_set_section_flags (abfd, sect,
- SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING))
- /* XXX Should we delete the section from the bfd ? */
- return NULL;
-
-
debuglink_size = strlen (filename) + 1;
debuglink_size += 3;
debuglink_size &= ~3;
/* BFD back-end for OSF/1 core files.
- Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004
+ Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
{
asection *asect;
- asect = bfd_make_section_anyway (abfd, name);
+ asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
int unused_section_number = 0;
asection *sec;
char *name;
+ flagword flags;
for (sec = abfd->sections; sec; sec = sec->next)
if (unused_section_number <= sec->target_index)
if (name == NULL)
return;
strcpy (name, in->n_name);
- sec = bfd_make_section_anyway (abfd, name);
+ flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
+ sec = bfd_make_section_anyway_with_flags (abfd, name, flags);
sec->vma = 0;
sec->lma = 0;
sec->userdata = NULL;
sec->next = NULL;
sec->alignment_power = 2;
- sec->flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
sec->target_index = unused_section_number;
/* BFD back-end for PPCbug boot records.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com>
ppcboot_hdr_t hdr;
size_t i;
ppcboot_data_t *tdata;
+ flagword flags;
BFD_ASSERT (sizeof (ppcboot_hdr_t) == 1024);
abfd->symcount = PPCBOOT_SYMS;
/* One data section. */
- sec = bfd_make_section (abfd, ".data");
+ flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_CODE | SEC_HAS_CONTENTS;
+ sec = bfd_make_section_with_flags (abfd, ".data", flags);
if (sec == NULL)
return NULL;
- sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_CODE | SEC_HAS_CONTENTS;
sec->vma = 0;
sec->size = statbuf.st_size - sizeof (ppcboot_hdr_t);
sec->filepos = sizeof (ppcboot_hdr_t);
/* BFD backend for core files which use the ptrace_user structure
- Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004
+ Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
The structure of this file is based on trad-core.c written by John Gilmore
of Cygnus Support.
struct ptrace_user u;
struct trad_core_struct *rawptr;
bfd_size_type amt;
+ flagword flags;
val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd);
if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC
/* Create the sections. */
- core_stacksec (abfd) = bfd_make_section_anyway (abfd, ".stack");
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ core_stacksec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack",
+ flags);
if (core_stacksec (abfd) == NULL)
goto fail;
- core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
+ core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data",
+ flags);
if (core_datasec (abfd) == NULL)
goto fail;
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
+ core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
+ SEC_HAS_CONTENTS);
if (core_regsec (abfd) == NULL)
goto fail;
text. I don't think that any of these things are supported on the
system on which I am developing this for though. */
- core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
-
core_datasec (abfd)->size = u.pt_dsize;
core_stacksec (abfd)->size = u.pt_ssize;
core_regsec (abfd)->size = sizeof (u);
/* IBM RS/6000 "XCOFF" back-end for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
- 2001, 2002, 2004
+ 2001, 2002, 2004, 2006
Free Software Foundation, Inc.
FIXME: Can someone provide a transliteration of this name into ASCII?
Using the following chars caused a compiler warning on HIUX (so I replaced
{
asection *asect;
- asect = bfd_make_section_anyway (abfd, name);
+ asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
/* BFD back end for SCO5 core files (U-area and raw sections)
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by Jouke Numan <jnuman@hiscom.nl>
{
asection *asect;
- asect = bfd_make_section_anyway (abfd, name);
+ asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect)
return NULL;
- asect->flags = flags;
asect->size = size;
asect->vma = vma;
asect->filepos = filepos;
/* We choose to use the name ".linux-dynamic" for the fixup table.
Why not? */
- s = bfd_make_section (abfd, ".linux-dynamic");
+ s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
s->size = 0;
/* BFD back-end for s-record objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
char secbuf[20];
char *secname;
bfd_size_type amt;
+ flagword flags;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
amt = strlen (secbuf) + 1;
secname = bfd_alloc (abfd, amt);
strcpy (secname, secbuf);
- sec = bfd_make_section (abfd, secname);
+ flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
+ sec = bfd_make_section_with_flags (abfd, secname, flags);
if (sec == NULL)
goto error_return;
- sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
sec->vma = address;
sec->lma = address;
sec->size = bytes;
if (sinfo->stabstr == NULL)
{
+ flagword flags;
+
/* Initialize the stabs information we need to keep track of. */
first = TRUE;
sinfo->strings = _bfd_stringtab_init ();
stab_link_includes_newfunc,
sizeof (struct stab_link_includes_entry)))
goto error_return;
- sinfo->stabstr = bfd_make_section_anyway (abfd, ".stabstr");
+ flags = (SEC_HAS_CONTENTS | SEC_READONLY | SEC_DEBUGGING
+ | SEC_LINKER_CREATED);
+ sinfo->stabstr = bfd_make_section_anyway_with_flags (abfd, ".stabstr",
+ flags);
if (sinfo->stabstr == NULL)
goto error_return;
- sinfo->stabstr->flags |= (SEC_HAS_CONTENTS | SEC_READONLY
- | SEC_DEBUGGING | SEC_LINKER_CREATED);
}
/* Initialize the information we are going to store for this .stab
/* The .dynamic section holds the basic dynamic information: the
sun4_dynamic structure, the dynamic debugger information, and
the sun4_dynamic_link structure. */
- s = bfd_make_section (abfd, ".dynamic");
+ s = bfd_make_section_with_flags (abfd, ".dynamic", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .got section holds the global offset table. The address
is put in the ld_got field. */
- s = bfd_make_section (abfd, ".got");
+ s = bfd_make_section_with_flags (abfd, ".got", flags);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .plt section holds the procedure linkage table. The
address is put in the ld_plt field. */
- s = bfd_make_section (abfd, ".plt");
+ s = bfd_make_section_with_flags (abfd, ".plt", flags | SEC_CODE);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_CODE)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .dynrel section holds the dynamic relocs. The address is
put in the ld_rel field. */
- s = bfd_make_section (abfd, ".dynrel");
+ s = bfd_make_section_with_flags (abfd, ".dynrel", flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .hash section holds the dynamic hash table. The address
is put in the ld_hash field. */
- s = bfd_make_section (abfd, ".hash");
+ s = bfd_make_section_with_flags (abfd, ".hash", flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .dynsym section holds the dynamic symbols. The address
is put in the ld_stab field. */
- s = bfd_make_section (abfd, ".dynsym");
+ s = bfd_make_section_with_flags (abfd, ".dynsym", flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .dynstr section holds the dynamic symbol string table.
The address is put in the ld_symbols field. */
- s = bfd_make_section (abfd, ".dynstr");
+ s = bfd_make_section_with_flags (abfd, ".dynstr", flags | SEC_READONLY);
if (s == NULL
- || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2))
return FALSE;
/* The .need section holds the list of names of shared objets
which must be included at runtime. The address of this
section is put in the ld_need field. */
- asection *s = bfd_make_section (dynobj, ".need");
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_READONLY);
+ asection *s = bfd_make_section_with_flags (dynobj, ".need", flags);
if (s == NULL
- || ! bfd_set_section_flags (dynobj, s,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_READONLY))
|| ! bfd_set_section_alignment (dynobj, s, 2))
return FALSE;
}
/* The .rules section holds the path to search for shared
objects. The address of this section is put in the ld_rules
field. */
- asection *s = bfd_make_section (dynobj, ".rules");
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY | SEC_READONLY);
+ asection *s = bfd_make_section_with_flags (dynobj, ".rules", flags);
if (s == NULL
- || ! bfd_set_section_flags (dynobj, s,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_READONLY))
|| ! bfd_set_section_alignment (dynobj, s, 2))
return FALSE;
}
/* BFD back end for traditional Unix core files (U-area and raw sections)
Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by John Gilmore of Cygnus Support.
struct user u;
struct trad_core_struct *rawptr;
bfd_size_type amt;
+ flagword flags;
#ifdef TRAD_CORE_USER_OFFSET
/* If defined, this macro is the file position of the user struct. */
/* Create the sections. */
- core_stacksec(abfd) = bfd_make_section_anyway (abfd, ".stack");
+ flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
+ core_stacksec(abfd) = bfd_make_section_anyway_with_flags (abfd, ".stack",
+ flags);
if (core_stacksec (abfd) == NULL)
goto fail;
- core_datasec (abfd) = bfd_make_section_anyway (abfd, ".data");
+ core_datasec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".data",
+ flags);
if (core_datasec (abfd) == NULL)
goto fail;
- core_regsec (abfd) = bfd_make_section_anyway (abfd, ".reg");
+ core_regsec (abfd) = bfd_make_section_anyway_with_flags (abfd, ".reg",
+ SEC_HAS_CONTENTS);
if (core_regsec (abfd) == NULL)
goto fail;
- core_stacksec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_datasec (abfd)->flags = SEC_ALLOC + SEC_LOAD + SEC_HAS_CONTENTS;
- core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
-
core_datasec (abfd)->size = NBPG * u.u_dsize
#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
- NBPG * u.u_tsize
if (xcoff_hash_table (info)->loader_section == NULL)
{
asection *lsec;
+ flagword flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
- lsec = bfd_make_section_anyway (abfd, ".loader");
+ lsec = bfd_make_section_anyway_with_flags (abfd, ".loader", flags);
if (lsec == NULL)
goto end_return;
xcoff_hash_table (info)->loader_section = lsec;
- lsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY;
}
/* Likewise for the linkage section. */
if (xcoff_hash_table (info)->linkage_section == NULL)
{
asection *lsec;
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY);
- lsec = bfd_make_section_anyway (abfd, ".gl");
+ lsec = bfd_make_section_anyway_with_flags (abfd, ".gl", flags);
if (lsec == NULL)
goto end_return;
xcoff_hash_table (info)->linkage_section = lsec;
- lsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY);
lsec->alignment_power = 2;
}
if (xcoff_hash_table (info)->toc_section == NULL)
{
asection *tsec;
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY);
- tsec = bfd_make_section_anyway (abfd, ".tc");
+ tsec = bfd_make_section_anyway_with_flags (abfd, ".tc", flags);
if (tsec == NULL)
goto end_return;
xcoff_hash_table (info)->toc_section = tsec;
- tsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY);
tsec->alignment_power = 2;
}
if (xcoff_hash_table (info)->descriptor_section == NULL)
{
asection *dsec;
+ flagword flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY);
- dsec = bfd_make_section_anyway (abfd, ".ds");
+ dsec = bfd_make_section_anyway_with_flags (abfd, ".ds", flags);
if (dsec == NULL)
goto end_return;
xcoff_hash_table (info)->descriptor_section = dsec;
- dsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY);
dsec->alignment_power = 2;
}
&& info->strip != strip_all)
{
asection *dsec;
+ flagword flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
- dsec = bfd_make_section_anyway (abfd, ".debug");
+ dsec = bfd_make_section_anyway_with_flags (abfd, ".debug", flags);
if (dsec == NULL)
goto end_return;
xcoff_hash_table (info)->debug_section = dsec;
- dsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY;
}
}
{
/* The linker script puts the .td section in the data
section after the .tc section. */
- csect = bfd_make_section_anyway (abfd, ".td");
+ csect = bfd_make_section_anyway_with_flags (abfd, ".td",
+ SEC_ALLOC);
}
else
- csect = bfd_make_section_anyway (abfd, ".bss");
+ csect = bfd_make_section_anyway_with_flags (abfd, ".bss",
+ SEC_ALLOC);
if (csect == NULL)
goto error_return;
csect->vma = sym.n_value;
csect->size = aux.x_csect.x_scnlen.l;
- csect->flags |= SEC_ALLOC;
csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp);
/* There are a number of other fields and section flags
which we do not bother to set. */
that needs padding. This requires unlinking and
relinking the bfd's section list. */
- n = bfd_make_section_anyway (abfd, ".pad");
- n->flags = SEC_HAS_CONTENTS;
+ n = bfd_make_section_anyway_with_flags (abfd, ".pad",
+ SEC_HAS_CONTENTS);
n->alignment_power = 0;
bfd_section_list_remove (abfd, n);
/* xSYM symbol-file support for BFD.
- Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
if (mdata->name_table == NULL)
return -1;
- bfdsec = bfd_make_section_anyway (abfd, name);
+ bfdsec = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (bfdsec == NULL)
return -1;
bfdsec->filepos = 0;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
-
abfd->tdata.sym_data = mdata;
return 0;