bpf: accept # as an inline comment char

This little patch makes the BPF assembler accept '#' as an inline
comment character, which clang -S seems to use.

gas/
	* config/tc-bpf.c (comment_chars): Add '#'.
	* doc/c-bpf.texi (BPF Special Characters): Add note that '#' may
	be used for inline comments.
This commit is contained in:
David Faust 2023-07-24 14:57:35 -07:00
parent 200546f1a3
commit 9d1e07bd19
2 changed files with 3 additions and 4 deletions

View File

@ -53,7 +53,7 @@ struct bpf_insn
unsigned int has_imm64 : 1;
};
const char comment_chars[] = ";";
const char comment_chars[] = ";#";
const char line_comment_chars[] = "#";
const char line_separator_chars[] = "`";
const char EXP_CHARS[] = "eE";

View File

@ -64,9 +64,8 @@ the host endianness is used.
@cindex line comment character, BPF
@cindex BPF line comment character
The presence of a @samp{;} on a line indicates the start of a comment
that extends to the end of the current line. If a @samp{#} appears as
the first character of a line, the whole line is treated as a comment.
The presence of a @samp{;} or a @samp{#} on a line indicates the start
of a comment that extends to the end of the current line.
@cindex statement separator, BPF
Statements and assembly directives are separated by newlines.