This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: _bfd_elf_init_private_section_data setting output section type improperly for .stabstr
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Thu, 1 Jun 2006 13:31:39 +0930
- Subject: Re: _bfd_elf_init_private_section_data setting output section type improperly for .stabstr
- References: <8b10c78c0605102132p5d7c9403x176fcc760aade19a@mail.google.com> <20060511121541.GJ24458@bubble.grove.modra.org> <20060511171053.GA22035@lucon.org> <20060511190220.GA22858@lucon.org>
On Thu, May 11, 2006 at 12:02:20PM -0700, H. J. Lu wrote:
> bfd_make_section_anyway is used to create a new fake input .stabstr
> section. The SEC_LINKER_CREATED bit should be passed to
> _bfd_elf_new_section_hook so that the proper ELF fields will be
> set. This patch calls bfd_make_section_anyway_with_flags so that
> the ELF fields of the new fake input .stabstr section will be set
> properly.
I've installed this along with numerous other places that can use
bfd_make_section_with_flags or bfd_make_section_anyway_with_flags.
* 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.
Index: bfd/aix386-core.c
===================================================================
RCS file: /cvs/src/src/bfd/aix386-core.c,v
retrieving revision 1.15
diff -u -p -r1.15 aix386-core.c
--- bfd/aix386-core.c 23 Dec 2005 10:19:40 -0000 1.15
+++ bfd/aix386-core.c 31 May 2006 09:17:30 -0000
@@ -2,7 +2,7 @@
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>.
@@ -80,6 +80,7 @@ aix386_core_file_p (abfd)
struct trad_core_struct coredata;
struct corehdr internal_core;
} *mergem;
+ flagword flags;
amt = sizeof (longbuf);
if (bfd_bread ((PTR) longbuf, amt, abfd) != amt)
@@ -117,11 +118,12 @@ aix386_core_file_p (abfd)
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;
@@ -129,12 +131,13 @@ aix386_core_file_p (abfd)
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 =
@@ -175,11 +178,12 @@ aix386_core_file_p (abfd)
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;
Index: bfd/aix5ppc-core.c
===================================================================
RCS file: /cvs/src/src/bfd/aix5ppc-core.c,v
retrieving revision 1.14
diff -u -p -r1.14 aix5ppc-core.c
--- bfd/aix5ppc-core.c 24 Dec 2005 08:37:38 -0000 1.14
+++ bfd/aix5ppc-core.c 31 May 2006 09:17:30 -0000
@@ -1,5 +1,5 @@
/* 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.
@@ -56,6 +56,7 @@ xcoff64_core_p (bfd *abfd)
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)
@@ -117,21 +118,21 @@ xcoff64_core_p (bfd *abfd)
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;
@@ -141,11 +142,11 @@ xcoff64_core_p (bfd *abfd)
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;
@@ -155,11 +156,11 @@ xcoff64_core_p (bfd *abfd)
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;
@@ -178,11 +179,11 @@ xcoff64_core_p (bfd *abfd)
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;
@@ -206,11 +207,11 @@ xcoff64_core_p (bfd *abfd)
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;
Index: bfd/aout-adobe.c
===================================================================
RCS file: /cvs/src/src/bfd/aout-adobe.c,v
retrieving revision 1.24
diff -u -p -r1.24 aout-adobe.c
--- bfd/aout-adobe.c 4 May 2005 15:52:59 -0000 1.24
+++ bfd/aout-adobe.c 31 May 2006 09:17:30 -0000
@@ -1,6 +1,6 @@
/* 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.
@@ -132,7 +132,7 @@ aout_adobe_callback (bfd *abfd)
/* 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)
@@ -141,7 +141,7 @@ aout_adobe_callback (bfd *abfd)
/* 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. */
@@ -155,8 +155,6 @@ aout_adobe_callback (bfd *abfd)
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
Index: bfd/aoutf1.h
===================================================================
RCS file: /cvs/src/src/bfd/aoutf1.h,v
retrieving revision 1.17
diff -u -p -r1.17 aoutf1.h
--- bfd/aoutf1.h 4 May 2006 21:25:52 -0000 1.17
+++ bfd/aoutf1.h 31 May 2006 09:17:31 -0000
@@ -1,6 +1,6 @@
/* 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.
@@ -566,6 +566,7 @@ sunos4_core_file_p (bfd *abfd)
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))
@@ -627,28 +628,31 @@ sunos4_core_file_p (bfd *abfd)
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;
Index: bfd/binary.c
===================================================================
RCS file: /cvs/src/src/bfd/binary.c,v
retrieving revision 1.28
diff -u -p -r1.28 binary.c
--- bfd/binary.c 23 May 2005 17:44:52 -0000 1.28
+++ bfd/binary.c 31 May 2006 09:17:32 -0000
@@ -1,6 +1,6 @@
/* 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.
@@ -63,6 +63,7 @@ binary_object_p (bfd *abfd)
{
struct stat statbuf;
asection *sec;
+ flagword flags;
if (abfd->target_defaulted)
{
@@ -80,10 +81,10 @@ binary_object_p (bfd *abfd)
}
/* 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;
Index: bfd/cisco-core.c
===================================================================
RCS file: /cvs/src/src/bfd/cisco-core.c,v
retrieving revision 1.12
diff -u -p -r1.12 cisco-core.c
--- bfd/cisco-core.c 23 Dec 2005 10:19:40 -0000 1.12
+++ bfd/cisco-core.c 31 May 2006 09:17:32 -0000
@@ -1,5 +1,5 @@
/* 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.
@@ -95,6 +95,7 @@ cisco_core_file_validate (abfd, crash_in
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;
@@ -241,10 +242,10 @@ cisco_core_file_validate (abfd, crash_in
/* 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;
@@ -253,10 +254,10 @@ cisco_core_file_validate (abfd, crash_in
/* 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);
@@ -264,10 +265,9 @@ cisco_core_file_validate (abfd, crash_in
/* 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,
Index: bfd/coff-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-arm.c,v
retrieving revision 1.64
diff -u -p -r1.64 coff-arm.c
--- bfd/coff-arm.c 11 May 2006 08:48:58 -0000 1.64
+++ bfd/coff-arm.c 31 May 2006 09:17:33 -0000
@@ -1940,12 +1940,11 @@ bfd_arm_get_bfd_for_interworking (bfd *
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;
}
@@ -1954,12 +1953,12 @@ bfd_arm_get_bfd_for_interworking (bfd *
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;
}
Index: bfd/coff-h8300.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-h8300.c,v
retrieving revision 1.38
diff -u -p -r1.38 coff-h8300.c
--- bfd/coff-h8300.c 16 Mar 2006 12:20:15 -0000 1.38
+++ bfd/coff-h8300.c 31 May 2006 09:17:33 -0000
@@ -1276,12 +1276,12 @@ h8300_bfd_link_add_symbols (bfd *abfd, s
/* 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. */
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.340
diff -u -p -r1.340 elf.c
--- bfd/elf.c 27 May 2006 00:47:45 -0000 1.340
+++ bfd/elf.c 31 May 2006 09:17:39 -0000
@@ -7313,13 +7309,12 @@ elfcore_maybe_make_sect (bfd *abfd, char
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;
}
@@ -7351,12 +7346,12 @@ _bfd_elfcore_make_pseudosection (bfd *ab
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);
@@ -7635,7 +7630,7 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_I
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;
@@ -7650,7 +7645,6 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_I
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))
@@ -7665,7 +7659,7 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_I
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;
@@ -7680,7 +7674,6 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_I
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);
@@ -7721,7 +7714,7 @@ elfcore_grok_win32pstatus (bfd *abfd, El
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;
@@ -7729,7 +7722,6 @@ elfcore_grok_win32pstatus (bfd *abfd, El
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)
@@ -7749,14 +7741,13 @@ elfcore_grok_win32pstatus (bfd *abfd, El
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;
@@ -7826,13 +7817,13 @@ elfcore_grok_note (bfd *abfd, Elf_Intern
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;
@@ -7979,13 +7970,12 @@ elfcore_grok_nto_status (bfd *abfd, Elf_
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));
@@ -8009,13 +7999,12 @@ elfcore_grok_nto_regs (bfd *abfd,
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. */
Index: bfd/elf32-bfin.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-bfin.c,v
retrieving revision 1.12
diff -u -p -r1.12 elf32-bfin.c
--- bfd/elf32-bfin.c 23 May 2006 05:45:22 -0000 1.12
+++ bfd/elf32-bfin.c 31 May 2006 09:17:42 -0000
@@ -1984,15 +1984,12 @@ bfin_check_relocs (bfd * abfd,
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;
}
@@ -3380,9 +3377,8 @@ elf32_bfinfdpic_create_dynamic_sections
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. */
@@ -3409,9 +3405,8 @@ elf32_bfinfdpic_create_dynamic_sections
}
/* 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. */
@@ -3435,9 +3430,9 @@ elf32_bfinfdpic_create_dynamic_sections
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
@@ -3453,11 +3448,11 @@ elf32_bfinfdpic_create_dynamic_sections
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;
}
Index: bfd/elf32-m32c.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32c.c,v
retrieving revision 1.7
diff -u -p -r1.7 elf32-m32c.c
--- bfd/elf32-m32c.c 2 May 2006 01:41:20 -0000 1.7
+++ bfd/elf32-m32c.c 31 May 2006 09:17:43 -0000
@@ -691,16 +691,11 @@ m32c_elf_check_relocs
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;
}
Index: bfd/hppabsd-core.c
===================================================================
RCS file: /cvs/src/src/bfd/hppabsd-core.c,v
retrieving revision 1.18
diff -u -p -r1.18 hppabsd-core.c
--- bfd/hppabsd-core.c 23 Dec 2005 10:19:40 -0000 1.18
+++ bfd/hppabsd-core.c 31 May 2006 09:17:43 -0000
@@ -1,6 +1,6 @@
/* 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.
@@ -90,11 +90,10 @@ make_bfd_asection (abfd, name, flags, si
{
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;
Index: bfd/hpux-core.c
===================================================================
RCS file: /cvs/src/src/bfd/hpux-core.c,v
retrieving revision 1.19
diff -u -p -r1.19 hpux-core.c
--- bfd/hpux-core.c 23 Dec 2005 10:19:40 -0000 1.19
+++ bfd/hpux-core.c 31 May 2006 09:17:43 -0000
@@ -1,5 +1,5 @@
/* 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
@@ -124,11 +124,10 @@ make_bfd_asection (bfd *abfd, const char
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);
Index: bfd/i386linux.c
===================================================================
RCS file: /cvs/src/src/bfd/i386linux.c,v
retrieving revision 1.16
diff -u -p -r1.16 i386linux.c
--- bfd/i386linux.c 16 Mar 2006 12:20:16 -0000 1.16
+++ bfd/i386linux.c 31 May 2006 09:17:44 -0000
@@ -312,9 +312,8 @@ linux_link_create_dynamic_sections (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;
Index: bfd/ieee.c
===================================================================
RCS file: /cvs/src/src/bfd/ieee.c,v
retrieving revision 1.54
diff -u -p -r1.54 ieee.c
--- bfd/ieee.c 3 May 2006 14:26:40 -0000 1.54
+++ bfd/ieee.c 31 May 2006 09:17:45 -0000
@@ -1080,7 +1080,6 @@ get_section_entry (bfd *abfd, ieee_data_
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;
}
@@ -1268,14 +1267,15 @@ ieee_slurp_debug (bfd *abfd)
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);
Index: bfd/ihex.c
===================================================================
RCS file: /cvs/src/src/bfd/ihex.c,v
retrieving revision 1.31
diff -u -p -r1.31 ihex.c
--- bfd/ihex.c 4 May 2006 05:05:25 -0000 1.31
+++ bfd/ihex.c 31 May 2006 09:17:46 -0000
@@ -1,6 +1,6 @@
/* 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.
@@ -355,6 +355,7 @@ ihex_scan (bfd *abfd)
char secbuf[20];
char *secname;
bfd_size_type amt;
+ flagword flags;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
amt = strlen (secbuf) + 1;
@@ -362,10 +363,10 @@ ihex_scan (bfd *abfd)
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;
Index: bfd/irix-core.c
===================================================================
RCS file: /cvs/src/src/bfd/irix-core.c,v
retrieving revision 1.18
diff -u -p -r1.18 irix-core.c
--- bfd/irix-core.c 23 Dec 2005 10:19:40 -0000 1.18
+++ bfd/irix-core.c 31 May 2006 09:17:46 -0000
@@ -1,5 +1,5 @@
/* 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
@@ -152,11 +152,10 @@ make_bfd_asection (bfd *abfd,
{
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;
Index: bfd/lynx-core.c
===================================================================
RCS file: /cvs/src/src/bfd/lynx-core.c,v
retrieving revision 1.10
diff -u -p -r1.10 lynx-core.c
--- bfd/lynx-core.c 23 Dec 2005 10:19:40 -0000 1.10
+++ bfd/lynx-core.c 31 May 2006 09:17:46 -0000
@@ -1,5 +1,5 @@
/* 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.
@@ -73,11 +73,10 @@ make_bfd_asection (abfd, name, flags, si
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;
Index: bfd/m68klinux.c
===================================================================
RCS file: /cvs/src/src/bfd/m68klinux.c,v
retrieving revision 1.18
diff -u -p -r1.18 m68klinux.c
--- bfd/m68klinux.c 16 Mar 2006 12:20:16 -0000 1.18
+++ bfd/m68klinux.c 31 May 2006 09:17:46 -0000
@@ -316,9 +316,8 @@ linux_link_create_dynamic_sections (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;
Index: bfd/mach-o.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o.c,v
retrieving revision 1.20
diff -u -p -r1.20 mach-o.c
--- bfd/mach-o.c 23 Dec 2005 10:19:40 -0000 1.20
+++ bfd/mach-o.c 31 May 2006 09:17:47 -0000
@@ -1,5 +1,5 @@
/* 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.
@@ -634,6 +634,7 @@ bfd_mach_o_make_bfd_section (bfd *abfd,
char *sname;
const char *prefix = "LC_SEGMENT";
unsigned int snamelen;
+ flagword flags;
snamelen = strlen (prefix) + 1
+ strlen (section->segname) + 1
@@ -644,7 +645,10 @@ bfd_mach_o_make_bfd_section (bfd *abfd,
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;
@@ -654,11 +658,6 @@ bfd_mach_o_make_bfd_section (bfd *abfd,
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;
}
@@ -966,7 +965,7 @@ bfd_mach_o_scan_read_dylinker (bfd *abfd
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;
@@ -975,7 +974,6 @@ bfd_mach_o_scan_read_dylinker (bfd *abfd
bfdsec->size = command->len - 8;
bfdsec->filepos = command->offset + 8;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec;
@@ -1022,7 +1020,7 @@ bfd_mach_o_scan_read_dylib (bfd *abfd, b
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;
@@ -1031,7 +1029,6 @@ bfd_mach_o_scan_read_dylib (bfd *abfd, b
bfdsec->size = command->len - 8;
bfdsec->filepos = command->offset + 8;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec;
@@ -1142,14 +1139,13 @@ bfd_mach_o_scan_read_thread (bfd *abfd,
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;
}
@@ -1218,7 +1214,7 @@ bfd_mach_o_scan_read_symtab (bfd *abfd,
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;
@@ -1227,7 +1223,6 @@ bfd_mach_o_scan_read_symtab (bfd *abfd,
bfdsec->size = seg->nsyms * 12;
bfdsec->filepos = seg->symoff;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
seg->stabs_segment = bfdsec;
@@ -1237,7 +1232,7 @@ bfd_mach_o_scan_read_symtab (bfd *abfd,
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;
@@ -1246,7 +1241,6 @@ bfd_mach_o_scan_read_symtab (bfd *abfd,
bfdsec->size = seg->strsize;
bfdsec->filepos = seg->stroff;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
seg->stabstr_segment = bfdsec;
@@ -1263,6 +1257,7 @@ bfd_mach_o_scan_read_segment (bfd *abfd,
char *sname;
const char *prefix = "LC_SEGMENT";
unsigned int snamelen;
+ flagword flags;
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT);
@@ -1286,7 +1281,8 @@ bfd_mach_o_scan_read_segment (bfd *abfd,
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;
@@ -1295,7 +1291,6 @@ bfd_mach_o_scan_read_segment (bfd *abfd,
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;
Index: bfd/netbsd-core.c
===================================================================
RCS file: /cvs/src/src/bfd/netbsd-core.c,v
retrieving revision 1.24
diff -u -p -r1.24 netbsd-core.c
--- bfd/netbsd-core.c 23 Dec 2005 10:19:40 -0000 1.24
+++ bfd/netbsd-core.c 31 May 2006 09:17:47 -0000
@@ -1,6 +1,6 @@
/* 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
@@ -126,11 +126,10 @@ netbsd_core_file_p (bfd *abfd)
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;
@@ -159,11 +158,12 @@ netbsd_core_file_p (bfd *abfd)
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;
Index: bfd/nlmcode.h
===================================================================
RCS file: /cvs/src/src/bfd/nlmcode.h,v
retrieving revision 1.17
diff -u -p -r1.17 nlmcode.h
--- bfd/nlmcode.h 4 May 2005 15:53:36 -0000 1.17
+++ bfd/nlmcode.h 31 May 2006 09:17:49 -0000
@@ -1,6 +1,6 @@
/* 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.
@@ -138,14 +138,13 @@ add_bfd_section (bfd *abfd,
{
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;
Index: bfd/opncls.c
===================================================================
RCS file: /cvs/src/src/bfd/opncls.c,v
retrieving revision 1.43
diff -u -p -r1.43 opncls.c
--- bfd/opncls.c 25 Apr 2006 17:46:15 -0000 1.43
+++ bfd/opncls.c 31 May 2006 09:17:49 -0000
@@ -1345,6 +1345,7 @@ bfd_create_gnu_debuglink_section (bfd *a
{
asection *sect;
bfd_size_type debuglink_size;
+ flagword flags;
if (abfd == NULL || filename == NULL)
{
@@ -1363,16 +1364,11 @@ bfd_create_gnu_debuglink_section (bfd *a
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;
Index: bfd/osf-core.c
===================================================================
RCS file: /cvs/src/src/bfd/osf-core.c,v
retrieving revision 1.16
diff -u -p -r1.16 osf-core.c
--- bfd/osf-core.c 23 Dec 2005 10:19:40 -0000 1.16
+++ bfd/osf-core.c 31 May 2006 09:17:50 -0000
@@ -1,5 +1,5 @@
/* 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.
@@ -67,11 +67,10 @@ make_bfd_asection (abfd, name, flags, si
{
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;
Index: bfd/peXXigen.c
===================================================================
RCS file: /cvs/src/src/bfd/peXXigen.c,v
retrieving revision 1.34
diff -u -p -r1.34 peXXigen.c
--- bfd/peXXigen.c 9 Jan 2006 15:58:42 -0000 1.34
+++ bfd/peXXigen.c 31 May 2006 09:17:51 -0000
@@ -147,6 +147,7 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void *
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)
@@ -156,7 +157,8 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void *
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;
@@ -169,7 +171,6 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void *
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;
Index: bfd/ppcboot.c
===================================================================
RCS file: /cvs/src/src/bfd/ppcboot.c,v
retrieving revision 1.24
diff -u -p -r1.24 ppcboot.c
--- bfd/ppcboot.c 23 May 2005 17:44:55 -0000 1.24
+++ bfd/ppcboot.c 31 May 2006 09:17:51 -0000
@@ -1,5 +1,5 @@
/* 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>
@@ -151,6 +151,7 @@ ppcboot_object_p (abfd)
ppcboot_hdr_t hdr;
size_t i;
ppcboot_data_t *tdata;
+ flagword flags;
BFD_ASSERT (sizeof (ppcboot_hdr_t) == 1024);
@@ -205,10 +206,10 @@ ppcboot_object_p (abfd)
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);
Index: bfd/ptrace-core.c
===================================================================
RCS file: /cvs/src/src/bfd/ptrace-core.c,v
retrieving revision 1.14
diff -u -p -r1.14 ptrace-core.c
--- bfd/ptrace-core.c 23 Dec 2005 10:19:40 -0000 1.14
+++ bfd/ptrace-core.c 31 May 2006 09:17:51 -0000
@@ -1,5 +1,5 @@
/* 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.
@@ -63,6 +63,7 @@ ptrace_unix_core_file_p (abfd)
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
@@ -89,13 +90,17 @@ ptrace_unix_core_file_p (abfd)
/* 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;
@@ -103,10 +108,6 @@ ptrace_unix_core_file_p (abfd)
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);
Index: bfd/rs6000-core.c
===================================================================
RCS file: /cvs/src/src/bfd/rs6000-core.c,v
retrieving revision 1.17
diff -u -p -r1.17 rs6000-core.c
--- bfd/rs6000-core.c 28 Oct 2005 16:24:34 -0000 1.17
+++ bfd/rs6000-core.c 31 May 2006 09:17:51 -0000
@@ -1,6 +1,6 @@
/* 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
@@ -294,11 +294,10 @@ make_bfd_asection (bfd *abfd, const char
{
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;
Index: bfd/sco5-core.c
===================================================================
RCS file: /cvs/src/src/bfd/sco5-core.c,v
retrieving revision 1.19
diff -u -p -r1.19 sco5-core.c
--- bfd/sco5-core.c 23 Dec 2005 10:19:40 -0000 1.19
+++ bfd/sco5-core.c 31 May 2006 09:17:52 -0000
@@ -1,5 +1,5 @@
/* 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>
@@ -63,10 +63,9 @@ make_bfd_asection (abfd, name, flags, si
{
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;
Index: bfd/sparclinux.c
===================================================================
RCS file: /cvs/src/src/bfd/sparclinux.c,v
retrieving revision 1.18
diff -u -p -r1.18 sparclinux.c
--- bfd/sparclinux.c 16 Mar 2006 12:20:16 -0000 1.18
+++ bfd/sparclinux.c 31 May 2006 09:17:52 -0000
@@ -313,9 +313,8 @@ linux_link_create_dynamic_sections (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;
Index: bfd/srec.c
===================================================================
RCS file: /cvs/src/src/bfd/srec.c,v
retrieving revision 1.37
diff -u -p -r1.37 srec.c
--- bfd/srec.c 23 May 2005 17:44:55 -0000 1.37
+++ bfd/srec.c 31 May 2006 09:17:53 -0000
@@ -1,6 +1,6 @@
/* 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>.
@@ -526,15 +526,16 @@ srec_scan (bfd *abfd)
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;
Index: bfd/stabs.c
===================================================================
RCS file: /cvs/src/src/bfd/stabs.c,v
retrieving revision 1.26
diff -u -p -r1.26 stabs.c
--- bfd/stabs.c 16 Mar 2006 12:20:16 -0000 1.26
+++ bfd/stabs.c 31 May 2006 09:17:53 -0000
@@ -187,6 +187,8 @@ _bfd_link_section_stabs (bfd *abfd,
if (sinfo->stabstr == NULL)
{
+ flagword flags;
+
/* Initialize the stabs information we need to keep track of. */
first = TRUE;
sinfo->strings = _bfd_stringtab_init ();
@@ -198,11 +200,12 @@ _bfd_link_section_stabs (bfd *abfd,
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
Index: bfd/sunos.c
===================================================================
RCS file: /cvs/src/src/bfd/sunos.c,v
retrieving revision 1.22
diff -u -p -r1.22 sunos.c
--- bfd/sunos.c 16 Mar 2006 12:20:16 -0000 1.22
+++ bfd/sunos.c 31 May 2006 09:17:55 -0000
@@ -745,57 +745,50 @@ sunos_create_dynamic_sections (bfd *abfd
/* 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;
@@ -890,14 +883,10 @@ sunos_add_dynamic_symbols (bfd *abfd,
/* 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;
}
@@ -907,14 +896,10 @@ sunos_add_dynamic_symbols (bfd *abfd,
/* 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;
}
Index: bfd/trad-core.c
===================================================================
RCS file: /cvs/src/src/bfd/trad-core.c,v
retrieving revision 1.23
diff -u -p -r1.23 trad-core.c
--- bfd/trad-core.c 23 Dec 2005 10:19:40 -0000 1.23
+++ bfd/trad-core.c 1 Jun 2006 03:12:16 -0000
@@ -1,6 +1,6 @@
/* 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.
@@ -79,6 +79,7 @@ trad_unix_core_file_p (abfd)
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. */
@@ -155,20 +156,20 @@ trad_unix_core_file_p (abfd)
/* 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
Index: bfd/xcofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/xcofflink.c,v
retrieving revision 1.44
diff -u -p -r1.44 xcofflink.c
--- bfd/xcofflink.c 16 Mar 2006 12:20:16 -0000 1.44
+++ bfd/xcofflink.c 31 May 2006 09:17:58 -0000
@@ -794,27 +794,27 @@ xcoff_link_create_extra_sections (bfd *
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;
}
@@ -822,14 +822,14 @@ xcoff_link_create_extra_sections (bfd *
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;
}
@@ -837,14 +837,14 @@ xcoff_link_create_extra_sections (bfd *
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;
}
@@ -853,13 +853,13 @@ xcoff_link_create_extra_sections (bfd *
&& 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;
}
}
@@ -1552,16 +1552,17 @@ xcoff_link_add_symbols (bfd *abfd, struc
{
/* 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. */
@@ -5460,8 +5465,8 @@ _bfd_xcoff_bfd_final_link (bfd *abfd, st
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);
Index: bfd/xsym.c
===================================================================
RCS file: /cvs/src/src/bfd/xsym.c,v
retrieving revision 1.16
diff -u -p -r1.16 xsym.c
--- bfd/xsym.c 23 May 2005 17:44:55 -0000 1.16
+++ bfd/xsym.c 31 May 2006 09:17:59 -0000
@@ -1,5 +1,5 @@
/* 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.
@@ -2228,7 +2228,7 @@ bfd_sym_scan (bfd *abfd, bfd_sym_version
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;
@@ -2238,8 +2238,6 @@ bfd_sym_scan (bfd *abfd, bfd_sym_version
bfdsec->filepos = 0;
bfdsec->alignment_power = 0;
- bfdsec->flags = SEC_HAS_CONTENTS;
-
abfd->tdata.sym_data = mdata;
return 0;
--
Alan Modra
IBM OzLabs - Linux Technology Centre