Do not use objcopy on macOS

On macOS, it is not used to localize symbols in dynamic libraries
(libruby.dylib and libyjit.o).  Instead, using `objcopy` which does
not support recent mach-O causes linker errors as bellow.

```
linking shared-library libruby.3.3.dylib
error: cannot parse the debug map for 'libruby.3.3.dylib': Invalid data was encountered while parsing the file
linking ruby
ld: malformed mach-o: LC_*_DYLIB load command string extends beyond end of load command file './libruby.3.3.dylib'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```
This commit is contained in:
Nobuyoshi Nakada 2023-02-15 13:44:04 +09:00
parent fba8f7783b
commit 413120e581
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6

View File

@ -235,7 +235,7 @@ AS_CASE(["${build_os}"],
AC_PATH_TOOL([NM], [nm], [/usr/ccs/bin/nm], [/usr/ccs/bin:$PATH]) AC_PATH_TOOL([NM], [nm], [/usr/ccs/bin/nm], [/usr/ccs/bin:$PATH])
]) ])
AS_CASE(["${target_os}"], AS_CASE(["${target_os}"],
[cygwin*|msys*|mingw*], [ [cygwin*|msys*|mingw*|darwin*], [
ac_cv_prog_ac_ct_OBJCOPY=":" ac_cv_prog_ac_ct_OBJCOPY=":"
]) ])
@ -507,15 +507,6 @@ AS_CASE(["$target_os"],
[hiuxmpp*], [AC_DEFINE(__HIUX_MPP__)]) # by TOYODA Eizi <toyoda@npd.kishou.go.jp> [hiuxmpp*], [AC_DEFINE(__HIUX_MPP__)]) # by TOYODA Eizi <toyoda@npd.kishou.go.jp>
AS_IF([test "$OBJCOPY" != :], [
AC_MSG_CHECKING([if $OBJCOPY works to localize symbols])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[void conftest_objcopy(void) {}]])],
[
$OBJCOPY -w -L '*conftest_*' conftest.$OBJEXT 2>/dev/null || OBJCOPY=:
])
AS_IF([test "$OBJCOPY" = :], [AC_MSG_RESULT(no)], [AC_MSG_RESULT(yes)])
])
AC_PROG_LN_S AC_PROG_LN_S
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
AC_PROG_INSTALL AC_PROG_INSTALL