Discussion:
Building a cross binutils for Solaris/x86 target
Alex Bennee
2007-03-16 16:18:43 UTC
Permalink
Hi,

One of the toolchains we use at work is a Solaris/x86 target hosted on
Linux/x86. One of my colleagues hacked up binutils 2.16.1 to enable it
to link a Solaris binary.

I'm in the process of porting them 2.17 and would very much like to
submit the patches upstream if I can do them neatly. However my autoconf
magic is a little rusty.

In the BFD the linker is specified in elf64-x86-64.c as "/lib/ld64.so.1"
when on Solaris is needs to be in "/lib/amd64/ld.so.1". Are there any
config variables passed to the C code that I can use to #ifdef this?

I had a brief scan through config.h but couldn't see anything helpful.

Regards,
--
Alex, homepage: http://www.bennee.com/~alex/
Mustgo, n.: Any item of food that has been sitting in the refrigerator
so long it has become a science project. -- Sniglets, "Rich Hall &
Friends"
Ian Lance Taylor
2007-03-16 17:24:02 UTC
Permalink
Post by Alex Bennee
One of the toolchains we use at work is a Solaris/x86 target hosted on
Linux/x86. One of my colleagues hacked up binutils 2.16.1 to enable it
to link a Solaris binary.
I'm in the process of porting them 2.17 and would very much like to
submit the patches upstream if I can do them neatly. However my autoconf
magic is a little rusty.
In the BFD the linker is specified in elf64-x86-64.c as "/lib/ld64.so.1"
when on Solaris is needs to be in "/lib/amd64/ld.so.1". Are there any
config variables passed to the C code that I can use to #ifdef this?
I had a brief scan through config.h but couldn't see anything helpful.
This isn't properly expressed as an autoconf test. Autoconf tests can
only test for host features. You are talking about a target feature.
The way to implement this would be to clone the x86_64 target and just
change the interpreter string. Then make your new target the default
in config.bfd.

Alternatively, GNU/Linux has the same issue. The way it is handled
there is to arrange for gcc to always pass the appropriate
-dynamic-linker option when it invokes the linker. That is the way to
go if you always use gcc.

Ian
Alex Bennee
2007-03-19 12:01:46 UTC
Permalink
Post by Alex Bennee
One of the toolchains we use at work is a Solaris/x86 target hosted on
Linux/x86.
<snip>
Post by Alex Bennee
In the BFD the linker is specified in elf64-x86-64.c as "/lib/ld64.so.1"
when on Solaris is needs to be in "/lib/amd64/ld.so.1". Are there any
config variables passed to the C code that I can use to #ifdef this?
<snip>
This isn't properly expressed as an autoconf test. Autoconf tests can
only test for host features. You are talking about a target feature.
The way to implement this would be to clone the x86_64 target and just
change the interpreter string. Then make your new target the default
in config.bfd.
You mean create something like elf64-solaris-x86-64.c as a clone of the
original elf64-x86-64.c?

It does seem a little like a sledgehammer approach. Scanning through the
directory it looks like BFD is trying to keep the processor dependant
stuff purely that, dependant on the processor.

However if a patch creating a new variant and associated files is
acceptable to the binutils maintainers I'm happy to do that.
Alternatively, GNU/Linux has the same issue. The way it is handled
there is to arrange for gcc to always pass the appropriate
-dynamic-linker option when it invokes the linker. That is the way to
go if you always use gcc.
I shall investigate if I can build the OpenSolaris linker on a Linux
host. Otherwise I may have to go for remotely using a target machine to
link the final result.
--
Alex, homepage: http://www.bennee.com/~alex/
When a fellow says, "It ain't the money but the principle of the thing,"
it's the money. -- Kim Hubbard
Daniel Jacobowitz
2007-03-19 12:30:06 UTC
Permalink
Post by Alex Bennee
You mean create something like elf64-solaris-x86-64.c as a clone of the
original elf64-x86-64.c?
No. Take a look at the "FreeBSD support" comment at the bottom of
elf64-x86-64.c.
--
Daniel Jacobowitz
CodeSourcery
Michael Wetherell
2007-03-19 15:51:57 UTC
Permalink
Post by Alex Bennee
One of the toolchains we use at work is a Solaris/x86 target hosted
on Linux/x86. One of my colleagues hacked up binutils 2.16.1 to
enable it to link a Solaris binary.
I'm in the process of porting them 2.17 and would very much like to
submit the patches upstream if I can do them neatly. However my
autoconf magic is a little rusty.
In the BFD the linker is specified in elf64-x86-64.c as
"/lib/ld64.so.1" when on Solaris is needs to be in
"/lib/amd64/ld.so.1". Are there any config variables passed to the C
code that I can use to #ifdef this?
I had a brief scan through config.h but couldn't see anything
helpful.
Hi,

It should be working already, did you try a recent version?

Regards,
Mike
Alex Bennee
2007-03-19 18:21:11 UTC
Permalink
Post by Alex Bennee
One of the toolchains we use at work is a Solaris/x86 target hosted
on Linux/x86. One of my colleagues hacked up binutils 2.16.1 to
enable it to link a Solaris binary.
<snip>
Hi,
It should be working already, did you try a recent version?
Erm, latest release 2.17. Is this something in CVS?
Regards,
Mike
--
Alex, homepage: http://www.bennee.com/~alex/
Everything is controlled by a small evil group to which, unfortunately,
no one we know belongs.
Michael Wetherell
2007-03-19 18:36:13 UTC
Permalink
Post by Alex Bennee
Post by Michael Wetherell
It should be working already, did you try a recent version?
Erm, latest release 2.17. Is this something in CVS?
Yes try the CVS or a snapshot like binutils-070315.tar.bz2 from
ftp://sourceware.org/pub/binutils/snapshots.

Regards,
Mike

Loading...