mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
dtc: implement labels on property data
Extend the parser grammer to allow labels before or after any property data (string, cell list, or byte list), and any byte or cell within the property data. Store the labels using the same linked list structure as node references, but using a parallel list. When writing assembly output emit global labels as offsets from the start of the definition of the data. Note that the alignment for a cell list is done as part of the opening < delimiter, not the = or , before it. To label a cell after a string or byte list put the label inside the cell list. For example, prop = zero: [ aa bb ], two: < four: 1234 > eight: ; will produce labels with offsets 0, 2, 4, and 8 bytes from the beginning of the data for property prop. Signed-off-by: Milton Miller <miltonm@bga.com>
This commit is contained in:
parent
ac6a5e26b4
commit
6a99b13132
4 changed files with 60 additions and 12 deletions
5
dtc.h
5
dtc.h
|
@ -111,10 +111,10 @@ struct data {
|
|||
char *val;
|
||||
int asize;
|
||||
struct fixup *refs;
|
||||
struct fixup *labels;
|
||||
};
|
||||
|
||||
#define empty_data \
|
||||
((struct data){.len = 0, .val = NULL, .asize = 0, .refs = NULL})
|
||||
#define empty_data ((struct data){ /* all .members = 0 or NULL */ })
|
||||
|
||||
void fixup_free(struct fixup *f);
|
||||
void data_free(struct data d);
|
||||
|
@ -135,6 +135,7 @@ struct data data_append_zeroes(struct data d, int len);
|
|||
struct data data_append_align(struct data d, int align);
|
||||
|
||||
struct data data_add_fixup(struct data d, char *ref);
|
||||
struct data data_add_label(struct data d, char *label);
|
||||
|
||||
int data_is_one_string(struct data d);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue