From c58212eaf957ef39484ed71316074fd8366e9c4a Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 8 Apr 2015 04:55:07 -0700 Subject: Add ld_list_options This patch adds ld_list_options for ELF targets to avoid duplicated outputs from ld --help. * Makefile.am (ELF_CLFAGS): New. (AM_CFLAGS): Add $(ELF_CLFAGS). * configure.ac (elf_list_options): New. AC_SUBST. (elf_shlib_list_options): Likewise. (elf_plt_unwind_list_options): Likewise. * lexsup.c (elf_shlib_list_options): New. (elf_static_list_options): Likewise. (elf_plt_unwind_list_options): Likewise. (ld_list_options): Likewise. (help): Call ld_list_options. * Makefile.in: Regenerated. * configure: Likewise. * emulparams/plt_unwind.sh (PLT_UNWIND): New. (PARSE_AND_LIST_OPTIONS): Removed. * emultempl/elf32.em (gld_list_options): New. (gld${EMULATION_NAME}_list_options): Define only if BNDPLT or PARSE_AND_LIST_OPTIONS is defined. (ld_${EMULATION_NAME}_emulation): Replace gld${EMULATION_NAME}_list_options with ${gld_list_options. --- ld/ChangeLog | 22 +++++++++ ld/Makefile.am | 5 +- ld/Makefile.in | 9 +++- ld/configure | 28 +++++++++-- ld/configure.ac | 21 ++++++++- ld/emulparams/plt_unwind.sh | 9 +--- ld/emultempl/elf32.em | 112 +++----------------------------------------- ld/lexsup.c | 108 ++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 195 insertions(+), 119 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 4228732..a76dcb3 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,25 @@ +2015-04-08 H.J. Lu + + * Makefile.am (ELF_CLFAGS): New. + (AM_CFLAGS): Add $(ELF_CLFAGS). + * configure.ac (elf_list_options): New. AC_SUBST. + (elf_shlib_list_options): Likewise. + (elf_plt_unwind_list_options): Likewise. + * lexsup.c (elf_shlib_list_options): New. + (elf_static_list_options): Likewise. + (elf_plt_unwind_list_options): Likewise. + (ld_list_options): Likewise. + (help): Call ld_list_options. + * Makefile.in: Regenerated. + * configure: Likewise. + * emulparams/plt_unwind.sh (PLT_UNWIND): New. + (PARSE_AND_LIST_OPTIONS): Removed. + * emultempl/elf32.em (gld_list_options): New. + (gld${EMULATION_NAME}_list_options): Define only if BNDPLT or + PARSE_AND_LIST_OPTIONS is defined. + (ld_${EMULATION_NAME}_emulation): Replace + gld${EMULATION_NAME}_list_options with ${gld_list_options. + 2015-04-07 Alan Modra PR ld/18176 diff --git a/ld/Makefile.am b/ld/Makefile.am index 80c7487..99e6fb1 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -34,9 +34,12 @@ LEX = `if [ -f ../flex/flex ]; then echo ../flex/flex; else echo @LEX@; fi` am__skiplex = am__skipyacc = +ELF_CLFAGS=-DELF_LIST_OPTIONS=@elf_list_options@ \ + -DELF_SHLIB_LIST_OPTIONS=@elf_shlib_list_options@ \ + -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@ WARN_CFLAGS = @WARN_CFLAGS@ NO_WERROR = @NO_WERROR@ -AM_CFLAGS = $(WARN_CFLAGS) +AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) # Conditionally enable the plugin interface. if ENABLE_PLUGINS diff --git a/ld/Makefile.in b/ld/Makefile.in index 81159cb..bc874f1 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -344,6 +344,9 @@ datarootdir = @datarootdir@ do_compare = @do_compare@ docdir = @docdir@ dvidir = @dvidir@ +elf_list_options = @elf_list_options@ +elf_plt_unwind_list_options = @elf_plt_unwind_list_options@ +elf_shlib_list_options = @elf_shlib_list_options@ enable_initfini_array = @enable_initfini_array@ exec_prefix = @exec_prefix@ host = @host@ @@ -391,7 +394,11 @@ tooldir = $(exec_prefix)/$(target_alias) # maintainer mode is disabled. Avoid this. am__skiplex = am__skipyacc = -AM_CFLAGS = $(WARN_CFLAGS) +ELF_CLFAGS = -DELF_LIST_OPTIONS=@elf_list_options@ \ + -DELF_SHLIB_LIST_OPTIONS=@elf_shlib_list_options@ \ + -DELF_PLT_UNWIND_LIST_OPTIONS=@elf_plt_unwind_list_options@ + +AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) @ENABLE_PLUGINS_FALSE@PLUGIN_C = # Conditionally enable the plugin interface. diff --git a/ld/configure b/ld/configure index 4a312df..44bce0e 100755 --- a/ld/configure +++ b/ld/configure @@ -608,6 +608,9 @@ LIB_PATH EMUL_EXTRA_OFILES EMULATION_OFILES EMUL +elf_plt_unwind_list_options +elf_shlib_list_options +elf_list_options STRINGIFY enable_initfini_array ENABLE_PLUGINS_FALSE @@ -11710,7 +11713,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11713 "configure" +#line 11716 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11816,7 +11819,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11819 "configure" +#line 11822 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -17025,6 +17028,9 @@ _ACEOF fi fi +elf_list_options=FALSE +elf_shlib_list_options=FALSE +elf_plt_unwind_list_options=FALSE for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` do if test "$targ_alias" = "all"; then @@ -17055,7 +17061,20 @@ do for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do case " $all_emuls " in - *" e${i}.o "*) ;; + *" e${i}.o "*) + case "${i}" in + *elf*) + elf_list_options=TRUE + . ${srcdir}/emulparams/${i}.sh + if test x${GENERATE_SHLIB_SCRIPT} = xyes; then + elf_shlib_list_options=TRUE + fi + if test x${PLT_UNWIND} = xyes; then + elf_plt_unwind_list_options=TRUE + fi + ;; + esac + ;; *) all_emuls="$all_emuls e${i}.o" eval result=\$tdir_$i @@ -17092,6 +17111,9 @@ done + + + TDIRS=tdirs diff --git a/ld/configure.ac b/ld/configure.ac index a885b7b..572440c 100644 --- a/ld/configure.ac +++ b/ld/configure.ac @@ -281,6 +281,9 @@ if test x${want64} = xfalse; then fi fi +elf_list_options=FALSE +elf_shlib_list_options=FALSE +elf_plt_unwind_list_options=FALSE for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'` do if test "$targ_alias" = "all"; then @@ -311,7 +314,20 @@ do for i in $targ_emul $targ_extra_emuls $targ_extra_libpath; do case " $all_emuls " in - *" e${i}.o "*) ;; + *" e${i}.o "*) + case "${i}" in + *elf*) + elf_list_options=TRUE + . ${srcdir}/emulparams/${i}.sh + if test x${GENERATE_SHLIB_SCRIPT} = xyes; then + elf_shlib_list_options=TRUE + fi + if test x${PLT_UNWIND} = xyes; then + elf_plt_unwind_list_options=TRUE + fi + ;; + esac + ;; *) all_emuls="$all_emuls e${i}.o" eval result=\$tdir_$i @@ -346,6 +362,9 @@ do fi done +AC_SUBST(elf_list_options) +AC_SUBST(elf_shlib_list_options) +AC_SUBST(elf_plt_unwind_list_options) AC_SUBST(EMUL) TDIRS=tdirs diff --git a/ld/emulparams/plt_unwind.sh b/ld/emulparams/plt_unwind.sh index c832570..38d7668 100644 --- a/ld/emulparams/plt_unwind.sh +++ b/ld/emulparams/plt_unwind.sh @@ -1,3 +1,5 @@ +PLT_UNWIND=yes + PARSE_AND_LIST_PROLOGUE=' #define OPTION_LD_GENERATED_UNWIND_INFO 301 #define OPTION_NO_LD_GENERATED_UNWIND_INFO 302 @@ -10,13 +12,6 @@ PARSE_AND_LIST_LONGOPTS=' OPTION_NO_LD_GENERATED_UNWIND_INFO}, ' -PARSE_AND_LIST_OPTIONS=' - fprintf (file, _("\ - --ld-generated-unwind-info Generate exception handling info for PLT.\n\ - --no-ld-generated-unwind-info Don'\''t do so.\n" - )); -' - PARSE_AND_LIST_ARGS_CASES=' case OPTION_LD_GENERATED_UNWIND_INFO: link_info.no_ld_generated_unwind_info = FALSE; diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 4dd71ab..dc643b6 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -2366,117 +2366,14 @@ fragment <