[binutils-gdb] gas: streamline expr_build_dot()
Jan Beulich
jbeulich@sourceware.org
Tue Dec 3 09:48:52 GMT 2024
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=29f84cf8a214db79fe28c6d7d4a1e242783555c4
commit 29f84cf8a214db79fe28c6d7d4a1e242783555c4
Author: Jan Beulich <jbeulich@suse.com>
Date: Tue Dec 3 10:47:36 2024 +0100
gas: streamline expr_build_dot()
There's no point involving symbol_clone_if_forward_ref(), just for it to
replace dot_symbol by one obtained from symbol_temp_new_now(). For the
abs-section case also produce a slightly more "complete" (as in: all
potentially relevant fields filled) expression by going through
expr_build_uconstant().
Move the function next to current_location(), for it to be easier to see
the (dis)similarities. Correct the function's comment while there.
Diff:
---
gas/expr.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/gas/expr.c b/gas/expr.c
index fc3b6a3522c..056870bbb23 100644
--- a/gas/expr.c
+++ b/gas/expr.c
@@ -193,17 +193,6 @@ expr_build_uconstant (offsetT value)
e.X_extrabit = 0;
return make_expr_symbol (&e);
}
-
-/* Build an expression for the current location ('.'). */
-
-symbolS *
-expr_build_dot (void)
-{
- expressionS e;
-
- current_location (&e);
- return symbol_clone_if_forward_ref (make_expr_symbol (&e));
-}
/* Build any floating-point literal here.
Also build any bignum literal here. */
@@ -754,6 +743,24 @@ current_location (expressionS *expressionp)
}
}
+/* Make a symbol for the current location ('.'). */
+
+symbolS *
+expr_build_dot (void)
+{
+ if (now_seg != absolute_section)
+ {
+ symbolS *symbolP = symbol_temp_new_now ();
+
+#ifdef tc_new_dot_label
+ tc_new_dot_label (symbolP);
+#endif
+ return symbolP;
+ }
+
+ return expr_build_uconstant (abs_section_offset);
+}
+
#ifndef md_register_arithmetic
# define md_register_arithmetic 1
#endif
More information about the Binutils-cvs
mailing list