xref: /freebsd/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_solaris.h (revision 02e9120893770924227138ba49df1edb3896112a)
1 //===-- sanitizer_solaris.h -------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a part of Sanitizer runtime. It contains Solaris-specific
10 // definitions.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef SANITIZER_SOLARIS_H
15 #define SANITIZER_SOLARIS_H
16 
17 #include "sanitizer_internal_defs.h"
18 
19 #if SANITIZER_SOLARIS
20 
21 #include <link.h>
22 
23 namespace __sanitizer {
24 
25 // Beginning of declaration from OpenSolaris/Illumos
26 // $SRC/cmd/sgs/include/rtld.h.
27 struct Rt_map {
28   Link_map rt_public;
29   const char *rt_pathname;
30   ulong_t rt_padstart;
31   ulong_t rt_padimlen;
32   ulong_t rt_msize;
33   uint_t rt_flags;
34   uint_t rt_flags1;
35   ulong_t rt_tlsmodid;
36 };
37 
38 // Structure matching the Solaris 11.4 struct dl_phdr_info used to determine
39 // presence of dlpi_tls_modid field at runtime.  Cf. Solaris 11.4
40 // dl_iterate_phdr(3C), Example 2.
41 struct dl_phdr_info_test {
42   ElfW(Addr) dlpi_addr;
43   const char *dlpi_name;
44   const ElfW(Phdr) * dlpi_phdr;
45   ElfW(Half) dlpi_phnum;
46   u_longlong_t dlpi_adds;
47   u_longlong_t dlpi_subs;
48   size_t dlpi_tls_modid;
49   void *dlpi_tls_data;
50 };
51 
52 }  // namespace __sanitizer
53 
54 #endif  // SANITIZER_SOLARIS
55 
56 #endif  // SANITIZER_SOLARIS_H
57