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>
22 /*----------------------------------------------------------------------*/
50 [SYM_UNION] = {'u', "union"},
61 /*----------------------------------------------------------------------*/
135 /*----------------------------------------------------------------------*/
157 for (sym = symtab[h]; sym; sym = sym->hash_next) in find_symbol()
158 if (map_to_ns(sym->type) == map_to_ns(ns) && in find_symbol()
159 strcmp(name, sym->name) == 0 && in find_symbol()
160 sym->is_declared) in find_symbol()
163 if (exact && sym && sym->type != ns) in find_symbol()
172 return ((sym->type == SYM_STRUCT || in is_unknown_symbol()
173 sym->type == SYM_UNION || in is_unknown_symbol()
174 sym->type == SYM_ENUM) && in is_unknown_symbol()
175 (defn = sym->defn) && defn->tag == SYM_NORMAL && in is_unknown_symbol()
176 strcmp(defn->string, "}") == 0 && in is_unknown_symbol()
177 (defn = defn->next) && defn->tag == SYM_NORMAL && in is_unknown_symbol()
178 strcmp(defn->string, "UNKNOWN") == 0 && in is_unknown_symbol()
179 (defn = defn->next) && defn->tag == SYM_NORMAL && in is_unknown_symbol()
180 strcmp(defn->string, "{") == 0); in is_unknown_symbol()
228 for (sym = symtab[h]; sym; sym = sym->hash_next) { in __add_symbol()
229 if (map_to_ns(sym->type) == map_to_ns(type) && in __add_symbol()
230 strcmp(name, sym->name) == 0) { in __add_symbol()
233 else if (sym->type == type && in __add_symbol()
234 equal_list(sym->defn, defn)) { in __add_symbol()
235 if (!sym->is_declared && sym->is_override) { in __add_symbol()
241 sym->is_declared = 1; in __add_symbol()
243 } else if (!sym->is_declared) { in __add_symbol()
244 if (sym->is_override && flag_preserve) { in __add_symbol()
249 sym->is_declared = 1; in __add_symbol()
266 for (psym = &symtab[h]; *psym; psym = &(*psym)->hash_next) { in __add_symbol()
268 *psym = sym->hash_next; in __add_symbol()
272 --nsyms; in __add_symbol()
276 sym->name = name; in __add_symbol()
277 sym->type = type; in __add_symbol()
278 sym->defn = defn; in __add_symbol()
279 sym->expansion_trail = NULL; in __add_symbol()
280 sym->visited = NULL; in __add_symbol()
281 sym->is_extern = is_extern; in __add_symbol()
283 sym->hash_next = symtab[h]; in __add_symbol()
286 sym->is_declared = !is_reference; in __add_symbol()
287 sym->status = status; in __add_symbol()
288 sym->is_override = 0; in __add_symbol()
319 /*----------------------------------------------------------------------*/
323 free(node->string); in free_node()
330 struct string_list *next = s->next; in free_list()
341 newnode->string = xstrdup(string); in mk_node()
342 newnode->tag = SYM_NORMAL; in mk_node()
343 newnode->next = NULL; in mk_node()
356 for (n2 = n; n2->next; n2 = n2->next) in concat_list()
358 n2->next = start; in concat_list()
370 newnode->string = xstrdup(node->string); in copy_node()
371 newnode->tag = node->tag; in copy_node()
384 for (start = start->next; start != end; start = start->next) { in copy_list_range()
385 n->next = copy_node(start); in copy_list_range()
386 n = n->next; in copy_list_range()
388 n->next = NULL; in copy_list_range()
395 if (a->tag != b->tag || strcmp(a->string, b->string)) in equal_list()
397 a = a->next; in equal_list()
398 b = b->next; in equal_list()
427 if (node.string >= buffer + sizeof(buffer) - 1) { in read_node()
463 if (sym && sym->tag == SYM_NORMAL && in read_reference()
464 !strcmp(sym->string, "override")) { in read_reference()
472 if (def && def->tag == SYM_NORMAL && in read_reference()
473 !strcmp(def->string, "extern")) { in read_reference()
479 def->next = defn; in read_reference()
483 subsym = add_reference_symbol(xstrdup(sym->string), sym->tag, in read_reference()
485 subsym->is_override = is_override; in read_reference()
492 if (symbol_types[list->tag].n) { in print_node()
493 putc(symbol_types[list->tag].n, f); in print_node()
496 fputs(list->string, f); in print_node()
511 while ((tmp = tmp->next) != NULL) in print_list()
516 tmp2 = e - 1; in print_list()
518 (*tmp2--) = list; in print_list()
519 while ((list = list->next) != NULL) in print_list()
520 *(tmp2--) = list; in print_list()
530 struct string_list *list = sym->defn; in expand_and_crc_sym()
539 while ((tmp = tmp->next) != NULL) in expand_and_crc_sym()
544 tmp2 = e - 1; in expand_and_crc_sym()
546 *(tmp2--) = list; in expand_and_crc_sym()
547 while ((list = list->next) != NULL) in expand_and_crc_sym()
548 *(tmp2--) = list; in expand_and_crc_sym()
555 switch (cur->tag) { in expand_and_crc_sym()
558 fprintf(debugfile, "%s ", cur->string); in expand_and_crc_sym()
559 crc = partial_crc32(cur->string, crc); in expand_and_crc_sym()
565 subsym = find_symbol(cur->string, cur->tag, 0); in expand_and_crc_sym()
567 if (subsym->expansion_trail) { in expand_and_crc_sym()
569 fprintf(debugfile, "%s ", cur->string); in expand_and_crc_sym()
570 crc = partial_crc32(cur->string, crc); in expand_and_crc_sym()
573 subsym->expansion_trail = expansion_trail; in expand_and_crc_sym()
582 subsym = find_symbol(cur->string, cur->tag, 0); in expand_and_crc_sym()
587 symbol_types[cur->tag].name, in expand_and_crc_sym()
588 cur->string); in expand_and_crc_sym()
590 (symbol_types[cur->tag].name), in expand_and_crc_sym()
591 mk_node(cur->string), in expand_and_crc_sym()
596 add_symbol(cur->string, cur->tag, n, 0); in expand_and_crc_sym()
598 if (subsym->expansion_trail) { in expand_and_crc_sym()
601 symbol_types[cur->tag].name, in expand_and_crc_sym()
602 cur->string); in expand_and_crc_sym()
605 crc = partial_crc32(symbol_types[cur->tag].name, in expand_and_crc_sym()
608 crc = partial_crc32(cur->string, crc); in expand_and_crc_sym()
611 subsym->expansion_trail = expansion_trail; in expand_and_crc_sym()
622 if (!sym->visited) { in expand_and_crc_sym()
624 end = &sym->visited; in expand_and_crc_sym()
625 sym->visited = (struct symbol *)-1L; in expand_and_crc_sym()
646 expansion_trail = (struct symbol *)-1L; in export_symbol()
648 sym->expansion_trail = expansion_trail; in export_symbol()
653 while (sym != (struct symbol *)-1L) { in export_symbol()
654 struct symbol *n = sym->expansion_trail; in export_symbol()
656 if (sym->status != STATUS_UNCHANGED) { in export_symbol()
665 print_type_name(sym->type, sym->name); in export_symbol()
666 if (sym->status == STATUS_DEFINED) in export_symbol()
672 sym->expansion_trail = 0; in export_symbol()
685 /*----------------------------------------------------------------------*/
718 fputs("Usage:\n" "genksyms [-adDTwqhVR] > /path/to/.tmp_obj.ver\n" "\n" in genksyms_usage()
719 " -d, --debug Increment the debug level (repeatable)\n" in genksyms_usage()
720 " -D, --dump Dump expanded symbol defs (for debugging only)\n" in genksyms_usage()
721 " -r, --reference file Read reference symbols from a file\n" in genksyms_usage()
722 " -T, --dump-types file Dump expanded types into file\n" in genksyms_usage()
723 " -p, --preserve Preserve reference modversions or fail\n" in genksyms_usage()
724 " -w, --warnings Enable warnings\n" in genksyms_usage()
725 " -q, --quiet Disable warnings (default)\n" in genksyms_usage()
726 " -h, --help Print this message\n" in genksyms_usage()
727 " -V, --version Print the release version\n" in genksyms_usage()
742 {"dump-types", 1, 0, 'T'}, in main()
812 while (visited_symbols != (struct symbol *)-1L) { in main()
815 if (sym->is_override) in main()
817 if (symbol_types[sym->type].n) { in main()
818 putc(symbol_types[sym->type].n, dumpfile); in main()
821 fputs(sym->name, dumpfile); in main()
823 if (sym->is_extern) in main()
825 print_list(dumpfile, sym->defn); in main()
828 visited_symbols = sym->visited; in main()
829 sym->visited = NULL; in main()