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/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 +if [[ -z $ELF_TESTS ]]; then
       28 +    print -u2 "Don't know where the test data is rooted";
       29 +    exit 1;
       30 +fi
       31 +
  27   32  sh_path=
  28   33  sh_lib="lib"
  29   34  sh_lib64="$sh_lib/64"
  30   35  sh_soname="libld.so.4"
  31      -sh_cc="cc"
       36 +sh_cc="gcc"
  32   37  sh_cflags="-m32"
  33      -sh_file="link.c"
       38 +sh_file="${ELF_TESTS}/tests/assert-deflib/link.c"
  34   39  sh_arg0=$(basename $0)
  35   40  
  36   41  function fatal
  37   42  {
  38   43          local msg="$*"
  39   44          [[ -z "$msg" ]] && msg="failed"
  40   45          echo "$sh_arg0: $msg" >&2
  41   46          exit 1
  42   47  }
  43   48  
↓ open down ↓ 22 lines elided ↑ open up ↑
  66   71  
  67   72          echo $3
  68   73          LD_LIBRARY_PATH_64="$sh_path/$sh_lib64" $sh_cc $sh_cflags $sh_file $1
  69   74          if [[ $? -eq $2 ]]; then
  70   75                  printf "success\n\n"
  71   76          else
  72   77                  fatal $4
  73   78          fi
  74   79  }
  75   80  
  76      -sh_path=$1
  77      -[[ -z "$1" ]] && fatal "<proto root>"
       81 +sh_path=${1:-/}
  78   82  validate
  79   83  
  80   84  run "-Wl,-zassert-deflib" 0 \
  81   85      "Testing basic compilation succeeds with warnings..." \
  82   86      "failed to compile with warnings"
  83   87  
  84   88  run "-Wl,-zassert-deflib -Wl,-zfatal-warnings" 1 \
  85   89      "Testing basic compilation fails if warning are fatal..." \
  86   90      "linking succeeeded, expected failure"
  87   91  
↓ open down ↓ 48 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX