public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* Building syscall.h on mips
@ 2012-05-22 21:02 Steve Ellcey 
  2012-05-22 21:10 ` Joseph S. Myers
  0 siblings, 1 reply; 6+ messages in thread
From: Steve Ellcey  @ 2012-05-22 21:02 UTC (permalink / raw)
  To: libc-ports


I am trying to build the ToT glibc on MIPS and am running into a problem.
I build it 8 different ways for various versions and when I compile it with
'gcc -mips32', it fails to build.  This is due to the syscall-list changes
in glibc-ports/sysdeps/unix/sysv/linux/mips/Makefile.

With these changes, the Makefile is trying to run GCC with '-mips32 -mabi=n32'
which is an illegal combination.  The -mips32 comes from my setting of CC and
the -mabi=n32 is coming from syscall-list-n32-options in the Makefile.

I was able to fix things with this patch:

diff --git a/ports/sysdeps/unix/sysv/linux/mips/Makefile b/ports/sysdeps/unix/sy
index 41e9258..a8aebf7 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/Makefile
+++ b/ports/sysdeps/unix/sysv/linux/mips/Makefile
@@ -9,11 +9,11 @@ sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
 
 syscall-list-variants := o32 n32 n64
 syscall-list-includes := sgidefs.h
-syscall-list-o32-options := -mabi=32
+syscall-list-o32-options := -mips32 -march=mips32
 syscall-list-o32-condition := _MIPS_SIM == _MIPS_SIM_ABI32
-syscall-list-n32-options := -mabi=n32
+syscall-list-n32-options := -mips32r2 -march=mips32r2
 syscall-list-n32-condition := _MIPS_SIM == _MIPS_SIM_ABIN32
-syscall-list-n64-options := -mabi=64
+syscall-list-n64-options := -mips64 -march=mips64
 syscall-list-n64-condition := _MIPS_SIM == _MIPS_SIM_ABI64
 endif

But I noticed that when I did this syscall.h had 3 sections, ifdefed
using the above conditions and each one was identical.  So rather then
change the options I just removed them along with the conditions and
syscall-list-variants.  This gave me a syscall.h that looks very
similar to glibc 1.14.  The only difference is that the new file has
an include of sgidefs.h.

diff --git a/sysdeps/unix/sysv/linux/mips/Makefile b/sysdeps/unix/sysv/linux/mip
index 41e9258..2d5ec60 100644
--- a/sysdeps/unix/sysv/linux/mips/Makefile
+++ b/sysdeps/unix/sysv/linux/mips/Makefile
@@ -4,17 +4,8 @@ endif
 
 ifeq ($(subdir),misc)
 sysdep_routines += cachectl cacheflush sysmips _test_and_set
-
 sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
-
-syscall-list-variants := o32 n32 n64
 syscall-list-includes := sgidefs.h
-syscall-list-o32-options := -mabi=32
-syscall-list-o32-condition := _MIPS_SIM == _MIPS_SIM_ABI32
-syscall-list-n32-options := -mabi=n32
-syscall-list-n32-condition := _MIPS_SIM == _MIPS_SIM_ABIN32
-syscall-list-n64-options := -mabi=64
-syscall-list-n64-condition := _MIPS_SIM == _MIPS_SIM_ABI64
 endif
 
 ifeq ($(subdir),elf)


So, does this second patch look OK for glibc-ports for MIPS?

Steve Ellcey
sellcey@mips.com

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

* Re: Building syscall.h on mips
  2012-05-22 21:02 Building syscall.h on mips Steve Ellcey 
@ 2012-05-22 21:10 ` Joseph S. Myers
  2012-05-22 22:40   ` Steve Ellcey
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph S. Myers @ 2012-05-22 21:10 UTC (permalink / raw)
  To: Steve Ellcey; +Cc: libc-ports

On Tue, 22 May 2012, Steve Ellcey  wrote:

> So, does this second patch look OK for glibc-ports for MIPS?

No, it's definitely wrong.  The header needs to have three sections, each 
one with the syscalls relevant to that particular ABI.  Those sets are 
similar, but not the same.  The MIPS build of this header was broken for a 
long time (see 
<http://sourceware.org/ml/libc-alpha/2011-12/msg00046.html>).

If you can't get -m options working there, maybe it's necessary to use 
entirely -U and -D options in the -options variables - those options being 
such as to make the MIPS asm/unistd.h define the correct set of syscalls 
for each ABI.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: Building syscall.h on mips
  2012-05-22 21:10 ` Joseph S. Myers
@ 2012-05-22 22:40   ` Steve Ellcey
  2012-05-23  0:06     ` Joseph S. Myers
  0 siblings, 1 reply; 6+ messages in thread
From: Steve Ellcey @ 2012-05-22 22:40 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: libc-ports

On Tue, 2012-05-22 at 21:10 +0000, Joseph S. Myers wrote:
> On Tue, 22 May 2012, Steve Ellcey  wrote:
> 
> > So, does this second patch look OK for glibc-ports for MIPS?
> 
> No, it's definitely wrong.  The header needs to have three sections, each 
> one with the syscalls relevant to that particular ABI.  Those sets are 
> similar, but not the same.  The MIPS build of this header was broken for a 
> long time (see 
> <http://sourceware.org/ml/libc-alpha/2011-12/msg00046.html>).
> 
> If you can't get -m options working there, maybe it's necessary to use 
> entirely -U and -D options in the -options variables - those options being 
> such as to make the MIPS asm/unistd.h define the correct set of syscalls 
> for each ABI.

Ok, I think I have it now.  With these -D flags, I get similar but not
identical sets for the three ifdef's.  I would have liked to use
_MIPS_SIM_ABI32, etc in the -D instead of 1,2,3 but that did not seem to
work.

How does this patch look?

Steve Ellcey
sellcey@mips.com


diff --git a/sysdeps/unix/sysv/linux/mips/Makefile
b/sysdeps/unix/sysv/linux/mip
index 41e9258..2aaf63c 100644
--- a/sysdeps/unix/sysv/linux/mips/Makefile
+++ b/sysdeps/unix/sysv/linux/mips/Makefile
@@ -7,13 +7,14 @@ sysdep_routines += cachectl cacheflush sysmips
_test_and_set
 
 sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
 
+# _MIPS_SIM_ABI32 == 1, _MIPS_SIM_ABIN32 == 2, _MIPS_SIM_ABI64 == 3
 syscall-list-variants := o32 n32 n64
 syscall-list-includes := sgidefs.h
-syscall-list-o32-options := -mabi=32
+syscall-list-o32-options := -D_MIPS_SIM=1
 syscall-list-o32-condition := _MIPS_SIM == _MIPS_SIM_ABI32
-syscall-list-n32-options := -mabi=n32
+syscall-list-n32-options := -D_MIPS_SIM=2
 syscall-list-n32-condition := _MIPS_SIM == _MIPS_SIM_ABIN32
-syscall-list-n64-options := -mabi=64
+syscall-list-n64-options := -D_MIPS_SIM=3
 syscall-list-n64-condition := _MIPS_SIM == _MIPS_SIM_ABI64
 endif

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

* Re: Building syscall.h on mips
  2012-05-22 22:40   ` Steve Ellcey
@ 2012-05-23  0:06     ` Joseph S. Myers
  2012-05-23 15:47       ` Steve Ellcey
  0 siblings, 1 reply; 6+ messages in thread
From: Joseph S. Myers @ 2012-05-23  0:06 UTC (permalink / raw)
  To: Steve Ellcey; +Cc: libc-ports

On Tue, 22 May 2012, Steve Ellcey wrote:

> Ok, I think I have it now.  With these -D flags, I get similar but not
> identical sets for the three ifdef's.  I would have liked to use
> _MIPS_SIM_ABI32, etc in the -D instead of 1,2,3 but that did not seem to
> work.
> 
> How does this patch look?

It looks good but appears to have a line wrapped so it doesn't apply 
cleanly - could you send a patch with whitespace preserved, and a 
ChangeLog entry to go in ChangeLog.mips?

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: Building syscall.h on mips
  2012-05-23  0:06     ` Joseph S. Myers
@ 2012-05-23 15:47       ` Steve Ellcey
  2012-05-23 18:49         ` Joseph S. Myers
  0 siblings, 1 reply; 6+ messages in thread
From: Steve Ellcey @ 2012-05-23 15:47 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: libc-ports

On Wed, 2012-05-23 at 00:06 +0000, Joseph S. Myers wrote:
> On Tue, 22 May 2012, Steve Ellcey wrote:
> 
> > Ok, I think I have it now.  With these -D flags, I get similar but not
> > identical sets for the three ifdef's.  I would have liked to use
> > _MIPS_SIM_ABI32, etc in the -D instead of 1,2,3 but that did not seem to
> > work.
> > 
> > How does this patch look?
> 
> It looks good but appears to have a line wrapped so it doesn't apply 
> cleanly - could you send a patch with whitespace preserved, and a 
> ChangeLog entry to go in ChangeLog.mips?

Here is a ChangeLog Entry:

2012-05-23  Steve Ellcey  <sellcey@mips.com>

	* sysdeps/unix/sysv/linux/mips/Makefile: Modify
	syscall-list-*-options to use -D flags.



And here is the (hopefully unwrapped) diff:


diff --git a/sysdeps/unix/sysv/linux/mips/Makefile b/sysdeps/unix/sysv/linux/mips/Makefile
index 41e9258..2aaf63c 100644
--- a/sysdeps/unix/sysv/linux/mips/Makefile
+++ b/sysdeps/unix/sysv/linux/mips/Makefile
@@ -7,13 +7,14 @@ sysdep_routines += cachectl cacheflush sysmips _test_and_set
 
 sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
 
+# _MIPS_SIM_ABI32 == 1, _MIPS_SIM_ABIN32 == 2, _MIPS_SIM_ABI64 == 3
 syscall-list-variants := o32 n32 n64
 syscall-list-includes := sgidefs.h
-syscall-list-o32-options := -mabi=32
+syscall-list-o32-options := -D_MIPS_SIM=1
 syscall-list-o32-condition := _MIPS_SIM == _MIPS_SIM_ABI32
-syscall-list-n32-options := -mabi=n32
+syscall-list-n32-options := -D_MIPS_SIM=2
 syscall-list-n32-condition := _MIPS_SIM == _MIPS_SIM_ABIN32
-syscall-list-n64-options := -mabi=64
+syscall-list-n64-options := -D_MIPS_SIM=3
 syscall-list-n64-condition := _MIPS_SIM == _MIPS_SIM_ABI64
 endif
 


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

* Re: Building syscall.h on mips
  2012-05-23 15:47       ` Steve Ellcey
@ 2012-05-23 18:49         ` Joseph S. Myers
  0 siblings, 0 replies; 6+ messages in thread
From: Joseph S. Myers @ 2012-05-23 18:49 UTC (permalink / raw)
  To: Steve Ellcey; +Cc: libc-ports

On Wed, 23 May 2012, Steve Ellcey wrote:

> Here is a ChangeLog Entry:
> 
> 2012-05-23  Steve Ellcey  <sellcey@mips.com>
> 
> 	* sysdeps/unix/sysv/linux/mips/Makefile: Modify
> 	syscall-list-*-options to use -D flags.
> 
> And here is the (hopefully unwrapped) diff:

Thanks, I've reworked the ChangeLog entry to name the individual makefile 
variables changed and committed the patch.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

end of thread, other threads:[~2012-05-23 18:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-22 21:02 Building syscall.h on mips Steve Ellcey 
2012-05-22 21:10 ` Joseph S. Myers
2012-05-22 22:40   ` Steve Ellcey
2012-05-23  0:06     ` Joseph S. Myers
2012-05-23 15:47       ` Steve Ellcey
2012-05-23 18:49         ` Joseph S. Myers

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