Skip to content

LLVM hacks for MidnightBSD 3.x

Lucas Holt edited this page Apr 11, 2023 · 6 revisions

The switch from binutils has caused some issues with various ports. Here are a few possible hacks one can use for mports.

compiler flags:

-fcommon

meson:

-Db_lundef=false

cmake:

(when no-undefined is set)

if (CMAKE_SYSTEM_NAME MATCHES "MidnightBSD")`
    string(REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")`
endif ()`

Binary ver

@${RM} ${WRKSRC}/binary.ver

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220103

Example patch for chromium

--- build/linux/chrome.map.orig	2018-08-08 19:10:32 UTC
+++ build/linux/chrome.map
@@ -1,4 +1,7 @@
 {
+local:
+  *;
+
 global:
   __bss_start;
   __data_start;
@@ -20,6 +23,10 @@ global:
   # Program entry point.
   _start;

+  # MidnightBSD specific variables.
+  __progname;
+  environ;
+
   # Memory allocation symbols.  We want chrome and any libraries to
   # share the same heap, so it is correct to export these symbols.
   calloc;
@@ -81,7 +88,4 @@ global:
   localtime64;
   localtime64_r;
   localtime_r;
-
-local:
-  *;
 };

Other Migration bugs

Work around the lack of definition of union semun per POSIX.

When feasible, do this by adding -D_WANT_SEMUN to CFLAGS or CXXFLAGS