summaryrefslogtreecommitdiff
path: root/dtc.h
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2021-07-27 12:30:19 -0600
committerDavid Gibson <david@gibson.dropbear.id.au>2021-09-25 16:11:41 +1000
commitff3a30c115ad7354689dc7858604356ecb7f9b1c (patch)
treebf9715256abd733baa9314d1a35a853df9255646 /dtc.h
parent5eb5927d81ee6036f45c4e1bd89ae66ed325d721 (diff)
downloaddevice-tree-compiler-ff3a30c115ad7354689dc7858604356ecb7f9b1c.tar.gz
asm: Use .asciz and .ascii instead of .string
We use the .string pseudo-op both in some of our test assembly files and in our -Oasm output. We expect this to emit a \0 terminated string into the .o file. However for certain targets (e.g. HP PA-RISC) it doesn't include the \0. Use .asciz instead, which explicitly does what we want. There's also one place we can use .ascii (which explicitly emits a string *without* \0 termination) instead of multiple .byte directives. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'dtc.h')
-rw-r--r--dtc.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/dtc.h b/dtc.h
index cf2c6ac..0a1f549 100644
--- a/dtc.h
+++ b/dtc.h
@@ -116,6 +116,12 @@ enum markertype {
TYPE_UINT64,
TYPE_STRING,
};
+
+static inline bool is_type_marker(enum markertype type)
+{
+ return type >= TYPE_UINT8;
+}
+
extern const char *markername(enum markertype markertype);
struct marker {
@@ -140,7 +146,22 @@ struct data {
for_each_marker(m) \
if ((m)->type == (t))
-size_t type_marker_length(struct marker *m);
+static inline struct marker *next_type_marker(struct marker *m)
+{
+ for_each_marker(m)
+ if (is_type_marker(m->type))
+ break;
+ return m;
+}
+
+static inline size_t type_marker_length(struct marker *m)
+{
+ struct marker *next = next_type_marker(m->next);
+
+ if (next)
+ return next->offset - m->offset;
+ return 0;
+}
void data_free(struct data d);