diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-25 15:11:33 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-25 15:11:33 -0400 |
| commit | e531c0179299de7fbaa84dda39ab1bd289cecf88 (patch) | |
| tree | ef36533c3e27db68404ce787aaf7f0abe96ca327 /src/tomo.c | |
| parent | 4740cc22f39f6eb1c056c07b66fec11d76340704 (diff) | |
Speculative fix for Mac: use llvm-objcopy instead of patchelf for Mach-O
shared library files
Diffstat (limited to 'src/tomo.c')
| -rw-r--r-- | src/tomo.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -495,10 +495,19 @@ void build_library(Text_t lib_dir_name) if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) errx(WEXITSTATUS(status), "Failed to run `objcopy` to add library prefix to symbols"); +#if defined(__ELF__) prog = run_cmd("patchelf --rename-dynamic-symbols .build/symbol_renames.txt 'lib", lib_dir_name, SHARED_SUFFIX, "'"); status = pclose(prog); if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) errx(WEXITSTATUS(status), "Failed to run `patchelf` to rename dynamic symbols with library prefix"); +#elif defined(__MACH__) + prog = run_cmd("llvm-objcopy --redefine-syms=.build/symbol_renames.txt 'lib", lib_dir_name, SHARED_SUFFIX, "'"); + status = pclose(prog); + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) + errx(WEXITSTATUS(status), "Failed to run `llvm-objcopy` to rename dynamic symbols with library prefix"); +#else +#error "Unknown platform (not ELF or MACH)" +#endif if (verbose) print("Successfully renamed symbols with library prefix!"); |
