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