* 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.
This commit is contained in:
Alan Modra 2006-06-01 03:45:58 +00:00
parent 13d6194fb9
commit 117ed4f8d5
37 changed files with 252 additions and 249 deletions

View file

@ -1,3 +1,43 @@
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> 2006-05-31 Daniel Jacobowitz <dan@codesourcery.com>
* Makefile.am (INCLUDES): Use @INCINTL@. * Makefile.am (INCLUDES): Use @INCINTL@.

View file

@ -2,7 +2,7 @@
This was based on trad-core.c, which was written by John Gilmore of This was based on trad-core.c, which was written by John Gilmore of
Cygnus Support. Cygnus Support.
Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2000, Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2000,
2001, 2002, 2004 2001, 2002, 2004, 2006
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>. Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>.
Converted to back end form by Ian Lance Taylor <ian@cygnus.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 trad_core_struct coredata;
struct corehdr internal_core; struct corehdr internal_core;
} *mergem; } *mergem;
flagword flags;
amt = sizeof (longbuf); amt = sizeof (longbuf);
if (bfd_bread ((PTR) longbuf, amt, abfd) != amt) if (bfd_bread ((PTR) longbuf, amt, abfd) != amt)
@ -117,11 +118,12 @@ aix386_core_file_p (abfd)
core_hdr (abfd) = core; core_hdr (abfd) = core;
/* Create the sections. */ /* 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) if (core_regsec (abfd) == NULL)
goto loser; goto loser;
core_regsec (abfd)->flags = SEC_HAS_CONTENTS;
core_regsec (abfd)->size = sizeof (core->cd_regs); core_regsec (abfd)->size = sizeof (core->cd_regs);
core_regsec (abfd)->vma = (bfd_vma) -1; core_regsec (abfd)->vma = (bfd_vma) -1;
@ -129,12 +131,13 @@ aix386_core_file_p (abfd)
core_regsec (abfd)->filepos = core_regsec (abfd)->filepos =
(file_ptr) offsetof (struct corehdr, cd_regs[0]); (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) if (core_reg2sec (abfd) == NULL)
/* bfd_release frees everything allocated after it's arg. */ /* bfd_release frees everything allocated after it's arg. */
goto loser; goto loser;
core_reg2sec (abfd)->flags = SEC_HAS_CONTENTS;
core_reg2sec (abfd)->size = sizeof (core->cd_fpregs); core_reg2sec (abfd)->size = sizeof (core->cd_fpregs);
core_reg2sec (abfd)->vma = (bfd_vma) -1; core_reg2sec (abfd)->vma = (bfd_vma) -1;
core_reg2sec (abfd)->filepos = core_reg2sec (abfd)->filepos =
@ -175,11 +178,12 @@ aix386_core_file_p (abfd)
flags = SEC_ALLOC + SEC_HAS_CONTENTS; flags = SEC_ALLOC + SEC_HAS_CONTENTS;
break; 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) if (core_section (abfd, n) == NULL)
goto loser; goto loser;
core_section (abfd, n)->flags = flags;
core_section (abfd, n)->size = core->cd_segs[i].cs_len; 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)->vma = core->cd_segs[i].cs_address;
core_section (abfd, n)->filepos = core->cd_segs[i].cs_offset; core_section (abfd, n)->filepos = core->cd_segs[i].cs_offset;

View file

@ -1,5 +1,5 @@
/* IBM RS/6000 "XCOFF" back-end for BFD. /* 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. Free Software Foundation, Inc.
Written by Tom Rix Written by Tom Rix
Contributed by Red Hat Inc. Contributed by Red Hat Inc.
@ -56,6 +56,7 @@ xcoff64_core_p (bfd *abfd)
bfd_size_type i; bfd_size_type i;
struct vm_infox vminfo; struct vm_infox vminfo;
const bfd_target *return_value = NULL; const bfd_target *return_value = NULL;
flagword flags;
/* Get the header. */ /* Get the header. */
if (bfd_seek (abfd, 0, SEEK_SET) != 0) if (bfd_seek (abfd, 0, SEEK_SET) != 0)
@ -117,21 +118,21 @@ xcoff64_core_p (bfd *abfd)
abfd->tdata.any = new_core_hdr; abfd->tdata.any = new_core_hdr;
/* .stack section. */ /* .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) if (NULL == sec)
return return_value; return return_value;
sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec->size = core.c_size; sec->size = core.c_size;
sec->vma = core.c_stackorg; sec->vma = core.c_stackorg;
sec->filepos = core.c_stack; sec->filepos = core.c_stack;
/* .reg section for all registers. */ /* .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) if (NULL == sec)
return return_value; return return_value;
sec->flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
sec->size = sizeof (struct __context64); sec->size = sizeof (struct __context64);
sec->vma = 0; sec->vma = 0;
sec->filepos = 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 To actually find out how long this section is in this particular
core dump would require going down the whole list of struct core dump would require going down the whole list of struct
ld_info's. See if we can just fake it. */ 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) if (NULL == sec)
return return_value; return return_value;
sec->flags = SEC_HAS_CONTENTS;
sec->size = core.c_lsize; sec->size = core.c_lsize;
sec->vma = 0; sec->vma = 0;
sec->filepos = core.c_loader; sec->filepos = core.c_loader;
@ -155,11 +156,11 @@ xcoff64_core_p (bfd *abfd)
regions. */ regions. */
/* .data section from executable. */ /* .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) if (NULL == sec)
return return_value; return return_value;
sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec->size = core.c_datasize; sec->size = core.c_datasize;
sec->vma = core.c_dataorg; sec->vma = core.c_dataorg;
sec->filepos = core.c_data; sec->filepos = core.c_data;
@ -178,11 +179,11 @@ xcoff64_core_p (bfd *abfd)
if (ldinfo.ldinfo_core) 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) if (NULL == sec)
return return_value; return return_value;
sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec->size = ldinfo.ldinfo_datasize; sec->size = ldinfo.ldinfo_datasize;
sec->vma = ldinfo.ldinfo_dataorg; sec->vma = ldinfo.ldinfo_dataorg;
sec->filepos = ldinfo.ldinfo_core; sec->filepos = ldinfo.ldinfo_core;
@ -206,11 +207,11 @@ xcoff64_core_p (bfd *abfd)
if (vminfo.vminfo_offset) 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) if (NULL == sec)
return return_value; return return_value;
sec->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec->size = vminfo.vminfo_size; sec->size = vminfo.vminfo_size;
sec->vma = vminfo.vminfo_addr; sec->vma = vminfo.vminfo_addr;
sec->filepos = vminfo.vminfo_offset; sec->filepos = vminfo.vminfo_offset;

View file

@ -1,6 +1,6 @@
/* BFD back-end for a.out.adobe binaries. /* BFD back-end for a.out.adobe binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 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. Free Software Foundation, Inc.
Written by Cygnus Support. Based on bout.c. 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 /* First one is called ".text" or whatever; subsequent ones are
".text1", ".text2", ... */ ".text1", ".text2", ... */
bfd_set_error (bfd_error_no_error); 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; trynum = 0;
while (!sect) while (!sect)
@ -141,7 +141,7 @@ aout_adobe_callback (bfd *abfd)
/* Some other error -- slide into the sunset. */ /* Some other error -- slide into the sunset. */
return NULL; return NULL;
sprintf (try_again, "%s%d", section_name, ++trynum); 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. */ /* Fix the name, if it is a sprintf'd name. */
@ -155,8 +155,6 @@ aout_adobe_callback (bfd *abfd)
sect->name = newname; sect->name = newname;
} }
/* Now set the section's attributes. */
bfd_set_section_flags (abfd, sect, flags);
/* Assumed big-endian. */ /* Assumed big-endian. */
sect->size = ((ext->e_size[0] << 8) sect->size = ((ext->e_size[0] << 8)
| ext->e_size[1] << 8 | ext->e_size[1] << 8

View file

@ -1,6 +1,6 @@
/* A.out "format 1" file handling code for BFD. /* A.out "format 1" file handling code for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 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. Free Software Foundation, Inc.
Written by Cygnus Support. Written by Cygnus Support.
@ -566,6 +566,7 @@ sunos4_core_file_p (bfd *abfd)
struct internal_sunos_core internal_sunos_core; struct internal_sunos_core internal_sunos_core;
char external_core[1]; char external_core[1];
} *mergem; } *mergem;
flagword flags;
if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd) if (bfd_bread ((void *) longbuf, (bfd_size_type) sizeof (longbuf), abfd)
!= sizeof (longbuf)) != sizeof (longbuf))
@ -627,28 +628,31 @@ sunos4_core_file_p (bfd *abfd)
abfd->tdata.sun_core_data->hdr = core; abfd->tdata.sun_core_data->hdr = core;
/* Create the sections. */ /* 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) if (core_stacksec (abfd) == NULL)
/* bfd_release frees everything allocated after it's arg. */ /* bfd_release frees everything allocated after it's arg. */
goto loser; 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) if (core_datasec (abfd) == NULL)
goto loser; 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) if (core_regsec (abfd) == NULL)
goto loser; 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) if (core_reg2sec (abfd) == NULL)
goto loser; 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_stacksec (abfd)->size = core->c_ssize;
core_datasec (abfd)->size = core->c_dsize; core_datasec (abfd)->size = core->c_dsize;
core_regsec (abfd)->size = core->c_regs_size; core_regsec (abfd)->size = core->c_regs_size;

View file

@ -1,6 +1,6 @@
/* BFD back-end for binary objects. /* BFD back-end for binary objects.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 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> Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -63,6 +63,7 @@ binary_object_p (bfd *abfd)
{ {
struct stat statbuf; struct stat statbuf;
asection *sec; asection *sec;
flagword flags;
if (abfd->target_defaulted) if (abfd->target_defaulted)
{ {
@ -80,10 +81,10 @@ binary_object_p (bfd *abfd)
} }
/* One data section. */ /* 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) if (sec == NULL)
return NULL; return NULL;
sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
sec->vma = 0; sec->vma = 0;
sec->size = statbuf.st_size; sec->size = statbuf.st_size;
sec->filepos = 0; sec->filepos = 0;

View file

@ -1,5 +1,5 @@
/* BFD back-end for CISCO crash dumps. /* 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. Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -95,6 +95,7 @@ cisco_core_file_validate (abfd, crash_info_loc)
sec_ptr asect; sec_ptr asect;
struct stat statbuf; struct stat statbuf;
bfd_size_type amt; bfd_size_type amt;
flagword flags;
if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0) if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0)
return NULL; return NULL;
@ -241,10 +242,10 @@ cisco_core_file_validate (abfd, crash_info_loc)
/* Create a ".data" section that maps the entire file, which is /* Create a ".data" section that maps the entire file, which is
essentially a dump of the target system's RAM. */ 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) if (asect == NULL)
goto error_return; goto error_return;
asect->flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
/* The size of memory is the size of the core file itself. */ /* The size of memory is the size of the core file itself. */
asect->size = statbuf.st_size; asect->size = statbuf.st_size;
asect->vma = rambase; asect->vma = rambase;
@ -253,10 +254,10 @@ cisco_core_file_validate (abfd, crash_info_loc)
/* Create a ".crash" section to allow access to the saved /* Create a ".crash" section to allow access to the saved
crash information. */ 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) if (asect == NULL)
goto error_return; goto error_return;
asect->flags = SEC_HAS_CONTENTS;
asect->vma = 0; asect->vma = 0;
asect->filepos = crashinfo_offset; asect->filepos = crashinfo_offset;
asect->size = sizeof (crashinfo); asect->size = sizeof (crashinfo);
@ -264,10 +265,9 @@ cisco_core_file_validate (abfd, crash_info_loc)
/* Create a ".reg" section to allow access to the saved /* Create a ".reg" section to allow access to the saved
registers. */ registers. */
asect = bfd_make_section_anyway (abfd, ".reg"); asect = bfd_make_section_anyway_with_flags (abfd, ".reg", flags);
if (asect == NULL) if (asect == NULL)
goto error_return; goto error_return;
asect->flags = SEC_HAS_CONTENTS;
asect->vma = 0; asect->vma = 0;
asect->filepos = bfd_get_32 (abfd, crashinfo.registers) - rambase; asect->filepos = bfd_get_32 (abfd, crashinfo.registers) - rambase;
/* Since we don't know the exact size of the saved register info, /* Since we don't know the exact size of the saved register info,

View file

@ -1940,12 +1940,11 @@ bfd_arm_get_bfd_for_interworking (bfd * abfd,
if (sec == NULL) if (sec == NULL)
{ {
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY; flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
| SEC_CODE | SEC_READONLY);
sec = bfd_make_section (abfd, ARM2THUMB_GLUE_SECTION_NAME); sec = bfd_make_section_with_flags (abfd, ARM2THUMB_GLUE_SECTION_NAME,
flags);
if (sec == NULL if (sec == NULL
|| ! bfd_set_section_flags (abfd, sec, flags)
|| ! bfd_set_section_alignment (abfd, sec, 2)) || ! bfd_set_section_alignment (abfd, sec, 2))
return FALSE; return FALSE;
} }
@ -1954,12 +1953,12 @@ bfd_arm_get_bfd_for_interworking (bfd * abfd,
if (sec == NULL) if (sec == NULL)
{ {
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_CODE | SEC_READONLY; flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
| SEC_CODE | SEC_READONLY);
sec = bfd_make_section (abfd, THUMB2ARM_GLUE_SECTION_NAME); sec = bfd_make_section_with_flags (abfd, THUMB2ARM_GLUE_SECTION_NAME,
flags);
if (sec == NULL if (sec == NULL
|| ! bfd_set_section_flags (abfd, sec, flags)
|| ! bfd_set_section_alignment (abfd, sec, 2)) || ! bfd_set_section_alignment (abfd, sec, 2))
return FALSE; return FALSE;
} }

View file

@ -1276,12 +1276,12 @@ h8300_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
/* Make sure the appropriate flags are set, including SEC_IN_MEMORY. */ /* Make sure the appropriate flags are set, including SEC_IN_MEMORY. */
flags = (SEC_ALLOC | SEC_LOAD flags = (SEC_ALLOC | SEC_LOAD
| SEC_HAS_CONTENTS | SEC_IN_MEMORY | SEC_READONLY); | 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, /* If the section wasn't created, or we couldn't set the flags,
quit quickly now, rather than dying a painful death later. */ quit quickly now, rather than dying a painful death later. */
if (!htab->vectors_sec if (!htab->vectors_sec)
|| !bfd_set_section_flags (abfd, htab->vectors_sec, flags))
return FALSE; return FALSE;
/* Also create the vector hash table. */ /* Also create the vector hash table. */

View file

@ -7313,13 +7313,12 @@ elfcore_maybe_make_sect (bfd *abfd, char *name, asection *sect)
if (bfd_get_section_by_name (abfd, name) != NULL) if (bfd_get_section_by_name (abfd, name) != NULL)
return TRUE; return TRUE;
sect2 = bfd_make_section (abfd, name); sect2 = bfd_make_section_with_flags (abfd, name, sect->flags);
if (sect2 == NULL) if (sect2 == NULL)
return FALSE; return FALSE;
sect2->size = sect->size; sect2->size = sect->size;
sect2->filepos = sect->filepos; sect2->filepos = sect->filepos;
sect2->flags = sect->flags;
sect2->alignment_power = sect->alignment_power; sect2->alignment_power = sect->alignment_power;
return TRUE; return TRUE;
} }
@ -7351,12 +7350,12 @@ _bfd_elfcore_make_pseudosection (bfd *abfd,
return FALSE; return FALSE;
memcpy (threaded_name, buf, len); 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) if (sect == NULL)
return FALSE; return FALSE;
sect->size = size; sect->size = size;
sect->filepos = filepos; sect->filepos = filepos;
sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2; sect->alignment_power = 2;
return elfcore_maybe_make_sect (abfd, name, sect); return elfcore_maybe_make_sect (abfd, name, sect);
@ -7635,7 +7634,7 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
return FALSE; return FALSE;
memcpy (name, buf, len); 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) if (sect == NULL)
return FALSE; return FALSE;
@ -7650,7 +7649,6 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_reg); sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_reg);
#endif #endif
sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2; sect->alignment_power = 2;
if (!elfcore_maybe_make_sect (abfd, ".reg", sect)) if (!elfcore_maybe_make_sect (abfd, ".reg", sect))
@ -7665,7 +7663,7 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
return FALSE; return FALSE;
memcpy (name, buf, len); 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) if (sect == NULL)
return FALSE; return FALSE;
@ -7680,7 +7678,6 @@ elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note)
sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_fpreg); sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_fpreg);
#endif #endif
sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2; sect->alignment_power = 2;
return elfcore_maybe_make_sect (abfd, ".reg2", sect); return elfcore_maybe_make_sect (abfd, ".reg2", sect);
@ -7721,7 +7718,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
memcpy (name, buf, len); 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) if (sect == NULL)
return FALSE; return FALSE;
@ -7729,7 +7726,6 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
sect->filepos = (note->descpos sect->filepos = (note->descpos
+ offsetof (struct win32_pstatus, + offsetof (struct win32_pstatus,
data.thread_info.thread_context)); data.thread_info.thread_context));
sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2; sect->alignment_power = 2;
if (pstatus.data.thread_info.is_active_thread) if (pstatus.data.thread_info.is_active_thread)
@ -7749,14 +7745,13 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
memcpy (name, buf, len); 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) if (sect == NULL)
return FALSE; return FALSE;
sect->size = note->descsz; sect->size = note->descsz;
sect->filepos = note->descpos; sect->filepos = note->descpos;
sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2; sect->alignment_power = 2;
break; break;
@ -7826,13 +7821,13 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note)
case NT_AUXV: 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) if (sect == NULL)
return FALSE; return FALSE;
sect->size = note->descsz; sect->size = note->descsz;
sect->filepos = note->descpos; sect->filepos = note->descpos;
sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32; sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
return TRUE; return TRUE;
@ -7979,13 +7974,12 @@ elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid)
return FALSE; return FALSE;
strcpy (name, buf); 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) if (sect == NULL)
return FALSE; return FALSE;
sect->size = note->descsz; sect->size = note->descsz;
sect->filepos = note->descpos; sect->filepos = note->descpos;
sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2; sect->alignment_power = 2;
return (elfcore_maybe_make_sect (abfd, ".qnx_core_status", sect)); return (elfcore_maybe_make_sect (abfd, ".qnx_core_status", sect));
@ -8009,13 +8003,12 @@ elfcore_grok_nto_regs (bfd *abfd,
return FALSE; return FALSE;
strcpy (name, buf); 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) if (sect == NULL)
return FALSE; return FALSE;
sect->size = note->descsz; sect->size = note->descsz;
sect->filepos = note->descpos; sect->filepos = note->descpos;
sect->flags = SEC_HAS_CONTENTS;
sect->alignment_power = 2; sect->alignment_power = 2;
/* This is the current thread. */ /* This is the current thread. */

View file

@ -1984,15 +1984,12 @@ bfin_check_relocs (bfd * abfd,
srelgot = bfd_get_section_by_name (dynobj, ".rela.got"); srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
if (srelgot == NULL) 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 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)) || !bfd_set_section_alignment (dynobj, srelgot, 2))
return FALSE; return FALSE;
} }
@ -3380,9 +3377,8 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
if (bed->plt_readonly) if (bed->plt_readonly)
pltflags |= SEC_READONLY; pltflags |= SEC_READONLY;
s = bfd_make_section (abfd, ".plt"); s = bfd_make_section_with_flags (abfd, ".plt", pltflags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_flags (abfd, s, pltflags)
|| ! bfd_set_section_alignment (abfd, s, bed->plt_alignment)) || ! bfd_set_section_alignment (abfd, s, bed->plt_alignment))
return FALSE; return FALSE;
/* Blackfin-specific: remember it. */ /* Blackfin-specific: remember it. */
@ -3409,9 +3405,8 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
} }
/* Blackfin-specific: we want rel relocations for the plt. */ /* 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 if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE; return FALSE;
/* Blackfin-specific: remember it. */ /* Blackfin-specific: remember it. */
@ -3435,9 +3430,9 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
image and use a R_*_COPY reloc to tell the dynamic linker to image and use a R_*_COPY reloc to tell the dynamic linker to
initialize them at run time. The linker script puts the .dynbss initialize them at run time. The linker script puts the .dynbss
section into the .bss section of the final image. */ section into the .bss section of the final image. */
s = bfd_make_section (abfd, ".dynbss"); s = bfd_make_section_with_flags (abfd, ".dynbss",
if (s == NULL SEC_ALLOC | SEC_LINKER_CREATED);
|| ! bfd_set_section_flags (abfd, s, SEC_ALLOC | SEC_LINKER_CREATED)) if (s == NULL)
return FALSE; return FALSE;
/* The .rel[a].bss section holds copy relocs. This section is not /* The .rel[a].bss section holds copy relocs. This section is not
@ -3453,11 +3448,11 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
copy relocs. */ copy relocs. */
if (! info->shared) if (! info->shared)
{ {
s = bfd_make_section (abfd, s = bfd_make_section_with_flags (abfd,
(bed->default_use_rela_p (bed->default_use_rela_p
? ".rela.bss" : ".rel.bss")); ? ".rela.bss" : ".rel.bss"),
flags | SEC_READONLY);
if (s == NULL if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align)) || ! bfd_set_section_alignment (abfd, s, bed->s->log_file_align))
return FALSE; return FALSE;
} }

View file

@ -691,16 +691,11 @@ m32c_elf_check_relocs
splt = bfd_get_section_by_name (dynobj, ".plt"); splt = bfd_get_section_by_name (dynobj, ".plt");
if (splt == NULL) 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 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)) || ! bfd_set_section_alignment (dynobj, splt, 1))
return FALSE; return FALSE;
} }

View file

@ -1,6 +1,6 @@
/* BFD back-end for HPPA BSD core files. /* BFD back-end for HPPA BSD core files.
Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2005 Copyright 1993, 1994, 1995, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
Free Software Foundation, Inc. 2006 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -90,11 +90,10 @@ make_bfd_asection (abfd, name, flags, size, offset, alignment_power)
{ {
asection *asect; asection *asect;
asect = bfd_make_section (abfd, name); asect = bfd_make_section_with_flags (abfd, name, flags);
if (!asect) if (!asect)
return NULL; return NULL;
asect->flags = flags;
asect->size = size; asect->size = size;
asect->filepos = offset; asect->filepos = offset;
asect->alignment_power = alignment_power; asect->alignment_power = alignment_power;

View file

@ -1,5 +1,5 @@
/* BFD back-end for HP/UX core files. /* 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. Free Software Foundation, Inc.
Written by Stu Grossman, Cygnus Support. Written by Stu Grossman, Cygnus Support.
Converted to back-end form by Ian Lance Taylor, Cygnus SUpport Converted to back-end form by Ian Lance Taylor, Cygnus SUpport
@ -124,11 +124,10 @@ make_bfd_asection (bfd *abfd, const char *name, flagword flags,
strcpy (newname, name); strcpy (newname, name);
asect = bfd_make_section_anyway (abfd, newname); asect = bfd_make_section_anyway_with_flags (abfd, newname, flags);
if (!asect) if (!asect)
return NULL; return NULL;
asect->flags = flags;
asect->size = size; asect->size = size;
asect->vma = vma; asect->vma = vma;
asect->filepos = bfd_tell (abfd); asect->filepos = bfd_tell (abfd);

View file

@ -312,9 +312,8 @@ linux_link_create_dynamic_sections (abfd, info)
/* We choose to use the name ".linux-dynamic" for the fixup table. /* We choose to use the name ".linux-dynamic" for the fixup table.
Why not? */ Why not? */
s = bfd_make_section (abfd, ".linux-dynamic"); s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2)) || ! bfd_set_section_alignment (abfd, s, 2))
return FALSE; return FALSE;
s->size = 0; s->size = 0;

View file

@ -1080,7 +1080,6 @@ get_section_entry (bfd *abfd, ieee_data_type *ieee, unsigned int index)
sprintf (tmp, " fsec%4d", index); sprintf (tmp, " fsec%4d", index);
section = bfd_make_section (abfd, tmp); section = bfd_make_section (abfd, tmp);
ieee->section_table[index] = section; ieee->section_table[index] = section;
section->flags = SEC_NO_FLAGS;
section->target_index = index; section->target_index = index;
ieee->section_table[index] = section; ieee->section_table[index] = section;
} }
@ -1268,14 +1267,15 @@ ieee_slurp_debug (bfd *abfd)
ieee_data_type *ieee = IEEE_DATA (abfd); ieee_data_type *ieee = IEEE_DATA (abfd);
asection *sec; asection *sec;
file_ptr debug_end; file_ptr debug_end;
flagword flags;
if (ieee->w.r.debug_information_part == 0) if (ieee->w.r.debug_information_part == 0)
return TRUE; 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) if (sec == NULL)
return FALSE; return FALSE;
sec->flags |= SEC_DEBUGGING | SEC_HAS_CONTENTS;
sec->filepos = ieee->w.r.debug_information_part; sec->filepos = ieee->w.r.debug_information_part;
debug_end = ieee_part_after (ieee, ieee->w.r.debug_information_part); debug_end = ieee_part_after (ieee, ieee->w.r.debug_information_part);

View file

@ -1,6 +1,6 @@
/* BFD back-end for Intel Hex objects. /* BFD back-end for Intel Hex objects.
Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
Free Software Foundation, Inc. 2006 Free Software Foundation, Inc.
Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>. Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -355,6 +355,7 @@ ihex_scan (bfd *abfd)
char secbuf[20]; char secbuf[20];
char *secname; char *secname;
bfd_size_type amt; bfd_size_type amt;
flagword flags;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1); sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
amt = strlen (secbuf) + 1; amt = strlen (secbuf) + 1;
@ -362,10 +363,10 @@ ihex_scan (bfd *abfd)
if (secname == NULL) if (secname == NULL)
goto error_return; goto error_return;
strcpy (secname, secbuf); 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) if (sec == NULL)
goto error_return; goto error_return;
sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
sec->vma = extbase + segbase + addr; sec->vma = extbase + segbase + addr;
sec->lma = extbase + segbase + addr; sec->lma = extbase + segbase + addr;
sec->size = len; sec->size = len;

View file

@ -1,5 +1,5 @@
/* BFD back-end for Irix core files. /* 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. Free Software Foundation, Inc.
Written by Stu Grossman, Cygnus Support. Written by Stu Grossman, Cygnus Support.
Converted to back-end form by Ian Lance Taylor, Cygnus Support Converted to back-end form by Ian Lance Taylor, Cygnus Support
@ -152,11 +152,10 @@ make_bfd_asection (bfd *abfd,
{ {
asection *asect; asection *asect;
asect = bfd_make_section_anyway (abfd, name); asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect) if (!asect)
return NULL; return NULL;
asect->flags = flags;
asect->size = size; asect->size = size;
asect->vma = vma; asect->vma = vma;
asect->filepos = filepos; asect->filepos = filepos;

View file

@ -1,5 +1,5 @@
/* BFD back end for Lynx core files /* 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. Free Software Foundation, Inc.
Written by Stu Grossman of Cygnus Support. Written by Stu Grossman of Cygnus Support.
@ -73,11 +73,10 @@ make_bfd_asection (abfd, name, flags, size, vma, filepos)
strcpy (newname, name); strcpy (newname, name);
asect = bfd_make_section (abfd, newname); asect = bfd_make_section_with_flags (abfd, newname, flags);
if (!asect) if (!asect)
return NULL; return NULL;
asect->flags = flags;
asect->size = size; asect->size = size;
asect->vma = vma; asect->vma = vma;
asect->filepos = filepos; asect->filepos = filepos;

View file

@ -316,9 +316,8 @@ linux_link_create_dynamic_sections (abfd, info)
/* We choose to use the name ".linux-dynamic" for the fixup table. /* We choose to use the name ".linux-dynamic" for the fixup table.
Why not? */ Why not? */
s = bfd_make_section (abfd, ".linux-dynamic"); s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2)) || ! bfd_set_section_alignment (abfd, s, 2))
return FALSE; return FALSE;
s->size = 0; s->size = 0;

View file

@ -1,5 +1,5 @@
/* Mach-O support for BFD. /* 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. Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -634,6 +634,7 @@ bfd_mach_o_make_bfd_section (bfd *abfd, bfd_mach_o_section *section)
char *sname; char *sname;
const char *prefix = "LC_SEGMENT"; const char *prefix = "LC_SEGMENT";
unsigned int snamelen; unsigned int snamelen;
flagword flags;
snamelen = strlen (prefix) + 1 snamelen = strlen (prefix) + 1
+ strlen (section->segname) + 1 + strlen (section->segname) + 1
@ -644,7 +645,10 @@ bfd_mach_o_make_bfd_section (bfd *abfd, bfd_mach_o_section *section)
return NULL; return NULL;
sprintf (sname, "%s.%s.%s", prefix, section->segname, section->sectname); 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) if (bfdsec == NULL)
return NULL; return NULL;
@ -654,11 +658,6 @@ bfd_mach_o_make_bfd_section (bfd *abfd, bfd_mach_o_section *section)
bfdsec->filepos = section->offset; bfdsec->filepos = section->offset;
bfdsec->alignment_power = section->align; 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 bfdsec;
} }
@ -966,7 +965,7 @@ bfd_mach_o_scan_read_dylinker (bfd *abfd,
return -1; return -1;
strcpy (sname, prefix); 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) if (bfdsec == NULL)
return -1; return -1;
@ -975,7 +974,6 @@ bfd_mach_o_scan_read_dylinker (bfd *abfd,
bfdsec->size = command->len - 8; bfdsec->size = command->len - 8;
bfdsec->filepos = command->offset + 8; bfdsec->filepos = command->offset + 8;
bfdsec->alignment_power = 0; bfdsec->alignment_power = 0;
bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec; cmd->section = bfdsec;
@ -1022,7 +1020,7 @@ bfd_mach_o_scan_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
return -1; return -1;
strcpy (sname, prefix); 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) if (bfdsec == NULL)
return -1; return -1;
@ -1031,7 +1029,6 @@ bfd_mach_o_scan_read_dylib (bfd *abfd, bfd_mach_o_load_command *command)
bfdsec->size = command->len - 8; bfdsec->size = command->len - 8;
bfdsec->filepos = command->offset + 8; bfdsec->filepos = command->offset + 8;
bfdsec->alignment_power = 0; bfdsec->alignment_power = 0;
bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec; cmd->section = bfdsec;
@ -1142,14 +1139,13 @@ bfd_mach_o_scan_read_thread (bfd *abfd, bfd_mach_o_load_command *command)
j++; j++;
} }
bfdsec = bfd_make_section (abfd, sname); bfdsec = bfd_make_section_with_flags (abfd, sname, SEC_HAS_CONTENTS);
bfdsec->vma = 0; bfdsec->vma = 0;
bfdsec->lma = 0; bfdsec->lma = 0;
bfdsec->size = cmd->flavours[i].size; bfdsec->size = cmd->flavours[i].size;
bfdsec->filepos = cmd->flavours[i].offset; bfdsec->filepos = cmd->flavours[i].offset;
bfdsec->alignment_power = 0x0; bfdsec->alignment_power = 0x0;
bfdsec->flags = SEC_HAS_CONTENTS;
cmd->section = bfdsec; cmd->section = bfdsec;
} }
@ -1218,7 +1214,7 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
return -1; return -1;
strcpy (sname, prefix); 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) if (bfdsec == NULL)
return -1; return -1;
@ -1227,7 +1223,6 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
bfdsec->size = seg->nsyms * 12; bfdsec->size = seg->nsyms * 12;
bfdsec->filepos = seg->symoff; bfdsec->filepos = seg->symoff;
bfdsec->alignment_power = 0; bfdsec->alignment_power = 0;
bfdsec->flags = SEC_HAS_CONTENTS;
seg->stabs_segment = bfdsec; seg->stabs_segment = bfdsec;
@ -1237,7 +1232,7 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
return -1; return -1;
strcpy (sname, prefix); 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) if (bfdsec == NULL)
return -1; return -1;
@ -1246,7 +1241,6 @@ bfd_mach_o_scan_read_symtab (bfd *abfd, bfd_mach_o_load_command *command)
bfdsec->size = seg->strsize; bfdsec->size = seg->strsize;
bfdsec->filepos = seg->stroff; bfdsec->filepos = seg->stroff;
bfdsec->alignment_power = 0; bfdsec->alignment_power = 0;
bfdsec->flags = SEC_HAS_CONTENTS;
seg->stabstr_segment = bfdsec; seg->stabstr_segment = bfdsec;
@ -1263,6 +1257,7 @@ bfd_mach_o_scan_read_segment (bfd *abfd, bfd_mach_o_load_command *command)
char *sname; char *sname;
const char *prefix = "LC_SEGMENT"; const char *prefix = "LC_SEGMENT";
unsigned int snamelen; unsigned int snamelen;
flagword flags;
BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT); BFD_ASSERT (command->type == BFD_MACH_O_LC_SEGMENT);
@ -1286,7 +1281,8 @@ bfd_mach_o_scan_read_segment (bfd *abfd, bfd_mach_o_load_command *command)
return -1; return -1;
sprintf (sname, "%s.%s", prefix, seg->segname); 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) if (bfdsec == NULL)
return -1; return -1;
@ -1295,7 +1291,6 @@ bfd_mach_o_scan_read_segment (bfd *abfd, bfd_mach_o_load_command *command)
bfdsec->size = seg->filesize; bfdsec->size = seg->filesize;
bfdsec->filepos = seg->fileoff; bfdsec->filepos = seg->fileoff;
bfdsec->alignment_power = 0x0; bfdsec->alignment_power = 0x0;
bfdsec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_CODE;
seg->segment = bfdsec; seg->segment = bfdsec;

View file

@ -1,6 +1,6 @@
/* BFD back end for NetBSD style core files /* BFD back end for NetBSD style core files
Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001, Copyright 1988, 1989, 1991, 1992, 1993, 1996, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc. Free Software Foundation, Inc.
Written by Paul Kranenburg, EUR Written by Paul Kranenburg, EUR
@ -126,11 +126,10 @@ netbsd_core_file_p (bfd *abfd)
flags = SEC_ALLOC + SEC_HAS_CONTENTS; flags = SEC_ALLOC + SEC_HAS_CONTENTS;
break; break;
} }
asect = bfd_make_section_anyway (abfd, sname); asect = bfd_make_section_anyway_with_flags (abfd, sname, flags);
if (asect == NULL) if (asect == NULL)
goto punt; goto punt;
asect->flags = flags;
asect->size = coreseg.c_size; asect->size = coreseg.c_size;
asect->vma = coreseg.c_addr; asect->vma = coreseg.c_addr;
asect->filepos = offset; asect->filepos = offset;
@ -159,11 +158,12 @@ netbsd_core_file_p (bfd *abfd)
asect->size = wcookie_offset; asect->size = wcookie_offset;
/* And create the .wcookie section. */ /* 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) if (asect == NULL)
goto punt; goto punt;
asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
asect->size = coreseg.c_size - wcookie_offset; asect->size = coreseg.c_size - wcookie_offset;
asect->vma = 0; asect->vma = 0;
asect->filepos = offset + wcookie_offset; asect->filepos = offset + wcookie_offset;

View file

@ -1,6 +1,6 @@
/* NLM (NetWare Loadable Module) executable support for BFD. /* NLM (NetWare Loadable Module) executable support for BFD.
Copyright 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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 Written by Fred Fish @ Cygnus Support, using ELF support as the
template. template.
@ -138,14 +138,13 @@ add_bfd_section (bfd *abfd,
{ {
asection *newsect; asection *newsect;
newsect = bfd_make_section (abfd, name); newsect = bfd_make_section_with_flags (abfd, name, flags);
if (newsect == NULL) if (newsect == NULL)
return FALSE; return FALSE;
newsect->vma = 0; /* NLM's are relocatable. */ newsect->vma = 0; /* NLM's are relocatable. */
newsect->size = size; newsect->size = size;
newsect->filepos = offset; newsect->filepos = offset;
newsect->flags = flags;
newsect->alignment_power = bfd_log2 ((bfd_vma) 0); /* FIXME */ newsect->alignment_power = bfd_log2 ((bfd_vma) 0); /* FIXME */
return TRUE; return TRUE;

View file

@ -1345,6 +1345,7 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
{ {
asection *sect; asection *sect;
bfd_size_type debuglink_size; bfd_size_type debuglink_size;
flagword flags;
if (abfd == NULL || filename == NULL) if (abfd == NULL || filename == NULL)
{ {
@ -1363,16 +1364,11 @@ bfd_create_gnu_debuglink_section (bfd *abfd, const char *filename)
return 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) if (sect == NULL)
return 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 = strlen (filename) + 1;
debuglink_size += 3; debuglink_size += 3;
debuglink_size &= ~3; debuglink_size &= ~3;

View file

@ -1,5 +1,5 @@
/* BFD back-end for OSF/1 core files. /* 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. Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -67,11 +67,10 @@ make_bfd_asection (abfd, name, flags, size, vma, filepos)
{ {
asection *asect; asection *asect;
asect = bfd_make_section_anyway (abfd, name); asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect) if (!asect)
return NULL; return NULL;
asect->flags = flags;
asect->size = size; asect->size = size;
asect->vma = vma; asect->vma = vma;
asect->filepos = filepos; asect->filepos = filepos;

View file

@ -147,6 +147,7 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
int unused_section_number = 0; int unused_section_number = 0;
asection *sec; asection *sec;
char *name; char *name;
flagword flags;
for (sec = abfd->sections; sec; sec = sec->next) for (sec = abfd->sections; sec; sec = sec->next)
if (unused_section_number <= sec->target_index) if (unused_section_number <= sec->target_index)
@ -156,7 +157,8 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
if (name == NULL) if (name == NULL)
return; return;
strcpy (name, in->n_name); 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->vma = 0;
sec->lma = 0; sec->lma = 0;
@ -169,7 +171,6 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
sec->userdata = NULL; sec->userdata = NULL;
sec->next = NULL; sec->next = NULL;
sec->alignment_power = 2; sec->alignment_power = 2;
sec->flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
sec->target_index = unused_section_number; sec->target_index = unused_section_number;

View file

@ -1,5 +1,5 @@
/* BFD back-end for PPCbug boot records. /* 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. Free Software Foundation, Inc.
Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com> Written by Michael Meissner, Cygnus Support, <meissner@cygnus.com>
@ -151,6 +151,7 @@ ppcboot_object_p (abfd)
ppcboot_hdr_t hdr; ppcboot_hdr_t hdr;
size_t i; size_t i;
ppcboot_data_t *tdata; ppcboot_data_t *tdata;
flagword flags;
BFD_ASSERT (sizeof (ppcboot_hdr_t) == 1024); BFD_ASSERT (sizeof (ppcboot_hdr_t) == 1024);
@ -205,10 +206,10 @@ ppcboot_object_p (abfd)
abfd->symcount = PPCBOOT_SYMS; abfd->symcount = PPCBOOT_SYMS;
/* One data section. */ /* 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) if (sec == NULL)
return NULL; return NULL;
sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_CODE | SEC_HAS_CONTENTS;
sec->vma = 0; sec->vma = 0;
sec->size = statbuf.st_size - sizeof (ppcboot_hdr_t); sec->size = statbuf.st_size - sizeof (ppcboot_hdr_t);
sec->filepos = sizeof (ppcboot_hdr_t); sec->filepos = sizeof (ppcboot_hdr_t);

View file

@ -1,5 +1,5 @@
/* BFD backend for core files which use the ptrace_user structure /* 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. Free Software Foundation, Inc.
The structure of this file is based on trad-core.c written by John Gilmore The structure of this file is based on trad-core.c written by John Gilmore
of Cygnus Support. of Cygnus Support.
@ -63,6 +63,7 @@ ptrace_unix_core_file_p (abfd)
struct ptrace_user u; struct ptrace_user u;
struct trad_core_struct *rawptr; struct trad_core_struct *rawptr;
bfd_size_type amt; bfd_size_type amt;
flagword flags;
val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd); val = bfd_bread ((void *)&u, (bfd_size_type) sizeof u, abfd);
if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC if (val != sizeof u || u.pt_magic != _BCS_PTRACE_MAGIC
@ -89,13 +90,17 @@ ptrace_unix_core_file_p (abfd)
/* Create the sections. */ /* 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) if (core_stacksec (abfd) == NULL)
goto fail; 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) if (core_datasec (abfd) == NULL)
goto fail; 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) if (core_regsec (abfd) == NULL)
goto fail; 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 text. I don't think that any of these things are supported on the
system on which I am developing this for though. */ 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_datasec (abfd)->size = u.pt_dsize;
core_stacksec (abfd)->size = u.pt_ssize; core_stacksec (abfd)->size = u.pt_ssize;
core_regsec (abfd)->size = sizeof (u); core_regsec (abfd)->size = sizeof (u);

View file

@ -1,6 +1,6 @@
/* IBM RS/6000 "XCOFF" back-end for BFD. /* IBM RS/6000 "XCOFF" back-end for BFD.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
2001, 2002, 2004 2001, 2002, 2004, 2006
Free Software Foundation, Inc. Free Software Foundation, Inc.
FIXME: Can someone provide a transliteration of this name into ASCII? FIXME: Can someone provide a transliteration of this name into ASCII?
Using the following chars caused a compiler warning on HIUX (so I replaced Using the following chars caused a compiler warning on HIUX (so I replaced
@ -294,11 +294,10 @@ make_bfd_asection (bfd *abfd, const char *name, flagword flags,
{ {
asection *asect; asection *asect;
asect = bfd_make_section_anyway (abfd, name); asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect) if (!asect)
return NULL; return NULL;
asect->flags = flags;
asect->size = size; asect->size = size;
asect->vma = vma; asect->vma = vma;
asect->filepos = filepos; asect->filepos = filepos;

View file

@ -1,5 +1,5 @@
/* BFD back end for SCO5 core files (U-area and raw sections) /* 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. Free Software Foundation, Inc.
Written by Jouke Numan <jnuman@hiscom.nl> Written by Jouke Numan <jnuman@hiscom.nl>
@ -63,10 +63,9 @@ make_bfd_asection (abfd, name, flags, size, vma, filepos)
{ {
asection *asect; asection *asect;
asect = bfd_make_section_anyway (abfd, name); asect = bfd_make_section_anyway_with_flags (abfd, name, flags);
if (!asect) if (!asect)
return NULL; return NULL;
asect->flags = flags;
asect->size = size; asect->size = size;
asect->vma = vma; asect->vma = vma;
asect->filepos = filepos; asect->filepos = filepos;

View file

@ -313,9 +313,8 @@ linux_link_create_dynamic_sections (abfd, info)
/* We choose to use the name ".linux-dynamic" for the fixup table. /* We choose to use the name ".linux-dynamic" for the fixup table.
Why not? */ Why not? */
s = bfd_make_section (abfd, ".linux-dynamic"); s = bfd_make_section_with_flags (abfd, ".linux-dynamic", flags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2)) || ! bfd_set_section_alignment (abfd, s, 2))
return FALSE; return FALSE;
s->size = 0; s->size = 0;

View file

@ -1,6 +1,6 @@
/* BFD back-end for s-record objects. /* BFD back-end for s-record objects.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 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. Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>. Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
@ -526,15 +526,16 @@ srec_scan (bfd *abfd)
char secbuf[20]; char secbuf[20];
char *secname; char *secname;
bfd_size_type amt; bfd_size_type amt;
flagword flags;
sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1); sprintf (secbuf, ".sec%d", bfd_count_sections (abfd) + 1);
amt = strlen (secbuf) + 1; amt = strlen (secbuf) + 1;
secname = bfd_alloc (abfd, amt); secname = bfd_alloc (abfd, amt);
strcpy (secname, secbuf); 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) if (sec == NULL)
goto error_return; goto error_return;
sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
sec->vma = address; sec->vma = address;
sec->lma = address; sec->lma = address;
sec->size = bytes; sec->size = bytes;

View file

@ -187,6 +187,8 @@ _bfd_link_section_stabs (bfd *abfd,
if (sinfo->stabstr == NULL) if (sinfo->stabstr == NULL)
{ {
flagword flags;
/* Initialize the stabs information we need to keep track of. */ /* Initialize the stabs information we need to keep track of. */
first = TRUE; first = TRUE;
sinfo->strings = _bfd_stringtab_init (); sinfo->strings = _bfd_stringtab_init ();
@ -198,11 +200,12 @@ _bfd_link_section_stabs (bfd *abfd,
stab_link_includes_newfunc, stab_link_includes_newfunc,
sizeof (struct stab_link_includes_entry))) sizeof (struct stab_link_includes_entry)))
goto error_return; 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) if (sinfo->stabstr == NULL)
goto error_return; 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 /* Initialize the information we are going to store for this .stab

View file

@ -745,57 +745,50 @@ sunos_create_dynamic_sections (bfd *abfd,
/* The .dynamic section holds the basic dynamic information: the /* The .dynamic section holds the basic dynamic information: the
sun4_dynamic structure, the dynamic debugger information, and sun4_dynamic structure, the dynamic debugger information, and
the sun4_dynamic_link structure. */ the sun4_dynamic_link structure. */
s = bfd_make_section (abfd, ".dynamic"); s = bfd_make_section_with_flags (abfd, ".dynamic", flags);
if (s == NULL if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2)) || ! bfd_set_section_alignment (abfd, s, 2))
return FALSE; return FALSE;
/* The .got section holds the global offset table. The address /* The .got section holds the global offset table. The address
is put in the ld_got field. */ 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 if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags)
|| ! bfd_set_section_alignment (abfd, s, 2)) || ! bfd_set_section_alignment (abfd, s, 2))
return FALSE; return FALSE;
/* The .plt section holds the procedure linkage table. The /* The .plt section holds the procedure linkage table. The
address is put in the ld_plt field. */ 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 if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_CODE)
|| ! bfd_set_section_alignment (abfd, s, 2)) || ! bfd_set_section_alignment (abfd, s, 2))
return FALSE; return FALSE;
/* The .dynrel section holds the dynamic relocs. The address is /* The .dynrel section holds the dynamic relocs. The address is
put in the ld_rel field. */ 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 if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2)) || ! bfd_set_section_alignment (abfd, s, 2))
return FALSE; return FALSE;
/* The .hash section holds the dynamic hash table. The address /* The .hash section holds the dynamic hash table. The address
is put in the ld_hash field. */ 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 if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2)) || ! bfd_set_section_alignment (abfd, s, 2))
return FALSE; return FALSE;
/* The .dynsym section holds the dynamic symbols. The address /* The .dynsym section holds the dynamic symbols. The address
is put in the ld_stab field. */ 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 if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2)) || ! bfd_set_section_alignment (abfd, s, 2))
return FALSE; return FALSE;
/* The .dynstr section holds the dynamic symbol string table. /* The .dynstr section holds the dynamic symbol string table.
The address is put in the ld_symbols field. */ 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 if (s == NULL
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, s, 2)) || ! bfd_set_section_alignment (abfd, s, 2))
return FALSE; return FALSE;
@ -890,14 +883,10 @@ sunos_add_dynamic_symbols (bfd *abfd,
/* The .need section holds the list of names of shared objets /* The .need section holds the list of names of shared objets
which must be included at runtime. The address of this which must be included at runtime. The address of this
section is put in the ld_need field. */ 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 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)) || ! bfd_set_section_alignment (dynobj, s, 2))
return FALSE; return FALSE;
} }
@ -907,14 +896,10 @@ sunos_add_dynamic_symbols (bfd *abfd,
/* The .rules section holds the path to search for shared /* The .rules section holds the path to search for shared
objects. The address of this section is put in the ld_rules objects. The address of this section is put in the ld_rules
field. */ 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 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)) || ! bfd_set_section_alignment (dynobj, s, 2))
return FALSE; return FALSE;
} }

View file

@ -1,6 +1,6 @@
/* BFD back end for traditional Unix core files (U-area and raw sections) /* BFD back end for traditional Unix core files (U-area and raw sections)
Copyright 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 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. Free Software Foundation, Inc.
Written by John Gilmore of Cygnus Support. Written by John Gilmore of Cygnus Support.
@ -79,6 +79,7 @@ trad_unix_core_file_p (abfd)
struct user u; struct user u;
struct trad_core_struct *rawptr; struct trad_core_struct *rawptr;
bfd_size_type amt; bfd_size_type amt;
flagword flags;
#ifdef TRAD_CORE_USER_OFFSET #ifdef TRAD_CORE_USER_OFFSET
/* If defined, this macro is the file position of the user struct. */ /* 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. */ /* 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) if (core_stacksec (abfd) == NULL)
goto fail; 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) if (core_datasec (abfd) == NULL)
goto fail; 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) if (core_regsec (abfd) == NULL)
goto fail; 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 core_datasec (abfd)->size = NBPG * u.u_dsize
#ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE #ifdef TRAD_CORE_DSIZE_INCLUDES_TSIZE
- NBPG * u.u_tsize - NBPG * u.u_tsize

View file

@ -794,27 +794,27 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info)
if (xcoff_hash_table (info)->loader_section == NULL) if (xcoff_hash_table (info)->loader_section == NULL)
{ {
asection *lsec; 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) if (lsec == NULL)
goto end_return; goto end_return;
xcoff_hash_table (info)->loader_section = lsec; xcoff_hash_table (info)->loader_section = lsec;
lsec->flags |= SEC_HAS_CONTENTS | SEC_IN_MEMORY;
} }
/* Likewise for the linkage section. */ /* Likewise for the linkage section. */
if (xcoff_hash_table (info)->linkage_section == NULL) if (xcoff_hash_table (info)->linkage_section == NULL)
{ {
asection *lsec; 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) if (lsec == NULL)
goto end_return; goto end_return;
xcoff_hash_table (info)->linkage_section = lsec; xcoff_hash_table (info)->linkage_section = lsec;
lsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
| SEC_IN_MEMORY);
lsec->alignment_power = 2; lsec->alignment_power = 2;
} }
@ -822,14 +822,14 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info)
if (xcoff_hash_table (info)->toc_section == NULL) if (xcoff_hash_table (info)->toc_section == NULL)
{ {
asection *tsec; 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) if (tsec == NULL)
goto end_return; goto end_return;
xcoff_hash_table (info)->toc_section = tsec; xcoff_hash_table (info)->toc_section = tsec;
tsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
| SEC_IN_MEMORY);
tsec->alignment_power = 2; tsec->alignment_power = 2;
} }
@ -837,14 +837,14 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info)
if (xcoff_hash_table (info)->descriptor_section == NULL) if (xcoff_hash_table (info)->descriptor_section == NULL)
{ {
asection *dsec; 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) if (dsec == NULL)
goto end_return; goto end_return;
xcoff_hash_table (info)->descriptor_section = dsec; xcoff_hash_table (info)->descriptor_section = dsec;
dsec->flags |= (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
| SEC_IN_MEMORY);
dsec->alignment_power = 2; dsec->alignment_power = 2;
} }
@ -853,13 +853,13 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info)
&& info->strip != strip_all) && info->strip != strip_all)
{ {
asection *dsec; 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) if (dsec == NULL)
goto end_return; goto end_return;
xcoff_hash_table (info)->debug_section = dsec; 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, struct bfd_link_info *info)
{ {
/* The linker script puts the .td section in the data /* The linker script puts the .td section in the data
section after the .tc section. */ section after the .tc section. */
csect = bfd_make_section_anyway (abfd, ".td"); csect = bfd_make_section_anyway_with_flags (abfd, ".td",
SEC_ALLOC);
} }
else else
csect = bfd_make_section_anyway (abfd, ".bss"); csect = bfd_make_section_anyway_with_flags (abfd, ".bss",
SEC_ALLOC);
if (csect == NULL) if (csect == NULL)
goto error_return; goto error_return;
csect->vma = sym.n_value; csect->vma = sym.n_value;
csect->size = aux.x_csect.x_scnlen.l; csect->size = aux.x_csect.x_scnlen.l;
csect->flags |= SEC_ALLOC;
csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp); csect->alignment_power = SMTYP_ALIGN (aux.x_csect.x_smtyp);
/* There are a number of other fields and section flags /* There are a number of other fields and section flags
which we do not bother to set. */ which we do not bother to set. */
@ -5460,8 +5461,8 @@ _bfd_xcoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
that needs padding. This requires unlinking and that needs padding. This requires unlinking and
relinking the bfd's section list. */ relinking the bfd's section list. */
n = bfd_make_section_anyway (abfd, ".pad"); n = bfd_make_section_anyway_with_flags (abfd, ".pad",
n->flags = SEC_HAS_CONTENTS; SEC_HAS_CONTENTS);
n->alignment_power = 0; n->alignment_power = 0;
bfd_section_list_remove (abfd, n); bfd_section_list_remove (abfd, n);

View file

@ -1,5 +1,5 @@
/* xSYM symbol-file support for BFD. /* 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. Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -2228,7 +2228,7 @@ bfd_sym_scan (bfd *abfd, bfd_sym_version version, bfd_sym_data_struct *mdata)
if (mdata->name_table == NULL) if (mdata->name_table == NULL)
return -1; return -1;
bfdsec = bfd_make_section_anyway (abfd, name); bfdsec = bfd_make_section_anyway_with_flags (abfd, name, SEC_HAS_CONTENTS);
if (bfdsec == NULL) if (bfdsec == NULL)
return -1; return -1;
@ -2238,8 +2238,6 @@ bfd_sym_scan (bfd *abfd, bfd_sym_version version, bfd_sym_data_struct *mdata)
bfdsec->filepos = 0; bfdsec->filepos = 0;
bfdsec->alignment_power = 0; bfdsec->alignment_power = 0;
bfdsec->flags = SEC_HAS_CONTENTS;
abfd->tdata.sym_data = mdata; abfd->tdata.sym_data = mdata;
return 0; return 0;