From 40a68167e73e794739a96981742258e9cbd822be Mon Sep 17 00:00:00 2001 From: Kien Nguyen Date: Wed, 3 Dec 2025 20:57:09 -0800 Subject: [PATCH 1/3] Unbreak the MS-Windows build broken by last changes * src/comp.c (gcc_jit_context_zero) [WINDOWSNT]: Define and define the prototype of its function pointer. (init_gccjit_functions) [WINDOWSNT]: Load 'gcc_jit_context_zero from the DLL. --- src/comp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/comp.c b/src/comp.c index bc8e30c479e..bff101a1ac9 100644 --- a/src/comp.c +++ b/src/comp.c @@ -95,6 +95,7 @@ along with GNU Emacs. If not, see . */ #undef gcc_jit_context_set_int_option #undef gcc_jit_context_set_logfile #undef gcc_jit_context_set_str_option +#undef gcc_jit_context_zero #undef gcc_jit_function_get_param #undef gcc_jit_function_new_block #undef gcc_jit_function_new_local @@ -271,6 +272,8 @@ DEF_DLL_FN (void, gcc_jit_context_set_logfile, DEF_DLL_FN (void, gcc_jit_context_set_str_option, (gcc_jit_context *ctxt, enum gcc_jit_str_option opt, const char *value)); +DEF_DLL_FN (gcc_jit_rvalue *, gcc_jit_context_zero, + (gcc_jit_context *ctxt, gcc_jit_type *numeric_type)); DEF_DLL_FN (void, gcc_jit_struct_set_fields, (gcc_jit_struct *struct_type, gcc_jit_location *loc, int num_fields, gcc_jit_field **fields)); @@ -334,6 +337,7 @@ init_gccjit_functions (void) LOAD_DLL_FN (library, gcc_jit_context_set_int_option); LOAD_DLL_FN (library, gcc_jit_context_set_logfile); LOAD_DLL_FN (library, gcc_jit_context_set_str_option); + LOAD_DLL_FN (library, gcc_jit_context_zero); LOAD_DLL_FN (library, gcc_jit_function_get_param); LOAD_DLL_FN (library, gcc_jit_function_new_block); LOAD_DLL_FN (library, gcc_jit_function_new_local); @@ -415,6 +419,7 @@ init_gccjit_functions (void) #define gcc_jit_context_set_int_option fn_gcc_jit_context_set_int_option #define gcc_jit_context_set_logfile fn_gcc_jit_context_set_logfile #define gcc_jit_context_set_str_option fn_gcc_jit_context_set_str_option +#define gcc_jit_context_zero fn_gcc_jit_context_zero #define gcc_jit_function_get_param fn_gcc_jit_function_get_param #define gcc_jit_function_new_block fn_gcc_jit_function_new_block #define gcc_jit_function_new_local fn_gcc_jit_function_new_local From 5b56436f358901cfb4dad730fca4c4308643a023 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 4 Dec 2025 13:56:20 +0200 Subject: [PATCH 2/3] ; Fix comments and whitespace of a recent changeset * src/pdumper.c (dump_do_dump_relocation): * src/comp.h: * src/comp.c (obj_to_reloc, emit_static_object) (declare_imported_data_relocs, check_abi_version, setup_constants) (load_comp_unit): Fix comments and whitespace. --- src/comp.c | 26 +++++++++++++------------- src/comp.h | 8 ++++---- src/pdumper.c | 6 +++--- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/comp.c b/src/comp.c index bff101a1ac9..e425dee1bfc 100644 --- a/src/comp.c +++ b/src/comp.c @@ -957,11 +957,11 @@ obj_to_reloc (Lisp_Object obj) comp.ptrdiff_type, XFIXNUM (idx)); +#ifdef USE_POINTER_TO_CONSTANTS /* If we are using pointers to constant vectors instead of copying to vectors in the data segment, construct an indirect access. Note that there is no decay of arrays to pointers or similar in - libgccjit. */ -#ifdef USE_POINTER_TO_CONSTANTS + libgccjit. */ gcc_jit_rvalue *zero = gcc_jit_context_zero (comp.ctxt, comp.ptrdiff_type); gcc_jit_lvalue *constants = gcc_jit_context_new_array_access (comp.ctxt, NULL, reloc.array.r_val, zero); @@ -2718,8 +2718,9 @@ emit_static_object (const char *name, Lisp_Object obj) const char *p = SSDATA (str); # if defined(LIBGCCJIT_HAVE_gcc_jit_global_set_initializer) - /* FIXME; What is this if-condition for? This is the name of - function and should always be true. */ + /* This if-condition could only be false on MS-Windows if libgccjit + lacks 'gcc_jit_global_set_initializer', whose function pointer will + then be left at its original NULL value. */ if (gcc_jit_global_set_initializer) { ptrdiff_t str_size = len + 1; @@ -2743,9 +2744,8 @@ emit_static_object (const char *name, Lisp_Object obj) } #endif - /* FIXME; Is the following still needed? The above case - seems to always be taken nowadays. */ - + /* This is for older versions of libgccjit, which lack some functions, + and therefore cannot use the above code. */ gcc_jit_type *a_type = gcc_jit_context_new_array_type (comp.ctxt, NULL, @@ -2914,7 +2914,7 @@ declare_imported_data_relocs (Lisp_Object container, const char *code_symbol, Lisp_Object tem = CALLNI (comp-data-container-l, container); Lisp_Object constants = Fvconcat (1, &tem); - /* Emit the printed representation of the constants as a C string. */ + /* Emit the printed representation of the constants as a C string. */ emit_static_object (text_symbol, constants); *nconstants = XFIXNUM (CALLNI (hash-table-count, @@ -2926,7 +2926,7 @@ declare_imported_data_relocs (Lisp_Object container, const char *code_symbol, EMACS_INT len = 1; gcc_jit_type *type = comp.lisp_obj_ptr_type; #else - /* Lisp_Object CODE_SYMBOL[N], N = number of constants. */ + /* Lisp_Object CODE_SYMBOL[N], N = number of constants. */ EMACS_INT len = *nconstants; gcc_jit_type *type = comp.lisp_obj_type; #endif @@ -3040,7 +3040,7 @@ emit_abi_version (void) comp.void_ptr_type, ABI_VERSION_SYM); } -/* Check ABI version of CU against the current version. Do this because +/* Check ABI version of CU against the current version. Do this because relying on a substring of an MD5 checksum as part of an eln's file name is prone to fail. */ @@ -5336,8 +5336,8 @@ unset_cu_load_ongoing (Lisp_Object comp_u) } /* Setup constatns vector in the data segment VEC from Lisp vector - CONSTANTS. Store in *N the number of elements in VEC. Store in *ROOT - an MPS root for VEC, if one is needed. */ + CONSTANTS. Store in *N the number of elements in VEC. Store in + *ROOT an MPS root for VEC, if one is needed. */ static void setup_constants (comp_data_vector_t vec, Lisp_Object constants, @@ -5492,7 +5492,7 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump, &comp_u->data_eph_vec_pin); # endif /* No longer needed after top-level code has run. Let the - vector be GC'd. */ + vector be GC'd. */ comp_u->data_eph_vec = Qnil; } } diff --git a/src/comp.h b/src/comp.h index 265ae3428bb..e962e137f05 100644 --- a/src/comp.h +++ b/src/comp.h @@ -97,8 +97,8 @@ struct Lisp_Native_Comp_Unit Lisp_Object data_eph_vec; /* A Lisp vector read from a string contained in the text segment of - the .eln (TEXT_DATA_RELOC_SYM). The elements of the vector are - constants used in the native code. */ + the .eln (TEXT_DATA_RELOC_SYM). The elements of the vector are + constants used in the native code. */ Lisp_Object data_vec; /* STUFF WE DO NOT DUMP!! */ @@ -107,12 +107,12 @@ struct Lisp_Native_Comp_Unit stored (COMP_UNIT_SYM), and an exact root for it. */ Lisp_Object *comp_unit; - /* Pointers into data segment where constant vectors are found. */ + /* Pointers into data segment where constant vectors are found. */ comp_data_vector_t data_relocs; comp_data_vector_t data_eph_relocs; /* Size of the vectors above. 1 in the USE_POINTER_TO_CONSTANTS - case. */ + case. */ size_t n_data_relocs; size_t n_data_eph_relocs; diff --git a/src/pdumper.c b/src/pdumper.c index 67367a29e2e..f9368dbccdc 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -5870,7 +5870,7 @@ dump_do_dump_relocation (const uintptr_t dump_base, if (!NILP (lambda_data_idx)) { /* FIXME/elnroot: why is the fixup not done in the Lisp - vector? does it not exist? */ + vector? does it not exist? */ eassert (VECTORP (comp_u->data_vec)); /* This is an anonymous lambda. @@ -5878,9 +5878,9 @@ dump_do_dump_relocation (const uintptr_t dump_base, by code. */ Lisp_Object tem; XSETSUBR (tem, subr); - /* No need to fix something if pointers are used because - there are no copies in vectors in the data segments. */ # ifndef USE_POINTER_TO_CONSTANTS + /* No need to fix something if pointers are used because + there are no copies in vectors in the data segments. */ Lisp_Object *fixup = &(comp_u->data_relocs[XFIXNUM (lambda_data_idx)]); eassert (EQ (*fixup, Vcomp__hashdollar)); From 7a84008270b2e3b5f416a909b894e992c3825b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerd=20M=C3=B6llmann?= Date: Thu, 4 Dec 2025 14:00:48 +0100 Subject: [PATCH 3/3] ; Revert a change ein src/.lldbinit --- src/.lldbinit | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/.lldbinit b/src/.lldbinit index 7c38a974d67..b5a259c6507 100644 --- a/src/.lldbinit +++ b/src/.lldbinit @@ -116,16 +116,6 @@ command alias go process launch --disable-aslr false --working-dir ../lisp #settings set -- target.run-args --batch -l loadup --temacs=pbootstrap --bin-dest /Users/gerd/emacs/github/igc-copy/nextstep/Emacs.app/Contents/MacOS/ --eln-dest /Users/gerd/emacs/github/igc-copy/nextstep/Emacs.app/Contents/Frameworks/ #command alias go process launch --working-dir . -# Start process with stderr 2> log, open log and auto-revert-tail-mode -#process attach --waitfor --name emacs (--continue) - -# Attach to future Emacs - -# target create temacs -# settings set -- target.run-args --batch -l loadup --temacs=pbootstrap --bin-dest '/Users/gerd/emacs/github/cl-packages/carbon/Emacs.app/Contents/MacOS/' --eln-dest '/Users/gerd/emacs/github/cl-packages/carbon/Emacs.app/Contents/Frameworks/' -# command alias go process launch --working-dir . -# ##settings set target.disable-aslr false - -target create bootstrap-emacs -settings set -- target.run-args -batch --no-site-file --no-site-lisp --eval "(setq load-prefer-newer t byte-compile-warnings 'all)" --eval "(setq org--inhibit-version-check t)" -l comp -f byte-compile-refresh-preloaded -f batch-byte+native-compile ../lisp/dos-w32.el -command alias go process launch --working-dir ../lisp/ +target create emacs +settings set -- target.run-args +command alias go process launch --working-dir .