gas: move obj_begin earlier
Alan Modra
amodra@gmail.com
Sat Jan 24 00:35:49 GMT 2026
csky wants to set up ELF object attributes in its md_begin.
I've had a look over all the md_begin functions and elf_begin and
it looks safe to run elf_being earlier. gas_cgen_begin must run
after md_begin.
* as.c (perform_an_assembly_pass): Move obj_begin earlier.
* testsuite/gas/mmix/builtin1.d,
* testsuite/gas/mmix/builtin3.d: Adjust expected output.
diff --git a/gas/as.c b/gas/as.c
index 6492bf1351f..f08c7c71d73 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -1266,16 +1266,16 @@ perform_an_assembly_pass (int argc, char ** argv)
if (strstr (BFD_VERSION_STRING, "." XSTRING (BFD_VERSION_DATE)) != NULL)
predefine_symbol ("date", BFD_VERSION_DATE);
+#ifdef obj_begin
+ obj_begin ();
+#endif
+
/* This may add symbol table entries, which requires having an open BFD,
and sections already created. */
md_begin ();
-
#ifdef USING_CGEN
gas_cgen_begin ();
#endif
-#ifdef obj_begin
- obj_begin ();
-#endif
/* Skip argv[0]. */
argv++;
diff --git a/gas/testsuite/gas/mmix/builtin1.d b/gas/testsuite/gas/mmix/builtin1.d
index 17d13bbfa68..c03a287a401 100644
--- a/gas/testsuite/gas/mmix/builtin1.d
+++ b/gas/testsuite/gas/mmix/builtin1.d
@@ -6,10 +6,10 @@
.*: file format elf64-mmix
SYMBOL TABLE:
-0+14 l \*ABS\* 0+ rJ
0+ l d \.text 0+ (|\.text)
0+ l d \.data 0+ (|\.data)
0+ l d \.bss 0+ (|\.bss)
+0+14 l \*ABS\* 0+ rJ
0+ g F \.text 0+ Main
diff --git a/gas/testsuite/gas/mmix/builtin3.d b/gas/testsuite/gas/mmix/builtin3.d
index 74801a6d548..29455374db6 100644
--- a/gas/testsuite/gas/mmix/builtin3.d
+++ b/gas/testsuite/gas/mmix/builtin3.d
@@ -8,10 +8,10 @@
.*: file format elf64-mmix
SYMBOL TABLE:
-0+14 l \*ABS\* 0+ rJ
0+ l d \.text 0+ (|\.text)
0+ l d \.data 0+ (|\.data)
0+ l d \.bss 0+ (|\.bss)
+0+14 l \*ABS\* 0+ rJ
0+ g F \.text 0+ Main
--
Alan Modra
More information about the Binutils
mailing list