s390: Fixes duplicated __fentry__ call in function profiler.
The s390 function profiler now correctly emits only one __fentry__ call, resolving a bug introduced during -m31 removal.
This commit corrects a bug in the s390 function profiler that caused a duplicated call to __fentry__. The issue arose from an incorrect rewrite of the TARGET_64BIT else branch during the removal of the -m31 option. The fix reorganizes the conditional logic so that the handling for -mnop-mcount and the default case correctly falls under an else branch of the flag_fentry check, ensuring only a single __fentry__ call is emitted when profiling is enabled.
In Details
s390: The s390_function_profiler in config/s390/s390.cc had a logic error where the branch intended for -mno-fentry was executed even when -mfentry was active, due to an incorrect refactoring of the TARGET_64BIT conditional logic. The original structure was if (flag_fentry) { ... } else if (TARGET_64BIT) { ... } else { ... }. The change inadvertently flattened this to if (flag_fentry) { ... } if (flag_nop_mcount) ... else { ... }. The fix restores the correct nesting, making the -mnop-mcount/default handling an else block of the flag_fentry case, thus preventing the redund…
- __fentry__
- A symbol typically representing the entry point of a function, often used in profiling or instrumentation to mark the beginning of function execution.
- s390
- IBM's System/390 and its successors (z/Architecture), a mainframe computer architecture for which GCC provides support.
- profiling
- The process of analyzing a program's execution to measure performance, identify bottlenecks, and understand resource usage. Function profiling specifically tracks function calls and execution times.
- TARGET_64BIT
- A GCC target flag indicating that the compiler is configured for a 64-bit architecture.
- flag_fentry
- A compiler flag (e.g.,
-mfentry) that enables the use of the__fentry__mechanism for function entry tracing or profiling. - flag_nop_mcount
- A compiler flag that potentially disables or modifies the behavior of function call counting (
mcount) mechanisms.