summaryrefslogtreecommitdiff
path: root/regress/libexec
diff options
context:
space:
mode:
Diffstat (limited to 'regress/libexec')
-rw-r--r--regress/libexec/ld.so/initfirst/Makefile.inc35
-rw-r--r--regress/libexec/ld.so/initfirst/lib.c40
-rw-r--r--regress/libexec/ld.so/initfirst/libif1/Makefile9
-rw-r--r--regress/libexec/ld.so/initfirst/libif1/lib.c2
-rw-r--r--regress/libexec/ld.so/initfirst/libif1/shlib_version2
-rw-r--r--regress/libexec/ld.so/initfirst/libif2/Makefile9
-rw-r--r--regress/libexec/ld.so/initfirst/libif2/lib.c2
-rw-r--r--regress/libexec/ld.so/initfirst/libif2/shlib_version2
-rw-r--r--regress/libexec/ld.so/initfirst/libif3/Makefile9
-rw-r--r--regress/libexec/ld.so/initfirst/libif3/lib.c2
-rw-r--r--regress/libexec/ld.so/initfirst/libif3/shlib_version2
-rw-r--r--regress/libexec/ld.so/initfirst/libnormal/Makefile8
-rw-r--r--regress/libexec/ld.so/initfirst/libnormal/lib.c2
-rw-r--r--regress/libexec/ld.so/initfirst/libnormal/shlib_version2
-rw-r--r--regress/libexec/ld.so/initfirst/prog1/expected15
-rw-r--r--regress/libexec/ld.so/initfirst/prog1/expected25
-rw-r--r--regress/libexec/ld.so/initfirst/prog1/expected35
-rw-r--r--regress/libexec/ld.so/initfirst/prog1/expected45
-rw-r--r--regress/libexec/ld.so/initfirst/prog1/main.c29
19 files changed, 175 insertions, 0 deletions
diff --git a/regress/libexec/ld.so/initfirst/Makefile.inc b/regress/libexec/ld.so/initfirst/Makefile.inc
new file mode 100644
index 00000000000..e5716a74c99
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/Makefile.inc
@@ -0,0 +1,35 @@
+# $OpenBSD: Makefile.inc,v 1.1 2011/11/08 23:51:02 guenther Exp $
+
+.include <bsd.obj.mk>
+
+IF1_DIR=${.CURDIR}/../libif1
+
+IF1_OBJDIR!= if [ -d $(IF1_DIR)/${__objdir} ]; then \
+ echo "$(IF1_DIR)/${__objdir}"; \
+ else \
+ echo "$(IF1_DIR)"; \
+ fi
+
+IF2_DIR=${.CURDIR}/../libif2
+
+IF2_OBJDIR!= if [ -d $(IF2_DIR)/${__objdir} ]; then \
+ echo "$(IF2_DIR)/${__objdir}"; \
+ else \
+ echo "$(IF2_DIR)"; \
+ fi
+
+IF3_DIR=${.CURDIR}/../libif3
+
+IF3_OBJDIR!= if [ -d $(IF3_DIR)/${__objdir} ]; then \
+ echo "$(IF3_DIR)/${__objdir}"; \
+ else \
+ echo "$(IF3_DIR)"; \
+ fi
+
+NORMAL_DIR=${.CURDIR}/../libnormal
+
+NORMAL_OBJDIR!= if [ -d $(NORMAL_DIR)/${__objdir} ]; then \
+ echo "$(NORMAL_DIR)/${__objdir}"; \
+ else \
+ echo "$(NORMAL_DIR)"; \
+ fi
diff --git a/regress/libexec/ld.so/initfirst/lib.c b/regress/libexec/ld.so/initfirst/lib.c
new file mode 100644
index 00000000000..6087b1dd996
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/lib.c
@@ -0,0 +1,40 @@
+/* $OpenBSD: lib.c,v 1.1 2011/11/08 23:51:02 guenther Exp $ */
+
+/*
+ * Copyright (c) 2011 Philip Guenther <guenther@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include <stdio.h>
+
+static void init(void) __attribute__((constructor));
+static void
+init(void)
+{
+ printf("init %s\n", NAME);
+}
+
+
+static void fini(void) __attribute__((destructor));
+static void
+fini(void)
+{
+ printf("fini %s\n", NAME);
+}
+
+void func(void)
+{
+ printf("func %s\n", NAME);
+}
diff --git a/regress/libexec/ld.so/initfirst/libif1/Makefile b/regress/libexec/ld.so/initfirst/libif1/Makefile
new file mode 100644
index 00000000000..3b8484ca731
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/libif1/Makefile
@@ -0,0 +1,9 @@
+# $OpenBSD: Makefile,v 1.1 2011/11/08 23:51:02 guenther Exp $
+
+LIB= if1
+SRCS= lib.c
+LDADD+= -Wl,-zinitfirst
+
+regress: all
+
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/initfirst/libif1/lib.c b/regress/libexec/ld.so/initfirst/libif1/lib.c
new file mode 100644
index 00000000000..1708c5a9ec3
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/libif1/lib.c
@@ -0,0 +1,2 @@
+#define NAME "if1"
+#include "../lib.c"
diff --git a/regress/libexec/ld.so/initfirst/libif1/shlib_version b/regress/libexec/ld.so/initfirst/libif1/shlib_version
new file mode 100644
index 00000000000..987ef746955
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/libif1/shlib_version
@@ -0,0 +1,2 @@
+major=1
+minor=0
diff --git a/regress/libexec/ld.so/initfirst/libif2/Makefile b/regress/libexec/ld.so/initfirst/libif2/Makefile
new file mode 100644
index 00000000000..3741eeea7b1
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/libif2/Makefile
@@ -0,0 +1,9 @@
+# $OpenBSD: Makefile,v 1.1 2011/11/08 23:51:02 guenther Exp $
+
+LIB= if2
+SRCS= lib.c
+LDADD+= -Wl,-zinitfirst
+
+regress: all
+
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/initfirst/libif2/lib.c b/regress/libexec/ld.so/initfirst/libif2/lib.c
new file mode 100644
index 00000000000..656cd1146f6
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/libif2/lib.c
@@ -0,0 +1,2 @@
+#define NAME "if2"
+#include "../lib.c"
diff --git a/regress/libexec/ld.so/initfirst/libif2/shlib_version b/regress/libexec/ld.so/initfirst/libif2/shlib_version
new file mode 100644
index 00000000000..987ef746955
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/libif2/shlib_version
@@ -0,0 +1,2 @@
+major=1
+minor=0
diff --git a/regress/libexec/ld.so/initfirst/libif3/Makefile b/regress/libexec/ld.so/initfirst/libif3/Makefile
new file mode 100644
index 00000000000..da806319f8d
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/libif3/Makefile
@@ -0,0 +1,9 @@
+# $OpenBSD: Makefile,v 1.1 2011/11/08 23:51:02 guenther Exp $
+
+LIB= if3
+SRCS= lib.c
+LDADD+= -Wl,-zinitfirst
+
+regress: all
+
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/initfirst/libif3/lib.c b/regress/libexec/ld.so/initfirst/libif3/lib.c
new file mode 100644
index 00000000000..52ea7474274
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/libif3/lib.c
@@ -0,0 +1,2 @@
+#define NAME "if3"
+#include "../lib.c"
diff --git a/regress/libexec/ld.so/initfirst/libif3/shlib_version b/regress/libexec/ld.so/initfirst/libif3/shlib_version
new file mode 100644
index 00000000000..987ef746955
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/libif3/shlib_version
@@ -0,0 +1,2 @@
+major=1
+minor=0
diff --git a/regress/libexec/ld.so/initfirst/libnormal/Makefile b/regress/libexec/ld.so/initfirst/libnormal/Makefile
new file mode 100644
index 00000000000..20b1b5ef1fa
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/libnormal/Makefile
@@ -0,0 +1,8 @@
+# $OpenBSD: Makefile,v 1.1 2011/11/08 23:51:02 guenther Exp $
+
+LIB= normal
+SRCS= lib.c
+
+regress: all
+
+.include <bsd.lib.mk>
diff --git a/regress/libexec/ld.so/initfirst/libnormal/lib.c b/regress/libexec/ld.so/initfirst/libnormal/lib.c
new file mode 100644
index 00000000000..4018c0338ce
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/libnormal/lib.c
@@ -0,0 +1,2 @@
+#define NAME "normal"
+#include "../lib.c"
diff --git a/regress/libexec/ld.so/initfirst/libnormal/shlib_version b/regress/libexec/ld.so/initfirst/libnormal/shlib_version
new file mode 100644
index 00000000000..987ef746955
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/libnormal/shlib_version
@@ -0,0 +1,2 @@
+major=1
+minor=0
diff --git a/regress/libexec/ld.so/initfirst/prog1/expected1 b/regress/libexec/ld.so/initfirst/prog1/expected1
new file mode 100644
index 00000000000..56928546182
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/prog1/expected1
@@ -0,0 +1,5 @@
+init if1
+init if2
+init normal
+main
+func normal
diff --git a/regress/libexec/ld.so/initfirst/prog1/expected2 b/regress/libexec/ld.so/initfirst/prog1/expected2
new file mode 100644
index 00000000000..08cbef24f0e
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/prog1/expected2
@@ -0,0 +1,5 @@
+init if1
+init if2
+init normal
+main
+func if1
diff --git a/regress/libexec/ld.so/initfirst/prog1/expected3 b/regress/libexec/ld.so/initfirst/prog1/expected3
new file mode 100644
index 00000000000..08cbef24f0e
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/prog1/expected3
@@ -0,0 +1,5 @@
+init if1
+init if2
+init normal
+main
+func if1
diff --git a/regress/libexec/ld.so/initfirst/prog1/expected4 b/regress/libexec/ld.so/initfirst/prog1/expected4
new file mode 100644
index 00000000000..81cc0318c9b
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/prog1/expected4
@@ -0,0 +1,5 @@
+init if1
+init if2
+init if3
+main
+func if1
diff --git a/regress/libexec/ld.so/initfirst/prog1/main.c b/regress/libexec/ld.so/initfirst/prog1/main.c
new file mode 100644
index 00000000000..65f0c20adf9
--- /dev/null
+++ b/regress/libexec/ld.so/initfirst/prog1/main.c
@@ -0,0 +1,29 @@
+/* $OpenBSD: main.c,v 1.1 2011/11/08 23:51:02 guenther Exp $ */
+
+/*
+ * Copyright (c) 2011 Philip Guenther <guenther@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+
+void func(void);
+
+int
+main()
+{
+ printf("main\n");
+ func();
+ return 0;
+}