Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 21 Jan 2024 15:33:05 -0800
From: Fangrui Song <i@...kray.me>
To: musl@...ts.openwall.com
Subject: DT_PREINIT_ARRAY support

There is a DT_PREINIT_ARRAY patch that falls through the cracks:
 https://www.openwall.com/lists/musl/2016/05/17/2
I wonder whether it can be visited again.

I ported sanitizers to upstream compiler-rt. I have not had time to
track the latest status for musl, but I know that quite a few
sanitizers will benefit from musl supporting the feature and see
another recent issue about tsan
(https://github.com/llvm/llvm-project/issues/78452).

---

Some notes about DT_PREINIT_ARRAY

The linker defines DT_PREINIT_ARRAY and DT_PREINIT_ARRAYSZ according
to the address and size of .preinit_array. The linker also defines
__preinit_array_start and __preinit_array_end if referenced.

The generic ABI says:

> DT_PREINIT_ARRAY: This element holds the address of the array of pointers to pre-initialization functions, discussed in ``Initialization and Termination Functions'' below. The DT_PREINIT_ARRAY table is processed only in an executable file; it is ignored if contained in a shared object.

DT_PREINIT_ARRAY only applies to the executable. This feature gives
the executable a way to run initialization functions before shared
object dependencies.

There is no .postfini_array.

Most ld.so implementations support DT_PREINIT_ARRAY.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.