firmware: Map '@' in filenames to '_' in symbols.

'@' is not a valid character in symbol names and can sometimes appear
in path names.

Reviewed by:	imp, markj
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D35480
This commit is contained in:
John Baldwin 2022-06-14 10:50:51 -07:00
parent 1442fed7e2
commit 628a4156a7
2 changed files with 5 additions and 5 deletions

View File

@ -199,7 +199,7 @@ ${_firmw:C/\:.*$/.fwo/:T}: ${_firmw:C/\:.*$//} ${SYSDIR}/kern/firmw.S
${CC:N${CCACHE_BIN}} -c -x assembler-with-cpp -DLOCORE \
${CFLAGS} ${WERROR} \
-DFIRMW_FILE="${.ALLSRC:M*${_firmw:C/\:.*$//}}" \
-DFIRMW_SYMBOL="${_firmw:C/\:.*$//:C/[-.\/]/_/g}" \
-DFIRMW_SYMBOL="${_firmw:C/\:.*$//:C/[-.\/@]/_/g}" \
${SYSDIR}/kern/firmw.S -o ${.TARGET}
OBJS+= ${_firmw:C/\:.*$/.fwo/:T}

View File

@ -143,8 +143,8 @@ if (opt_l) {
for (file_i = 0; file_i < num_files; file_i++) {
symb = filenames[file_i];
# '-', '.' and '/' are converted to '_'
gsub(/-|\.|\//, "_", symb);
# '-', '.', '/', and '@' are converted to '_'
gsub(/-|\.|\/|@/, "_", symb);
printc("extern char _binary_" symb "_start[], _binary_" symb "_end[];");
}
@ -172,8 +172,8 @@ for (file_i = 0; file_i < num_files; file_i++) {
short = shortnames[file_i];
symb = filenames[file_i];
version = versions[file_i];
# '-', '.' and '/' are converted to '_'
gsub(/-|\.|\//, "_", symb);
# '-', '.', '/', and '@' are converted to '_'
gsub(/-|\.|\/|@/, "_", symb);
reg = "\t\tfp = ";
reg = reg "firmware_register(\"" short "\", _binary_" symb "_start , ";