Print this page
10366 ld(1) should support GNU-style linker sets
10367 ld(1) tests should be a real test suite
10368 want an ld(1) regression test for i386 LD tls transition (10267)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/test/ld/x64/tls/ie/x64-ie-test.sh
          +++ new/usr/src/test/elf-tests/tests/tls/x64/ie/x64-ie-test.sh
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13  # Copyright 2012, Richard Lowe.
  14   14  
  15   15  function grep_test {
  16   16      name=$1
  17   17      pattern=$2
  18   18  
  19   19      if /usr/bin/fgrep -q "${pattern}"; then
  20   20          print -u2 "pass: $name"
  21   21      else
  22   22          print -u2 "FAIL: $name"
       23 +        exit 1
  23   24      fi
  24      -}        
       25 +}
  25   26  
  26   27  function dis_test {
  27   28      name=${1}
  28   29      func=${2}
  29   30      file=${3}
  30   31      pattern=${4}
  31   32  
  32   33      dis -F${func} ${file} | grep_test "${name}" "${pattern}"
  33   34  }
  34   35  
  35      -make PROTO="${1}"
       36 +if [[ -z $ELF_TESTS ]]; then
       37 +    print -u2 "Don't know where the test data is rooted";
       38 +    exit 1;
       39 +fi
       40 +
       41 +make -f ${ELF_TESTS}/tests/tls/x64/ie/Makefile.test
  36   42  
  37   43  dis_test "addq-->leaq 1" func style1 \
  38   44      'func+0x10: 48 8d 92 f8 ff ff  leaq   -0x8(%rdx),%rdx'
  39   45  dis_test "addq-->leaq 2" func style1 \
  40   46      'func+0x17: 48 8d b6 f0 ff ff  leaq   -0x10(%rsi),%rsi'
  41   47  
  42   48  dis_test "addq-->leaq w/REX 1" func style1-with-r13 \
  43   49      'func+0x10: 48 8d 92 f8 ff ff  leaq   -0x8(%rdx),%rdx'
  44   50  dis_test "addq-->leaq w/REX 2" func style1-with-r13 \
  45   51      'func+0x17: 4d 8d ad f0 ff ff  leaq   -0x10(%r13),%r13'
↓ open down ↓ 5 lines elided ↑ open up ↑
  51   57  
  52   58  dis_test "movq-->movq" main style2 \
  53   59      'main+0x4:  48 c7 c6 f0 ff ff  movq   $-0x10,%rsi   <0xfffffffffffffff0>'
  54   60  
  55   61  dis_test "movq-->movq w/REX" main style2-with-r13 \
  56   62      'main+0x4:  49 c7 c5 f0 ff ff  movq   $-0x10,%r13   <0xfffffffffffffff0>'
  57   63  
  58   64  dis_test "movq-->movq incase of SIB" main style2-with-r12 \
  59   65      'main+0x4:  49 c7 c4 f0 ff ff  movq   $-0x10,%r12   <0xfffffffffffffff0>'
  60   66  
  61      -make PROTO="${1}" fail 2>&1 | grep_test "bad insn sequence" \
       67 +make -f ${ELF_TESTS}/tests/tls/x64/ie/Makefile.test fail 2>&1 | grep_test "bad insn sequence" \
  62   68     'ld: fatal: relocation error: R_AMD64_TPOFF32: file style2-with-badness.o: symbol foo: section .text: offset 0x7, relocation against unknown TLS instruction sequence'
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX