Index: ELF/InputFiles.cpp =================================================================== --- ELF/InputFiles.cpp +++ ELF/InputFiles.cpp @@ -931,7 +931,7 @@ // characters in a filename are replaced with underscore. std::string S = "_binary_" + MB.getBufferIdentifier().str(); for (size_t I = 0; I < S.size(); ++I) - if (!isalnum(S[I])) + if (!isalnum(static_cast(S[I]))) S[I] = '_'; Symtab->addRegular(Saver.save(S + "_start"), STV_DEFAULT, STT_OBJECT, Index: test/ELF/format-binary-non-ascii.s =================================================================== --- test/ELF/format-binary-non-ascii.s +++ test/ELF/format-binary-non-ascii.s @@ -0,0 +1,15 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t£.o + +# RUN: ld.lld -o %t.elf %t£.o --format=binary %t£.o +# RUN: llvm-readobj -symbols %t.elf | FileCheck %s + +# CHECK: Name: _binary_{{[a-zA-Z0-9_]+}}test_ELF_Output_format_binary_non_ascii_s_tmp___o_start +# CHECK: Name: _binary_{{[a-zA-Z0-9_]+}}test_ELF_Output_format_binary_non_ascii_s_tmp___o_end +# CHECK: Name: _binary_{{[a-zA-Z0-9_]+}}test_ELF_Output_format_binary_non_ascii_s_tmp___o_size + +.text +.align 4 +.globl _start +_start: + nop