summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.inc4
-rw-r--r--src/include/assert.h54
-rw-r--r--src/include/rules.h6
3 files changed, 42 insertions, 22 deletions
diff --git a/Makefile.inc b/Makefile.inc
index 89bb3e423983..a51b73d36ba5 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -411,6 +411,10 @@ CPPFLAGS_common += -include $(src)/commonlib/bsd/include/commonlib/bsd/compiler.
CPPFLAGS_common += -I3rdparty
CPPFLAGS_common += -D__BUILD_DIR__=\"$(obj)\"
+ifeq ($(BUILD_TIMELESS),1)
+CPPFLAGS_common += -D__TIMELESS__
+endif
+
ifeq ($(CONFIG_PCI_OPTION_ROM_RUN_YABEL)$(CONFIG_PCI_OPTION_ROM_RUN_REALMODE),y)
CPPFLAGS_ramstage += -Isrc/device/oprom/include
endif
diff --git a/src/include/assert.h b/src/include/assert.h
index f656d816835a..8c19c1cfee10 100644
--- a/src/include/assert.h
+++ b/src/include/assert.h
@@ -12,31 +12,41 @@
#undef ASSERT
#endif
+/* Do not use filenames nor line numbers on timeless builds, to preserve reproducibility */
+#if ENV_TIMELESS
+#define __ASSERT_FILE__ "(filenames not available on timeless builds)"
+#define __ASSERT_LINE__ 404
+#else
+#define __ASSERT_FILE__ __FILE__
+#define __ASSERT_LINE__ __LINE__
+#endif
+
/* GCC and CAR versions */
-#define ASSERT(x) { \
- if (!(x)) { \
- printk(BIOS_EMERG, "ASSERTION ERROR: file '%s'" \
- ", line %d\n", __FILE__, __LINE__); \
- if (CONFIG(FATAL_ASSERTS)) \
- hlt(); \
- } \
+#define ASSERT(x) { \
+ if (!(x)) { \
+ printk(BIOS_EMERG, \
+ "ASSERTION ERROR: file '%s', line %d\n", \
+ __ASSERT_FILE__, __ASSERT_LINE__); \
+ if (CONFIG(FATAL_ASSERTS)) \
+ hlt(); \
+ } \
}
-
-#define ASSERT_MSG(x, msg) { \
- if (!(x)) { \
- printk(BIOS_EMERG, "ASSERTION ERROR: file '%s'" \
- ", line %d\n", __FILE__, __LINE__); \
- printk(BIOS_EMERG, "%s", msg); \
- if (CONFIG(FATAL_ASSERTS)) \
- hlt(); \
- } \
+#define ASSERT_MSG(x, msg) { \
+ if (!(x)) { \
+ printk(BIOS_EMERG, \
+ "ASSERTION ERROR: file '%s', line %d\n", \
+ __ASSERT_FILE__, __ASSERT_LINE__); \
+ printk(BIOS_EMERG, "%s", msg); \
+ if (CONFIG(FATAL_ASSERTS)) \
+ hlt(); \
+ } \
}
-
-#define BUG() { \
- printk(BIOS_EMERG, "ERROR: BUG ENCOUNTERED at file '%s'"\
- ", line %d\n", __FILE__, __LINE__); \
- if (CONFIG(FATAL_ASSERTS)) \
- hlt(); \
+#define BUG() { \
+ printk(BIOS_EMERG, \
+ "ERROR: BUG ENCOUNTERED at file '%s', line %d\n", \
+ __ASSERT_FILE__, __ASSERT_LINE__); \
+ if (CONFIG(FATAL_ASSERTS)) \
+ hlt(); \
}
#define assert(statement) ASSERT(statement)
diff --git a/src/include/rules.h b/src/include/rules.h
index 160829efa464..2cc54e7942ec 100644
--- a/src/include/rules.h
+++ b/src/include/rules.h
@@ -3,6 +3,12 @@
#ifndef _RULES_H
#define _RULES_H
+#if defined(__TIMELESS__)
+#define ENV_TIMELESS 1
+#else
+#define ENV_TIMELESS 0
+#endif
+
/* Useful helpers to tell whether the code is executing in bootblock,
* romstage, ramstage or SMM.
*/