Skip to content

Commit ed6dccd

Browse files
committed
ltmain.sh: allow more flags at link-time
libtool defaults to filtering flags passed at link-time. This brings the filtering in GCC's 'fork' of libtool into sync with upstream libtool commit 22a7e547e9857fc94fe5bc7c921d9a4b49c09f8e. In particular, this now allows some harmless diagnostic flags (especially useful for things like -Werror=odr), more optimization flags, and some Clang-specific options. GCC's -flto documentation mentions: > To use the link-time optimizer, -flto and optimization options should be > specified at compile time and during the final link. It is recommended > that you compile all the files participating in the same link with the > same options and also specify those options at link time. This allows compliance with that. * ltmain.sh (func_mode_link): Allow various flags through filter.
1 parent 82d9727 commit ed6dccd

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

ltmain.sh

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4968,19 +4968,41 @@ func_mode_link ()
49684968
arg="$func_quote_for_eval_result"
49694969
;;
49704970

4971-
# -64, -mips[0-9] enable 64-bit mode on the SGI compiler
4972-
# -r[0-9][0-9]* specifies the processor on the SGI compiler
4973-
# -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
4974-
# +DA*, +DD* enable 64-bit mode on the HP compiler
4975-
# -q* pass through compiler args for the IBM compiler
4976-
# -m*, -t[45]*, -txscale* pass through architecture-specific
4977-
# compiler args for GCC
4978-
# -F/path gives path to uninstalled frameworks, gcc on darwin
4979-
# -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
4980-
# @file GCC response files
4981-
# -tp=* Portland pgcc target processor selection
4971+
# Flags to be passed through unchanged, with rationale:
4972+
# -64, -mips[0-9] enable 64-bit mode for the SGI compiler
4973+
# -r[0-9][0-9]* specify processor for the SGI compiler
4974+
# -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
4975+
# +DA*, +DD* enable 64-bit mode for the HP compiler
4976+
# -q* compiler args for the IBM compiler
4977+
# -m*, -t[45]*, -txscale* architecture-specific flags for GCC
4978+
# -F/path path to uninstalled frameworks, gcc on darwin
4979+
# -p, -pg, --coverage, -fprofile-* profiling flags for GCC
4980+
# -fstack-protector* stack protector flags for GCC
4981+
# @file GCC response files
4982+
# -tp=* Portland pgcc target processor selection
4983+
# -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
4984+
# -specs=* GCC specs files
4985+
# -stdlib=* select c++ std lib with clang
4986+
# -fdiagnostics-color* simply affects output
4987+
# -frecord-gcc-switches used to verify flags were respected
4988+
# -fsanitize=* Clang/GCC memory and address sanitizer
4989+
# -fno-sanitize* Clang/GCC memory and address sanitizer
4990+
# -shared-libsan Link with shared sanitizer runtimes (Clang)
4991+
# -static-libsan Link with static sanitizer runtimes (Clang)
4992+
# -fuse-ld=* Linker select flags for GCC
4993+
# -rtlib=* select c runtime lib with clang
4994+
# --unwindlib=* select unwinder library with clang
4995+
# -f{file|debug|macro|profile}-prefix-map=* needed for lto linking
4996+
# -Wa,* Pass flags directly to the assembler
4997+
# -Werror, -Werror=* Report (specified) warnings as errors
49824998
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
4983-
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
4999+
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*| \
5000+
-O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*| \
5001+
-stdlib=*|-rtlib=*|--unwindlib=*| \
5002+
-specs=*|-fsanitize=*|-fno-sanitize*|-shared-libsan|-static-libsan| \
5003+
-ffile-prefix-map=*|-fdebug-prefix-map=*|-fmacro-prefix-map=*|-fprofile-prefix-map=*| \
5004+
-fdiagnostics-color*|-frecord-gcc-switches| \
5005+
-fuse-ld=*|-Wa,*|-Werror|-Werror=*)
49845006
func_quote_for_eval "$arg"
49855007
arg="$func_quote_for_eval_result"
49865008
func_append compile_command " $arg"

0 commit comments

Comments
 (0)