Page MenuHomeFreeBSD

ld(1): Correctly define .init_array and .fini_array for all platforms.
AbandonedPublic

Authored by zlei on Jun 7 2023, 3:14 PM.
Tags
None
Referenced Files
F150817968: D40467.id.diff
Sat, Apr 4, 6:31 AM
F150723256: D40467.id122961.diff
Fri, Apr 3, 3:18 PM
Unknown Object (File)
Fri, Apr 3, 7:23 AM
Unknown Object (File)
Sat, Mar 28, 7:47 AM
Unknown Object (File)
Thu, Mar 26, 1:24 PM
Unknown Object (File)
Wed, Mar 25, 5:59 PM
Unknown Object (File)
Thu, Mar 19, 11:10 PM
Unknown Object (File)
Sun, Mar 15, 1:44 AM

Details

Summary

The constructor and destructor section names can have a priority
suffixed, as a decimal number.

Unless the ldscript is instructed to sort these sections
into a single one, this feature does not work as expected.

MFC after: 1 week
Sponsored by: NVIDIA Networking

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

arichardson added a subscriber: arichardson.

This will sort by name not priority. Ld.lld will sort by priority automatically if you omit init_array from the linker script but for bfd you need SORT_BY_INIT_PRIORITY

This revision now requires changes to proceed.Jun 7 2023, 4:18 PM

@arichardson : Use SORT_BY_INIT_PRIORITY()

Should .ctors and .dtors use the same?

Split the FIX for sorting input sections to D45194 .

I tried to Update Diff but failed. Split the definition for other platforms to D45214 .

zlei abandoned this revision.
zlei added a reviewer: hselasky.

Landed as e15b5ba77d69 and 3e76d05231b0 .