xref: /titanic_41/usr/src/cmd/sgs/test/ld/x64/tls/ie/Makefile (revision 49f9b365248ee858ee91baa36eab27c5200f6dca)
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
14include $(SRC)/Makefile.master
15
16# We have to use GCC, and only GCC.  The best way is to ask cw(1) which GCC to use.
17CC_CMD =	$(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc -_compiler
18CC =		$(CC_CMD:sh)
19CFLAGS = 	-O1 -m64
20
21LINK.c = env LD_ALTEXEC=$(PROTO)/usr/bin/amd64/ld $(CC) $(CFLAGS) -o $@ $^
22COMPILE.c = $(CC) $(CFLAGS) -c -o $@ $^
23COMPILE.s = $(CC) $(CFLAGS) -c -o $@ $^
24
25.KEEP_STATE:
26
27install default: all
28
29.c.o:
30	$(COMPILE.c)
31
32.s.o:
33	$(COMPILE.s)
34
35# A basic use of TLS that uses the movq m/r --> movq i/r variant
36PROGS += 	style2
37STYLE2OBJS =	style2.o
38style2: $(STYLE2OBJS)
39	$(LINK.c)
40
41# A copy of style2 that uses %r13 in the TLS sequence, and thus excercises the
42# REX transitions of the movq mem,reg -> movq imm,reg variant.
43PROGS +=	style2-with-r13
44STYLE2R13OBJS =	style2-with-r13.o
45style2-with-r13: $(STYLE2R13OBJS)
46	$(LINK.c)
47
48# A copy of style2 that uses %r12 in the TLS sequence, so we can verify that
49# it is _not_ special to this variant
50PROGS +=	style2-with-r12
51STYLE2R12OBJS =	style2-with-r12.o
52style2-with-r12: $(STYLE2R12OBJS)
53	$(LINK.c)
54
55# A copy of style2 that has a R_AMD64_GOTTPOFF relocation with a bad insn sequence
56STYLE2BADNESSOBJS =	style2-with-badness.o
57style2-with-badness: $(STYLE2BADNESSOBJS)
58	-$(LINK.c)
59
60# A basic use of TLS that uses the addq mem/reg --> leaq mem,reg variant
61PROGS +=	style1
62STYLE1OBJS =	style1-main.o style1-func.o
63style1: $(STYLE1OBJS)
64	$(LINK.c)
65
66# A copy of style1-func that uses %r13 in the TLS sequence and thus excercises
67# the REX transitions. of the addq mem,reg --> leaq mem,reg variant
68PROGS +=	style1-with-r13
69STYLE1R13OBJS =	style1-main.o style1-func-with-r13.o
70style1-with-r13: $(STYLE1R13OBJS)
71	$(LINK.c)
72
73# A copy of style1-func that uses %r12 to test the addq mem,reg --> addq imm,reg variant
74PROGS +=	style1-with-r12
75STYLE1R12OBJS =	style1-main.o style1-func-with-r12.o
76style1-with-r12: $(STYLE1R12OBJS)
77	$(LINK.c)
78
79all:	$(PROGS)
80
81clobber clean:
82	rm -f $(PROGS) $(STYLE1OBJS) $(STYLE1R13OBJS) $(STYLE1R12OBJS) \
83	    $(STYLE2OBJS) $(STYLE2R13OBJS) $(STYLE2R12OBJS) $(STYLE2BADNESSOBJS)
84
85fail: style2-with-badness FRC
86
87FRC:
88