DynamoRIO / DynamoRIO/dynamorio
Header order dependency for build_target_arch_type()
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 31
Description
build_target_arch_type() is defined in trace_entry.h
https://github.com/DynamoRIO/dynamorio/blob/1b9e54743d8962bf10d15fefaf4056cc4a6140aa/clients/drcachesim/common/trace_entry.h#L1118
But it is defined conditionally only if dr_defines.h has already defined certain symbols, specifically IF_X64_ELSE
https://github.com/DynamoRIO/dynamorio/blob/1b9e54743d8962bf10d15fefaf4056cc4a6140aa/core/lib/globals_api.h#L534
Otherwise this shows up as a build failure to find build_target_arch_type, which may seem mysterious as the order between trace_entry.h and dr_defines.h (both of which may be transitively included) may not be immediately clear. It is hard to ensure that for all builds dr_defines.h is included before trace_entry.h.
One way to get around this is to wrap build_target_arch_type in a new function implemented in some non-header file like what #7233 did. But eventually we should clean this up so the build_target_arch_type in trace_entry.h is itself usable.
Contributor guide
Assessment
This issue has not been assessed yet.