llvm-project
llvm-project copied to clipboard
libunwind compile error on x32 using clang/clang++
When built with clang libunwind fails with:
/mnt/vmtmp/una/repo/llvm/libunwind/src/DwarfParser.hpp:480:8: error: non-constant-expression cannot be narrowed from type 'link_reg_t' (aka 'unsigned long long') to 'pint_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
480 | upToPC - fdeInfo.pcStart}};
| ^~~~~~~~~~~~~~~~~~~~~~~~
/mnt/vmtmp/una/repo/llvm/libunwind/src/DwarfInstructions.hpp:220:33: note: in instantiation of function template specialization 'libunwind::CFI_Parser<libunwind::LocalAddressSpace>::parseFDEInstructions<libunwind::Registers_x86_64>' requested here
220 | if (CFI_Parser<A>::template parseFDEInstructions<R>(
| ^
/mnt/vmtmp/una/repo/llvm/libunwind/src/UnwindCursor.hpp:1079:37: note: in instantiation of member function 'libunwind::DwarfInstructions<libunwind::LocalAddressSpace, libunwind::Registers_x86_64>::stepWithDwarf' requested here
1079 | return DwarfInstructions<A, R>::stepWithDwarf(
| ^
/mnt/vmtmp/una/repo/llvm/libunwind/src/UnwindCursor.hpp:3279:20: note: in instantiation of member function 'libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_x86_64>::stepWithDwarfFDE' requested here
3279 | result = this->stepWithDwarfFDE(stage2);
| ^
/mnt/vmtmp/una/repo/llvm/libunwind/src/UnwindCursor.hpp:1384:21: note: in instantiation of member function 'libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_x86_64>::step' requested here
1384 | UnwindCursor<A, R>::UnwindCursor(unw_context_t *context, A &as)
| ^
/mnt/vmtmp/una/repo/llvm/libunwind/src/libunwind.cpp:87:7: note: in instantiation of member function 'libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_x86_64>::UnwindCursor' requested here
87 | UnwindCursor<LocalAddressSpace, REGISTER_KIND>(
| ^
/mnt/vmtmp/una/repo/llvm/libunwind/src/DwarfParser.hpp:480:8: note: insert an explicit cast to silence this issue
480 | upToPC - fdeInfo.pcStart}};
| ^~~~~~~~~~~~~~~~~~~~~~~~
| static_cast<pint_t>( )
In file included from /mnt/vmtmp/una/repo/llvm/libunwind/src/libunwind.cpp:30:
/mnt/vmtmp/una/repo/llvm/libunwind/src/AddressSpace.hpp:669:46: error: non-constant-expression cannot be narrowed from type 'link_reg_t' (aka 'unsigned long long') to 'uintptr_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
669 | dl_iterate_cb_data cb_data = {this, &info, targetAddr};
| ^~~~~~~~~~
/mnt/vmtmp/una/repo/llvm/libunwind/src/UnwindCursor.hpp:2779:30: note: in instantiation of function template specialization 'libunwind::LocalAddressSpace::findUnwindSections<libunwind::Registers_x86_64>' requested here
2779 | if (_addressSpace.template findUnwindSections<R>(pc, sects)) {
| ^
/mnt/vmtmp/una/repo/llvm/libunwind/src/UnwindCursor.hpp:1384:21: note: in instantiation of member function 'libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_x86_64>::setInfoBasedOnIPRegister' requested here
1384 | UnwindCursor<A, R>::UnwindCursor(unw_context_t *context, A &as)
| ^
/mnt/vmtmp/una/repo/llvm/libunwind/src/libunwind.cpp:87:7: note: in instantiation of member function 'libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_x86_64>::UnwindCursor' requested here
87 | UnwindCursor<LocalAddressSpace, REGISTER_KIND>(
| ^
/mnt/vmtmp/una/repo/llvm/libunwind/src/AddressSpace.hpp:669:46: note: insert an explicit cast to silence this issue
669 | dl_iterate_cb_data cb_data = {this, &info, targetAddr};
| ^~~~~~~~~~
| static_cast<uintptr_t>( )
2 errors generated.
if you clone https://github.com/daunabomba/una.git and then
git remote rename origin una una/una.py --int --build will reproduce the error