File tree Expand file tree Collapse file tree 2 files changed +35
-10
lines changed Expand file tree Collapse file tree 2 files changed +35
-10
lines changed Original file line number Diff line number Diff line change @@ -2149,9 +2149,23 @@ printELFCapRelocations(const ELFObjectFile<ELFT> *Obj) {
2149
2149
uint64_t Perms =
2150
2150
support::endian::read<TargetUint, ELFT::TargetEndianness, 1 >(
2151
2151
entry + 4 *sizeof (TargetUint));
2152
- bool isFunction = Perms & (UINT64_C (1 ) << ((sizeof (TargetUint) * 8 ) - 1 ));
2153
- bool isConstant = Perms & (UINT64_C (1 ) << ((sizeof (TargetUint) * 8 ) - 2 ));
2154
- // Perms &= 0xffffffff;
2152
+ const uint64_t Function = UINT64_C (1 ) << ((sizeof (TargetUint) * 8 ) - 1 );
2153
+ const uint64_t Constant = UINT64_C (1 ) << ((sizeof (TargetUint) * 8 ) - 2 );
2154
+ StringRef PermStr;
2155
+ switch (Perms) {
2156
+ case 0 :
2157
+ PermStr = " " ;
2158
+ break ;
2159
+ case Constant:
2160
+ PermStr = " (Constant)" ;
2161
+ break ;
2162
+ case Function:
2163
+ PermStr = " (Function)" ;
2164
+ break ;
2165
+ default :
2166
+ PermStr = " (Unknown)" ;
2167
+ break ;
2168
+ }
2155
2169
StringRef Symbol = " <Unnamed symbol>" ;
2156
2170
if (SymbolNames.find (Base) != SymbolNames.end ())
2157
2171
Symbol = SymbolNames[Base];
@@ -2160,8 +2174,7 @@ printELFCapRelocations(const ELFObjectFile<ELFT> *Obj) {
2160
2174
<< " )\t Offset: " << format (AddrFmt.data (), Offset)
2161
2175
<< " \t Length: " << format (AddrFmt.data (), Length)
2162
2176
<< " \t Permissions: " << format (PermsFmt.data (), Perms)
2163
- << (isFunction ? " (Function)\n "
2164
- : (isConstant ? " (Constant)\n " : " \n " ));
2177
+ << PermStr << " \n " ;
2165
2178
}
2166
2179
outs () << " \n " ;
2167
2180
}
Original file line number Diff line number Diff line change @@ -3439,11 +3439,23 @@ template <class ELFT> void ELFDumper<ELFT>::printCheriCapRelocs() {
3439
3439
uint64_t Perms =
3440
3440
support::endian::read<TargetUint, ELFT::TargetEndianness, 1 >(
3441
3441
entry + 4 *sizeof (TargetUint));
3442
- bool isFunction = Perms & (UINT64_C (1 ) << ((sizeof (TargetUint) * 8 ) - 1 ));
3443
- bool isReadOnly = Perms & (UINT64_C (1 ) << ((sizeof (TargetUint) * 8 ) - 2 ));
3444
- const char *PermStr =
3445
- isFunction ? " Function" : (isReadOnly ? " Constant" : " Object" );
3446
- // Perms &= 0xffffffff;
3442
+ const uint64_t Function = UINT64_C (1 ) << ((sizeof (TargetUint) * 8 ) - 1 );
3443
+ const uint64_t Constant = UINT64_C (1 ) << ((sizeof (TargetUint) * 8 ) - 2 );
3444
+ StringRef PermStr;
3445
+ switch (Perms) {
3446
+ case 0 :
3447
+ PermStr = " Object" ;
3448
+ break ;
3449
+ case Constant:
3450
+ PermStr = " Constant" ;
3451
+ break ;
3452
+ case Function:
3453
+ PermStr = " Function" ;
3454
+ break ;
3455
+ default :
3456
+ PermStr = " Unknown" ;
3457
+ break ;
3458
+ }
3447
3459
std::string BaseSymbol;
3448
3460
if (Base == 0 ) {
3449
3461
// Base is 0 -> either it is really NULL or (more likely) there is a
You can’t perform that action at this time.
0 commit comments