aboutsummaryrefslogtreecommitdiffstats
path: root/src/ctr.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-05-25 16:54:31 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-05-26 12:32:02 -0400
commitb9940f0e0d7b5b4fae497cc80d14948a091d71c2 (patch)
tree298cfa831794e04980424932a4a03e8f387f689f /src/ctr.h
parentf91a49c65d3ea7dd4679b192d8421f621f057304 (diff)
downloadkutter-b9940f0e0d7b5b4fae497cc80d14948a091d71c2.tar.gz
kutter-b9940f0e0d7b5b4fae497cc80d14948a091d71c2.tar.xz
kutter-b9940f0e0d7b5b4fae497cc80d14948a091d71c2.zip
build: Avoid linker magic in compile_time_request.c unique id generation
Avoid generating unique ids via memory locations and linker scripts. Instead, generate them using code produced by buildcommands.py. Utilize gcc's ability to perform static string comparisons at compile time to produce a unique id for each unique string. This fixes a build failure on ARM introduced in 142b92b8. It also reduces the complexity of the build. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/ctr.h')
-rw-r--r--src/ctr.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ctr.h b/src/ctr.h
new file mode 100644
index 00000000..3396644c
--- /dev/null
+++ b/src/ctr.h
@@ -0,0 +1,17 @@
+#ifndef __CTR_H
+#define __CTR_H
+// Definitions for creating compile time requests. The DECL_CTR macro
+// produces requests (text strings) that are placed in a special
+// section of the intermediate object files. The requests are then
+// extracted during the build and passed to scripts/buildcommand.py.
+// The scripts/buildcommand.py code then generates
+// out/compile_time_request.c from these requests.
+
+#include "compiler.h" // __section
+
+// Declare a compile time request
+#define DECL_CTR(REQUEST) \
+ static char __PASTE(_DECLS_, __LINE__)[] __attribute__((used)) \
+ __section(".compile_time_request") = (REQUEST)
+
+#endif // ctr.h