This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: [libgo] PATCH: Handle system call numbers "(0x40000000 | (234))"


"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}

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