mailing list of musl libc
 help / color / mirror / code / Atom feed
* Trouble compiling musl for MIPS softfloat
@ 2015-05-24  4:36 Arjen Roodselaar
  2015-05-24 12:45 ` Szabolcs Nagy
  0 siblings, 1 reply; 5+ messages in thread
From: Arjen Roodselaar @ 2015-05-24  4:36 UTC (permalink / raw)
  To: musl

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

I am trying to compile musl for use on devices powered by a MIPS 24kc, a SoC without hardware floating point support. The supported target architectures list specifically mentions this, but so far I have been unable to get this working. In short, using mips-sf-linux-gnu as the target in the configure step seems to enable soft float support as per this output: https://gist.github.com/arjenroodselaar/f8d20534b0d8c7542d01. When linking however ld warns about a small number of files being compiled with -mhard–float, resulting in crt1.so to use -mhard–float: https://gist.github.com/arjenroodselaar/270df6970b2bd43c9bce. This then trickles down in anything I try to link against libc. Ignoring all this and simply compiling hard-float binaries is causing problems when executing malloc.

Tools used here:

Binutils-2.25
Gcc-4.8.4
Musl-1.1.9

(I tried musl 1.0.5 and gcc 4.9.2 but neither seem to make a difference here).

Am I missing something here or is soft float support for MIPS currently broken? Any help is appreciated.

Thanks,
Arjen Roodselaar

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

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

* Re: Trouble compiling musl for MIPS softfloat
  2015-05-24  4:36 Trouble compiling musl for MIPS softfloat Arjen Roodselaar
@ 2015-05-24 12:45 ` Szabolcs Nagy
  2015-05-24 16:18   ` Rich Felker
  2015-05-24 22:09   ` Arjen Roodselaar
  0 siblings, 2 replies; 5+ messages in thread
From: Szabolcs Nagy @ 2015-05-24 12:45 UTC (permalink / raw)
  To: musl

* Arjen Roodselaar <arjen@fb.com> [2015-05-24 04:36:52 +0000]:
> I am trying to compile musl for use on devices powered by a MIPS 24kc, a SoC without hardware floating point support. The supported target architectures list specifically mentions this, but so far I have been unable to get this working. In short, using mips-sf-linux-gnu as the target in the configure step seems to enable soft float support as per this output: https://gist.github.com/arjenroodselaar/f8d20534b0d8c7542d01. When linking however ld warns about a small number of files being compiled with -mhard?float, resulting in crt1.so to use -mhard?float: https://gist.github.com/arjenroodselaar/270df6970b2bd43c9bce. This then trickles down in anything I try to link against libc. Ignoring all this and simply compiling hard-float binaries is causing problems when executing malloc.
> 
> Tools used here:
> 
> Binutils-2.25
> Gcc-4.8.4
> Musl-1.1.9
> 

works here with
binutils-2.24
gcc-4.8.2
musl-1.1.9

i get an assembler warning for the crt asm though:

{standard input}:32: Warning: macro instruction expanded into multiple instructions in a branch delay slot

for this insn:

         and $sp, $sp, -8

which turns into

  38:	2401fff8 	li	at,-8
  3c:	03a1e824 	and	sp,sp,at

(but this is not soft-float related, just the new start code in 1.1.9)

> (I tried musl 1.0.5 and gcc 4.9.2 but neither seem to make a difference here).
> 
> Am I missing something here or is soft float support for MIPS currently broken? Any help is appreciated.

your problem seems to be that asm is assumed to be
hardfloat by your toolchain.

(ie the assembler does not get the -msoft-float flag
properly)

you may try to add

CFLAGS += -Wa,-msoft-float

to your config.mak

(i have no idea why this would be needed, you may want
to send the build command and its output when -v added
for one of the files that turned to hard float
eg.

 rm src/setjmp/setjmp.lo
 make src/setjmp/setjmp.lo

and copy the build command, add -v to the end, and send us the
command and output and maybe readelf -aW src/setjmp/setjmp.lo
output too)


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

* Re: Trouble compiling musl for MIPS softfloat
  2015-05-24 12:45 ` Szabolcs Nagy
@ 2015-05-24 16:18   ` Rich Felker
  2015-05-24 22:09   ` Arjen Roodselaar
  1 sibling, 0 replies; 5+ messages in thread
From: Rich Felker @ 2015-05-24 16:18 UTC (permalink / raw)
  To: musl

On Sun, May 24, 2015 at 02:45:40PM +0200, Szabolcs Nagy wrote:
> i get an assembler warning for the crt asm though:
> 
> {standard input}:32: Warning: macro instruction expanded into multiple instructions in a branch delay slot
> 
> for this insn:
> 
>          and $sp, $sp, -8
> 
> which turns into
> 
>   38:	2401fff8 	li	at,-8
>   3c:	03a1e824 	and	sp,sp,at
> 
> (but this is not soft-float related, just the new start code in 1.1.9)

This looks like a potentially serious bug, omitting stack alignment.
It shouldn't matter as long as crt_arch.h is only used in dlstart.lo
(where the kernel normally gives an aligned stack pointer to begin
with) but I want to remove crt/*/crt1.s within the next couple release
cycles, and then it would matter.

Rich


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

* Re: Trouble compiling musl for MIPS softfloat
  2015-05-24 12:45 ` Szabolcs Nagy
  2015-05-24 16:18   ` Rich Felker
@ 2015-05-24 22:09   ` Arjen Roodselaar
  2015-05-25 20:14     ` Rich Felker
  1 sibling, 1 reply; 5+ messages in thread
From: Arjen Roodselaar @ 2015-05-24 22:09 UTC (permalink / raw)
  To: musl

Passing -Wa,-msoft-float to the assembler works like a charm. Reading your
reply I realized I had been looking for a way to pass this on to the
assembler but did not realize I should just pass that same flag. I guess
it was a long day yesterday. Thank you for the quick reply on this!

1.1.9 indeed produces a few of those warnings mentioned so for now I will
continue with 1.1.8. Rich, should I open an issue somewhere to make sure
this gets looked in to?

On 5/24/15, 5:45 AM, "Szabolcs Nagy" <nsz@port70.net> wrote:

>* Arjen Roodselaar <arjen@fb.com> [2015-05-24 04:36:52 +0000]:
>> I am trying to compile musl for use on devices powered by a MIPS 24kc,
>>a SoC without hardware floating point support. The supported target
>>architectures list specifically mentions this, but so far I have been
>>unable to get this working. In short, using mips-sf-linux-gnu as the
>>target in the configure step seems to enable soft float support as per
>>this output: 
>>https://gist.github.com/arjenroodselaar/f8d20534b0d8c7542d01. When
>>linking however ld warns about a small number of files being compiled
>>with -mhard?float, resulting in crt1.so to use -mhard?float:
>>https://gist.github.com/arjenroodselaar/270df6970b2bd43c9bce. This then
>>trickles down in anything I try to link against libc. Ignoring all this
>>and simply compiling hard-float binaries is causing problems when
>>executing malloc.
>> 
>> Tools used here:
>> 
>> Binutils-2.25
>> Gcc-4.8.4
>> Musl-1.1.9
>> 
>
>works here with
>binutils-2.24
>gcc-4.8.2
>musl-1.1.9
>
>i get an assembler warning for the crt asm though:
>
>{standard input}:32: Warning: macro instruction expanded into multiple
>instructions in a branch delay slot
>
>for this insn:
>
>         and $sp, $sp, -8
>
>which turns into
>
>  38:	2401fff8 	li	at,-8
>  3c:	03a1e824 	and	sp,sp,at
>
>(but this is not soft-float related, just the new start code in 1.1.9)
>
>> (I tried musl 1.0.5 and gcc 4.9.2 but neither seem to make a difference
>>here).
>> 
>> Am I missing something here or is soft float support for MIPS currently
>>broken? Any help is appreciated.
>
>your problem seems to be that asm is assumed to be
>hardfloat by your toolchain.
>
>(ie the assembler does not get the -msoft-float flag
>properly)
>
>you may try to add
>
>CFLAGS += -Wa,-msoft-float
>
>to your config.mak
>
>(i have no idea why this would be needed, you may want
>to send the build command and its output when -v added
>for one of the files that turned to hard float
>eg.
>
> rm src/setjmp/setjmp.lo
> make src/setjmp/setjmp.lo
>
>and copy the build command, add -v to the end, and send us the
>command and output and maybe readelf -aW src/setjmp/setjmp.lo
>output too)



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

* Re: Trouble compiling musl for MIPS softfloat
  2015-05-24 22:09   ` Arjen Roodselaar
@ 2015-05-25 20:14     ` Rich Felker
  0 siblings, 0 replies; 5+ messages in thread
From: Rich Felker @ 2015-05-25 20:14 UTC (permalink / raw)
  To: musl

On Sun, May 24, 2015 at 10:09:58PM +0000, Arjen Roodselaar wrote:
> Passing -Wa,-msoft-float to the assembler works like a charm. Reading your
> reply I realized I had been looking for a way to pass this on to the
> assembler but did not realize I should just pass that same flag. I guess
> it was a long day yesterday. Thank you for the quick reply on this!
> 
> 1.1.9 indeed produces a few of those warnings mentioned so for now I will
> continue with 1.1.8. Rich, should I open an issue somewhere to make sure
> this gets looked in to?

As of commit 9f26ebded188ed78c3571a4ca1477dd6351bc647 they should be
fixed. Let me know if you see any remaining such warnings. Thanks!

Rich


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

end of thread, other threads:[~2015-05-25 20:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-24  4:36 Trouble compiling musl for MIPS softfloat Arjen Roodselaar
2015-05-24 12:45 ` Szabolcs Nagy
2015-05-24 16:18   ` Rich Felker
2015-05-24 22:09   ` Arjen Roodselaar
2015-05-25 20:14     ` 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).