Looks like # is supported in version scripts and the VERSION command in a linker script, but is unsupported outside of VERSION. VERSION { # meow meow GLIBC_2.2.5 { global: __free_hook; local: *; }; GLIBC_2.2.6 { global: __nanosleep; local: *; }; } ld.bfd a.o -T a.ver -shared Moving the comment outside: % ld.bfd a.o -T a.ver -shared -o a.so ld.bfd:a.ver:1: ignoring invalid character `#' in expression ld.bfd:a.ver:1: syntax error gold and ld.lld support # outside of VERSION in a linker script.
The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cc9faa98adc96788e6a560c685bbd8e69c856cb7 commit cc9faa98adc96788e6a560c685bbd8e69c856cb7 Author: Alan Modra <amodra@gmail.com> Date: Wed Aug 11 18:16:35 2021 +0930 PR28198, Support # as linker script comment marker PR 28198 * ldlex.l: Combine rules for handling newline, whitespace and comments. Extend # comment handling to all states.
Easy fix