This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add TLS support to binutils (ia32 and ia64 for now)


On Wed, Feb 13, 2002 at 04:27:04PM -0800, Richard Henderson wrote:
> On Thu, Feb 14, 2002 at 10:14:46AM +1030, Alan Modra wrote:
> > Yay!  If you don't find time, I'll do so.  It's something I've been
> > meaning to do for quite a while.
> 
> I've started, but got stalled on 
> 
> CREATE_BIG_COFF_TARGET_VEC (a29kcoff_big_vec, "coff-a29k-big", 0, SEC_READONLY, '_', NULL)
> 
> I can't think of any solution except to put the whole
> initializer in each CREATE_BIG_COFF_TARGET_VEC instance.

I've started on this, but am wondering if such a change actually makes the
code more maintainable. E.g. things like
initializing bfd_target->section_flags is plain ugly (as
designated initializers cannot be used), masking off allowable section flags
cannot be done with a simple and, etc.
Below is what I have now.

For TLS, I wonder if
SEC_CONSTRUCTOR_TEXT/SEC_CONSTRUCTOR_DATA/SEC_CONSTRUCTOR_BSS
cannot be killed (grep revealed they are just used in objdump to
print them and nothing sets them) and SEC_COFF_SHARED_LIBRARY
merged with SEC_ARCH_BIT_0 (one is COFF only, one is ELF only).
That would free 3 bits, TLS needs just one and we'd have 2 more spare ones
for the time being.

--- bfd/bfd-in.h.jj	Mon Apr 22 12:08:59 2002
+++ bfd/bfd-in.h	Thu May 16 17:43:31 2002
@@ -341,10 +341,10 @@ typedef struct sec *sec_ptr;
 #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
 #define bfd_section_lma(bfd, ptr) ((ptr)->lma)
 #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
-#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
+#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags)
 #define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
 
-#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
+#define bfd_is_com_section(ptr) ((ptr)->flags.is_common)
 
 #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (boolean)true), true)
 #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
--- bfd/section.c.jj	Tue Feb 12 14:57:04 2002
+++ bfd/section.c	Thu May 16 19:03:48 2002
@@ -166,57 +166,71 @@ CODE_FRAGMENT
 .  long symbol;
 .};
 .
-.typedef struct sec
-.{
-.  {* The name of the section; the name isn't a copy, the pointer is
-.     the same as that passed to bfd_make_section.  *}
-.  const char *name;
+.#if defined __GNUC__ && __GNUC__ >= 2
+.#define ENUM_BITFIELD(TYPE) enum TYPE
+.#else
+.#define ENUM_BITFIELD(TYPE) unsigned int
+.#endif
 .
-.  {* A unique sequence number.  *}
-.  int id;
-.
-.  {* Which section in the bfd; 0..n-1 as sections are created in a bfd.  *}
-.  int index;
+.enum bfd_link_dups
+.{
+.  {* This value for flags.link_dups means that duplicate
+.     sections with the same name should simply be discarded.  *}
+.  link_dups_discard = 0,
 .
-.  {* The next section in the list belonging to the BFD, or NULL.  *}
-.  struct sec *next;
+.  {* This value for flags.link_dups means that the linker
+.     should warn if there are any duplicate sections, although
+.     it should still only link one copy.  *}
+.  link_dups_one_only,
 .
-.  {* The field flags contains attributes of the section. Some
-.     flags are read in from the object file, and some are
-.     synthesized from other information.  *}
-.  flagword flags;
+.  {* This value for flags.link_dups means that the linker
+.     should warn if any duplicate sections are a different size.  *}
+.  link_dups_same_size,
 .
-.#define SEC_NO_FLAGS   0x000
+.  {* This value for flags.link_dups means that the linker
+.     should warn if any duplicate sections contain different
+.     contents.  *}
+.  link_dups_same_contents
+.};
 .
+.typedef struct
+.{
 .  {* Tells the OS to allocate space for this section when loading.
 .     This is clear for a section containing debug information only.  *}
-.#define SEC_ALLOC      0x001
+.  unsigned int alloc : 1;
 .
 .  {* Tells the OS to load the section from the file when loading.
 .     This is clear for a .bss section.  *}
-.#define SEC_LOAD       0x002
+.  unsigned int load : 1;
 .
 .  {* The section contains data still to be relocated, so there is
 .     some relocation information too.  *}
-.#define SEC_RELOC      0x004
+.  unsigned int reloc : 1;
+.
+.  {* The section contains common symbols (symbols may be defined
+.     multiple times, the value of a symbol is the amount of
+.     space it requires, and the largest symbol value is the one
+.     used).  Most targets have exactly one of these (which we
+.     translate to bfd_com_section_ptr), but ECOFF has two.  *}
+.  unsigned int is_common : 1;
 .
 .  {* ELF reserves 4 processor specific bits and 8 operating system
 .     specific bits in sh_flags; at present we can get away with just
 .     one in communicating between the assembler and BFD, but this
 .     isn't a good long-term solution.  *}
-.#define SEC_ARCH_BIT_0 0x008
+.  unsigned int arch_bit_0 : 1;
 .
 .  {* A signal to the OS that the section contains read only data.  *}
-.#define SEC_READONLY   0x010
+.  unsigned int readonly : 1;
 .
 .  {* The section contains code only.  *}
-.#define SEC_CODE       0x020
+.  unsigned int code : 1;
 .
 .  {* The section contains data only.  *}
-.#define SEC_DATA       0x040
+.  unsigned int data : 1;
 .
 .  {* The section will reside in ROM.  *}
-.#define SEC_ROM        0x080
+.  unsigned int rom : 1;
 .
 .  {* The section contains constructor information. This section
 .     type is used by the linker to create lists of constructors and
@@ -228,22 +242,16 @@ CODE_FRAGMENT
 .     sections called <<__CTOR_LIST__>> and relocate the data
 .     contained within - exactly the operations it would peform on
 .     standard data.  *}
-.#define SEC_CONSTRUCTOR 0x100
-.
-.  {* The section is a constructor, and should be placed at the
-.     end of the text, data, or bss section(?).  *}
-.#define SEC_CONSTRUCTOR_TEXT 0x1100
-.#define SEC_CONSTRUCTOR_DATA 0x2100
-.#define SEC_CONSTRUCTOR_BSS  0x3100
+.  unsigned int constructor : 1;
 .
 .  {* The section has contents - a data section could be
-.     <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
-.     <<SEC_HAS_CONTENTS>>  *}
-.#define SEC_HAS_CONTENTS 0x200
+.     <<alloc>> && <<has_contents>>; a debug section could be
+.     <<has_contents>>  *}
+.  unsigned int has_contents : 1;
 .
 .  {* An instruction to the linker to not output the section
 .     even if it has information which would normally be written.  *}
-.#define SEC_NEVER_LOAD 0x400
+.  unsigned int never_load : 1;
 .
 .  {* The section is a COFF shared library section.  This flag is
 .     only for the linker.  If this type of section appears in
@@ -254,7 +262,7 @@ CODE_FRAGMENT
 .     might be cleaner to have some more general mechanism to
 .     allow the back end to control what the linker does with
 .     sections.  *}
-.#define SEC_COFF_SHARED_LIBRARY 0x800
+.  unsigned int coff_shared_library : 1;
 .
 .  {* The section has GOT references.  This flag is only for the
 .     linker, and is currently only used by the elf32-hppa back end.
@@ -262,105 +270,143 @@ CODE_FRAGMENT
 .     in this section, which indicate to the linker that the section
 .     contains PIC code, and must be handled specially when doing a
 .     static link.  *}
-.#define SEC_HAS_GOT_REF 0x4000
-.
-.  {* The section contains common symbols (symbols may be defined
-.     multiple times, the value of a symbol is the amount of
-.     space it requires, and the largest symbol value is the one
-.     used).  Most targets have exactly one of these (which we
-.     translate to bfd_com_section_ptr), but ECOFF has two.  *}
-.#define SEC_IS_COMMON 0x8000
+.  unsigned int has_got_ref : 1;
 .
 .  {* The section contains only debugging information.  For
 .     example, this is set for ELF .debug and .stab sections.
 .     strip tests this flag to see if a section can be
 .     discarded.  *}
-.#define SEC_DEBUGGING 0x10000
+.  unsigned int debugging : 1;
 .
 .  {* The contents of this section are held in memory pointed to
 .     by the contents field.  This is checked by bfd_get_section_contents,
 .     and the data is retrieved from memory if appropriate.  *}
-.#define SEC_IN_MEMORY 0x20000
+.  unsigned int in_memory : 1;
 .
 .  {* The contents of this section are to be excluded by the
 .     linker for executable and shared objects unless those
 .     objects are to be further relocated.  *}
-.#define SEC_EXCLUDE 0x40000
+.  unsigned int exclude : 1;
 .
 .  {* The contents of this section are to be sorted based on the sum of
 .     the symbol and addend values specified by the associated relocation
 .     entries.  Entries without associated relocation entries will be
 .     appended to the end of the section in an unspecified order.  *}
-.#define SEC_SORT_ENTRIES 0x80000
+.  unsigned int sort_entries : 1;
 .
 .  {* When linking, duplicate sections of the same name should be
 .     discarded, rather than being combined into a single section as
 .     is usually done.  This is similar to how common symbols are
-.     handled.  See SEC_LINK_DUPLICATES below.  *}
-.#define SEC_LINK_ONCE 0x100000
+.     handled.  See link_dups below.  *}
+.  unsigned int link_once : 1;
 .
-.  {* If SEC_LINK_ONCE is set, this bitfield describes how the linker
+.  {* If link_once is set, this bitfield describes how the linker
 .     should handle duplicate sections.  *}
-.#define SEC_LINK_DUPLICATES 0x600000
-.
-.  {* This value for SEC_LINK_DUPLICATES means that duplicate
-.     sections with the same name should simply be discarded.  *}
-.#define SEC_LINK_DUPLICATES_DISCARD 0x0
-.
-.  {* This value for SEC_LINK_DUPLICATES means that the linker
-.     should warn if there are any duplicate sections, although
-.     it should still only link one copy.  *}
-.#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
-.
-.  {* This value for SEC_LINK_DUPLICATES means that the linker
-.     should warn if any duplicate sections are a different size.  *}
-.#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
-.
-.  {* This value for SEC_LINK_DUPLICATES means that the linker
-.     should warn if any duplicate sections contain different
-.     contents.  *}
-.#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
+.  ENUM_BITFIELD (bfd_link_dups) link_dups : 2;
 .
 .  {* This section was created by the linker as part of dynamic
 .     relocation or other arcane processing.  It is skipped when
 .     going through the first-pass output, trusting that someone
 .     else up the line will take care of it later.  *}
-.#define SEC_LINKER_CREATED 0x800000
+.  unsigned int linker_created : 1;
 .
 .  {* This section should not be subject to garbage collection.  *}
-.#define SEC_KEEP 0x1000000
+.  unsigned int keep : 1;
 .
 .  {* This section contains "short" data, and should be placed
 .     "near" the GP.  *}
-.#define SEC_SMALL_DATA 0x2000000
+.  unsigned int small_data : 1;
 .
 .  {* This section contains data which may be shared with other
 .     executables or shared objects.  *}
-.#define SEC_SHARED 0x4000000
+.  unsigned int shared : 1;
 .
 .  {* When a section with this flag is being linked, then if the size of
 .     the input section is less than a page, it should not cross a page
 .     boundary.  If the size of the input section is one page or more, it
 .     should be aligned on a page boundary.  *}
-.#define SEC_BLOCK 0x8000000
+.  unsigned int block : 1;
 .
 .  {* Conditionally link this section; do not link if there are no
 .     references found to any symbol in the section.  *}
-.#define SEC_CLINK 0x10000000
+.  unsigned int clink : 1;
 .
 .  {* Attempt to merge identical entities in the section.
 .     Entity size is given in the entsize field.  *}
-.#define SEC_MERGE 0x20000000
+.  unsigned int merge : 1;
 .
-.  {* If given with SEC_MERGE, entities to merge are zero terminated
+.  {* If given with flags.merge, entities to merge are zero terminated
 .     strings where entsize specifies character size instead of fixed
 .     size entries.  *}
-.#define SEC_STRINGS 0x40000000
+.  unsigned int strings : 1;
 .
 .  {* This section contains data about section groups.  *}
-.#define SEC_GROUP 0x80000000
+.  unsigned int group : 1;
+.
+.} secflagword;
+.
+.{* Macros to initialize flags.
+.   Redefine any of these you want to set and use SECFLAG_INIT
+.   macro.  *}
+.#define SECFLAG_ALLOC			0
+.#define SECFLAG_LOAD			0
+.#define SECFLAG_RELOC			0
+.#define SECFLAG_IS_COMMON		0
+.#define SECFLAG_ARCH_BIT_0		0
+.#define SECFLAG_READONLY		0
+.#define SECFLAG_CODE			0
+.#define SECFLAG_DATA			0
+.#define SECFLAG_ROM			0
+.#define SECFLAG_CONSTRUCTOR		0
+.#define SECFLAG_HAS_CONTENTS		0
+.#define SECFLAG_NEVER_LOAD		0
+.#define SECFLAG_COFF_SHARED_LIBRARY	0
+.#define SECFLAG_HAS_GOT_REF		0
+.#define SECFLAG_DEBUGGING		0
+.#define SECFLAG_IN_MEMORY		0
+.#define SECFLAG_EXCLUDE		0
+.#define SECFLAG_SORT_ENTRIES		0
+.#define SECFLAG_LINK_ONCE		0
+.#define SECFLAG_LINK_DUPS		link_dups_discard
+.#define SECFLAG_LINKER_CREATED		0
+.#define SECFLAG_KEEP			0
+.#define SECFLAG_SMALL_DATA		0
+.#define SECFLAG_SHARED			0
+.#define SECFLAG_BLOCK			0
+.#define SECFLAG_CLINK			0
+.#define SECFLAG_MERGE			0
+.#define SECFLAG_STRINGS		0
+.#define SECFLAG_GROUP			0
+.#define SECFLAG_INIT							\
+.  { SECFLAG_ALLOC, SECFLAG_LOAD, SECFLAG_RELOC, SECFLAG_IS_COMMON,	\
+.    SECFLAG_ARCH_BIT_0, SECFLAG_READONLY, SECFLAG_CODE, SECFLAG_DATA,	\
+.    SECFLAG_ROM, SECFLAG_CONSTRUCTOR, SECFLAG_HAS_CONTENTS,		\
+.    SECFLAG_NEVER_LOAD, SECFLAG_COFF_SHARED_LIBRARY,			\
+.    SECFLAG_HAS_GOT_REF, SECFLAG_DEBUGGING, SECFLAG_IN_MEMORY,		\
+.    SECFLAG_EXCLUDE, SECFLAG_SORT_ENTRIES, SECFLAG_LINK_ONCE,		\
+.    SECFLAG_LINK_DUPS, SECFLAG_LINKER_CREATED, SECFLAG_KEEP,		\
+.    SECFLAG_SMALL_DATA, SECFLAG_SHARED, SECFLAG_BLOCK, SECFLAG_CLINK,	\
+.    SECFLAG_MERGE, SECFLAG_STRINGS, SECFLAG_GROUP }
+.
+.typedef struct sec
+.{
+.  {* The name of the section; the name isn't a copy, the pointer is
+.     the same as that passed to bfd_make_section.  *}
+.  const char *name;
+.
+.  {* A unique sequence number.  *}
+.  int id;
 .
-.  {*  End of section flags.  *}
+.  {* Which section in the bfd; 0..n-1 as sections are created in a bfd.  *}
+.  int index;
+.
+.  {* The next section in the list belonging to the BFD, or NULL.  *}
+.  struct sec *next;
+.
+.  {* The bitfield flags contains attributes of the section. Some
+.     flags are read in from the object file, and some are
+.     synthesized from other information.  *}
+.  secflagword flags;
 .
 .  {* Some internal packed boolean fields.  *}
 .
@@ -451,7 +497,7 @@ CODE_FRAGMENT
 .  {* Pointer to data for applications.  *}
 .  PTR userdata;
 .
-.  {* If the SEC_IN_MEMORY flag is set, this points to the actual
+.  {* If the in_memory flag is set, this points to the actual
 .     contents.  *}
 .  unsigned char *contents;
 .
@@ -584,17 +630,17 @@ static const asymbol global_syms[] =
   GLOBAL_SYM_INIT (BFD_IND_SECTION_NAME, &bfd_ind_section)
 };
 
-#define STD_SECTION(SEC, FLAGS, SYM, NAME, IDX)				\
+#define STD_SECTION(SEC, SYM, NAME, IDX)				\
   const asymbol * const SYM = (asymbol *) &global_syms[IDX]; 		\
   const asection SEC = 							\
-    /* name, id,  index, next, flags, user_set_vma, reloc_done,      */	\
-    { NAME,  IDX, 0,     NULL, FLAGS, 0,            0,			\
+    /* name, id,  index, next, flags,	     user_set_vma,	     */	\
+    { NAME,  IDX, 0,     NULL, SECFLAG_INIT, 0,				\
 									\
-    /* linker_mark, linker_has_input, gc_mark, segment_mark,         */	\
-       0,           0,                1,       0,			\
+    /* reloc_done, linker_mark, linker_has_input, gc_mark,	     */	\
+       0,	   0,           0,                1,			\
 									\
-    /* vma, lma, _cooked_size, _raw_size,                            */	\
-       0,   0,   0,            0,					\
+    /* segment_mark, vma, lma, _cooked_size, _raw_size,              */	\
+       0,	     0,   0,   0,            0,				\
 									\
     /* output_offset, output_section,      alignment_power,          */	\
        0,             (struct sec *) &SEC, 0,				\
@@ -621,11 +667,14 @@ static const asymbol global_syms[] =
        NULL,            NULL						\
     }
 
-STD_SECTION (bfd_com_section, SEC_IS_COMMON, bfd_com_symbol,
-	     BFD_COM_SECTION_NAME, 0);
-STD_SECTION (bfd_und_section, 0, bfd_und_symbol, BFD_UND_SECTION_NAME, 1);
-STD_SECTION (bfd_abs_section, 0, bfd_abs_symbol, BFD_ABS_SECTION_NAME, 2);
-STD_SECTION (bfd_ind_section, 0, bfd_ind_symbol, BFD_IND_SECTION_NAME, 3);
+#undef SECFLAG_IS_COMMON
+#define SECFLAG_IS_COMMON 1
+STD_SECTION (bfd_com_section, bfd_com_symbol, BFD_COM_SECTION_NAME, 0);
+#undef SECFLAG_IS_COMMON
+#define SECFLAG_IS_COMMON 0
+STD_SECTION (bfd_und_section, bfd_und_symbol, BFD_UND_SECTION_NAME, 1);
+STD_SECTION (bfd_abs_section, bfd_abs_symbol, BFD_ABS_SECTION_NAME, 2);
+STD_SECTION (bfd_ind_section, bfd_ind_symbol, BFD_IND_SECTION_NAME, 3);
 #undef STD_SECTION
 
 struct section_hash_entry
@@ -991,7 +1040,7 @@ FUNCTION
 	bfd_set_section_flags
 
 SYNOPSIS
-	boolean bfd_set_section_flags(bfd *abfd, asection *sec, flagword flags);
+	boolean bfd_set_section_flags(bfd *abfd, asection *sec, secflagword flags);
 
 DESCRIPTION
 	Set the attributes of the section @var{sec} in the BFD
@@ -1001,7 +1050,7 @@ DESCRIPTION
 	o <<bfd_error_invalid_operation>> -
 	The section cannot have one or more of the attributes
 	requested. For example, a .bss section in <<a.out>> may not
-	have the <<SEC_HAS_CONTENTS>> field set.
+	have the <<has_contents>> field set.
 
 */
 
@@ -1010,12 +1059,12 @@ boolean
 bfd_set_section_flags (abfd, section, flags)
      bfd *abfd ATTRIBUTE_UNUSED;
      sec_ptr section;
-     flagword flags;
+     secflagword flags;
 {
 #if 0
   /* If you try to copy a text section from an input file (where it
-     has the SEC_CODE flag set) to an output file, this loses big if
-     the bfd_applicable_section_flags (abfd) doesn't have the SEC_CODE
+     has the code flag set) to an output file, this loses big if
+     the bfd_applicable_section_flags (abfd) doesn't have the code
      set - which it doesn't, at least not for a.out.  FIXME */
 
   if ((flags & bfd_applicable_section_flags (abfd)) != flags)
@@ -1129,7 +1178,7 @@ DESCRIPTION
 	Normally <<true>> is returned, else <<false>>. Possible error
 	returns are:
 	o <<bfd_error_no_contents>> -
-	The output section does not have the <<SEC_HAS_CONTENTS>>
+	The output section does not have the <<has_contents>>
 	attribute, so nothing can be written to it.
 	o and some more too
 
@@ -1153,7 +1202,7 @@ bfd_set_section_contents (abfd, section,
 {
   bfd_size_type sz;
 
-  if (!(bfd_get_section_flags (abfd, section) & SEC_HAS_CONTENTS))
+  if (!bfd_get_section_flags (abfd, section).has_contents)
     {
       bfd_set_error (bfd_error_no_contents);
       return (false);
@@ -1217,9 +1266,9 @@ DESCRIPTION
 	offset of @var{offset} from the start of the input section,
 	and is read for @var{count} bytes.
 
-	If the contents of a constructor with the <<SEC_CONSTRUCTOR>>
+	If the contents of a constructor with the <<constructor>>
 	flag set are requested or if the section does not have the
-	<<SEC_HAS_CONTENTS>> flag set, then the @var{location} is filled
+	<<has_contents>> flag set, then the @var{location} is filled
 	with zeroes. If no errors occur, <<true>> is returned, else
 	<<false>>.
 
@@ -1234,7 +1283,7 @@ bfd_get_section_contents (abfd, section,
 {
   bfd_size_type sz;
 
-  if (section->flags & SEC_CONSTRUCTOR)
+  if (section->flags.constructor)
     {
       memset (location, 0, (size_t) count);
       return true;
@@ -1256,13 +1305,13 @@ bfd_get_section_contents (abfd, section,
     /* Don't bother.  */
     return true;
 
-  if ((section->flags & SEC_HAS_CONTENTS) == 0)
+  if (section->flags.has_contents == 0)
     {
       memset (location, 0, (size_t) count);
       return true;
     }
 
-  if ((section->flags & SEC_IN_MEMORY) != 0)
+  if (section->flags.in_memory != 0)
     {
       memcpy (location, section->contents + offset, (size_t) count);
       return true;
@@ -1352,7 +1401,7 @@ _bfd_strip_section_from_output (info, s)
 	  for (is = abfd->sections; is != NULL; is = is->next)
 	    {
 	      if (is != s && is->output_section == os
-		  && (is->flags & SEC_EXCLUDE) == 0)
+		  && is->flags.exclude == 0)
 		break;
 	    }
 	  if (is != NULL)
@@ -1376,5 +1425,5 @@ _bfd_strip_section_from_output (info, s)
 	  }
     }
 
-  s->flags |= SEC_EXCLUDE;
+  s->flags.exclude = 1;
 }
--- bfd/bfd-in2.h.jj	Mon Apr 22 12:09:00 2002
+++ bfd/bfd-in2.h	Thu May 16 19:10:27 2002
@@ -347,10 +347,10 @@ typedef struct sec *sec_ptr;
 #define bfd_section_vma(bfd, ptr) ((ptr)->vma)
 #define bfd_section_lma(bfd, ptr) ((ptr)->lma)
 #define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
-#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags + 0)
+#define bfd_get_section_flags(bfd, ptr) ((ptr)->flags)
 #define bfd_get_section_userdata(bfd, ptr) ((ptr)->userdata)
 
-#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
+#define bfd_is_com_section(ptr) ((ptr)->flags.is_common)
 
 #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = (boolean)true), true)
 #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),true)
@@ -1004,57 +1004,71 @@ struct bfd_comdat_info
   long symbol;
 };
 
-typedef struct sec
-{
-  /* The name of the section; the name isn't a copy, the pointer is
-     the same as that passed to bfd_make_section.  */
-  const char *name;
-
-  /* A unique sequence number.  */
-  int id;
+#if defined __GNUC__ && __GNUC__ >= 2
+#define ENUM_BITFIELD(TYPE) enum TYPE
+#else
+#define ENUM_BITFIELD(TYPE) unsigned int
+#endif
 
-  /* Which section in the bfd; 0..n-1 as sections are created in a bfd.  */
-  int index;
+enum bfd_link_dups
+{
+  /* This value for flags.link_dups means that duplicate
+     sections with the same name should simply be discarded.  */
+  link_dups_discard = 0,
 
-  /* The next section in the list belonging to the BFD, or NULL.  */
-  struct sec *next;
+  /* This value for flags.link_dups means that the linker
+     should warn if there are any duplicate sections, although
+     it should still only link one copy.  */
+  link_dups_one_only,
 
-  /* The field flags contains attributes of the section. Some
-     flags are read in from the object file, and some are
-     synthesized from other information.  */
-  flagword flags;
+  /* This value for flags.link_dups means that the linker
+     should warn if any duplicate sections are a different size.  */
+  link_dups_same_size,
 
-#define SEC_NO_FLAGS   0x000
+  /* This value for flags.link_dups means that the linker
+     should warn if any duplicate sections contain different
+     contents.  */
+  link_dups_same_contents
+};
 
+typedef struct
+{
   /* Tells the OS to allocate space for this section when loading.
      This is clear for a section containing debug information only.  */
-#define SEC_ALLOC      0x001
+  unsigned int alloc : 1;
 
   /* Tells the OS to load the section from the file when loading.
      This is clear for a .bss section.  */
-#define SEC_LOAD       0x002
+  unsigned int load : 1;
 
   /* The section contains data still to be relocated, so there is
      some relocation information too.  */
-#define SEC_RELOC      0x004
+  unsigned int reloc : 1;
+
+  /* The section contains common symbols (symbols may be defined
+     multiple times, the value of a symbol is the amount of
+     space it requires, and the largest symbol value is the one
+     used).  Most targets have exactly one of these (which we
+     translate to bfd_com_section_ptr), but ECOFF has two.  */
+  unsigned int is_common : 1;
 
   /* ELF reserves 4 processor specific bits and 8 operating system
      specific bits in sh_flags; at present we can get away with just
      one in communicating between the assembler and BFD, but this
      isn't a good long-term solution.  */
-#define SEC_ARCH_BIT_0 0x008
+  unsigned int arch_bit_0 : 1;
 
   /* A signal to the OS that the section contains read only data.  */
-#define SEC_READONLY   0x010
+  unsigned int readonly : 1;
 
   /* The section contains code only.  */
-#define SEC_CODE       0x020
+  unsigned int code : 1;
 
   /* The section contains data only.  */
-#define SEC_DATA       0x040
+  unsigned int data : 1;
 
   /* The section will reside in ROM.  */
-#define SEC_ROM        0x080
+  unsigned int rom : 1;
 
   /* The section contains constructor information. This section
      type is used by the linker to create lists of constructors and
@@ -1066,22 +1080,16 @@ typedef struct sec
      sections called <<__CTOR_LIST__>> and relocate the data
      contained within - exactly the operations it would peform on
      standard data.  */
-#define SEC_CONSTRUCTOR 0x100
-
-  /* The section is a constructor, and should be placed at the
-     end of the text, data, or bss section(?).  */
-#define SEC_CONSTRUCTOR_TEXT 0x1100
-#define SEC_CONSTRUCTOR_DATA 0x2100
-#define SEC_CONSTRUCTOR_BSS  0x3100
+  unsigned int constructor : 1;
 
   /* The section has contents - a data section could be
-     <<SEC_ALLOC>> | <<SEC_HAS_CONTENTS>>; a debug section could be
-     <<SEC_HAS_CONTENTS>>  */
-#define SEC_HAS_CONTENTS 0x200
+     <<alloc>> && <<has_contents>>; a debug section could be
+     <<has_contents>>  */
+  unsigned int has_contents : 1;
 
   /* An instruction to the linker to not output the section
      even if it has information which would normally be written.  */
-#define SEC_NEVER_LOAD 0x400
+  unsigned int never_load : 1;
 
   /* The section is a COFF shared library section.  This flag is
      only for the linker.  If this type of section appears in
@@ -1092,7 +1100,7 @@ typedef struct sec
      might be cleaner to have some more general mechanism to
      allow the back end to control what the linker does with
      sections.  */
-#define SEC_COFF_SHARED_LIBRARY 0x800
+  unsigned int coff_shared_library : 1;
 
   /* The section has GOT references.  This flag is only for the
      linker, and is currently only used by the elf32-hppa back end.
@@ -1100,105 +1108,143 @@ typedef struct sec
      in this section, which indicate to the linker that the section
      contains PIC code, and must be handled specially when doing a
      static link.  */
-#define SEC_HAS_GOT_REF 0x4000
-
-  /* The section contains common symbols (symbols may be defined
-     multiple times, the value of a symbol is the amount of
-     space it requires, and the largest symbol value is the one
-     used).  Most targets have exactly one of these (which we
-     translate to bfd_com_section_ptr), but ECOFF has two.  */
-#define SEC_IS_COMMON 0x8000
+  unsigned int has_got_ref : 1;
 
   /* The section contains only debugging information.  For
      example, this is set for ELF .debug and .stab sections.
      strip tests this flag to see if a section can be
      discarded.  */
-#define SEC_DEBUGGING 0x10000
+  unsigned int debugging : 1;
 
   /* The contents of this section are held in memory pointed to
      by the contents field.  This is checked by bfd_get_section_contents,
      and the data is retrieved from memory if appropriate.  */
-#define SEC_IN_MEMORY 0x20000
+  unsigned int in_memory : 1;
 
   /* The contents of this section are to be excluded by the
      linker for executable and shared objects unless those
      objects are to be further relocated.  */
-#define SEC_EXCLUDE 0x40000
+  unsigned int exclude : 1;
 
   /* The contents of this section are to be sorted based on the sum of
      the symbol and addend values specified by the associated relocation
      entries.  Entries without associated relocation entries will be
      appended to the end of the section in an unspecified order.  */
-#define SEC_SORT_ENTRIES 0x80000
+  unsigned int sort_entries : 1;
 
   /* When linking, duplicate sections of the same name should be
      discarded, rather than being combined into a single section as
      is usually done.  This is similar to how common symbols are
-     handled.  See SEC_LINK_DUPLICATES below.  */
-#define SEC_LINK_ONCE 0x100000
+     handled.  See link_dups below.  */
+  unsigned int link_once : 1;
 
-  /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
+  /* If link_once is set, this bitfield describes how the linker
      should handle duplicate sections.  */
-#define SEC_LINK_DUPLICATES 0x600000
-
-  /* This value for SEC_LINK_DUPLICATES means that duplicate
-     sections with the same name should simply be discarded.  */
-#define SEC_LINK_DUPLICATES_DISCARD 0x0
-
-  /* This value for SEC_LINK_DUPLICATES means that the linker
-     should warn if there are any duplicate sections, although
-     it should still only link one copy.  */
-#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
-
-  /* This value for SEC_LINK_DUPLICATES means that the linker
-     should warn if any duplicate sections are a different size.  */
-#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
-
-  /* This value for SEC_LINK_DUPLICATES means that the linker
-     should warn if any duplicate sections contain different
-     contents.  */
-#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
+  ENUM_BITFIELD (bfd_link_dups) link_dups : 2;
 
   /* This section was created by the linker as part of dynamic
      relocation or other arcane processing.  It is skipped when
      going through the first-pass output, trusting that someone
      else up the line will take care of it later.  */
-#define SEC_LINKER_CREATED 0x800000
+  unsigned int linker_created : 1;
 
   /* This section should not be subject to garbage collection.  */
-#define SEC_KEEP 0x1000000
+  unsigned int keep : 1;
 
   /* This section contains "short" data, and should be placed
      "near" the GP.  */
-#define SEC_SMALL_DATA 0x2000000
+  unsigned int small_data : 1;
 
   /* This section contains data which may be shared with other
      executables or shared objects.  */
-#define SEC_SHARED 0x4000000
+  unsigned int shared : 1;
 
   /* When a section with this flag is being linked, then if the size of
      the input section is less than a page, it should not cross a page
      boundary.  If the size of the input section is one page or more, it
      should be aligned on a page boundary.  */
-#define SEC_BLOCK 0x8000000
+  unsigned int block : 1;
 
   /* Conditionally link this section; do not link if there are no
      references found to any symbol in the section.  */
-#define SEC_CLINK 0x10000000
+  unsigned int clink : 1;
 
   /* Attempt to merge identical entities in the section.
      Entity size is given in the entsize field.  */
-#define SEC_MERGE 0x20000000
+  unsigned int merge : 1;
 
-  /* If given with SEC_MERGE, entities to merge are zero terminated
+  /* If given with flags.merge, entities to merge are zero terminated
      strings where entsize specifies character size instead of fixed
      size entries.  */
-#define SEC_STRINGS 0x40000000
+  unsigned int strings : 1;
 
   /* This section contains data about section groups.  */
-#define SEC_GROUP 0x80000000
+  unsigned int group : 1;
+
+} secflagword;
+
+/* Macros to initialize flags.
+   Redefine any of these you want to set and use SECFLAG_INIT
+   macro.  */
+#define SECFLAG_ALLOC                  0
+#define SECFLAG_LOAD                   0
+#define SECFLAG_RELOC                  0
+#define SECFLAG_IS_COMMON              0
+#define SECFLAG_ARCH_BIT_0             0
+#define SECFLAG_READONLY               0
+#define SECFLAG_CODE                   0
+#define SECFLAG_DATA                   0
+#define SECFLAG_ROM                    0
+#define SECFLAG_CONSTRUCTOR            0
+#define SECFLAG_HAS_CONTENTS           0
+#define SECFLAG_NEVER_LOAD             0
+#define SECFLAG_COFF_SHARED_LIBRARY    0
+#define SECFLAG_HAS_GOT_REF            0
+#define SECFLAG_DEBUGGING              0
+#define SECFLAG_IN_MEMORY              0
+#define SECFLAG_EXCLUDE                0
+#define SECFLAG_SORT_ENTRIES           0
+#define SECFLAG_LINK_ONCE              0
+#define SECFLAG_LINK_DUPS              link_dups_discard
+#define SECFLAG_LINKER_CREATED         0
+#define SECFLAG_KEEP                   0
+#define SECFLAG_SMALL_DATA             0
+#define SECFLAG_SHARED                 0
+#define SECFLAG_BLOCK                  0
+#define SECFLAG_CLINK                  0
+#define SECFLAG_MERGE                  0
+#define SECFLAG_STRINGS                0
+#define SECFLAG_GROUP                  0
+#define SECFLAG_INIT                                                   \
+  { SECFLAG_ALLOC, SECFLAG_LOAD, SECFLAG_RELOC, SECFLAG_IS_COMMON,     \
+    SECFLAG_ARCH_BIT_0, SECFLAG_READONLY, SECFLAG_CODE, SECFLAG_DATA,  \
+    SECFLAG_ROM, SECFLAG_CONSTRUCTOR, SECFLAG_HAS_CONTENTS,            \
+    SECFLAG_NEVER_LOAD, SECFLAG_COFF_SHARED_LIBRARY,                   \
+    SECFLAG_HAS_GOT_REF, SECFLAG_DEBUGGING, SECFLAG_IN_MEMORY,         \
+    SECFLAG_EXCLUDE, SECFLAG_SORT_ENTRIES, SECFLAG_LINK_ONCE,          \
+    SECFLAG_LINK_DUPS, SECFLAG_LINKER_CREATED, SECFLAG_KEEP,           \
+    SECFLAG_SMALL_DATA, SECFLAG_SHARED, SECFLAG_BLOCK, SECFLAG_CLINK,  \
+    SECFLAG_MERGE, SECFLAG_STRINGS, SECFLAG_GROUP }
 
-  /*  End of section flags.  */
+typedef struct sec
+{
+  /* The name of the section; the name isn't a copy, the pointer is
+     the same as that passed to bfd_make_section.  */
+  const char *name;
+
+  /* A unique sequence number.  */
+  int id;
+
+  /* Which section in the bfd; 0..n-1 as sections are created in a bfd.  */
+  int index;
+
+  /* The next section in the list belonging to the BFD, or NULL.  */
+  struct sec *next;
+
+  /* The bitfield flags contains attributes of the section. Some
+     flags are read in from the object file, and some are
+     synthesized from other information.  */
+  secflagword flags;
 
   /* Some internal packed boolean fields.  */
 
@@ -1289,7 +1335,7 @@ typedef struct sec
   /* Pointer to data for applications.  */
   PTR userdata;
 
-  /* If the SEC_IN_MEMORY flag is set, this points to the actual
+  /* If the in_memory flag is set, this points to the actual
      contents.  */
   unsigned char *contents;
 
@@ -1418,7 +1464,7 @@ asection *
 bfd_make_section PARAMS ((bfd *, const char *name));
 
 boolean
-bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, flagword flags));
+bfd_set_section_flags PARAMS ((bfd *abfd, asection *sec, secflagword flags));
 
 void
 bfd_map_over_sections PARAMS ((bfd *abfd,
@@ -3625,9 +3671,9 @@ typedef struct bfd_target
      from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>.  */
   flagword object_flags;
 
- /* A mask of all the flags which a section may have set - from
-    the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>.  */
-  flagword section_flags;
+ /* A bitfield with all the flags which a section may have set - from
+    the set <<alloc>>, ...<<never_load>>.  */
+  secflagword section_flags;
 
  /* The character normally found at the front of a symbol.
     (if any), perhaps `_'.  */
@@ -3866,7 +3912,7 @@ CONCAT2 (NAME,_bfd_merge_sections)
   /* Remove sections that are not referenced from the output.  */
   boolean  (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
 
-  /* Attempt to merge SEC_MERGE sections.  */
+  /* Attempt to merge mergeable sections.  */
   boolean  (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
 
   /* Routines to handle dynamic symbols and relocs.  */
--- bfd/reloc.c.jj	Wed Apr  3 12:23:03 2002
+++ bfd/reloc.c	Tue May 14 22:49:50 2002
@@ -3514,8 +3514,8 @@ SYNOPSIS
 	 (bfd *, struct bfd_link_info *);
 
 DESCRIPTION
-	Provides default handling for SEC_MERGE section merging for back ends
-	which don't have SEC_MERGE support -- i.e., does nothing.
+	Provides default handling for mergeable section merging for back ends
+	which don't have merge support -- i.e., does nothing.
 */
 
 boolean
--- bfd/elflink.h.jj	Tue May 14 11:50:15 2002
+++ bfd/elflink.h	Thu May 16 17:49:02 2002
@@ -653,8 +653,8 @@ elf_merge_symbol (abfd, info, name, sym,
 
   if (newdyn
       && newdef
-      && (sec->flags & SEC_ALLOC) != 0
-      && (sec->flags & SEC_LOAD) == 0
+      && sec->flags.alloc
+      && sec->flags.load == 0
       && sym->st_size > 0
       && bind != STB_WEAK
       && ELF_ST_TYPE (sym->st_info) != STT_FUNC)
@@ -666,8 +666,8 @@ elf_merge_symbol (abfd, info, name, sym,
       && olddef
       && h->root.type == bfd_link_hash_defined
       && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
-      && (h->root.u.def.section->flags & SEC_ALLOC) != 0
-      && (h->root.u.def.section->flags & SEC_LOAD) == 0
+      && h->root.u.def.section->flags.alloc
+      && h->root.u.def.section->flags.load == 0
       && h->size > 0
       && h->type != STT_FUNC)
     olddyncommon = true;
@@ -1563,7 +1563,7 @@ elf_link_add_object_symbols (abfd, info)
 	 object in the output file.  We hack by simply clobbering the
 	 list of sections in the BFD.  This could be handled more
 	 cleanly by, say, a new section flag; the existing
-	 SEC_NEVER_LOAD flag is not the one we want, because that one
+	 never_load flag is not the one we want, because that one
 	 still implies that the section takes up space in the output
 	 file.  */
       bfd_section_list_clear (abfd);
@@ -2222,10 +2222,10 @@ elf_link_add_object_symbols (abfd, info)
 	  Elf_Internal_Rela *internal_relocs;
 	  boolean ok;
 
-	  if ((o->flags & SEC_RELOC) == 0
+	  if (o->flags.reloc == 0
 	      || o->reloc_count == 0
 	      || ((info->strip == strip_all || info->strip == strip_debugger)
-		  && (o->flags & SEC_DEBUGGING) != 0)
+		  && o->flags.debugging)
 	      || bfd_is_abs_section (o->output_section))
 	    continue;
 
@@ -2258,7 +2258,7 @@ elf_link_add_object_symbols (abfd, info)
       asection *stab, *stabstr;
 
       stab = bfd_get_section_by_name (abfd, ".stab");
-      if (stab != NULL && !(stab->flags & SEC_MERGE))
+      if (stab != NULL && !stab->flags.merge)
 	{
 	  stabstr = bfd_get_section_by_name (abfd, ".stabstr");
 
@@ -2284,7 +2284,7 @@ elf_link_add_object_symbols (abfd, info)
       asection *s;
 
       for (s = abfd->sections; s != NULL; s = s->next)
-	if (s->flags & SEC_MERGE)
+	if (s->flags.merge)
 	  {
 	    struct bfd_elf_section_data *secdata;
 
@@ -2322,7 +2322,7 @@ elf_link_create_dynamic_sections (abfd, 
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  flagword flags;
+  secflagword flags;
   register asection *s;
   struct elf_link_hash_entry *h;
   struct elf_backend_data *bed;
@@ -2339,10 +2339,15 @@ elf_link_create_dynamic_sections (abfd, 
   else
     abfd = elf_hash_table (info)->dynobj;
 
-  /* Note that we set the SEC_IN_MEMORY flag for all of these
+  /* Note that we set the in_memory flag for all of these
      sections.  */
-  flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
-	   | SEC_IN_MEMORY | SEC_LINKER_CREATED);
+  memset (&flags, 0, sizeof (flags));
+  flags.alloc = 1;
+  flags.load = 1;
+  flags.has_contents = 1;
+  flags.in_memory = 1;
+  flags.linker_created = 1;
+  flags.readonly = 1;
 
   /* A dynamically linked executable has a .interp section, but a
      shared library does not.  */
@@ -2350,7 +2355,7 @@ elf_link_create_dynamic_sections (abfd, 
     {
       s = bfd_make_section (abfd, ".interp");
       if (s == NULL
-	  || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY))
+	  || ! bfd_set_section_flags (abfd, s, flags))
 	return false;
     }
 
@@ -2359,7 +2364,7 @@ elf_link_create_dynamic_sections (abfd, 
     {
       s = bfd_make_section (abfd, ".eh_frame_hdr");
       if (s == NULL
-	  || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+	  || ! bfd_set_section_flags (abfd, s, flags)
 	  || ! bfd_set_section_alignment (abfd, s, 2))
 	return false;
     }
@@ -2368,31 +2373,31 @@ elf_link_create_dynamic_sections (abfd, 
      if they are not needed.  */
   s = bfd_make_section (abfd, ".gnu.version_d");
   if (s == NULL
-      || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+      || ! bfd_set_section_flags (abfd, s, flags)
       || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
     return false;
 
   s = bfd_make_section (abfd, ".gnu.version");
   if (s == NULL
-      || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+      || ! bfd_set_section_flags (abfd, s, flags)
       || ! bfd_set_section_alignment (abfd, s, 1))
     return false;
 
   s = bfd_make_section (abfd, ".gnu.version_r");
   if (s == NULL
-      || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+      || ! bfd_set_section_flags (abfd, s, flags)
       || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
     return false;
 
   s = bfd_make_section (abfd, ".dynsym");
   if (s == NULL
-      || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+      || ! bfd_set_section_flags (abfd, s, flags)
       || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
     return false;
 
   s = bfd_make_section (abfd, ".dynstr");
   if (s == NULL
-      || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY))
+      || ! bfd_set_section_flags (abfd, s, flags))
     return false;
 
   /* Create a strtab to hold the dynamic symbol names.  */
@@ -2403,6 +2408,7 @@ elf_link_create_dynamic_sections (abfd, 
 	return false;
     }
 
+  flags.readonly = 0;
   s = bfd_make_section (abfd, ".dynamic");
   if (s == NULL
       || ! bfd_set_section_flags (abfd, s, flags)
@@ -2432,9 +2438,10 @@ elf_link_create_dynamic_sections (abfd, 
 
   bed = get_elf_backend_data (abfd);
 
+  flags.readonly = 1;
   s = bfd_make_section (abfd, ".hash");
   if (s == NULL
-      || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+      || ! bfd_set_section_flags (abfd, s, flags)
       || ! bfd_set_section_alignment (abfd, s, LOG_FILE_ALIGN))
     return false;
   elf_section_data (s)->this_hdr.sh_entsize = bed->s->sizeof_hash_entry;
@@ -4763,8 +4770,8 @@ elf_link_sort_relocs (abfd, info, psec)
 
   size = 0;
   for (o = dynobj->sections; o != NULL; o = o->next)
-    if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
-	== (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
+    if (o->flags.has_contents
+	&& o->flags.linker_created
 	&& o->output_section == reldyn)
       size += o->_raw_size;
 
@@ -4781,8 +4788,8 @@ elf_link_sort_relocs (abfd, info, psec)
     }
 
   for (o = dynobj->sections; o != NULL; o = o->next)
-    if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
-	== (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
+    if (o->flags.has_contents
+	&& o->flags.linker_created
 	&& o->output_section == reldyn)
       {
 	if (rel)
@@ -4836,8 +4843,8 @@ elf_link_sort_relocs (abfd, info, psec)
   qsort (rela + ret, (size_t) count - ret, sizeof (*rela), elf_link_sort_cmp2);
 
   for (o = dynobj->sections; o != NULL; o = o->next)
-    if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
-	== (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
+    if (o->flags.has_contents
+	&& o->flags.linker_created
 	&& o->output_section == reldyn)
       {
 	if (rel)
@@ -4988,7 +4995,7 @@ elf_bfd_final_link (abfd, info)
 		 the linker has decided to not include.  */
 	      sec->linker_mark = true;
 
-	      if (sec->flags & SEC_MERGE)
+	      if (sec->flags.merge)
 		merged = true;
 
 	      if (info->relocateable || info->emitrelocations)
@@ -5033,7 +5040,7 @@ elf_bfd_final_link (abfd, info)
 		      && elf_symtab_shndx (sec->owner) != 0)
 		    max_sym_shndx_count = sym_count;
 
-		  if ((sec->flags & SEC_RELOC) != 0)
+		  if (sec->flags.reloc)
 		    {
 		      size_t ext_size;
 
@@ -5048,21 +5055,20 @@ elf_bfd_final_link (abfd, info)
 	}
 
       if (o->reloc_count > 0)
-	o->flags |= SEC_RELOC;
+	o->flags.reloc = 1;
       else
 	{
-	  /* Explicitly clear the SEC_RELOC flag.  The linker tends to
+	  /* Explicitly clear the reloc flag.  The linker tends to
 	     set it (this is probably a bug) and if it is set
 	     assign_section_numbers will create a reloc section.  */
-	  o->flags &=~ SEC_RELOC;
+	  o->flags.reloc = 0;
 	}
 
-      /* If the SEC_ALLOC flag is not set, force the section VMA to
+      /* If the alloc flag is not set, force the section VMA to
 	 zero.  This is done in elf_fake_sections as well, but forcing
 	 the VMA to 0 here will ensure that relocs against these
 	 sections are handled correctly.  */
-      if ((o->flags & SEC_ALLOC) == 0
-	  && ! o->user_set_vma)
+      if (o->flags.alloc == 0 && ! o->user_set_vma)
 	o->vma = 0;
     }
 
@@ -5095,8 +5101,7 @@ elf_bfd_final_link (abfd, info)
 
 	  output_section = o->output_section;
 
-	  if (output_section != NULL
-	      && (o->flags & SEC_RELOC) != 0)
+	  if (output_section != NULL && o->flags.reloc)
 	    {
 	      struct bfd_elf_section_data *esdi
 		= elf_section_data (o);
@@ -5131,7 +5136,7 @@ elf_bfd_final_link (abfd, info)
 	      *rel_count += NUM_SHDR_ENTRIES (& esdi->rel_hdr);
 	      if (esdi->rel_hdr2)
 		*rel_count2 += NUM_SHDR_ENTRIES (esdi->rel_hdr2);
-	      output_section->flags |= SEC_RELOC;
+	      output_section->flags.reloc = 1;
 	    }
 	}
 
@@ -5139,7 +5144,7 @@ elf_bfd_final_link (abfd, info)
      them file positions, and allocate some buffers.  */
   for (o = abfd->sections; o != NULL; o = o->next)
     {
-      if ((o->flags & SEC_RELOC) != 0)
+      if (o->flags.reloc)
 	{
 	  if (!elf_link_size_reloc_section (abfd,
 					    &elf_section_data (o)->rel_hdr,
@@ -5528,7 +5533,7 @@ elf_bfd_final_link (abfd, info)
   /* Adjust the relocs to have the correct symbol indices.  */
   for (o = abfd->sections; o != NULL; o = o->next)
     {
-      if ((o->flags & SEC_RELOC) == 0)
+      if (o->flags.reloc)
 	continue;
 
       elf_link_adjust_relocs (abfd, &elf_section_data (o)->rel_hdr,
@@ -5714,11 +5719,11 @@ elf_bfd_final_link (abfd, info)
 
       for (o = dynobj->sections; o != NULL; o = o->next)
 	{
-	  if ((o->flags & SEC_HAS_CONTENTS) == 0
+	  if (o->flags.has_contents == 0
 	      || o->_raw_size == 0
 	      || o->output_section == bfd_abs_section_ptr)
 	    continue;
-	  if ((o->flags & SEC_LINKER_CREATED) == 0)
+	  if (o->flags.linker_created == 0)
 	    {
 	      /* At this point, we are only interested in sections
 		 created by elf_link_create_dynamic_sections.  */
@@ -5791,7 +5796,7 @@ elf_bfd_final_link (abfd, info)
     free (finfo.symbuf);
   for (o = abfd->sections; o != NULL; o = o->next)
     {
-      if ((o->flags & SEC_RELOC) != 0
+      if (o->flags.reloc
 	  && elf_section_data (o)->rel_hashes != NULL)
 	free (elf_section_data (o)->rel_hashes);
     }
@@ -5825,7 +5830,7 @@ elf_bfd_final_link (abfd, info)
     free (finfo.symbuf);
   for (o = abfd->sections; o != NULL; o = o->next)
     {
-      if ((o->flags & SEC_RELOC) != 0
+      if (o->flags.reloc
 	  && elf_section_data (o)->rel_hashes != NULL)
 	free (elf_section_data (o)->rel_hashes);
     }
@@ -5862,7 +5867,7 @@ elf_link_output_sym (finfo, name, elfsym
 
   if (name == (const char *) NULL || *name == '\0')
     elfsym->st_name = 0;
-  else if (input_sec->flags & SEC_EXCLUDE)
+  else if (input_sec->flags.exclude)
     elfsym->st_name = 0;
   else
     {
@@ -5930,7 +5935,7 @@ elf_link_flush_output_syms (finfo)
   return true;
 }
 
-/* Adjust all external symbols pointing into SEC_MERGE sections
+/* Adjust all external symbols pointing into mergeable sections
    to reflect the object merging within the sections.  */
 
 static boolean
@@ -5945,7 +5950,7 @@ elf_link_sec_merge_syms (h, data)
 
   if ((h->root.type == bfd_link_hash_defined
        || h->root.type == bfd_link_hash_defweak)
-      && ((sec = h->root.u.def.section)->flags & SEC_MERGE)
+      && (sec = h->root.u.def.section)->flags.merge
       && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
     {
       bfd *output_bfd = (bfd *) data;
@@ -6505,13 +6510,13 @@ elf_link_input_bfd (finfo, input_bfd)
       /* If this symbol is defined in a section which we are
 	 discarding, we don't need to keep it, but note that
 	 linker_mark is only reliable for sections that have contents.
-	 For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE
+	 For the benefit of the MIPS ELF linker, we check exclude flag
 	 as well as linker_mark.  */
       if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
 	  && isec != NULL
-	  && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0)
+	  && ((! isec->linker_mark && isec->flags.has_contents)
 	      || (! finfo->info->relocateable
-		  && (isec->flags & SEC_EXCLUDE) != 0)))
+		  && isec->flags.exclude)))
 	continue;
 
       /* Get the name of the symbol.  */
@@ -6525,7 +6530,7 @@ elf_link_input_bfd (finfo, input_bfd)
 	   && (bfd_hash_lookup (finfo->info->keep_hash, name, false, false)
 	       == NULL))
 	  || (((finfo->info->discard == discard_sec_merge
-		&& (isec->flags & SEC_MERGE) && ! finfo->info->relocateable)
+		&& isec->flags.merge && ! finfo->info->relocateable)
 	       || finfo->info->discard == discard_l)
 	      && bfd_is_local_label_name (input_bfd, name)))
 	continue;
@@ -6569,11 +6574,11 @@ elf_link_input_bfd (finfo, input_bfd)
 	  continue;
 	}
 
-      if ((o->flags & SEC_HAS_CONTENTS) == 0
-	  || (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0))
+      if (o->flags.has_contents == 0
+	  || (o->_raw_size == 0 && o->flags.reloc == 0))
 	continue;
 
-      if ((o->flags & SEC_LINKER_CREATED) != 0)
+      if (o->flags.linker_created)
 	{
 	  /* Section was created by elf_link_create_dynamic_sections
 	     or somesuch.  */
@@ -6594,7 +6599,7 @@ elf_link_input_bfd (finfo, input_bfd)
 	    return false;
 	}
 
-      if ((o->flags & SEC_RELOC) != 0)
+      if (o->flags.reloc)
 	{
 	  Elf_Internal_Rela *internal_relocs;
 
@@ -6645,7 +6650,7 @@ elf_link_input_bfd (finfo, input_bfd)
 			  && elf_discarded_section (h->root.u.def.section))
 			{
 #if BFD_VERSION_DATE < 20031005
-			  if ((o->flags & SEC_DEBUGGING) != 0)
+			  if (o->flags.debugging)
 			    {
 #if BFD_VERSION_DATE > 20021005
 			      (*finfo->info->callbacks->warning)
@@ -6674,8 +6679,7 @@ elf_link_input_bfd (finfo, input_bfd)
 		      if (sec != NULL && elf_discarded_section (sec))
 			{
 #if BFD_VERSION_DATE < 20031005
-			  if ((o->flags & SEC_DEBUGGING) != 0
-			      || (sec->flags & SEC_LINK_ONCE) != 0)
+			  if (o->flags.debugging || sec->flags.link_once)
 			    {
 #if BFD_VERSION_DATE > 20021005
 			      (*finfo->info->callbacks->warning)
@@ -6961,7 +6965,7 @@ elf_link_input_bfd (finfo, input_bfd)
 	    bfd_size_type sec_size;
 
 	    sec_size = (o->_cooked_size != 0 ? o->_cooked_size : o->_raw_size);
-	    if (! (o->flags & SEC_EXCLUDE)
+	    if (! o->flags.exclude
 		&& ! bfd_set_section_contents (output_bfd, o->output_section,
 					       contents,
 					       (file_ptr) o->output_offset,
@@ -7485,7 +7489,7 @@ elf_gc_mark (info, sec, gc_mark_hook)
 
   /* Look through the section relocs.  */
   ret = true;
-  if ((sec->flags & SEC_RELOC) != 0 && sec->reloc_count > 0)
+  if (sec->flags.reloc && sec->reloc_count > 0)
     {
       Elf_Internal_Rela *relstart, *rel, *relend;
       Elf_Internal_Shdr *symtab_hdr;
@@ -7635,25 +7639,23 @@ elf_gc_sweep (info, gc_sweep_hook)
       for (o = sub->sections; o != NULL; o = o->next)
 	{
 	  /* Keep special sections.  Keep .debug sections.  */
-	  if ((o->flags & SEC_LINKER_CREATED)
-	      || (o->flags & SEC_DEBUGGING))
+	  if (o->flags.linker_created || o->flags.debugging)
 	    o->gc_mark = 1;
 
 	  if (o->gc_mark)
 	    continue;
 
 	  /* Skip sweeping sections already excluded.  */
-	  if (o->flags & SEC_EXCLUDE)
+	  if (o->flags.exclude)
 	    continue;
 
 	  /* Since this is early in the link process, it is simple
 	     to remove a section from the output.  */
-	  o->flags |= SEC_EXCLUDE;
+	  o->flags.exclude = 1;
 
 	  /* But we also have to update some of the relocation
 	     info we collected before.  */
-	  if (gc_sweep_hook
-	      && (o->flags & SEC_RELOC) && o->reloc_count > 0)
+	  if (gc_sweep_hook && o->flags.reloc && o->reloc_count > 0)
 	    {
 	      Elf_Internal_Rela *internal_relocs;
 	      boolean r;
@@ -7870,13 +7872,13 @@ elf_gc_sections (abfd, info)
 
       for (o = sub->sections; o != NULL; o = o->next)
 	{
-	  if (o->flags & SEC_KEEP)
+	  if (o->flags.keep)
 	    if (!elf_gc_mark (info, o, gc_mark_hook))
 	      return false;
 	}
     }
 
-  /* ... and mark SEC_EXCLUDE for those that go.  */
+  /* ... and mark excluded for those that go.  */
   if (!elf_gc_sweep (info, get_elf_backend_data (abfd)->gc_sweep_hook))
     return false;
 
--- bfd/elflink.c.jj	Wed Apr  3 12:22:46 2002
+++ bfd/elflink.c	Thu May 16 17:48:22 2002
@@ -30,7 +30,7 @@ _bfd_elf_create_got_section (abfd, info)
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  flagword flags;
+  secflagword flags;
   register asection *s;
   struct elf_link_hash_entry *h;
   struct elf_backend_data *bed = get_elf_backend_data (abfd);
@@ -55,8 +55,12 @@ _bfd_elf_create_got_section (abfd, info)
       return false;
     }
 
-  flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
-	   | SEC_LINKER_CREATED);
+  memset (&flags, 0, sizeof (flags));
+  flags.alloc = 1;
+  flags.load = 1;
+  flags.has_contents = 1;
+  flags.in_memory = 1;
+  flags.linker_created = 1;
 
   s = bfd_make_section (abfd, ".got");
   if (s == NULL
@@ -108,7 +112,7 @@ _bfd_elf_create_dynamic_sections (abfd, 
      bfd *abfd;
      struct bfd_link_info *info;
 {
-  flagword flags, pltflags;
+  secflagword flags, pltflags;
   register asection *s;
   struct elf_backend_data *bed = get_elf_backend_data (abfd);
   int ptralign;
@@ -131,15 +135,23 @@ _bfd_elf_create_dynamic_sections (abfd, 
   /* We need to create .plt, .rel[a].plt, .got, .got.plt, .dynbss, and
      .rel[a].bss sections.  */
 
-  flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
-	   | SEC_LINKER_CREATED);
+  memset (&flags, 0, sizeof (flags));
+  flags.alloc = 1;
+  flags.load = 1;
+  flags.has_contents = 1;
+  flags.in_memory = 1;
+  flags.linker_created = 1;
 
   pltflags = flags;
-  pltflags |= SEC_CODE;
+  pltflags.code = 1;
   if (bed->plt_not_loaded)
-    pltflags &= ~ (SEC_CODE | SEC_LOAD | SEC_HAS_CONTENTS);
+    {
+      pltflags.code = 0;
+      pltflags.load = 0;
+      pltflags.has_contents = 0;
+    }
   if (bed->plt_readonly)
-    pltflags |= SEC_READONLY;
+    pltflags.readonly = 1;
 
   s = bfd_make_section (abfd, ".plt");
   if (s == NULL
@@ -166,10 +178,11 @@ _bfd_elf_create_dynamic_sections (abfd, 
 	return false;
     }
 
+  flags.readonly = 1;
   s = bfd_make_section (abfd,
 			bed->default_use_rela_p ? ".rela.plt" : ".rel.plt");
   if (s == NULL
-      || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+      || ! bfd_set_section_flags (abfd, s, flags)
       || ! bfd_set_section_alignment (abfd, s, ptralign))
     return false;
 
@@ -185,10 +198,12 @@ _bfd_elf_create_dynamic_sections (abfd, 
 	 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))
+      if (s == NULL)
 	return false;
 
+      memset (&s->flags, 0, sizeof (s->flags));
+      s->flags.alloc = 1;
+
       /* The .rel[a].bss section holds copy relocs.  This section is not
      normally needed.  We need to create it here, though, so that the
      linker will map it to an output section.  We can't just create it
@@ -206,7 +221,7 @@ _bfd_elf_create_dynamic_sections (abfd, 
 				(bed->default_use_rela_p
 				 ? ".rela.bss" : ".rel.bss"));
 	  if (s == NULL
-	      || ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
+	      || ! bfd_set_section_flags (abfd, s, flags)
 	      || ! bfd_set_section_alignment (abfd, s, ptralign))
 	    return false;
 	}
@@ -535,16 +550,18 @@ _bfd_elf_make_linker_section_rela (dynob
   lsect->rel_section = bfd_get_section_by_name (dynobj, lsect->rel_name);
   if (lsect->rel_section == NULL)
     {
+      secflagword flags;
+
+      memset (&flags, 0, sizeof (flags));
+      flags.alloc = 1;
+      flags.load = 1;
+      flags.has_contents = 1;
+      flags.in_memory = 1;
+      flags.linker_created = 1;
+      flags.readonly = 1;
       lsect->rel_section = bfd_make_section (dynobj, lsect->rel_name);
       if (lsect->rel_section == NULL
-	  || ! bfd_set_section_flags (dynobj,
-				      lsect->rel_section,
-				      (SEC_ALLOC
-				       | SEC_LOAD
-				       | SEC_HAS_CONTENTS
-				       | SEC_IN_MEMORY
-				       | SEC_LINKER_CREATED
-				       | SEC_READONLY))
+	  || ! bfd_set_section_flags (dynobj, lsect->rel_section, flags)
 	  || ! bfd_set_section_alignment (dynobj, lsect->rel_section, alignment))
 	return false;
     }
--- bfd/elfcode.h.jj	Sat Dec 22 00:48:25 2001
+++ bfd/elfcode.h	Tue May 14 23:15:15 2002
@@ -829,9 +829,8 @@ elf_object_p (abfd)
 
 	  targ_index = elf_section_data (s)->this_hdr.sh_info;
 	  targ_sec = bfd_section_from_elf_index (abfd, targ_index);
-	  if (targ_sec != NULL
-	      && (targ_sec->flags & SEC_DEBUGGING) != 0)
-	    s->flags |= SEC_DEBUGGING;
+	  if (targ_sec != NULL && targ_sec->flags.debugging)
+	    s->flags.debugging = 1;
 	}
     }
 
@@ -892,12 +891,12 @@ elf_write_relocs (abfd, sec, data)
   if (*failedp)
     return;
 
-  if ((sec->flags & SEC_RELOC) == 0)
+  if (sec->flags.reloc == 0)
     return;
 
   /* The linker backend writes the relocs out itself, and sets the
      reloc_count field to zero to inhibit writing them here.  Also,
-     sometimes the SEC_RELOC flag gets set even when there aren't any
+     sometimes the reloc flag gets set even when there aren't any
      relocs.  */
   if (sec->reloc_count == 0)
     return;
@@ -1509,8 +1508,7 @@ elf_slurp_reloc_table (abfd, asect, symb
 
   if (! dynamic)
     {
-      if ((asect->flags & SEC_RELOC) == 0
-	  || asect->reloc_count == 0)
+      if (asect->flags.reloc == 0 || asect->reloc_count == 0)
 	return true;
 
       rel_hdr = &d->rel_hdr;
--- bfd/merge.c.jj	Mon Mar  4 16:20:55 2002
+++ bfd/merge.c	Thu May 16 11:44:01 2002
@@ -1,5 +1,5 @@
-/* SEC_MERGE support.
-   Copyright 2001 Free Software Foundation, Inc.
+/* Section merging support.
+   Copyright 2001, 2002 Free Software Foundation, Inc.
    Written by Jakub Jelinek <jakub@redhat.com>.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -59,9 +59,9 @@ struct sec_merge_hash
   struct bfd_hash_table table;
   /* Next available index.  */
   bfd_size_type size;
-  /* First entity in the SEC_MERGE sections of this type.  */
+  /* First entity in the mergeable sections of this type.  */
   struct sec_merge_hash_entry *first;
-  /* Last entity in the SEC_MERGE sections of this type.  */
+  /* Last entity in the mergeable sections of this type.  */
   struct sec_merge_hash_entry *last;
   /* Entity size.  */
   unsigned int entsize;
@@ -370,12 +370,12 @@ _bfd_merge_section (abfd, psinfo, sec, p
   bfd_size_type amt;
 
   if (sec->_raw_size == 0
-      || (sec->flags & SEC_EXCLUDE)
-      || (sec->flags & SEC_MERGE) == 0
+      || sec->flags.exclude
+      || sec->flags.merge == 0
       || sec->entsize == 0)
     return true;
 
-  if ((sec->flags & SEC_RELOC) != 0)
+  if (sec->flags.reloc)
     {
       /* We aren't prepared to handle relocations in merged sections.  */
       return true;
@@ -392,7 +392,7 @@ _bfd_merge_section (abfd, psinfo, sec, p
   align = bfd_get_section_alignment (sec->owner, sec);
   if ((sec->entsize < (unsigned int)(1 << align)
        && ((sec->entsize & (sec->entsize - 1))
-	   || !(sec->flags & SEC_STRINGS)))
+	   || !sec->flags.strings))
       || (sec->entsize > (unsigned int)(1 << align)
 	  && (sec->entsize & ((1 << align) - 1))))
     {
@@ -407,7 +407,8 @@ _bfd_merge_section (abfd, psinfo, sec, p
 
   for (sinfo = (struct sec_merge_info *) *psinfo; sinfo; sinfo = sinfo->next)
     if ((secinfo = sinfo->chain)
-	&& ! ((secinfo->sec->flags ^ sec->flags) & (SEC_MERGE | SEC_STRINGS))
+	&& secinfo->sec->flags.merge == sec->flags.merge
+	&& secinfo->sec->flags.strings == sec->flags.strings
 	&& secinfo->sec->entsize == sec->entsize
 	&& ! strcmp (secinfo->sec->name, sec->name))
       break;
@@ -423,7 +424,7 @@ _bfd_merge_section (abfd, psinfo, sec, p
       sinfo->chain = NULL;
       *psinfo = (PTR) sinfo;
       sinfo->htab =
-	sec_merge_init (sec->entsize, (sec->flags & SEC_STRINGS));
+	sec_merge_init (sec->entsize, sec->flags.strings);
       if (sinfo->htab == NULL)
 	goto error_return;
     }
@@ -556,7 +557,7 @@ record_section (sinfo, secinfo)
   end = secinfo->contents + sec->_raw_size;
   nul = false;
   mask = ((bfd_vma) 1 << align) - 1;
-  if (sec->flags & SEC_STRINGS)
+  if (sec->flags.strings)
     {
       for (p = secinfo->contents; p < end; )
 	{
@@ -767,7 +768,7 @@ alloc_failure:
       }
 }
 
-/* This function is called once after all SEC_MERGE sections are registered
+/* This function is called once after all mergeable sections are registered
    with _bfd_merge_section.  */
 
 boolean
@@ -792,7 +793,7 @@ _bfd_merge_sections (abfd, xsinfo, remov
 
       /* Record the sections into the hash table.  */
       for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
-	if (secinfo->sec->flags & SEC_EXCLUDE)
+	if (secinfo->sec->flags.exclude)
 	  {
 	    *secinfo->psecinfo = NULL;
 	    if (remove_hook)
@@ -841,7 +842,7 @@ _bfd_merge_sections (abfd, xsinfo, remov
   	  if (secinfo->first == NULL)
 	    {
 	      secinfo->sec->_cooked_size = 0;
-	      secinfo->sec->flags |= SEC_EXCLUDE;
+	      secinfo->sec->flags.exclude = 1;
 	    }
     }
 
@@ -874,8 +875,8 @@ _bfd_write_merged_section (output_bfd, s
   return true;
 }
 
-/* Adjust an address in the SEC_MERGE section.  Given OFFSET within
-   *PSEC, this returns the new offset in the adjusted SEC_MERGE
+/* Adjust an address in the mergeable section.  Given OFFSET within
+   *PSEC, this returns the new offset in the adjusted mergeable
    section and writes the new section back into *PSEC.  */
 
 bfd_vma
--- bfd/binary.c.jj	Mon Apr 22 12:09:00 2002
+++ bfd/binary.c	Thu May 16 19:32:39 2002
@@ -96,7 +96,11 @@ binary_object_p (abfd)
   sec = bfd_make_section (abfd, ".data");
   if (sec == NULL)
     return NULL;
-  sec->flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS;
+  memset (&sec->flags, 0, sizeof (sec->flags));
+  sec->flags.alloc = 1;
+  sec->flags.load = 1;
+  sec->flags.data = 1;
+  sec->flags.has_contents = 1;
   sec->vma = 0;
   sec->_raw_size = statbuf.st_size;
   sec->filepos = 0;
@@ -273,9 +277,8 @@ binary_set_section_contents (abfd, sec, 
       found_low = false;
       low = 0;
       for (s = abfd->sections; s != NULL; s = s->next)
-	if (((s->flags
-	      & (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD))
-	     == (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC))
+	if (s->flags.has_contents && s->flags.load && s->flags.alloc
+	    && ! s->flags.never_load
 	    && (s->_raw_size > 0)
 	    && (! found_low || s->lma < low))
 	  {
@@ -289,9 +292,7 @@ binary_set_section_contents (abfd, sec, 
 
 	  /* Skip following warning check for sections that will not
 	     occupy file space.  */
-	  if ((s->flags
-	       & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD))
-	      != (SEC_HAS_CONTENTS | SEC_ALLOC)
+	  if ((s->flags.has_contents && s->flags.alloc && s->flags.never_load)
 	      || (s->_raw_size == 0))
 	    continue;
 
@@ -314,9 +315,9 @@ binary_set_section_contents (abfd, sec, 
   /* We don't want to output anything for a section that is neither
      loaded nor allocated.  The contents of such a section are not
      meaningful in the binary format.  */
-  if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
+  if (!sec->flags.load && !sec->flags.alloc)
     return true;
-  if ((sec->flags & SEC_NEVER_LOAD) != 0)
+  if (sec->flags.never_load)
     return true;
 
   return _bfd_generic_set_section_contents (abfd, sec, data, offset, size);
@@ -345,6 +346,21 @@ binary_sizeof_headers (abfd, exec)
 #define binary_get_section_contents_in_window \
   _bfd_generic_get_section_contents_in_window
 
+#undef SECFLAG_ALLOC
+#define SECFLAG_ALLOC 1
+#undef SECFLAG_LOAD
+#define SECFLAG_LOAD 1
+#undef SECFLAG_READONLY
+#define SECFLAG_READONLY 1
+#undef SECFLAG_CODE
+#define SECFLAG_CODE 1
+#undef SECFLAG_DATA
+#define SECFLAG_DATA 1
+#undef SECFLAG_ROM
+#define SECFLAG_ROM 1
+#undef SECFLAG_HAS_CONTENTS
+#define SECFLAG_HAS_CONTENTS 1
+
 const bfd_target binary_vec =
 {
   "binary",			/* name */
@@ -352,8 +368,7 @@ const bfd_target binary_vec =
   BFD_ENDIAN_UNKNOWN,		/* byteorder */
   BFD_ENDIAN_UNKNOWN,		/* header_byteorder */
   EXEC_P,			/* object_flags */
-  (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA
-   | SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */
+  SECFLAG_INIT,			/* section_flags */
   0,				/* symbol_leading_char */
   ' ',				/* ar_pad_char */
   16,				/* ar_max_namelen */
--- bfd/linker.c.jj	Mon Apr 22 12:09:25 2002
+++ bfd/linker.c	Thu May 16 11:41:46 2002
@@ -1239,7 +1239,9 @@ generic_link_check_archive_element (abfd
 	  else
 	    h->u.c.p->section = bfd_make_section_old_way (symbfd,
 							  p->section->name);
-	  h->u.c.p->section->flags = SEC_ALLOC;
+	  memset (&h->u.c.p->section->flags, 0,
+		  sizeof (h->u.c.p->section->flags));
+	  h->u.c.p->section->flags.alloc = 1;
 	}
       else
 	{
@@ -1710,13 +1712,17 @@ _bfd_generic_link_add_one_symbol (info, 
 	  if (section == bfd_com_section_ptr)
 	    {
 	      h->u.c.p->section = bfd_make_section_old_way (abfd, "COMMON");
-	      h->u.c.p->section->flags = SEC_ALLOC;
+	      memset (&h->u.c.p->section->flags, 0,
+		      sizeof (h->u.c.p->section->flags));
+	      h->u.c.p->section->flags.alloc = 1;
 	    }
 	  else if (section->owner != abfd)
 	    {
 	      h->u.c.p->section = bfd_make_section_old_way (abfd,
 							    section->name);
-	      h->u.c.p->section->flags = SEC_ALLOC;
+	      memset (&h->u.c.p->section->flags, 0,
+		      sizeof (h->u.c.p->section->flags));
+	      h->u.c.p->section->flags.alloc = 1;
 	    }
 	  else
 	    h->u.c.p->section = section;
@@ -1759,13 +1765,17 @@ _bfd_generic_link_add_one_symbol (info, 
 		{
 		  h->u.c.p->section
 		    = bfd_make_section_old_way (abfd, "COMMON");
-		  h->u.c.p->section->flags = SEC_ALLOC;
+		  memset (&h->u.c.p->section->flags, 0,
+			  sizeof (h->u.c.p->section->flags));
+		  h->u.c.p->section->flags.alloc = 1;
 		}
 	      else if (section->owner != abfd)
 		{
 		  h->u.c.p->section
 		    = bfd_make_section_old_way (abfd, section->name);
-		  h->u.c.p->section->flags = SEC_ALLOC;
+		  memset (&h->u.c.p->section->flags, 0,
+			  sizeof (h->u.c.p->section->flags));
+		  h->u.c.p->section->flags.alloc = 1;
 		}
 	      else
 		h->u.c.p->section = section;
@@ -2081,7 +2091,7 @@ _bfd_generic_final_link (abfd, info)
 	      o->orelocation = (arelent **) bfd_alloc (abfd, amt);
 	      if (!o->orelocation)
 		return false;
-	      o->flags |= SEC_RELOC;
+	      o->flags.reloc = 1;
 	      /* Reset the count so that it can be used as an index
 		 when putting in the output relocs.  */
 	      o->reloc_count = 0;
@@ -2345,8 +2355,7 @@ _bfd_generic_link_output_symbols (output
 		  break;
 		case discard_sec_merge:
 		  output = true;
-		  if (info->relocateable
-		      || ! (sym->section->flags & SEC_MERGE))
+		  if (info->relocateable || ! sym->section->flags.merge)
 		    break;
 		  /* FALLTHROUGH */
 		case discard_l:
@@ -2376,7 +2385,7 @@ _bfd_generic_link_output_symbols (output
 
 	 Gross.  .bss and similar sections won't have the linker_mark
 	 field set.  */
-      if ((sym->section->flags & SEC_HAS_CONTENTS) != 0
+      if (sym->section->flags.has_contents != 0
 	  && sym->section->linker_mark == false)
 	output = false;
 
@@ -2680,7 +2689,7 @@ default_data_link_order (abfd, info, sec
   file_ptr loc;
   boolean result;
 
-  BFD_ASSERT ((sec->flags & SEC_HAS_CONTENTS) != 0);
+  BFD_ASSERT (sec->flags.has_contents);
 
   size = link_order->size;
   if (size == 0)
@@ -2738,7 +2747,7 @@ default_indirect_link_order (output_bfd,
   bfd_size_type sec_size;
   file_ptr loc;
 
-  BFD_ASSERT ((output_section->flags & SEC_HAS_CONTENTS) != 0);
+  BFD_ASSERT (output_section->flags.has_contents);
 
   if (link_order->size == 0)
     return true;
--- bfd/elf.c.jj	Mon Apr 22 12:09:10 2002
+++ bfd/elf.c	Thu May 16 17:46:25 2002
@@ -542,7 +542,7 @@ _bfd_elf_make_section_from_shdr (abfd, h
      const char *name;
 {
   asection *newsect;
-  flagword flags;
+  secflagword flags;
   struct elf_backend_data *bed;
 
   if (hdr->bfd_section != NULL)
@@ -564,29 +564,32 @@ _bfd_elf_make_section_from_shdr (abfd, h
 				      bfd_log2 ((bfd_vma) hdr->sh_addralign)))
     return false;
 
-  flags = SEC_NO_FLAGS;
+  memset (&flags, 0, sizeof (flags));
   if (hdr->sh_type != SHT_NOBITS)
-    flags |= SEC_HAS_CONTENTS;
+    flags.has_contents = 1;
   if (hdr->sh_type == SHT_GROUP)
-    flags |= SEC_GROUP | SEC_EXCLUDE;
+    {
+      flags.group = 1;
+      flags.exclude = 1;
+    }
   if ((hdr->sh_flags & SHF_ALLOC) != 0)
     {
-      flags |= SEC_ALLOC;
+      flags.alloc = 1;
       if (hdr->sh_type != SHT_NOBITS)
-	flags |= SEC_LOAD;
+	flags.load = 1;
     }
   if ((hdr->sh_flags & SHF_WRITE) == 0)
-    flags |= SEC_READONLY;
+    flags.readonly = 1;
   if ((hdr->sh_flags & SHF_EXECINSTR) != 0)
-    flags |= SEC_CODE;
-  else if ((flags & SEC_LOAD) != 0)
-    flags |= SEC_DATA;
+    flags.code = 1;
+  else if (flags.load)
+    flags.data = 1;
   if ((hdr->sh_flags & SHF_MERGE) != 0)
     {
-      flags |= SEC_MERGE;
+      flags.merge = 1;
       newsect->entsize = hdr->sh_entsize;
       if ((hdr->sh_flags & SHF_STRINGS) != 0)
-	flags |= SEC_STRINGS;
+	flags.strings = 1;
     }
   if (hdr->sh_flags & SHF_GROUP)
     if (!setup_group (abfd, hdr, newsect))
@@ -609,7 +612,7 @@ _bfd_elf_make_section_from_shdr (abfd, h
 	break;
 
     if (i >= 0)
-      flags |= SEC_DEBUGGING;
+      flags.debugging = 1;
   }
 
   /* As a GNU extension, if the name begins with .gnu.linkonce, we
@@ -619,7 +622,10 @@ _bfd_elf_make_section_from_shdr (abfd, h
      are permitted.  The GNU linker extension is to actually discard
      all but one of the sections.  */
   if (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
-    flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
+    {
+      flags.link_once = 1;
+      flags.link_dups = link_dups_discard;
+    }
 
   bed = get_elf_backend_data (abfd);
   if (bed->elf_backend_section_flags)
@@ -629,7 +635,7 @@ _bfd_elf_make_section_from_shdr (abfd, h
   if (! bfd_set_section_flags (abfd, newsect, flags))
     return false;
 
-  if ((flags & SEC_ALLOC) != 0)
+  if (flags.alloc)
     {
       Elf_Internal_Phdr *phdr;
       unsigned int i;
@@ -664,15 +670,15 @@ _bfd_elf_make_section_from_shdr (abfd, h
 		  && (bfd_vma) hdr->sh_offset >= phdr->p_offset
 		  && (hdr->sh_offset + hdr->sh_size
 		      <= phdr->p_offset + phdr->p_memsz)
-		  && ((flags & SEC_LOAD) == 0
+		  && (flags.load == 0
 		      || (hdr->sh_offset + hdr->sh_size
 			  <= phdr->p_offset + phdr->p_filesz)))
 		{
-		  if ((flags & SEC_LOAD) == 0)
+		  if (flags.load == 0)
 		    newsect->lma = (phdr->p_paddr
 				    + hdr->sh_addr - phdr->p_vaddr);
 		  else
-		    /* We used to use the same adjustment for SEC_LOAD
+		    /* We used to use the same adjustment for load
 		       sections, but that doesn't work if the segment
 		       is packed with code from multiple VMAs.
 		       Instead we calculate the section LMA based on
@@ -1755,7 +1761,7 @@ bfd_section_from_shdr (abfd, shindex)
 	if (target_sect == NULL)
 	  return false;
 
-	if ((target_sect->flags & SEC_RELOC) == 0
+	if (target_sect->flags.reloc == 0
 	    || target_sect->reloc_count == 0)
 	  hdr2 = &elf_section_data (target_sect)->rel_hdr;
 	else
@@ -1769,7 +1775,7 @@ bfd_section_from_shdr (abfd, shindex)
 	*hdr2 = *hdr;
 	elf_elfsections (abfd)[shindex] = hdr2;
 	target_sect->reloc_count += NUM_SHDR_ENTRIES (hdr);
-	target_sect->flags |= SEC_RELOC;
+	target_sect->flags.reloc = 1;
 	target_sect->relocation = NULL;
 	target_sect->rel_filepos = hdr->sh_offset;
 	/* In the section to which the relocations apply, mark whether
@@ -1989,21 +1995,21 @@ _bfd_elf_make_section_from_phdr (abfd, h
   newsect->lma = hdr->p_paddr;
   newsect->_raw_size = hdr->p_filesz;
   newsect->filepos = hdr->p_offset;
-  newsect->flags |= SEC_HAS_CONTENTS;
+  newsect->flags.has_contents = 1;
   if (hdr->p_type == PT_LOAD)
     {
-      newsect->flags |= SEC_ALLOC;
-      newsect->flags |= SEC_LOAD;
+      newsect->flags.alloc = 1;
+      newsect->flags.load = 1;
       if (hdr->p_flags & PF_X)
 	{
 	  /* FIXME: all we known is that it has execute PERMISSION,
 	     may be data.  */
-	  newsect->flags |= SEC_CODE;
+	  newsect->flags.code = 1;
 	}
     }
   if (!(hdr->p_flags & PF_W))
     {
-      newsect->flags |= SEC_READONLY;
+      newsect->flags.readonly = 1;
     }
 
   if (split)
@@ -2021,12 +2027,12 @@ _bfd_elf_make_section_from_phdr (abfd, h
       newsect->_raw_size = hdr->p_memsz - hdr->p_filesz;
       if (hdr->p_type == PT_LOAD)
 	{
-	  newsect->flags |= SEC_ALLOC;
+	  newsect->flags.alloc = 1;
 	  if (hdr->p_flags & PF_X)
-	    newsect->flags |= SEC_CODE;
+	    newsect->flags.code = 1;
 	}
       if (!(hdr->p_flags & PF_W))
-	newsect->flags |= SEC_READONLY;
+	newsect->flags.readonly = 1;
     }
 
   return true;
@@ -2146,8 +2152,7 @@ elf_fake_sections (abfd, asect, failedpt
 
   this_hdr->sh_flags = 0;
 
-  if ((asect->flags & SEC_ALLOC) != 0
-      || asect->user_set_vma)
+  if (asect->flags.alooc || asect->user_set_vma)
     this_hdr->sh_addr = asect->vma;
   else
     this_hdr->sh_addr = 0;
@@ -2234,29 +2239,29 @@ elf_fake_sections (abfd, asect, failedpt
 	BFD_ASSERT (elf_tdata (abfd)->cverrefs == 0
 		    || this_hdr->sh_info == elf_tdata (abfd)->cverrefs);
     }
-  else if ((asect->flags & SEC_GROUP) != 0)
+  else if (asect->flags.group)
     {
       this_hdr->sh_type = SHT_GROUP;
       this_hdr->sh_entsize = 4;
     }
-  else if ((asect->flags & SEC_ALLOC) != 0
-	   && (((asect->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
-	       || (asect->flags & SEC_NEVER_LOAD) != 0))
+  else if (asect->flags.alloc
+	   && ((asect->flags.load == 0 && asect->flags.has_contents == 0)
+	       || asect->flags.never_load))
     this_hdr->sh_type = SHT_NOBITS;
   else
     this_hdr->sh_type = SHT_PROGBITS;
 
-  if ((asect->flags & SEC_ALLOC) != 0)
+  if (asect->flags.alloc)
     this_hdr->sh_flags |= SHF_ALLOC;
-  if ((asect->flags & SEC_READONLY) == 0)
+  if (asect->flags.readonly == 0)
     this_hdr->sh_flags |= SHF_WRITE;
-  if ((asect->flags & SEC_CODE) != 0)
+  if (asect->flags.code)
     this_hdr->sh_flags |= SHF_EXECINSTR;
-  if ((asect->flags & SEC_MERGE) != 0)
+  if (asect->flags.merge)
     {
       this_hdr->sh_flags |= SHF_MERGE;
       this_hdr->sh_entsize = asect->entsize;
-      if ((asect->flags & SEC_STRINGS) != 0)
+      if (asect->flags.strings)
 	this_hdr->sh_flags |= SHF_STRINGS;
     }
   if (elf_group_name (asect) != NULL)
@@ -2271,7 +2276,7 @@ elf_fake_sections (abfd, asect, failedpt
      SHT_REL[A] section.  If two relocation sections are required for
      this section, it is up to the processor-specific back-end to
      create the other.  */
-  if ((asect->flags & SEC_RELOC) != 0
+  if (asect->flags.reloc
       && !_bfd_elf_init_reloc_shdr (abfd,
 				    &elf_section_data (asect)->rel_hdr,
 				    asect,
@@ -2382,7 +2387,7 @@ assign_section_numbers (abfd)
 	section_number += SHN_HIRESERVE + 1 - SHN_LORESERVE;
       d->this_idx = section_number++;
       _bfd_elf_strtab_addref (elf_shstrtab (abfd), d->this_hdr.sh_name);
-      if ((sec->flags & SEC_RELOC) == 0)
+      if (sec->flags.reloc == 0)
 	d->rel_idx = 0;
       else
 	{
@@ -2962,7 +2967,7 @@ map_sections_to_segments (abfd)
   i = 0;
   for (s = abfd->sections; s != NULL; s = s->next)
     {
-      if ((s->flags & SEC_ALLOC) != 0)
+      if (s->flags.alloc)
 	{
 	  sections[i] = s;
 	  ++i;
@@ -2982,7 +2987,7 @@ map_sections_to_segments (abfd)
      the program headers and a PT_INTERP segment for the .interp
      section.  */
   s = bfd_get_section_by_name (abfd, ".interp");
-  if (s != NULL && (s->flags & SEC_LOAD) != 0)
+  if (s != NULL && s->flags.load)
     {
       amt = sizeof (struct elf_segment_map);
       m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
@@ -3019,8 +3024,7 @@ map_sections_to_segments (abfd)
   maxpagesize = get_elf_backend_data (abfd)->maxpagesize;
   writable = false;
   dynsec = bfd_get_section_by_name (abfd, ".dynamic");
-  if (dynsec != NULL
-      && (dynsec->flags & SEC_LOAD) == 0)
+  if (dynsec != NULL && dynsec->flags.load == 0)
     dynsec = NULL;
 
   /* Deal with -Ttext or something similar such that the first section
@@ -3070,8 +3074,7 @@ map_sections_to_segments (abfd)
              skip a page in the segment, then we need a new segment.  */
 	  new_segment = true;
 	}
-      else if ((last_hdr->flags & SEC_LOAD) == 0
-	       && (hdr->flags & SEC_LOAD) != 0)
+      else if (last_hdr->flags.load == 0 && hdr->flags.load)
 	{
 	  /* We don't want to put a loadable section after a
              nonloadable section in the same segment.  */
@@ -3085,7 +3088,7 @@ map_sections_to_segments (abfd)
 	  new_segment = false;
 	}
       else if (! writable
-	       && (hdr->flags & SEC_READONLY) == 0
+	       && hdr->flags.readonly == 0
 	       && (BFD_ALIGN (last_hdr->lma + last_hdr->_raw_size, maxpagesize)
 		   == hdr->lma))
 	{
@@ -3106,7 +3109,7 @@ map_sections_to_segments (abfd)
 
       if (! new_segment)
 	{
-	  if ((hdr->flags & SEC_READONLY) == 0)
+	  if (hdr->flags.readonly == 0)
 	    writable = true;
 	  last_hdr = hdr;
 	  continue;
@@ -3122,7 +3125,7 @@ map_sections_to_segments (abfd)
       *pm = m;
       pm = &m->next;
 
-      if ((hdr->flags & SEC_READONLY) == 0)
+      if (hdr->flags.readonly == 0)
 	writable = true;
       else
 	writable = false;
@@ -3166,8 +3169,7 @@ map_sections_to_segments (abfd)
      names for section types is bogus anyhow.  */
   for (s = abfd->sections; s != NULL; s = s->next)
     {
-      if ((s->flags & SEC_LOAD) != 0
-	  && strncmp (s->name, ".note", 5) == 0)
+      if (s->flags.load && strncmp (s->name, ".note", 5) == 0)
 	{
 	  amt = sizeof (struct elf_segment_map);
 	  m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
@@ -3188,7 +3190,7 @@ map_sections_to_segments (abfd)
   eh_frame_hdr = NULL;
   if (elf_tdata (abfd)->eh_frame_hdr)
     eh_frame_hdr = bfd_get_section_by_name (abfd, ".eh_frame_hdr");
-  if (eh_frame_hdr != NULL && (eh_frame_hdr->flags & SEC_LOAD))
+  if (eh_frame_hdr != NULL && eh_frame_hdr->flags.load)
     {
       amt = sizeof (struct elf_segment_map);
       m = (struct elf_segment_map *) bfd_zalloc (abfd, amt);
@@ -3239,9 +3241,9 @@ elf_sort_sections (arg1, arg2)
   else if (sec1->vma > sec2->vma)
     return 1;
 
-  /* Put !SEC_LOAD sections after SEC_LOAD ones.  */
+  /* Put !load sections after load ones.  */
 
-#define TOEND(x) (((x)->flags & SEC_LOAD) == 0)
+#define TOEND(x) ((x)->flags.load == 0)
 
   if (TOEND (sec1))
     {
@@ -3365,7 +3367,7 @@ assign_file_positions_for_segments (abfd
 
       if (p->p_type == PT_LOAD
 	  && m->count > 0
-	  && (m->sections[0]->flags & SEC_ALLOC) != 0)
+	  && m->sections[0]->flags.alloc)
 	{
 	  if ((abfd->flags & D_PAGED) != 0)
 	    off += (m->sections[0]->vma - off) % bed->maxpagesize;
@@ -3499,7 +3501,7 @@ assign_file_positions_for_segments (abfd
       for (i = 0, secpp = m->sections; i < m->count; i++, secpp++)
 	{
 	  asection *sec;
-	  flagword flags;
+	  secflagword flags;
 	  bfd_size_type align;
 
 	  sec = *secpp;
@@ -3516,7 +3518,7 @@ assign_file_positions_for_segments (abfd
 	      p->p_memsz += adjust;
 	      off += adjust;
 	      voff += adjust;
-	      if ((flags & SEC_LOAD) != 0)
+	      if (flags.load)
 		p->p_filesz += adjust;
 	    }
 
@@ -3524,18 +3526,18 @@ assign_file_positions_for_segments (abfd
 	    {
 	      bfd_signed_vma adjust;
 
-	      if ((flags & SEC_LOAD) != 0)
+	      if (flags.load != 0)
 		{
 		  adjust = sec->lma - (p->p_paddr + p->p_memsz);
 		  if (adjust < 0)
 		    adjust = 0;
 		}
-	      else if ((flags & SEC_ALLOC) != 0)
+	      else if (flags.alloc)
 		{
 		  /* The section VMA must equal the file position
 		     modulo the page size.  FIXME: I'm not sure if
 		     this adjustment is really necessary.  We used to
-		     not have the SEC_LOAD case just above, and then
+		     not have the load case just above, and then
 		     this was necessary, but now I'm not sure.  */
 		  if ((abfd->flags & D_PAGED) != 0)
 		    adjust = (sec->vma - voff) % bed->maxpagesize;
@@ -3559,21 +3561,20 @@ Error: First section in segment (%s) sta
 		  p->p_memsz += adjust;
 		  off += adjust;
 		  voff += adjust;
-		  if ((flags & SEC_LOAD) != 0)
+		  if (flags.load)
 		    p->p_filesz += adjust;
 		}
 
 	      sec->filepos = off;
 
-	      /* We check SEC_HAS_CONTENTS here because if NOLOAD is
+	      /* We check has_contents flag here because if NOLOAD is
                  used in a linker script we may have a section with
-                 SEC_LOAD clear but which is supposed to have
+                 load clear but which is supposed to have
                  contents.  */
-	      if ((flags & SEC_LOAD) != 0
-		  || (flags & SEC_HAS_CONTENTS) != 0)
+	      if (flags.load || flags.has_contents)
 		off += sec->_raw_size;
 
-	      if ((flags & SEC_ALLOC) != 0)
+	      if (flags.alloc)
 		voff += sec->_raw_size;
 	    }
 
@@ -3602,7 +3603,7 @@ Error: First section in segment (%s) sta
 	    {
 	      p->p_memsz += sec->_raw_size;
 
-	      if ((flags & SEC_LOAD) != 0)
+	      if (flags.load)
 		p->p_filesz += sec->_raw_size;
 
 	      if (align > p->p_align
@@ -3613,9 +3614,9 @@ Error: First section in segment (%s) sta
 	  if (! m->p_flags_valid)
 	    {
 	      p->p_flags |= PF_R;
-	      if ((flags & SEC_CODE) != 0)
+	      if (flags.code)
 		p->p_flags |= PF_X;
-	      if ((flags & SEC_READONLY) == 0)
+	      if (flags.readonly == 0)
 		p->p_flags |= PF_W;
 	    }
 	}
@@ -3707,7 +3708,7 @@ get_program_header_size (abfd)
   segs = 2;
 
   s = bfd_get_section_by_name (abfd, ".interp");
-  if (s != NULL && (s->flags & SEC_LOAD) != 0)
+  if (s != NULL && s->flags.load)
     {
       /* If we have a loadable interpreter section, we need a
 	 PT_INTERP segment.  In this case, assume we also need a
@@ -3731,8 +3732,7 @@ get_program_header_size (abfd)
 
   for (s = abfd->sections; s != NULL; s = s->next)
     {
-      if ((s->flags & SEC_LOAD) != 0
-	  && strncmp (s->name, ".note", 5) == 0)
+      if (s->flags.load && strncmp (s->name, ".note", 5) == 0)
 	{
 	  /* We need a PT_NOTE segment.  */
 	  ++segs;
@@ -4247,7 +4247,7 @@ copy_private_bfd_data (ibfd, obfd)
 #define IS_SOLARIS_PT_INTERP(p, s)			\
 	    (   p->p_vaddr == 0				\
 	     && p->p_filesz > 0				\
-	     && (s->flags & SEC_HAS_CONTENTS) != 0	\
+	     && s->flags.has_contents			\
 	     && s->_raw_size > 0			\
 	     && (bfd_vma) s->filepos >= p->p_offset	\
 	     && ((bfd_vma) s->filepos + s->_raw_size	\
@@ -4265,7 +4265,7 @@ copy_private_bfd_data (ibfd, obfd)
        ? IS_CONTAINED_BY_LMA (section, segment, segment->p_paddr)	\
        : IS_CONTAINED_BY_VMA (section, segment))			\
       || IS_SOLARIS_PT_INTERP (segment, section))			\
-     && (section->flags & SEC_ALLOC) != 0)				\
+     && section->flags.alloc)						\
     || IS_COREFILE_NOTE (segment, section))				\
    && section->output_section != NULL					\
    && section->segment_mark == false)
@@ -4762,12 +4762,12 @@ _bfd_elf_copy_private_section_data (ibfd
     {
       asection *s;
 
-      /* Only set up the segments if there are no more SEC_ALLOC
+      /* Only set up the segments if there are no more alloc
          sections.  FIXME: This won't do the right thing if objcopy is
-         used to remove the last SEC_ALLOC section, since objcopy
+         used to remove the last alloc section, since objcopy
          won't call this routine in that case.  */
       for (s = isec->next; s != NULL; s = s->next)
-	if ((s->flags & SEC_ALLOC) != 0)
+	if (s->flags.alloc)
 	  break;
       if (s == NULL)
 	{
@@ -5943,7 +5943,8 @@ _bfd_elfcore_make_pseudosection (abfd, n
     return false;
   sect->_raw_size = size;
   sect->filepos = filepos;
-  sect->flags = SEC_HAS_CONTENTS;
+  memset (&sect->flags, 0, sizeof (sect->flags));
+  sect->flags.has_contents = 1;
   sect->alignment_power = 2;
 
   return elfcore_maybe_make_sect (abfd, name, sect);
@@ -6258,7 +6259,8 @@ elfcore_grok_lwpstatus (abfd, note)
   sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_reg);
 #endif
 
-  sect->flags = SEC_HAS_CONTENTS;
+  memset (&sect->flags, 0, sizeof (sect->flags));
+  sect->flags.has_contents = 1;
   sect->alignment_power = 2;
 
   if (!elfcore_maybe_make_sect (abfd, ".reg", sect))
@@ -6287,7 +6289,8 @@ elfcore_grok_lwpstatus (abfd, note)
   sect->filepos = note->descpos + offsetof (lwpstatus_t, pr_fpreg);
 #endif
 
-  sect->flags = SEC_HAS_CONTENTS;
+  memset (&sect->flags, 0, sizeof (sect->flags));
+  sect->flags.has_contents = 1;
   sect->alignment_power = 2;
 
   return elfcore_maybe_make_sect (abfd, ".reg2", sect);
@@ -6336,7 +6339,8 @@ elfcore_grok_win32pstatus (abfd, note)
       sect->filepos = (note->descpos
 		       + offsetof (struct win32_pstatus,
 				   data.thread_info.thread_context));
-      sect->flags = SEC_HAS_CONTENTS;
+      memset (&sect->flags, 0, sizeof (sect->flags));
+      sect->flags.has_contents = 1;
       sect->alignment_power = 2;
 
       if (pstatus.data.thread_info.is_active_thread)
@@ -6361,7 +6365,8 @@ elfcore_grok_win32pstatus (abfd, note)
 
       sect->_raw_size = note->descsz;
       sect->filepos = note->descpos;
-      sect->flags = SEC_HAS_CONTENTS;
+      memset (&sect->flags, 0, sizeof (sect->flags));
+      sect->flags.has_contents = 1;
       sect->alignment_power = 2;
       break;
 
@@ -6897,7 +6902,7 @@ _bfd_elf_rela_local_sym (abfd, sym, sec,
   relocation = (sec->output_section->vma
 		+ sec->output_offset
 		+ sym->st_value);
-  if ((sec->flags & SEC_MERGE)
+  if (sec->flags.merge
       && ELF_ST_TYPE (sym->st_info) == STT_SECTION
       && elf_section_data (sec)->sec_info_type == ELF_INFO_TYPE_MERGE)
     {
--- bfd/elf32-i386.c.jj	Tue May 14 11:50:11 2002
+++ bfd/elf32-i386.c	Thu May 16 17:45:37 2002
@@ -578,6 +578,7 @@ create_got_section (dynobj, info)
      struct bfd_link_info *info;
 {
   struct elf_i386_link_hash_table *htab;
+  secflagword flags;
 
   if (! _bfd_elf_create_got_section (dynobj, info))
     return false;
@@ -589,11 +590,15 @@ create_got_section (dynobj, info)
     abort ();
 
   htab->srelgot = bfd_make_section (dynobj, ".rel.got");
+  memset (&flags, 0, sizeof (flags));
+  flags.alloc = 1;
+  flags.load = 1;
+  flags.has_contents = 1;
+  flags.in_memory = 1;
+  flags.linker_created = 1;
+  flags.readonly = 1;
   if (htab->srelgot == NULL
-      || ! bfd_set_section_flags (dynobj, htab->srelgot,
-				  (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS
-				   | SEC_IN_MEMORY | SEC_LINKER_CREATED
-				   | SEC_READONLY))
+      || ! bfd_set_section_flags (dynobj, htab->srelgot, flags)
       || ! bfd_set_section_alignment (dynobj, htab->srelgot, 2))
     return false;
   return true;
@@ -823,7 +828,7 @@ elf_i386_check_relocs (abfd, info, sec, 
 	     dynamic library if we manage to avoid copy relocs for the
 	     symbol.  */
 	  if ((info->shared
-	       && (sec->flags & SEC_ALLOC) != 0
+	       && sec->flags.alloc
 	       && (ELF32_R_TYPE (rel->r_info) != R_386_PC32
 		   || (h != NULL
 		       && (! info->symbolic
@@ -831,7 +836,7 @@ elf_i386_check_relocs (abfd, info, sec, 
 			   || (h->elf_link_hash_flags
 			       & ELF_LINK_HASH_DEF_REGULAR) == 0))))
 	      || (!info->shared
-		  && (sec->flags & SEC_ALLOC) != 0
+		  && sec->flags.alloc
 		  && h != NULL
 		  && (h->root.type == bfd_link_hash_defweak
 		      || (h->elf_link_hash_flags
@@ -870,13 +875,17 @@ elf_i386_check_relocs (abfd, info, sec, 
 		  sreloc = bfd_get_section_by_name (dynobj, name);
 		  if (sreloc == NULL)
 		    {
-		      flagword flags;
+		      secflagword flags;
 
 		      sreloc = bfd_make_section (dynobj, name);
-		      flags = (SEC_HAS_CONTENTS | SEC_READONLY
-			       | SEC_IN_MEMORY | SEC_LINKER_CREATED);
-		      if ((sec->flags & SEC_ALLOC) != 0)
-			flags |= SEC_ALLOC | SEC_LOAD;
+	      	      memset (&flags, 0, sizeof (flags));
+		      flags.has_contents = 1;
+		      flags.readonly = 1;
+		      flags.in_memory = 1;
+		      flags.linker_created = 1;
+		      flags.alloc = sec->flags.alloc;
+		      if (sec->flags.alloc)
+			flags.load = 1;
 		      if (sreloc == NULL
 			  || ! bfd_set_section_flags (dynobj, sreloc, flags)
 			  || ! bfd_set_section_alignment (dynobj, sreloc, 2))
@@ -1168,7 +1177,7 @@ elf_i386_adjust_dynamic_symbol (info, h)
   for (p = eh->dyn_relocs; p != NULL; p = p->next)
     {
       s = p->sec->output_section;
-      if (s != NULL && (s->flags & SEC_READONLY) != 0)
+      if (s != NULL && s->flags.readonly)
 	break;
     }
 
@@ -1195,7 +1204,7 @@ elf_i386_adjust_dynamic_symbol (info, h)
   /* We must generate a R_386_COPY reloc to tell the dynamic linker to
      copy the initial value out of the dynamic object and into the
      runtime process image.  */
-  if ((h->root.u.def.section->flags & SEC_ALLOC) != 0)
+  if (h->root.u.def.section->flags.alloc)
     {
       htab->srelbss->_raw_size += sizeof (Elf32_External_Rel);
       h->elf_link_hash_flags |= ELF_LINK_HASH_NEEDS_COPY;
@@ -1433,7 +1442,7 @@ readonly_dynrelocs (h, inf)
     {
       asection *s = p->sec->output_section;
 
-      if (s != NULL && (s->flags & SEC_READONLY) != 0)
+      if (s != NULL && s->flags.readonly)
 	{
 	  struct bfd_link_info *info = (struct bfd_link_info *) inf;
 
@@ -1511,7 +1520,7 @@ elf_i386_size_dynamic_sections (output_b
 		{
 		  srel = elf_section_data (p->sec)->sreloc;
 		  srel->_raw_size += p->count * sizeof (Elf32_External_Rel);
-		  if ((p->sec->output_section->flags & SEC_READONLY) != 0)
+		  if (p->sec->output_section->flags.readonly)
 		    info->flags |= DF_TEXTREL;
 		}
 	    }
@@ -1549,7 +1558,7 @@ elf_i386_size_dynamic_sections (output_b
   relocs = false;
   for (s = dynobj->sections; s != NULL; s = s->next)
     {
-      if ((s->flags & SEC_LINKER_CREATED) == 0)
+      if (s->flags.linker_created == 0)
 	continue;
 
       if (s == htab->splt
@@ -1798,7 +1807,7 @@ elf_i386_relocate_section (output_bfd, i
 	  relocation = (sec->output_section->vma
 			+ sec->output_offset
 			+ sym->st_value);
-	  if ((sec->flags & SEC_MERGE)
+	  if (sec->flags.merge)
 	      && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
 	    {
 	      asection *msec;
@@ -2040,8 +2049,7 @@ elf_i386_relocate_section (output_bfd, i
 	  /* r_symndx will be zero only for relocs against symbols
 	     from removed linkonce sections, or sections discarded by
 	     a linker script.  */
-	  if (r_symndx == 0
-	      || (input_section->flags & SEC_ALLOC) == 0)
+	  if (r_symndx == 0 || input_section->flags.alloc == 0)
 	    break;
 
 	  if ((info->shared
@@ -2124,12 +2132,12 @@ elf_i386_relocate_section (output_bfd, i
 
       /* FIXME: Why do we allow debugging sections to escape this error?
 	 More importantly, why do we not emit dynamic relocs for
-	 R_386_32 above in debugging sections (which are ! SEC_ALLOC)?
+	 R_386_32 above in debugging sections (which are ! alloc)?
 	 If we had emitted the dynamic reloc, we could remove the
 	 fudge here.  */
       if (unresolved_reloc
 	  && !(info->shared
-	       && (input_section->flags & SEC_DEBUGGING) != 0
+	       && input_section->flags.debugging
 	       && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0))
 	(*_bfd_error_handler)
 	  (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"),
--- bfd/elf-eh-frame.c.jj	Mon Apr 22 19:49:44 2002
+++ bfd/elf-eh-frame.c	Thu May 16 17:04:13 2002
@@ -720,7 +720,7 @@ _bfd_elf_discard_section_eh_frame (abfd,
   /* Shrink the sec as needed.  */
   sec->_cooked_size = new_size;
   if (sec->_cooked_size == 0)
-    sec->flags |= SEC_EXCLUDE;
+    sec->flags.exclude = 1;
 
   free (ehbuf);
   return new_size != sec->_raw_size;
--- bfd/libcoff.h.jj	Mon Apr 22 12:09:25 2002
+++ bfd/libcoff.h	Thu May 16 18:27:22 2002
@@ -740,7 +740,7 @@ typedef struct
     PARAMS ((bfd *, PTR, PTR));
 
   boolean (*_bfd_styp_to_sec_flags_hook)
-    PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
+    PARAMS ((bfd *, PTR, const char *, asection *, secflagword *));
 
   void (*_bfd_set_alignment_hook)
     PARAMS ((bfd *, asection *, PTR));
--- bfd/coffgen.c.jj	Mon Jan 28 14:42:09 2002
+++ bfd/coffgen.c	Thu May 16 18:24:32 2002
@@ -83,7 +83,7 @@ make_a_section_from_file (abfd, hdr, tar
   asection *return_section;
   char *name;
   boolean result = true;
-  flagword flags;
+  secflagword flags;
 
   name = NULL;
 
@@ -153,14 +153,14 @@ make_a_section_from_file (abfd, hdr, tar
 
   /* At least on i386-coff, the line number count for a shared library
      section must be ignored.  */
-  if ((return_section->flags & SEC_COFF_SHARED_LIBRARY) != 0)
+  if (return_section->flags.coff_shared_library)
     return_section->lineno_count = 0;
 
   if (hdr->s_nreloc != 0)
-    return_section->flags |= SEC_RELOC;
+    return_section->flags.reloc = 1;
   /* FIXME: should this check 'hdr->s_size > 0' */
   if (hdr->s_scnptr != 0)
-    return_section->flags |= SEC_HAS_CONTENTS;
+    return_section->flags.has_contents = 1;
 
   return result;
 }
--- bfd/coffcode.h.jj	Tue May 14 11:50:08 2002
+++ bfd/coffcode.h	Thu May 16 18:26:30 2002
@@ -309,9 +309,9 @@ CODE_FRAGMENT
 
 #define STRING_SIZE_SIZE (4)
 
-static long sec_to_styp_flags PARAMS ((const char *, flagword));
+static long sec_to_styp_flags PARAMS ((const char *, secflagword));
 static boolean styp_to_sec_flags
-  PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
+  PARAMS ((bfd *, PTR, const char *, asection *, secflagword *));
 static boolean coff_bad_format_hook PARAMS ((bfd *, PTR));
 static void coff_set_custom_section_alignment
   PARAMS ((bfd *, asection *, const struct coff_section_alignment_entry *,
@@ -1201,7 +1201,7 @@ Special entry points for gdb to swap in 
 .    PARAMS ((bfd *, PTR, PTR));
 .
 .  boolean (*_bfd_styp_to_sec_flags_hook)
-.    PARAMS ((bfd *, PTR, const char *, asection *, flagword *));
+.    PARAMS ((bfd *, PTR, const char *, asection *, secflagword *));
 .
 .  void (*_bfd_set_alignment_hook)
 .    PARAMS ((bfd *, asection *, PTR));
--- bfd/srec.c.jj	Mon Apr 22 12:09:28 2002
+++ bfd/srec.c	Thu May 16 19:30:39 2002
@@ -582,7 +582,10 @@ srec_scan (abfd)
 		    sec = bfd_make_section (abfd, secname);
 		    if (sec == NULL)
 		      goto error_return;
-		    sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
+		    memset (&sec->flags, 0, sizeof (sec->flags));
+		    sec->flags.has_contents = 1;
+		    sec->flags.load = 1;
+		    sec->flags.alloc = 1;
 		    sec->vma = address;
 		    sec->lma = address;
 		    sec->_raw_size = bytes;
@@ -871,9 +874,7 @@ srec_set_section_contents (abfd, section
   if (entry == NULL)
     return false;
 
-  if (bytes_to_do
-      && (section->flags & SEC_ALLOC)
-      && (section->flags & SEC_LOAD))
+  if (bytes_to_do && section->flags.alloc && section->flags.load)
     {
       bfd_byte *data;
 
@@ -1276,6 +1277,21 @@ srec_print_symbol (abfd, afile, symbol, 
 #define srec_bfd_final_link _bfd_generic_final_link
 #define srec_bfd_link_split_section _bfd_generic_link_split_section
 
+#undef SECFLAG_CODE
+#define SECFLAG_CODE 1
+#undef SECFLAG_DATA
+#define SECFLAG_DATA 1
+#undef SECFLAG_ROM
+#define SECFLAG_ROM 1
+#undef SECFLAG_HAS_CONTENTS
+#define SECFLAG_HAS_CONTENTS 1
+#undef SECFLAG_ALLOC
+#define SECFLAG_ALLOC 1
+#undef SECFLAG_LOAD
+#define SECFLAG_LOAD 1
+#undef SECFLAG_RELOC
+#define SECFLAG_RELOC 1
+
 const bfd_target srec_vec =
 {
   "srec",			/* name */
@@ -1285,8 +1301,7 @@ const bfd_target srec_vec =
   (HAS_RELOC | EXEC_P |		/* object flags */
    HAS_LINENO | HAS_DEBUG |
    HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-  (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
-   | SEC_ALLOC | SEC_LOAD | SEC_RELOC),	/* section flags */
+  SECFLAG_INIT,			/* section flags */
   0,				/* leading underscore */
   ' ',				/* ar_pad_char */
   16,				/* ar_max_namelen */
@@ -1340,8 +1355,7 @@ const bfd_target symbolsrec_vec =
   (HAS_RELOC | EXEC_P |		/* object flags */
    HAS_LINENO | HAS_DEBUG |
    HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
-  (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
-   | SEC_ALLOC | SEC_LOAD | SEC_RELOC),	/* section flags */
+  SECFLAG_INIT,			/* section flags */
   0,				/* leading underscore */
   ' ',				/* ar_pad_char */
   16,				/* ar_max_namelen */
--- bfd/targets.c.jj	Mon Apr 22 12:09:29 2002
+++ bfd/targets.c	Thu May 16 19:10:24 2002
@@ -182,9 +182,9 @@ DESCRIPTION
 .     from the set <<BFD_NO_FLAGS>>, <<HAS_RELOC>>, ...<<D_PAGED>>.  *}
 .  flagword object_flags;
 .
-. {* A mask of all the flags which a section may have set - from
-.    the set <<SEC_NO_FLAGS>>, <<SEC_ALLOC>>, ...<<SET_NEVER_LOAD>>.  *}
-.  flagword section_flags;
+. {* A bitfield with all the flags which a section may have set - from
+.    the set <<alloc>>, ...<<never_load>>.  *}
+.  secflagword section_flags;
 .
 . {* The character normally found at the front of a symbol.
 .    (if any), perhaps `_'.  *}
@@ -428,7 +428,7 @@ the tokens.
 .  {* Remove sections that are not referenced from the output.  *}
 .  boolean  (*_bfd_gc_sections) PARAMS ((bfd *, struct bfd_link_info *));
 .
-.  {* Attempt to merge SEC_MERGE sections.  *}
+.  {* Attempt to merge mergeable sections.  *}
 .  boolean  (*_bfd_merge_sections) PARAMS ((bfd *, struct bfd_link_info *));
 .
 .  {* Routines to handle dynamic symbols and relocs.  *}
--- bfd/tekhex.c.jj	Mon Apr 22 12:09:29 2002
+++ bfd/tekhex.c	Thu May 16 19:35:02 2002
@@ -434,7 +434,10 @@ first_phase (abfd, type, src)
 	      src++;
 	      section->vma = getvalue (&src);
 	      section->_raw_size = getvalue (&src) - section->vma;
-	      section->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
+	      memset (&section->flags, 0, sizeof (section->flags));
+	      section->flags.has_contents = 1;
+	      section->flags.load = 1;
+	      section->flags.alloc = 1;
 	      break;
 	    case '0':
 	    case '2':
@@ -651,7 +654,7 @@ tekhex_get_section_contents (abfd, secti
      file_ptr offset;
      bfd_size_type count;
 {
-  if (section->flags & (SEC_LOAD | SEC_ALLOC))
+  if (section->flags.load || section->flags.alloc)
     {
       move_section_contents (abfd, section, locationp, offset, count, true);
       return true;
@@ -689,7 +692,7 @@ tekhex_set_section_contents (abfd, secti
 
       for (s = abfd->sections; s; s = s->next)
 	{
-	  if (s->flags & SEC_LOAD)
+	  if (s->flags.load)
 	    {
 	      for (vma = s->vma & ~(bfd_vma) CHUNK_MASK;
 		   vma < s->vma + s->_raw_size;
@@ -699,7 +702,7 @@ tekhex_set_section_contents (abfd, secti
 	}
 
     }
-  if (section->flags & (SEC_LOAD | SEC_ALLOC))
+  if (section->flags.load || section->flags.alloc)
     {
       move_section_contents (abfd, section, locationp, offset, bytes_to_do,
 			     false);
@@ -1014,6 +1017,21 @@ tekhex_print_symbol (abfd, filep, symbol
 #define tekhex_get_section_contents_in_window \
   _bfd_generic_get_section_contents_in_window
 
+#undef SECFLAG_CODE
+#define SECFLAG_CODE 1
+#undef SECFLAG_DATA
+#define SECFLAG_DATA 1
+#undef SECFLAG_ROM
+#define SECFLAG_ROM 1
+#undef SECFLAG_HAS_CONTENTS
+#define SECFLAG_HAS_CONTENTS 1
+#undef SECFLAG_ALLOC
+#define SECFLAG_ALLOC 1
+#undef SECFLAG_LOAD
+#define SECFLAG_LOAD 1
+#undef SECFLAG_RELOC
+#define SECFLAG_RELOC 1
+
 const bfd_target tekhex_vec =
 {
   "tekhex",			/* name */
@@ -1023,8 +1041,7 @@ const bfd_target tekhex_vec =
   (EXEC_P |			/* object flags */
    HAS_SYMS | HAS_LINENO | HAS_DEBUG | HAS_RELOC | HAS_LOCALS |
    WP_TEXT | D_PAGED),
-  (SEC_CODE | SEC_DATA | SEC_ROM | SEC_HAS_CONTENTS
-   | SEC_ALLOC | SEC_LOAD | SEC_RELOC),	/* section flags */
+  SECFLAG_INIT,			/* section flags */
   0,				/* leading underscore */
   ' ',				/* ar_pad_char */
   16,				/* ar_max_namelen */
--- bfd/ihex.c.jj	Mon Apr 22 12:09:23 2002
+++ bfd/ihex.c	Thu May 16 19:48:28 2002
@@ -396,7 +396,10 @@ ihex_scan (abfd)
 		  sec = bfd_make_section (abfd, secname);
 		  if (sec == NULL)
 		    goto error_return;
-		  sec->flags = SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC;
+		  memset (&sec->flags, 0, sizeof (sec->flags));
+		  sec->flags.has_contents = 1;
+		  sec->flags.load = 1;
+		  sec->flags.alloc = 1;
 		  sec->vma = extbase + segbase + addr;
 		  sec->lma = extbase + segbase + addr;
 		  sec->_raw_size = len;
@@ -696,9 +699,7 @@ ihex_set_section_contents (abfd, section
   struct ihex_data_struct *tdata;
   bfd_size_type amt;
 
-  if (count == 0
-      || (section->flags & SEC_ALLOC) == 0
-      || (section->flags & SEC_LOAD) == 0)
+  if (count == 0 || ! section->flags.alloc || ! section->flags.load)
     return true;
 
   amt = sizeof (struct ihex_data_list);
@@ -985,6 +986,13 @@ ihex_sizeof_headers (abfd, exec)
 
 /* The Intel Hex target vector.  */
 
+#undef SECFLAG_HAS_CONTENTS
+#define SECFLAG_HAS_CONTENTS 1
+#undef SECFLAG_ALLOC
+#define SECFLAG_ALLOC 1
+#undef SECFLAG_LOAD
+#define SECFLAG_LOAD 1
+
 const bfd_target ihex_vec =
 {
   "ihex",			/* name */
@@ -992,7 +1000,7 @@ const bfd_target ihex_vec =
   BFD_ENDIAN_UNKNOWN,		/* target byte order */
   BFD_ENDIAN_UNKNOWN,		/* target headers byte order */
   0,				/* object flags */
-  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD),	/* section flags */
+  SECFLAG_INIT,			/* section flags */
   0,				/* leading underscore */
   ' ',				/* ar_pad_char */
   16,				/* ar_max_namelen */


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]