Skip to content

Commit

Permalink
[compiler-rt] Remove a few workarounds for FreeBSD 9.x (#76263)
Browse files Browse the repository at this point in the history
Support for FreeBSD 11.x was dropped so garbage collect a few FreeBSD
9.x workarounds and make 12.x the oldest supported releases.
  • Loading branch information
brad0 authored Dec 29, 2023
1 parent dafd178 commit 450be89
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 193 deletions.
8 changes: 0 additions & 8 deletions compiler-rt/lib/asan/asan_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
# include "asan_premap_shadow.h"
# include "asan_thread.h"
# include "sanitizer_common/sanitizer_flags.h"
# include "sanitizer_common/sanitizer_freebsd.h"
# include "sanitizer_common/sanitizer_hash.h"
# include "sanitizer_common/sanitizer_libc.h"
# include "sanitizer_common/sanitizer_procmaps.h"
Expand All @@ -59,13 +58,6 @@ extern Elf_Dyn _DYNAMIC;
extern ElfW(Dyn) _DYNAMIC[];
# endif

// x86-64 FreeBSD 9.2 and older define 'ucontext_t' incorrectly in
// 32-bit mode.
# if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32) && \
__FreeBSD_version <= 902001 // v9.2
# define ucontext_t xucontext_t
# endif

typedef enum {
ASAN_RT_VERSION_UNDEFINED = 0,
ASAN_RT_VERSION_DYNAMIC,
Expand Down
9 changes: 0 additions & 9 deletions compiler-rt/lib/asan/asan_new_delete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ COMMENT_EXPORT("??_V@YAXPAX@Z") // operator delete[]

using namespace __asan;

// FreeBSD prior v9.2 have wrong definition of 'size_t'.
// http://svnweb.freebsd.org/base?view=revision&revision=232261
#if SANITIZER_FREEBSD && SANITIZER_WORDSIZE == 32
#include <sys/param.h>
#if __FreeBSD_version <= 902001 // v9.2
#define size_t unsigned
#endif // __FreeBSD_version
#endif // SANITIZER_FREEBSD && SANITIZER_WORDSIZE == 32

// This code has issues on OSX.
// See https://github.com/google/sanitizers/issues/131.

Expand Down
12 changes: 0 additions & 12 deletions compiler-rt/lib/builtins/fp_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@
#include <stdbool.h>
#include <stdint.h>

// x86_64 FreeBSD prior v9.3 define fixed-width types incorrectly in
// 32-bit mode.
#if defined(__FreeBSD__) && defined(__i386__)
#include <sys/param.h>
#if __FreeBSD_version < 903000 // v9.3
#define uint64_t unsigned long long
#define int64_t long long
#undef UINT64_C
#define UINT64_C(c) (c##ULL)
#endif
#endif

#if defined SINGLE_PRECISION

typedef uint16_t half_rep_t;
Expand Down
1 change: 0 additions & 1 deletion compiler-rt/lib/memprof/memprof_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "memprof_internal.h"
#include "memprof_thread.h"
#include "sanitizer_common/sanitizer_flags.h"
#include "sanitizer_common/sanitizer_freebsd.h"
#include "sanitizer_common/sanitizer_libc.h"
#include "sanitizer_common/sanitizer_procmaps.h"

Expand Down
1 change: 0 additions & 1 deletion compiler-rt/lib/sanitizer_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ set(SANITIZER_IMPL_HEADERS
sanitizer_flags.h
sanitizer_flags.inc
sanitizer_flat_map.h
sanitizer_freebsd.h
sanitizer_fuchsia.h
sanitizer_getauxval.h
sanitizer_hash.h
Expand Down
137 changes: 0 additions & 137 deletions compiler-rt/lib/sanitizer_common/sanitizer_freebsd.h

This file was deleted.

9 changes: 2 additions & 7 deletions compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
# include <sched.h>
# include <signal.h>
# include <sys/mman.h>
# include <sys/param.h>
# if !SANITIZER_SOLARIS
# include <sys/ptrace.h>
# endif
Expand Down Expand Up @@ -136,9 +135,7 @@ const int FUTEX_WAKE_PRIVATE = FUTEX_WAKE | FUTEX_PRIVATE_FLAG;
# define SANITIZER_LINUX_USES_64BIT_SYSCALLS 0
# endif

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

# if SANITIZER_FREEBSD && __FreeBSD_version >= 1200000
# if SANITIZER_FREEBSD
# define SANITIZER_USE_GETENTROPY 1
# else
# define SANITIZER_USE_GETENTROPY 0
# endif

namespace __sanitizer {
Expand Down
8 changes: 1 addition & 7 deletions compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# include "sanitizer_common.h"
# include "sanitizer_file.h"
# include "sanitizer_flags.h"
# include "sanitizer_freebsd.h"
# include "sanitizer_getauxval.h"
# include "sanitizer_glibc_version.h"
# include "sanitizer_linux.h"
Expand All @@ -46,7 +45,6 @@
# endif

# if SANITIZER_FREEBSD
# include <osreldate.h>
# include <pthread_np.h>
# include <sys/auxv.h>
# include <sys/sysctl.h>
Expand Down Expand Up @@ -629,11 +627,7 @@ void GetThreadStackAndTls(bool main, uptr *stk_addr, uptr *stk_size,

# if !SANITIZER_FREEBSD
typedef ElfW(Phdr) Elf_Phdr;
# elif SANITIZER_WORDSIZE == 32 && __FreeBSD_version <= 902001 // v9.2
# define Elf_Phdr XElf32_Phdr
# define dl_phdr_info xdl_phdr_info
# define dl_iterate_phdr(c, b) xdl_iterate_phdr((c), (b))
# endif // !SANITIZER_FREEBSD
# endif

struct DlIteratePhdrData {
InternalMmapVectorNoCtor<LoadedModule> *modules;
Expand Down
11 changes: 0 additions & 11 deletions compiler-rt/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
#include "sanitizer_platform.h"
#if SANITIZER_FREEBSD || SANITIZER_NETBSD
#include "sanitizer_common.h"
#if SANITIZER_FREEBSD
#include "sanitizer_freebsd.h"
#endif
#include "sanitizer_procmaps.h"

// clang-format off
Expand All @@ -29,14 +26,6 @@

#include <limits.h>

// Fix 'kinfo_vmentry' definition on FreeBSD prior v9.2 in 32-bit mode.
#if SANITIZER_FREEBSD && (SANITIZER_WORDSIZE == 32)
#include <osreldate.h>
#if __FreeBSD_version <= 902001 // v9.2
#define kinfo_vmentry xkinfo_vmentry
#endif
#endif

namespace __sanitizer {

#if SANITIZER_FREEBSD
Expand Down

0 comments on commit 450be89

Please sign in to comment.