This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] BZ#15711: Build syscall.h with -ffreestanding.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: David Miller <davem at davemloft dot net>
- Date: Fri, 05 Jul 2013 07:56:02 -0400
- Subject: [PATCH] BZ#15711: Build syscall.h with -ffreestanding.
Building as root with --prefix=/usr causes and infinite build loop.
I could have built as non-root, but in this case I was on a Red Hat
build farm box and I didn't want to bother with the extra steps
required to build as non-root. We should not fail this spectacularly
when building as root.
The loop is caused by a auto-generated prerequisite between
/usr/include/stdc-predef.h and $BUILD/misc/bits/syscall.d.
As root we can install stdc-predef.h if it is required to
be updated by building syscall.h. This leads to an infinite
loop between the update of the two files.
The fix is to break the auto-generated prerequisite by building
with -ffreestanding. The syscall.h file doesn't need stdc-predef.h
Tested by building as root with --prefix=/usr on x86-64 and verifying
that the generated syscall.h files were the same.
OK to checkin?
2013-07-05 Carlos O'Donell <carlos@redhat.com>
[BZ #15711]
* sysdeps/unix/sysv/linux/Makefile ($(objpfx)bits/syscall%h):
Avoid system header dependency with -ffreestanding.
($(objpfx)bits/syscall%d): Likewise.
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index f580635..401ae39 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -64,7 +64,7 @@ $(objpfx)bits/syscall%h $(objpfx)bits/syscall%d: ../sysdeps/unix/sysv/linux/sys/
echo ''; \
$(if $(abi-variants), \
$(foreach v,$(abi-variants),\
- $(CC) -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
+ $(CC) -ffreestanding -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
-x c $(sysincludes) $< $(abi-$(v)-options) \
-D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
@@ -75,7 +75,7 @@ $(objpfx)bits/syscall%h $(objpfx)bits/syscall%d: ../sysdeps/unix/sysv/linux/sys/
$(if $(abi-$(v)-condition),echo '#endif';) \
rm -f $(@:.d=.h).new$(v); \
), \
- $(CC) -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
+ $(CC) -ffreestanding -E -MD -MP -MF $(@:.h=.d)-t$(v) -MT '$(@:.d=.h) $(@:.h=.d)' \
-x c $(sysincludes) $< \
-D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
---
Cheers,
Carlos.