From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9483 invoked by alias); 12 May 2006 16:52:12 -0000 Received: (qmail 9474 invoked by uid 22791); 12 May 2006 16:52:11 -0000 X-Spam-Check-By: sourceware.org Received: from roura.ac.upc.edu (HELO roura.ac.upc.es) (147.83.33.10) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 12 May 2006 16:52:09 +0000 Received: from [147.83.34.201] (dync-34-201.ac.upc.es [147.83.34.201]) by roura.ac.upc.es (8.13.6/8.13.6) with ESMTP id k4CGq6Ph016306 for ; Fri, 12 May 2006 18:52:06 +0200 Message-ID: <4464BD35.2030006@ac.upc.edu> Date: Fri, 12 May 2006 22:16:00 -0000 From: Mauricio Alvarez User-Agent: Mozilla Thunderbird 1.0.8 (X11/20060502) MIME-Version: 1.0 To: binutils@sourceware.org Subject: problems with gas in AIX 5.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00239.txt.bz2 Hi. I am trying to compile the FFMPEG multimedia application [1] under AIX operating system (AIX 5.2, Power processor) using the GCC compiler version 4.0.2 and the GNU GAS (version 2.16.1) The gcc-4.0.2 was built using the gcc-3.1 and the native (IBM) assembler and linker. I have used the native assembler and linker because it seems that is not possible to build gcc with binutils under AIX 5.X [2]. /powerpc-ibm-aix5.2.0.0-gcc-4.0.2 -v Using built-in specs. Target: powerpc-ibm-aix5.2.0.0 Configured with: ../gcc-4.0.2.orig/configure --prefix=/scratch_tmp/alvarez/powerpc-aix-gnu/result-gcc-4.0.2.orig --enable-languages=c,c++ --disable-nls --disable-multilib Thread model: aix gcc version 4.0.2 With gcc-4.0.2 and the native assembler and linker I have successfully compiled and executed the FFMPEG application. What I want to do is to use GAS in order to assembly some files of the program. Why? because I want to modify the assembler for some particular purposes (like adding new instructions and running the binaries on an emulator ). Now I am doing something like this: to compile a selected file with gcc-4.0.2 to assembly to assemble the result file to object file with gas-2.16.1 link the resultant object file and other objects with gcc-4.0.2 powerpc-ibm-aix5.2.0.0-gcc-4.0.2 -O3 -g -Wall -Wno-switch -I. -I/scratch_tmp/alvarez/media/ffmpeg -I/scratch_tmp/alvarez/media/ffmpeg/libavutil -I/scratch_tmp/alvarez/media/ffmpeg/libavcodec -I/scratch_tmp/alvarez/media/ffmpeg/libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -S -o ffmpeg.s ffmpeg.c /result-binutils-2.16.1.orig/bin/as -mppc -o ffmpeg.o ffmpeg.s powerpc-ibm-aix5.2.0.0-gcc-4.0.2 -g -o ffmpeg_g ffmpeg.o cmdutils.o -L./libavformat -lavformat -L./libavcodec -lavcodec -L./libavutil -lavutil -lm But in this case the final executable breaks with a Segmentation Fault. The only difference with the correct version is the use of GAS for assembling this file, so that indicates that there is problem with GAS. Trying to figure out what can be the problem I have made an object dump of the two files, one generated with the IBM assembler and the other one with GAS (objdump -m powerpc:common -d ffmpeg.o ) What I can see from the dumps is that the only difference is in the way of accessing the variables pointed by the TOC pointer. Here is an example - 4: 80 a2 00 00 lwz r5,0(r2) + 4: 80 a2 00 dc lwz r5,220(r2) this differences in offsets is maintained in all the accesses performed in this file. My question is. Is that a (known) bug in GAS? Is there any patch to resolve this problem? Or is there any compilation or assembly option that can avoid it? Thanks in advance for your comments. Mauricio Alvarez [1] http://ffmpeg.sourceforge.net/index.php [2] http://gcc.gnu.org/ml/gcc-help/2005-09/msg00178.html