aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Faust <david.faust@oracle.com>2023-07-24 14:57:35 -0700
committerDavid Faust <david.faust@oracle.com>2023-07-26 08:22:31 -0700
commit9d1e07bd19fb126edf5ac8bb098777bee9364ca5 (patch)
tree93fcff9d437f813bdcea11d6d20b5d85caae48e0
parent200546f1a33bd4e6d81d5bdef8d26836a7504bdb (diff)
downloadbinutils-9d1e07bd19fb126edf5ac8bb098777bee9364ca5.zip
binutils-9d1e07bd19fb126edf5ac8bb098777bee9364ca5.tar.gz
binutils-9d1e07bd19fb126edf5ac8bb098777bee9364ca5.tar.bz2
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.
-rw-r--r--gas/config/tc-bpf.c2
-rw-r--r--gas/doc/c-bpf.texi5
2 files changed, 3 insertions, 4 deletions
diff --git a/gas/config/tc-bpf.c b/gas/config/tc-bpf.c
index 095b05a..faa809c 100644
--- a/gas/config/tc-bpf.c
+++ b/gas/config/tc-bpf.c
@@ -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";
diff --git a/gas/doc/c-bpf.texi b/gas/doc/c-bpf.texi
index 6683ff9..868a358 100644
--- a/gas/doc/c-bpf.texi
+++ b/gas/doc/c-bpf.texi
@@ -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.