From 501079628835a9fd6ef776070f43c74447f2d96b Mon Sep 17 00:00:00 2001
From: Matteo Cicuttin <datafl4sh@toxicnet.eu>
Date: Wed, 19 May 2021 14:39:29 +0200
Subject: [PATCH] Duplicate symbol test.

---
 testdupsym/compile.sh |  4 ++++
 testdupsym/lib1.c     |  5 +++++
 testdupsym/lib2.c     |  5 +++++
 testdupsym/main.c     | 10 ++++++++++
 4 files changed, 24 insertions(+)
 create mode 100644 testdupsym/compile.sh
 create mode 100644 testdupsym/lib1.c
 create mode 100644 testdupsym/lib2.c
 create mode 100644 testdupsym/main.c

diff --git a/testdupsym/compile.sh b/testdupsym/compile.sh
new file mode 100644
index 0000000..bed9614
--- /dev/null
+++ b/testdupsym/compile.sh
@@ -0,0 +1,4 @@
+gcc -shared -o libl1.so lib1.c 
+gcc -shared -o libl2.so lib2.c
+gcc -o main main.c -L. -ll1 -ll2
+
diff --git a/testdupsym/lib1.c b/testdupsym/lib1.c
new file mode 100644
index 0000000..b70867f
--- /dev/null
+++ b/testdupsym/lib1.c
@@ -0,0 +1,5 @@
+int testfun(int x)
+{
+    return x+1;
+}
+
diff --git a/testdupsym/lib2.c b/testdupsym/lib2.c
new file mode 100644
index 0000000..00ca0e6
--- /dev/null
+++ b/testdupsym/lib2.c
@@ -0,0 +1,5 @@
+int testfun(int x)
+{
+    return x+2;
+}
+
diff --git a/testdupsym/main.c b/testdupsym/main.c
new file mode 100644
index 0000000..1757ac7
--- /dev/null
+++ b/testdupsym/main.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+int testfun(int);
+
+int main(void)
+{
+    printf("%d\n", testfun(42));
+    return 0;
+}
+
-- 
GitLab