When compiling libjava on AIX 6.1, gcc generates to the assembler symbols with dollar inside. But IBM "as" is not able to manage dollar in symbol names, so the compilation fails.
Created attachment 15273 [details] This patch learns to gcc how to use IBM as with symbols with dollar inside. This patch removes '$' from symbol names and replace them by "_". It emits ".rename" pseudo-op to keep the good symbol name in the symbol table. See http://publib.boulder.ibm.com/infocenter/systems/index.jsp?topic=/com.ibm.aix.aixassem/doc/alangref/rename.htm
Created attachment 15298 [details] new version of previous patch (aix-asm.patch) correctly export symbols Add compatibility with libtool processing correctly import them remove asm part specific to libjava
I don't think this is a real bug. Also patches should be off of the trunk and submitted to gcc-patches@gcc.gnu.org.
Yes, this will substitute "_" for "$", but most programs do not use dollar signs in symbol names, except Java. GNU Java is not supported on AIX, so building libjava does not accomplish much. This is a large patch and requires an assignment. With an assignment, I can consider it.
This patch causes G++ to crash building some applications on AIX. Apparently a version of G++ including this patch is being distributed and users are reporting problems.
+ strip = (char *)ggc_alloc_string (name, len); + + for (len = 0; name[len]; len++) + if (name[len] == '$') + strip[len] = '_'; + else + strip[len] = name[len]; + strip[len] = 0; + + return strip; It is not safe to edit a ggc_alloc_string-allocated string in place. This should be + strip = (char *)alloca (name, len); ... + return ggc_alloc_string (strip, len); Also, using fixed-size 256 byte buffers is not safe because they can overflow.
Created attachment 16493 [details] patch to convert dollar signs to underscores New patch. This patch intercepts the dollar signs at a lower level and correctly handles garbage collection allocations of strings.
Subject: Bug 35483 Author: dje Date: Wed Oct 15 12:23:55 2008 New Revision: 141134 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141134 Log: PR target/35483 Based on patches by Laurent Vivier. * xcoffout.h (DBX_FINISH_STABS): Translate dollar sign to underscore. * config/rs6000/rs6000-protos.h (rs6000_xcoff_strip_dollar): Declare. * config/rs6000/xcoff.h (ASM_DECLARE_FUNCTION_NAME): Translate dollar sign to underscore. (ASM_OUTPUT_EXTERNAL): Same. (ASM_OUTPUT_LABELREF): New. * config/rs6000/rs6000.c (rs6000_xcoff_strip_dollar): New. * config/rs6000/aix51.h (TARGET_USE_JCR_SECTION): Define. * config/rs6000/aix52.h (TARGET_USE_JCR_SECTION): Define. * config/rs6000/aix53.h (TARGET_USE_JCR_SECTION): Define. * config/rs6000/aix61.h (TARGET_USE_JCR_SECTION): Define. Modified: trunk/gcc/config/rs6000/aix51.h trunk/gcc/config/rs6000/aix52.h trunk/gcc/config/rs6000/aix53.h trunk/gcc/config/rs6000/aix61.h trunk/gcc/config/rs6000/rs6000-protos.h trunk/gcc/config/rs6000/rs6000.c trunk/gcc/config/rs6000/xcoff.h trunk/gcc/xcoffout.h
Patch committed.
Subject: Bug 35483 Author: dje Date: Thu Oct 16 11:57:26 2008 New Revision: 141170 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141170 Log: gcc/ PR target/35483 * Makefile.in (coverage.o): Depend on $(TM_P_H). * coverage.c: Include tm_p.h. * config/rs6000/x-aix (jc1): Override LDFLAGS. * config/rs6000/xcoff.h (ASM_GENERATE_INTERNAL_LABEL): Strip dollar signs from PREFIX. * config/rs6000/rs6000.c (output_toc): Use RS6000_OUTPUT_BASENAME instead of manual strip_name_encoding. java/ PR target/35483 * Make-lang.in (class.o): Depend on $(TM_P_H). (expr.o): Same. * class.c: Include tm_p.h. * expr.c: Include tm_p.h. Modified: trunk/gcc/ChangeLog trunk/gcc/Makefile.in trunk/gcc/config/rs6000/rs6000.c trunk/gcc/config/rs6000/x-aix trunk/gcc/config/rs6000/xcoff.h trunk/gcc/coverage.c trunk/gcc/java/ChangeLog trunk/gcc/java/Make-lang.in trunk/gcc/java/class.c trunk/gcc/java/expr.c