This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libgo] PATCH: Handle system call numbers "(0x40000000 | (234))"
- From: Ian Lance Taylor <iant at google dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 09 Dec 2011 14:47:07 -0800
- Subject: Re: [libgo] PATCH: Handle system call numbers "(0x40000000 | (234))"
- References: <20111209214430.GA31757@intel.com>
"H.J. Lu" <hongjiu.lu@intel.com> writes:
> Some my Linux system, system call numbers are defined as
>
> #define __NR_x32_rt_sigaction __NR_X32_SYSCALL(0)
>
> and
>
> __NR_X32_SYSCALL(0) is expanded to (0x40000000 | (512 + 0)). This patch
> tries to deal with by checking '^// unknowndefine SYS_[a-z]' and uses
> "${CC} -E" to extract the real number. Tested on Linux/x86-64. OK
> to install?
This patch might be a little simpler. Does it solve the problem?
Ian
diff -r 864416b061a9 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh Fri Dec 09 08:46:12 2011 -0800
+++ b/libgo/mksysinfo.sh Fri Dec 09 14:45:52 2011 -0800
@@ -97,6 +97,13 @@
${CC} -fdump-go-spec=gen-sysinfo.go -std=gnu99 -S -o sysinfo.s sysinfo.c
+# Pick up some constants that may be defined using preprocessor
+# macros.
+grep '^// unknowndefine SYS_' gen-sysinfo.go | \
+ sed -e 's|^// unknowndefine \(SYS_[^ ]*\) \(.*\)$|enum { \1 = \2 };|' \
+ >> sysinfo.c
+${CC} -fdump-go-spec=gen-sysinfo.go -std=gnu99 -S -o sysinfo.s sysinfo.c
+
echo 'package syscall' > ${OUT}
echo 'import "unsafe"' >> ${OUT}
echo 'type _ unsafe.Pointer' >> ${OUT}