]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gas local label and dollar label handling
authorAlan Modra <amodra@gmail.com>
Wed, 16 Feb 2022 02:41:55 +0000 (13:11 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 16 Feb 2022 11:35:24 +0000 (22:05 +1030)
commit19f7966ede4658568e273c6786e2dad73c2223e1
tree09632187cfc3a869120841aca97c52d7d962066b
parent969f6a63c0ae7779fd5eb10af25fd4ab810feef8
gas local label and dollar label handling

Much of the gas source and older BFD source use "long" for function
parameters and variables, when other types would be more appropriate.
This patch fixes one of those cases.  Dollar labels and numeric local
labels do not need large numbers.  Small positive itegers are usually
all that is required.  Due to allowing longs, it was possible for
fb_label_name and dollar_label_name to overflow their buffers.

* symbols.c: Delete unnecessary forward declarations.
(dollar_labels, dollar_label_instances): Use unsigned int.
(dollar_label_defined, dollar_label_instance): Likewise.
(define_dollar_label): Likewise.
(fb_low_counter, fb_labels, fb_label_instances): Likewise.
(fb_label_instance_inc, fb_label_instance): Likewise.
(fb_label_count, fb_label_max): Make them size_t.
(dollar_label_name, fb_label_name): Rewrite using sprintf.
* symbols.h (dollar_label_defined): Update prototype.
(define_dollar_label, dollar_label_name): Likewise.
(fb_label_instance_inc, fb_label_name): Likewise.
* config/bfin-lex.l (yylex): Remove unnecessary casts.
* expr.c (integer_constant): Likewise.
* read.c (read_a_source_file): Limit numeric label range to int.
gas/config/bfin-lex.l
gas/expr.c
gas/read.c
gas/symbols.c
gas/symbols.h