SecBSD's official ports repository

This commit is contained in:
purplerain 2023-08-16 22:26:55 +00:00
commit 2c0afcbbf3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
64331 changed files with 5339189 additions and 0 deletions

View file

@ -0,0 +1,14 @@
Use 'cc' as default compiler.
Index: make_ffi.py
--- make_ffi.py.orig
+++ make_ffi.py
@@ -76,7 +76,7 @@ def doit(vex_path):
errs = []
for cpp in cpplist:
cmd = [cpp, '-I' + vex_path, os.path.join("pyvex_c", "pyvex.h")]
- if cpp in ('cl', 'clang', 'gcc', 'cc', 'clang++', 'g++'):
+ if cpp in ('cc'):
cmd.append("-E")
try:
p = subprocess.Popen(cmd,

View file

@ -0,0 +1,28 @@
- Don't overwrite CFLAGS
- Force use of shared libraries
Index: pyvex_c/Makefile
--- pyvex_c/Makefile.orig
+++ pyvex_c/Makefile
@@ -33,18 +33,17 @@ sq = $(subst $(sp),?,$1)
CC?=gcc
AR=ar
INCFLAGS=-I "$(VEX_INCLUDE_PATH)"
-CFLAGS=-g -O2 -Wall -shared -fPIC -std=c99 $(INCFLAGS)
OBJECTS=pyvex.o logging.o analysis.o postprocess.o
HEADERS=pyvex.h
-all: $(LIBRARY_FILE) $(STATIC_LIBRARY_FILE)
+all: $(LIBRARY_FILE)
%.o: %.c
$(CC) -c $(CFLAGS) $<
-$(LIBRARY_FILE): $(OBJECTS) $(HEADERS) $(call sq,$(VEX_LIB_PATH)/libvex.a)
- $(CC) $(CFLAGS) -o $(LIBRARY_FILE) $(OBJECTS) "$(VEX_LIB_PATH)/libvex.a" $(LDFLAGS)
+$(LIBRARY_FILE): $(OBJECTS) $(HEADERS)
+ $(CC) $(CFLAGS) -o $(LIBRARY_FILE) $(OBJECTS) $(LDFLAGS)
$(STATIC_LIBRARY_FILE): $(OBJECTS) $(HEADERS) $(call sq,$(VEX_LIB_PATH)/libvex.a)
$(AR) rcs $(STATIC_LIBRARY_FILE) $(OBJECTS)

View file

@ -0,0 +1,26 @@
- match the guest with amd64-cx16-rdtscp-sse3-avx-avx2-bmi
as the host and guest hardware capabilities much be equal for VEX to work
- remove LZCNT from the guest as the host might not support it on OpenBSD
Index: pyvex_c/pyvex.c
--- pyvex_c/pyvex.c.orig
+++ pyvex_c/pyvex.c
@@ -175,6 +175,10 @@ int vex_init() {
#error "Unsupported host arch"
#endif
+ // Set the host capabilities to match the guest as defined
+ // in vex_prepare_vai().
+ vai_host.hwcaps = 0xf60;
+
vta.archinfo_host = vai_host;
//
@@ -222,7 +226,6 @@ static void vex_prepare_vai(VexArch arch, VexArchInfo
case VexArchAMD64:
vai->hwcaps = VEX_HWCAPS_AMD64_SSE3 |
VEX_HWCAPS_AMD64_CX16 |
- VEX_HWCAPS_AMD64_LZCNT |
VEX_HWCAPS_AMD64_AVX |
VEX_HWCAPS_AMD64_RDTSCP |
VEX_HWCAPS_AMD64_BMI |

View file

@ -0,0 +1,69 @@
- Remove urllib import which is not required when not downloading the sources
- Fix various paths to LibVEX
- Skip building a local copy of LibVEX
- Force use of the static library
Index: setup.py
--- setup.py.orig
+++ setup.py
@@ -7,7 +7,6 @@ import glob
import tarfile
import multiprocessing
import time
-from urllib.request import urlopen
import platform
if bytes is str:
@@ -45,7 +44,7 @@ else:
VEX_LIB_NAME = "vex" # can also be vex-amd64-linux
-VEX_PATH = os.path.abspath(os.path.join(PROJECT_DIR, '..', 'vex'))
+VEX_PATH = '${LOCALBASE}'
if not os.path.exists(VEX_PATH):
VEX_PATH = os.path.join(PROJECT_DIR, 'vex')
@@ -87,14 +86,14 @@ def _build_vex():
def _build_pyvex():
e = os.environ.copy()
- e['VEX_LIB_PATH'] = VEX_PATH
- e['VEX_INCLUDE_PATH'] = os.path.join(VEX_PATH, 'pub')
- e['VEX_LIB_FILE'] = os.path.join(VEX_PATH, 'libvex.lib')
+ e['VEX_LIB_PATH'] = os.path.join(VEX_PATH, 'lib')
+ e['VEX_INCLUDE_PATH'] = os.path.join(VEX_PATH, 'include/angr-vex')
+ e['VEX_LIB_FILE'] = os.path.join(VEX_PATH, 'lib/libvex.so')
cmd1 = ['nmake', '/f', 'Makefile-msvc']
cmd2 = ['make', '-j', str(multiprocessing.cpu_count())]
cmd3 = ['gmake', '-j', str(multiprocessing.cpu_count())]
- for cmd in (cmd1, cmd2, cmd3):
+ for cmd in (cmd3):
try:
if subprocess.call(cmd, cwd='pyvex_c', env=e) == 0:
break
@@ -112,7 +111,6 @@ def _shuffle_files():
pyvex_c_dir = os.path.join(PROJECT_DIR, 'pyvex_c')
shutil.copy(os.path.join(pyvex_c_dir, LIBRARY_FILE), LIB_DIR)
- shutil.copy(os.path.join(pyvex_c_dir, STATIC_LIBRARY_FILE), LIB_DIR)
shutil.copy(os.path.join(pyvex_c_dir, 'pyvex.h'), INCLUDE_DIR)
for f in glob.glob(os.path.join(VEX_PATH, 'pub', '*')):
shutil.copy(f, INCLUDE_DIR)
@@ -138,14 +136,14 @@ def _copy_sources():
def _build_ffi():
import make_ffi
try:
- make_ffi.doit(os.path.join(VEX_PATH, 'pub'))
+ make_ffi.doit(os.path.join(VEX_PATH, 'include/angr-vex'))
except Exception as e:
print(repr(e))
raise
class build(_build):
def run(self):
- self.execute(_build_vex, (), msg="Building libVEX")
+ #self.execute(_build_vex, (), msg="Building libVEX")
self.execute(_build_pyvex, (), msg="Building libpyvex")
self.execute(_shuffle_files, (), msg="Copying libraries and headers")
self.execute(_build_ffi, (), msg="Creating CFFI defs file")