aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAilin Nemui <ailin@d5421s.localdomain>2022-07-25 10:24:09 -0700
committerNirbheek Chauhan <nirbheek@centricular.com>2022-08-08 19:10:32 +0530
commitbcb382b6403117513b0d7e77f01debb89fd54a45 (patch)
tree302f034a399836e0a8e82b6997f45f4f5deebc42
parent77e589c4937cd77def8420f69756662d8b43cdba (diff)
downloadmeson-bcb382b6403117513b0d7e77f01debb89fd54a45.zip
meson-bcb382b6403117513b0d7e77f01debb89fd54a45.tar.gz
meson-bcb382b6403117513b0d7e77f01debb89fd54a45.tar.bz2
tests: Test extern'd globals on MacOS with the Apple Archiver
This forces the use of the Apple archiver, since that archiver doesn't add extern'd variables to the symbol table automatically, and instead requires that ranlib be used. A native file is used to ensure that Apple's ar is used even in the presence of llvm or gcc in the path with their superior archivers. Co-authored-by: Dylan Baker <dylan@pnwbakers.com>
-rw-r--r--test cases/osx/9 global variable ar/libfile.c9
-rw-r--r--test cases/osx/9 global variable ar/libfile2.c7
-rw-r--r--test cases/osx/9 global variable ar/meson.build6
-rw-r--r--test cases/osx/9 global variable ar/nativefile.ini2
-rw-r--r--test cases/osx/9 global variable ar/prog.c7
5 files changed, 31 insertions, 0 deletions
diff --git a/test cases/osx/9 global variable ar/libfile.c b/test cases/osx/9 global variable ar/libfile.c
new file mode 100644
index 0000000..b258d7b
--- /dev/null
+++ b/test cases/osx/9 global variable ar/libfile.c
@@ -0,0 +1,9 @@
+// Source: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
+
+#include <stdio.h>
+
+extern int l2;
+void l1(void)
+{
+ printf("l1 %d\n", l2);
+}
diff --git a/test cases/osx/9 global variable ar/libfile2.c b/test cases/osx/9 global variable ar/libfile2.c
new file mode 100644
index 0000000..1499c4d
--- /dev/null
+++ b/test cases/osx/9 global variable ar/libfile2.c
@@ -0,0 +1,7 @@
+// Source: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
+
+int l2;
+void l2_func(void)
+{
+ l2 = 77;
+}
diff --git a/test cases/osx/9 global variable ar/meson.build b/test cases/osx/9 global variable ar/meson.build
new file mode 100644
index 0000000..313dd1b
--- /dev/null
+++ b/test cases/osx/9 global variable ar/meson.build
@@ -0,0 +1,6 @@
+# Source: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
+
+project('global variable test', 'c')
+
+lib = static_library('mylib', 'libfile.c', 'libfile2.c')
+test('global variable', executable('prog', 'prog.c', link_with: lib))
diff --git a/test cases/osx/9 global variable ar/nativefile.ini b/test cases/osx/9 global variable ar/nativefile.ini
new file mode 100644
index 0000000..4fb5e7f
--- /dev/null
+++ b/test cases/osx/9 global variable ar/nativefile.ini
@@ -0,0 +1,2 @@
+[binaries]
+ar = 'ar'
diff --git a/test cases/osx/9 global variable ar/prog.c b/test cases/osx/9 global variable ar/prog.c
new file mode 100644
index 0000000..4665016
--- /dev/null
+++ b/test cases/osx/9 global variable ar/prog.c
@@ -0,0 +1,7 @@
+// Source: https://lists.gnu.org/archive/html/libtool/2002-07/msg00025.html
+
+extern void l1(void);
+int main(void)
+{
+ l1();
+}