This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

[PATCH 1/4] 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 (relax_segment): Call md_generic_table_relax_frag
	instead of relax_frag if defined.
---
 gas/doc/internals.texi | 5 +++++
 gas/write.c            | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/gas/doc/internals.texi b/gas/doc/internals.texi
index a50880d635..cb86b5b362 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 d5da41850c..d2bdb7acdf 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;
-- 
2.21.0


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