xref: /illumos-gate/usr/src/test/elf-tests/tests/tls/amd64/ie/Makefile.test (revision 17a5fa85fe0c34b1146222e40a80b42f2aae8500)
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 2012, Richard Lowe.
13
14CC =		gcc
15CFLAGS =	-O1 -m64
16
17LINK.c =  $(CC) $(CFLAGS) -o $@ $^
18COMPILE.s = $(CC) $(CFLAGS) -c -o $@ $^
19
20.KEEP_STATE:
21
22install default: all
23
24%.o: $(TESTDIR)/%.s
25	$(COMPILE.s)
26
27# A basic use of TLS that uses the movq m/r --> movq i/r variant
28PROGS +=	style2
29STYLE2OBJS =	style2.o
30style2: $(STYLE2OBJS)
31	$(LINK.c)
32
33# A copy of style2 that uses %r13 in the TLS sequence, and thus excercises the
34# REX transitions of the movq mem,reg -> movq imm,reg variant.
35PROGS +=	style2-with-r13
36STYLE2R13OBJS =	style2-with-r13.o
37style2-with-r13: $(STYLE2R13OBJS)
38	$(LINK.c)
39
40# A copy of style2 that uses %r12 in the TLS sequence, so we can verify that
41# it is _not_ special to this variant
42PROGS +=	style2-with-r12
43STYLE2R12OBJS =	style2-with-r12.o
44style2-with-r12: $(STYLE2R12OBJS)
45	$(LINK.c)
46
47# A copy of style2 that has a R_AMD64_GOTTPOFF relocation with a bad insn sequence
48STYLE2BADNESSOBJS =	style2-with-badness.o
49style2-with-badness: $(STYLE2BADNESSOBJS)
50	-$(LINK.c)
51
52# A basic use of TLS that uses the addq mem/reg --> leaq mem,reg variant
53PROGS +=	style1
54STYLE1OBJS =	style1-main.o style1-func.o
55style1: $(STYLE1OBJS)
56	$(LINK.c)
57
58# A copy of style1-func that uses %r13 in the TLS sequence and thus excercises
59# the REX transitions. of the addq mem,reg --> leaq mem,reg variant
60PROGS +=	style1-with-r13
61STYLE1R13OBJS =	style1-main.o style1-func-with-r13.o
62style1-with-r13: $(STYLE1R13OBJS)
63	$(LINK.c)
64
65# A copy of style1-func that uses %r12 to test the addq mem,reg --> addq imm,reg variant
66PROGS +=	style1-with-r12
67STYLE1R12OBJS =	style1-main.o style1-func-with-r12.o
68style1-with-r12: $(STYLE1R12OBJS)
69	$(LINK.c)
70
71all:	$(PROGS)
72
73clobber clean:
74	rm -f $(PROGS) $(STYLE1OBJS) $(STYLE1R13OBJS) $(STYLE1R12OBJS) \
75	    $(STYLE2OBJS) $(STYLE2R13OBJS) $(STYLE2R12OBJS) $(STYLE2BADNESSOBJS)
76
77fail: style2-with-badness FRC
78
79FRC:
80