diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/gcc-x86_32-has-stack-protector.sh | 8 | ||||
-rw-r--r-- | scripts/gcc-x86_64-has-stack-protector.sh | 6 | ||||
-rwxr-xr-x | scripts/kernel-doc | 40 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 5 |
4 files changed, 55 insertions, 4 deletions
diff --git a/scripts/gcc-x86_32-has-stack-protector.sh b/scripts/gcc-x86_32-has-stack-protector.sh new file mode 100644 index 000000000000..29493dc4528d --- /dev/null +++ b/scripts/gcc-x86_32-has-stack-protector.sh | |||
@@ -0,0 +1,8 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | echo "int foo(void) { char X[200]; return 3; }" | $* -S -xc -c -O0 -fstack-protector - -o - 2> /dev/null | grep -q "%gs" | ||
4 | if [ "$?" -eq "0" ] ; then | ||
5 | echo y | ||
6 | else | ||
7 | echo n | ||
8 | fi | ||
diff --git a/scripts/gcc-x86_64-has-stack-protector.sh b/scripts/gcc-x86_64-has-stack-protector.sh index 325c0a1b03b6..afaec618b395 100644 --- a/scripts/gcc-x86_64-has-stack-protector.sh +++ b/scripts/gcc-x86_64-has-stack-protector.sh | |||
@@ -1,6 +1,8 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | echo "int foo(void) { char X[200]; return 3; }" | $1 -S -xc -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs" | 3 | echo "int foo(void) { char X[200]; return 3; }" | $* -S -xc -c -O0 -mcmodel=kernel -fstack-protector - -o - 2> /dev/null | grep -q "%gs" |
4 | if [ "$?" -eq "0" ] ; then | 4 | if [ "$?" -eq "0" ] ; then |
5 | echo $2 | 5 | echo y |
6 | else | ||
7 | echo n | ||
6 | fi | 8 | fi |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 8bb83a100edb..0f11870116dc 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -1827,6 +1827,40 @@ sub reset_state { | |||
1827 | $state = 0; | 1827 | $state = 0; |
1828 | } | 1828 | } |
1829 | 1829 | ||
1830 | sub syscall_munge() { | ||
1831 | my $void = 0; | ||
1832 | |||
1833 | $prototype =~ s@[\r\n\t]+@ @gos; # strip newlines/CR's/tabs | ||
1834 | ## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) { | ||
1835 | if ($prototype =~ m/SYSCALL_DEFINE0/) { | ||
1836 | $void = 1; | ||
1837 | ## $prototype = "long sys_$1(void)"; | ||
1838 | } | ||
1839 | |||
1840 | $prototype =~ s/SYSCALL_DEFINE.*\(/long sys_/; # fix return type & func name | ||
1841 | if ($prototype =~ m/long (sys_.*?),/) { | ||
1842 | $prototype =~ s/,/\(/; | ||
1843 | } elsif ($void) { | ||
1844 | $prototype =~ s/\)/\(void\)/; | ||
1845 | } | ||
1846 | |||
1847 | # now delete all of the odd-number commas in $prototype | ||
1848 | # so that arg types & arg names don't have a comma between them | ||
1849 | my $count = 0; | ||
1850 | my $len = length($prototype); | ||
1851 | if ($void) { | ||
1852 | $len = 0; # skip the for-loop | ||
1853 | } | ||
1854 | for (my $ix = 0; $ix < $len; $ix++) { | ||
1855 | if (substr($prototype, $ix, 1) eq ',') { | ||
1856 | $count++; | ||
1857 | if ($count % 2 == 1) { | ||
1858 | substr($prototype, $ix, 1) = ' '; | ||
1859 | } | ||
1860 | } | ||
1861 | } | ||
1862 | } | ||
1863 | |||
1830 | sub process_state3_function($$) { | 1864 | sub process_state3_function($$) { |
1831 | my $x = shift; | 1865 | my $x = shift; |
1832 | my $file = shift; | 1866 | my $file = shift; |
@@ -1839,11 +1873,15 @@ sub process_state3_function($$) { | |||
1839 | elsif ($x =~ /([^\{]*)/) { | 1873 | elsif ($x =~ /([^\{]*)/) { |
1840 | $prototype .= $1; | 1874 | $prototype .= $1; |
1841 | } | 1875 | } |
1876 | |||
1842 | if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) { | 1877 | if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) { |
1843 | $prototype =~ s@/\*.*?\*/@@gos; # strip comments. | 1878 | $prototype =~ s@/\*.*?\*/@@gos; # strip comments. |
1844 | $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. | 1879 | $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. |
1845 | $prototype =~ s@^\s+@@gos; # strip leading spaces | 1880 | $prototype =~ s@^\s+@@gos; # strip leading spaces |
1846 | dump_function($prototype,$file); | 1881 | if ($prototype =~ /SYSCALL_DEFINE/) { |
1882 | syscall_munge(); | ||
1883 | } | ||
1884 | dump_function($prototype, $file); | ||
1847 | reset_state(); | 1885 | reset_state(); |
1848 | } | 1886 | } |
1849 | } | 1887 | } |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 88921611b22e..7e62303133dc 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -415,8 +415,9 @@ static int parse_elf(struct elf_info *info, const char *filename) | |||
415 | const char *secstrings | 415 | const char *secstrings |
416 | = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; | 416 | = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; |
417 | const char *secname; | 417 | const char *secname; |
418 | int nobits = sechdrs[i].sh_type == SHT_NOBITS; | ||
418 | 419 | ||
419 | if (sechdrs[i].sh_offset > info->size) { | 420 | if (!nobits && sechdrs[i].sh_offset > info->size) { |
420 | fatal("%s is truncated. sechdrs[i].sh_offset=%lu > " | 421 | fatal("%s is truncated. sechdrs[i].sh_offset=%lu > " |
421 | "sizeof(*hrd)=%zu\n", filename, | 422 | "sizeof(*hrd)=%zu\n", filename, |
422 | (unsigned long)sechdrs[i].sh_offset, | 423 | (unsigned long)sechdrs[i].sh_offset, |
@@ -425,6 +426,8 @@ static int parse_elf(struct elf_info *info, const char *filename) | |||
425 | } | 426 | } |
426 | secname = secstrings + sechdrs[i].sh_name; | 427 | secname = secstrings + sechdrs[i].sh_name; |
427 | if (strcmp(secname, ".modinfo") == 0) { | 428 | if (strcmp(secname, ".modinfo") == 0) { |
429 | if (nobits) | ||
430 | fatal("%s has NOBITS .modinfo\n", filename); | ||
428 | info->modinfo = (void *)hdr + sechdrs[i].sh_offset; | 431 | info->modinfo = (void *)hdr + sechdrs[i].sh_offset; |
429 | info->modinfo_len = sechdrs[i].sh_size; | 432 | info->modinfo_len = sechdrs[i].sh_size; |
430 | } else if (strcmp(secname, "__ksymtab") == 0) | 433 | } else if (strcmp(secname, "__ksymtab") == 0) |