[EXT_EP-12714] The function __attribute__((destructor)) is silently ignored Created: 08/Jul/25 Updated: 20/Apr/26 Resolved: 07/Nov/25 |
|
| Status: | Fixed |
| Project: | Embedded Software & Tools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Medium |
| Reporter: | TI User | Assignee: | TI User |
| Resolution: | Fixed | Votes: | 0 |
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Product: | Code Generation Tools |
| Internal ID: | CODEGEN-14222 |
| Forum URL: | https://e2e.ti.com/support/processors-group/processors/f/791/t/1536610 |
| Found In Release: | C29_1.0.0.LTS ARMCLANG_5.0.0.STS ARMCLANG_4.0.0.LTS C29_2.0.0.STS ARMCLANG_3.2.0.LTS |
| Fix In Release: | ARMCLANG_5.0.0.STS C29_1.0.2.LTS* ARMCLANG_4.0.5.LTS* ARMCLANG_3.2.4.LTS* C29_2.1.0.STS |
| Affected Platform/Device: | default |
| Workaround: | Use the standard RTS function atexit. For example:
atexit(function_name_here); /* declared in <stdlib.h> */ |
| Description |
|
The attached file has these lines ... __attribute__((destructor))
void stub() {}
int main()
{
return 0;
}
Build it down to assembly code ... tiarmclang -S file.c Inspect the assembly to see ... .section .fini_array,"a",%fini_array .p2align 2 .long stub(target1) An entry is made in the section .fini_array. But the startup and cleanup code in the compiler RTS library ignores this entry. |