Lines Matching +full:u +full:- +full:blox
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 Based on original work by Bjorn Ekwall <bj0rn@blox.se>
24 /*----------------------------------------------------------------------*/
52 [SYM_UNION] = {'u', "union"},
63 /*----------------------------------------------------------------------*/
137 /*----------------------------------------------------------------------*/
159 for (sym = symtab[h]; sym; sym = sym->hash_next) in find_symbol()
160 if (map_to_ns(sym->type) == map_to_ns(ns) && in find_symbol()
161 strcmp(name, sym->name) == 0 && in find_symbol()
162 sym->is_declared) in find_symbol()
165 if (exact && sym && sym->type != ns) in find_symbol()
174 return ((sym->type == SYM_STRUCT || in is_unknown_symbol()
175 sym->type == SYM_UNION || in is_unknown_symbol()
176 sym->type == SYM_ENUM) && in is_unknown_symbol()
177 (defn = sym->defn) && defn->tag == SYM_NORMAL && in is_unknown_symbol()
178 strcmp(defn->string, "}") == 0 && in is_unknown_symbol()
179 (defn = defn->next) && defn->tag == SYM_NORMAL && in is_unknown_symbol()
180 strcmp(defn->string, "UNKNOWN") == 0 && in is_unknown_symbol()
181 (defn = defn->next) && defn->tag == SYM_NORMAL && in is_unknown_symbol()
182 strcmp(defn->string, "{") == 0); in is_unknown_symbol()
230 for (sym = symtab[h]; sym; sym = sym->hash_next) { in __add_symbol()
231 if (map_to_ns(sym->type) == map_to_ns(type) && in __add_symbol()
232 strcmp(name, sym->name) == 0) { in __add_symbol()
235 else if (sym->type == type && in __add_symbol()
236 equal_list(sym->defn, defn)) { in __add_symbol()
237 if (!sym->is_declared && sym->is_override) { in __add_symbol()
243 sym->is_declared = 1; in __add_symbol()
245 } else if (!sym->is_declared) { in __add_symbol()
246 if (sym->is_override && flag_preserve) { in __add_symbol()
251 sym->is_declared = 1; in __add_symbol()
268 for (psym = &symtab[h]; *psym; psym = &(*psym)->hash_next) { in __add_symbol()
270 *psym = sym->hash_next; in __add_symbol()
274 --nsyms; in __add_symbol()
278 sym->name = name; in __add_symbol()
279 sym->type = type; in __add_symbol()
280 sym->defn = defn; in __add_symbol()
281 sym->expansion_trail = NULL; in __add_symbol()
282 sym->visited = NULL; in __add_symbol()
283 sym->is_extern = is_extern; in __add_symbol()
285 sym->hash_next = symtab[h]; in __add_symbol()
288 sym->is_declared = !is_reference; in __add_symbol()
289 sym->status = status; in __add_symbol()
290 sym->is_override = 0; in __add_symbol()
321 /*----------------------------------------------------------------------*/
325 free(node->string); in free_node()
332 struct string_list *next = s->next; in free_list()
343 newnode->string = xstrdup(string); in mk_node()
344 newnode->tag = SYM_NORMAL; in mk_node()
345 newnode->next = NULL; in mk_node()
358 for (n2 = n; n2->next; n2 = n2->next) in concat_list()
360 n2->next = start; in concat_list()
372 newnode->string = xstrdup(node->string); in copy_node()
373 newnode->tag = node->tag; in copy_node()
386 for (start = start->next; start != end; start = start->next) { in copy_list_range()
387 n->next = copy_node(start); in copy_list_range()
388 n = n->next; in copy_list_range()
390 n->next = NULL; in copy_list_range()
397 if (a->tag != b->tag || strcmp(a->string, b->string)) in equal_list()
399 a = a->next; in equal_list()
400 b = b->next; in equal_list()
429 if (node.string >= buffer + sizeof(buffer) - 1) { in read_node()
465 if (sym && sym->tag == SYM_NORMAL && in read_reference()
466 !strcmp(sym->string, "override")) { in read_reference()
474 if (def && def->tag == SYM_NORMAL && in read_reference()
475 !strcmp(def->string, "extern")) { in read_reference()
481 def->next = defn; in read_reference()
485 subsym = add_reference_symbol(xstrdup(sym->string), sym->tag, in read_reference()
487 subsym->is_override = is_override; in read_reference()
494 if (symbol_types[list->tag].n) { in print_node()
495 putc(symbol_types[list->tag].n, f); in print_node()
498 fputs(list->string, f); in print_node()
513 while ((tmp = tmp->next) != NULL) in print_list()
518 tmp2 = e - 1; in print_list()
520 (*tmp2--) = list; in print_list()
521 while ((list = list->next) != NULL) in print_list()
522 *(tmp2--) = list; in print_list()
532 struct string_list *list = sym->defn; in expand_and_crc_sym()
541 while ((tmp = tmp->next) != NULL) in expand_and_crc_sym()
546 tmp2 = e - 1; in expand_and_crc_sym()
548 *(tmp2--) = list; in expand_and_crc_sym()
549 while ((list = list->next) != NULL) in expand_and_crc_sym()
550 *(tmp2--) = list; in expand_and_crc_sym()
557 switch (cur->tag) { in expand_and_crc_sym()
560 fprintf(debugfile, "%s ", cur->string); in expand_and_crc_sym()
561 crc = partial_crc32(cur->string, crc); in expand_and_crc_sym()
567 subsym = find_symbol(cur->string, cur->tag, 0); in expand_and_crc_sym()
569 if (subsym->expansion_trail) { in expand_and_crc_sym()
571 fprintf(debugfile, "%s ", cur->string); in expand_and_crc_sym()
572 crc = partial_crc32(cur->string, crc); in expand_and_crc_sym()
575 subsym->expansion_trail = expansion_trail; in expand_and_crc_sym()
584 subsym = find_symbol(cur->string, cur->tag, 0); in expand_and_crc_sym()
589 symbol_types[cur->tag].name, in expand_and_crc_sym()
590 cur->string); in expand_and_crc_sym()
592 (symbol_types[cur->tag].name), in expand_and_crc_sym()
593 mk_node(cur->string), in expand_and_crc_sym()
598 add_symbol(cur->string, cur->tag, n, 0); in expand_and_crc_sym()
600 if (subsym->expansion_trail) { in expand_and_crc_sym()
603 symbol_types[cur->tag].name, in expand_and_crc_sym()
604 cur->string); in expand_and_crc_sym()
607 crc = partial_crc32(symbol_types[cur->tag].name, in expand_and_crc_sym()
610 crc = partial_crc32(cur->string, crc); in expand_and_crc_sym()
613 subsym->expansion_trail = expansion_trail; in expand_and_crc_sym()
624 if (!sym->visited) { in expand_and_crc_sym()
626 end = &sym->visited; in expand_and_crc_sym()
627 sym->visited = (struct symbol *)-1L; in expand_and_crc_sym()
648 expansion_trail = (struct symbol *)-1L; in export_symbol()
650 sym->expansion_trail = expansion_trail; in export_symbol()
655 while (sym != (struct symbol *)-1L) { in export_symbol()
656 struct symbol *n = sym->expansion_trail; in export_symbol()
658 if (sym->status != STATUS_UNCHANGED) { in export_symbol()
667 print_type_name(sym->type, sym->name); in export_symbol()
668 if (sym->status == STATUS_DEFINED) in export_symbol()
674 sym->expansion_trail = 0; in export_symbol()
687 /*----------------------------------------------------------------------*/
720 fputs("Usage:\n" "genksyms [-adDTwqhVR] > /path/to/.tmp_obj.ver\n" "\n" in genksyms_usage()
722 " -s, --symbol-prefix Select symbol prefix\n" in genksyms_usage()
723 " -d, --debug Increment the debug level (repeatable)\n" in genksyms_usage()
724 " -D, --dump Dump expanded symbol defs (for debugging only)\n" in genksyms_usage()
725 " -r, --reference file Read reference symbols from a file\n" in genksyms_usage()
726 " -T, --dump-types file Dump expanded types into file\n" in genksyms_usage()
727 " -p, --preserve Preserve reference modversions or fail\n" in genksyms_usage()
728 " -w, --warnings Enable warnings\n" in genksyms_usage()
729 " -q, --quiet Disable warnings (default)\n" in genksyms_usage()
730 " -h, --help Print this message\n" in genksyms_usage()
731 " -V, --version Print the release version\n" in genksyms_usage()
733 " -s Select symbol prefix\n" in genksyms_usage()
734 " -d Increment the debug level (repeatable)\n" in genksyms_usage()
735 " -D Dump expanded symbol defs (for debugging only)\n" in genksyms_usage()
736 " -r file Read reference symbols from a file\n" in genksyms_usage()
737 " -T file Dump expanded types into file\n" in genksyms_usage()
738 " -p Preserve reference modversions or fail\n" in genksyms_usage()
739 " -w Enable warnings\n" in genksyms_usage()
740 " -q Disable warnings (default)\n" in genksyms_usage()
741 " -h Print this message\n" in genksyms_usage()
742 " -V Print the release version\n" in genksyms_usage()
759 {"dump-types", 1, 0, 'T'}, in main()
832 while (visited_symbols != (struct symbol *)-1L) { in main()
835 if (sym->is_override) in main()
837 if (symbol_types[sym->type].n) { in main()
838 putc(symbol_types[sym->type].n, dumpfile); in main()
841 fputs(sym->name, dumpfile); in main()
843 if (sym->is_extern) in main()
845 print_list(dumpfile, sym->defn); in main()
848 visited_symbols = sym->visited; in main()
849 sym->visited = NULL; in main()