llvm-project
d38f314f - [BPF] Fix printing of unsigned 32-bit enum values in CO-RE relocations (#249079)

Commit
7 hours ago
[BPF] Fix printing of unsigned 32-bit enum values in CO-RE relocations (#249079) llvm-objdump shows the value of an enumerator in an enumval relocation. The value of a 32-bit enumerator, BTFEnum::Val, is int32_t and was always sign-extended, so a value of an unsigned enum in [0x80000000, 0xffffffff] was printed as a huge 64-bit value: ``` enum U { M = 0x80000000 }; ... __builtin_preserve_enum_value(*(enum U *)M, 1) ... CO-RE <enumval_value> [4] enum U::M = 18446744071562067968 ``` Extend the value according to the signedness of its enum, i.e., sign-extend it if ENUM_SIGNED_FLAG is set, and zero-extend it otherwise: ``` CO-RE <enumval_value> [4] enum U::M = 2147483648 ```
Author
Parents
Loading