mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] Enable multilib support when building with musl-gcc
@ 2019-01-30 21:38 James Larrowe
  2019-02-21 14:22 ` James Larrowe
  0 siblings, 1 reply; 5+ messages in thread
From: James Larrowe @ 2019-01-30 21:38 UTC (permalink / raw)
  To: musl; +Cc: James Larrowe

Somewhat incomplete; enables using 32-bit musl-gcc
on a 64-bit system

Signed-off-by: James Larrowe <larrowe.semaj11@gmail.com>
---
 tools/musl-gcc.specs.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/musl-gcc.specs.sh b/tools/musl-gcc.specs.sh
index 30492574..a73e6656 100644
--- a/tools/musl-gcc.specs.sh
+++ b/tools/musl-gcc.specs.sh
@@ -23,7 +23,9 @@ libgcc.a%s %:if-exists(libgcc_eh.a%s)
 crtendS.o%s $libdir/crtn.o
 
 *link:
--dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static} %{rdynamic:-export-dynamic}
+-dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static} \
+ %{rdynamic:-export-dynamic} %{m64:-melf_x86_64} %{mx32:-melf32_x86_64} \
+ %{m32:-melf_i386}
 
 *esp_link:
 
-- 
2.20.1



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

* Re: [PATCH] Enable multilib support when building with musl-gcc
  2019-01-30 21:38 [PATCH] Enable multilib support when building with musl-gcc James Larrowe
@ 2019-02-21 14:22 ` James Larrowe
  2019-02-21 14:44   ` Szabolcs Nagy
  0 siblings, 1 reply; 5+ messages in thread
From: James Larrowe @ 2019-02-21 14:22 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 942 bytes --]

Ping. Is there anything wrong with this? It works for me.

On Wed, Jan 30, 2019 at 4:38 PM James Larrowe <larrowe.semaj11@gmail.com>
wrote:

> Somewhat incomplete; enables using 32-bit musl-gcc
> on a 64-bit system
>
> Signed-off-by: James Larrowe <larrowe.semaj11@gmail.com>
> ---
>  tools/musl-gcc.specs.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/musl-gcc.specs.sh b/tools/musl-gcc.specs.sh
> index 30492574..a73e6656 100644
> --- a/tools/musl-gcc.specs.sh
> +++ b/tools/musl-gcc.specs.sh
> @@ -23,7 +23,9 @@ libgcc.a%s %:if-exists(libgcc_eh.a%s)
>  crtendS.o%s $libdir/crtn.o
>
>  *link:
> --dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static}
> %{rdynamic:-export-dynamic}
> +-dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static} \
> + %{rdynamic:-export-dynamic} %{m64:-melf_x86_64} %{mx32:-melf32_x86_64} \
> + %{m32:-melf_i386}
>
>  *esp_link:
>
> --
> 2.20.1
>
>

[-- Attachment #2: Type: text/html, Size: 1742 bytes --]

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

* Re: Re: [PATCH] Enable multilib support when building with musl-gcc
  2019-02-21 14:22 ` James Larrowe
@ 2019-02-21 14:44   ` Szabolcs Nagy
  2019-02-21 14:50     ` James Larrowe
  0 siblings, 1 reply; 5+ messages in thread
From: Szabolcs Nagy @ 2019-02-21 14:44 UTC (permalink / raw)
  To: musl; +Cc: James Larrowe

* James Larrowe <larrowe.semaj11@gmail.com> [2019-02-21 09:22:26 -0500]:
> Ping. Is there anything wrong with this? It works for me.

it breaks all targets that musl supports except x86_64

a multilib toolchain does not have separate include paths
for different abis so even on x86_64, -m32 or -mx32
would use the wrong headers.

> On Wed, Jan 30, 2019 at 4:38 PM James Larrowe <larrowe.semaj11@gmail.com>
> wrote:
> 
> > Somewhat incomplete; enables using 32-bit musl-gcc
> > on a 64-bit system
> >
> > Signed-off-by: James Larrowe <larrowe.semaj11@gmail.com>
> > ---
> >  tools/musl-gcc.specs.sh | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/musl-gcc.specs.sh b/tools/musl-gcc.specs.sh
> > index 30492574..a73e6656 100644
> > --- a/tools/musl-gcc.specs.sh
> > +++ b/tools/musl-gcc.specs.sh
> > @@ -23,7 +23,9 @@ libgcc.a%s %:if-exists(libgcc_eh.a%s)
> >  crtendS.o%s $libdir/crtn.o
> >
> >  *link:
> > --dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static}
> > %{rdynamic:-export-dynamic}
> > +-dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static} \
> > + %{rdynamic:-export-dynamic} %{m64:-melf_x86_64} %{mx32:-melf32_x86_64} \
> > + %{m32:-melf_i386}
> >
> >  *esp_link:
> >
> > --
> > 2.20.1
> >
> >


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

* Re: Re: [PATCH] Enable multilib support when building with musl-gcc
  2019-02-21 14:44   ` Szabolcs Nagy
@ 2019-02-21 14:50     ` James Larrowe
  2019-02-21 15:26       ` Rich Felker
  0 siblings, 1 reply; 5+ messages in thread
From: James Larrowe @ 2019-02-21 14:50 UTC (permalink / raw)
  To: musl, James Larrowe

[-- Attachment #1: Type: text/plain, Size: 1744 bytes --]

It was actually intended to fix building musl with "gcc -m32". If you run
"CC='gcc -m32' ./configure && make && sudo make install" and try to run
`musl-gcc`, it doesn't work and causes some "Incompatible architcture"
errors. If there's any way I can make this better, please let me know and
I'll resend the patch.

On Thu, Feb 21, 2019 at 9:44 AM Szabolcs Nagy <nsz@port70.net> wrote:

> * James Larrowe <larrowe.semaj11@gmail.com> [2019-02-21 09:22:26 -0500]:
> > Ping. Is there anything wrong with this? It works for me.
>
> it breaks all targets that musl supports except x86_64
>
> a multilib toolchain does not have separate include paths
> for different abis so even on x86_64, -m32 or -mx32
> would use the wrong headers.
>
> > On Wed, Jan 30, 2019 at 4:38 PM James Larrowe <larrowe.semaj11@gmail.com
> >
> > wrote:
> >
> > > Somewhat incomplete; enables using 32-bit musl-gcc
> > > on a 64-bit system
> > >
> > > Signed-off-by: James Larrowe <larrowe.semaj11@gmail.com>
> > > ---
> > >  tools/musl-gcc.specs.sh | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/tools/musl-gcc.specs.sh b/tools/musl-gcc.specs.sh
> > > index 30492574..a73e6656 100644
> > > --- a/tools/musl-gcc.specs.sh
> > > +++ b/tools/musl-gcc.specs.sh
> > > @@ -23,7 +23,9 @@ libgcc.a%s %:if-exists(libgcc_eh.a%s)
> > >  crtendS.o%s $libdir/crtn.o
> > >
> > >  *link:
> > > --dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static}
> > > %{rdynamic:-export-dynamic}
> > > +-dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static} \
> > > + %{rdynamic:-export-dynamic} %{m64:-melf_x86_64}
> %{mx32:-melf32_x86_64} \
> > > + %{m32:-melf_i386}
> > >
> > >  *esp_link:
> > >
> > > --
> > > 2.20.1
> > >
> > >
>

[-- Attachment #2: Type: text/html, Size: 2953 bytes --]

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

* Re: Re: [PATCH] Enable multilib support when building with musl-gcc
  2019-02-21 14:50     ` James Larrowe
@ 2019-02-21 15:26       ` Rich Felker
  0 siblings, 0 replies; 5+ messages in thread
From: Rich Felker @ 2019-02-21 15:26 UTC (permalink / raw)
  To: musl

On Thu, Feb 21, 2019 at 09:50:04AM -0500, James Larrowe wrote:
> It was actually intended to fix building musl with "gcc -m32". If you run
> "CC='gcc -m32' ./configure && make && sudo make install" and try to run
> `musl-gcc`, it doesn't work and causes some "Incompatible architcture"
> errors. If there's any way I can make this better, please let me know and
> I'll resend the patch.

When generating the musl-gcc wrapper, the -m32 is supposed to get
inserted into it if -m32 was included in $CC. It looks like there's
some reason this doesn't work without some linker flags also being
passed, and the musl-gcc.specs file is overriding a link spec in a way
that loses them. I'm not sure what the right fix it. It might be using
the specfile mechanism to rename/clone an existing spec then including
it at the beginning of the new one, with options at the end to
override, rather than replacing the old one, but I'm not sure if that
works here.

Rich


> On Thu, Feb 21, 2019 at 9:44 AM Szabolcs Nagy <nsz@port70.net> wrote:
> 
> > * James Larrowe <larrowe.semaj11@gmail.com> [2019-02-21 09:22:26 -0500]:
> > > Ping. Is there anything wrong with this? It works for me.
> >
> > it breaks all targets that musl supports except x86_64
> >
> > a multilib toolchain does not have separate include paths
> > for different abis so even on x86_64, -m32 or -mx32
> > would use the wrong headers.
> >
> > > On Wed, Jan 30, 2019 at 4:38 PM James Larrowe <larrowe.semaj11@gmail.com
> > >
> > > wrote:
> > >
> > > > Somewhat incomplete; enables using 32-bit musl-gcc
> > > > on a 64-bit system
> > > >
> > > > Signed-off-by: James Larrowe <larrowe.semaj11@gmail.com>
> > > > ---
> > > >  tools/musl-gcc.specs.sh | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/tools/musl-gcc.specs.sh b/tools/musl-gcc.specs.sh
> > > > index 30492574..a73e6656 100644
> > > > --- a/tools/musl-gcc.specs.sh
> > > > +++ b/tools/musl-gcc.specs.sh
> > > > @@ -23,7 +23,9 @@ libgcc.a%s %:if-exists(libgcc_eh.a%s)
> > > >  crtendS.o%s $libdir/crtn.o
> > > >
> > > >  *link:
> > > > --dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static}
> > > > %{rdynamic:-export-dynamic}
> > > > +-dynamic-linker $ldso -nostdlib %{shared:-shared} %{static:-static} \
> > > > + %{rdynamic:-export-dynamic} %{m64:-melf_x86_64}
> > %{mx32:-melf32_x86_64} \
> > > > + %{m32:-melf_i386}
> > > >
> > > >  *esp_link:
> > > >
> > > > --
> > > > 2.20.1
> > > >
> > > >
> >


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

end of thread, other threads:[~2019-02-21 15:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-30 21:38 [PATCH] Enable multilib support when building with musl-gcc James Larrowe
2019-02-21 14:22 ` James Larrowe
2019-02-21 14:44   ` Szabolcs Nagy
2019-02-21 14:50     ` James Larrowe
2019-02-21 15:26       ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).