bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ignore 'a' flag in COFF .section directives


From: Nick Clifton
Subject: Ignore 'a' flag in COFF .section directives
Date: 23 May 2002 11:42:45 +0100

Hi Guys,

  I am applying the small patch below to allow the COFF .section
  directive to silently ignore an 'a' flag in a .section directive.
  This allows the same .section directive to be assembled in both COFF
  and ELF formats.  I want this feature because I want to be able to
  create a test case with a second text section like this:

        .section text1, "ax"

  and I need this case to be assemblable with both COFF and ELF
  targets.

Cheers
        Nick

2002-05-23  Nick Clifton  <address@hidden>

        * config/obj-coff.c (obj_coff_section): Silently ignore an 'a'
        flag.
        * doc/as.texinfo: Document that the COFF version of .section
        ignores the 'a' flag.

Index: gas/config/obj-coff.c
===================================================================
RCS file: /cvs/src/src/gas/config/obj-coff.c,v
retrieving revision 1.58
diff -c -3 -p -w -r1.58 obj-coff.c
*** gas/config/obj-coff.c       11 May 2002 12:08:26 -0000      1.58
--- gas/config/obj-coff.c       23 May 2002 10:33:44 -0000
*************** coff_frob_file_after_relocs ()
*** 1397,1419 ****
    bfd_map_over_sections (stdoutput, coff_adjust_section_syms, (char*) 0);
  }
  
! /*
!  * implement the .section pseudo op:
!  *    .section name {, "flags"}
!  *                ^         ^
!  *                |         +--- optional flags: 'b' for bss
!  *                |                              'i' for info
!  *                +-- section name               'l' for lib
!  *                                               'n' for noload
!  *                                               'o' for over
!  *                                               'w' for data
!  *                                             'd' (apparently m88k for data)
!  *                                               'x' for text
!  *                                             'r' for read-only data
!  *                                             's' for shared data (PE)
!  * But if the argument is not a quoted string, treat it as a
!  * subsegment number.
!  */
  
  void
  obj_coff_section (ignore)
--- 1397,1420 ----
    bfd_map_over_sections (stdoutput, coff_adjust_section_syms, (char*) 0);
  }
  
! /* Implement the .section pseudo op:
!       .section name {, "flags"}
!                   ^         ^
!                   |         +--- optional flags: 'b' for bss
!                   |                              'i' for info
!                   +-- section name               'l' for lib
!                                                  'n' for noload
!                                                  'o' for over
!                                                  'w' for data
!                                                'd' (apparently m88k for data)
!                                                  'x' for text
!                                                'r' for read-only data
!                                                's' for shared data (PE)
!    But if the argument is not a quoted string, treat it as a
!    subsegment number.
! 
!    Note the 'a' flag is silently ignored.  This allows the same
!    .section directive to be parsed in both ELF and COFF formats.  */
  
  void
  obj_coff_section (ignore)
*************** obj_coff_section (ignore)
*** 1466,1471 ****
--- 1467,1473 ----
                case 'n': flags &=~ SEC_LOAD; flags |= SEC_NEVER_LOAD; break;
                case 'd': flags |= SEC_DATA | SEC_LOAD; /* fall through */
                case 'w': flags &=~ SEC_READONLY; break;
+               case 'a': break; /* For compatability with ELF.  */
                case 'x': flags |= SEC_CODE | SEC_LOAD; break;
                case 'r': flags |= SEC_READONLY; break;
                case 's': flags |= SEC_SHARED; break;

Index: gas/doc/as.texinfo
===================================================================
RCS file: /cvs/src/src/gas/doc/as.texinfo,v
retrieving revision 1.62
diff -c -3 -p -w -r1.62 as.texinfo
*** gas/doc/as.texinfo  16 Mar 2002 03:09:15 -0000      1.62
--- gas/doc/as.texinfo  23 May 2002 10:36:12 -0000
*************** read-only section
*** 4978,4983 ****
--- 4978,4985 ----
  executable section
  @item s
  shared section (meaningful for PE targets)
+ @item a
+ ignored.  (For compatibility with the ELF version)
  @end table
  
  If no flags are specified, the default flags depend upon the section name.  If




reply via email to

[Prev in Thread] Current Thread [Next in Thread]