GNU Binutils with patches for OS216
Revision | 094e34f22146ad53eb93da22e480cab428bd23b5 (tree) |
---|---|
Time | 2020-06-26 23:56:39 |
Author | Nick Alcock <nick.alcock@orac...> |
Commiter | Nick Alcock |
binutils, ld: work with --disable-libctf
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
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.
@@ -1,3 +1,28 @@ | ||
1 | +2020-06-26 Nick Alcock <nick.alcock@oracle.com> | |
2 | + | |
3 | + * configure.ac [--enable-libctf]: New, default yes. | |
4 | + Set ENABLE_LIBCTF accordingly. | |
5 | + * Makefile.am [!ENABLE_LIBCTF]: Empty LIBCTF and LIBCTF_NOBFD. | |
6 | + * configure: Regenerate. | |
7 | + * config.in: Regenerate. | |
8 | + * Makefile.in: Regenerate. | |
9 | + * aclocal.m4: Regenerate. | |
10 | + * objdump.c (usage): Conditionalize portions on ENABLE_LIBCTF. | |
11 | + (option_values): Likewise. | |
12 | + (long_options): Likewise. | |
13 | + (main): Likewise. | |
14 | + (dump_ctf_indent_lines): Conditionalize out when !ENABLE_LIBCTF. | |
15 | + (make_ctfsect): Likewise. | |
16 | + (dump_ctf_archive_member): Likewise. | |
17 | + (dump_ctf) [ENABLE_LIBCTF]: Likewise. | |
18 | + (dump_ctf) [!ENABLE_LIBCTF]: New empty stub. | |
19 | + * readelf.c (options): Conditionalize portions on ENABLE_LIBCTF. | |
20 | + (usage): Likewise. | |
21 | + (process_section_contents): Likewise. | |
22 | + (shdr_to_ctf_sect): Conditionalize out when !ENABLE_LIBCTF. | |
23 | + (dump_ctf_indent_lines): Likewise. | |
24 | + (dump_section_as_ctf) [ENABLE_LIBCTF]: Likewise. | |
25 | + | |
1 | 26 | 2020-06-26 Jan Beulich <jbeulich@suse.com> |
2 | 27 | |
3 | 28 | * doc/binutils.texi: Adjust description of x86's -Msuffix. Drop |
@@ -164,8 +164,13 @@ BFDLIB = ../bfd/libbfd.la | ||
164 | 164 | |
165 | 165 | OPCODES = ../opcodes/libopcodes.la |
166 | 166 | |
167 | +if ENABLE_LIBCTF | |
167 | 168 | LIBCTF = ../libctf/libctf.la |
168 | 169 | LIBCTF_NOBFD = ../libctf/libctf-nobfd.la |
170 | +else | |
171 | +LIBCTF = | |
172 | +LIBCTF_NOBFD = | |
173 | +endif | |
169 | 174 | |
170 | 175 | LIBIBERTY = ../libiberty/libiberty.a |
171 | 176 |
@@ -122,6 +122,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
122 | 122 | am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ |
123 | 123 | $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \ |
124 | 124 | $(top_srcdir)/../config/depstand.m4 \ |
125 | + $(top_srcdir)/../config/enable.m4 \ | |
125 | 126 | $(top_srcdir)/../config/gettext-sister.m4 \ |
126 | 127 | $(top_srcdir)/../config/iconv.m4 \ |
127 | 128 | $(top_srcdir)/../config/largefile.m4 \ |
@@ -222,6 +223,7 @@ objcopy_LDADD = $(LDADD) | ||
222 | 223 | am_objdump_OBJECTS = objdump.$(OBJEXT) dwarf.$(OBJEXT) prdbg.$(OBJEXT) \ |
223 | 224 | $(am__objects_3) $(am__objects_1) $(am__objects_2) |
224 | 225 | objdump_OBJECTS = $(am_objdump_OBJECTS) |
226 | +@ENABLE_LIBCTF_TRUE@am__DEPENDENCIES_2 = ../libctf/libctf.la | |
225 | 227 | am_ranlib_OBJECTS = ar.$(OBJEXT) is-ranlib.$(OBJEXT) arparse.$(OBJEXT) \ |
226 | 228 | arlex.$(OBJEXT) arsup.$(OBJEXT) rename.$(OBJEXT) \ |
227 | 229 | binemul.$(OBJEXT) emul_$(EMULATION).$(OBJEXT) $(am__objects_1) |
@@ -229,6 +231,7 @@ ranlib_OBJECTS = $(am_ranlib_OBJECTS) | ||
229 | 231 | am_readelf_OBJECTS = readelf.$(OBJEXT) version.$(OBJEXT) \ |
230 | 232 | unwind-ia64.$(OBJEXT) dwarf.$(OBJEXT) $(am__objects_2) |
231 | 233 | readelf_OBJECTS = $(am_readelf_OBJECTS) |
234 | +@ENABLE_LIBCTF_TRUE@am__DEPENDENCIES_3 = ../libctf/libctf-nobfd.la | |
232 | 235 | am_size_OBJECTS = size.$(OBJEXT) $(am__objects_1) |
233 | 236 | size_OBJECTS = $(am_size_OBJECTS) |
234 | 237 | size_LDADD = $(LDADD) |
@@ -658,8 +661,10 @@ BULIBS = bucomm.c version.c filemode.c | ||
658 | 661 | ELFLIBS = elfcomm.c |
659 | 662 | BFDLIB = ../bfd/libbfd.la |
660 | 663 | OPCODES = ../opcodes/libopcodes.la |
661 | -LIBCTF = ../libctf/libctf.la | |
662 | -LIBCTF_NOBFD = ../libctf/libctf-nobfd.la | |
664 | +@ENABLE_LIBCTF_FALSE@LIBCTF = | |
665 | +@ENABLE_LIBCTF_TRUE@LIBCTF = ../libctf/libctf.la | |
666 | +@ENABLE_LIBCTF_FALSE@LIBCTF_NOBFD = | |
667 | +@ENABLE_LIBCTF_TRUE@LIBCTF_NOBFD = ../libctf/libctf-nobfd.la | |
663 | 668 | LIBIBERTY = ../libiberty/libiberty.a |
664 | 669 | POTFILES = $(CFILES) $(DEBUG_SRCS) $(HFILES) |
665 | 670 | EXPECT = expect |
@@ -1189,6 +1189,7 @@ m4_include([../bfd/acinclude.m4]) | ||
1189 | 1189 | m4_include([../bfd/warning.m4]) |
1190 | 1190 | m4_include([../config/acx.m4]) |
1191 | 1191 | m4_include([../config/depstand.m4]) |
1192 | +m4_include([../config/enable.m4]) | |
1192 | 1193 | m4_include([../config/gettext-sister.m4]) |
1193 | 1194 | m4_include([../config/iconv.m4]) |
1194 | 1195 | m4_include([../config/largefile.m4]) |
@@ -21,6 +21,9 @@ | ||
21 | 21 | /* Should strings use -a behavior by default? */ |
22 | 22 | #undef DEFAULT_STRINGS_ALL |
23 | 23 | |
24 | +/* Handle .ctf type-info sections */ | |
25 | +#undef ENABLE_LIBCTF | |
26 | + | |
24 | 27 | /* Define to 1 if translation of program messages to the user's native |
25 | 28 | language is requested. */ |
26 | 29 | #undef ENABLE_NLS |
@@ -684,6 +684,8 @@ WARN_WRITE_STRINGS | ||
684 | 684 | NO_WERROR |
685 | 685 | WARN_CFLAGS_FOR_BUILD |
686 | 686 | WARN_CFLAGS |
687 | +ENABLE_LIBCTF_FALSE | |
688 | +ENABLE_LIBCTF_TRUE | |
687 | 689 | LIBDEBUGINFOD |
688 | 690 | OTOOL64 |
689 | 691 | OTOOL |
@@ -815,6 +817,7 @@ enable_targets | ||
815 | 817 | enable_deterministic_archives |
816 | 818 | enable_default_strings_all |
817 | 819 | with_debuginfod |
820 | +enable_libctf | |
818 | 821 | enable_werror |
819 | 822 | enable_build_warnings |
820 | 823 | enable_nls |
@@ -1472,6 +1475,7 @@ Optional Features: | ||
1472 | 1475 | ar and ranlib default to -D behavior |
1473 | 1476 | --disable-default-strings-all |
1474 | 1477 | strings defaults to --data behavior |
1478 | + --enable-libctf Handle .ctf type-info sections [default=yes] | |
1475 | 1479 | --enable-werror treat compile warnings as errors |
1476 | 1480 | --enable-build-warnings enable build-time compiler warnings |
1477 | 1481 | --disable-nls do not use Native Language Support |
@@ -11529,7 +11533,7 @@ else | ||
11529 | 11533 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
11530 | 11534 | lt_status=$lt_dlunknown |
11531 | 11535 | cat > conftest.$ac_ext <<_LT_EOF |
11532 | -#line 11532 "configure" | |
11536 | +#line 11536 "configure" | |
11533 | 11537 | #include "confdefs.h" |
11534 | 11538 | |
11535 | 11539 | #if HAVE_DLFCN_H |
@@ -11635,7 +11639,7 @@ else | ||
11635 | 11639 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
11636 | 11640 | lt_status=$lt_dlunknown |
11637 | 11641 | cat > conftest.$ac_ext <<_LT_EOF |
11638 | -#line 11638 "configure" | |
11642 | +#line 11642 "configure" | |
11639 | 11643 | #include "confdefs.h" |
11640 | 11644 | |
11641 | 11645 | #if HAVE_DLFCN_H |
@@ -12331,6 +12335,33 @@ cat >>confdefs.h <<_ACEOF | ||
12331 | 12335 | _ACEOF |
12332 | 12336 | |
12333 | 12337 | |
12338 | + # Check whether --enable-libctf was given. | |
12339 | +if test "${enable_libctf+set}" = set; then : | |
12340 | + enableval=$enable_libctf; | |
12341 | + case "$enableval" in | |
12342 | + yes|no) ;; | |
12343 | + *) as_fn_error $? "Argument to enable/disable libctf must be yes or no" "$LINENO" 5 ;; | |
12344 | + esac | |
12345 | + | |
12346 | +else | |
12347 | + enable_libctf=yes | |
12348 | +fi | |
12349 | + | |
12350 | + | |
12351 | +if test "${enable_libctf}" = yes; then | |
12352 | + | |
12353 | +$as_echo "#define ENABLE_LIBCTF 1" >>confdefs.h | |
12354 | + | |
12355 | +fi | |
12356 | + if test "${enable_libctf}" = yes; then | |
12357 | + ENABLE_LIBCTF_TRUE= | |
12358 | + ENABLE_LIBCTF_FALSE='#' | |
12359 | +else | |
12360 | + ENABLE_LIBCTF_TRUE='#' | |
12361 | + ENABLE_LIBCTF_FALSE= | |
12362 | +fi | |
12363 | + | |
12364 | + | |
12334 | 12365 | |
12335 | 12366 | # Set the 'development' global. |
12336 | 12367 | . $srcdir/../bfd/development.sh |
@@ -15413,6 +15444,10 @@ else | ||
15413 | 15444 | am__EXEEXT_FALSE= |
15414 | 15445 | fi |
15415 | 15446 | |
15447 | +if test -z "${ENABLE_LIBCTF_TRUE}" && test -z "${ENABLE_LIBCTF_FALSE}"; then | |
15448 | + as_fn_error $? "conditional \"ENABLE_LIBCTF\" was never defined. | |
15449 | +Usually this means the macro was only invoked conditionally." "$LINENO" 5 | |
15450 | +fi | |
15416 | 15451 | if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then |
15417 | 15452 | as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. |
15418 | 15453 | Usually this means the macro was only invoked conditionally." "$LINENO" 5 |
@@ -69,6 +69,12 @@ AC_DEBUGINFOD | ||
69 | 69 | AC_DEFINE_UNQUOTED(DEFAULT_STRINGS_ALL, $default_strings_all, |
70 | 70 | [Should strings use -a behavior by default?]) |
71 | 71 | |
72 | +GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections]) | |
73 | +if test "${enable_libctf}" = yes; then | |
74 | + AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections]) | |
75 | +fi | |
76 | +AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes) | |
77 | + | |
72 | 78 | AM_BINUTILS_WARNINGS |
73 | 79 | |
74 | 80 | AC_CONFIG_HEADERS(config.h:config.in) |
@@ -111,6 +111,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
111 | 111 | am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ |
112 | 112 | $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \ |
113 | 113 | $(top_srcdir)/../config/depstand.m4 \ |
114 | + $(top_srcdir)/../config/enable.m4 \ | |
114 | 115 | $(top_srcdir)/../config/gettext-sister.m4 \ |
115 | 116 | $(top_srcdir)/../config/iconv.m4 \ |
116 | 117 | $(top_srcdir)/../config/largefile.m4 \ |
@@ -235,7 +235,13 @@ usage (FILE *stream, int status) | ||
235 | 235 | =gdb_index,=trace_info,=trace_abbrev,=trace_aranges,\n\ |
236 | 236 | =addr,=cu_index,=links,=follow-links]\n\ |
237 | 237 | Display DWARF info in the file\n\ |
238 | +")); | |
239 | +#ifdef ENABLE_LIBCTF | |
240 | + fprintf (stream, _("\ | |
238 | 241 | --ctf=SECTION Display CTF info from SECTION\n\ |
242 | +")); | |
243 | +#endif | |
244 | + fprintf (stream, _("\ | |
239 | 245 | -t, --syms Display the contents of the symbol table(s)\n\ |
240 | 246 | -T, --dynamic-syms Display the contents of the dynamic symbol table\n\ |
241 | 247 | -r, --reloc Display the relocation entries in the file\n\ |
@@ -284,9 +290,12 @@ usage (FILE *stream, int status) | ||
284 | 290 | --dwarf-depth=N Do not display DIEs at depth N or greater\n\ |
285 | 291 | --dwarf-start=N Display DIEs starting with N, at the same depth\n\ |
286 | 292 | or deeper\n\ |
287 | - --dwarf-check Make additional dwarf internal consistency checks.\ | |
288 | - \n\ | |
289 | - --ctf-parent=SECTION Use SECTION as the CTF parent\n\ | |
293 | + --dwarf-check Make additional dwarf internal consistency checks.\n")); | |
294 | +#ifdef ENABLE_LIBCTF | |
295 | + fprintf (stream, _("\ | |
296 | + --ctf-parent=SECTION Use SECTION as the CTF parent\n")); | |
297 | +#endif | |
298 | + fprintf (stream, _("\ | |
290 | 299 | --visualize-jumps Visualize jumps by drawing ASCII art lines\n\ |
291 | 300 | --visualize-jumps=color Use colors in the ASCII art\n\ |
292 | 301 | --visualize-jumps=extended-color Use extended 8-bit color codes\n\ |
@@ -328,8 +337,10 @@ enum option_values | ||
328 | 337 | OPTION_NO_RECURSE_LIMIT, |
329 | 338 | OPTION_INLINES, |
330 | 339 | OPTION_SOURCE_COMMENT, |
340 | +#ifdef ENABLE_LIBCTF | |
331 | 341 | OPTION_CTF, |
332 | 342 | OPTION_CTF_PARENT, |
343 | +#endif | |
333 | 344 | OPTION_VISUALIZE_JUMPS |
334 | 345 | }; |
335 | 346 |
@@ -375,8 +386,10 @@ static struct option long_options[]= | ||
375 | 386 | {"special-syms", no_argument, &dump_special_syms, 1}, |
376 | 387 | {"include", required_argument, NULL, 'I'}, |
377 | 388 | {"dwarf", optional_argument, NULL, OPTION_DWARF}, |
389 | +#ifdef ENABLE_LIBCTF | |
378 | 390 | {"ctf", required_argument, NULL, OPTION_CTF}, |
379 | 391 | {"ctf-parent", required_argument, NULL, OPTION_CTF_PARENT}, |
392 | +#endif | |
380 | 393 | {"stabs", no_argument, NULL, 'G'}, |
381 | 394 | {"start-address", required_argument, NULL, OPTION_START_ADDRESS}, |
382 | 395 | {"stop-address", required_argument, NULL, OPTION_STOP_ADDRESS}, |
@@ -4026,6 +4039,7 @@ dump_bfd_header (bfd *abfd) | ||
4026 | 4039 | } |
4027 | 4040 | |
4028 | 4041 | |
4042 | +#ifdef ENABLE_LIBCTF | |
4029 | 4043 | /* Formatting callback function passed to ctf_dump. Returns either the pointer |
4030 | 4044 | it is passed, or a pointer to newly-allocated storage, in which case |
4031 | 4045 | 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) | ||
4167 | 4181 | free (parentdata); |
4168 | 4182 | free (ctfdata); |
4169 | 4183 | } |
4184 | +#else | |
4185 | +static void | |
4186 | +dump_ctf (bfd *abfd ATTRIBUTE_UNUSED, const char *sect_name ATTRIBUTE_UNUSED, | |
4187 | + const char *parent_name ATTRIBUTE_UNUSED) {} | |
4188 | +#endif | |
4170 | 4189 | |
4171 | 4190 | |
4172 | 4191 | static void |
@@ -5348,6 +5367,7 @@ main (int argc, char **argv) | ||
5348 | 5367 | case OPTION_DWARF_CHECK: |
5349 | 5368 | dwarf_check = TRUE; |
5350 | 5369 | break; |
5370 | +#ifdef ENABLE_LIBCTF | |
5351 | 5371 | case OPTION_CTF: |
5352 | 5372 | dump_ctf_section_info = TRUE; |
5353 | 5373 | dump_ctf_section_name = xstrdup (optarg); |
@@ -5356,6 +5376,7 @@ main (int argc, char **argv) | ||
5356 | 5376 | case OPTION_CTF_PARENT: |
5357 | 5377 | dump_ctf_parent_name = xstrdup (optarg); |
5358 | 5378 | break; |
5379 | +#endif | |
5359 | 5380 | case 'G': |
5360 | 5381 | dump_stab_section_info = TRUE; |
5361 | 5382 | seenflag = TRUE; |
@@ -4502,11 +4502,13 @@ static struct option options[] = | ||
4502 | 4502 | {"dwarf-start", required_argument, 0, OPTION_DWARF_START}, |
4503 | 4503 | {"dwarf-check", no_argument, 0, OPTION_DWARF_CHECK}, |
4504 | 4504 | |
4505 | +#ifdef ENABLE_LIBCTF | |
4505 | 4506 | {"ctf", required_argument, 0, OPTION_CTF_DUMP}, |
4506 | 4507 | |
4507 | 4508 | {"ctf-symbols", required_argument, 0, OPTION_CTF_SYMBOLS}, |
4508 | 4509 | {"ctf-strings", required_argument, 0, OPTION_CTF_STRINGS}, |
4509 | 4510 | {"ctf-parent", required_argument, 0, OPTION_CTF_PARENT}, |
4511 | +#endif | |
4510 | 4512 | |
4511 | 4513 | {"version", no_argument, 0, 'v'}, |
4512 | 4514 | {"wide", no_argument, 0, 'W'}, |
@@ -4558,6 +4560,7 @@ usage (FILE * stream) | ||
4558 | 4560 | --dwarf-depth=N Do not display DIEs at depth N or greater\n\ |
4559 | 4561 | --dwarf-start=N Display DIEs starting with N, at the same depth\n\ |
4560 | 4562 | or deeper\n")); |
4563 | +#ifdef ENABLE_LIBCTF | |
4561 | 4564 | fprintf (stream, _("\ |
4562 | 4565 | --ctf=<number|name> Display CTF info from section <number|name>\n\ |
4563 | 4566 | --ctf-parent=<number|name>\n\ |
@@ -4566,6 +4569,7 @@ usage (FILE * stream) | ||
4566 | 4569 | Use section <number|name> as the CTF external symtab\n\n\ |
4567 | 4570 | --ctf-strings=<number|name>\n\ |
4568 | 4571 | Use section <number|name> as the CTF external strtab\n\n")); |
4572 | +#endif | |
4569 | 4573 | |
4570 | 4574 | #ifdef SUPPORT_DISASSEMBLY |
4571 | 4575 | fprintf (stream, _("\ |
@@ -14132,6 +14136,7 @@ dump_section_as_bytes (Elf_Internal_Shdr * section, | ||
14132 | 14136 | return FALSE; |
14133 | 14137 | } |
14134 | 14138 | |
14139 | +#ifdef ENABLE_LIBCTF | |
14135 | 14140 | static ctf_sect_t * |
14136 | 14141 | shdr_to_ctf_sect (ctf_sect_t *buf, Elf_Internal_Shdr *shdr, Filedata *filedata) |
14137 | 14142 | { |
@@ -14292,6 +14297,7 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata) | ||
14292 | 14297 | free (strdata); |
14293 | 14298 | return ret; |
14294 | 14299 | } |
14300 | +#endif | |
14295 | 14301 | |
14296 | 14302 | static bfd_boolean |
14297 | 14303 | load_specific_debug_section (enum dwarf_section_display_enum debug, |
@@ -14777,11 +14783,13 @@ process_section_contents (Filedata * filedata) | ||
14777 | 14783 | res = FALSE; |
14778 | 14784 | } |
14779 | 14785 | |
14786 | +#ifdef ENABLE_LIBCTF | |
14780 | 14787 | if (dump & CTF_DUMP) |
14781 | 14788 | { |
14782 | 14789 | if (! dump_section_as_ctf (section, filedata)) |
14783 | 14790 | res = FALSE; |
14784 | 14791 | } |
14792 | +#endif | |
14785 | 14793 | } |
14786 | 14794 | |
14787 | 14795 | /* Check to see if the user requested a |
@@ -1,3 +1,33 @@ | ||
1 | +2020-06-26 Nick Alcock <nick.alcock@oracle.com> | |
2 | + | |
3 | + * configure.ac [--enable-libctf]: New, default yes. | |
4 | + Set ENABLE_LIBCTF accordingly. | |
5 | + * Makefile.am [!ENABLE_LIBCTF]: Empty LIBCTF. | |
6 | + * configure: Regenerate. | |
7 | + * config.in: Regenerate. | |
8 | + * Makefile.in: Regenerate. | |
9 | + * aclocal.m4: Regenerate. | |
10 | + * ldlang.c (ctf_output): Conditionalize on ENABLE_LIBCTF. | |
11 | + (ldlang_open_ctf): Likewise. | |
12 | + (lang_merge_ctf): Likewise. | |
13 | + (ldlang_ctf_apply_strsym): Likewise. | |
14 | + (lang_write_ctf): Likewise. | |
15 | + (ldlang_write_ctf_late): Likewise. | |
16 | + (ldlang_open_ctf) [!ENABLE_LIBCTF]: Warn about the presence of CTF | |
17 | + sections. | |
18 | + (lang_merge_ctf) [!ENABLE_LIBCTF]: New stub. | |
19 | + (ldlang_ctf_apply_strsym) [!ENABLE_LIBCTF]: Likewise. | |
20 | + (lang_write_ctf) [!ENABLE_LIBCTF]: Likewise. | |
21 | + (ldlang_write_ctf_late) [!ENABLE_LIBCTF]: Likewise. | |
22 | + * ldelfgen.c (ldelf_emit_ctf_early): Conditionalize on | |
23 | + ENABLE_LIBCTF. | |
24 | + (struct ctf_strsym_iter_cb_arg): Likewise. | |
25 | + (ldelf_ctf_strtab_iter_cb): Likewise. | |
26 | + (ldelf_ctf_symbols_iter_cb): Likewise. | |
27 | + (ldelf_examine_strtab_for_ctf): Likewise. | |
28 | + (ldelf_emit_ctf_early) [!ENABLE_LIBCTF]: New stub. | |
29 | + (ldelf_examine_strtab_for_ctf) [!ENABLE_LIBCTF]: New stub. | |
30 | + | |
1 | 31 | 2020-06-26 Jan Beulich <jbeulich@suse.com> |
2 | 32 | |
3 | 33 | * testsuite/ld-x86-64/x86-64.exp: Run K1OM tests. |
@@ -144,7 +144,11 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @zlibinc@ \ | ||
144 | 144 | |
145 | 145 | BFDLIB = ../bfd/libbfd.la |
146 | 146 | LIBIBERTY = ../libiberty/libiberty.a |
147 | +if ENABLE_LIBCTF | |
147 | 148 | LIBCTF = ../libctf/libctf.la |
149 | +else | |
150 | +LIBCTF = | |
151 | +endif | |
148 | 152 | |
149 | 153 | # These all start with e so 'make clean' can find them. |
150 | 154 | ALL_EMULATION_SOURCES = \ |
@@ -113,6 +113,7 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
113 | 113 | am__aclocal_m4_deps = $(top_srcdir)/../bfd/acinclude.m4 \ |
114 | 114 | $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/../config/acx.m4 \ |
115 | 115 | $(top_srcdir)/../config/depstand.m4 \ |
116 | + $(top_srcdir)/../config/enable.m4 \ | |
116 | 117 | $(top_srcdir)/../config/gettext-sister.m4 \ |
117 | 118 | $(top_srcdir)/../config/largefile.m4 \ |
118 | 119 | $(top_srcdir)/../config/lcmessage.m4 \ |
@@ -180,6 +181,7 @@ am_ld_new_OBJECTS = ldgram.$(OBJEXT) ldlex-wrapper.$(OBJEXT) \ | ||
180 | 181 | plugin.$(OBJEXT) ldbuildid.$(OBJEXT) |
181 | 182 | ld_new_OBJECTS = $(am_ld_new_OBJECTS) |
182 | 183 | am__DEPENDENCIES_1 = |
184 | +@ENABLE_LIBCTF_TRUE@am__DEPENDENCIES_2 = ../libctf/libctf.la | |
183 | 185 | AM_V_P = $(am__v_P_@AM_V@) |
184 | 186 | am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) |
185 | 187 | am__v_P_0 = false |
@@ -628,7 +630,8 @@ AM_CPPFLAGS = -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @zlibinc@ \ | ||
628 | 630 | |
629 | 631 | BFDLIB = ../bfd/libbfd.la |
630 | 632 | LIBIBERTY = ../libiberty/libiberty.a |
631 | -LIBCTF = ../libctf/libctf.la | |
633 | +@ENABLE_LIBCTF_FALSE@LIBCTF = | |
634 | +@ENABLE_LIBCTF_TRUE@LIBCTF = ../libctf/libctf.la | |
632 | 635 | |
633 | 636 | # These all start with e so 'make clean' can find them. |
634 | 637 | ALL_EMULATION_SOURCES = \ |
@@ -1189,6 +1189,7 @@ m4_include([../bfd/acinclude.m4]) | ||
1189 | 1189 | m4_include([../bfd/warning.m4]) |
1190 | 1190 | m4_include([../config/acx.m4]) |
1191 | 1191 | m4_include([../config/depstand.m4]) |
1192 | +m4_include([../config/enable.m4]) | |
1192 | 1193 | m4_include([../config/gettext-sister.m4]) |
1193 | 1194 | m4_include([../config/largefile.m4]) |
1194 | 1195 | m4_include([../config/lcmessage.m4]) |
@@ -33,6 +33,9 @@ | ||
33 | 33 | */ |
34 | 34 | #undef DEFAULT_NEW_DTAGS |
35 | 35 | |
36 | +/* Handle .ctf type-info sections */ | |
37 | +#undef ENABLE_LIBCTF | |
38 | + | |
36 | 39 | /* Define to 1 if translation of program messages to the user's native |
37 | 40 | language is requested. */ |
38 | 41 | #undef ENABLE_NLS |
@@ -678,6 +678,8 @@ WARN_WRITE_STRINGS | ||
678 | 678 | NO_WERROR |
679 | 679 | WARN_CFLAGS_FOR_BUILD |
680 | 680 | WARN_CFLAGS |
681 | +ENABLE_LIBCTF_FALSE | |
682 | +ENABLE_LIBCTF_TRUE | |
681 | 683 | installed_linker |
682 | 684 | install_as_default |
683 | 685 | TARGET_SYSTEM_ROOT_DEFINE |
@@ -832,6 +834,7 @@ enable_relro | ||
832 | 834 | enable_textrel_check |
833 | 835 | enable_separate_code |
834 | 836 | enable_default_hash_style |
837 | +enable_libctf | |
835 | 838 | enable_werror |
836 | 839 | enable_build_warnings |
837 | 840 | enable_nls |
@@ -1502,6 +1505,7 @@ Optional Features: | ||
1502 | 1505 | --enable-separate-code enable -z separate-code in ELF linker by default |
1503 | 1506 | --enable-default-hash-style={sysv,gnu,both} |
1504 | 1507 | use this default hash style |
1508 | + --enable-libctf Handle .ctf type-info sections [default=yes] | |
1505 | 1509 | --enable-werror treat compile warnings as errors |
1506 | 1510 | --enable-build-warnings enable build-time compiler warnings |
1507 | 1511 | --disable-nls do not use Native Language Support |
@@ -12033,7 +12037,7 @@ else | ||
12033 | 12037 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
12034 | 12038 | lt_status=$lt_dlunknown |
12035 | 12039 | cat > conftest.$ac_ext <<_LT_EOF |
12036 | -#line 12036 "configure" | |
12040 | +#line 12040 "configure" | |
12037 | 12041 | #include "confdefs.h" |
12038 | 12042 | |
12039 | 12043 | #if HAVE_DLFCN_H |
@@ -12139,7 +12143,7 @@ else | ||
12139 | 12143 | lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 |
12140 | 12144 | lt_status=$lt_dlunknown |
12141 | 12145 | cat > conftest.$ac_ext <<_LT_EOF |
12142 | -#line 12142 "configure" | |
12146 | +#line 12146 "configure" | |
12143 | 12147 | #include "confdefs.h" |
12144 | 12148 | |
12145 | 12149 | #if HAVE_DLFCN_H |
@@ -15926,6 +15930,33 @@ case "${enable_default_hash_style}" in | ||
15926 | 15930 | *) ac_default_emit_gnu_hash=0 ;; |
15927 | 15931 | esac |
15928 | 15932 | |
15933 | + # Check whether --enable-libctf was given. | |
15934 | +if test "${enable_libctf+set}" = set; then : | |
15935 | + enableval=$enable_libctf; | |
15936 | + case "$enableval" in | |
15937 | + yes|no) ;; | |
15938 | + *) as_fn_error $? "Argument to enable/disable libctf must be yes or no" "$LINENO" 5 ;; | |
15939 | + esac | |
15940 | + | |
15941 | +else | |
15942 | + enable_libctf=yes | |
15943 | +fi | |
15944 | + | |
15945 | + | |
15946 | +if test "${enable_libctf}" = yes; then | |
15947 | + | |
15948 | +$as_echo "#define ENABLE_LIBCTF 1" >>confdefs.h | |
15949 | + | |
15950 | +fi | |
15951 | + if test "${enable_libctf}" = yes; then | |
15952 | + ENABLE_LIBCTF_TRUE= | |
15953 | + ENABLE_LIBCTF_FALSE='#' | |
15954 | +else | |
15955 | + ENABLE_LIBCTF_TRUE='#' | |
15956 | + ENABLE_LIBCTF_FALSE= | |
15957 | +fi | |
15958 | + | |
15959 | + | |
15929 | 15960 | |
15930 | 15961 | # Set the 'development' global. |
15931 | 15962 | . $srcdir/../bfd/development.sh |
@@ -17700,6 +17731,9 @@ else | ||
17700 | 17731 | TESTBFDLIB="../bfd/.libs/libbfd.a" |
17701 | 17732 | TESTCTFLIB="../libctf/.libs/libctf.a" |
17702 | 17733 | fi |
17734 | +if test "${enable_libctf}" = no; then | |
17735 | + TESTCTFLIB= | |
17736 | +fi | |
17703 | 17737 | |
17704 | 17738 | |
17705 | 17739 |
@@ -17872,6 +17906,10 @@ if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then | ||
17872 | 17906 | as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. |
17873 | 17907 | Usually this means the macro was only invoked conditionally." "$LINENO" 5 |
17874 | 17908 | fi |
17909 | +if test -z "${ENABLE_LIBCTF_TRUE}" && test -z "${ENABLE_LIBCTF_FALSE}"; then | |
17910 | + as_fn_error $? "conditional \"ENABLE_LIBCTF\" was never defined. | |
17911 | +Usually this means the macro was only invoked conditionally." "$LINENO" 5 | |
17912 | +fi | |
17875 | 17913 | if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then |
17876 | 17914 | as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. |
17877 | 17915 | Usually this means the macro was only invoked conditionally." "$LINENO" 5 |
@@ -221,6 +221,12 @@ case "${enable_default_hash_style}" in | ||
221 | 221 | *) ac_default_emit_gnu_hash=0 ;; |
222 | 222 | esac |
223 | 223 | |
224 | +GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections]) | |
225 | +if test "${enable_libctf}" = yes; then | |
226 | + AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections]) | |
227 | +fi | |
228 | +AM_CONDITIONAL(ENABLE_LIBCTF, test "${enable_libctf}" = yes) | |
229 | + | |
224 | 230 | AM_BINUTILS_WARNINGS |
225 | 231 | |
226 | 232 | AM_LC_MESSAGES |
@@ -524,6 +530,9 @@ else | ||
524 | 530 | TESTBFDLIB="../bfd/.libs/libbfd.a" |
525 | 531 | TESTCTFLIB="../libctf/.libs/libctf.a" |
526 | 532 | fi |
533 | +if test "${enable_libctf}" = no; then | |
534 | + TESTCTFLIB= | |
535 | +fi | |
527 | 536 | AC_SUBST(TESTBFDLIB) |
528 | 537 | AC_SUBST(TESTCTFLIB) |
529 | 538 |
@@ -88,6 +88,7 @@ ldelf_map_segments (bfd_boolean need_layout) | ||
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | +#ifdef ENABLE_LIBCTF | |
91 | 92 | /* We want to emit CTF early if and only if we are not targetting ELF with this |
92 | 93 | invocation. */ |
93 | 94 |
@@ -197,3 +198,16 @@ ldelf_examine_strtab_for_ctf | ||
197 | 198 | "cost: %s\n"), ctf_errmsg (ctf_errno (ctf_output))); |
198 | 199 | } |
199 | 200 | } |
201 | +#else | |
202 | +extern int ldelf_emit_ctf_early (void) | |
203 | +{ | |
204 | + return 0; | |
205 | +} | |
206 | + | |
207 | +extern void ldelf_examine_strtab_for_ctf | |
208 | + (struct ctf_file *ctf_output ATTRIBUTE_UNUSED, | |
209 | + struct elf_sym_strtab *syms ATTRIBUTE_UNUSED, | |
210 | + bfd_size_type symcount ATTRIBUTE_UNUSED, | |
211 | + struct elf_strtab_hash *symstrtab ATTRIBUTE_UNUSED) | |
212 | +{} | |
213 | +#endif |
@@ -131,7 +131,9 @@ bfd_boolean delete_output_file_on_failure = FALSE; | ||
131 | 131 | struct lang_phdr *lang_phdr_list; |
132 | 132 | struct lang_nocrossrefs *nocrossref_list; |
133 | 133 | struct asneeded_minfo **asneeded_list_tail; |
134 | +#ifdef ENABLE_LIBCTF | |
134 | 135 | static ctf_file_t *ctf_output; |
136 | +#endif | |
135 | 137 | |
136 | 138 | /* Functions that traverse the linker script and might evaluate |
137 | 139 | 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) | ||
3669 | 3671 | einfo ("%F"); |
3670 | 3672 | } |
3671 | 3673 | |
3674 | +#ifdef ENABLE_LIBCTF | |
3672 | 3675 | /* Open the CTF sections in the input files with libctf: if any were opened, |
3673 | 3676 | create a fake input file that we'll write the merged CTF data to later |
3674 | 3677 | on. */ |
@@ -3848,6 +3851,38 @@ ldlang_write_ctf_late (void) | ||
3848 | 3851 | |
3849 | 3852 | lang_write_ctf (1); |
3850 | 3853 | } |
3854 | +#else | |
3855 | +static void | |
3856 | +ldlang_open_ctf (void) | |
3857 | +{ | |
3858 | + LANG_FOR_EACH_INPUT_STATEMENT (file) | |
3859 | + { | |
3860 | + asection *sect; | |
3861 | + | |
3862 | + /* If built without CTF, warn and delete all CTF sections from the output. | |
3863 | + (The alternative would be to simply concatenate them, which does not | |
3864 | + yield a valid CTF section.) */ | |
3865 | + | |
3866 | + if ((sect = bfd_get_section_by_name (file->the_bfd, ".ctf")) != NULL) | |
3867 | + { | |
3868 | + einfo (_("%P: warning: CTF section in `%pI' not linkable: " | |
3869 | + "%P was built without support for CTF\n"), file); | |
3870 | + sect->size = 0; | |
3871 | + sect->flags |= SEC_EXCLUDE; | |
3872 | + } | |
3873 | + } | |
3874 | +} | |
3875 | + | |
3876 | +static void lang_merge_ctf (void) {} | |
3877 | +void | |
3878 | +ldlang_ctf_apply_strsym (struct elf_sym_strtab *syms ATTRIBUTE_UNUSED, | |
3879 | + bfd_size_type symcount ATTRIBUTE_UNUSED, | |
3880 | + struct elf_strtab_hash *symstrtab ATTRIBUTE_UNUSED) | |
3881 | +{ | |
3882 | +} | |
3883 | +static void lang_write_ctf (int late ATTRIBUTE_UNUSED) {} | |
3884 | +void ldlang_write_ctf_late (void) {} | |
3885 | +#endif | |
3851 | 3886 | |
3852 | 3887 | /* Add the supplied name to the symbol table as an undefined reference. |
3853 | 3888 | This is a two step process as the symbol table doesn't even exist at |