summaryrefslogtreecommitdiffstats
path: root/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec
diff options
context:
space:
mode:
Diffstat (limited to 't/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec')
-rwxr-xr-xt/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/debian/rules9
-rw-r--r--t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/fill-values4
-rw-r--r--t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/orig/Makefile35
-rw-r--r--t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/orig/basic.c5
-rw-r--r--t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/orig/basic.pod14
5 files changed, 67 insertions, 0 deletions
diff --git a/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/debian/rules b/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/debian/rules
new file mode 100755
index 0000000..fab80fa
--- /dev/null
+++ b/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/debian/rules
@@ -0,0 +1,9 @@
+#!/usr/bin/make -f
+
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+
+%:
+ dh $@
+
+# dwz errors out; no .debug_info section present due to -nostdlib
+override_dh_dwz:
diff --git a/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/fill-values b/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/fill-values
new file mode 100644
index 0000000..88f75cb
--- /dev/null
+++ b/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/fill-values
@@ -0,0 +1,4 @@
+Skeleton: upload-native
+Testname: binaries-libc-link
+Description: Binaries not linked against libc
+Package-Architecture: any
diff --git a/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/orig/Makefile b/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/orig/Makefile
new file mode 100644
index 0000000..daa4159
--- /dev/null
+++ b/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/orig/Makefile
@@ -0,0 +1,35 @@
+# turn off PIE in CC in case we have a PIEful toolchain:
+ifneq ($(findstring -no-pie,$(shell gcc -no-pie 2>&1)),)
+ CC := gcc
+else
+ CC := gcc -fno-pie -no-pie
+endif
+
+LINKER_FLAGS := -Wl,--no-copy-dt-needed-entries,--no-as-needed
+
+all: basic basic.1 libbasic-nodeps libbasic-nolibc
+
+basic.1: basic.pod
+ pod2man --section 1 $< > $@
+
+basic: basic.o
+ $(CC) -nostdlib -o$@ $< $(LINKER_FLAGS) -lm $(LFLAGS)
+
+libbasic-nodeps: basic.o
+ $(CC) -nostdlib --shared -o$@ $<
+
+libbasic-nolibc: basic.o
+ $(CC) -nostdlib --shared -o$@ $< $(LINKER_FLAGS) -lm
+
+install:
+ install -d $(DESTDIR)/usr/bin
+ install -d $(DESTDIR)/usr/lib/basic
+ install -d $(DESTDIR)/usr/share/man/man1
+ install -m 755 -c basic $(DESTDIR)/usr/bin/basic
+ install -m 755 -c libbasic-* $(DESTDIR)/usr/lib/basic
+ install -m 644 -c basic.1 $(DESTDIR)/usr/share/man/man1
+
+clean distclean:
+ rm -f basic libbasic-* basic.1
+
+check test:
diff --git a/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/orig/basic.c b/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/orig/basic.c
new file mode 100644
index 0000000..77bc677
--- /dev/null
+++ b/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/orig/basic.c
@@ -0,0 +1,5 @@
+int
+main(void)
+{
+ return 0;
+}
diff --git a/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/orig/basic.pod b/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/orig/basic.pod
new file mode 100644
index 0000000..d395e96
--- /dev/null
+++ b/t/recipes/checks/binaries/prerequisites/binaries-libc-link/build-spec/orig/basic.pod
@@ -0,0 +1,14 @@
+=head1 NAME
+
+basic -- segfaults
+
+=head1 SYNOPSIS
+
+ basic
+
+=head1 DESCRIPTION
+
+It tends to seg. fault, but if it doesn't it will return 0 like
+/bin/true.
+
+=cut