public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* problems with gas in AIX 5.2
@ 2006-05-12 22:16 Mauricio Alvarez
  2006-05-15 22:38 ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Mauricio Alvarez @ 2006-05-12 22:16 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problems with gas in AIX 5.2
  2006-05-12 22:16 problems with gas in AIX 5.2 Mauricio Alvarez
@ 2006-05-15 22:38 ` Nick Clifton
  2006-05-15 22:39   ` Mauricio Alvarez
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2006-05-15 22:38 UTC (permalink / raw)
  To: Mauricio Alvarez; +Cc: binutils

Hi Mauricio,

> 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

Why not use gcc-4.0.2 to assemble the file as well ?  ie why use a 
different assembler from the one that forms part of the gcc-4.0.2 
toolchain ?

> link the resultant object file and other objects with gcc-4.0.2

ie:

powerpc-ibm-aix5.2.0.0-gcc-4.0.2 [...] -S -o ffmpeg.s ffmpeg.c
powerpc-ibm-aix5.2.0.0-gcc-4.0.2 -mppc -o ffmpeg.o ffmpeg.s
powerpc-ibm-aix5.2.0.0-gcc-4.0.2 [...] -o ffmpeg_g ffmpeg.o

Cheers
   Nick


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problems with gas in AIX 5.2
  2006-05-15 22:38 ` Nick Clifton
@ 2006-05-15 22:39   ` Mauricio Alvarez
  2006-05-19 12:35     ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Mauricio Alvarez @ 2006-05-15 22:39 UTC (permalink / raw)
  To: binutils

Nick Clifton wrote:
> Hi Mauricio,

Hi Nick and others

thanks for your reply

> 
> Why not use gcc-4.0.2 to assemble the file as well ?  ie why use a
> different assembler from the one that forms part of the gcc-4.0.2
> toolchain ?

I have built gcc-4.0.2 with the native (IBM) assembler and linker, with
 these toolchain "my" application compiles and assembles correctly. I
can not build gcc with binutils because there is some documented
problems of building gcc with binutils on AIX 5.2.

But, I want to use binutils because I want to do some modifications in
the assembler. So, I have to build gcc with the native assembler and to
assemble my applications with the GNU assembler using the mentioned scheme:

powerpc-ibm-aix5.2.0.0-gcc-4.0.2 [...] -S -o file.s file.c
binutils-2.16.1/as -mppc -o file.o file.s

But, using this approach the application (FFMPEG) breaks with a
segmentation fault.

By looking at the generated binaries I think that the problem is in the
GNU assembler.

Then, my original question is: is this a known problem of binutils in
AIX-5.X, and if there is a patch or some compile/assembly options that
can overcome or avoid this problem.

Thanks for your comments.

Mauricio Alvarez

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: problems with gas in AIX 5.2
  2006-05-15 22:39   ` Mauricio Alvarez
@ 2006-05-19 12:35     ` Nick Clifton
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2006-05-19 12:35 UTC (permalink / raw)
  To: Mauricio Alvarez; +Cc: binutils

Hi Mauricio,

> But, I want to use binutils because I want to do some modifications in
> the assembler.

Do you mean that you want to edit the assembler output of the compiler 
by hand, before passing it on to the assembler itself, or do you mean 
that you want the assembler to perform some changes to the code as it 
converts it into an object file ?

> So, I have to build gcc with the native assembler and to
> assemble my applications with the GNU assembler using the mentioned scheme:

I assume that you are using the most recent sources for the assembler, 
correct ?

> Then, my original question is: is this a known problem of binutils in
> AIX-5.X, and if there is a patch or some compile/assembly options that
> can overcome or avoid this problem.

Unfortunately I am not familiar with the AIX port of the assembler, so I 
  cannot tell you if it is a known problem.  Perhaps if you can put 
together a small test case that demonstrates the problem, someone can 
look at it.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-05-19  9:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-12 22:16 problems with gas in AIX 5.2 Mauricio Alvarez
2006-05-15 22:38 ` Nick Clifton
2006-05-15 22:39   ` Mauricio Alvarez
2006-05-19 12:35     ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).