<commit_before>// Test that dynamically allocated TLS space is included in the root set.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0:use_ld_allocations=0"
// RUN: %clangxx %s -DBUILD_DSO -fPIC -shared -o %t-so.so
// RUN: %clangxx_lsan %s -o %t
// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=1" %run %t 2>&1
// RUN: LSAN_OPTIONS="" %run %t 2>&1

#ifndef BUILD_DSO
#include <assert.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "sanitizer_common/print_address.h"

int main(int argc, char *argv[]) {
  std::string path = std::string(argv[0]) + "-so.so";

  void *handle = dlopen(path.c_str(), RTLD_LAZY);
  assert(handle != 0);
  typedef void **(* store_t)(void *p);
  store_t StoreToTLS = (store_t)dlsym(handle, "StoreToTLS");
  assert(dlerror() == 0);

  void *p = malloc(1337);
  // If we don't  know about dynamic TLS, we will return a false leak above.
  void **p_in_tls = StoreToTLS(p);<commit_msg>Disable use_tls_dynamic on 32-bit linux<commit_after>// Test that dynamically allocated TLS space is included in the root set.
// RUN: LSAN_BASE="detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0:use_ld_allocations=0"
// RUN: %clangxx %s -DBUILD_DSO -fPIC -shared -o %t-so.so
// RUN: %clangxx_lsan %s -o %t
// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=0" not %run %t 2>&1 | FileCheck %s
// RUN: LSAN_OPTIONS=$LSAN_BASE:"use_tls=1" %run %t 2>&1
// RUN: LSAN_OPTIONS="" %run %t 2>&1
// UNSUPPORTED: i386-linux,i686-linux

#ifndef BUILD_DSO
#include <assert.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "sanitizer_common/print_address.h"

int main(int argc, char *argv[]) {
  std::string path = std::string(argv[0]) + "-so.so";

  void *handle = dlopen(path.c_str(), RTLD_LAZY);
  assert(handle != 0);
  typedef void **(* store_t)(void *p);
  store_t StoreToTLS = (store_t)dlsym(handle, "StoreToTLS");
  assert(dlerror() == 0);

  void *p = malloc(1337);
  // If we don't  know about dynamic TLS, we will return a false leak above.
  void **p_in_tls = StoreToTLS(p);
{'fraction_non_alphanumeric': 0.16975023126734506, 'fraction_numerical': 0.022201665124884366, 'mean_word_length': 4.830188679245283, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4426001', 'n_tokens_mistral': 927, 'n_tokens_neox': 865, 'n_words': 215}