This CL is to mitigate R_X86_64_PC32 relocation overflow problems for huge binaries that has near 2G allocated sections.
By examining those binaries, I found these 2 issues contributes to the problem:
1). huge ".dynsym" and ".dynstr" stands in the way between .rodata and .text
2). _init_array_start/end are placed at 0 if no ".init_array" presents, this causes .text relocation against them become more prone to overflow.
This CL is to address 2).
( 1) is addressed in D45788
I'd think that this comment could be improved by making it clear what is the default behavior, what your problem is, and how to solve it. The important thing is that future readers will be able to understand this comment without too much context. I'd write something like this.
If a section does not exist, there's ambiguity as to how we define _start and _end symbols for an init/fini section. Since the loader assume that the symbols are always defined, we need to always define them. But what value? The loader iterates over all pointers between _start and _end to run global ctors/dtors, so if the section is empty, their symbol values don't actually matter as long as _start and _end point to the same location.
That said, we don't want to set the symbols to 0 (which is probably the simplest value) because that could cause some program to fail to link due to relocation overflow, if their program text is above 2 GiB. We use the address of the .text section instead to prevent that failure.