From 0c90e04897b42cd1e518ec57122703c6b8e7e845 Mon Sep 17 00:00:00 2001 From: Louis Brunner Date: Thu, 3 Oct 2024 14:09:33 +0100 Subject: [PATCH] potential fix for macos15 arm64 compilation --- .github/macos-13-expected.txt | 136 ------------------------ coregrind/m_mach/dummy_dylddata.S | 5 + coregrind/m_mach/dyld_cache.c | 19 ++++ gdbserver_tests/mcsignopass.stdoutB.exp | 24 ++--- gdbserver_tests/mcsigpass.stdoutB.exp | 6 +- 5 files changed, 39 insertions(+), 151 deletions(-) diff --git a/.github/macos-13-expected.txt b/.github/macos-13-expected.txt index e06698e43..2b6899313 100644 --- a/.github/macos-13-expected.txt +++ b/.github/macos-13-expected.txt @@ -1,8 +1,5 @@ memcheck/tests/accounting (stderr) memcheck/tests/addressable (stderr) -memcheck/tests/amd64/bt_everything (stderr) -memcheck/tests/amd64/bug132146 (stderr) -memcheck/tests/amd64/bug279698 (stderr) memcheck/tests/amd64/bug492210_1 (stderr) memcheck/tests/amd64/bug492210_2 (stderr) memcheck/tests/amd64/fxsave-amd64 (stdout) @@ -11,14 +8,8 @@ memcheck/tests/amd64/insn-bsfl (stdout) memcheck/tests/amd64/insn-bsfl (stderr) memcheck/tests/amd64/insn-pmovmskb (stdout) memcheck/tests/amd64/insn-pmovmskb (stderr) -memcheck/tests/amd64/insn_basic (stderr) -memcheck/tests/amd64/insn_fpu (stderr) -memcheck/tests/amd64/insn_mmx (stderr) -memcheck/tests/amd64/insn_sse (stderr) -memcheck/tests/amd64/insn_sse2 (stderr) memcheck/tests/amd64/rh2257546_128 (stdout) memcheck/tests/amd64/rh2257546_128 (stderr) -memcheck/tests/amd64/rh2257546_256 (stderr) memcheck/tests/amd64/sh-mem-vec128-plo-no (stderr) memcheck/tests/amd64/sh-mem-vec128-plo-yes (stderr) memcheck/tests/amd64/sh-mem-vec256-plo-no (stderr) @@ -29,135 +20,62 @@ memcheck/tests/amd64/xor-undef-amd64 (stdout) memcheck/tests/amd64/xor-undef-amd64 (stderr) memcheck/tests/amd64/xsave-avx (stderr) memcheck/tests/atomic_incs (stderr) -memcheck/tests/badaddrvalue (stderr) memcheck/tests/badfree-2trace (stderr) -memcheck/tests/badfree (stderr) -memcheck/tests/badfree3 (stderr) -memcheck/tests/badjump (stderr) -memcheck/tests/badjump2 (stderr) -memcheck/tests/badloop (stderr) -memcheck/tests/badpoll (stderr) -memcheck/tests/badrw (stderr) memcheck/tests/big_blocks_freed_list (stderr) memcheck/tests/brk2 (stderr) -memcheck/tests/buflen_check (stderr) memcheck/tests/bug155125 (stderr) memcheck/tests/bug287260 (stderr) -memcheck/tests/bug340392 (stderr) -memcheck/tests/bug401284 (stderr) -memcheck/tests/bug464969_d_demangle (stderr) -memcheck/tests/bug472219 (stderr) -memcheck/tests/bug484002 (stderr) -memcheck/tests/calloc-overflow (stderr) memcheck/tests/client-msg-as-xml (stderr) -memcheck/tests/clientperm (stderr) memcheck/tests/clireq_nofill (stderr) -memcheck/tests/clo_redzone_128 (stderr) -memcheck/tests/clo_redzone_default (stderr) memcheck/tests/cond_ld (stderr) memcheck/tests/cond_st (stderr) -memcheck/tests/custom-overlap (stderr) memcheck/tests/custom_alloc (stderr) -memcheck/tests/cxx17_aligned_new (stderr) memcheck/tests/darwin/aio (stderr) memcheck/tests/darwin/bug437790 (stderr) -memcheck/tests/darwin/deep_badparam (stderr) memcheck/tests/darwin/env (stderr) -memcheck/tests/darwin/ioctl-tiocsbrk (stderr) -memcheck/tests/darwin/mkfifo (stderr) memcheck/tests/darwin/pth-supp (stderr) -memcheck/tests/darwin/pth-undocumented (stderr) memcheck/tests/darwin/scalar (stderr) -memcheck/tests/darwin/scalar_fork (stderr) memcheck/tests/darwin/scalar_nocancel (stderr) -memcheck/tests/darwin/scalar_vfork (stderr) -memcheck/tests/demangle-rust (stderr) -memcheck/tests/demangle (stderr) memcheck/tests/descr_belowsp (stderr) -memcheck/tests/describe-block (stderr) -memcheck/tests/doublefree (stderr) memcheck/tests/err_disable1 (stderr) memcheck/tests/err_disable2 (stderr) memcheck/tests/err_disable3 (stderr) memcheck/tests/err_disable4 (stderr) -memcheck/tests/err_disable_arange1 (stderr) -memcheck/tests/erringfds (stderr) -memcheck/tests/error_counts (stderr) memcheck/tests/errs1 (stderr) -memcheck/tests/execve1 (stderr) -memcheck/tests/execve2 (stderr) -memcheck/tests/exit_on_first_error (stderr) -memcheck/tests/exit_on_first_error_with_xml (stderr) -memcheck/tests/exitprog (stderr) memcheck/tests/file_locking (stderr) -memcheck/tests/fprw (stderr) -memcheck/tests/fwrite (stderr) memcheck/tests/gone_abrt_xml (stderr) -memcheck/tests/holey_buffer_too_small (stderr) memcheck/tests/inits (stderr) -memcheck/tests/inline (stderr) memcheck/tests/inlinfo (stderr) memcheck/tests/inlinfosupp (stderr) memcheck/tests/inlinfosuppobj (stderr) memcheck/tests/inltemplate (stderr) -memcheck/tests/leak-0 (stderr) memcheck/tests/leak-autofreepool-0 (stderr) memcheck/tests/leak-autofreepool-1 (stderr) memcheck/tests/leak-autofreepool-2 (stderr) memcheck/tests/leak-autofreepool-4 (stderr) -memcheck/tests/leak-autofreepool-5 (stderr) memcheck/tests/leak-autofreepool-6 (stderr) memcheck/tests/leak-cases-exit-on-definite (stderr) memcheck/tests/leak-cases-full (stderr) memcheck/tests/leak-cases-possible (stderr) -memcheck/tests/leak-cases-summary (stderr) memcheck/tests/leak-cycle (stderr) memcheck/tests/leak-delta (stderr) -memcheck/tests/leak-pool-0 (stderr) -memcheck/tests/leak-pool-1 (stderr) -memcheck/tests/leak-pool-2 (stderr) -memcheck/tests/leak-pool-3 (stderr) -memcheck/tests/leak-pool-4 (stderr) -memcheck/tests/leak-pool-5 (stderr) memcheck/tests/leak-tree (stderr) memcheck/tests/leak_cpp_interior (stderr) memcheck/tests/lks (stderr) -memcheck/tests/long-supps (stderr) memcheck/tests/long_namespace_xml (stderr) -memcheck/tests/mallinfo (stderr) -memcheck/tests/malloc1 (stderr) -memcheck/tests/malloc1_ks_alloc (stderr) -memcheck/tests/malloc1_ks_alloc_and_free (stderr) -memcheck/tests/malloc1_ks_free (stderr) -memcheck/tests/malloc1_ks_none (stderr) memcheck/tests/malloc2 (stderr) -memcheck/tests/malloc3 (stderr) -memcheck/tests/malloc_free_fill (stderr) -memcheck/tests/manuel1 (stderr) -memcheck/tests/manuel2 (stderr) memcheck/tests/manuel3 (stderr) -memcheck/tests/match-overrun (stderr) memcheck/tests/memalign_args (stderr) -memcheck/tests/memalign_test (stderr) memcheck/tests/memccpy1 (stderr) memcheck/tests/memccpy2 (stderr) memcheck/tests/memcmptest (stderr) memcheck/tests/memmem (stderr) memcheck/tests/mempool (stderr) memcheck/tests/mempool2 (stderr) -memcheck/tests/metadata (stderr) -memcheck/tests/mismatches (stderr) memcheck/tests/mismatches_xml (stderr) -memcheck/tests/mmaptest (stderr) memcheck/tests/nanoleak2 (stderr) memcheck/tests/nanoleak_dynsupp (stderr) memcheck/tests/nanoleak_supp (stderr) -memcheck/tests/new_aligned_delete_default (stderr) -memcheck/tests/new_delete_mismatch_size (stderr) -memcheck/tests/new_nothrow (stderr) -memcheck/tests/new_override (stderr) -memcheck/tests/noisy_child (stderr) -memcheck/tests/null_socket (stderr) memcheck/tests/origin1-yes (stderr) memcheck/tests/origin2-not-quite (stderr) memcheck/tests/origin3-no (stderr) @@ -165,57 +83,22 @@ memcheck/tests/origin4-many (stderr) memcheck/tests/origin5-bz2 (stderr) memcheck/tests/origin6-fp (stderr) memcheck/tests/overlap (stderr) -memcheck/tests/partial_load_dflt (stderr) -memcheck/tests/partial_load_ok (stderr) -memcheck/tests/partiallydefinedeq (stderr) -memcheck/tests/pdb-realloc (stderr) -memcheck/tests/pdb-realloc2 (stderr) -memcheck/tests/pipe (stderr) memcheck/tests/pointer-trace (stderr) memcheck/tests/posix_memalign (stderr) memcheck/tests/posix_memalign_supp (stderr) memcheck/tests/posix_memalign_xml (stderr) memcheck/tests/post-syscall (stderr) -memcheck/tests/realloc1 (stderr) -memcheck/tests/realloc2 (stderr) -memcheck/tests/realloc3 (stderr) -memcheck/tests/realloc_size_zero (stderr) memcheck/tests/realloc_size_zero_again_no (stderr) memcheck/tests/realloc_size_zero_again_yes (stderr) -memcheck/tests/realloc_size_zero_mismatch (stderr) -memcheck/tests/realloc_size_zero_no (stderr) -memcheck/tests/realloc_size_zero_off (stderr) -memcheck/tests/realloc_size_zero_supp (stderr) -memcheck/tests/realloc_size_zero_yes (stderr) memcheck/tests/recursive-merge (stderr) -memcheck/tests/resvn_stack (stderr) -memcheck/tests/sbfragment (stderr) memcheck/tests/sendmsg (stderr) -memcheck/tests/sh-mem-random (stderr) -memcheck/tests/sh-mem (stderr) -memcheck/tests/sigaltstack (stderr) -memcheck/tests/sigkill (stderr) -memcheck/tests/signal2 (stderr) -memcheck/tests/sigprocmask (stderr) -memcheck/tests/sized_aligned_new_delete_args (stderr) -memcheck/tests/sized_aligned_new_delete_misaligned1 (stderr) memcheck/tests/sized_aligned_new_delete_misaligned1_xml (stderr) -memcheck/tests/sized_aligned_new_delete_misaligned2 (stderr) memcheck/tests/sized_aligned_new_delete_misaligned2_xml (stderr) -memcheck/tests/sized_aligned_new_delete_misaligned3 (stderr) memcheck/tests/sized_aligned_new_delete_misaligned3_xml (stderr) -memcheck/tests/sized_delete (stderr) memcheck/tests/static_malloc (stderr) memcheck/tests/stpncpy (stderr) -memcheck/tests/str_tester (stderr) memcheck/tests/strchr (stderr) -memcheck/tests/supp_unknown (stderr) -memcheck/tests/suppfree (stderr) -memcheck/tests/suppfreecollision (stderr) memcheck/tests/supponlyobj (stderr) -memcheck/tests/suppsrc_lineno (stderr) -memcheck/tests/suppsrc_sanlineno (stderr) -memcheck/tests/suppvarinfo5 (stderr) memcheck/tests/test-plo-no (stderr) memcheck/tests/test-plo-yes (stderr) memcheck/tests/thread_alloca (stderr) @@ -223,38 +106,19 @@ memcheck/tests/threadname (stderr) memcheck/tests/threadname_xml (stderr) memcheck/tests/trivialleak (stderr) memcheck/tests/undef_malloc_args (stderr) -memcheck/tests/unit_libcbase (stderr) -memcheck/tests/unit_oset (stderr) memcheck/tests/varinfo1 (stderr) memcheck/tests/varinfo2 (stderr) memcheck/tests/varinfo3 (stderr) memcheck/tests/varinfo4 (stderr) memcheck/tests/varinfo5 (stderr) memcheck/tests/varinfo6 (stderr) -memcheck/tests/varinforestrict (stderr) memcheck/tests/vbit-test/vbit-test (stderr) -memcheck/tests/vcpu_bz2 (stderr) -memcheck/tests/vcpu_fbench (stderr) -memcheck/tests/vcpu_fnfns (stderr) memcheck/tests/wcpncpy (stderr) -memcheck/tests/wcs (stderr) -memcheck/tests/wcsncpy (stderr) -memcheck/tests/wmemcmp (stderr) -memcheck/tests/wrap1 (stderr) -memcheck/tests/wrap2 (stderr) -memcheck/tests/wrap3 (stderr) -memcheck/tests/wrap4 (stderr) memcheck/tests/wrap5 (stdout) -memcheck/tests/wrap5 (stderr) memcheck/tests/wrap6 (stdout) -memcheck/tests/wrap6 (stderr) -memcheck/tests/wrap7 (stderr) memcheck/tests/wrap8 (stdout) -memcheck/tests/wrap8 (stderr) memcheck/tests/wrapmalloc (stdout) -memcheck/tests/wrapmalloc (stderr) memcheck/tests/wrapmallocstatic (stdout) -memcheck/tests/wrapmallocstatic (stderr) memcheck/tests/writev1 (stderr) memcheck/tests/xml1 (stderr) cachegrind/tests/wrap5 (stdout) diff --git a/coregrind/m_mach/dummy_dylddata.S b/coregrind/m_mach/dummy_dylddata.S index ae49f8947..67297ae42 100644 --- a/coregrind/m_mach/dummy_dylddata.S +++ b/coregrind/m_mach/dummy_dylddata.S @@ -58,3 +58,8 @@ __DATA.__dyld4: .quad 0 ; (func pointer, used by dyld, non-null) ; void* (*tlv_get_addrAddr)(dyld3::MachOAnalyzer::TLV_Thunk*); .quad 0 ; (used by dyld, non-null) + +.text +.globl _dyld_stub_binder +_dyld_stub_binder: + ret diff --git a/coregrind/m_mach/dyld_cache.c b/coregrind/m_mach/dyld_cache.c index f78955b45..7564e0207 100644 --- a/coregrind/m_mach/dyld_cache.c +++ b/coregrind/m_mach/dyld_cache.c @@ -56,6 +56,7 @@ # define MACH_HEADER mach_header_64 # define MAGIC MH_MAGIC_64 +static void output_text_debug_info(const dyld_cache_image_text_info* textInfo); static void output_debug_info(const dyld_cache_header* dyld_cache); typedef struct { @@ -253,6 +254,7 @@ static struct MACH_HEADER* find_image_text(const dyld_cache_header* header, cons const char* imagePath = (const char*) calculate_relative(header, textInfo->pathOffset); if (VG_(strcmp)(imagePath, path) == 0) { + output_text_debug_info(textInfo); *len = textInfo->textSegmentSize; return (struct MACH_HEADER*) calculate_unslid(textInfo->loadAddress); } @@ -296,6 +298,23 @@ int VG_(dyld_cache_load_library)(const HChar* path) { return 1; } +static void output_text_debug_info(const dyld_cache_image_text_info* textInfo) { + const uint8_t* u = textInfo->uuid; + VG_(debugLog)(5, "dyld_cache", + "image_text_info{\n" + " .uuid: %02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x,\n" + " .loadAddress: %#llx,\n" + " .textSegmentSize: %u,\n" + " .pathOffset: %#x,\n" + "}\n", + u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7], u[8], + u[9], u[10], u[11], u[12], u[13], u[14], u[15], + textInfo->loadAddress, + textInfo->textSegmentSize, + textInfo->pathOffset + ); +} + static void output_debug_info(const dyld_cache_header* cache) { const uint8_t* u1 = cache->uuid; const uint8_t* u2 = cache->symbolFileUUID; diff --git a/gdbserver_tests/mcsignopass.stdoutB.exp b/gdbserver_tests/mcsignopass.stdoutB.exp index 7481e329a..e224d92cd 100644 --- a/gdbserver_tests/mcsignopass.stdoutB.exp +++ b/gdbserver_tests/mcsignopass.stdoutB.exp @@ -7,53 +7,53 @@ SIGFPE Yes Yes Yes Arithmetic exception Continuing. Program received signal SIGSEGV, Segmentation fault. test1 () at faultstatus.c:123 -121 *BADADDR = 'x'; +123 *BADADDR = 'x'; Continuing. Program received signal SIGSEGV, Segmentation fault. test1 () at faultstatus.c:123 -121 *BADADDR = 'x'; +123 *BADADDR = 'x'; Continuing. Program received signal SIGSEGV, Segmentation fault. test1 () at faultstatus.c:123 -121 *BADADDR = 'x'; +123 *BADADDR = 'x'; Continuing. Program received signal SIGSEGV, Segmentation fault. test1 () at faultstatus.c:123 -121 *BADADDR = 'x'; +123 *BADADDR = 'x'; Continuing. Program received signal SIGSEGV, Segmentation fault. test1 () at faultstatus.c:123 -121 *BADADDR = 'x'; +123 *BADADDR = 'x'; Continuing. Program received signal SIGSEGV, Segmentation fault. test1 () at faultstatus.c:123 -121 *BADADDR = 'x'; +123 *BADADDR = 'x'; Continuing. Program received signal SIGSEGV, Segmentation fault. test1 () at faultstatus.c:123 -121 *BADADDR = 'x'; +123 *BADADDR = 'x'; Continuing. Program received signal SIGSEGV, Segmentation fault. test1 () at faultstatus.c:123 -121 *BADADDR = 'x'; +123 *BADADDR = 'x'; Continuing. Program received signal SIGSEGV, Segmentation fault. test1 () at faultstatus.c:123 -121 *BADADDR = 'x'; +123 *BADADDR = 'x'; Continuing. Program received signal SIGSEGV, Segmentation fault. test1 () at faultstatus.c:123 -121 *BADADDR = 'x'; +123 *BADADDR = 'x'; Continuing. Program received signal SIGSEGV, Segmentation fault. test1 () at faultstatus.c:123 -121 *BADADDR = 'x'; +123 *BADADDR = 'x'; Signal Stop Print Pass to program Description SIGSEGV No Yes Yes Segmentation fault Continuing. Program received signal SIGSEGV, Segmentation fault. Program received signal SIGBUS, Bus error. test3 () at faultstatus.c:133 -131 mapping[FILESIZE+10]; +133 mapping[FILESIZE+10]; Continuing. Program received signal SIGFPE, Arithmetic exception. diff --git a/gdbserver_tests/mcsigpass.stdoutB.exp b/gdbserver_tests/mcsigpass.stdoutB.exp index 27739d62b..b496a4a05 100644 --- a/gdbserver_tests/mcsigpass.stdoutB.exp +++ b/gdbserver_tests/mcsigpass.stdoutB.exp @@ -1,14 +1,14 @@ Continuing. Program received signal SIGSEGV, Segmentation fault. test1 () at faultstatus.c:123 -121 *BADADDR = 'x'; +123 *BADADDR = 'x'; Continuing. Program received signal SIGSEGV, Segmentation fault. test2 () at faultstatus.c:128 -126 mapping[0] = 'x'; +128 mapping[0] = 'x'; Continuing. Program received signal SIGBUS, Bus error. test3 () at faultstatus.c:133 -131 mapping[FILESIZE+10]; +133 mapping[FILESIZE+10]; Continuing. Program received signal SIGFPE, Arithmetic exception.