public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Cross-assembling for AIX/PowerPC64
@ 2014-07-25  7:22 Jonas Maebe
  2014-07-25  7:36 ` Tristan Gingold
  0 siblings, 1 reply; 7+ messages in thread
From: Jonas Maebe @ 2014-07-25  7:22 UTC (permalink / raw)
  To: binutils

Hi,

I have configured binutils 2.24 using the following configure command 
(on OS X 10.9):

   ../configure --target=powerpc-ibm-aix53 --with-sysroot --disable-werror

The resulting assembler can assemble for AIX/PowerPC (32 bit) fine. 
However, when I try to assemble for AIX/PowerPC64 with this command:

   powerpc-ibm-aix53-as -a64 -u -o 
../../rtl/units/powerpc64-aix/ctypes.o 
../../rtl/units/powerpc64-aix/ctypes.s -mpwr5

Then I get the following error:

   Assembler messages:
   Fatal error: selected target format 'aixcoff64-rs6000' unknown

Looking at "powerpc-ibm-aix53-objdump -i", these are the supported 
object file formats:

***
aixcoff-rs6000
  (header big endian, data big endian)
   powerpc:common
   rs6000:6000
aix5coff64-rs6000
  (header big endian, data big endian)
   powerpc:common
   rs6000:6000
srec
  (header endianness unknown, data endianness unknown)
   powerpc:common
   rs6000:6000
symbolsrec
  (header endianness unknown, data endianness unknown)
   powerpc:common
   rs6000:6000
verilog
  (header endianness unknown, data endianness unknown)
   powerpc:common
   rs6000:6000
tekhex
  (header endianness unknown, data endianness unknown)
   powerpc:common
   rs6000:6000
binary
  (header endianness unknown, data endianness unknown)
   powerpc:common
   rs6000:6000
ihex
  (header endianness unknown, data endianness unknown)
   powerpc:common
   rs6000:6000

                aixcoff-rs6000 aix5coff64-rs6000 srec symbolsrec verilog 
tekhex
powerpc:common aixcoff-rs6000 aix5coff64-rs6000 srec symbolsrec verilog 
tekhex
    rs6000:6000 aixcoff-rs6000 aix5coff64-rs6000 srec symbolsrec verilog 
tekhex

                binary ihex
powerpc:common binary ihex
    rs6000:6000 binary ihex
***

How can I either add support for aixcoff64-rs6000, or make "-a64" select 
aix5coff64-rs6000 as opposed to aixcoff64-rs6000? Additionally, while 
I'm almost sure that there must be a command line option for "as" to 
explicitly specify the output file format (like there is for ld), I 
couldn't find it in its help (although that wouldn't be a final 
solution, because then our compiler would have to auto-detect whether 
it's using GNU as or native AIX as to determine which command line 
options to pass).

Thanks,


Jonas

PS: the command I use to assemble for AIX/PowerPC (32 bit) is the same 
as the one for 64 bit, except without the "-a64" (explicitly adding 
"-a32" also works in that case).

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

* Re: Cross-assembling for AIX/PowerPC64
  2014-07-25  7:22 Cross-assembling for AIX/PowerPC64 Jonas Maebe
@ 2014-07-25  7:36 ` Tristan Gingold
  2014-07-25  8:10   ` Jonas Maebe
  0 siblings, 1 reply; 7+ messages in thread
From: Tristan Gingold @ 2014-07-25  7:36 UTC (permalink / raw)
  To: Jonas Maebe; +Cc: binutils


On 25 Jul 2014, at 09:22, Jonas Maebe <jonas.maebe@elis.ugent.be> wrote:

> Hi,
> 
> I have configured binutils 2.24 using the following configure command (on OS X 10.9):
> 
>  ../configure --target=powerpc-ibm-aix53 --with-sysroot --disable-werror
> 
> The resulting assembler can assemble for AIX/PowerPC (32 bit) fine. However, when I try to assemble for AIX/PowerPC64 with this command:
> 
>  powerpc-ibm-aix53-as -a64 -u -o ../../rtl/units/powerpc64-aix/ctypes.o ../../rtl/units/powerpc64-aix/ctypes.s -mpwr5
> 
> Then I get the following error:
> 
>  Assembler messages:
>  Fatal error: selected target format 'aixcoff64-rs6000' unknown

There is a discrepancy between bfd and gas.  Try to configure for powerpc-ibm-aix or hack gas/config/tc-ppc.c

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

* Re: Cross-assembling for AIX/PowerPC64
  2014-07-25  7:36 ` Tristan Gingold
@ 2014-07-25  8:10   ` Jonas Maebe
  2014-07-25  8:26     ` Tristan Gingold
  0 siblings, 1 reply; 7+ messages in thread
From: Jonas Maebe @ 2014-07-25  8:10 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils

On 25/07/14 09:36, Tristan Gingold wrote:
>
> On 25 Jul 2014, at 09:22, Jonas Maebe <jonas.maebe@elis.ugent.be> wrote:
>
>> Hi,
>>
>> I have configured binutils 2.24 using the following configure command (on OS X 10.9):
>>
>>   ../configure --target=powerpc-ibm-aix53 --with-sysroot --disable-werror
>>
>> The resulting assembler can assemble for AIX/PowerPC (32 bit) fine. However, when I try to assemble for AIX/PowerPC64 with this command:
>>
>>   powerpc-ibm-aix53-as -a64 -u -o ../../rtl/units/powerpc64-aix/ctypes.o ../../rtl/units/powerpc64-aix/ctypes.s -mpwr5
>>
>> Then I get the following error:
>>
>>   Assembler messages:
>>   Fatal error: selected target format 'aixcoff64-rs6000' unknown
>
> There is a discrepancy between bfd and gas.  Try to configure for powerpc-ibm-aix or hack gas/config/tc-ppc.c

I had to hack gas/config/tc-ppc.c (manually add a "#define TE_AIX5"; it 
seems this should normally be set by gas/config/te-aix5.h, but this file 
doesn't appear to be included anywhere), because configuring for 
powerpc-ibm-aix resulted in linker errors:

   powerpc-ibm-aix-ld -bpT:0x10000000 -bpD:0x20000000 -btextro 
-binitfini:P.BUG_.._main:FPC_LIB_EXIT  -G -L. -o shr_64.o link.res -b64 
-bE:linksyms.fpc

  /Data/dev/aix/aixroot/lib/crt0_64.o: file not recognized: File format 
not recognized (that's a crt0_64.o from an AIX 5.3 machine).

Configuring that way also meant that ar's -X64_32 option was not 
supported (presumably such support was only added in AIX 5.x).

In any case, with the hack it does work. Thanks!


Jonas

PS: shall I file a bug report?

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

* Re: Cross-assembling for AIX/PowerPC64
  2014-07-25  8:10   ` Jonas Maebe
@ 2014-07-25  8:26     ` Tristan Gingold
  2014-07-25  8:31       ` Tristan Gingold
  2014-07-25  9:32       ` Jonas Maebe
  0 siblings, 2 replies; 7+ messages in thread
From: Tristan Gingold @ 2014-07-25  8:26 UTC (permalink / raw)
  To: Jonas Maebe; +Cc: binutils


On 25 Jul 2014, at 10:10, Jonas Maebe <jonas.maebe@elis.ugent.be> wrote:
[..]
> 
> I had to hack gas/config/tc-ppc.c (manually add a "#define TE_AIX5"; it seems this should normally be set by gas/config/te-aix5.h, but this file doesn't appear to be included anywhere), because configuring for powerpc-ibm-aix resulted in linker errors:

[...]

> In any case, with the hack it does work. Thanks!

You're welcome.

> PS: shall I file a bug report?

Why not (but a patch would even be better)!



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

* Re: Cross-assembling for AIX/PowerPC64
  2014-07-25  8:26     ` Tristan Gingold
@ 2014-07-25  8:31       ` Tristan Gingold
  2014-07-25  9:32       ` Jonas Maebe
  1 sibling, 0 replies; 7+ messages in thread
From: Tristan Gingold @ 2014-07-25  8:31 UTC (permalink / raw)
  To: Jonas Maebe; +Cc: binutils


On 25 Jul 2014, at 10:26, Tristan Gingold <gingold@adacore.com> wrote:

> 
> On 25 Jul 2014, at 10:10, Jonas Maebe <jonas.maebe@elis.ugent.be> wrote:
> [..]
>> 
>> I had to hack gas/config/tc-ppc.c (manually add a "#define TE_AIX5"; it seems this should normally be set by gas/config/te-aix5.h, but this file doesn't appear to be included anywhere), because configuring for powerpc-ibm-aix resulted in linker errors:

Short investigation (FTR): the aixcoff64-rs6000 format is for AIX4.3, the format has changed with AIX 5.1.

(Maybe we could simply remove the support for AIX versions before AIX 5.1)

Tristan.

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

* Re: Cross-assembling for AIX/PowerPC64
  2014-07-25  8:26     ` Tristan Gingold
  2014-07-25  8:31       ` Tristan Gingold
@ 2014-07-25  9:32       ` Jonas Maebe
  2014-07-25  9:36         ` Tristan Gingold
  1 sibling, 1 reply; 7+ messages in thread
From: Jonas Maebe @ 2014-07-25  9:32 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils

On 25/07/14 10:26, Tristan Gingold wrote:
>
>> PS: shall I file a bug report?
>
> Why not (but a patch would even be better)!

In the end it does seem to be at least a partial PEBKAC: gas assumes I'm 
trying to configure for AIX version "53" rather than "5.3" :) Although 
technically, that version is still larger than 4.3 and hence it should 
default to the newer object file format :)

All subdirectories that care about the AIX version use a different 
matching logic:
* ld/configure.tgt:

powerpc-*-aix[5-9]*)    targ_emul=aix5ppc ;;
powerpc-*-aix*)         targ_emul=aixppc ;;
rs6000-*-aix[5-9]*)     targ_emul=aix5rs6 ;;
rs6000-*-aix*)          targ_emul=aixrs6

* binutils/configure.tgt:

     powerpc-*-aix[5-9]* | rs6000-*-aix[5-9]*)
         targ_emul=aix
         targ_emul_vector=bin_aix_emulation
         ;;

     powerpc-*-aix4.3* | rs6000-*-aix4.3*)
         targ_emul=aix
         targ_emul_vector=bin_aix_emulation
         ;;

* gas/configure.tgt (after mapping "rs6000" and "powerpc" to "ppc"):

   ppc-*-aix5.[01])                      fmt=coff em=aix5 ;;
   ppc-*-aix[5-9].*)                     fmt=coff em=aix5 ;;
   ppc-*-aix*)                           fmt=coff ;;

This will all obviously also break for a hypothetical future AIX version 
10. Maybe the matching could be inverted by first explicitly checking 
for (powerpc|rs6000|ppc)-*-aix[1234].*, and afterwards let 
(powerpc|ppc)-*-aix* select AIX 5+ functionality? Optionally, 
(powerpc|rs6000|ppc)-*-aix without any version suffix could also map to 
the old object format, for backward compatibility -- except for 
binutils/configure.tgt, which already doesn't match plain *-aix at all 
(not sure what happens then, maybe no AIX support whatsoever in objdump 
and friends -- AIX is the only target that is handled specially there)


Jonas

PS: I don't have an active copyright assignment on file and it's quite a 
bureaucratic hassle to get one from my university (not because they're 
not willing to give it, but simply because of the process you have to go 
through, and they want give it for one year at a time only).

Well, technically I may have a copyright assignment on file, because the 
scan I got of the form they sent to the FSF last time (in 2009) didn't 
have the date filled out, so it may be valid indefinitely :)

OTOH, for changes like this no copyright assignment may be required, I 
don't know.

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

* Re: Cross-assembling for AIX/PowerPC64
  2014-07-25  9:32       ` Jonas Maebe
@ 2014-07-25  9:36         ` Tristan Gingold
  0 siblings, 0 replies; 7+ messages in thread
From: Tristan Gingold @ 2014-07-25  9:36 UTC (permalink / raw)
  To: Jonas Maebe; +Cc: binutils


On 25 Jul 2014, at 11:32, Jonas Maebe <jonas.maebe@elis.ugent.be> wrote:

> On 25/07/14 10:26, Tristan Gingold wrote:
>> 
>>> PS: shall I file a bug report?
>> 
>> Why not (but a patch would even be better)!
> 
> In the end it does seem to be at least a partial PEBKAC: gas assumes I'm trying to configure for AIX version "53" rather than "5.3" :)

Ah indeed too.  I didn't catch that.

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

end of thread, other threads:[~2014-07-25  9:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-25  7:22 Cross-assembling for AIX/PowerPC64 Jonas Maebe
2014-07-25  7:36 ` Tristan Gingold
2014-07-25  8:10   ` Jonas Maebe
2014-07-25  8:26     ` Tristan Gingold
2014-07-25  8:31       ` Tristan Gingold
2014-07-25  9:32       ` Jonas Maebe
2014-07-25  9:36         ` Tristan Gingold

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).