aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@canonical.com>2011-09-16 13:20:31 +0100
committerJohn Rigby <john.rigby@linaro.org>2011-11-16 14:49:26 -0700
commite9f90afe36d0ab064abe74b3a10208446bcf9557 (patch)
tree4d8e5b3f92d130449fe4a2761c4d5f6ff943786f /scripts
parent5c4ecbfe21d654f825080dde133cf37ff5e3d12d (diff)
downloadlinux-linaro-precise-e9f90afe36d0ab064abe74b3a10208446bcf9557.tar.gz
UBUNTU: SAUCE: headers_install: fix #include "..." usage for userspace
When headers are converted to userspace headers they may include relative includes. For example x86 has the following in its asm/posix_types.h: # ifdef __i386__ # include "posix_types_32.h" # else # include "posix_types_64.h" # endif However this is not safe in the face of the gcc option -I- which removes "the directory the file I am being included from" from the search list. Convert these references to <dir/...> form avoiding this. BugLink: http://bugs.launchpad.net/bugs/824377 Signed-off-by: Andy Whitcroft <apw@canonical.com> Acked-by: Tim Gardner <tim.gardner@canonical.com> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.headersinst4
-rw-r--r--scripts/headers_install.pl8
2 files changed, 9 insertions, 3 deletions
diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index a57f5bd5a13..b4018c57989 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -50,8 +50,8 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
file$(if $(word 2, $(all-files)),s))
cmd_install = \
- $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \
- $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \
+ $(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(printdir) $(header-y); \
+ $(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(printdir) $(objhdr-y); \
for F in $(wrapper-files); do \
echo "\#include <asm-generic/$$F>" > $(install)/$$F; \
done; \
diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
index 48462be328b..9f56fc50116 100644
--- a/scripts/headers_install.pl
+++ b/scripts/headers_install.pl
@@ -18,7 +18,9 @@
use strict;
-my ($readdir, $installdir, $arch, @files) = @ARGV;
+my ($readdir, $installdir, $arch, $printdir, @files) = @ARGV;
+
+$printdir =~ s@^include/@@;
my $unifdef = "scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__";
@@ -30,6 +32,10 @@ foreach my $file (@files) {
open(my $out, '>', $tmpfile)
or die "$tmpfile: $!\n";
while (my $line = <$in>) {
+ # Any #include which uses "" and does not have a path needs
+ # rewriting so that the resultant user space headers are
+ # safe against the use of -I-.
+ $line =~ s/^(\s*#\s*include\s+)"([^\/]*?)"/$1<$printdir\/$2>/;
$line =~ s/([\s(])__user\s/$1/g;
$line =~ s/([\s(])__force\s/$1/g;
$line =~ s/([\s(])__iomem\s/$1/g;