mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-23 14:44:20 -06:00
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>
This commit is contained in:
parent
f91a49c65d
commit
b9940f0e0d
6 changed files with 120 additions and 73 deletions
17
src/ctr.h
Normal file
17
src/ctr.h
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue