binutils, ld: work with --disable-libctf
authorNick Alcock <nick.alcock@oracle.com>
Mon, 30 Sep 2019 14:04:05 +0000 (15:04 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 26 Jun 2020 14:56:39 +0000 (15:56 +0100)
This unfortunately means conditionalizing out all the libctf code, but
the result is not too unbearably ugly, if a bit repetitive.  I have
stubbed out code in the !ENABLE_LIBCTF path to avoid extra redundant
ifdefs where it seems that might be helpful.  (The stubs are not too
disruptive, but I've tried to keep them on one line where possible to
avoid filling up the screen with stubs that nobody would care about.
If this is too much of a coding style violation I can change it.)

Changes since v2: use GCC_ENABLE rather than repeating all the
                  AC_ARG_ENABLE stuff over and over again.

ld/
* configure.ac [--enable-libctf]: New, default yes.
Set ENABLE_LIBCTF accordingly.
* Makefile.am [!ENABLE_LIBCTF]: Empty LIBCTF.
* configure: Regenerate.
* config.in: Regenerate.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* ldlang.c (ctf_output): Conditionalize on ENABLE_LIBCTF.
(ldlang_open_ctf): Likewise.
(lang_merge_ctf): Likewise.
(ldlang_ctf_apply_strsym): Likewise.
(lang_write_ctf): Likewise.
(ldlang_write_ctf_late): Likewise.
(ldlang_open_ctf) [!ENABLE_LIBCTF]: Warn about the presence of CTF
sections.
(lang_merge_ctf) [!ENABLE_LIBCTF]: New stub.
(ldlang_ctf_apply_strsym) [!ENABLE_LIBCTF]: Likewise.
(lang_write_ctf) [!ENABLE_LIBCTF]: Likewise.
(ldlang_write_ctf_late) [!ENABLE_LIBCTF]: Likewise.
* ldelfgen.c (ldelf_emit_ctf_early): Conditionalize on
ENABLE_LIBCTF.
(struct ctf_strsym_iter_cb_arg): Likewise.
(ldelf_ctf_strtab_iter_cb): Likewise.
(ldelf_ctf_symbols_iter_cb): Likewise.
(ldelf_examine_strtab_for_ctf): Likewise.
(ldelf_emit_ctf_early) [!ENABLE_LIBCTF]: New stub.
(ldelf_examine_strtab_for_ctf) [!ENABLE_LIBCTF]: New stub.

binutils/
* configure.ac [--enable-libctf]: New, default yes.
Set ENABLE_LIBCTF accordingly.
* Makefile.am [!ENABLE_LIBCTF]: Empty LIBCTF and LIBCTF_NOBFD.
* configure: Regenerate.
* config.in: Regenerate.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* objdump.c (usage): Conditionalize portions on ENABLE_LIBCTF.
(option_values): Likewise.
(long_options): Likewise.
(main): Likewise.
(dump_ctf_indent_lines): Conditionalize out when !ENABLE_LIBCTF.
(make_ctfsect): Likewise.
(dump_ctf_archive_member): Likewise.
(dump_ctf) [ENABLE_LIBCTF]: Likewise.
(dump_ctf) [!ENABLE_LIBCTF]: New empty stub.
* readelf.c (options): Conditionalize portions on ENABLE_LIBCTF.
(usage): Likewise.
(process_section_contents): Likewise.
(shdr_to_ctf_sect): Conditionalize out when !ENABLE_LIBCTF.
(dump_ctf_indent_lines): Likewise.
(dump_section_as_ctf) [ENABLE_LIBCTF]: Likewise.

19 files changed:
binutils/ChangeLog
binutils/Makefile.am
binutils/Makefile.in
binutils/aclocal.m4
binutils/config.in
binutils/configure
binutils/configure.ac
binutils/doc/Makefile.in
binutils/objdump.c
binutils/readelf.c
ld/ChangeLog
ld/Makefile.am
ld/Makefile.in
ld/aclocal.m4
ld/config.in
ld/configure
ld/configure.ac
ld/ldelfgen.c
ld/ldlang.c

index 6db2be3262c3cee85c3817fb48255dc6cf5d899d..1532a37c390632c62c1b0073c527a76c8813012e 100644 (file)
@@ -1,3 +1,28 @@
+2020-06-26  Nick Alcock  <nick.alcock@oracle.com>
+
+       * configure.ac [--enable-libctf]: New, default yes.
+       Set ENABLE_LIBCTF accordingly.
+       * Makefile.am [!ENABLE_LIBCTF]: Empty LIBCTF and LIBCTF_NOBFD.
+       * configure: Regenerate.
+       * config.in: Regenerate.
+       * Makefile.in: Regenerate.
+       * aclocal.m4: Regenerate.
+       * objdump.c (usage): Conditionalize portions on ENABLE_LIBCTF.
+       (option_values): Likewise.
+       (long_options): Likewise.
+       (main): Likewise.
+       (dump_ctf_indent_lines): Conditionalize out when !ENABLE_LIBCTF.
+       (make_ctfsect): Likewise.
+       (dump_ctf_archive_member): Likewise.
+       (dump_ctf) [ENABLE_LIBCTF]: Likewise.
+       (dump_ctf) [!ENABLE_LIBCTF]: New empty stub.
+       * readelf.c (options): Conditionalize portions on ENABLE_LIBCTF.
+       (usage): Likewise.
+       (process_section_contents): Likewise.
+       (shdr_to_ctf_sect): Conditionalize out when !ENABLE_LIBCTF.
+       (dump_ctf_indent_lines): Likewise.
+       (dump_section_as_ctf) [ENABLE_LIBCTF]: Likewise.
+
 2020-06-26  Jan Beulich  <jbeulich@suse.com>
 
        * doc/binutils.texi: Adjust description of x86's -Msuffix. Drop
index e5cf5634a7d071fe896960b96670bcc500384b2d..2ee1196790882688a59e9e3b720078e0ecb86074 100644 (file)
@@ -164,8 +164,13 @@ BFDLIB = ../bfd/libbfd.la
 
 OPCODES = ../opcodes/libopcodes.la
 
+if ENABLE_LIBCTF
 LIBCTF = ../libctf/libctf.la
 LIBCTF_NOBFD = ../libctf/libctf-nobfd.la
+else
+LIBCTF =
+LIBCTF_NOBFD =
+endif
 
 LIBIBERTY = ../libiberty/libiberty.a
 
index ee6f267df97763bd582bfbf6daf1f38db7654a59..7ef2af4aff6bce67be2e1f37950c7f423be94df7 100644 (file)
@@ -122,6 +122,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
        $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../config/depstand.m4 \
+       $(top_srcdir)/../config/enable.m4 \
        $(top_srcdir)/../config/gettext-sister.m4 \
        $(top_srcdir)/../config/iconv.m4 \
        $(top_srcdir)/../config/largefile.m4 \
@@ -222,6 +223,7 @@ objcopy_LDADD = $(LDADD)
 am_objdump_OBJECTS = objdump.$(OBJEXT) dwarf.$(OBJEXT) prdbg.$(OBJEXT) \
        $(am__objects_3) $(am__objects_1) $(am__objects_2)
 objdump_OBJECTS = $(am_objdump_OBJECTS)
+@ENABLE_LIBCTF_TRUE@am__DEPENDENCIES_2 = ../libctf/libctf.la
 am_ranlib_OBJECTS = ar.$(OBJEXT) is-ranlib.$(OBJEXT) arparse.$(OBJEXT) \
        arlex.$(OBJEXT) arsup.$(OBJEXT) rename.$(OBJEXT) \
        binemul.$(OBJEXT) emul_$(EMULATION).$(OBJEXT) $(am__objects_1)
@@ -229,6 +231,7 @@ ranlib_OBJECTS = $(am_ranlib_OBJECTS)
 am_readelf_OBJECTS = readelf.$(OBJEXT) version.$(OBJEXT) \
        unwind-ia64.$(OBJEXT) dwarf.$(OBJEXT) $(am__objects_2)
 readelf_OBJECTS = $(am_readelf_OBJECTS)
+@ENABLE_LIBCTF_TRUE@am__DEPENDENCIES_3 = ../libctf/libctf-nobfd.la
 am_size_OBJECTS = size.$(OBJEXT) $(am__objects_1)
 size_OBJECTS = $(am_size_OBJECTS)
 size_LDADD = $(LDADD)
@@ -658,8 +661,10 @@ BULIBS = bucomm.c version.c filemode.c
 ELFLIBS = elfcomm.c
 BFDLIB = ../bfd/libbfd.la
 OPCODES = ../opcodes/libopcodes.la
-LIBCTF = ../libctf/libctf.la
-LIBCTF_NOBFD = ../libctf/libctf-nobfd.la
+@ENABLE_LIBCTF_FALSE@LIBCTF = 
+@ENABLE_LIBCTF_TRUE@LIBCTF = ../libctf/libctf.la
+@ENABLE_LIBCTF_FALSE@LIBCTF_NOBFD = 
+@ENABLE_LIBCTF_TRUE@LIBCTF_NOBFD = ../libctf/libctf-nobfd.la
 LIBIBERTY = ../libiberty/libiberty.a
 POTFILES = $(CFILES) $(DEBUG_SRCS) $(HFILES)
 EXPECT = expect
index 4fa32fffd8ca30875686dc8ef5636799a97e2898..8bf2e9e242452756ba716f146b20a4b6d28013e4 100644 (file)
@@ -1189,6 +1189,7 @@ m4_include([../bfd/acinclude.m4])
 m4_include([../bfd/warning.m4])
 m4_include([../config/acx.m4])
 m4_include([../config/depstand.m4])
+m4_include([../config/enable.m4])
 m4_include([../config/gettext-sister.m4])
 m4_include([../config/iconv.m4])
 m4_include([../config/largefile.m4])
index 703f7b15e7571df9a8ce8c779a01018e6659ee3b..3adc32bb1ffb55ea7dd1e69cdd7c92410bd4bf0f 100644 (file)
@@ -21,6 +21,9 @@
 /* Should strings use -a behavior by default? */
 #undef DEFAULT_STRINGS_ALL
 
+/* Handle .ctf type-info sections */
+#undef ENABLE_LIBCTF
+
 /* Define to 1 if translation of program messages to the user's native
    language is requested. */
 #undef ENABLE_NLS
index 782fffac6ff5a288e39d820dc82b99392a69e760..bdc93e02078047b995edc1d461a7a60906045e49 100755 (executable)
@@ -684,6 +684,8 @@ WARN_WRITE_STRINGS
 NO_WERROR
 WARN_CFLAGS_FOR_BUILD
 WARN_CFLAGS
+ENABLE_LIBCTF_FALSE
+ENABLE_LIBCTF_TRUE
 LIBDEBUGINFOD
 OTOOL64
 OTOOL
@@ -815,6 +817,7 @@ enable_targets
 enable_deterministic_archives
 enable_default_strings_all
 with_debuginfod
+enable_libctf
 enable_werror
 enable_build_warnings
 enable_nls
@@ -1472,6 +1475,7 @@ Optional Features:
                           ar and ranlib default to -D behavior
   --disable-default-strings-all
                           strings defaults to --data behavior
+  --enable-libctf         Handle .ctf type-info sections [default=yes]
   --enable-werror         treat compile warnings as errors
   --enable-build-warnings enable build-time compiler warnings
   --disable-nls           do not use Native Language Support
@@ -11529,7 +11533,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11532 "configure"
+#line 11536 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11635,7 +11639,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11638 "configure"
+#line 11642 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12331,6 +12335,33 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+ # Check whether --enable-libctf was given.
+if test "${enable_libctf+set}" = set; then :
+  enableval=$enable_libctf;
+      case "$enableval" in
+       yes|no) ;;
+       *) as_fn_error $? "Argument to enable/disable libctf must be yes or no" "$LINENO" 5 ;;
+      esac
+
+else
+  enable_libctf=yes
+fi
+
+
+if test "${enable_libctf}" = yes; then
+
+$as_echo "#define ENABLE_LIBCTF 1" >>confdefs.h
+
+fi
+ if test "${enable_libctf}" = yes; then
+  ENABLE_LIBCTF_TRUE=
+  ENABLE_LIBCTF_FALSE='#'
+else
+  ENABLE_LIBCTF_TRUE='#'
+  ENABLE_LIBCTF_FALSE=
+fi
+
+
 
 # Set the 'development' global.
 . $srcdir/../bfd/development.sh
@@ -15413,6 +15444,10 @@ else
   am__EXEEXT_FALSE=
 fi
 
+if test -z "${ENABLE_LIBCTF_TRUE}" && test -z "${ENABLE_LIBCTF_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_LIBCTF\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
   as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
index 385ab01a26c8ef2bbde8518b0df43e9d289447bf..4ac1f34a6d200d51c4eca2118d1a7b350cf20f45 100644 (file)
@@ -69,6 +69,12 @@ AC_DEBUGINFOD
 AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all,
                   [Should strings use -a behavior by default?])
 
+GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
+if test "${enable_libctf}" = yes; then
+    AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
+fi
+AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes)
+
 AM_BINUTILS_WARNINGS
 
 AC_CONFIG_HEADERS(config.h:config.in)
index b00260bc25f86d30f27d91834ea516a1a961e171..e925b81e0dc67cd45cd392b1c22d4b5b300764aa 100644 (file)
@@ -111,6 +111,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
        $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../config/depstand.m4 \
+       $(top_srcdir)/../config/enable.m4 \
        $(top_srcdir)/../config/gettext-sister.m4 \
        $(top_srcdir)/../config/iconv.m4 \
        $(top_srcdir)/../config/largefile.m4 \
index c582feb70a7301a79ac19a9f69078ec23d7c68a2..93508e2a348b2bbe6c3e4d473b02fae6b46090a6 100644 (file)
@@ -235,7 +235,13 @@ usage (FILE *stream, int status)
           =gdb_index,=trace_info,=trace_abbrev,=trace_aranges,\n\
           =addr,=cu_index,=links,=follow-links]\n\
                            Display DWARF info in the file\n\
+"));
+#ifdef ENABLE_LIBCTF
+  fprintf (stream, _("\
   --ctf=SECTION            Display CTF info from SECTION\n\
+"));
+#endif
+  fprintf (stream, _("\
   -t, --syms               Display the contents of the symbol table(s)\n\
   -T, --dynamic-syms       Display the contents of the dynamic symbol table\n\
   -r, --reloc              Display the relocation entries in the file\n\
@@ -284,9 +290,12 @@ usage (FILE *stream, int status)
       --dwarf-depth=N        Do not display DIEs at depth N or greater\n\
       --dwarf-start=N        Display DIEs starting with N, at the same depth\n\
                              or deeper\n\
-      --dwarf-check          Make additional dwarf internal consistency checks.\
-      \n\
-      --ctf-parent=SECTION       Use SECTION as the CTF parent\n\
+      --dwarf-check          Make additional dwarf internal consistency checks.\n"));
+#ifdef ENABLE_LIBCTF
+      fprintf (stream, _("\
+      --ctf-parent=SECTION     Use SECTION as the CTF parent\n"));
+#endif
+      fprintf (stream, _("\
       --visualize-jumps          Visualize jumps by drawing ASCII art lines\n\
       --visualize-jumps=color    Use colors in the ASCII art\n\
       --visualize-jumps=extended-color   Use extended 8-bit color codes\n\
@@ -328,8 +337,10 @@ enum option_values
     OPTION_NO_RECURSE_LIMIT,
     OPTION_INLINES,
     OPTION_SOURCE_COMMENT,
+#ifdef ENABLE_LIBCTF
     OPTION_CTF,
     OPTION_CTF_PARENT,
+#endif
     OPTION_VISUALIZE_JUMPS
   };
 
@@ -375,8 +386,10 @@ static struct option long_options[]=
   {"special-syms", no_argument, &dump_special_syms, 1},
   {"include", required_argument, NULL, 'I'},
   {"dwarf", optional_argument, NULL, OPTION_DWARF},
+#ifdef ENABLE_LIBCTF
   {"ctf", required_argument, NULL, OPTION_CTF},
   {"ctf-parent", required_argument, NULL, OPTION_CTF_PARENT},
+#endif
   {"stabs", no_argument, NULL, 'G'},
   {"start-address", required_argument, NULL, OPTION_START_ADDRESS},
   {"stop-address", required_argument, NULL, OPTION_STOP_ADDRESS},
@@ -4026,6 +4039,7 @@ dump_bfd_header (bfd *abfd)
 }
 \f
 
+#ifdef ENABLE_LIBCTF
 /* Formatting callback function passed to ctf_dump.  Returns either the pointer
    it is passed, or a pointer to newly-allocated storage, in which case
    dump_ctf() will free it when it no longer needs it.  */
@@ -4167,6 +4181,11 @@ dump_ctf (bfd *abfd, const char *sect_name, const char *parent_name)
   free (parentdata);
   free (ctfdata);
 }
+#else
+static void
+dump_ctf (bfd *abfd ATTRIBUTE_UNUSED, const char *sect_name ATTRIBUTE_UNUSED,
+         const char *parent_name ATTRIBUTE_UNUSED) {}
+#endif
 
 \f
 static void
@@ -5348,6 +5367,7 @@ main (int argc, char **argv)
        case OPTION_DWARF_CHECK:
          dwarf_check = TRUE;
          break;
+#ifdef ENABLE_LIBCTF
        case OPTION_CTF:
          dump_ctf_section_info = TRUE;
          dump_ctf_section_name = xstrdup (optarg);
@@ -5356,6 +5376,7 @@ main (int argc, char **argv)
        case OPTION_CTF_PARENT:
          dump_ctf_parent_name = xstrdup (optarg);
          break;
+#endif
        case 'G':
          dump_stab_section_info = TRUE;
          seenflag = TRUE;
index 25f0e2354c3642b85ea10e6fa151d1a747596feb..2f0cd77ecfcd6af1bbce0b4d3706f2290bfcfad6 100644 (file)
@@ -4502,11 +4502,13 @@ static struct option options[] =
   {"dwarf-start",      required_argument, 0, OPTION_DWARF_START},
   {"dwarf-check",      no_argument, 0, OPTION_DWARF_CHECK},
 
+#ifdef ENABLE_LIBCTF
   {"ctf",             required_argument, 0, OPTION_CTF_DUMP},
 
   {"ctf-symbols",      required_argument, 0, OPTION_CTF_SYMBOLS},
   {"ctf-strings",      required_argument, 0, OPTION_CTF_STRINGS},
   {"ctf-parent",       required_argument, 0, OPTION_CTF_PARENT},
+#endif
 
   {"version",         no_argument, 0, 'v'},
   {"wide",            no_argument, 0, 'W'},
@@ -4558,6 +4560,7 @@ usage (FILE * stream)
   --dwarf-depth=N        Do not display DIEs at depth N or greater\n\
   --dwarf-start=N        Display DIEs starting with N, at the same depth\n\
                          or deeper\n"));
+#ifdef ENABLE_LIBCTF
   fprintf (stream, _("\
   --ctf=<number|name>    Display CTF info from section <number|name>\n\
   --ctf-parent=<number|name>\n\
@@ -4566,6 +4569,7 @@ usage (FILE * stream)
                          Use section <number|name> as the CTF external symtab\n\n\
   --ctf-strings=<number|name>\n\
                          Use section <number|name> as the CTF external strtab\n\n"));
+#endif
 
 #ifdef SUPPORT_DISASSEMBLY
   fprintf (stream, _("\
@@ -14132,6 +14136,7 @@ dump_section_as_bytes (Elf_Internal_Shdr *  section,
   return FALSE;
 }
 
+#ifdef ENABLE_LIBCTF
 static ctf_sect_t *
 shdr_to_ctf_sect (ctf_sect_t *buf, Elf_Internal_Shdr *shdr, Filedata *filedata)
 {
@@ -14292,6 +14297,7 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
   free (strdata);
   return ret;
 }
+#endif
 
 static bfd_boolean
 load_specific_debug_section (enum dwarf_section_display_enum  debug,
@@ -14777,11 +14783,13 @@ process_section_contents (Filedata * filedata)
            res = FALSE;
        }
 
+#ifdef ENABLE_LIBCTF
       if (dump & CTF_DUMP)
        {
          if (! dump_section_as_ctf (section, filedata))
            res = FALSE;
        }
+#endif
     }
 
   /* Check to see if the user requested a
index 1a06dc9624bd8224b09becdf54dde5436da410b1..4cf120413ea1261d117e0649f5271e488eae2850 100644 (file)
@@ -1,3 +1,33 @@
+2020-06-26  Nick Alcock  <nick.alcock@oracle.com>
+
+       * configure.ac [--enable-libctf]: New, default yes.
+       Set ENABLE_LIBCTF accordingly.
+       * Makefile.am [!ENABLE_LIBCTF]: Empty LIBCTF.
+       * configure: Regenerate.
+       * config.in: Regenerate.
+       * Makefile.in: Regenerate.
+       * aclocal.m4: Regenerate.
+       * ldlang.c (ctf_output): Conditionalize on ENABLE_LIBCTF.
+       (ldlang_open_ctf): Likewise.
+       (lang_merge_ctf): Likewise.
+       (ldlang_ctf_apply_strsym): Likewise.
+       (lang_write_ctf): Likewise.
+       (ldlang_write_ctf_late): Likewise.
+       (ldlang_open_ctf) [!ENABLE_LIBCTF]: Warn about the presence of CTF
+       sections.
+       (lang_merge_ctf) [!ENABLE_LIBCTF]: New stub.
+       (ldlang_ctf_apply_strsym) [!ENABLE_LIBCTF]: Likewise.
+       (lang_write_ctf) [!ENABLE_LIBCTF]: Likewise.
+       (ldlang_write_ctf_late) [!ENABLE_LIBCTF]: Likewise.
+       * ldelfgen.c (ldelf_emit_ctf_early): Conditionalize on
+       ENABLE_LIBCTF.
+       (struct ctf_strsym_iter_cb_arg): Likewise.
+       (ldelf_ctf_strtab_iter_cb): Likewise.
+       (ldelf_ctf_symbols_iter_cb): Likewise.
+       (ldelf_examine_strtab_for_ctf): Likewise.
+       (ldelf_emit_ctf_early) [!ENABLE_LIBCTF]: New stub.
+       (ldelf_examine_strtab_for_ctf) [!ENABLE_LIBCTF]: New stub.
+
 2020-06-26  Jan Beulich  <jbeulich@suse.com>
 
        * testsuite/ld-x86-64/x86-64.exp: Run K1OM tests.
index f0767f2be3dac8f62cf380d5b3242731325fef62..5035c5d1d5cc9ba578be6d0b8844ae37cb775e62 100644 (file)
@@ -144,7 +144,11 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @zlibinc@ \
 
 BFDLIB = ../bfd/libbfd.la
 LIBIBERTY = ../libiberty/libiberty.a
+if ENABLE_LIBCTF
 LIBCTF = ../libctf/libctf.la
+else
+LIBCTF =
+endif
 
 # These all start with e so 'make clean' can find them.
 ALL_EMULATION_SOURCES = \
index be0291ceecdf4bc163a836ceb7cadd4e5a31d690..49e1f857d2c6c535065ac39fd9e74d08effb1061 100644 (file)
@@ -113,6 +113,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \
        $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \
        $(top_srcdir)/../config/depstand.m4 \
+       $(top_srcdir)/../config/enable.m4 \
        $(top_srcdir)/../config/gettext-sister.m4 \
        $(top_srcdir)/../config/largefile.m4 \
        $(top_srcdir)/../config/lcmessage.m4 \
@@ -180,6 +181,7 @@ am_ld_new_OBJECTS = ldgram.$(OBJEXT) ldlex-wrapper.$(OBJEXT) \
        plugin.$(OBJEXT) ldbuildid.$(OBJEXT)
 ld_new_OBJECTS = $(am_ld_new_OBJECTS)
 am__DEPENDENCIES_1 =
+@ENABLE_LIBCTF_TRUE@am__DEPENDENCIES_2 = ../libctf/libctf.la
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
 am__v_P_0 = false
@@ -628,7 +630,8 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @zlibinc@ \
 
 BFDLIB = ../bfd/libbfd.la
 LIBIBERTY = ../libiberty/libiberty.a
-LIBCTF = ../libctf/libctf.la
+@ENABLE_LIBCTF_FALSE@LIBCTF = 
+@ENABLE_LIBCTF_TRUE@LIBCTF = ../libctf/libctf.la
 
 # These all start with e so 'make clean' can find them.
 ALL_EMULATION_SOURCES = \
index 7df8bf68f196d1b022b38091c81b1f05cc46c65b..f6e87a228af5b6ced6ee60e1bdb81b0b8b08af47 100644 (file)
@@ -1189,6 +1189,7 @@ m4_include([../bfd/acinclude.m4])
 m4_include([../bfd/warning.m4])
 m4_include([../config/acx.m4])
 m4_include([../config/depstand.m4])
+m4_include([../config/enable.m4])
 m4_include([../config/gettext-sister.m4])
 m4_include([../config/largefile.m4])
 m4_include([../config/lcmessage.m4])
index 8cadcba60f1ccd213e4c8e48cd8eefa25b8c5e74..f17121073679759f95d38720c5fee9cdddebef68 100644 (file)
@@ -33,6 +33,9 @@
    */
 #undef DEFAULT_NEW_DTAGS
 
+/* Handle .ctf type-info sections */
+#undef ENABLE_LIBCTF
+
 /* Define to 1 if translation of program messages to the user's native
    language is requested. */
 #undef ENABLE_NLS
index fba65c58e222f98000bde8be57944de81f27f1e7..11c69bec7b91293f63063b33184c0a2919c9dd6b 100755 (executable)
@@ -678,6 +678,8 @@ WARN_WRITE_STRINGS
 NO_WERROR
 WARN_CFLAGS_FOR_BUILD
 WARN_CFLAGS
+ENABLE_LIBCTF_FALSE
+ENABLE_LIBCTF_TRUE
 installed_linker
 install_as_default
 TARGET_SYSTEM_ROOT_DEFINE
@@ -832,6 +834,7 @@ enable_relro
 enable_textrel_check
 enable_separate_code
 enable_default_hash_style
+enable_libctf
 enable_werror
 enable_build_warnings
 enable_nls
@@ -1502,6 +1505,7 @@ Optional Features:
   --enable-separate-code  enable -z separate-code in ELF linker by default
   --enable-default-hash-style={sysv,gnu,both}
                           use this default hash style
+  --enable-libctf         Handle .ctf type-info sections [default=yes]
   --enable-werror         treat compile warnings as errors
   --enable-build-warnings enable build-time compiler warnings
   --disable-nls           do not use Native Language Support
@@ -12033,7 +12037,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12036 "configure"
+#line 12040 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12139,7 +12143,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12142 "configure"
+#line 12146 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15926,6 +15930,33 @@ case "${enable_default_hash_style}" in
   *) ac_default_emit_gnu_hash=0 ;;
 esac
 
+ # Check whether --enable-libctf was given.
+if test "${enable_libctf+set}" = set; then :
+  enableval=$enable_libctf;
+      case "$enableval" in
+       yes|no) ;;
+       *) as_fn_error $? "Argument to enable/disable libctf must be yes or no" "$LINENO" 5 ;;
+      esac
+
+else
+  enable_libctf=yes
+fi
+
+
+if test "${enable_libctf}" = yes; then
+
+$as_echo "#define ENABLE_LIBCTF 1" >>confdefs.h
+
+fi
+ if test "${enable_libctf}" = yes; then
+  ENABLE_LIBCTF_TRUE=
+  ENABLE_LIBCTF_FALSE='#'
+else
+  ENABLE_LIBCTF_TRUE='#'
+  ENABLE_LIBCTF_FALSE=
+fi
+
+
 
 # Set the 'development' global.
 . $srcdir/../bfd/development.sh
@@ -17700,6 +17731,9 @@ else
   TESTBFDLIB="../bfd/.libs/libbfd.a"
   TESTCTFLIB="../libctf/.libs/libctf.a"
 fi
+if test "${enable_libctf}" = no; then
+    TESTCTFLIB=
+fi
 
 
 
@@ -17872,6 +17906,10 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${ENABLE_LIBCTF_TRUE}" && test -z "${ENABLE_LIBCTF_FALSE}"; then
+  as_fn_error $? "conditional \"ENABLE_LIBCTF\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
   as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
index 2b6c0480e90179024479c2aae22e35aee7ca23b1..5a4938afdb0ec6f48a947cdcc51d41efb78f5143 100644 (file)
@@ -221,6 +221,12 @@ case "${enable_default_hash_style}" in
   *) ac_default_emit_gnu_hash=0 ;;
 esac
 
+GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
+if test "${enable_libctf}" = yes; then
+    AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
+fi
+AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes)
+
 AM_BINUTILS_WARNINGS
 
 AM_LC_MESSAGES
@@ -524,6 +530,9 @@ else
   TESTBFDLIB="../bfd/.libs/libbfd.a"
   TESTCTFLIB="../libctf/.libs/libctf.a"
 fi
+if test "${enable_libctf}" = no; then
+    TESTCTFLIB=
+fi
 AC_SUBST(TESTBFDLIB)
 AC_SUBST(TESTCTFLIB)
 
index c0568f169ff69e32abf01c4b3c7b4c92e07f7a7a..3a5619435cf4d9912b18016e5a2e5f75d4e50786 100644 (file)
@@ -88,6 +88,7 @@ ldelf_map_segments (bfd_boolean need_layout)
     }
 }
 
+#ifdef ENABLE_LIBCTF
 /* We want to emit CTF early if and only if we are not targetting ELF with this
    invocation.  */
 
@@ -197,3 +198,16 @@ ldelf_examine_strtab_for_ctf
                 "cost: %s\n"), ctf_errmsg (ctf_errno (ctf_output)));
     }
 }
+#else
+extern int ldelf_emit_ctf_early (void)
+{
+  return 0;
+}
+
+extern void ldelf_examine_strtab_for_ctf
+  (struct ctf_file *ctf_output ATTRIBUTE_UNUSED,
+   struct elf_sym_strtab *syms ATTRIBUTE_UNUSED,
+   bfd_size_type symcount ATTRIBUTE_UNUSED,
+   struct elf_strtab_hash *symstrtab ATTRIBUTE_UNUSED)
+{}
+#endif
index 38ed83a274b34138eff369f7d6282bda14c7c907..23e787a3b22d0fa83ea7ec4245a4046865dc2bcc 100644 (file)
@@ -131,7 +131,9 @@ bfd_boolean delete_output_file_on_failure = FALSE;
 struct lang_phdr *lang_phdr_list;
 struct lang_nocrossrefs *nocrossref_list;
 struct asneeded_minfo **asneeded_list_tail;
+#ifdef ENABLE_LIBCTF
 static ctf_file_t *ctf_output;
+#endif
 
 /* Functions that traverse the linker script and might evaluate
    DEFINED() need to increment this at the start of the traversal.  */
@@ -3669,6 +3671,7 @@ open_input_bfds (lang_statement_union_type *s, enum open_bfd_mode mode)
     einfo ("%F");
 }
 
+#ifdef ENABLE_LIBCTF
 /* Open the CTF sections in the input files with libctf: if any were opened,
    create a fake input file that we'll write the merged CTF data to later
    on.  */
@@ -3848,6 +3851,38 @@ ldlang_write_ctf_late (void)
 
   lang_write_ctf (1);
 }
+#else
+static void
+ldlang_open_ctf (void)
+{
+  LANG_FOR_EACH_INPUT_STATEMENT (file)
+    {
+      asection *sect;
+
+      /* If built without CTF, warn and delete all CTF sections from the output.
+        (The alternative would be to simply concatenate them, which does not
+        yield a valid CTF section.)  */
+
+      if ((sect = bfd_get_section_by_name (file->the_bfd, ".ctf")) != NULL)
+       {
+           einfo (_("%P: warning: CTF section in `%pI' not linkable: "
+                    "%P was built without support for CTF\n"), file);
+           sect->size = 0;
+           sect->flags |= SEC_EXCLUDE;
+       }
+    }
+}
+
+static void lang_merge_ctf (void) {}
+void
+ldlang_ctf_apply_strsym (struct elf_sym_strtab *syms ATTRIBUTE_UNUSED,
+                        bfd_size_type symcount ATTRIBUTE_UNUSED,
+                        struct elf_strtab_hash *symstrtab ATTRIBUTE_UNUSED)
+{
+}
+static void lang_write_ctf (int late ATTRIBUTE_UNUSED) {}
+void ldlang_write_ctf_late (void) {}
+#endif
 
 /* Add the supplied name to the symbol table as an undefined reference.
    This is a two step process as the symbol table doesn't even exist at
This page took 0.077395 seconds and 4 git commands to generate.