macho-dump has this. And some tests rely on it.
I ported it to llvm-readobj as part of the bigger project "let's deprecate macho-dump".
Example output:
% /exps/llvm2/build/./bin/llvm-mc -triple armv7-apple-darwin10 -filetype=obj -o - < /exps/llvm2/test/MC/MachO/ARM/data-in-code.s | /exps/llvm2/build/bin/llvm-readobj -macho-dice
File: <stdin>
Format: Mach-O arm
Arch: arm
AddressSize: 32bit
DataInCode {
Data offset: 300
Data size: 32
Data Regions [
DICE {
Index: 0
Offset: 0
Length: 4
Kind: 1
}
DICE {
Index: 1
Offset: 4
Length: 4
Kind: 4
}
DICE {
Index: 2
Offset: 8
Length: 2
Kind: 3
}
DICE {
Index: 3
Offset: 10
Length: 1
Kind: 2
}
]}
Feedback really appreciated.