Bug 758 - syscall.h not generated properly
Summary: syscall.h not generated properly
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.3.4
: P2 critical
Target Milestone: ---
Assignee: Andreas Jaeger
URL:
Keywords:
Depends on:
Blocks: libc236
  Show dependency treegraph
 
Reported: 2005-02-22 23:52 UTC by Jim Gifford
Modified: 2018-04-19 15:01 UTC (History)
3 users (show)

See Also:
Host: mipsel-unknown-linux-gnu
Target: mips-linux
Build:
Last reconfirmed: 2005-10-17 21:14:25
fweimer: security-


Attachments
Updated Patch based on libc-alpha message (3.11 KB, patch)
2005-02-24 19:53 UTC, Jim Gifford
Details | Diff
Debian's backported patch. (5.79 KB, patch)
2005-10-17 21:13 UTC, Daniel Jacobowitz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Gifford 2005-02-22 23:52:38 UTC
When trying to compile numerous programs I stumbled accross a lot of these type
of errors. Looks to be caused by syscall.h not being generated properly.

 error: `SYS_read' undeclared (first use in this function)
 error: (Each undeclared identifier is reported only once
 error: for each function it appears in.)
 error: `SYS_write' undeclared (first use in this function)

Comparing my contents to the contents of a known working distro's version 2.3.3
of syscall.h, I noticied a big difference.

Here is my contents of syscall.h

/* Generated at libc build time from kernel syscall list.  */

#ifndef _SYSCALL_H
# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."
#endif

#include <sgidefs.h>
#if _MIPS_SIM == _ABIN32
#define SYS_Linux __NR_N32_Linux
#define SYS_Linux_syscalls __NR_N32_Linux_syscalls
#elif _MIPS_SIM == _ABI64
#else
#define SYS_Linux __NR_O32_Linux
#define SYS_Linux_syscalls __NR_O32_Linux_syscalls
#endif

The distro's version had a lot of lines simlar to the following

#define SYS_accept __NR_accept
#define SYS_fdatasync __NR_fdatasync
#define SYS_bind __NR_bind
#define SYS_mlockall __NR_mlockall
#define SYS_connect __NR_connect
#define SYS_sched_yield __NR_sched_yield

I'm using no patches to build my glibc, using the following build commands. I'm
building with linuxthreads and libcibn.

cd /usr/src/glibc-2.3.4
rm -rf nptl*
mkdir /usr/src/glibc-2.3.4-build
/usr/src/glibc-2.3.4/configure --prefix=/usr \
    --libexecdir=/usr/bin --disable-profile \
    --enable-add-ons --enable-bind-now \
    --enable-kernel=2.6.0 --without-cvs
make 
make install
Comment 1 Jim Gifford 2005-02-23 03:12:30 UTC
Was giving to me by some folks at linux-mips.org. Here is a link to the messages

http://www.linux-mips.org/archives/linux-mips/2005-02/msg00197.html
Comment 2 Jim Gifford 2005-02-23 18:29:46 UTC
A patch was proposed here on libc-alpha for this issue
http://sourceware.org/ml/libc-alpha/2004-11/msg00097.html
Comment 3 Jim Gifford 2005-02-24 19:53:57 UTC
Created attachment 422 [details]
Updated Patch based on libc-alpha message
Comment 4 Jim Gifford 2005-02-24 19:54:46 UTC
I have attached an updated patch to the one posted to libc-alpha in november
2004, I have tested the patch and it does properly generate the syscall.h file.
Comment 5 Sourceware Commits 2005-02-25 15:19:30 UTC
Subject: Bug 758

CVSROOT:	/cvs/glibc
Module name:	libc
Changes by:	aj@sources.redhat.com	2005-02-25 15:18:14

Modified files:
	sysdeps/unix/sysv/linux/mips: Makefile configure configure.in 
	sysdeps/unix/sysv/linux/mips/mips32/kern64: sysdep.h 
	sysdeps/unix/sysv/linux/mips/mips64/n32: sysdep.h 
	sysdeps/unix/sysv/linux/mips/mips64/n64: sysdep.h 

Log message:
	2004-11-11  Richard Sandiford  <rsandifo@redhat.com>
	
	[BZ #758]
	* sysdeps/unix/sysv/linux/mips/configure.in (asm-unistd.h): Only
	preprocess <asm/unistd.h> if it defines ABI-prefixed syscall names
	like __NR_N32_open.  Just include <asm/unistd.h> otherwise.
	* sysdeps/unix/sysv/linux/mips/configure: Regenerate.
	* sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h: Delete
	* sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (SYS_ify): Use the
	standard __NR prefix.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (SYS_ify): Likewise.
	* sysdeps/unix/sysv/linux/mips/Makefile (syscall-%.h): Rework so that
	the output file is compatible with both pre-2.6 and 2.6 kernel headers.
	Extract separate syscall lists for each ABI.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/Makefile.diff?cvsroot=glibc&r1=1.14&r2=1.15
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/configure.diff?cvsroot=glibc&r1=1.8&r2=1.9
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/configure.in.diff?cvsroot=glibc&r1=1.7&r2=1.8
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h.diff?cvsroot=glibc&r1=1.1&r2=1.2
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h.diff?cvsroot=glibc&r1=1.4&r2=1.5
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h.diff?cvsroot=glibc&r1=1.4&r2=1.5

Comment 6 Andreas Jaeger 2005-02-25 15:23:37 UTC
Roland, this should go into 2.3 as well.
Comment 7 Roland McGrath 2005-03-23 01:58:16 UTC
I haven't gotten confirmation that this has had testing meeting the 2.3 branch
inclusion criteria.
Comment 8 Greg Schafer 2005-07-17 05:22:48 UTC
(In reply to comment #7)
> I haven't gotten confirmation that this has had testing meeting the 2.3 branch
> inclusion criteria.

Roland, mips64 won't even build without this fix. Would it be possible to relax
the inclusion criteria on this occasion? If you do decide to apply it on the
branch, this fixup is also needed:

http://sources.redhat.com/ml/glibc-cvs/2005-q1/msg00811.html

Thanks
Comment 9 Roland McGrath 2005-07-18 03:53:36 UTC
The relevant criterion is that someone testify that they have built a 2.3-based
glibc using this patch into a production or production-testing binary form and
had real-world testing of it.  If there is noone who can get even that minimally
serious about mips maintenance, then the changes do not belong in the 2.3 branch.
It's not a hard requirement to meet, and I cannot imagine how you could be in
the position of caring what's in the 2.3 branch without already having done the
requisite work of making a usable package with the necessary patch and testing it.
Comment 10 Daniel Jacobowitz 2005-07-18 16:43:11 UTC
MontaVista applies this patch to glibc 2.3.4 and 2.3.5 (the patch attached to
the bug is mildly whitespace-mangled, but functionally the same).  Does that help?

Debian uses a somewhat different patch that I wrote before Richard's better version.
Comment 11 Roland McGrath 2005-07-19 08:58:26 UTC
Can you send me a nonmangled patch against the current 2.3 branch, that you have
tested?  If you do some work beyond merging and have your own log entry, send
that; otherwise, I'll use the trunk log entry shown in this bug and your patch
should match its description of changes.
Comment 12 Daniel Jacobowitz 2005-10-17 21:13:33 UTC
Created attachment 716 [details]
Debian's backported patch.

This is the patch that Debian now applies.  All I changed from Richard's
posting was a couple of _MIPS_SIM vs _ABI macros that changed after 2.3.
Comment 13 Sourceware Commits 2005-10-23 00:42:59 UTC
Subject: Bug 758

CVSROOT:	/cvs/glibc
Module name:	libc
Branch: 	glibc-2_3-branch
Changes by:	roland@sources.redhat.com	2005-10-23 00:42:56

Modified files:
	sysdeps/unix/sysv/linux/mips: Makefile configure configure.in 
	sysdeps/unix/sysv/linux/mips/mips64/n32: sysdep.h 
	sysdeps/unix/sysv/linux/mips/mips32/kern64: sysdep.h 
	sysdeps/unix/sysv/linux/mips/mips64/n64: sysdep.h 

Log message:
	2004-11-11  Richard Sandiford  <rsandifo@redhat.com>
	
	[BZ #758]
	* sysdeps/unix/sysv/linux/mips/configure.in (asm-unistd.h): Only
	preprocess <asm/unistd.h> if it defines ABI-prefixed syscall names
	like __NR_N32_open.  Just include <asm/unistd.h> otherwise.
	* sysdeps/unix/sysv/linux/mips/configure: Regenerate.
	* sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h: Delete
	* sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h (SYS_ify): Use the
	standard __NR prefix.
	* sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h (SYS_ify): Likewise.
	* sysdeps/unix/sysv/linux/mips/Makefile (syscall-%.h): Rework so that
	the output file is compatible with both pre-2.6 and 2.6 kernel headers.
	Extract separate syscall lists for each ABI.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/Makefile.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.14&r2=1.14.2.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/configure.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.8&r2=1.8.2.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/configure.in.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.7&r2=1.7.2.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/mips64/n32/sysdep.h.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.4&r2=1.4.2.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.1&r2=1.1.4.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/mips64/n64/sysdep.h.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.4&r2=1.4.2.1

Comment 14 Roland McGrath 2005-11-04 21:43:36 UTC
This bug should be fixed in the 2.3.6 release just made.
Comment 15 Sourceware Commits 2005-11-15 02:08:23 UTC
Subject: Bug 758

CVSROOT:	/cvs/glibc
Module name:	libc
Branch: 	glibc-2_3-branch
Changes by:	roland@sources.redhat.com	2005-11-15 02:08:20

Modified files:
	.              : ChangeLog 
Removed files:
	sysdeps/unix/sysv/linux/mips/mips32/kern64: sysdep.h 

Log message:
	2005-11-14  Roland McGrath  <roland@redhat.com>
	
	[BZ #758]
	* sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h: Really remove.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/mips/mips32/kern64/sysdep.h.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.1.4.1&r2=NONE
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/ChangeLog.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.9088.2.75&r2=1.9088.2.76