public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Cross-compile on Linux for Solaris x86
@ 2022-05-12 19:13 Paul Lucas
  2022-05-12 20:37 ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Lucas @ 2022-05-12 19:13 UTC (permalink / raw)
  To: binutils

Hello -

I’m building a cross-compiled gcc and binutils on Linux x86_64 for Solaris x86_64.  The problem is that the executables produced hard-code the wrong path for the dynamic linker and get killed immediately upon launch.  In elfxx-x86.c, the path for ELF64_DYNAMIC_INTERPRETER is defined as "/lib/ld64.so.1", but should be "/lib/amd64/ld.so.1" on a Solaris x86_64 system.

I came across this exact problem here:

https://binutils.sourceware.narkive.com/hNh1UFx2/building-a-cross-for-solaris-x86-target#post2

That thread is 15 years (!) old and implies this issue has beed addressed in the binutils 2.17/2.18 timeframe.  I’m building binutils 2.32 and still hitting this same problem.

What’s the fix?

Thanks.

- Paul


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

* Re: Cross-compile on Linux for Solaris x86
  2022-05-12 19:13 Cross-compile on Linux for Solaris x86 Paul Lucas
@ 2022-05-12 20:37 ` H.J. Lu
  2022-05-12 23:32   ` Paul Lucas
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2022-05-12 20:37 UTC (permalink / raw)
  To: Paul Lucas; +Cc: Binutils

On Thu, May 12, 2022 at 12:14 PM Paul Lucas via Binutils
<binutils@sourceware.org> wrote:
>
> Hello -
>
> I’m building a cross-compiled gcc and binutils on Linux x86_64 for Solaris x86_64.  The problem is that the executables produced hard-code the wrong path for the dynamic linker and get killed immediately upon launch.  In elfxx-x86.c, the path for ELF64_DYNAMIC_INTERPRETER is defined as "/lib/ld64.so.1", but should be "/lib/amd64/ld.so.1" on a Solaris x86_64 system.
>
> I came across this exact problem here:
>
> https://binutils.sourceware.narkive.com/hNh1UFx2/building-a-cross-for-solaris-x86-target#post2
>
> That thread is 15 years (!) old and implies this issue has beed addressed in the binutils 2.17/2.18 timeframe.  I’m building binutils 2.32 and still hitting this same problem.
>
> What’s the fix?

1. Please get binutils 2.38.
2. Configure binutils 2.38 to target Solaris/x86-64.


-- 
H.J.

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

* Re: Cross-compile on Linux for Solaris x86
  2022-05-12 20:37 ` H.J. Lu
@ 2022-05-12 23:32   ` Paul Lucas
  2022-05-13  0:05     ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Lucas @ 2022-05-12 23:32 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Binutils



> On May 12, 2022, at 1:37 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> 
> On Thu, May 12, 2022 at 12:14 PM Paul Lucas via Binutils
> <binutils@sourceware.org> wrote:
>> 
>> Hello -
>> 
>> I’m building a cross-compiled gcc and binutils on Linux x86_64 for Solaris x86_64. The problem is that the executables produced hard-code the wrong path for the dynamic linker and get killed immediately upon launch. In elfxx-x86.c, the path for ELF64_DYNAMIC_INTERPRETER is defined as "/lib/ld64.so.1", but should be "/lib/amd64/ld.so.1" on a Solaris x86_64 system.
>> 
>> I came across this exact problem here:
>> 
>> https://binutils.sourceware.narkive.com/hNh1UFx2/building-a-cross-for-solaris-x86-target#post2
>> 
>> That thread is 15 years (!) old and implies this issue has beed addressed in the binutils 2.17/2.18 timeframe. I’m building binutils 2.32 and still hitting this same problem.
>> 
>> What’s the fix?
> 
> 1. Please get binutils 2.38.

OK, I did.  Same result.

> 2. Configure binutils 2.38 to target Solaris/x86-64.

Specifically, I did:

configure --enable-gold=default --disable-ld --enable-lto --prefix=/solaris-x86_64 --disable-multilib --disable-nls --target=x86_64-sunos-solaris2.11 --with-sysroot=/solaris-x86_64 --disable-werror --enable-plugins

which is what I’ve been doing.

Assuming that you didn’t make a typo when you typed "x86-64” (with a dash, not an underscore), I also tried:

	--target=x86-64-sunos-solaris2.11

but then the target triple parser presumably gets confused and complains:

	Kernel `sunos' not known to work with OS `solaris2.11’

Looking at the binutils source code, the literal string "/lib/ld64.so.1” still occurs and the literal string "/lib/amd64/ld.so.1” still doesn’t.

- Paul


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

* Re: Cross-compile on Linux for Solaris x86
  2022-05-12 23:32   ` Paul Lucas
@ 2022-05-13  0:05     ` H.J. Lu
  0 siblings, 0 replies; 4+ messages in thread
From: H.J. Lu @ 2022-05-13  0:05 UTC (permalink / raw)
  To: Paul Lucas; +Cc: Binutils

On Thu, May 12, 2022 at 4:33 PM Paul Lucas <plucas@splunk.com> wrote:
>
>
>
> > On May 12, 2022, at 1:37 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> >
> > On Thu, May 12, 2022 at 12:14 PM Paul Lucas via Binutils
> > <binutils@sourceware.org> wrote:
> >>
> >> Hello -
> >>
> >> I’m building a cross-compiled gcc and binutils on Linux x86_64 for Solaris x86_64. The problem is that the executables produced hard-code the wrong path for the dynamic linker and get killed immediately upon launch. In elfxx-x86.c, the path for ELF64_DYNAMIC_INTERPRETER is defined as "/lib/ld64.so.1", but should be "/lib/amd64/ld.so.1" on a Solaris x86_64 system.
> >>
> >> I came across this exact problem here:
> >>
> >> https://binutils.sourceware.narkive.com/hNh1UFx2/building-a-cross-for-solaris-x86-target#post2
> >>
> >> That thread is 15 years (!) old and implies this issue has beed addressed in the binutils 2.17/2.18 timeframe. I’m building binutils 2.32 and still hitting this same problem.
> >>
> >> What’s the fix?
> >
> > 1. Please get binutils 2.38.
>
> OK, I did.  Same result.
>
> > 2. Configure binutils 2.38 to target Solaris/x86-64.
>
> Specifically, I did:
>
> configure --enable-gold=default --disable-ld --enable-lto --prefix=/solaris-x86_64 --disable-multilib --disable-nls --target=x86_64-sunos-solaris2.11 --with-sysroot=/solaris-x86_64 --disable-werror --enable-plugins

Gold doesn't support Solaris.

> which is what I’ve been doing.
>
> Assuming that you didn’t make a typo when you typed "x86-64” (with a dash, not an underscore), I also tried:
>
>         --target=x86-64-sunos-solaris2.11
>
> but then the target triple parser presumably gets confused and complains:
>
>         Kernel `sunos' not known to work with OS `solaris2.11’
>
> Looking at the binutils source code, the literal string "/lib/ld64.so.1” still occurs and the literal string "/lib/amd64/ld.so.1” still doesn’t.
>
> - Paul
>


-- 
H.J.

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

end of thread, other threads:[~2022-05-13  0:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 19:13 Cross-compile on Linux for Solaris x86 Paul Lucas
2022-05-12 20:37 ` H.J. Lu
2022-05-12 23:32   ` Paul Lucas
2022-05-13  0:05     ` H.J. Lu

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