summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-10 17:46:29 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-10 22:36:38 +0000
commitcc5f804483a9a1a60be24475baee0eed5d44bef5 (patch)
tree786ba5dc5737628b1730bff1d194dec6f2034a9b
parent870323cac1e40e8f95ea7bd6f425a85dcfbab612 (diff)
downloadpoky-cc5f804483a9a1a60be24475baee0eed5d44bef5.tar.gz
libtool: Fix option parsing performance regression
Cut and paste the pieces of build-aux/options-parser inline into the main ltmain.sh code. This removes a performance degradation caused by the repeated calls to func_quote_for_eval, the mechanism funclib uses to construct the functions used for option parsing. (From OE-Core rev: 6bf5cbbcac80ee818cc932d69227e70e41ce02d3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/libtool/libtool-2.4.5.inc1
-rw-r--r--meta/recipes-devtools/libtool/libtool/unwind-opt-parsing.patch179
2 files changed, 180 insertions, 0 deletions
diff --git a/meta/recipes-devtools/libtool/libtool-2.4.5.inc b/meta/recipes-devtools/libtool/libtool-2.4.5.inc
index 5ac6a78e34..909c7da424 100644
--- a/meta/recipes-devtools/libtool/libtool-2.4.5.inc
+++ b/meta/recipes-devtools/libtool/libtool-2.4.5.inc
@@ -19,6 +19,7 @@ SRC_URI = "${GNU_MIRROR}/libtool/libtool-${PV}.tar.gz \
19 file://fix-resolve-lt-sysroot.patch \ 19 file://fix-resolve-lt-sysroot.patch \
20 file://nohardcodepaths.patch \ 20 file://nohardcodepaths.patch \
21 file://avoid-running-automake-autoconf-version.patch \ 21 file://avoid-running-automake-autoconf-version.patch \
22 file://unwind-opt-parsing.patch \
22 " 23 "
23 24
24SRC_URI[md5sum] = "7d30ed9fa6bb11270ebb31639a37bd54" 25SRC_URI[md5sum] = "7d30ed9fa6bb11270ebb31639a37bd54"
diff --git a/meta/recipes-devtools/libtool/libtool/unwind-opt-parsing.patch b/meta/recipes-devtools/libtool/libtool/unwind-opt-parsing.patch
new file mode 100644
index 0000000000..b633bc41bb
--- /dev/null
+++ b/meta/recipes-devtools/libtool/libtool/unwind-opt-parsing.patch
@@ -0,0 +1,179 @@
1Cut and paste the pieces of build-aux/options-parser inline into the main
2ltmain.sh code. This removes a performance degradation caused by the
3repeated calls to func_quote_for_eval, the mechanism funclib uses
4to construct the functions used for option parsing.
5
6Upstream-Status: Submitted [Being discussed on mailing list Feb 2015]
7
8diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
9index d5cf07a..0f54303 100644
10--- a/build-aux/ltmain.in
11+++ b/build-aux/ltmain.in
12@@ -342,11 +342,15 @@ _LT_EOF
13 # libtool_options_prep [ARG]...
14 # -----------------------------
15 # Preparation for options parsed by libtool.
16-libtool_options_prep ()
17-{
18+#libtool_options_prep ()
19+#{
20 $debug_mode
21
22 # Option defaults:
23+ opt_verbose=false
24+ opt_warning_types=
25+
26+ # Option defaults:
27 opt_config=false
28 opt_dlopen=
29 opt_dry_run=false
30@@ -382,19 +386,14 @@ libtool_options_prep ()
31 shift; set dummy --mode uninstall ${1+"$@"}; shift
32 ;;
33 esac
34-
35- # Pass back the list of options.
36- func_quote_for_eval ${1+"$@"}
37- libtool_options_prep_result=$func_quote_for_eval_result
38-}
39-func_add_hook func_options_prep libtool_options_prep
40+#}
41
42
43 # libtool_parse_options [ARG]...
44 # ---------------------------------
45 # Provide handling for libtool specific options.
46-libtool_parse_options ()
47-{
48+#libtool_parse_options ()
49+#{
50 $debug_cmd
51
52 # Perform our own loop to consume as many options as possible in
53@@ -474,29 +473,90 @@ libtool_parse_options ()
54 func_append preserve_args " $_G_opt"
55 ;;
56
57- # An option not handled by this hook function:
58- *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
59- esac
60- done
61+ --debug|-x) debug_cmd='set -x'
62+ func_echo "enabling shell trace mode"
63+ $debug_cmd
64+ ;;
65
66+ --no-warnings|--no-warning|--no-warn)
67+ set dummy --warnings none ${1+"$@"}
68+ shift
69+ ;;
70
71- # save modified positional parameters for caller
72- func_quote_for_eval ${1+"$@"}
73- libtool_parse_options_result=$func_quote_for_eval_result
74-}
75-func_add_hook func_parse_options libtool_parse_options
76+ --warnings|--warning|-W)
77+ test $# = 0 && func_missing_arg $_G_opt && break
78+ case " $warning_categories $1" in
79+ *" $1 "*)
80+ # trailing space prevents matching last $1 above
81+ func_append_uniq opt_warning_types " $1"
82+ ;;
83+ *all)
84+ opt_warning_types=$warning_categories
85+ ;;
86+ *none)
87+ opt_warning_types=none
88+ warning_func=:
89+ ;;
90+ *error)
91+ opt_warning_types=$warning_categories
92+ warning_func=func_fatal_error
93+ ;;
94+ *)
95+ func_fatal_error \
96+ "unsupported warning category: '$1'"
97+ ;;
98+ esac
99+ shift
100+ ;;
101+
102+ --verbose|-v) opt_verbose=: ;;
103+ --version) func_version ;;
104+ -\?|-h) func_usage ;;
105+ --help) func_help ;;
106+
107+ # Separate optargs to long options (plugins may need this):
108+ --*=*) func_split_equals "$_G_opt"
109+ set dummy "$func_split_equals_lhs" \
110+ "$func_split_equals_rhs" ${1+"$@"}
111+ shift
112+ ;;
113+
114+ # Separate optargs to short options:
115+ -W*)
116+ func_split_short_opt "$_G_opt"
117+ set dummy "$func_split_short_opt_name" \
118+ "$func_split_short_opt_arg" ${1+"$@"}
119+ shift
120+ ;;
121+
122+ # Separate non-argument short options:
123+ -\?*|-h*|-v*|-x*)
124+ func_split_short_opt "$_G_opt"
125+ set dummy "$func_split_short_opt_name" \
126+ "-$func_split_short_opt_arg" ${1+"$@"}
127+ shift
128+ ;;
129+
130+ --) break ;;
131+ -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
132+ *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
133+ esac
134+ done
135+#}
136
137+# Display all warnings if -W was not given.
138+test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
139
140
141 # libtool_validate_options [ARG]...
142 # ---------------------------------
143 # Perform any sanity checks on option settings and/or unconsumed
144 # arguments.
145-libtool_validate_options ()
146-{
147+#libtool_validate_options ()
148+#{
149 # save first non-option argument
150 if test 0 -lt $#; then
151- nonopt=$1
152+ nonopt=$_G_opt
153 shift
154 fi
155
156@@ -537,20 +597,10 @@ libtool_validate_options ()
157 generic_help=$help
158 help="Try '$progname --help --mode=$opt_mode' for more information."
159 }
160+#}
161
162- # Pass back the unparsed argument list
163- func_quote_for_eval ${1+"$@"}
164- libtool_validate_options_result=$func_quote_for_eval_result
165-}
166-func_add_hook func_validate_options libtool_validate_options
167-
168-
169-# Process options as early as possible so that --help and --version
170-# can return quickly.
171-func_options ${1+"$@"}
172-eval set dummy "$func_options_result"; shift
173-
174-
175+# Bail if the options were screwed!
176+$exit_cmd $EXIT_FAILURE
177
178 ## ----------- ##
179 ## Main. ##