xref: /illumos-gate/usr/src/test/elf-tests/tests/resolution/mixed-hidden-comdat/Makefile.test (revision dd72704bd9e794056c558153663c739e2012d721)
1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12# Copyright 2021, Richard Lowe.
13
14OBJS=visible.o hidden.o access.o
15
16SRCDIR=$(PWD)
17
18.KEEP_STATE:
19
20all: libnoref.so libothertest.so test
21
22%.o: $(SRCDIR)/%.s
23	gcc -D_ASM -m64 -c $< -o $@
24%.o: $(SRCDIR)/%.S
25	gcc -D_ASM -m64 -c $< -o $@
26
27libtest.so: $(OBJS)
28	gcc -m64 -shared $(OBJS) -o $@
29
30# libtest.so, but with the important objects in the other order so that we
31# choose the other COMDAT section to keep.
32libothertest.so: $(OBJS)
33	gcc -m64 -shared hidden.o visible.o access.o -o $@
34
35libnoref.so: $(OBJS:access.o=)	#Remove any references
36	gcc -m64 -Wl,-zignore -shared $(OBJS:access.o=) -o $@
37
38test: $(SRCDIR)/main.c libtest.so
39	gcc -m64 $(SRCDIR)/main.c -o $@ -L$(PWD) -R$(PWD) -ltest
40
41clean:
42	rm -rf $(OBJS) test libtest.so
43