This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Support bits/syscall.h build for triarch systems


The rule in sysdeps/unix/sysv/linux/Makefile to generate
bits/syscall.h handles biarch systems (32-bit/64-bit) via
$(64bit-predefine) and $(32bit-predefine), generating a header that
can be used for both configurations.

It does not, however, support triarch systems where there are *three*
sets of syscalls available.  An existing case of this in ports is
MIPS; it also applies to x86_64 with the x32 port (not yet
integrated).

Nor is it possible for a port to provide its own version of the
makefile rule in its own sysdeps directory and have that version used.
sysdeps directories are used in an order from the most specific to the
least specific; this works well as a header inclusion order, but is
also the makefile inclusion order.  Since make uses the commands from
the *last* rule for a given target, this means that
sysdeps/unix/sysv/linux/Makefile always overrides
sysdeps/unix/sysv/linux/<arch>/Makefile.

Until the general biarch support was added in commit
abe7b661ff7a361c9fe11789bab068e44de849b0

2002-10-15  Roland McGrath  <roland@redhat.com>
            Jakub Jelinek  <jakub@redhat.com>

        * sysdeps/unix/sysv/linux/Makefile
        ($(objpfx)syscall-%.h $(objpfx)syscall-%.d): Take code from
        sparc/Makefile to produce a bi-arch file as needed.
        That's now parameterized by the variable $(64bit-predefine).
        Use LC_ALL=C for `comm' commands in that rule.
        No longer conditional on [$(no_syscall_list_h)].
        * sysdeps/unix/sysv/linux/sparc/Makefile: Remove replacement rules.
        (64bit-predefine): New variable.
        * sysdeps/unix/sysv/linux/x86_64/Makefile: Likewise.
        * sysdeps/unix/sysv/linux/s390/Makefile: New file.
        * sysdeps/unix/sysv/linux/powerpc/Makefile
        (64bit-predefine): New variable.

support for targets to have their own rule was present, in the form of
a conditional disabling the common rule for this target if they had
defined no_syscall_list_h in their own makefiles.  Code for MIPS using
that define was added later by Aleandre in
<http://sourceware.org/ml/libc-alpha/2003-03/msg00244.html> (I suppose
tested against an older version of libc that still had the
conditionals).

HJ's x32 port <https://github.com/hjl-tools/glibc/tree/hjl/x32/master>
implements a rather more complicated scheme for allowing targets to
override this makefile rule, involving a $(use-default-syscall-macros)
makefile variable set via a shell variable set in a preconfigure
script.  I don't see any real need for that complexity; I think the
old approach of a makefile variable set in the appropriate sysdeps
makefile is sufficient.  Thus, I propose this patch, which restores
the conditional that was removed in 2002, to allow no_syscall_list_h
settings to work again.  (I have a small associated ports patch to
sysdeps/unix/sysv/linux/mips/Makefile, which has set that variable
since 2003, to update a dependency on
../sysdeps/unix/sysv/linux/mips/sys/syscall.h which has not been a
correct path since the move to ports.)

2011-12-19  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/unix/sysv/linux/Makefile ($(objpfx)syscall-%.h
	$(objpfx)syscall-%.d): Restore no_syscall_list_h conditional.

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 3032026..4a8be5b 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -38,6 +38,7 @@ install-others += $(inst_includedir)/bits/syscall.h
 
 tests += tst-clone
 
+ifndef no_syscall_list_h
 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
 # For bi-arch platforms, the CPU/Makefile defines {32,64}bit-predefine and
 # we generate a file that uses <bits/wordsize.h>.
@@ -82,6 +83,7 @@ else
 endif
 	rm -f $(@:.h=.d)-t1 $(@:.h=.d)-t2
 	mv -f $(@:.h=.d)-t3 $(@:.h=.d)
+endif
 
 $(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h $(+force)
 	$(make-target-directory)

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]