Sunday, February 25, 2024

Re: missing endbr64

Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/gnustep/libobjc2/Makefile,v
diff -u -p -u -r1.32 Makefile
--- Makefile 13 Nov 2023 15:17:52 -0000 1.32
+++ Makefile 25 Feb 2024 20:58:14 -0000
@@ -3,16 +3,15 @@ ONLY_FOR_ARCHS = ${LLD_ARCHS}
COMMENT = GNUstep libobjc2 objective-c runtime

# note: this port does not use the gnustep module
-VERSION = 1.8.1
+VERSION = 2.2
GH_ACCOUNT = gnustep
GH_PROJECT = libobjc2
GH_TAGNAME = v${VERSION}
DISTNAME = libobjc2-${VERSION:S/_//}
PKGNAME = gnustep-${DISTNAME}
-REVISION = 7

-SHARED_LIBS += objc2 1.1
-SHARED_LIBS += objcxx 0.0
+SHARED_LIBS += objc2 2.0
+SHARED_LIBS += objcxx 1.0

CATEGORIES = x11/gnustep devel

@@ -29,17 +28,19 @@ MODULES = devel/cmake
CFLAGS += -fintegrated-as
.endif

+BUILD_DEPENDS += devel/robin-map
MAKE_FLAGS += LIBOBJCLIBNAME=objc2 \
LIBOBJC=libobjc2 \
HEADER_DIR=${DESTDIR}${PREFIX}/include/gnustep \
VERSION=${LIBobjc2_VERSION} \
SILENT=""

-CONFIGURE_ARGS += -DLIBOBJC_NAME=objc2 -DINCLUDE_DIRECTORY=gnustep/objc \
+CONFIGURE_ARGS += -DLIBOBJC_NAME=objc2 -DINCLUDE_DIRECTORY=gnustep/objc \
-DCMAKE_MODULE_PATH=${PREFIX}/share/llvm/cmake \
- -DBUILD_STATIC_LIBOBJC=On \
- -DLLVM_OPTS=Off \
- -DTESTS=Off
+ -DBUILD_STATIC_LIBOBJC=On \
+ -DLLVM_OPTS=Off \
+ -DTESTS=Off \
+ -DCMAKE_CXX_FLAGS="-I${LOCALBASE}/include"

MAKE_FLAGS += LIBOBJCLIBNAME=objc2 \
LIBOBJC=libobjc2
Index: distinfo
===================================================================
RCS file: /cvs/ports/x11/gnustep/libobjc2/distinfo,v
diff -u -p -u -r1.4 distinfo
--- distinfo 19 Apr 2017 21:10:10 -0000 1.4
+++ distinfo 25 Feb 2024 20:58:14 -0000
@@ -1,2 +1,2 @@
-SHA256 (gnustep/libobjc2-1.8.1.tar.gz) = RyvWhAcMTcbngpODb0JsHGmBw4GLVG907EALuPE9+SU=
-SIZE (gnustep/libobjc2-1.8.1.tar.gz) = 173635
+SHA256 (gnustep/libobjc2-2.2.tar.gz) = xMXO3leZSSSfFnNsmx+FxYxErdsBP1mXDctWbZBpFSo=
+SIZE (gnustep/libobjc2-2.2.tar.gz) = 203442
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: patches/patch-CMakeLists_txt
diff -N patches/patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt 10 Dec 2022 20:22:09 -0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,63 +0,0 @@
-Do not use CMAKE_THREAD_LIBS_INIT as linker flag
-Don't pick up libdispatch if available.
-
-Index: CMakeLists.txt
---- CMakeLists.txt.orig
-+++ CMakeLists.txt
-@@ -5,7 +5,6 @@ project(libobjc)
- enable_language(ASM)
-
- set(CMAKE_C_FLAGS_DEBUG "-g -O0 -fno-inline ${CMAKE_C_FLAGS_DEBUG}")
--set(CMAKE_C_FLAGS_RELEASE "-O3 ${CMAKE_C_FLAGS_RELEASE}")
- set(CMAKE_C_FLAGS "-std=gnu99 ${CMAKE_C_FLAGS}")
-
- set(libobjc_VERSION 4.6)
-@@ -237,12 +236,8 @@ endif (ENABLE_OBJCXX)
-
- # Currently, we actually need pthreads, but we should use the platform's native
- # threading implementation (we do for everything except thread-local storage)
--set(CMAKE_THREAD_PREFER_PTHREAD)
--include(FindThreads)
--set(objc_LINK_FLAGS "${objc_LINK_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
-+find_package(Threads REQUIRED)
-
--
--
- add_library(objc SHARED ${libobjc_C_SRCS} ${libobjc_ASM_SRCS} ${libobjc_OBJC_SRCS} ${libobjc_CXX_SRCS})
-
- set_target_properties(objc PROPERTIES
-@@ -265,6 +260,9 @@ if (BUILD_STATIC_LIBOBJC)
- endif ()
-
-
-+if (CMAKE_THREAD_LIBS_INIT)
-+ target_link_libraries(objc ${CMAKE_THREAD_LIBS_INIT})
-+endif ()
-
- # Explicitly link the C++ runtime and libgc if we are compiling with gc support.
- target_link_libraries(objc ${CXX_RUNTIME})
-@@ -272,12 +270,6 @@ if (LIBGC)
- target_link_libraries(objc ${LIBGC})
- endif ()
-
--# Link libdispatch if available (we'll miss symbols for toydispatch otherwise)
--find_library(LIBDISPATCH dispatch)
--if (LIBDISPATCH)
-- target_link_libraries(objc ${LIBDISPATCH})
--endif ()
--
- # Make weak symbols work on OS X
- if (APPLE)
- set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS
-@@ -285,6 +277,11 @@ if (APPLE)
- set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,-undefined,dynamic_lookup")
- set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-undefined,dynamic_lookup")
- endif ()
-+
-+if (NOT CMAKE_INSTALL_LIBDIR)
-+ set(CMAKE_INSTALL_LIBDIR lib)
-+endif ()
-+
-
- #
- # Installation
Index: patches/patch-objc_msgSend_arm_S
===================================================================
RCS file: patches/patch-objc_msgSend_arm_S
diff -N patches/patch-objc_msgSend_arm_S
--- patches/patch-objc_msgSend_arm_S 11 Mar 2022 20:15:57 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-No support for neon SIMD in binutils-2.17.
-
---- objc_msgSend.arm.S.orig Wed Dec 28 08:58:48 2016
-+++ objc_msgSend.arm.S Wed Dec 28 08:58:53 2016
-@@ -4,7 +4,6 @@
- #define DATA_OFFSET 12
- #define SLOT_OFFSET 16
- .syntax unified
--.fpu neon
-
- // Macro for testing: logs a register value to standard error
- .macro LOG reg
Index: patches/patch-objcxx_eh_cc
===================================================================
RCS file: patches/patch-objcxx_eh_cc
diff -N patches/patch-objcxx_eh_cc
--- patches/patch-objcxx_eh_cc 13 Nov 2023 15:17:52 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-Fix build with llvm-16:
-/usr/ports/pobj/gnustep-libobjc2-1.8.1/libobjc2-1.8.1/objcxx_eh.cc:76:2: error: unknown type name 'unexpected_handler'
- unexpected_handler unexpectedHandler;
-
-https://github.com/gnustep/libobjc2/commit/0ae4e4ceb77410c619bf597d6f0b0842d5f078a6
-
-Index: objcxx_eh.cc
---- objcxx_eh.cc.orig
-+++ objcxx_eh.cc
-@@ -2,7 +2,6 @@
- #include <stdio.h>
- #include "dwarf_eh.h"
- #include "objcxx_eh.h"
--#include <exception>
-
- extern "C"
- {
-@@ -14,6 +13,14 @@ namespace __cxxabiv1
- }
-
- using __cxxabiv1::__class_type_info;
-+
-+// Define some C++ ABI types here, rather than including them. This prevents
-+// conflicts with the libstdc++ headers, which expose only a subset of the
-+// type_info class (the part required for standards compliance, not the
-+// implementation details).
-+
-+typedef void (*unexpected_handler)();
-+typedef void (*terminate_handler)();
-
- namespace std
- {
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/x11/gnustep/libobjc2/pkg/PLIST,v
diff -u -p -u -r1.3 PLIST
--- pkg/PLIST 11 Mar 2022 20:15:57 -0000 1.3
+++ pkg/PLIST 25 Feb 2024 20:58:14 -0000
@@ -1,3 +1,6 @@
+@conflict libdispatch-*
+include/Block.h
+include/Block_private.h
include/gnustep/
include/gnustep/objc/
include/gnustep/objc/Availability.h
@@ -13,10 +16,14 @@ include/gnustep/objc/message.h
include/gnustep/objc/objc-api.h
include/gnustep/objc/objc-arc.h
include/gnustep/objc/objc-auto.h
+include/gnustep/objc/objc-class.h
+include/gnustep/objc/objc-exception.h
+include/gnustep/objc/objc-runtime.h
+include/gnustep/objc/objc-visibility.h
include/gnustep/objc/objc.h
include/gnustep/objc/runtime-deprecated.h
include/gnustep/objc/runtime.h
include/gnustep/objc/slot.h
-lib/libobjc2.a
+@static-lib lib/libobjc2.a
@lib lib/libobjc2.so.${LIBobjc2_VERSION}
-@lib lib/libobjcxx.so.${LIBobjcxx_VERSION}
+lib/pkgconfig/libobjc.pc
On Sunday, February 25, 2024 16:44 CET, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:

> > x11/gnustep/libobjc2.log
> > ld: warning: __objc_block_trampoline_sret: missing endbr64
> > ld: warning: __objc_block_trampoline: missing endbr64
> > ld: warning: objc_msgSend: missing endbr64
> > ld: warning: objc_msgSend_fpret: missing endbr64
> > ld: warning: objc_msgSend_stret: missing endbr64
>
> I guess this is very similay to devel/objfw. Just add endbr64 to
> those functions like we did there. No aarch64 support here by the
> looks of it.

Above version of libobjc2 is old, but due to build errors, and runtime errors, I was
unable to upgrade. However, a new version was released just a few days ago, and that one even builds
and doesn't show runtime errors so far.
I updated one test box, to get these new ld warnings, there are only these left on amd64:

ld: warning: objc_msgSend: missing endbr64
ld: warning: objc_msgSend_fpret: missing endbr64
ld: warning: objc_msgSend_stret: missing endbr64

Which are all the platforms, that need such fix? I see objc_msgSend_fpret for aarch64, arm,
amd64, i386, mips and riscv64.

Attached patch to update to the new 2.2 release, without any fixes for the missing endbr64.

Sebastian

No comments:

Post a Comment