[Midnightbsd-cvs] [MidnightBSD/src] 3c2e9c: kernel: Fix defining of .init_array and .fini_arra...
Lucas Holt
noreply at github.com
Tue Sep 24 00:52:19 EDT 2024
Branch: refs/heads/master
Home: https://github.com/MidnightBSD/src
Commit: 3c2e9ccda5801f0c223d4d66536c30fd5a7dc872
https://github.com/MidnightBSD/src/commit/3c2e9ccda5801f0c223d4d66536c30fd5a7dc872
Author: Lucas Holt <luke at foolishgames.com>
Date: 2024-09-24 (Tue, 24 Sep 2024)
Changed paths:
M sys/conf/ldscript.amd64
M sys/conf/ldscript.i386
Log Message:
-----------
kernel: Fix defining of .init_array and .fini_array sections
These input sections can have decimal numbers as the priority suffix.
Clang emits the '%u' form, while SORT is an alias for SORT_BY_NAME,
hence will result in wrong order of constructors / destructors in
output sections. Fix by using the correct sorting command
SORT_BY_INIT_PRIORITY instead [1].
The functions referenced by section .fini_array is in the normal order,
but been executed in the reverse order. The order is same with
.init_array section.
Currently these sections are not used, there should be no functional
change.
Note: As for the .ctors and .dtors sections, both Clang and GCC emit
the priority suffix in the form of '%05u', so there is no semantic
difference between SORT_BY_NAME and SORT_BY_INIT_PRIORITY for those
sections [2].
This fix is extracted from a bigger patch [3] of hselasky, with
additional fix for .fini_array section.
1. https://sourceware.org/binutils/docs/ld/Input-Section-Wildcards.html
2. https://reviews.llvm.org/D91187
3. https://reviews.freebsd.org/D40467
Obtained from: https://cgit.freebsd.org/src/patch/?id=87841ead405f7b380cbe18963d02c28ff0163ba2
To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/src/settings/notifications
More information about the Midnightbsd-cvs
mailing list