@@ -1143,10 +1143,13 @@ fn (mut v Builder) setup_ccompiler_options(ccompiler string) {
11431143 ccoptions.linker_flags << '-Wl,-export_dynamic' // clang for mac needs export_dynamic instead of -rdynamic
11441144 if v.pref.building_v && ccoptions.cc == .clang {
11451145 // ld64 otherwise lets temporary object and output paths perturb the
1146- // content-derived UUID and the ad-hoc code signature.
1146+ // content-derived UUID and its provisional ad-hoc code signature.
1147+ // Suppress that signature so every linker version leaves the same
1148+ // unsigned layout for the normalized post-link signature below.
11471149 ccoptions.args << os.quoted_path ('-ffile-prefix-map=${v .out_name_c }=<generated-c>' )
11481150 ccoptions.linker_flags << '-Wl,-reproducible'
11491151 ccoptions.linker_flags << '-Wl,-final_output,v-compiler'
1152+ ccoptions.linker_flags << '-Wl,-no_adhoc_codesign'
11501153 }
11511154 } else {
11521155 if v.pref.ccompiler != 'x86_64-w64-mingw32-gcc' {
@@ -2374,9 +2377,8 @@ fn (v &Builder) finalize_reproducible_macos_debug_compiler() {
23742377 verror ('could not find `codesign` to finalize the reproducible macOS compiler binary' )
23752378 return
23762379 }
2377- // Removing the linker's signature first also removes its output-name-dependent
2378- // allocation, so the replacement has the same layout for every output path.
2379- os.execute ('${os .quoted_path (codesign_path )} --remove-signature ${os .quoted_path (v .pref .out_name )}' )
2380+ // The linker leaves this compiler unsigned; add one normalized signature with
2381+ // a stable identifier so its layout and contents do not depend on the output path.
23802382 codesign_result :=
23812383 os.execute ('${os .quoted_path (codesign_path )} --force --sign - --identifier org.vlang.v ${os .quoted_path (v .pref .out_name )}' )
23822384 if codesign_result.exit_code != 0 {
0 commit comments