Print this page
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/assert-deflib/test-deflib.sh
          +++ new/usr/src/test/elf-tests/tests/assert-deflib/test-deflib.sh
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17  #
  18   18  # This test validates that the -zassert-deflib option of ld(1) works correctly.
  19   19  # It requires that some cc is in your path and that you have passed in the path
  20   20  # to the proto area with the new version of libld.so.4. One thing that we have
  21   21  # to do is be careful with using LD_LIBRARY_PATH. Setting LD_LIBRARY_PATH does
  22   22  # not change the default search path so we want to make sure that we use a
  23   23  # different ISA (e.g. 32-bit vs 64-bit) from the binary we're generating.
  24   24  #
  25   25  unalias -a
  26   26  
       27 +TESTDIR=$(dirname $0)
       28 +
  27   29  sh_path=
  28   30  sh_lib="lib"
  29   31  sh_lib64="$sh_lib/64"
  30   32  sh_soname="libld.so.4"
  31      -sh_cc="cc"
       33 +sh_cc="gcc"
  32   34  sh_cflags="-m32"
  33      -sh_file="link.c"
       35 +sh_file="${TESTDIR}/link.c"
  34   36  sh_arg0=$(basename $0)
  35   37  
  36   38  function fatal
  37   39  {
  38   40          local msg="$*"
  39   41          [[ -z "$msg" ]] && msg="failed"
  40   42          echo "$sh_arg0: $msg" >&2
  41   43          exit 1
  42   44  }
  43   45  
↓ open down ↓ 22 lines elided ↑ open up ↑
  66   68  
  67   69          echo $3
  68   70          LD_LIBRARY_PATH_64="$sh_path/$sh_lib64" $sh_cc $sh_cflags $sh_file $1
  69   71          if [[ $? -eq $2 ]]; then
  70   72                  printf "success\n\n"
  71   73          else
  72   74                  fatal $4
  73   75          fi
  74   76  }
  75   77  
  76      -sh_path=$1
  77      -[[ -z "$1" ]] && fatal "<proto root>"
       78 +sh_path=${1:-/}
  78   79  validate
  79   80  
  80   81  run "-Wl,-zassert-deflib" 0 \
  81   82      "Testing basic compilation succeeds with warnings..." \
  82   83      "failed to compile with warnings"
  83   84  
  84   85  run "-Wl,-zassert-deflib -Wl,-zfatal-warnings" 1 \
  85   86      "Testing basic compilation fails if warning are fatal..." \
  86   87      "linking succeeeded, expected failure"
  87   88  
↓ open down ↓ 48 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX