Commit Graph

368 Commits

Author SHA1 Message Date
GCC Administrator
c232f92161 Daily bump. 2024-10-26 00:19:39 +00:00
Ian Lance Taylor
bab7a64c1a libbacktrace: recognize new Mach-O DWARF sections
Patch from Pavel Safonov.

These sections are used on macOS Sequoia.

Fixes https://github.com/ianlancetaylor/libbacktrace/issues/136

	* macho.c (dwarf_section_names): Add __debug_addr and
	__debug_line_str.
2024-10-25 15:20:55 -07:00
GCC Administrator
de14559ef5 Daily bump. 2024-10-19 00:19:43 +00:00
Ian Lance Taylor
f8687bceaa libbacktrace: don't get confused by overlapping address ranges
Fixes https://github.com/ianlancetaylor/libbacktrace/issues/137.

	* dwarf.c (resolve_unit_addrs_overlap_walk): New static function.
	(resolve_unit_addrs_overlap): New static function.
	(build_dwarf_data): Call resolve_unit_addrs_overlap.
2024-10-18 13:04:11 -07:00
GCC Administrator
8ac4db24e4 Daily bump. 2024-08-06 00:17:19 +00:00
Ian Lance Taylor
3a51aaf5f4 libbacktrace: avoid -Wpointer-arith errors
Based on patch from Kirill Müller.

	* configure.ac (ACX_PROG_CC_WARNING_OPTS): Add -Wpointer-arith.
	* pecoff.c (coff_add): Cast void pointers.
	* xcoff.c (xcoff_add): Likewise.
	* configure: Regenerate.
2024-08-05 16:46:03 -07:00
GCC Administrator
e7f6a5dc4a Daily bump. 2024-07-31 00:19:44 +00:00
Ian Lance Taylor
37aa98f79a libbacktrace: fix syntax of Windows registration functions
Adjust the syntax to keep MSVC happy.

Fixes https://github.com/ianlancetaylor/libbacktrace/issues/131

	* pecoff.c (LDR_DLL_NOTIFICATION): Put function modifier
	inside parentheses.
	(LDR_REGISTER_FUNCTION): Likewise.
2024-07-30 09:27:59 -07:00
GCC Administrator
e20ea6bcf8 Daily bump. 2024-07-19 00:18:20 +00:00
Ian Lance Taylor
248e8530dd libbacktrace: use __has_attribute for fallthrough
Also convert some FALLTHROUGH comments to ATTRIBUTE_FALLTHROUGH.

	* internal.h: Use __has_attribute to check for fallthrough
	attribute.
	* elf.c (elf_zstd_decompress): Use ATTRIBUTE_FALLTHROUGH rather
	than a FALLTHROUGH comment.
2024-07-18 11:35:44 -07:00
Ian Lance Taylor
93c54caa64 libbacktrace: add cast to avoid warning
* print.c (print_syminfo_callback): Add cast to avoid warning.
2024-07-17 17:59:41 -07:00
Ian Lance Taylor
30875fa698 libbacktrace: better backtrace_print when no debug info
Fixes https://github.com/ianlancetaylor/libbacktrace/issues/59

	* print.c (print_syminfo_callback): New static function.
	(print_callback): Call backtrace_syminfo if there is no function
	or file name.
2024-07-17 17:39:27 -07:00
GCC Administrator
a922de0a7a Daily bump. 2024-07-18 00:18:58 +00:00
Ian Lance Taylor
a8b5ce1580 libbacktrace: add notes about dl_iterate_phdr to README
* README: Add notes about dl_iterate_phdr.
2024-07-17 17:03:30 -07:00
Ian Lance Taylor
f438299ef6 libbacktrace: update xcoff.c for base_address changes
* xcoff.c (struct xcoff_fileline_data): Change base_address field
	to struct libbacktrace_base_address.
	(xcoff_initialize_syminfo): Change base_address to struct
	libbacktrace_base_address.  Use libbacktrace_add_base.
	(xcoff_initialize_fileline): Likewise.
	(xcoff_lookup_pc): Use libbacktrace_add_base.
	(xcoff_add): Change base_address to struct
	libbacktrace_base_address.
	(xcoff_armem_add, xcoff_add_shared_libs): Likewise.
	(backtrace_initialize): Likewise.
	* Makefile.am (xcoff.lo): Remove unused target.
	(xcoff_32.lo, xcoff_64.lo): New targets.
	* Makefile.in: Regenerate.
2024-07-16 21:27:05 -07:00
GCC Administrator
72bce1fbef Daily bump. 2024-07-17 00:18:32 +00:00
Ian Lance Taylor
c6803cdaba libbacktrace: support FDPIC
Based on patch by Max Filippov.

	* internal.h: If FDPIC, #include <link.h> and/or <sys/link.h>.
	(libbacktrace_using_fdpic): Define.
	(struct libbacktrace_base_address): Define.
	(libbacktrace_add_base): Define.
	(backtrace_dwarf_add): Change base_address to struct
	libbacktrace_base_address.
	* dwarf.c (struct dwarf_data): Change base_address to struct
	libbacktrace_base_address.
	(add_ranges, find_address_ranges, build_ddress_map): Likewise.
	(build_dwarf_data, build_dwarf_add): Likewise.
	(add_low_high_range): Change base_address to struct
	libbacktrace_base_address.  Use libbacktrace_add_base.
	(add_ranges_from_ranges, add_ranges_from_rnglists): Likewise.
	(add_line): Use libbacktrace_add_base.
	* elf.c (elf_initialize_syminfo): Change base_address to struct
	libbacktrace_base_address.  Use libbacktrace_add_base.
	(elf_add): Change base_address to struct
	libbacktrace_base_address.
	(phdr_callback): Likewise.  Initialize base_address.m.
	(backtrace_initialize): If using FDPIC, don't call elf_add with
	main executable; always use dl_iterate_phdr.
	* macho.c (macho_add_symtab): Change base_address to struct
	libbacktrace_base_address.  Use libbacktrace_add_base.
	(macho_syminfo): Change base_address to struct
	libbacktrace_base_address.
	(macho_add_fat, macho_add_dsym, macho_add): Likewise.
	(backtrace_initialize): Likewise.  Initialize base_address.m.
	* pecoff.c (coff_initialize_syminfo): Change base_address to
	struct libbacktrace_base_address.  Use libbacktrace_add_base.
	(coff_add): Change base_address to struct
	libbacktrace_base_address.  Initialize base_address.m.
2024-07-15 17:28:28 -07:00
GCC Administrator
2ee5b58be6 Daily bump. 2024-07-13 00:17:42 +00:00
Ian Lance Taylor
bf406a5369 libbacktrace: avoid infinite recursion
We could get an infinite recursion in an odd case in which a
.gnu_debugdata section was added to a debug file, and mini_debuginfo
was put into the debug file, and the debug file was put into a
/usr/lib/debug directory to be found by build ID.  This combination
doesn't really make sense but we shouldn't get an infinite recursion.

	* elf.c (elf_add): Don't use .gnu_debugdata if we are already
	reading a debuginfo file.
	* Makefile.am (m2test_*): New test targets.
	(CHECK_PROGRAMS): Add m2test.
	(MAKETESTS): Add m2test_minidebug2.
	(%_minidebug2): New pattern.
	(CLEANFILES): Remove minidebug2 files.
	* Makefile.in: Regenerate.
2024-07-11 19:34:45 -07:00
Ian Lance Taylor
d7318f4cf8 libbacktrace: don't fail if symbol size is unknown
* btest.c (test5): Don't fail if symbol size is 0.
	* mtest.c (test5): Likewise.
2024-07-11 17:58:17 -07:00
Ian Lance Taylor
b870086904 libbacktrace: correctly gather Mach-O symbol table
For PR libbacktrace/97082.
	* macho.c (MACH_O_N_EXT): Don't define.
	(MACH_O_N_UNDF): Define.
	(macho_defined_symbol): Don't discard N_EXT symbols.  Do
	discard N_UNDF symbols.
2024-07-11 17:54:43 -07:00
GCC Administrator
88ff0504ab Daily bump. 2024-07-12 00:17:52 +00:00
Ian Lance Taylor
8f7c06df42 libbacktrace: fix testsuite for clang
* btest.c (test1, test3): Add optnone attribute.
	* edtest.c (test1): Likewise.
	* mtest.c (test1, test3): Likewise.
	* configure.ac: Use -Wno-attributes and -Wno-unknown-attributes.
	* configure: Regenerate.
2024-07-11 16:12:47 -07:00
Ian Lance Taylor
b96789abf8 libbacktrace: suggest how to fix missing debug info
* elf.c (elf_nodebug): Suggest -g.
	* macho.c (macho_nodebug): Suggest -g and dsymutil.
	* pecoff.c (coff_nodebug): Suggest -g.
2024-07-11 15:39:07 -07:00
Ian Lance Taylor
02f7525e5e libbacktrace: remove trailing whitespace
* dwarf.c: Remove trailing whitespace.
	* macho.c: Likewise.
2024-07-11 15:29:24 -07:00
GCC Administrator
6c08b82965 Daily bump. 2024-06-17 00:16:32 +00:00
Ian Lance Taylor
8348f8c22f libbacktrace: it's OK if zstd decompressor sees no backward bits
* elf.c (elf_fetch_bits_backward) Don't fail if no bits are
	available.
2024-06-16 15:44:36 -07:00
GCC Administrator
3e3d115c94 Daily bump. 2024-05-04 00:16:30 +00:00
Ian Lance Taylor
b69dac54ef libbacktrace: add DLLS as they are loaded
Patch from Björn Schäpers.

	* pecoff.c (struct dll_notification_data): Define.
	(LDR_DLL_NOTIFICATION): New typedef.
	(LDR_REGISTER_FUNCTION): New typedef.
	(struct dll_notification_context): Define.
	(dll_notification): New static function.
	(backtrace_initialize): Register DLL notification.
2024-05-03 15:25:00 -07:00
GCC Administrator
deb69bfbb0 Daily bump. 2024-04-29 00:17:54 +00:00
Ian Lance Taylor
942a9cf2a9 libbacktrace: load Windows modules
Patch from Björn Schäpers <bjoern@hazardy.de>.

	* configure.ac: Checked for tlhelp32.h
	* pecoff.c: Include <tlhelp32.h> if available.
	(backtrace_initialize): Use tlhelp32 api for a snapshot to
	detect loaded modules.
	(coff_add): New argument for the module handle of the file,
	to get the base address.
	* configure, config.h.in: Regenerate.
2024-04-28 11:14:17 -07:00
GCC Administrator
3091f1dfa7 Daily bump. 2024-04-24 00:16:29 +00:00
Ian Lance Taylor
d2f05fed44 libbacktrace: test --compress-debug-sections=ARG for each ARG
This should fix a testsuite problem with Solaris ld that supports zlib
but not zlib-gabi.

	* configure.ac: Test --compress-debug-sections=zlib-gnu and
	--compress-debug-sections=zlib-gabi separately, setting new
	automake conditionals.
	* Makefile.am (ctestg, ctestg_alloc): Only build if
	HAVE_COMPRESSED_DEBUG_ZLIB_GNU.
	(ctesta, ctesta_alloc): Only build if
	HAVE_COMPRESSED_DEBUG_ZLIB_GABI.
	(ctestzstd_alloc): New test if HAVE_COMPRESSED_DEBUG_ZSTD.
	* configure, Makefile.in: Regenerate.
2024-04-23 10:04:16 -07:00
GCC Administrator
c775a030af Daily bump. 2024-03-09 00:17:14 +00:00
Ian Lance Taylor
5825bd0e0d libbacktrace: don't assume compressed section is aligned
Patch originally by GitHub user ubyte at
https://github.com/ianlancetaylor/libbacktrace/pull/120.

	* elf.c (elf_uncompress_chdr): Don't assume compressed section is
	aligned.
2024-03-08 13:56:33 -08:00
GCC Administrator
ef1b788584 Daily bump. 2024-03-03 00:17:08 +00:00
Ian Lance Taylor
9b0d218544 libbacktrace: pass -no-install when linking test programs
* Makefile.am (libbacktrace_testing_ldflags): Define.
	(*_LDFLAGS): Add $(libbacktrace_testing_ldflags) for test
	programs.
	* Makefile.in: Regenerate
2024-03-02 13:11:07 -08:00
Ian Lance Taylor
c4f82ec6b4 libbacktrace: skip all LZMA block header padding bytes
Fixes https://github.com/ianlancetaylor/libbacktrace/issues/118

	* elf.c (elf_uncompress_lzma_block): Skip all header padding bytes
	and verify that they are zero.
2024-03-02 12:17:18 -08:00
Ian Lance Taylor
282455d313 libbacktrace: use real .opd for debuginfo on ppc64 v1 ABI
PR libbacktrace/114201
	* elf.c (elf_add): Add caller_opd parameter.  Change all callers.
	Release opd data after all recursive calls.
2024-03-01 18:53:16 -08:00
GCC Administrator
306a4c3223 Daily bump. 2024-03-02 00:17:11 +00:00
Ian Lance Taylor
c6d4fb0062 libbacktrace: read symbol table of debuginfo file
These become another symbol table to search.  This is needed if people
use --strip-all rather than --strip-debug when adding a debuglink
section.

Patch is from GitHub user pickard1.

Fixes https://github.com/ianlancetaylor/libbacktrace/issues/113.

	* elf.c (elf_add): Add the symbol table from a debuginfo file.
	* Makefile.am (MAKETESTS): Add buildidfull and gnudebuglinkfull
	variants of buildid and gnudebuglink tests.
	(%_gnudebuglinkfull, %_buildidfull): New patterns.
	* Makefile.in: Regenerate.
2024-02-29 19:45:57 -08:00
Jakub Jelinek
1ccad1f136 Update copyright years. 2024-01-05 08:54:28 +01:00
Jakub Jelinek
a945c346f5 Update copyright years. 2024-01-03 12:19:35 +01:00
Jakub Jelinek
6a720d41ff Update Copyright year in ChangeLog files
2023 -> 2024
2024-01-03 11:35:18 +01:00
GCC Administrator
8428bcd703 Daily bump. 2023-12-01 00:17:36 +00:00
Ian Lance Taylor
c6f7253bcc libbacktrace: support ASLR on Windows
Patch from Björn Schäpers.

	* pecoff.c: Include <windows.h> if available.
	(coff_add): On Windows call GetModuleHandle to get base address.
2023-11-30 11:24:57 -08:00
GCC Administrator
31d8cf17ca Daily bump. 2023-11-30 00:17:38 +00:00
Ian Lance Taylor
8b2e510ca3 libbacktrace: call GetModuleFileNameA on Windows
Patch from Björn Schäpers.

	* fileline.c: Include <windows.h> if available.
	(windows_get_executable_path): New static function.
	(fileline_initialize): Call windows_get_executable_path.
	* configure.ac: Checked for windows.h
	* configure: Regenerate.
	* config.h.in: Regenerate.
2023-11-29 14:04:36 -08:00
GCC Administrator
3b6327461d Daily bump. 2023-10-23 00:16:43 +00:00
Iain Sandoe
6a6d3817af Config,Darwin: Allow for configuring Darwin to use embedded runpath.
Recent Darwin versions place contraints on the use of run paths
specified in environment variables.  This breaks some assumptions
in the GCC build.

This change allows the user to configure a Darwin build to use
'@rpath/libraryname.dylib' in library names and then to add an
embedded runpath to executables (and libraries with dependents).

The embedded runpath is added by default unless the user adds
'-nodefaultrpaths' to the link line.

For an installed compiler, it means that any executable built with
that compiler will reference the runtimes installed with the
compiler (equivalent to hard-coding the library path into the name
of the library).

During build-time configurations  any "-B" entries will be added to
the runpath thus the newly-built libraries will be found by exes.

Since the install name is set in libtool, that decision needs to be
available here (but might also cause dependent ones in Makefiles,
so we need to export a conditional).

This facility is not available for Darwin 8 or earlier, however the
existing environment variable runpath does work there.

We default this on for systems where the external DYLD_LIBRARY_PATH
does not work and off for Darwin 8 or earlier.  For systems that can
use either method, if the value is unset, we use the default (which
is currently DYLD_LIBRARY_PATH).

ChangeLog:

	* configure: Regenerate.
	* configure.ac: Do not add default runpaths to GCC exes
	when we are building -static-libstdc++/-static-libgcc (the
	default).
	* libtool.m4: Add 'enable-darwin-at-runpath'.  Act  on the
	enable flag to alter Darwin libraries to use @rpath names.

gcc/ChangeLog:

	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.
	* config/darwin.h: Handle Darwin rpaths.
	* config/darwin.opt: Handle Darwin rpaths.
	* Makefile.in:  Handle Darwin rpaths.

gcc/ada/ChangeLog:

	* gcc-interface/Makefile.in: Handle Darwin rpaths.

gcc/jit/ChangeLog:
	* Make-lang.in: Handle Darwin rpaths.

libatomic/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

libbacktrace/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

libcc1/ChangeLog:

	* configure: Regenerate.

libffi/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

libgcc/ChangeLog:

	* config/t-slibgcc-darwin: Generate libgcc_s
	with an @rpath name.
	* config.host: Handle Darwin rpaths.

libgfortran/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths

libgm2/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.
	* libm2cor/Makefile.am: Handle Darwin rpaths.
	* libm2cor/Makefile.in: Regenerate.
	* libm2iso/Makefile.am: Handle Darwin rpaths.
	* libm2iso/Makefile.in: Regenerate.
	* libm2log/Makefile.am: Handle Darwin rpaths.
	* libm2log/Makefile.in: Regenerate.
	* libm2min/Makefile.am: Handle Darwin rpaths.
	* libm2min/Makefile.in: Regenerate.
	* libm2pim/Makefile.am: Handle Darwin rpaths.
	* libm2pim/Makefile.in: Regenerate.

libgomp/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths

libitm/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

libobjc/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

libphobos/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.
	* libdruntime/Makefile.am: Handle Darwin rpaths.
	* libdruntime/Makefile.in: Regenerate.
	* src/Makefile.am: Handle Darwin rpaths.
	* src/Makefile.in: Regenerate.

libquadmath/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

libsanitizer/ChangeLog:

	* asan/Makefile.am: Handle Darwin rpaths.
	* asan/Makefile.in: Regenerate.
	* configure: Regenerate.
	* hwasan/Makefile.am: Handle Darwin rpaths.
	* hwasan/Makefile.in: Regenerate.
	* lsan/Makefile.am: Handle Darwin rpaths.
	* lsan/Makefile.in: Regenerate.
	* tsan/Makefile.am: Handle Darwin rpaths.
	* tsan/Makefile.in: Regenerate.
	* ubsan/Makefile.am: Handle Darwin rpaths.
	* ubsan/Makefile.in: Regenerate.

libssp/ChangeLog:

	* Makefile.am: Handle Darwin rpaths.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

libstdc++-v3/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.
	* src/Makefile.am: Handle Darwin rpaths.
	* src/Makefile.in: Regenerate.

libvtv/ChangeLog:

	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

lto-plugin/ChangeLog:
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.

zlib/ChangeLog:
	* configure: Regenerate.
	* configure.ac: Handle Darwin rpaths.
2023-10-22 19:30:02 +01:00