Go on AIX

2,630 views
Skip to first unread message

John Marshall

unread,
Aug 17, 2010, 12:00:24 PM8/17/10
to golan...@googlegroups.com
A couple of questions about go on AIX:
1) what are the prospects? (I imagine gccgo is how it might be supported)
2) what are the platform specifics that are required if gcc is actually
available? Assembly code required or is C enough?

Thanks

Ian Lance Taylor

unread,
Aug 17, 2010, 5:09:09 PM8/17/10
to John Marshall, golan...@googlegroups.com
John Marshall <John.M...@ec.gc.ca> writes:

One issue with supporting gccgo on AIX is that the code which handles
the import statement needs to be able to open up object files and
archives in order to extract the export data. I wrote that code for
ELF; somebody would need to write it for XCOFF. It's conceptually
straightforward.

For good support for Go, somebody would need to port the split stack
support. It's not essential to have it, in that Go programs will run in
any case, but it's certainly better if it's available.

I don't really understand your second question.

It would also be feasible to port 6g/8g to AIX, but it would be harder.

Ian

John Marshall

unread,
Aug 17, 2010, 5:25:50 PM8/17/10
to golan...@googlegroups.com
On 08/17/2010 09:09 PM, Ian Lance Taylor wrote:
> John Marshall<John.M...@ec.gc.ca> writes:
>
>
>> A couple of questions about go on AIX:
>> 1) what are the prospects? (I imagine gccgo is how it might be supported)
>> 2) what are the platform specifics that are required if gcc is
>> actually available? Assembly code required or is C enough?
>>
> One issue with supporting gccgo on AIX is that the code which handles
> the import statement needs to be able to open up object files and
> archives in order to extract the export data. I wrote that code for
> ELF; somebody would need to write it for XCOFF. It's conceptually
> straightforward.
>
Is the ELF support you mentioned contained in a file or two (something
I could take a gander at)?

> For good support for Go, somebody would need to port the split stack
> support. It's not essential to have it, in that Go programs will run in
> any case, but it's certainly better if it's available.
>
> I don't really understand your second question.
>

Basically, is any PPC assembly required or C code only?


> It would also be feasible to port 6g/8g to AIX, but it would be harder.
>

Eric Van Hensbergen wrote me about this option. But it would require "a
good understanding of PPC architecture" and I am afraid that is not my
cup of tea.

I guess I'll be waiting for others to do the heavy lifting if I ever
want to use Go code on AIX+PPC.

Thanks to you both.

John

Dr Code

unread,
Aug 18, 2010, 9:30:28 AM8/18/10
to John Marshall, golan...@googlegroups.com
On Tue, Aug 17, 2010 at 4:25 PM, John Marshall <John.M...@ec.gc.ca> wrote:
> On 08/17/2010 09:09 PM, Ian Lance Taylor wrote:
>>
>> John Marshall<John.M...@ec.gc.ca>  writes:
>>
>>
>>>
>>> A couple of questions about go on AIX:
>>> 1) what are the prospects? (I imagine gccgo is how it might be supported)
>>> 2) what are the platform specifics that are required if gcc is
>>> actually available? Assembly code required or is C enough?

>> One issue with supporting gccgo on AIX is that the code which handles
>> the import statement needs to be able to open up object files and
>> archives in order to extract the export data.  I wrote that code for
>> ELF; somebody would need to write it for XCOFF.  It's conceptually
>> straightforward.

> I guess I'll be waiting for others to do the heavy lifting if I ever want to


> use Go code on AIX+PPC.

I have started a GO port to ppc.
I have code for ql and qc compiling, and have started work on qg.
If anyone is interested, I can make my branch available.

Rich

Ian Lance Taylor

unread,
Aug 18, 2010, 9:53:26 AM8/18/10
to John Marshall, golan...@googlegroups.com
John Marshall <John.M...@ec.gc.ca> writes:

> On 08/17/2010 09:09 PM, Ian Lance Taylor wrote:
>
>> One issue with supporting gccgo on AIX is that the code which handles
>> the import statement needs to be able to open up object files and
>> archives in order to extract the export data. I wrote that code for
>> ELF; somebody would need to write it for XCOFF. It's conceptually
>> straightforward.
>>
> Is the ELF support you mentioned contained in a file or two
> (something I could take a gander at)?

gcc/go/import-elf.cc and gcc/go/import-archive.cc.

>> I don't really understand your second question.
>>
> Basically, is any PPC assembly required or C code only?

For gccgo it is all C and C++ code.

Ian

Tianyi Cui

unread,
Aug 18, 2010, 8:23:07 PM8/18/10
to golang-nuts
I'm interested. Please make your branch available, thanks.

On Aug 18, 9:30 pm, Dr Code <cod...@gmail.com> wrote:
> On Tue, Aug 17, 2010 at 4:25 PM, John Marshall <John.Marsh...@ec.gc.ca> wrote:
> > On 08/17/2010 09:09 PM, Ian Lance Taylor wrote:
>
> >> John Marshall<John.Marsh...@ec.gc.ca>  writes:

John Marshall

unread,
Aug 18, 2010, 9:14:11 PM8/18/10
to golan...@googlegroups.com

Sure.

Thanks,
John

Dr Code

unread,
Aug 18, 2010, 11:42:16 PM8/18/10
to Tianyi Cui, golang-nuts

You can checkout from here:
hg clone https://codedr-go-ppc.googlecode.com/hg/ codedr-go-ppc

The changes are on branch 'codedr.ppc'

Rich

Vinu Rajashekhar

unread,
Aug 25, 2010, 6:40:52 AM8/25/10
to Ian Lance Taylor, John Marshall, golan...@googlegroups.com
Except for the small inline assembly where you save the callee-saved
registers in SAVE_REGS macro ?
 
Ian

Ian Lance Taylor

unread,
Aug 25, 2010, 10:09:31 AM8/25/10
to Vinu Rajashekhar, John Marshall, golan...@googlegroups.com
Vinu Rajashekhar <vinut...@gmail.com> writes:

>> For gccgo it is all C and C++ code.
>>
>>
> Except for the small inline assembly where you save the callee-saved
> registers in SAVE_REGS macro ?

Well, yeah, OK, but in my defense there isn't any actual assembly code
there. You do have to know the names of the callee saved registers.

Ian

Eric Van Hensbergen

unread,
Aug 6, 2011, 12:14:53 PM8/6/11
to Dr Code, golang-nuts
Any further progress on the ppc port? Looks like the existing repo
hasn't been touched in about a year. If no one else has had any
success pushing this further, I may take another swag at it.

-eric

Tamás Gulácsi

unread,
Sep 26, 2012, 9:46:11 AM9/26/12
to golan...@googlegroups.com, Dr Code
Hi,

I'm suffering with trying to compile gcc-4.7.1 to have a cross-compiling gcc for aix from amd64.
With buildroot-2012.08 I got:

/bin/bash ./libtool  --tag=CC   --mode=compile /opt/buildroot-2012.08/output/toolchain/gcc-4.7.1-final/./gcc/xgcc -B/opt/buildroot-2012.08/output/toolchain/gcc-4.7.1-final/./gcc/ -B/opt/buildroot-2012.08/output/host/usr/powerpc-unknown-linux-uclibc/bin/ -B/opt/buildroot-2012.08/output/host/usr/powerpc-unknown-linux-uclibc/lib/ -isystem /opt/buildroot-2012.08/output/host/usr/powerpc-unknown-linux-uclibc/include -isystem /opt/buildroot-2012.08/output/host/usr/powerpc-unknown-linux-uclibc/sys-include    -DHAVE_CONFIG_H -I. -I/opt/buildroot-2012.08/output/toolchain/gcc-4.7.1/libgo  -I /opt/buildroot-2012.08/output/toolchain/gcc-4.7.1/libgo/runtime -I/opt/buildroot-2012.08/output/toolchain/gcc-4.7.1/libgo/../libffi/include -I../libffi/include -pthread  -fexceptions -fplan9-extensions  -Wall -Wextra -Wwrite-strings -Wcast-qual -Werror  -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I /opt/buildroot-2012.08/output/toolchain/gcc-4.7.1/libgo/../libgcc -I ../../gcc/include -g -O2 -I/opt/buildroot-2012.08/output/host/include -I/opt/buildroot-2012.08/output/host/usr/include -MT runtime.lo -MD -MP -MF .deps/runtime.Tpo -c -o runtime.lo `test -f 'runtime/runtime.c' || echo '/opt/buildroot-2012.08/output/toolchain/gcc-4.7.1/libgo/'`runtime/runtime.c
/opt/buildroot-2012.08/output/toolchain/gcc-4.7.1/libgo/runtime/proc.c: In function 'runtime_gogo':
/opt/buildroot-2012.08/output/toolchain/gcc-4.7.1/libgo/runtime/proc.c:349:2: error: implicit declaration of function 'setcontext' [-Werror=implicit-function-declaration]
/opt/buildroot-2012.08/output/toolchain/gcc-4.7.1/libgo/runtime/proc.c: In function 'runtime_mcall':
/opt/buildroot-2012.08/output/toolchain/gcc-4.7.1/libgo/runtime/proc.c:384:3: error: implicit declaration of function 'getcontext' [-Werror=implicit-function-declaration]
/opt/buildroot-2012.08/output/toolchain/gcc-4.7.1/libgo/runtime/proc.c: In function '__go_go':
/opt/buildroot-2012.08/output/toolchain/gcc-4.7.1/libgo/runtime/proc.c:1504:3: error: implicit declaration of function 'makecontext' [-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors
make[5]: *** [proc.lo] Error 1


Idea? Is that implicit declaration warning really an error?

GThomas

Ian Lance Taylor

unread,
Sep 26, 2012, 10:07:33 AM9/26/12
to Tamás Gulácsi, golan...@googlegroups.com, Dr Code
It's going to be an error if it can't find those functions at link time.

This is just one of your problems. The gccgo compiler has no support
for export and import of package data on AIX. That would have to be
implemented before it could work.

Ian

Gulácsi Tamás

unread,
Sep 26, 2012, 10:18:43 AM9/26/12
to Ian Lance Taylor, Dr Code, golan...@googlegroups.com

Does this mean that gccgo is totally hopeless on AIX? Even with native (not cross compile) gcc 4.7.2?

Ian Lance Taylor

unread,
Sep 26, 2012, 10:32:10 AM9/26/12
to Gulácsi Tamás, Dr Code, golan...@googlegroups.com
On Wed, Sep 26, 2012 at 7:18 AM, Gulácsi Tamás <tgula...@gmail.com> wrote:
> Does this mean that gccgo is totally hopeless on AIX? Even with native (not
> cross compile) gcc 4.7.2?

I don't know about "totally hopeless." But it is true that gccgo will
not work on AIX, either native or cross-compiling, without
modification. Adding support export and import of package data is not
what I would call difficult, but it is not trivial.

Ian

Patrick Higgins

unread,
Sep 26, 2012, 11:11:18 AM9/26/12
to golan...@googlegroups.com, Dr Code
What version of AIX is this? I tried to build on AIX 5.3 a month or two ago and failed. I forget what problems I hit, but it sounds like Ian is saying there is no point unless you and I (and anyone else who want to see Go on AIX) code up some of the necessary support. I gave up because my interest level is actually pretty low. I was more curious than anything after reading the blog entries about gccgo.

--Patrick

Tamás Gulácsi

unread,
Sep 26, 2012, 12:55:04 PM9/26/12
to golan...@googlegroups.com, Dr Code
I'm really interested in programming in go for AIX, but this obstacle (XCOFF generator) seems too big...

Ian Lance Taylor

unread,
Sep 26, 2012, 1:52:30 PM9/26/12
to Tamás Gulácsi, golan...@googlegroups.com, Dr Code
On Wed, Sep 26, 2012 at 9:55 AM, Tamás Gulácsi <tgula...@gmail.com> wrote:
> I'm really interested in programming in go for AIX, but this obstacle (XCOFF
> generator) seems too big...

To be precise, you don't need an XCOFF generator--GCC will generate
the XCOFF for you--but you do need an XCOFF reader. it would go in
libiberty, along side simple-object-elf.c and simple-object-coff.c.

Ian
> --
>
>

Gulácsi Tamás

unread,
Jan 24, 2013, 4:50:35 PM1/24/13
to Ian Lance Taylor, golang-nuts, Dr Code

Hi,

I've stumbled on this: https://github.com/mirrors/gcc/commit/2c64b281f32d81eafbf0dce8b103ddbf7398ef2f

What's next?
What shall I do to have Go on AIX?

Thanks, GThomas

minux

unread,
Jan 24, 2013, 5:15:06 PM1/24/13
to Gulácsi Tamás, golang-nuts
On Fri, Jan 25, 2013 at 5:50 AM, Gulácsi Tamás <gth...@gthomas.eu> wrote:

I've stumbled on this: https://github.com/mirrors/gcc/commit/2c64b281f32d81eafbf0dce8b103ddbf7398ef2f

What's next?
What shall I do to have Go on AIX?

OK, so simple object reader is completed. If you have some time, you can try
building gccgo on AIX and fix build problems as they appear.

sorry, i can't provide more details because based on my past experiences,
different systems have vastly different problems to solve. You can ask on the
mailing list when problem arises. (But please be prepared to upstream your
changes if you do want to tackle this)

scchang

unread,
Dec 16, 2016, 12:46:59 AM12/16/16
to golang-nuts, gth...@gthomas.eu
Not sure if ppl in this thread are still interested. I managed to get gccgo (included in gcc 4.8.4) to work on AIX 5.3. The bulk of the changes are indeed in the xcoff reader as Ian and others had suggested. xcoff writer also has a couple of issues as the default assembler could not understand the generated assembly code as it complained about syntax error.

It also appears that IBM were also trying to get gccgo to work on AIX based on a recent gcc bug they filed. They probably already got it working. Not sure whether and when they would upstream the changes though.

Ian Lance Taylor

unread,
Dec 16, 2016, 1:02:52 AM12/16/16
to scchang, golang-nuts, gth...@gthomas.eu
On Thu, Dec 15, 2016 at 9:42 PM, scchang <sccha...@gmail.com> wrote:
> Not sure if ppl in this thread are still interested. I managed to get gccgo
> (included in gcc 4.8.4) to work on AIX 5.3. The bulk of the changes are
> indeed in the xcoff reader as Ian and others had suggested. xcoff writer
> also has a couple of issues as the default assembler could not understand
> the generated assembly code as it complained about syntax error.
>
> It also appears that IBM were also trying to get gccgo to work on AIX based
> on a recent gcc bug they filed. They probably already got it working. Not
> sure whether and when they would upstream the changes though.

It would be great if you could send in patches for gccgo. Thanks.

Ian

Gulácsi Tamás

unread,
Dec 16, 2016, 1:04:50 AM12/16/16
to scchang, golang-nuts

Great news! I'm in need for that!
Can you share it somehow?

matthieu.sar...@atos.net

unread,
Dec 19, 2016, 11:10:56 AM12/19/16
to golang-nuts, gth...@gthomas.eu
I am also working on an AIX port, from another version (GCC 7 on AIX 6.1).

For now, I have been able to complete the build, but lots of tests are failing. Some of the changes I made require to be reworked, as I did them just to allow the build to progress, to have an idea about the amount of changes required, now I will have to make them work properly.

I should be able to share my work soon.

scchang

unread,
Dec 20, 2016, 1:56:47 PM12/20/16
to golang-nuts, gth...@gthomas.eu, matthieu.sar...@atos.net
Good to hear. I wasn't able to get very far with latest gcc on AIX 5.3. Since you have made good progress on AIX 6.1, I will not waste any more time on 5.3. That being said, I will try to bootstrap Go library to the latest.

Tony...@bull.net

unread,
Feb 17, 2017, 8:27:22 AM2/17/17
to golang-nuts, gth...@gthomas.eu, matthieu.sar...@atos.net
Hi,

We are making progress with GCC Go on AIX 6.1, with GCC 7 snapshot.
Current issues are:
 - '$' character in assembler symbols. Replacing '$' by '_' is not a complete solution yet. Requires more study.
 - go command failure, due to: 'FFI Go closure' not being implemented on AIX yet.
 - still many errors in libgo tests
Help is welcome.
And we plan to share our patches starting next week.
We are now checking our patches under FedoraCore25/PPC64 (BE) .
Our plan is to bootstrap GoLang with GCC Go.

Regards
Tony

Tony...@bull.net

unread,
May 2, 2017, 5:58:55 AM5/2/17
to golang-nuts
The first (alpha) version of Gcc Go for AIX 7.1 is available on BullFreeware:

  http://bullfreeware.com/affichage.php?id=3614

It is an experimental version. That means that still several Go compiler and Go libgo tests are still failing and only 32 bit version has been built/tested in depth for now.
Gcc Go compiler tests : still 13 AIX-specific tests out of 7346 are still failing.
libgo test: about 17 failing tests out of 145

GCC v7 snapshot 20170323
Go v1.8

Failures deal with: <nil>, networking, linking issue with type, etc.
If you have a message like: "value of type string is not assignable to type string", showing that types are considered to be different though the same, try linking with: -static-libgo

However, this GCC Go compiler/runtime has been used for compiling/testing a real Go product, FileBeat, with success.

Feel free to experiment with it.
Reply all
Reply to author
Forward
0 new messages