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]

libgo patch committed: Define F_GETLK and friends on i386 GNU/Linux


On i386 GNU/Linux, when compiling with -D_FILE_OFFSET_BITS=64, <fcntl.h>
winds up doing this:

#  define F_GETLK	F_GETLK64  /* Get record locking info.	*/
...
# define F_GETLK64	12	/* Get record locking info.  */

Because of the ordering, -fdump-go-spec does not write F_GETLK into the
file that it creates.  The effect is that syscall.F_GETLK is not defined
for i386 GNU/Linux.  This patch fixes the problem.  Bootstrapped and ran
Go testsuite on x86_64-unknown-linux-gnu, both 32-bit and 64-bit mode.
Committed to mainline and 4.7 branch.

Ian

diff -r a602dc132c2d libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Tue Aug 14 20:46:42 2012 -0700
+++ b/libgo/mksysinfo.sh	Mon Aug 20 22:10:34 2012 -0700
@@ -211,6 +211,16 @@
   echo "const O_CLOEXEC = 0" >> ${OUT}
 fi
 
+# These flags can be lost on i386 GNU/Linux when using
+# -D_FILE_OFFSET_BITS=64, because we see "#define F_SETLK F_SETLK64"
+# before we see the definition of F_SETLK64.
+for flag in F_GETLK F_SETLK F_SETLKW; do
+  if ! grep "^const ${flag} " ${OUT} >/dev/null 2>&1 \
+      && grep "^const ${flag}64 " ${OUT} >/dev/null 2>&1; then
+    echo "const ${flag} = ${flag}64" >> ${OUT}
+  fi
+done
+
 # The signal numbers.
 grep '^const _SIG[^_]' gen-sysinfo.go | \
   grep -v '^const _SIGEV_' | \

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