]> git.saurik.com Git - apple/ld64.git/blobdiff - unit-tests/test-cases/dead_strip-archive-weak/main.c
ld64-95.2.12.tar.gz
[apple/ld64.git] / unit-tests / test-cases / dead_strip-archive-weak / main.c
diff --git a/unit-tests/test-cases/dead_strip-archive-weak/main.c b/unit-tests/test-cases/dead_strip-archive-weak/main.c
new file mode 100644 (file)
index 0000000..c082574
--- /dev/null
@@ -0,0 +1,27 @@
+
+extern void loadme();
+
+void good()
+{
+}
+
+void bad()
+{
+}
+
+// foo is first found be dead stripping here
+// then the use of loadme causes libfoo.a(foo.o)
+// to be loaded which overrides foo
+__attribute__((weak)) void foo()
+{
+       bad();
+}
+
+int main()
+{
+       foo();
+       loadme();
+       return 0;
+}
+
+