From: H.J. Lu Date: Thu, 12 Dec 2019 19:54:31 +0000 (-0800) Subject: gas: Add md_generic_table_relax_frag X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b65d68b8d60338a860e169aac3bac54e6bac60db;p=binutils-gdb.git gas: Add md_generic_table_relax_frag Add md_generic_table_relax_frag for TC_GENERIC_RELAX_TABLE targets so that a backend can extend relax_frag beyond TC_GENERIC_RELAX_TABLE. * write.c (md_generic_table_relax_frag): New. Defined to relax_frag if not defined. (relax_segment): Call md_generic_table_relax_frag instead of relax_frag. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index a65b7d37a28..ef7369cee9e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2019-12-12 H.J. Lu + + * write.c (md_generic_table_relax_frag): New. Defined to + relax_frag if not defined. + (relax_segment): Call md_generic_table_relax_frag instead of + relax_frag. + 2019-12-12 Alan Modra * config/tc-aarch64.c (get_aarch64_insn): Avoid signed overflow. diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi index a50880d635f..cb86b5b3629 100644 --- a/gas/doc/internals.texi +++ b/gas/doc/internals.texi @@ -1210,6 +1210,11 @@ If you do not define @code{md_relax_frag}, you may define machine independent code knows how to use such a table to relax PC relative references. See @file{tc-m68k.c} for an example. @xref{Relaxation}. +@item md_generic_table_relax_frag +@cindex md_generic_table_relax_frag +If defined, it is a C statement that is invoked, instead of +the default implementation, to scan @code{TC_GENERIC_RELAX_TABLE}. + @item md_prepare_relax_scan @cindex md_prepare_relax_scan If defined, it is a C statement that is invoked prior to scanning diff --git a/gas/write.c b/gas/write.c index d5da41850cc..d2bdb7acdf7 100644 --- a/gas/write.c +++ b/gas/write.c @@ -2481,6 +2481,10 @@ write_object_file (void) } #ifdef TC_GENERIC_RELAX_TABLE +#ifndef md_generic_table_relax_frag +#define md_generic_table_relax_frag relax_frag +#endif + /* Relax a fragment by scanning TC_GENERIC_RELAX_TABLE. */ long @@ -3031,7 +3035,8 @@ relax_segment (struct frag *segment_frag_root, segT segment, int pass) #ifdef TC_GENERIC_RELAX_TABLE /* The default way to relax a frag is to look through TC_GENERIC_RELAX_TABLE. */ - growth = relax_frag (segment, fragP, stretch); + growth = md_generic_table_relax_frag (segment, fragP, + stretch); #endif /* TC_GENERIC_RELAX_TABLE */ #endif break;