summaryrefslogtreecommitdiff
path: root/test/old-elf/Inputs/shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/old-elf/Inputs/shared.c')
-rw-r--r--test/old-elf/Inputs/shared.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/old-elf/Inputs/shared.c b/test/old-elf/Inputs/shared.c
new file mode 100644
index 000000000000..2be91c4b9e45
--- /dev/null
+++ b/test/old-elf/Inputs/shared.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+extern int i;
+int i = 42;
+
+// Undefined weak function in a dynamic library.
+__attribute__((weak)) void weakfoo();
+
+// Regular function in a dynamic library.
+void foo() {
+ // Try to call weakfoo so that the reference to weekfoo will be included in
+ // the resulting .so file.
+ if (weakfoo)
+ weakfoo();
+ puts("Fooo!!");
+}