Unable to build PowerPC AIX targets

Message ID 55c9214b-18e4-416d-945f-ab2d1e053c08@redhat.com
State New
Headers
Series Unable to build PowerPC AIX targets |

Commit Message

Nick Clifton Sept. 16, 2025, 10:12 a.m. UTC
  Hi Rainer,

   Building gas for AIX targeted PowerPC ports is currently failing
   because the comment_chars array is now ELF only:

ld: app.o: in function `do_scrub_begin':
gas/app.c:216:(.text+0x55): undefined reference to `comment_chars'

   I assume that there is no special need for the array to only be
   defined for the ELF target, so I found that a patch like the one
   attached solved the problem.  Does this work for you ?

Cheers
   Nick
  

Comments

Rainer Orth Sept. 16, 2025, 10:34 a.m. UTC | #1
Hi Nick,

>   Building gas for AIX targeted PowerPC ports is currently failing
>   because the comment_chars array is now ELF only:
>
> ld: app.o: in function `do_scrub_begin':
> gas/app.c:216:(.text+0x55): undefined reference to `comment_chars'
>
>   I assume that there is no special need for the array to only be
>   defined for the ELF target, so I found that a patch like the one
>   attached solved the problem.  Does this work for you ?

of course.  Sorry for messing things up: I'd misread the nesting of
#ifdef's here and only tested on Linux/PowerPC.

	Rainer
  
Nick Clifton Sept. 16, 2025, 1:46 p.m. UTC | #2
Hi Rainer,

>>    I assume that there is no special need for the array to only be
>>    defined for the ELF target, so I found that a patch like the one
>>    attached solved the problem.  Does this work for you ?
> 
> of course.  Sorry for messing things up: I'd misread the nesting of
> #ifdef's here and only tested on Linux/PowerPC.

No worries.  I have checked in the patch.

Cheers
   Nick
  

Patch

diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index a92a46446f0..3b2b218bcf3 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -123,6 +123,10 @@  static void ppc_weak (int);
 static void ppc_GNU_visibility (int);
 #endif
 
+/* This string holds the chars that always start a comment.  If the
+   pre-processor is disabled, these aren't very useful.  */
+const char ppc_comment_chars[] = "#";
+
 #ifdef OBJ_ELF
 static void ppc_elf_rdata (int);
 static void ppc_elf_lcomm (int);
@@ -134,10 +138,6 @@  static void ppc_elf_gnu_attribute (int);
 /* Generic assembler global variables which must be defined by all
    targets.  */
 
-/* This string holds the chars that always start a comment.  If the
-   pre-processor is disabled, these aren't very useful.  */
-const char ppc_comment_chars[] = "#";
-
 /* Characters which start a comment at the beginning of a line.  */
 const char line_comment_chars[] = "#";
 
diff --git a/gas/config/tc-ppc.h b/gas/config/tc-ppc.h
index ea520b67842..3bbeafc172c 100644
--- a/gas/config/tc-ppc.h
+++ b/gas/config/tc-ppc.h
@@ -216,6 +216,9 @@  extern void ppc_new_dot_label (symbolS *);
 extern const char       ppc_symbol_chars[];
 #define tc_symbol_chars ppc_symbol_chars
 
+#define tc_comment_chars ppc_comment_chars
+extern const char ppc_comment_chars[];
+
 #ifdef OBJ_ELF
 
 /* Support for SHT_ORDERED */
@@ -225,9 +228,6 @@  extern int ppc_section_flags (flagword, bfd_vma, int);
 #define md_elf_section_type(STR, LEN)		ppc_section_type (STR, LEN)
 #define md_elf_section_flags(FLAGS, ATTR, TYPE)	ppc_section_flags (FLAGS, ATTR, TYPE)
 
-#define tc_comment_chars ppc_comment_chars
-extern const char ppc_comment_chars[];
-
 #define md_elf_section_letter		ppc_elf_section_letter
 extern bfd_vma ppc_elf_section_letter (int, const char **);