From 6a99b1313208d05ba6d9c5d3858230d9ee785f8c Mon Sep 17 00:00:00 2001 From: Milton Miller Date: Sat, 7 Jul 2007 01:18:51 -0500 Subject: 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 --- dtc-parser.y | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'dtc-parser.y') diff --git a/dtc-parser.y b/dtc-parser.y index d88cbf1..19bc58e 100644 --- a/dtc-parser.y +++ b/dtc-parser.y @@ -131,9 +131,11 @@ propdata: propdataprefix DT_STRING { $$ = data_merge($1, $2); } $$ = data_merge(data_append_align($1, sizeof(cell_t)), $3); } | propdataprefix '[' bytestring ']' { $$ = data_merge($1, $3); } + | propdata DT_LABEL { $$ = data_add_label($1, $2); } ; propdataprefix: propdata ',' { $$ = $1; } + | propdataprefix DT_LABEL { $$ = data_add_label($1, $2); } | /* empty */ { $$ = empty_data; } ; @@ -150,10 +152,12 @@ celllist: celllist opt_cell_base DT_CELL { | celllist DT_REF { $$ = data_append_cell(data_add_fixup($1, $2), -1); } + | celllist DT_LABEL { $$ = data_add_label($1, $2); } | /* empty */ { $$ = empty_data; } ; bytestring: bytestring DT_BYTE { $$ = data_append_byte($1, $2); } + | bytestring DT_LABEL { $$ = data_add_label($1, $2); } | /* empty */ { $$ = empty_data; } ; -- cgit v1.2.1