This is the mail archive of the binutils@sourceware.cygnus.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]

[PATCH] misc BFD flags


This patch adds the following functionality to bfd and objdump,
primarily for targets using TI COFF:

C_STATLAB:  Define handling for this storage class, which indicates a
load-time (lma) versus run-time (vma) address.
SEC_CLINK: Sections marked with this flag are linked only if
referenced.  Same function as --gc-sections in the linker, but allows
specific sections to be marked.
SEC_BLOCK: Marks a section for blocking, a weaker form of alignment.
Blocked sections must not cross a page boundary, where the page value is
typically either fixed for a given target or the alignment value of the
section.


Index: bfd/ChangeLog
===================================================================
RCS file: /cvs/src/src/bfd/ChangeLog,v
retrieving revision 1.375
diff -d -c -p -r1.375 ChangeLog
*** ChangeLog	2000/04/05 21:23:04	1.375
--- ChangeLog	2000/04/06 01:57:50
***************
*** 1,3 ****
--- 1,10 ----
+ 2000-04-05  Timothy Wall  <twall@cygnus.com>
+ 
+ 	* coffcode.h (coff_slurp_symbol_table): Handle C_STATLAB storage
+ 	class.  Handle SEC_CLINK and SEC_BLOCK flags.
+ 	* section.c: Add SEC_CLINK and SEC_BLOCK flags.
+ 	* bfd-in2.h: Add SEC_CLINK and SEC_BLOCK flags.
+ 
  Wed Apr  5 22:04:20 2000  J"orn Rennecke <amylaar@cygnus.co.uk>
  
  	* reloc.c (_bfd_relocate_contents): Add BFD_RELOC_SH_LOOP_START and
Index: bfd/bfd-in2.h
===================================================================
RCS file: /cvs/src/src/bfd/bfd-in2.h,v
retrieving revision 1.37
diff -d -c -p -r1.37 bfd-in2.h
*** bfd-in2.h	2000/04/05 21:23:04	1.37
--- bfd-in2.h	2000/04/06 01:57:50
*************** typedef struct sec
*** 1057,1062 ****
--- 1057,1071 ----
            executables or shared objects.  */
  #define SEC_SHARED 0x4000000
  
+         /* This section should be blocked (weak alignment).  Guarantees a
+           section will not cross a page boundary if smaller than a page, or
+           be aligned on a page boundary if >= a page.  */
+ #define SEC_BLOCK 0x8000000
+ 
+         /* Conditionally link this section; link only if there are no
+           references found to any symbol in the section.  */
+ #define SEC_CLINK 0x10000000
+ 
          /*  End of section flags.  */
  
          /* Some internal packed boolean fields.  */
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.33
diff -d -c -p -r1.33 coffcode.h
*** coffcode.h	2000/03/01 20:39:07	1.33
--- coffcode.h	2000/04/06 01:57:51
*************** sec_to_styp_flags (sec_name, sec_flags)
*** 436,441 ****
--- 436,451 ----
        styp_flags = STYP_BSS;
      }
  
+ #ifdef STYP_CLINK
+   if (sec_flags & SEC_CLINK)
+     styp_flags |= STYP_CLINK;
+ #endif
+ 
+ #ifdef STYP_BLOCK
+   if (sec_flags & SEC_BLOCK)
+     styp_flags |= STYP_BLOCK;
+ #endif
+ 
  #ifdef STYP_NOLOAD
    if ((sec_flags & (SEC_NEVER_LOAD | SEC_COFF_SHARED_LIBRARY)) != 0)
      styp_flags |= STYP_NOLOAD;
*************** styp_to_sec_flags (abfd, hdr, name, sect
*** 533,538 ****
--- 543,558 ----
    long styp_flags = internal_s->s_flags;
    flagword sec_flags = 0;
  
+ #ifdef STYP_BLOCK
+   if (styp_flags & STYP_BLOCK)
+       sec_flags |= SEC_BLOCK;
+ #endif  
+ 
+ #ifdef STYP_CLINK
+   if (styp_flags & STYP_CLINK)
+       sec_flags |= SEC_CLINK;
+ #endif  
+ 
  #ifdef STYP_NOLOAD
    if (styp_flags & STYP_NOLOAD)
      {
*************** coff_slurp_symbol_table (abfd)
*** 4304,4309 ****
--- 4324,4334 ----
  #endif
  	      break;
  
+ 	    case C_STATLAB:	/* Static load time label */
+               dst->symbol.value = src->u.syment.n_value;
+               dst->symbol.flags = BSF_GLOBAL;
+               break;
+ 
  	    case C_NULL:
  	      /* PE DLLs sometimes have zeroed out symbols for some
                   reason.  Just ignore them without a warning.  */
*************** coff_slurp_symbol_table (abfd)
*** 4326,4332 ****
  #ifdef TIC80COFF
  	    case C_UEXT:	/* Tentative external definition */
  #endif
- 	    case C_STATLAB:	/* Static load time label */
  	    case C_EXTLAB:	/* External load time label */
  	    case C_HIDDEN:	/* ext symbol in dmert public lib */
  	    default:
--- 4351,4356 ----
Index: bfd/coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.11
diff -d -c -p -r1.11 coffgen.c
*** coffgen.c	2000/02/09 13:41:44	1.11
--- coffgen.c	2000/04/06 01:57:52
*************** fixup_symbol_value (abfd, coff_symbol_pt
*** 608,615 ****
  	  syment->n_value = (coff_symbol_ptr->symbol.value
  			     + coff_symbol_ptr->symbol.section->output_offset);
  	  if (! obj_pe (abfd))
! 	    syment->n_value +=
! 	      coff_symbol_ptr->symbol.section->output_section->vma;
  	}
        else
  	{
--- 608,618 ----
  	  syment->n_value = (coff_symbol_ptr->symbol.value
  			     + coff_symbol_ptr->symbol.section->output_offset);
  	  if (! obj_pe (abfd))
!             {
!               syment->n_value += (syment->n_sclass == C_STATLAB) ?
!                 coff_symbol_ptr->symbol.section->output_section->lma :
!                 coff_symbol_ptr->symbol.section->output_section->vma;
!             }
  	}
        else
  	{
Index: bfd/section.c
===================================================================
RCS file: /cvs/src/src/bfd/section.c,v
retrieving revision 1.12
diff -d -c -p -r1.12 section.c
*** section.c	2000/02/21 12:01:25	1.12
--- section.c	2000/04/06 01:57:52
*************** CODE_FRAGMENT
*** 336,341 ****
--- 336,350 ----
  .	   executables or shared objects.  *}
  .#define SEC_SHARED 0x4000000
  .
+ .	{* This section should be blocked (weak alignment).  Guarantees a
+ .          section will not cross a page boundary if smaller than a page, or
+ .          be aligned on a page boundary if >= a page.  *}
+ .#define SEC_BLOCK 0x8000000
+ .
+ .	{* Conditionally link this section; link only if there are no
+ .          references found to any symbol in the section.  *}
+ .#define SEC_CLINK 0x10000000
+ .
  .	{*  End of section flags.  *}
  .
  .	{* Some internal packed boolean fields.  *}
Index: binutils/ChangeLog
===================================================================
RCS file: /cvs/src/src/binutils/ChangeLog,v
retrieving revision 1.135
diff -d -c -p -r1.135 ChangeLog
*** ChangeLog	2000/04/05 03:43:56	1.135
--- ChangeLog	2000/04/06 01:57:54
***************
*** 1,3 ****
--- 1,7 ----
+ 2000-04-05  Timothy Wall  <twall@cygnus.com>
+ 
+ 	* objdump.c (dump_section_header): Print CLINK and BLOCK flags.
+ 
  2000-04-05  Alan Modra  <alan@linuxcare.com.au>
  
  	* binutils.texi: Remove optional `=' from long options that have
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.20
diff -d -c -p -r1.20 objdump.c
*** objdump.c	2000/04/04 14:32:29	1.20
--- objdump.c	2000/04/06 01:57:54
*************** dump_section_header (abfd, section, igno
*** 376,381 ****
--- 376,383 ----
    PF (SEC_NEVER_LOAD, "NEVER_LOAD");
    PF (SEC_EXCLUDE, "EXCLUDE");
    PF (SEC_SORT_ENTRIES, "SORT_ENTRIES");
+   PF (SEC_BLOCK, "BLOCK");
+   PF (SEC_CLINK, "CLINK");
    PF (SEC_SMALL_DATA, "SMALL_DATA");
    PF (SEC_SHARED, "SHARED");
  

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