public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH]: Allow target control of eh optimization
@ 2007-11-06 17:16 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2007-11-06 17:16 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

Hi Guys,

   I am applying the attached patch to implement a new target macro -
   md_allow_eh_opt which can be used to disable the call frame
   optimization code if the target so desires.  This is needed by the
   MN10300 port because its linker relaxation changes the size of
   function prologues which means that some of the optimizations in
   ehopt.c cannot be applied.

Cheers
   Nick

gas/ChangeLog
2007-11-06  Nick Clifton  <nickc@redhat.com>

	* ehopt.c (check_eh_frame): If md_allow_eh_opt is defined, invoke
	it to see if the optimizations should be applied.
	* config/tc-mn10300.h (md_allow_eh_opt): Define.  Only allow call
	frame optimization if linker relaxation is not enabled.

gas/testsuite/ChangeLog
2007-11-06  Nick Clifton  <nickc@redhat.com>

	* gas/elf/elf.exp: Disable ehopt test for mn10300.

[-- Attachment #2: mn10300.eh-opt.patch --]
[-- Type: text/x-patch, Size: 3298 bytes --]

Index: gas/ehopt.c
===================================================================
RCS file: /cvs/src/src/gas/ehopt.c,v
retrieving revision 1.15
diff -c -3 -p -r1.15 ehopt.c
*** gas/ehopt.c	3 Jul 2007 11:01:03 -0000	1.15
--- gas/ehopt.c	6 Nov 2007 16:50:25 -0000
*************** check_eh_frame (expressionS *exp, unsign
*** 275,280 ****
--- 275,285 ----
    if (flag_traditional_format)
      return 0;
  
+ #ifdef md_allow_eh_opt
+   if (! md_allow_eh_opt)
+     return 0;
+ #endif
+ 
    /* Select the proper section data.  */
    if (strcmp (segment_name (now_seg), ".eh_frame") == 0)
      d = &eh_frame_data;
Index: gas/config/tc-mn10300.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mn10300.h,v
retrieving revision 1.23
diff -c -3 -p -r1.23 tc-mn10300.h
*** gas/config/tc-mn10300.h	30 Oct 2007 15:18:29 -0000	1.23
--- gas/config/tc-mn10300.h	6 Nov 2007 16:50:25 -0000
*************** extern bfd_boolean mn10300_allow_local_s
*** 120,122 ****
--- 120,127 ----
  
  #define HANDLE_ALIGN(frag) mn10300_handle_align (frag)
  extern void mn10300_handle_align (fragS *);
+ 
+ /* Only allow call frame debug info optimization when linker relaxation is
+    not enabled as otherwise we could generate the DWARF directives without
+    the relocs necessary to patch them up.  */
+ #define md_allow_eh_opt (linkrelax == 0)
Index: gas/doc/internals.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/internals.texi,v
retrieving revision 1.56
diff -c -3 -p -r1.56 internals.texi
*** gas/doc/internals.texi	19 Oct 2007 17:31:24 -0000	1.56
--- gas/doc/internals.texi	6 Nov 2007 16:50:26 -0000
*************** evaluated.  Targets which implement link
*** 1547,1552 ****
--- 1547,1557 ----
  position of the two symbols relative to each other should ensure that this
  macro returns zero in situations where this can occur.
  
+ @item md_allow_eh_opt
+ If defined, GAS will check this macro before performing any optimizations on
+ the DWARF call frame debug information that is emitted.  Targets which
+ implement link time relaxation may need to define this macro and set it to zero
+ if it is possible to change the size of a function's prologue.
  @end table
  
  @node Object format backend
Index: gas/testsuite/gas/elf/elf.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/elf/elf.exp,v
retrieving revision 1.42
diff -c -3 -p -r1.42 elf.exp
*** gas/testsuite/gas/elf/elf.exp	27 Oct 2007 17:45:53 -0000	1.42
--- gas/testsuite/gas/elf/elf.exp	6 Nov 2007 16:50:26 -0000
*************** if { ([istarget "*-*-*elf*"]		
*** 73,79 ****
  	    set target_machine -armelf
  	}
      }
!     run_dump_test "ehopt0"
      run_dump_test "group0a" 
      run_dump_test "group0b" 
      run_dump_test "group1a" 
--- 73,84 ----
  	    set target_machine -armelf
  	}
      }
! 
!     # The MN10300 port disables the assembler's call frame optimization
!     # because it interfers with link time relaxation of function prologues.
!     if (![istarget "mn10300-*-*"] && ![istarget "am3*-*-*"]} then {    
!       run_dump_test "ehopt0"
!     }
      run_dump_test "group0a" 
      run_dump_test "group0b" 
      run_dump_test "group1a" 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-06 17:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-06 17:16 [PATCH]: Allow target control of eh optimization Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).