diff mbox

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

Message ID mcrboi4olrn.fsf@dhcp-172-18-216-180.mtv.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor Aug. 21, 2012, 5:29 a.m. UTC
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 mbox

Patch

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_' | \