mailing list of musl libc
 help / color / mirror / code / Atom feed
* -m32
@ 2017-05-29 18:22 Jorge Almeida
  2017-05-29 20:08 ` -m32 Laurent Bercot
  0 siblings, 1 reply; 7+ messages in thread
From: Jorge Almeida @ 2017-05-29 18:22 UTC (permalink / raw)
  To: musl

I tried to compile a "hello world" program (on a x86_64 system) with
the -m32 flag of gcc:


/opt/bin/musl-gcc -static -march=native -Os -m32 -fomit-frame-pointer
-pipe -Wall  -Werror=pedantic  -Werror=implicit-function-declaration
-Wno-unused-function -pedantic -pedantic-errors
-mpreferred-stack-boundary=4 -falign-functions=1 -falign-jumps=1
-falign-loops=1 -fno-unwind-tables -fdata-sections -ffunction-sections
-Wl,--gc-sections -fno-asynchronous-unwind-tables -std=c99 -o foo
.foo.c
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../x86_64-pc-linux-gnu/bin/ld:
i386 architecture of input file
`/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/32/crtbegin.o' is incompatible
with i386:x86-64 output
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../x86_64-pc-linux-gnu/bin/ld:
i386 architecture of input file `/tmp/cc9x8D3p.o' is incompatible with
i386:x86-64 output
/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/../../../../x86_64-pc-linux-gnu/bin/ld:
i386 architecture of input file
`/usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/32/crtend.o' is incompatible
with i386:x86-64 output
collect2: error: ld returned 1 exit status
make: *** [.makefile_foo:15: foo] Error 1


Is there anything missing with my gcc, or is -m32 just not supported?

(I checked that the same program compiles and works correctly with glibc)

thanks

Jorge Almeida


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

* Re: -m32
  2017-05-29 18:22 -m32 Jorge Almeida
@ 2017-05-29 20:08 ` Laurent Bercot
  2017-05-29 21:07   ` -m32 Jorge Almeida
  0 siblings, 1 reply; 7+ messages in thread
From: Laurent Bercot @ 2017-05-29 20:08 UTC (permalink / raw)
  To: musl

>I tried to compile a "hello world" program (on a x86_64 system) with
>the -m32 flag of gcc:

  AIUI, musl doesn't support multi-arch, and considers that x86 and 
x86_64
are two different architectures. You cannot use the musl-gcc wrapper for
this, you need a cross-toolchain actually targetting your 32-bit arch.

  Fortunately, these are easy to make with the musl-cross-make tool.
  Here are a few: https://skarnet.org/toolchains/cross/
  You'll be interested in the i486* or i686* ones.

--
  Laurent



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

* Re: -m32
  2017-05-29 20:08 ` -m32 Laurent Bercot
@ 2017-05-29 21:07   ` Jorge Almeida
  2017-05-29 21:23     ` -m32 Matias Fonzo
  0 siblings, 1 reply; 7+ messages in thread
From: Jorge Almeida @ 2017-05-29 21:07 UTC (permalink / raw)
  To: musl

On Mon, May 29, 2017 at 9:08 PM, Laurent Bercot
<ska-dietlibc@skarnet.org> wrote:
>> I tried to compile a "hello world" program (on a x86_64 system) with
>> the -m32 flag of gcc:
>
>
>  AIUI, musl doesn't support multi-arch, and considers that x86 and x86_64
> are two different architectures. You cannot use the musl-gcc wrapper for
> this, you need a cross-toolchain actually targetting your 32-bit arch.

Thanks, Laurent. I want to run my binaries on a 64bit system, and I
would prefer to take advantage of its capabilities. But I have no use
for  64 bit pointers, which, in my case, are responsable for a large
size overhead. Since the m32 flg is not supported, I suppose the
target should be x32, which the musl site says is experimental (maybe
that information is outdated?)
>
>  Fortunately, these are easy to make with the musl-cross-make tool.
I'll try and see if I'm able to grokk it!

Regards

Jorge


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

* Re: -m32
  2017-05-29 21:07   ` -m32 Jorge Almeida
@ 2017-05-29 21:23     ` Matias Fonzo
  2017-05-29 22:41       ` -m32 Jorge Almeida
  0 siblings, 1 reply; 7+ messages in thread
From: Matias Fonzo @ 2017-05-29 21:23 UTC (permalink / raw)
  To: Jorge Almeida; +Cc: musl

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

Hola Jorge,

On Mon, 29 May 2017 22:07:47 +0100
Jorge Almeida <jjalmeida@gmail.com> wrote:

> On Mon, May 29, 2017 at 9:08 PM, Laurent Bercot
> <ska-dietlibc@skarnet.org> wrote:
> >> I tried to compile a "hello world" program (on a x86_64 system)
> >> with the -m32 flag of gcc:  
> >
> >
> >  AIUI, musl doesn't support multi-arch, and considers that x86 and
> > x86_64 are two different architectures. You cannot use the musl-gcc
> > wrapper for this, you need a cross-toolchain actually targetting
> > your 32-bit arch.  
> 
> Thanks, Laurent. I want to run my binaries on a 64bit system, and I
> would prefer to take advantage of its capabilities. But I have no use
> for  64 bit pointers, which, in my case, are responsable for a large
> size overhead. Since the m32 flg is not supported, I suppose the
> target should be x32, which the musl site says is experimental (maybe
> that information is outdated?)
> >
> >  Fortunately, these are easy to make with the musl-cross-make
> > tool.  
> I'll try and see if I'm able to grokk it!

Yes. musl-cross-make is an option.  If you are looking for an already
made x32 -- from time to time I publish pre-built cross-compilers based
on musl, check:

http://gungre.ch/dragora/mirror/current/compilers/darkcrusade_2017Jan05/


Regards,
Matías


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 966 bytes --]

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

* Re: -m32
  2017-05-29 21:23     ` -m32 Matias Fonzo
@ 2017-05-29 22:41       ` Jorge Almeida
  2017-05-30  0:17         ` -m32 Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: Jorge Almeida @ 2017-05-29 22:41 UTC (permalink / raw)
  To: Matias Fonzo; +Cc: musl

On Mon, May 29, 2017 at 10:23 PM, Matias Fonzo <selk@dragora.org> wrote:

> Hola Jorge,


>
> Yes. musl-cross-make is an option.  If you are looking for an already
> made x32 -- from time to time I publish pre-built cross-compilers based
> on musl, check:
>
> http://gungre.ch/dragora/mirror/current/compilers/darkcrusade_2017Jan05/
>
>
I wish I could understand the documentation in
https://github.com/richfelker/musl-cross-make (I supose this is the
official page). Until then, I just tried your pre-built  and it works
for me.

Muchas gracias!

Jorge


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

* Re: -m32
  2017-05-29 22:41       ` -m32 Jorge Almeida
@ 2017-05-30  0:17         ` Rich Felker
  2017-05-30  8:26           ` -m32 Jorge Almeida
  0 siblings, 1 reply; 7+ messages in thread
From: Rich Felker @ 2017-05-30  0:17 UTC (permalink / raw)
  To: musl

On Mon, May 29, 2017 at 11:41:29PM +0100, Jorge Almeida wrote:
> On Mon, May 29, 2017 at 10:23 PM, Matias Fonzo <selk@dragora.org> wrote:
> 
> > Hola Jorge,
> 
> 
> >
> > Yes. musl-cross-make is an option.  If you are looking for an already
> > made x32 -- from time to time I publish pre-built cross-compilers based
> > on musl, check:
> >
> > http://gungre.ch/dragora/mirror/current/compilers/darkcrusade_2017Jan05/
> >
> >
> I wish I could understand the documentation in
> https://github.com/richfelker/musl-cross-make (I supose this is the
> official page). Until then, I just tried your pre-built  and it works
> for me.
> 
> Muchas gracias!

Thanks, it's helpful to know that the documentation is unhelpful.
Basically you should just be able to do something like:

make TARGET=x86_64-linux-muslx32 OUTPUT=/where/to/install install

Add -jN as appropriate for parallel multi-core build.

Rich


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

* Re: -m32
  2017-05-30  0:17         ` -m32 Rich Felker
@ 2017-05-30  8:26           ` Jorge Almeida
  0 siblings, 0 replies; 7+ messages in thread
From: Jorge Almeida @ 2017-05-30  8:26 UTC (permalink / raw)
  To: musl

On Tue, May 30, 2017 at 1:17 AM, Rich Felker <dalias@libc.org> wrote:
>> >
> Thanks, it's helpful to know that the documentation is unhelpful.

Unhelpful for me, it doesn't mean it's not good enough for most users.
I'm probably the only subscriber of this list who is not a pro.

> Basically you should just be able to do something like:
>
> make TARGET=x86_64-linux-muslx32 OUTPUT=/where/to/install install
>
> Add -jN as appropriate for parallel multi-core build.
>
Thanks, Trying it now...

Jorge


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

end of thread, other threads:[~2017-05-30  8:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-29 18:22 -m32 Jorge Almeida
2017-05-29 20:08 ` -m32 Laurent Bercot
2017-05-29 21:07   ` -m32 Jorge Almeida
2017-05-29 21:23     ` -m32 Matias Fonzo
2017-05-29 22:41       ` -m32 Jorge Almeida
2017-05-30  0:17         ` -m32 Rich Felker
2017-05-30  8:26           ` -m32 Jorge Almeida

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