From 26d7f93ed9aa4b60a203b8db79b337a680ea09e9 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 1 May 2017 17:04:37 +0200 Subject: [PATCH] perl: Fix Errno.pm generation for GCC >= 5 Signed-off-by: Michael Tremer --- lfs/perl | 1 + ...-Fix-Errno.pm-generation-for-gcc-5.0.patch | 66 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 src/patches/perl-Fix-Errno.pm-generation-for-gcc-5.0.patch diff --git a/lfs/perl b/lfs/perl index c4ddc8e760..9ab8efae4e 100644 --- a/lfs/perl +++ b/lfs/perl @@ -77,6 +77,7 @@ $(subst %,%_MD5,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/perl-Fix-Errno.pm-generation-for-gcc-5.0.patch ifneq "$(ROOT)" "" cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/$(THISAPP)-libc-2.patch endif diff --git a/src/patches/perl-Fix-Errno.pm-generation-for-gcc-5.0.patch b/src/patches/perl-Fix-Errno.pm-generation-for-gcc-5.0.patch new file mode 100644 index 0000000000..1f6e80a079 --- /dev/null +++ b/src/patches/perl-Fix-Errno.pm-generation-for-gcc-5.0.patch @@ -0,0 +1,66 @@ +From 96bcd6ed97ff05f5b421005f23973279dbfcafbf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Wed, 11 Feb 2015 15:46:37 +0100 +Subject: [PATCH 1/2] Fix Errno.pm generation for gcc-5.0 + +gcc-5.0 -E interleaves now line numbers with expended macros, so that +the generated errno.c will be preprocessed to + +EBFONT => [[ + 59 + ]] + +which is hard to parse in in line-based reader. + +So use -P option with gcc >= 5.0. Global -P usage would break makedepend, +global -ftrack-macro-expansion=0 would break lib/h2ph.t. + +RT#123784 +--- + ext/Errno/Errno_pm.PL | 23 +++++++++++++++++------ + 1 file changed, 17 insertions(+), 6 deletions(-) + +diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL +index 3dadfce..c6bfa06 100644 +--- a/ext/Errno/Errno_pm.PL ++++ b/ext/Errno/Errno_pm.PL +@@ -215,20 +215,31 @@ sub write_errno_pm { + { # BeOS (support now removed) did not enter this block + # invoke CPP and read the output + ++ my $inhibit_linemarkers = ''; ++ if ($Config{gccversion} =~ /\A(\d+)\./ and $1 >= 5) { ++ # GCC 5.0 interleaves expanded macros with line numbers breaking ++ # each line into multiple lines. RT#123784 ++ $inhibit_linemarkers = ' -P'; ++ } ++ + if ($^O eq 'VMS') { +- my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}"; ++ my $cpp = "$Config{cppstdin} $Config{cppflags}" . ++ $inhibit_linemarkers . " $Config{cppminus}"; + $cpp =~ s/sys\$input//i; + open(CPPO,"$cpp errno.c |") or + die "Cannot exec $Config{cppstdin}"; + } elsif ($IsMSWin32 || $^O eq 'NetWare') { +- open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or +- die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'"; ++ my $cpp = "$Config{cpprun} $Config{cppflags}" . ++ $inhibit_linemarkers; ++ open(CPPO,"$cpp errno.c |") or ++ die "Cannot run '$cpp errno.c'"; + } elsif ($IsSymbian) { +- my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc -"; ++ my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc" . ++ $inhibit_linemarkers ." -"; + open(CPPO,"$cpp < errno.c |") + or die "Cannot exec $cpp"; + } else { +- my $cpp = default_cpp(); ++ my $cpp = default_cpp() . $inhibit_linemarkers; + open(CPPO,"$cpp < errno.c |") + or die "Cannot exec $cpp"; + } +-- +2.3.0 + -- 2.39.5