From dfa0359b50b0866584549d3920e62285dc61ba48 Mon Sep 17 00:00:00 2001
From: Justine Tunney <jtunney@gmail.com>
Date: Mon, 6 Sep 2021 19:34:57 -0700
Subject: [PATCH] Exclude .py files in MODE=rel / tiny

---
 build/config.mk            | 5 +++++
 third_party/python/pyobj.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/build/config.mk b/build/config.mk
index 0576b887f..58e21e199 100644
--- a/build/config.mk
+++ b/build/config.mk
@@ -74,6 +74,9 @@ CONFIG_CCFLAGS +=		\
 TARGET_ARCH ?=			\
 	-msse3
 
+PYFLAGS +=			\
+	-B
+
 endif
 
 # Asan Mode
@@ -157,6 +160,8 @@ CONFIG_CCFLAGS +=		\
 	-fno-align-loops
 TARGET_ARCH ?=			\
 	-msse3
+PYFLAGS +=			\
+	-B
 endif
 
 # Linux-Only Tiny Mode
diff --git a/third_party/python/pyobj.c b/third_party/python/pyobj.c
index 5dc459935..a1788e1ee 100644
--- a/third_party/python/pyobj.c
+++ b/third_party/python/pyobj.c
@@ -69,7 +69,7 @@ FLAGS\n\
   -O0          don't optimize [default]\n\
   -O1          remove debug statements\n\
   -O2          remove debug statements and docstrings\n\
-  -b           binary only (don't include .py file)\n\
+  -B           binary only (don't include .py file)\n\
   -0           zip uncompressed\n\
   -n           do nothing\n\
   -h           help\n\
@@ -222,6 +222,7 @@ static void
 GetOpts(int argc, char *argv[])
 {
     int opt;
+    image_base = IMAGE_BASE_VIRTUAL;
     while ((opt = getopt(argc, argv, "hn0Bb:O:o:C:P:")) != -1) {
         switch (opt) {
         case 'B':