24ea14660b
[ELF] Align the first section of a PT_LOAD even if its type is SHT_NOBITS Reported at https://reviews.llvm.org/D64930#1642223 If the only section of a PT_LOAD is a SHT_NOBITS section (e.g. .bss), we may not align its sh_offset. p_offset of the PT_LOAD will be set to sh_offset, and we will get p_offset!=p_vaddr (mod p_align). If such executable is mapped by the Linux kernel, it will segfault. After D64906, this may happen the non-linker script case. The linker script case has had this issue for a long time. This was fixed by rL321657 (but the test linkerscript/nobits-offset.s failed to test a SHT_NOBITS section), but broken by rL345154. Reviewed By: peter.smith Differential Revision: https://reviews.llvm.org/D66658 Pull in r371013 from upstream lld trunk (by Rui Ueyama): Align output segments correctly Previously, segments were aligned according to their first section's alignment requirements. That was not correct, but segments are also aligned to a page boundary, and a page boundary is usually much larger than a section alignment requirement, so no one noticed this bug before. Now, lld has --nmagic option which sets maxPageSize to 1 to effectively disable page alignment, which reveals the issue. Fixes https://bugs.llvm.org/show_bug.cgi?id=43212 Differential Revision: https://reviews.llvm.org/D67152 Together, these should ensure gpboot.out gets a correctly aligned offset for its .rodata section, and fix "layout constraint violation" errors from objcopy. |
||
---|---|---|
.. | ||
amd | ||
apr | ||
apr-util | ||
atf | ||
bearssl | ||
binutils | ||
blacklist | ||
bmake | ||
bsnmp | ||
byacc | ||
bzip2 | ||
capsicum-test | ||
com_err | ||
compiler-rt | ||
cortex-strings | ||
dialog | ||
diff | ||
dma | ||
dtc | ||
ee | ||
elftoolchain | ||
expat | ||
file | ||
flex | ||
gcc | ||
gcclibs | ||
gdb | ||
gdtoa | ||
googletest | ||
gperf | ||
hyperv/tools | ||
ipfilter | ||
jemalloc | ||
ldns | ||
ldns-host | ||
less | ||
libarchive | ||
libbegemot | ||
libc-pwcache | ||
libc-vis | ||
libc++ | ||
libcxxrt | ||
libdivsufsort | ||
libevent | ||
libexecinfo | ||
libgnuregex | ||
libpcap | ||
libstdc++ | ||
libucl | ||
libunwind | ||
libxo | ||
llvm | ||
lua | ||
mandoc | ||
mknod | ||
mtree | ||
ncurses | ||
netbsd-tests | ||
netcat | ||
ngatm | ||
ntp | ||
nvi | ||
ofed | ||
one-true-awk | ||
openbsm | ||
opencsd/decoder | ||
openmp | ||
openpam | ||
openresolv | ||
opie | ||
pam_modules/pam_passwdqc | ||
pf | ||
pjdfstest | ||
pnpinfo | ||
processor-trace | ||
sendmail | ||
serf | ||
smbfs | ||
sqlite3 | ||
subversion | ||
tcp_wrappers | ||
tcpdump | ||
tcsh | ||
telnet | ||
tnftp | ||
traceroute | ||
tzcode | ||
tzdata | ||
unbound | ||
unvis | ||
vis | ||
wpa | ||
xz |