[lld] Casts in lld COFF driver

Hi Rui,

When building lld with a gcc compiler I get cast errors on |= for characteristics

What kinds of casts are acceptable to use in lld to be accepted to fix this

[ 82%] [ 82%] C:/msys64/home/Martell/MINGW-packages/mingw-w64-clang-git/src/llvm/tools/lld/COFF/Writer.cpp: In member function ‘void lld::coff::OutputSection::addPermissions(uint32_t)’:
C:/msys64/home/Martell/MINGW-packages/mingw-w64-clang-git/src/llvm/tools/lld/COFF/Writer.cpp:87:26: error: no match for ‘operator|=’ (operand types are ‘llvm::support::ulittle32_t {aka llvm::support::detail::packed_endian_specific_integral<unsigned int, (llvm::support::endianness)1u, 1u>}’ and ‘uint32_t {aka unsigned int}’)
Header.Characteristics |= C & PermMask;
^
Built target X86CommonTableGen
Built target LLVMPasses
C:/msys64/home/Martell/MINGW-packages/mingw-w64-clang-git/src/llvm/tools/lld/COFF/Writer.cpp: In member function ‘void lld::coff::Writer::writeHeader()’:
C:/msys64/home/Martell/MINGW-packages/mingw-w64-clang-git/src/llvm/tools/lld/COFF/Writer.cpp:245:25: error: no match for ‘operator|=’ (operand types are ‘llvm::support::ulittle16_t {aka llvm::support::detail::packed_endian_specific_integral<short unsigned int, (llvm::support::endianness)1u, 1u>}’ and ‘llvm::COFF::Characteristics’)
COFF->Characteristics |= IMAGE_FILE_LARGE_ADDRESS_AWARE;
^
C:/msys64/home/Martell/MINGW-packages/mingw-w64-clang-git/src/llvm/tools/lld/COFF/Writer.cpp:247:27: error: no match for ‘operator|=’ (operand types are ‘llvm::support::ulittle16_t {aka llvm::support::detail::packed_endian_specific_integral<short unsigned int, (llvm::support::endianness)1u, 1u>}’ and ‘llvm::COFF::Characteristics’)
COFF->Characteristics |= IMAGE_FILE_RELOCS_STRIPPED;
^

Many Thanks

Martell

Hi Martell,

I added these operators recently. Did you synchronize your llvm (not lld) repository to head?