summaryrefslogtreecommitdiff
blob: 473cd9a29e1abd052019ba844be9252850924659 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/?id=71a8b8ef0adf01af4c78c739e04533a35c1dc89c

From 71a8b8ef0adf01af4c78c739e04533a35c1dc89c Mon Sep 17 00:00:00 2001
From: Otavio Salvador <otavio@ossystems.com.br>
Date: Wed, 31 May 2023 11:41:42 -0300
Subject: libfdt: meson: Fix linking on macOS linker

-undefined error is the equivalent of --no-undefined for the macOS
linker, but -undefined would also be understood as a valid argument for
GNU ld so we use the supported linker variant.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
--- a/libfdt/meson.build
+++ b/libfdt/meson.build
@@ -16,10 +16,20 @@ sources = files(
   'fdt_wip.c',
 )
 
+link_args = []
+if cc.has_link_argument('-Wl,--no-undefined')
+    link_args += '-Wl,--no-undefined'
+else
+    # -undefined error is the equivalent of --no-undefined for the macOS linker,
+    # but -undefined would also be understood as a valid argument for GNU ld!
+    link_args += cc.get_supported_link_arguments('-Wl,-undefined,error')
+endif
+
+link_args += version_script
 libfdt = library(
   'fdt', sources,
   version: '1.6.0',
-  link_args: ['-Wl,--no-undefined', version_script],
+  link_args: link_args,
   link_depends: 'version.lds',
   install: true,
 )
-- 
cgit