From: Pythagoras W. <py...@ll...> - 2007-03-29 17:26:48
|
On Wed, Mar 28, 2007 at 02:53:11PM +0530, Rajesh Pethe wrote: :I'm having an issue with gcc compiler on powerpc-ibm-aix5.2.0.0. I've :tried installing the RPM package but after successful installation the :compiler is not working. : :Even tried to compile a simple C program 'int main() { return 0; }' :using gcc -c file.c and it returns - : :Assembler: :/tmp//ccCt0H7E.s: line 10: 1252-191 Only .llong should be used for :relocatable expressions. The issue is that the IBM tools (in this case the assembler) pay attention to the OBJECT_MODE environment variable, while gcc does not. I'll bet that you have OBJECT_MODE=64, so /usr/bin/as expects 64-bit assembler instructions, but gcc generated 32-bit ones. To make it work, either set OBJECT_MODE=32 or use the -maix64 option to gcc. That way the tools will consistently use the correct mode. For example: env OBJECT_MODE=32 gcc -c file.c gcc -maix64 -c file.c To solve this for our users, we rename /opt/freeware/bin/gcc to /opt/freeware/bin/gcc.orig and put a wrapper script at /opt/freeware/bin/gcc that attempts to keep the tool chain consistent. The same thing is done for g++. ---Cut Here--- #!/bin/sh # Wrap gcc and g++ to support the OBJECT_MODE environment variable. # Determine which compiler was requested case "$0" in *gcc*) compiler=gcc ;; *g++*) compiler=g++ ;; * ) echo "failed to determine compiler (gcc or g++) from '$0'" >&2 exit 1 ;; esac compiler=/opt/freeware/bin/$compiler.orig # Scan for -maix32 or -maix64, which overrides OBJECT_MODE for arg in "$@"; do case "$arg" in -maix32|-maix64) unset OBJECT_MODE; break ;; esac done # Tell compiler to use requested object mode if [ "$OBJECT_MODE" = 64 ]; then set -- -maix64 "$@" fi exec $compiler "$@" ---Cut Here--- -- Pythagoras Watson, LLNL ASC Systems Administrator |