gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

macOS 13 arm63 with Rosetta


From: Kirill A. Korinsky
Subject: macOS 13 arm63 with Rosetta
Date: Mon, 25 Dec 2023 00:04:19 +0100

After this patch over the local root 1bb1897c367d6cd116de244c264fb6d1a40dbb0d I was able to move a bit forward on macOS 13 arm63 which is cross compiling to x86_64 via -arch x86_64 and --host/--build/--target option. Now it fails as:

(lldb) r
Process 36079 launched: '/Users/catap/src/gcl/gcl/unixport/saved_pre_gcl' (x86_64)
warning: libobjc.A.dylib is being read from process memory. This indicates that LLDB could not read from the host's in-memory shared cache. This will likely reduce debugging performance.

Process 36079 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1f5c6c000)
    frame #0: 0x0000000c06aeeedd dyld`dyld3::MachOFile::trieWalk(Diagnostics&, unsigned char const*, unsigned char const*, char const*) + 185
dyld`dyld3::MachOFile::trieWalk:
->  0xc06aeeedd <+185>: movzbl (%r13), %ebx
    0xc06aeeee2 <+190>: testb  %bl, %bl
    0xc06aeeee4 <+192>: jns    0xc06aeef1b               ; <+247>
    0xc06aeeee6 <+194>: movq   %r13, -0x248(%rbp)
Target 0: (saved_pre_gcl) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1f5c6c000)
  * frame #0: 0x0000000c06aeeedd dyld`dyld3::MachOFile::trieWalk(Diagnostics&, unsigned char const*, unsigned char const*, char const*) + 185
    frame #1: 0x0000000c06ab9672 dyld`dyld4::Loader::hasExportedSymbol(Diagnostics&, dyld4::RuntimeState&, char const*, dyld4::Loader::ExportedSymbolMode, dyld4::Loader::ResolvedSymbol*, dyld3::Array<dyld4::Loader const*>*) const + 312
    frame #2: 0x0000000c06ab950f dyld`invocation function for block in dyld4::Loader::resolveSymbol(Diagnostics&, dyld4::RuntimeState&, int, char const*, bool, bool, void (unsigned int, unsigned int, dyld4::Loader::ResolvedSymbol const&) block_pointer, bool) const + 123
    frame #3: 0x0000000c06aa96d9 dyld`dyld4::RuntimeState::withLoadersReadLock(void () block_pointer) + 41
    frame #4: 0x0000000c06ab9106 dyld`dyld4::Loader::resolveSymbol(Diagnostics&, dyld4::RuntimeState&, int, char const*, bool, bool, void (unsigned int, unsigned int, dyld4::Loader::ResolvedSymbol const&) block_pointer, bool) const + 730
    frame #5: 0x0000000c06abdfd9 dyld`invocation function for block in dyld4::JustInTimeLoader::forEachBindTarget(Diagnostics&, dyld4::RuntimeState&, void (unsigned int, unsigned int, dyld4::Loader::ResolvedSymbol const&) block_pointer, bool, void (dyld4::Loader::ResolvedSymbol const&, bool&) block_pointer, void (dyld4::Loader::ResolvedSymbol const&, bool&) block_pointer) const + 89
    frame #6: 0x0000000c06af48c1 dyld`invocation function for block in mach_o::Fixups::forEachBindTarget_Opcodes(Diagnostics&, bool, void (mach_o::Fixups::BindTargetInfo const&, bool&) block_pointer, void (mach_o::Fixups::BindTargetInfo const&, bool&) block_pointer) const + 41
    frame #7: 0x0000000c06af3dd3 dyld`mach_o::Fixups::forEachBind_OpcodesRegular(Diagnostics&, void (char const*, bool, bool, unsigned int, int, unsigned int, unsigned int, unsigned long long, unsigned char, char const*, bool, bool, unsigned long long, bool, bool&) block_pointer) const + 651
    frame #8: 0x0000000c06af38f1 dyld`mach_o::Fixups::forEachBindUnified_Opcodes(Diagnostics&, bool, void (unsigned long long, unsigned int, mach_o::Fixups::BindTargetInfo const&, bool&) block_pointer, void (unsigned long long, unsigned int, mach_o::Fixups::BindTargetInfo const&, bool&) block_pointer) const + 193
    frame #9: 0x0000000c06af3312 dyld`mach_o::Fixups::forEachBindTarget_Opcodes(Diagnostics&, bool, void (mach_o::Fixups::BindTargetInfo const&, bool&) block_pointer, void (mach_o::Fixups::BindTargetInfo const&, bool&) block_pointer) const + 184
    frame #10: 0x0000000c06abdf54 dyld`invocation function for block in dyld4::JustInTimeLoader::forEachBindTarget(Diagnostics&, dyld4::RuntimeState&, void (unsigned int, unsigned int, dyld4::Loader::ResolvedSymbol const&) block_pointer, bool, void (dyld4::Loader::ResolvedSymbol const&, bool&) block_pointer, void (dyld4::Loader::ResolvedSymbol const&, bool&) block_pointer) const + 267
    frame #11: 0x0000000c06af6428 dyld`dyld3::MachOAnalyzer::withVMLayout(Diagnostics&, void (mach_o::Layout const&) block_pointer) const + 830
    frame #12: 0x0000000c06abd203 dyld`dyld4::JustInTimeLoader::applyFixups(Diagnostics&, dyld4::RuntimeState&, dyld4::DyldCacheDataConstLazyScopedWriter&, bool) const + 503
    frame #13: 0x0000000c06ada59d dyld`dyld4::APIs::dlopen_from(char const*, int, void*)::$_1::operator()() const + 873
    frame #14: 0x0000000c06ad5370 dyld`dyld4::APIs::dlopen_from(char const*, int, void*) + 810
    frame #15: 0x000000010000c69c saved_pre_gcl`init_boot at main.c:433:11
    frame #16: 0x000000010000cda2 saved_pre_gcl`main(argc=1, argv=0x0000000d0ab9b8b8, envp=0x0000000d0ab9b8c8) at main.c:640:21
    frame #17: 0x0000000c06aa241f dyld`start + 1903
(lldb) up 15
frame #15: 0x000000010000c69c saved_pre_gcl`init_boot at main.c:433:11
   430    sSAoptimize_maximum_pagesA->s.s_dbind=Cnil;
   431    z=alloca(n);
   432    snprintf(z,n,"%-*.*s%s",(int)m,(int)m,d,s);
-> 433    if (!(v=dlopen(z,RTLD_LAZY|RTLD_GLOBAL)))
   434      printf("%s\n",dlerror());
   435    if (!(q=dlsym(v,"gcl_init_boot")))
   436      printf("%s\n",dlerror());
(lldb) p z
(char *) 0x0000000d0ab9b4c0 "/Users/catap/src/gcl/gcl/unixport/libboot.so"
(lldb) 

Interesting fact: raw_pre_gcl loads it without any issue.

-- 
wbr, Kirill

On 24. Dec 2023, at 23:52, Kirill A. Korinsky <kirill@korins.ky> wrote:

Hello,

On 24. Dec 2023, at 15:17, Camm Maguire <camm@maguirefamily.org> wrote:

"Kirill A. Korinsky" <kirill@korins.ky> writes:

This build was made with local root

It contains patches in addition to posix_spawn which allows to build it on macOS 13 arm64 under rosetta:

--- unixport/makefile
+++ unixport/makefile
@@ -68,7 +68,7 @@ $(LSPDIR)/auto_new.lsp: $(LSPDIR)/auto.lsp
echo "(AUTOLOAD 'init-readline '|readline|)" >>$@

libboot.so: ../o/boot.o
- $(CC) -shared -Wl,-undefined -Wl,dynamic_lookup $< -o $@
+ $(CC) $(CFLAGS) -shared -Wl,-undefined -Wl,dynamic_lookup $< -o $@

init_raw.lsp: init_raw.lsp.in

@@ -84,7 +84,7 @@ boot.h: boot.ini
rm $*.c

$(DPP): ../bin/dpp.c
- ${CC} ${DEFS} -o $@ $<
+ ${CC} ${CFLAGS} ${DEFS} -o $@ $<

new_init.c: ${INI_FILES}
echo '#include "make-init.h"' > $@

Can you consider to add it to the upstream?


This is going in for you shortly.

And I've discovered one more missed place:

diff --git a/gcl/makefile b/gcl/makefile
index 79301325a..a3c8cc12b 100644
--- a/gcl/makefile
+++ b/gcl/makefile
@@ -391,7 +391,7 @@ $(HDIR)new_decl.h:
 
 $(HDIR)mcompdefs.h: $(HDIR)compdefs.h $(HDIR)new_decl.h
        $(AWK) 'BEGIN {print "#include \"include.h\"";print "#include \"page.h\"";print "---"} {a=$$1;gsub("\\.\\.\\.","",a);print "\"#define " $$1 "\" " a}' $< |\
-       $(CC) -E -P -I./$(HDIR) - |\
+       $(CC) $(CFLAGS) -E -P -I./$(HDIR) - |\
        $(AWK) '/^\-\-\-$$/ {i=1;next} {if (!i) next} {gsub("\"","");print}' >$@
 
 $(HDIR)cmpinclude.h: $(HDIR)mcompdefs.h $(CMPINCLUDE_FILES) $(HDIR)config.h $(HDIR)cmponly_last.h

-- 
wbr, Kirill



Attachment: signature.asc
Description: Message signed with OpenPGP


reply via email to

[Prev in Thread] Current Thread [Next in Thread]