parent
de7e0a986b
commit
4ae6e00c91
@ -1 +1 @@
|
||||
SOURCES/binutils-2.38.tar.xz
|
||||
SOURCES/binutils-2.39.tar.xz
|
||||
|
@ -1 +1 @@
|
||||
15d42de8f15404a4a43a912440cf367f994779d7 SOURCES/binutils-2.38.tar.xz
|
||||
f17653e7b1d1fa5242a408919845da23e8cc5141 SOURCES/binutils-2.39.tar.xz
|
||||
|
@ -1,117 +0,0 @@
|
||||
diff -rupN --no-dereference binutils-2.38/ld/pe-dll.c binutils-2.38-new/ld/pe-dll.c
|
||||
--- binutils-2.38/ld/pe-dll.c 2022-01-22 13:14:09.000000000 +0100
|
||||
+++ binutils-2.38-new/ld/pe-dll.c 2022-04-26 13:55:06.273552113 +0200
|
||||
@@ -2084,8 +2084,12 @@ make_head (bfd *parent)
|
||||
char *oname;
|
||||
bfd *abfd;
|
||||
|
||||
- oname = xmalloc (20 + dll_symname_len);
|
||||
- sprintf (oname, "%s_d%06d.o", dll_symname, tmp_seq);
|
||||
+ if (asprintf (&oname, "%s_d%06d.o", dll_symname, tmp_seq) < 4)
|
||||
+ /* In theory we should return NULL here at let our caller decide what to
|
||||
+ do. But currently the return value is not checked, just used, and
|
||||
+ besides, this condition only happens when the system has run out of
|
||||
+ memory. So just give up. */
|
||||
+ exit (EXIT_FAILURE);
|
||||
tmp_seq++;
|
||||
|
||||
abfd = bfd_create (oname, parent);
|
||||
@@ -2173,8 +2177,12 @@ make_tail (bfd *parent)
|
||||
char *oname;
|
||||
bfd *abfd;
|
||||
|
||||
- oname = xmalloc (20 + dll_symname_len);
|
||||
- sprintf (oname, "%s_d%06d.o", dll_symname, tmp_seq);
|
||||
+ if (asprintf (&oname, "%s_d%06d.o", dll_symname, tmp_seq) < 4)
|
||||
+ /* In theory we should return NULL here at let our caller decide what to
|
||||
+ do. But currently the return value is not checked, just used, and
|
||||
+ besides, this condition only happens when the system has run out of
|
||||
+ memory. So just give up. */
|
||||
+ exit (EXIT_FAILURE);
|
||||
tmp_seq++;
|
||||
|
||||
abfd = bfd_create (oname, parent);
|
||||
@@ -2324,8 +2332,12 @@ make_one (def_file_export *exp, bfd *par
|
||||
}
|
||||
}
|
||||
|
||||
- oname = xmalloc (20 + dll_symname_len);
|
||||
- sprintf (oname, "%s_d%06d.o", dll_symname, tmp_seq);
|
||||
+ if (asprintf (&oname, "%s_d%06d.o", dll_symname, tmp_seq) < 4)
|
||||
+ /* In theory we should return NULL here at let our caller decide what to
|
||||
+ do. But currently the return value is not checked, just used, and
|
||||
+ besides, this condition only happens when the system has run out of
|
||||
+ memory. So just give up. */
|
||||
+ exit (EXIT_FAILURE);
|
||||
tmp_seq++;
|
||||
|
||||
abfd = bfd_create (oname, parent);
|
||||
@@ -2510,8 +2522,12 @@ make_singleton_name_thunk (const char *i
|
||||
char *oname;
|
||||
bfd *abfd;
|
||||
|
||||
- oname = xmalloc (20 + dll_symname_len);
|
||||
- sprintf (oname, "%s_nmth%06d.o", dll_symname, tmp_seq);
|
||||
+ if (asprintf (&oname, "%s_nmth%06d.o", dll_symname, tmp_seq) < 4)
|
||||
+ /* In theory we should return NULL here at let our caller decide what to
|
||||
+ do. But currently the return value is not checked, just used, and
|
||||
+ besides, this condition only happens when the system has run out of
|
||||
+ memory. So just give up. */
|
||||
+ exit (EXIT_FAILURE);
|
||||
tmp_seq++;
|
||||
|
||||
abfd = bfd_create (oname, parent);
|
||||
@@ -2551,7 +2567,7 @@ make_import_fixup_mark (arelent *rel, ch
|
||||
struct bfd_symbol *sym = *rel->sym_ptr_ptr;
|
||||
bfd *abfd = bfd_asymbol_bfd (sym);
|
||||
struct bfd_link_hash_entry *bh;
|
||||
- char *fixup_name, buf[26];
|
||||
+ char *fixup_name, buf[256];
|
||||
size_t prefix_len;
|
||||
|
||||
/* "name" buffer has space before the symbol name for prefixes. */
|
||||
@@ -2586,8 +2602,12 @@ make_import_fixup_entry (const char *nam
|
||||
char *oname;
|
||||
bfd *abfd;
|
||||
|
||||
- oname = xmalloc (20 + dll_symname_len);
|
||||
- sprintf (oname, "%s_fu%06d.o", dll_symname, tmp_seq);
|
||||
+ if (asprintf (&oname, "%s_fu%06d.o", dll_symname, tmp_seq) < 4)
|
||||
+ /* In theory we should return NULL here at let our caller decide what to
|
||||
+ do. But currently the return value is not checked, just used, and
|
||||
+ besides, this condition only happens when the system has run out of
|
||||
+ memory. So just give up. */
|
||||
+ exit (EXIT_FAILURE);
|
||||
tmp_seq++;
|
||||
|
||||
abfd = bfd_create (oname, parent);
|
||||
@@ -2640,8 +2660,12 @@ make_runtime_pseudo_reloc (const char *n
|
||||
bfd *abfd;
|
||||
bfd_size_type size;
|
||||
|
||||
- oname = xmalloc (20 + dll_symname_len);
|
||||
- sprintf (oname, "%s_rtr%06d.o", dll_symname, tmp_seq);
|
||||
+ if (asprintf (&oname, "%s_rtr%06d.o", dll_symname, tmp_seq) < 4)
|
||||
+ /* In theory we should return NULL here at let our caller decide what to
|
||||
+ do. But currently the return value is not checked, just used, and
|
||||
+ besides, this condition only happens when the system has run out of
|
||||
+ memory. So just give up. */
|
||||
+ exit (EXIT_FAILURE);
|
||||
tmp_seq++;
|
||||
|
||||
abfd = bfd_create (oname, parent);
|
||||
@@ -2727,8 +2751,12 @@ pe_create_runtime_relocator_reference (b
|
||||
char *oname;
|
||||
bfd *abfd;
|
||||
|
||||
- oname = xmalloc (20 + dll_symname_len);
|
||||
- sprintf (oname, "%s_ertr%06d.o", dll_symname, tmp_seq);
|
||||
+ if (asprintf (&oname, "%s_ertr%06d.o", dll_symname, tmp_seq) < 4)
|
||||
+ /* In theory we should return NULL here at let our caller decide what to
|
||||
+ do. But currently the return value is not checked, just used, and
|
||||
+ besides, this condition only happens when the system has run out of
|
||||
+ memory. So just give up. */
|
||||
+ exit (EXIT_FAILURE);
|
||||
tmp_seq++;
|
||||
|
||||
abfd = bfd_create (oname, parent);
|
@ -0,0 +1,19 @@
|
||||
diff -rupN --no-dereference binutils-2.39/bfd/coffcode.h binutils-2.39-new/bfd/coffcode.h
|
||||
--- binutils-2.39/bfd/coffcode.h 2022-07-08 11:46:47.000000000 +0200
|
||||
+++ binutils-2.39-new/bfd/coffcode.h 2022-10-30 12:41:41.408023817 +0100
|
||||
@@ -4284,10 +4284,13 @@ coff_set_section_contents (bfd * abfd,
|
||||
|
||||
rec = (bfd_byte *) location;
|
||||
recend = rec + count;
|
||||
- while (rec < recend)
|
||||
+ while (recend - rec >= 4)
|
||||
{
|
||||
+ size_t len = bfd_get_32 (abfd, rec);
|
||||
+ if (len == 0 || len > (size_t) (recend - rec) / 4)
|
||||
+ break;
|
||||
+ rec += len * 4;
|
||||
++section->lma;
|
||||
- rec += bfd_get_32 (abfd, rec) * 4;
|
||||
}
|
||||
|
||||
BFD_ASSERT (rec == recend);
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,255 +0,0 @@
|
||||
diff -rupN --no-dereference binutils-2.38/binutils/doc/binutils.texi binutils-2.38-new/binutils/doc/binutils.texi
|
||||
--- binutils-2.38/binutils/doc/binutils.texi 2022-01-22 13:14:07.000000000 +0100
|
||||
+++ binutils-2.38-new/binutils/doc/binutils.texi 2022-04-26 13:55:05.297550720 +0200
|
||||
@@ -2246,6 +2246,8 @@ objdump [@option{-a}|@option{--archive-h
|
||||
@option{--dwarf}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]]
|
||||
[@option{-WK}|@option{--dwarf=follow-links}]
|
||||
[@option{-WN}|@option{--dwarf=no-follow-links}]
|
||||
+ [@option{-wD}|@option{--dwarf=use-debuginfod}]
|
||||
+ [@option{-wE}|@option{--dwarf=do-not-use-debuginfod}]
|
||||
[@option{-L}|@option{--process-links}]
|
||||
[@option{--ctf=}@var{section}]
|
||||
[@option{-G}|@option{--stabs}]
|
||||
@@ -4879,6 +4881,8 @@ readelf [@option{-a}|@option{--all}]
|
||||
@option{--debug-dump}[=rawline,=decodedline,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=str-offsets,=loc,=Ranges,=pubtypes,=trace_info,=trace_abbrev,=trace_aranges,=gdb_index,=addr,=cu_index,=links]]
|
||||
[@option{-wK}|@option{--debug-dump=follow-links}]
|
||||
[@option{-wN}|@option{--debug-dump=no-follow-links}]
|
||||
+ [@option{-wD}|@option{--debug-dump=use-debuginfod}]
|
||||
+ [@option{-wE}|@option{--debug-dump=do-not-use-debuginfod}]
|
||||
[@option{-P}|@option{--process-links}]
|
||||
[@option{--dwarf-depth=@var{n}}]
|
||||
[@option{--dwarf-start=@var{n}}]
|
||||
@@ -5504,7 +5508,8 @@ deduced from the input file
|
||||
@cindex separate debug files
|
||||
|
||||
debuginfod is a web service that indexes ELF/DWARF debugging resources
|
||||
-by build-id and serves them over HTTP.
|
||||
+by build-id and serves them over HTTP. For more information see:
|
||||
+@emph{https://sourceware.org/elfutils/Debuginfod.html}
|
||||
|
||||
Binutils can be built with the debuginfod client library
|
||||
@code{libdebuginfod} using the @option{--with-debuginfod} configure option.
|
||||
@@ -5516,6 +5521,10 @@ separate debug files when the files are
|
||||
debuginfod is packaged with elfutils, starting with version 0.178.
|
||||
You can get the latest version from `https://sourceware.org/elfutils/'.
|
||||
|
||||
+The DWARF info dumping tools (@command{readelf} and @command{objdump})
|
||||
+have options to control when they should access the debuginfod
|
||||
+servers. By default this access is enabled.
|
||||
+
|
||||
@node Reporting Bugs
|
||||
@chapter Reporting Bugs
|
||||
@cindex bugs
|
||||
diff -rupN --no-dereference binutils-2.38/binutils/doc/debug.options.texi binutils-2.38-new/binutils/doc/debug.options.texi
|
||||
--- binutils-2.38/binutils/doc/debug.options.texi 2022-01-22 13:14:07.000000000 +0100
|
||||
+++ binutils-2.38-new/binutils/doc/debug.options.texi 2022-04-26 13:55:05.298550721 +0200
|
||||
@@ -68,10 +68,27 @@ chosen when configuring the binutils via
|
||||
@option{--enable-follow-debug-links=no} options. If these are not
|
||||
used then the default is to enable the following of debug links.
|
||||
|
||||
+Note - if support for the debuginfod protocol was enabled when the
|
||||
+binutils were built then this option will also include an attempt to
|
||||
+contact any debuginfod servers mentioned in the @var{DEBUGINFOD_URLS}
|
||||
+environment variable. This could take some time to resolve. This
|
||||
+behaviour can be disabled via the @option{=do-not-use-debuginfod} debug
|
||||
+option.
|
||||
+
|
||||
@item N
|
||||
@itemx =no-follow-links
|
||||
Disables the following of links to separate debug info files.
|
||||
|
||||
+@item D
|
||||
+@itemx =use-debuginfod
|
||||
+Enables contacting debuginfod servers if there is a need to follow
|
||||
+debug links. This is the default behaviour.
|
||||
+
|
||||
+@item E
|
||||
+@itemx =do-not-use-debuginfod
|
||||
+Disables contacting debuginfod servers when there is a need to follow
|
||||
+debug links.
|
||||
+
|
||||
@item l
|
||||
@itemx =rawline
|
||||
Displays the contents of the @samp{.debug_line} section in a raw
|
||||
diff -rupN --no-dereference binutils-2.38/binutils/dwarf.c binutils-2.38-new/binutils/dwarf.c
|
||||
--- binutils-2.38/binutils/dwarf.c 2022-01-22 13:14:07.000000000 +0100
|
||||
+++ binutils-2.38-new/binutils/dwarf.c 2022-04-26 13:55:05.299550722 +0200
|
||||
@@ -109,6 +109,9 @@ int do_debug_cu_index;
|
||||
int do_wide;
|
||||
int do_debug_links;
|
||||
int do_follow_links = DEFAULT_FOR_FOLLOW_LINKS;
|
||||
+#ifdef HAVE_LIBDEBUGINFOD
|
||||
+int use_debuginfod = 1;
|
||||
+#endif
|
||||
bool do_checks;
|
||||
|
||||
int dwarf_cutoff_level = -1;
|
||||
@@ -11038,7 +11041,7 @@ debuginfod_fetch_separate_debug_info (st
|
||||
|
||||
return false;
|
||||
}
|
||||
-#endif
|
||||
+#endif /* HAVE_LIBDEBUGINFOD */
|
||||
|
||||
static void *
|
||||
load_separate_debug_info (const char * main_filename,
|
||||
@@ -11157,9 +11160,10 @@ load_separate_debug_info (const char *
|
||||
{
|
||||
char * tmp_filename;
|
||||
|
||||
- if (debuginfod_fetch_separate_debug_info (xlink,
|
||||
- & tmp_filename,
|
||||
- file))
|
||||
+ if (use_debuginfod
|
||||
+ && debuginfod_fetch_separate_debug_info (xlink,
|
||||
+ & tmp_filename,
|
||||
+ file))
|
||||
{
|
||||
/* File successfully downloaded from server, replace
|
||||
debug_filename with the file's path. */
|
||||
@@ -11207,13 +11211,15 @@ load_separate_debug_info (const char *
|
||||
warn (_("tried: %s\n"), debug_filename);
|
||||
|
||||
#if HAVE_LIBDEBUGINFOD
|
||||
- {
|
||||
- char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR);
|
||||
- if (urls == NULL)
|
||||
- urls = "";
|
||||
+ if (use_debuginfod)
|
||||
+ {
|
||||
+ char *urls = getenv (DEBUGINFOD_URLS_ENV_VAR);
|
||||
|
||||
- warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls);
|
||||
- }
|
||||
+ if (urls == NULL)
|
||||
+ urls = "";
|
||||
+
|
||||
+ warn (_("tried: DEBUGINFOD_URLS=%s\n"), urls);
|
||||
+ }
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -11707,6 +11713,9 @@ dwarf_select_sections_by_names (const ch
|
||||
{ "aranges", & do_debug_aranges, 1 },
|
||||
{ "cu_index", & do_debug_cu_index, 1 },
|
||||
{ "decodedline", & do_debug_lines, FLAG_DEBUG_LINES_DECODED },
|
||||
+#ifdef HAVE_LIBDEBUGINFOD
|
||||
+ { "do-not-use-debuginfod", & use_debuginfod, 0 },
|
||||
+#endif
|
||||
{ "follow-links", & do_follow_links, 1 },
|
||||
{ "frames", & do_debug_frames, 1 },
|
||||
{ "frames-interp", & do_debug_frames_interp, 1 },
|
||||
@@ -11730,6 +11739,9 @@ dwarf_select_sections_by_names (const ch
|
||||
{ "trace_abbrev", & do_trace_abbrevs, 1 },
|
||||
{ "trace_aranges", & do_trace_aranges, 1 },
|
||||
{ "trace_info", & do_trace_info, 1 },
|
||||
+#ifdef HAVE_LIBDEBUGINFOD
|
||||
+ { "use-debuginfod", & use_debuginfod, 1 },
|
||||
+#endif
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
@@ -11783,6 +11795,10 @@ dwarf_select_sections_by_letters (const
|
||||
case 'A': do_debug_addr = 1; break;
|
||||
case 'a': do_debug_abbrevs = 1; break;
|
||||
case 'c': do_debug_cu_index = 1; break;
|
||||
+#ifdef HAVE_LIBDEBUGINFOD
|
||||
+ case 'D': use_debuginfod = 1; break;
|
||||
+ case 'E': use_debuginfod = 0; break;
|
||||
+#endif
|
||||
case 'F': do_debug_frames_interp = 1; /* Fall through. */
|
||||
case 'f': do_debug_frames = 1; break;
|
||||
case 'g': do_gdb_index = 1; break;
|
||||
diff -rupN --no-dereference binutils-2.38/binutils/dwarf.h binutils-2.38-new/binutils/dwarf.h
|
||||
--- binutils-2.38/binutils/dwarf.h 2022-01-22 13:14:07.000000000 +0100
|
||||
+++ binutils-2.38-new/binutils/dwarf.h 2022-04-26 13:55:05.299550722 +0200
|
||||
@@ -224,6 +224,9 @@ extern int do_debug_cu_index;
|
||||
extern int do_wide;
|
||||
extern int do_debug_links;
|
||||
extern int do_follow_links;
|
||||
+#ifdef HAVE_LIBDEBUGINFOD
|
||||
+extern int use_debuginfod;
|
||||
+#endif
|
||||
extern bool do_checks;
|
||||
|
||||
extern int dwarf_cutoff_level;
|
||||
diff -rupN --no-dereference binutils-2.38/binutils/NEWS binutils-2.38-new/binutils/NEWS
|
||||
--- binutils-2.38/binutils/NEWS 2022-01-22 13:14:07.000000000 +0100
|
||||
+++ binutils-2.38-new/binutils/NEWS 2022-04-26 13:55:05.297550720 +0200
|
||||
@@ -1,5 +1,8 @@
|
||||
-*- text -*-
|
||||
|
||||
+* Add an option to objdump and readelf to prevent attempts to access debuginfod
|
||||
+ servers when following links.
|
||||
+
|
||||
Changes in 2.38:
|
||||
|
||||
* elfedit: Add --output-abiversion option to update ABIVERSION.
|
||||
diff -rupN --no-dereference binutils-2.38/binutils/objdump.c binutils-2.38-new/binutils/objdump.c
|
||||
--- binutils-2.38/binutils/objdump.c 2022-01-22 13:14:07.000000000 +0100
|
||||
+++ binutils-2.38-new/binutils/objdump.c 2022-04-26 13:55:05.300550724 +0200
|
||||
@@ -281,6 +281,14 @@ usage (FILE *stream, int status)
|
||||
Do not follow links to separate debug info files\n\
|
||||
(default)\n"));
|
||||
#endif
|
||||
+#if HAVE_LIBDEBUGINFOD
|
||||
+ fprintf (stream, _("\
|
||||
+ -WD --dwarf=use-debuginfod\n\
|
||||
+ When following links, also query debuginfod servers (default)\n"));
|
||||
+ fprintf (stream, _("\
|
||||
+ -WE --dwarf=do-not-use-debuginfod\n\
|
||||
+ When following links, do not query debuginfod servers\n"));
|
||||
+#endif
|
||||
fprintf (stream, _("\
|
||||
-L, --process-links Display the contents of non-debug sections in\n\
|
||||
separate debuginfo files. (Implies -WK)\n"));
|
||||
diff -rupN --no-dereference binutils-2.38/binutils/readelf.c binutils-2.38-new/binutils/readelf.c
|
||||
--- binutils-2.38/binutils/readelf.c 2022-04-26 13:54:52.269532121 +0200
|
||||
+++ binutils-2.38-new/binutils/readelf.c 2022-04-26 13:55:05.303550728 +0200
|
||||
@@ -5126,6 +5126,14 @@ usage (FILE * stream)
|
||||
Do not follow links to separate debug info files\n\
|
||||
(default)\n"));
|
||||
#endif
|
||||
+#if HAVE_LIBDEBUGINFOD
|
||||
+ fprintf (stream, _("\
|
||||
+ -wD --debug-dump=use-debuginfod\n\
|
||||
+ When following links, also query debuginfod servers (default)\n"));
|
||||
+ fprintf (stream, _("\
|
||||
+ -wE --debug-dump=do-not-use-debuginfod\n\
|
||||
+ When following links, do not query debuginfod servers\n"));
|
||||
+#endif
|
||||
fprintf (stream, _("\
|
||||
--dwarf-depth=N Do not display DIEs at depth N or greater\n"));
|
||||
fprintf (stream, _("\
|
||||
diff -rupN --no-dereference binutils-2.38/binutils/testsuite/binutils-all/debuginfod.exp binutils-2.38-new/binutils/testsuite/binutils-all/debuginfod.exp
|
||||
--- binutils-2.38/binutils/testsuite/binutils-all/debuginfod.exp 2022-01-22 13:14:07.000000000 +0100
|
||||
+++ binutils-2.38-new/binutils/testsuite/binutils-all/debuginfod.exp 2022-04-26 13:55:05.303550728 +0200
|
||||
@@ -185,8 +185,14 @@ proc test_fetch_debugaltlink { prog prog
|
||||
}
|
||||
|
||||
if { [regexp ".*DEBUGINFOD.*" $conf_objdump] } {
|
||||
- test_fetch_debuglink $OBJDUMP "-W"
|
||||
+ test_fetch_debuglink $OBJDUMP "-W -WD"
|
||||
test_fetch_debugaltlink $OBJDUMP "-Wk"
|
||||
+
|
||||
+ set test "disabling debuginfod access"
|
||||
+ setup_xfail *-*-*
|
||||
+ test_fetch_debuglink $OBJDUMP "-W -WE"
|
||||
+ set test "debuginfod"
|
||||
+
|
||||
} else {
|
||||
untested "$test (objdump not configured with debuginfod)"
|
||||
}
|
||||
@@ -194,6 +200,12 @@ if { [regexp ".*DEBUGINFOD.*" $conf_objd
|
||||
if { [regexp ".*DEBUGINFOD.*" $conf_readelf] } {
|
||||
test_fetch_debuglink $READELF "-w"
|
||||
test_fetch_debugaltlink $READELF "-wk"
|
||||
+
|
||||
+ set test "disabling debuginfod access"
|
||||
+ setup_xfail *-*-*
|
||||
+ test_fetch_debuglink $READELF "-w -wE"
|
||||
+ set test "debuginfod"
|
||||
+
|
||||
} else {
|
||||
untested "$test (readelf not configured with debuginfod)"
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,67 @@
|
||||
diff -rupN --no-dereference binutils-2.39/gas/dwarf2dbg.c binutils-2.39-new/gas/dwarf2dbg.c
|
||||
--- binutils-2.39/gas/dwarf2dbg.c 2022-07-08 11:46:47.000000000 +0200
|
||||
+++ binutils-2.39-new/gas/dwarf2dbg.c 2022-10-30 12:41:40.297023812 +0100
|
||||
@@ -2882,6 +2882,7 @@ out_debug_info (segT info_seg, segT abbr
|
||||
{
|
||||
const char *name;
|
||||
size_t len;
|
||||
+ expressionS size = { .X_op = O_constant };
|
||||
|
||||
/* Skip warning constructs (see above). */
|
||||
if (symbol_get_bfdsym (symp)->flags & BSF_WARNING)
|
||||
@@ -2895,6 +2896,18 @@ out_debug_info (segT info_seg, segT abbr
|
||||
if (!S_IS_DEFINED (symp) || !S_IS_FUNCTION (symp))
|
||||
continue;
|
||||
|
||||
+#if defined (OBJ_ELF) /* || defined (OBJ_MAYBE_ELF) */
|
||||
+ size.X_add_number = S_GET_SIZE (symp);
|
||||
+ if (size.X_add_number == 0 && IS_ELF
|
||||
+ && symbol_get_obj (symp)->size != NULL)
|
||||
+ {
|
||||
+ size.X_op = O_add;
|
||||
+ size.X_op_symbol = make_expr_symbol (symbol_get_obj (symp)->size);
|
||||
+ }
|
||||
+#endif
|
||||
+ if (size.X_op == O_constant && size.X_add_number == 0)
|
||||
+ continue;
|
||||
+
|
||||
subseg_set (str_seg, 0);
|
||||
name_sym = symbol_temp_new_now_octets ();
|
||||
name = S_GET_NAME (symp);
|
||||
@@ -2920,29 +2933,17 @@ out_debug_info (segT info_seg, segT abbr
|
||||
emit_expr (&exp, sizeof_address);
|
||||
|
||||
/* DW_AT_high_pc */
|
||||
- exp.X_op = O_constant;
|
||||
-#if defined (OBJ_ELF) /* || defined (OBJ_MAYBE_ELF) */
|
||||
- exp.X_add_number = S_GET_SIZE (symp);
|
||||
- if (exp.X_add_number == 0 && IS_ELF
|
||||
- && symbol_get_obj (symp)->size != NULL)
|
||||
- {
|
||||
- exp.X_op = O_add;
|
||||
- exp.X_op_symbol = make_expr_symbol (symbol_get_obj (symp)->size);
|
||||
- }
|
||||
-#else
|
||||
- exp.X_add_number = 0;
|
||||
-#endif
|
||||
if (DWARF2_VERSION < 4)
|
||||
{
|
||||
- if (exp.X_op == O_constant)
|
||||
- exp.X_op = O_symbol;
|
||||
- exp.X_add_symbol = symp;
|
||||
- emit_expr (&exp, sizeof_address);
|
||||
+ if (size.X_op == O_constant)
|
||||
+ size.X_op = O_symbol;
|
||||
+ size.X_add_symbol = symp;
|
||||
+ emit_expr (&size, sizeof_address);
|
||||
}
|
||||
- else if (exp.X_op == O_constant)
|
||||
- out_uleb128 (exp.X_add_number);
|
||||
+ else if (size.X_op == O_constant)
|
||||
+ out_uleb128 (size.X_add_number);
|
||||
else
|
||||
- emit_leb128_expr (symbol_get_value_expression (exp.X_op_symbol), 0);
|
||||
+ emit_leb128_expr (symbol_get_value_expression (size.X_op_symbol), 0);
|
||||
}
|
||||
|
||||
/* End of children. */
|
@ -1,92 +0,0 @@
|
||||
diff -rupN --no-dereference binutils-2.38/gas/dwarf2dbg.c binutils-2.38-new/gas/dwarf2dbg.c
|
||||
--- binutils-2.38/gas/dwarf2dbg.c 2022-01-22 13:14:08.000000000 +0100
|
||||
+++ binutils-2.38-new/gas/dwarf2dbg.c 2022-04-26 13:55:04.339549352 +0200
|
||||
@@ -402,18 +402,27 @@ set_or_check_view (struct line_entry *e,
|
||||
if (viewx.X_op != O_constant || viewx.X_add_number)
|
||||
{
|
||||
expressionS incv;
|
||||
+ expressionS *p_view;
|
||||
|
||||
if (!p->loc.u.view)
|
||||
- {
|
||||
- p->loc.u.view = symbol_temp_make ();
|
||||
- gas_assert (!S_IS_DEFINED (p->loc.u.view));
|
||||
- }
|
||||
+ p->loc.u.view = symbol_temp_make ();
|
||||
|
||||
memset (&incv, 0, sizeof (incv));
|
||||
incv.X_unsigned = 1;
|
||||
incv.X_op = O_symbol;
|
||||
incv.X_add_symbol = p->loc.u.view;
|
||||
incv.X_add_number = 1;
|
||||
+ p_view = symbol_get_value_expression (p->loc.u.view);
|
||||
+ if (p_view->X_op == O_constant || p_view->X_op == O_symbol)
|
||||
+ {
|
||||
+ /* If we can, constant fold increments so that a chain of
|
||||
+ expressions v + 1 + 1 ... + 1 is not created.
|
||||
+ resolve_expression isn't ideal for this purpose. The
|
||||
+ base v might not be resolvable until later. */
|
||||
+ incv.X_op = p_view->X_op;
|
||||
+ incv.X_add_symbol = p_view->X_add_symbol;
|
||||
+ incv.X_add_number = p_view->X_add_number + 1;
|
||||
+ }
|
||||
|
||||
if (viewx.X_op == O_constant)
|
||||
{
|
||||
diff -rupN --no-dereference binutils-2.38/gas/symbols.c binutils-2.38-new/gas/symbols.c
|
||||
--- binutils-2.38/gas/symbols.c 2022-01-22 13:14:08.000000000 +0100
|
||||
+++ binutils-2.38-new/gas/symbols.c 2022-04-26 13:55:04.338549351 +0200
|
||||
@@ -61,8 +61,10 @@ struct symbol_flags
|
||||
/* Whether the symbol can be re-defined. */
|
||||
unsigned int volatil : 1;
|
||||
|
||||
- /* Whether the symbol is a forward reference. */
|
||||
+ /* Whether the symbol is a forward reference, and whether such has
|
||||
+ been determined. */
|
||||
unsigned int forward_ref : 1;
|
||||
+ unsigned int forward_resolved : 1;
|
||||
|
||||
/* This is set if the symbol is defined in an MRI common section.
|
||||
We handle such sections as single common symbols, so symbols
|
||||
@@ -202,7 +204,7 @@ static void *
|
||||
symbol_entry_find (htab_t table, const char *name)
|
||||
{
|
||||
hashval_t hash = htab_hash_string (name);
|
||||
- symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
+ symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
hash, name, 0, 0, 0 } };
|
||||
return htab_find_with_hash (table, &needle, hash);
|
||||
}
|
||||
@@ -784,7 +786,9 @@ symbol_clone (symbolS *orgsymP, int repl
|
||||
symbolS *
|
||||
symbol_clone_if_forward_ref (symbolS *symbolP, int is_forward)
|
||||
{
|
||||
- if (symbolP && !symbolP->flags.local_symbol)
|
||||
+ if (symbolP
|
||||
+ && !symbolP->flags.local_symbol
|
||||
+ && !symbolP->flags.forward_resolved)
|
||||
{
|
||||
symbolS *orig_add_symbol = symbolP->x->value.X_add_symbol;
|
||||
symbolS *orig_op_symbol = symbolP->x->value.X_op_symbol;
|
||||
@@ -837,6 +841,7 @@ symbol_clone_if_forward_ref (symbolS *sy
|
||||
|
||||
symbolP->x->value.X_add_symbol = add_symbol;
|
||||
symbolP->x->value.X_op_symbol = op_symbol;
|
||||
+ symbolP->flags.forward_resolved = 1;
|
||||
}
|
||||
|
||||
return symbolP;
|
||||
diff -rupN --no-dereference binutils-2.38/gas/testsuite/gas/elf/dwarf2-18.d binutils-2.38-new/gas/testsuite/gas/elf/dwarf2-18.d
|
||||
--- binutils-2.38/gas/testsuite/gas/elf/dwarf2-18.d 2022-01-22 13:14:08.000000000 +0100
|
||||
+++ binutils-2.38-new/gas/testsuite/gas/elf/dwarf2-18.d 2022-04-26 13:55:04.339549352 +0200
|
||||
@@ -2,9 +2,8 @@
|
||||
#readelf: -x.rodata -wL
|
||||
#name: DWARF2 18
|
||||
# The am33 cr16 crx ft32 mn10 msp430 nds32 and rl78 targets do not evaluate the subtraction of symbols at assembly time.
|
||||
-# The mep targets turns some view computations into complex relocations.
|
||||
# The riscv targets do not support the subtraction of symbols.
|
||||
-#xfail: am3*-* cr16-* crx-* ft32*-* mep-* mn10*-* msp430-* nds32*-* riscv*-* rl78-*
|
||||
+#xfail: am3*-* cr16-* crx-* ft32*-* mn10*-* msp430-* nds32*-* riscv*-* rl78-*
|
||||
|
||||
Hex dump of section '\.rodata':
|
||||
0x00000000 0100 *.*
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
diff -rupN --no-dereference binutils-2.38/ltmain.sh binutils-2.38-new/ltmain.sh
|
||||
--- binutils-2.38/ltmain.sh 2022-01-22 13:14:09.000000000 +0100
|
||||
+++ binutils-2.38-new/ltmain.sh 2022-04-26 13:55:02.394546575 +0200
|
||||
diff -rupN --no-dereference binutils-2.39/ltmain.sh binutils-2.39-new/ltmain.sh
|
||||
--- binutils-2.39/ltmain.sh 2022-07-08 11:46:48.000000000 +0200
|
||||
+++ binutils-2.39-new/ltmain.sh 2022-10-30 12:41:38.049023801 +0100
|
||||
@@ -7103,6 +7103,7 @@ EOF
|
||||
rpath="$finalize_rpath"
|
||||
test "$mode" != relink && rpath="$compile_rpath$rpath"
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,197 @@
|
||||
diff -rupN --no-dereference binutils-2.39/elfcpp/elfcpp.h binutils-2.39-new/elfcpp/elfcpp.h
|
||||
--- binutils-2.39/elfcpp/elfcpp.h 2022-07-08 11:46:47.000000000 +0200
|
||||
+++ binutils-2.39-new/elfcpp/elfcpp.h 2022-10-30 12:41:39.175023806 +0100
|
||||
@@ -999,7 +999,9 @@ enum
|
||||
// string.
|
||||
NT_GNU_GOLD_VERSION = 4,
|
||||
// Program property note, as described in "Linux Extensions to the gABI".
|
||||
- NT_GNU_PROPERTY_TYPE_0 = 5
|
||||
+ NT_GNU_PROPERTY_TYPE_0 = 5,
|
||||
+ // FDO .note.package notes as defined on https://systemd.io/ELF_PACKAGE_METADATA/
|
||||
+ FDO_PACKAGING_METADATA = 0xcafe1a7e
|
||||
};
|
||||
|
||||
// The OS values which may appear in word 0 of a NT_GNU_ABI_TAG note.
|
||||
diff -rupN --no-dereference binutils-2.39/gold/configure.ac binutils-2.39-new/gold/configure.ac
|
||||
--- binutils-2.39/gold/configure.ac 2022-10-30 12:41:34.538023785 +0100
|
||||
+++ binutils-2.39-new/gold/configure.ac 2022-10-30 12:41:39.173023806 +0100
|
||||
@@ -591,6 +591,32 @@ if test "$threads" = "yes"; then
|
||||
fi
|
||||
AM_CONDITIONAL(THREADS, test "$threads" = "yes")
|
||||
|
||||
+# Used to validate --package-metadata= input. Disabled by default.
|
||||
+AC_ARG_ENABLE([jansson],
|
||||
+ [AS_HELP_STRING([--enable-jansson],
|
||||
+ [enable jansson [default=no]])],
|
||||
+ [enable_jansson=$enableval],
|
||||
+ [enable_jansson="no"])
|
||||
+
|
||||
+if test "x$enable_jansson" != "xno"; then
|
||||
+ PKG_PROG_PKG_CONFIG
|
||||
+ AS_IF([test -n "$PKG_CONFIG"],
|
||||
+ [
|
||||
+ PKG_CHECK_MODULES(JANSSON, [jansson],
|
||||
+ [
|
||||
+ AC_DEFINE(HAVE_JANSSON, 1, [The jansson library is to be used])
|
||||
+ AC_SUBST([JANSSON_CFLAGS])
|
||||
+ AC_SUBST([JANSSON_LIBS])
|
||||
+ ],
|
||||
+ [
|
||||
+ AC_MSG_ERROR([Cannot find jansson library])
|
||||
+ ])
|
||||
+ ],
|
||||
+ [
|
||||
+ AC_MSG_ERROR([Cannot find pkg-config])
|
||||
+ ])
|
||||
+fi
|
||||
+
|
||||
dnl We have to check these in C, not C++, because autoconf generates
|
||||
dnl tests which have no type information, and current glibc provides
|
||||
dnl multiple declarations of functions like basename when compiling
|
||||
diff -rupN --no-dereference binutils-2.39/gold/layout.cc binutils-2.39-new/gold/layout.cc
|
||||
--- binutils-2.39/gold/layout.cc 2022-10-30 12:41:33.405023779 +0100
|
||||
+++ binutils-2.39-new/gold/layout.cc 2022-10-30 12:41:39.174023806 +0100
|
||||
@@ -38,6 +38,9 @@
|
||||
#include <windows.h>
|
||||
#include <rpcdce.h>
|
||||
#endif
|
||||
+#ifdef HAVE_JANSSON
|
||||
+#include <jansson.h>
|
||||
+#endif
|
||||
|
||||
#include "parameters.h"
|
||||
#include "options.h"
|
||||
@@ -2439,6 +2442,7 @@ Layout::create_notes()
|
||||
this->create_gold_note();
|
||||
this->create_stack_segment();
|
||||
this->create_build_id();
|
||||
+ this->create_package_metadata();
|
||||
}
|
||||
|
||||
// Create the dynamic sections which are needed before we read the
|
||||
@@ -3536,6 +3540,52 @@ Layout::create_build_id()
|
||||
}
|
||||
}
|
||||
|
||||
+// If --package-metadata was used, set up the package metadata note.
|
||||
+// https://systemd.io/ELF_PACKAGE_METADATA/
|
||||
+
|
||||
+void
|
||||
+Layout::create_package_metadata()
|
||||
+{
|
||||
+ if (!parameters->options().user_set_package_metadata())
|
||||
+ return;
|
||||
+
|
||||
+ const char* desc = parameters->options().package_metadata();
|
||||
+ if (strcmp(desc, "") == 0)
|
||||
+ return;
|
||||
+
|
||||
+#ifdef HAVE_JANSSON
|
||||
+ json_error_t json_error;
|
||||
+ json_t *json = json_loads(desc, 0, &json_error);
|
||||
+ if (json)
|
||||
+ json_decref(json);
|
||||
+ else
|
||||
+ {
|
||||
+ gold_fatal(_("error: --package-metadata=%s does not contain valid "
|
||||
+ "JSON: %s\n"),
|
||||
+ desc, json_error.text);
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
+ // Create the note.
|
||||
+ size_t trailing_padding;
|
||||
+ // Ensure the trailing NULL byte is always included, as per specification.
|
||||
+ size_t descsz = strlen(desc) + 1;
|
||||
+ Output_section* os = this->create_note("FDO", elfcpp::FDO_PACKAGING_METADATA,
|
||||
+ ".note.package", descsz, true,
|
||||
+ &trailing_padding);
|
||||
+ if (os == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ Output_section_data* posd = new Output_data_const(desc, descsz, 4);
|
||||
+ os->add_output_section_data(posd);
|
||||
+
|
||||
+ if (trailing_padding != 0)
|
||||
+ {
|
||||
+ posd = new Output_data_zero_fill(trailing_padding, 0);
|
||||
+ os->add_output_section_data(posd);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// If we have both .stabXX and .stabXXstr sections, then the sh_link
|
||||
// field of the former should point to the latter. I'm not sure who
|
||||
// started this, but the GNU linker does it, and some tools depend
|
||||
diff -rupN --no-dereference binutils-2.39/gold/layout.h binutils-2.39-new/gold/layout.h
|
||||
--- binutils-2.39/gold/layout.h 2022-07-08 11:46:48.000000000 +0200
|
||||
+++ binutils-2.39-new/gold/layout.h 2022-10-30 12:41:39.174023806 +0100
|
||||
@@ -1107,6 +1107,10 @@ class Layout
|
||||
void
|
||||
create_build_id();
|
||||
|
||||
+ // Create a package metadata note if needed.
|
||||
+ void
|
||||
+ create_package_metadata();
|
||||
+
|
||||
// Link .stab and .stabstr sections.
|
||||
void
|
||||
link_stabs_sections();
|
||||
@@ -1453,6 +1457,8 @@ class Layout
|
||||
Gdb_index* gdb_index_data_;
|
||||
// The space for the build ID checksum if there is one.
|
||||
Output_section_data* build_id_note_;
|
||||
+ // The space for the package metadata JSON if there is one.
|
||||
+ Output_section_data* package_metadata_note_;
|
||||
// The output section containing dwarf abbreviations
|
||||
Output_reduced_debug_abbrev_section* debug_abbrev_;
|
||||
// The output section containing the dwarf debug info tree
|
||||
diff -rupN --no-dereference binutils-2.39/gold/Makefile.am binutils-2.39-new/gold/Makefile.am
|
||||
--- binutils-2.39/gold/Makefile.am 2022-07-08 11:46:48.000000000 +0200
|
||||
+++ binutils-2.39-new/gold/Makefile.am 2022-10-30 12:41:39.173023806 +0100
|
||||
@@ -35,7 +35,7 @@ THREADFLAGS = @PTHREAD_CFLAGS@
|
||||
THREADLIBS = @PTHREAD_LIBS@
|
||||
|
||||
AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC) $(THREADFLAGS)
|
||||
-AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC) $(THREADFLAGS)
|
||||
+AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS) $(ZLIBINC) $(THREADFLAGS) $(JANSSON_CFLAGS)
|
||||
AM_LDFLAGS = $(THREADFLAGS)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
@@ -187,7 +187,7 @@ libgold_a_LIBADD = $(LIBOBJS)
|
||||
sources_var = main.cc
|
||||
deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
|
||||
ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) \
|
||||
- $(THREADLIBS) $(LIBDL) $(ZLIB)
|
||||
+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
|
||||
ldflags_var = $(GOLD_LDFLAGS)
|
||||
|
||||
ld_new_SOURCES = $(sources_var)
|
||||
@@ -201,12 +201,12 @@ incremental_dump_SOURCES = incremental-d
|
||||
incremental_dump_DEPENDENCIES = $(TARGETOBJS) libgold.a $(LIBIBERTY) \
|
||||
$(LIBINTL_DEP)
|
||||
incremental_dump_LDADD = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
|
||||
- $(THREADLIBS) $(LIBDL) $(ZLIB)
|
||||
+ $(THREADLIBS) $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
|
||||
|
||||
dwp_SOURCES = dwp.cc
|
||||
dwp_DEPENDENCIES = libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
|
||||
dwp_LDADD = libgold.a $(LIBIBERTY) $(GOLD_LDADD) $(LIBINTL) $(THREADLIBS) \
|
||||
- $(LIBDL) $(ZLIB)
|
||||
+ $(LIBDL) $(ZLIB) $(JANSSON_LIBS)
|
||||
dwp_LDFLAGS = $(GOLD_LDFLAGS)
|
||||
|
||||
CONFIG_STATUS_DEPENDENCIES = $(srcdir)/../bfd/development.sh
|
||||
diff -rupN --no-dereference binutils-2.39/gold/options.h binutils-2.39-new/gold/options.h
|
||||
--- binutils-2.39/gold/options.h 2022-07-08 11:46:48.000000000 +0200
|
||||
+++ binutils-2.39-new/gold/options.h 2022-10-30 12:41:39.175023806 +0100
|
||||
@@ -1102,6 +1102,10 @@ class General_options
|
||||
DEFINE_bool(p, options::ONE_DASH, 'p', false,
|
||||
N_("Ignored for ARM compatibility"), NULL);
|
||||
|
||||
+ DEFINE_optional_string(package_metadata, options::TWO_DASHES, '\0', NULL,
|
||||
+ N_("Generate package metadata note"),
|
||||
+ N_("[=JSON]"));
|
||||
+
|
||||
DEFINE_bool(pie, options::ONE_DASH, '\0', false,
|
||||
N_("Create a position independent executable"),
|
||||
N_("Do not create a position independent executable"));
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue