Skip to content

Commit 450be89

Browse files
authored
[compiler-rt] Remove a few workarounds for FreeBSD 9.x (#76263)
Support for FreeBSD 11.x was dropped so garbage collect a few FreeBSD 9.x workarounds and make 12.x the oldest supported releases.
1 parent dafd178 commit 450be89

9 files changed

+3
-193
lines changed

compiler-rt/lib/asan/asan_linux.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
# include "asan_premap_shadow.h"
3434
# include "asan_thread.h"
3535
# include "sanitizer_common/sanitizer_flags.h"
36-
# include "sanitizer_common/sanitizer_freebsd.h"
3736
# include "sanitizer_common/sanitizer_hash.h"
3837
# include "sanitizer_common/sanitizer_libc.h"
3938
# include "sanitizer_common/sanitizer_procmaps.h"
@@ -59,13 +58,6 @@ extern Elf_Dyn _DYNAMIC;
5958
extern ElfW(Dyn) _DYNAMIC[];
6059
# endif
6160

62-
// x86-64 FreeBSD 9.2 and older define 'ucontext_t' incorrectly in
63-
// 32-bit mode.
64-
# if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32) && \
65-
__FreeBSD_version <= 902001 // v9.2
66-
# define ucontext_t xucontext_t
67-
# endif
68-
6961
typedef enum {
7062
ASAN_RT_VERSION_UNDEFINED = 0,
7163
ASAN_RT_VERSION_DYNAMIC,

compiler-rt/lib/asan/asan_new_delete.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,6 @@ COMMENT_EXPORT("??_V@YAXPAX@Z") // operator delete[]
4848

4949
using namespace __asan;
5050

51-
// FreeBSD prior v9.2 have wrong definition of 'size_t'.
52-
// http://svnweb.freebsd.org/base?view=revision&revision=232261
53-
#if SANITIZER_FREEBSD && SANITIZER_WORDSIZE == 32
54-
#include <sys/param.h>
55-
#if __FreeBSD_version <= 902001 // v9.2
56-
#define size_t unsigned
57-
#endif // __FreeBSD_version
58-
#endif // SANITIZER_FREEBSD && SANITIZER_WORDSIZE == 32
59-
6051
// This code has issues on OSX.
6152
// See https://github.com/google/sanitizers/issues/131.
6253

compiler-rt/lib/builtins/fp_lib.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,6 @@
2626
#include <stdbool.h>
2727
#include <stdint.h>
2828

29-
// x86_64 FreeBSD prior v9.3 define fixed-width types incorrectly in
30-
// 32-bit mode.
31-
#if defined(__FreeBSD__) && defined(__i386__)
32-
#include <sys/param.h>
33-
#if __FreeBSD_version < 903000 // v9.3
34-
#define uint64_t unsigned long long
35-
#define int64_t long long
36-
#undef UINT64_C
37-
#define UINT64_C(c) (c##ULL)
38-
#endif
39-
#endif
40-
4129
#if defined SINGLE_PRECISION
4230

4331
typedef uint16_t half_rep_t;

compiler-rt/lib/memprof/memprof_linux.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "memprof_internal.h"
2121
#include "memprof_thread.h"
2222
#include "sanitizer_common/sanitizer_flags.h"
23-
#include "sanitizer_common/sanitizer_freebsd.h"
2423
#include "sanitizer_common/sanitizer_libc.h"
2524
#include "sanitizer_common/sanitizer_procmaps.h"
2625

compiler-rt/lib/sanitizer_common/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ set(SANITIZER_IMPL_HEADERS
151151
sanitizer_flags.h
152152
sanitizer_flags.inc
153153
sanitizer_flat_map.h
154-
sanitizer_freebsd.h
155154
sanitizer_fuchsia.h
156155
sanitizer_getauxval.h
157156
sanitizer_hash.h

compiler-rt/lib/sanitizer_common/sanitizer_freebsd.h

Lines changed: 0 additions & 137 deletions
This file was deleted.

compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
# include <sched.h>
5959
# include <signal.h>
6060
# include <sys/mman.h>
61-
# include <sys/param.h>
6261
# if !SANITIZER_SOLARIS
6362
# include <sys/ptrace.h>
6463
# endif
@@ -136,9 +135,7 @@ const int FUTEX_WAKE_PRIVATE = FUTEX_WAKE | FUTEX_PRIVATE_FLAG;
136135
# define SANITIZER_LINUX_USES_64BIT_SYSCALLS 0
137136
# endif
138137

139-
// Note : FreeBSD had implemented both
140-
// Linux apis, available from
141-
// future 12.x version most likely
138+
// Note : FreeBSD implemented both Linux and OpenBSD apis.
142139
# if SANITIZER_LINUX && defined(__NR_getrandom)
143140
# if !defined(GRND_NONBLOCK)
144141
# define GRND_NONBLOCK 1
@@ -148,10 +145,8 @@ const int FUTEX_WAKE_PRIVATE = FUTEX_WAKE | FUTEX_PRIVATE_FLAG;
148145
# define SANITIZER_USE_GETRANDOM 0
149146
# endif // SANITIZER_LINUX && defined(__NR_getrandom)
150147

151-
# if SANITIZER_FREEBSD && __FreeBSD_version >= 1200000
148+
# if SANITIZER_FREEBSD
152149
# define SANITIZER_USE_GETENTROPY 1
153-
# else
154-
# define SANITIZER_USE_GETENTROPY 0
155150
# endif
156151

157152
namespace __sanitizer {

compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
# include "sanitizer_common.h"
2222
# include "sanitizer_file.h"
2323
# include "sanitizer_flags.h"
24-
# include "sanitizer_freebsd.h"
2524
# include "sanitizer_getauxval.h"
2625
# include "sanitizer_glibc_version.h"
2726
# include "sanitizer_linux.h"
@@ -46,7 +45,6 @@
4645
# endif
4746

4847
# if SANITIZER_FREEBSD
49-
# include <osreldate.h>
5048
# include <pthread_np.h>
5149
# include <sys/auxv.h>
5250
# include <sys/sysctl.h>
@@ -629,11 +627,7 @@ void GetThreadStackAndTls(bool main, uptr *stk_addr, uptr *stk_size,
629627

630628
# if !SANITIZER_FREEBSD
631629
typedef ElfW(Phdr) Elf_Phdr;
632-
# elif SANITIZER_WORDSIZE == 32 && __FreeBSD_version <= 902001 // v9.2
633-
# define Elf_Phdr XElf32_Phdr
634-
# define dl_phdr_info xdl_phdr_info
635-
# define dl_iterate_phdr(c, b) xdl_iterate_phdr((c), (b))
636-
# endif // !SANITIZER_FREEBSD
630+
# endif
637631

638632
struct DlIteratePhdrData {
639633
InternalMmapVectorNoCtor<LoadedModule> *modules;

compiler-rt/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
#include "sanitizer_platform.h"
1414
#if SANITIZER_FREEBSD || SANITIZER_NETBSD
1515
#include "sanitizer_common.h"
16-
#if SANITIZER_FREEBSD
17-
#include "sanitizer_freebsd.h"
18-
#endif
1916
#include "sanitizer_procmaps.h"
2017

2118
// clang-format off
@@ -29,14 +26,6 @@
2926

3027
#include <limits.h>
3128

32-
// Fix 'kinfo_vmentry' definition on FreeBSD prior v9.2 in 32-bit mode.
33-
#if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32)
34-
#include <osreldate.h>
35-
#if __FreeBSD_version <= 902001 // v9.2
36-
#define kinfo_vmentry xkinfo_vmentry
37-
#endif
38-
#endif
39-
4029
namespace __sanitizer {
4130

4231
#if SANITIZER_FREEBSD

0 commit comments

Comments
 (0)