HomeFreeBSD

mips: remove 16-byte alignment from .init and .fini epilogues

Description

mips: remove 16-byte alignment from .init and .fini epilogues

The .init and .fini epilogues from crtn should be placed immediately
after any instructions in .init and .fini sections from the linked
objects. Using 16-byte alignment for the epilogues on MIPS was a bug,
but it did not cause any issue with GNU ld as GNU ld (2.17.50) fills the
padding with NOPs.

Current versions of LLD fill any padding between different object files
with trap instructions. Inserting trap padding prior to the .init/.fini
epilogue is undesriable as the resulting binary will crash at runtime.

The .init and .fini sections in object files linked between crti and
crtn must already be a multiple of the instruction size and so no
alignment directive is required in crtn. Indeed, other architectures
(except sparc64) do not specify alignment in their crtn implementations.

Reported by: arichardson
Reviewed by: andrew
Event: Waterloo Hackathon 2019
Differential Revision: https://reviews.freebsd.org/D18291

Details

Provenance
emasteAuthored on
Reviewer
andrew
Differential Revision
D18291: Align mips crt .init/.fini sections to 4 bytes instead of 16
Parents
rS348007: special-case getvfsbyname(3) for fusefs(5)
Branches
Unknown
Tags
Unknown