# -*- Python -*-

import os

# Setup config name.
config.name = 'Scudo' + config.name_suffix

# Setup source root.
config.test_source_root = os.path.dirname(__file__)

# Path to the static library
base_lib = os.path.join(config.compiler_rt_libdir,
                        "libclang_rt.scudo-%s.a" % config.target_arch)
whole_archive = "-Wl,-whole-archive %s -Wl,-no-whole-archive " % base_lib

# Test suffixes.
config.suffixes = ['.c', '.cc', '.cpp']

# C flags.
c_flags = ([config.target_cflags] +
           ["-std=c++11",
           "-pthread",
           "-fPIE",
           "-pie",
           "-O0",
           "-UNDEBUG",
           "-Wl,--gc-sections"])

def build_invocation(compile_flags):                                            
  return " " + " ".join([config.clang] + compile_flags) + " "                   

# Add clang substitutions.
config.substitutions.append( ("%clang_scudo ",
                              build_invocation(c_flags) + whole_archive) )

# Hardened Allocator tests are currently supported on Linux only.
if config.host_os not in ['Linux']:
   config.unsupported = True

# -*- Python -*-

import os

# Setup config name.
config.name = 'Scudo' + config.name_suffix

# Setup source root.
config.test_source_root = os.path.dirname(__file__)

# Path to the static library
base_lib = os.path.join(config.compiler_rt_libdir,
                        "libclang_rt.scudo-%s.a" % config.target_arch)
whole_archive = "-Wl,-whole-archive %s -Wl,-no-whole-archive " % base_lib

# Test suffixes.
config.suffixes = ['.c', '.cc', '.cpp']

# C flags.
c_flags = ([config.target_cflags] +
           ["-std=c++11",
           "-pthread",
           "-fPIE",
           "-pie",
           "-O0",
           "-UNDEBUG",
           "-ldl",
           "-lrt",
           "-Wl,--gc-sections"])

def build_invocation(compile_flags):                                            
  return " " + " ".join([config.clang] + compile_flags) + " "                   

# Add clang substitutions.
config.substitutions.append( ("%clang_scudo ",
                              build_invocation(c_flags) + whole_archive) )

# Hardened Allocator tests are currently supported on Linux only.
if config.host_os not in ['Linux']:
   config.unsupported = True

Fix standalone compiler-rt test breakage
[scudo] Fix standalone compiler-rt test breakage

Summary:
Apparently "test standalone compiler-rt" still requires -ldl and -lrt for
Scudo even with --gc-sections. I am not entirely sure why, so if anybody has
some input, feel free to chime in.

In the meantime, add again those two to fix the test.

Reviewers: kcc, alekseyshl

Reviewed By: kcc

Subscribers: Hahnfeld, dberris, llvm-commits

Differential Revision: https://reviews.llvm.org/D29527

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@294199 91177308-0d34-0410-b5e6-96231b3b80d8
