HomeFreeBSD

Tentatively apply https://reviews.llvm.org/D41635:

Description

Tentatively apply https://reviews.llvm.org/D41635:

We normally want to ignore SHT_NOBITS sections when computing
offsets. The sh_offset of section itself seems to be irrelevant and

* If the section is in the middle of a PT_LOAD, it will make no
  difference on the computed offset of the followup section.
* If it is in the end of a PT_LOAD, we want to avoid its alignment
  changing the offset of the followup sections.

The issue is if it is at the start of the PT_LOAD. In that case we do
have to align it so that the following sections have congruent
address and offset module the page size. We were not handling this
case.

This should fix freebsd kernel link.

In particular, this fixes ctfmerge and/or objcopy throwing "Layout
constraint violation" errors when processing an lld-linked kernel.

Details

Provenance
dimAuthored on
Parents
rS327619: The source strings are from the password database which guarantees
Branches
Unknown
Tags
Unknown