From 8c7504802aa101a9df8e799e1d1943ab7b5ff80b Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 6 Nov 2007 17:15:10 +0000 Subject: [PATCH] * 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/elf/elf.exp: Disable ehopt test for mn10300. --- gas/ChangeLog | 7 +++++++ gas/config/tc-mn10300.h | 5 +++++ gas/doc/internals.texi | 5 +++++ gas/ehopt.c | 5 +++++ gas/testsuite/ChangeLog | 4 ++++ gas/testsuite/gas/elf/elf.exp | 7 ++++++- 6 files changed, 32 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 637be807f10..e92fccbca96 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2007-11-06 Nick Clifton + + * 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. + 2007-11-05 Danny Smith * read.c (ALIGN_LIMIT): Rename to ... diff --git a/gas/config/tc-mn10300.h b/gas/config/tc-mn10300.h index 8a2e457eb5a..ca51eda7a34 100644 --- a/gas/config/tc-mn10300.h +++ b/gas/config/tc-mn10300.h @@ -120,3 +120,8 @@ extern bfd_boolean mn10300_allow_local_subtract (expressionS *, expressionS *, s #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) diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index 62f16f7f3d4..78b767e5f9b 100644 --- a/gas/doc/internals.texi +++ b/gas/doc/internals.texi @@ -1547,6 +1547,11 @@ evaluated. Targets which implement link time relaxation which may change the 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 diff --git a/gas/ehopt.c b/gas/ehopt.c index 2b0609be005..048bc57b5a0 100644 --- a/gas/ehopt.c +++ b/gas/ehopt.c @@ -275,6 +275,11 @@ check_eh_frame (expressionS *exp, unsigned int *pnbytes) 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; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index bbce8cabf47..fdb57bc0eef 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-11-06 Nick Clifton + + * gas/elf/elf.exp: Disable ehopt test for mn10300. + 2007-11-01 H.J. Lu * gas/i386/i386.d: New. diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp index c5e2921623f..28f8e51a400 100644 --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -73,7 +73,12 @@ if { ([istarget "*-*-*elf*"] set target_machine -armelf } } - run_dump_test "ehopt0" + + # 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" -- 2.30.2