LibC+LibELF: Correctly call destructors on exit()

We currently don't call any DT_FINI_ARRAY functions, so change that.

The call to `_fini` in `exit` is unnecessary, as we now call the
function referenced by DT_FINI in `__call_fini_functions`.
This commit is contained in:
Sönke Holz 2023-10-03 20:57:46 +02:00 committed by Daniel Bertalan
commit 0bff1f61b6
Notes: sideshowbarker 2024-07-17 06:35:23 +09:00
5 changed files with 58 additions and 9 deletions

View file

@ -245,14 +245,19 @@ public:
Symbol symbol(unsigned) const;
typedef void (*InitializationFunction)();
typedef void (*FinalizationFunction)();
typedef ElfW(Addr) (*IfuncResolver)();
bool has_init_section() const { return m_init_offset != 0; }
bool has_init_array_section() const { return m_init_array_offset != 0; }
Section init_section() const;
InitializationFunction init_section_function() const;
Section fini_section() const;
Section init_array_section() const;
bool has_fini_section() const { return m_fini_offset != 0; }
bool has_fini_array_section() const { return m_fini_array_offset != 0; }
Section fini_section() const;
FinalizationFunction fini_section_function() const;
Section fini_array_section() const;
HashSection hash_section() const