svn commit: r296419 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Sun Mar 6 00:31:12 UTC 2016
Author: kib
Date: Sun Mar 6 00:31:11 2016
New Revision: 296419
URL: https://svnweb.freebsd.org/changeset/base/296419
Log:
In the link_elf_obj.c, handle sections of type SHT_AMD64_UNWIND same
as SHT_PROGBITS. This is needed after the clang 3.8 import, which
generates that type for .eh_frame section, which had SHT_PROGBITS type
before.
Reported by: Nikolai Lifanov <lifanov at mail.lifanov.com>
PR: 207729
Tested by: dim (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Modified:
head/sys/kern/link_elf_obj.c
Modified: head/sys/kern/link_elf_obj.c
==============================================================================
--- head/sys/kern/link_elf_obj.c Sat Mar 5 21:10:34 2016 (r296418)
+++ head/sys/kern/link_elf_obj.c Sun Mar 6 00:31:11 2016 (r296419)
@@ -257,6 +257,9 @@ link_elf_link_preload(linker_class_t cls
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+ case SHT_AMD64_UNWIND:
+#endif
ef->nprogtab++;
break;
case SHT_SYMTAB:
@@ -327,9 +330,16 @@ link_elf_link_preload(linker_class_t cls
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+ case SHT_AMD64_UNWIND:
+#endif
ef->progtab[pb].addr = (void *)shdr[i].sh_addr;
if (shdr[i].sh_type == SHT_PROGBITS)
ef->progtab[pb].name = "<<PROGBITS>>";
+#ifdef __amd64__
+ else if (shdr[i].sh_type == SHT_AMD64_UNWIND)
+ ef->progtab[pb].name = "<<UNWIND>>";
+#endif
else
ef->progtab[pb].name = "<<NOBITS>>";
ef->progtab[pb].size = shdr[i].sh_size;
@@ -575,6 +585,9 @@ link_elf_load_file(linker_class_t cls, c
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+ case SHT_AMD64_UNWIND:
+#endif
ef->nprogtab++;
break;
case SHT_SYMTAB:
@@ -681,6 +694,9 @@ link_elf_load_file(linker_class_t cls, c
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+ case SHT_AMD64_UNWIND:
+#endif
alignmask = shdr[i].sh_addralign - 1;
mapsize += alignmask;
mapsize &= ~alignmask;
@@ -748,6 +764,9 @@ link_elf_load_file(linker_class_t cls, c
switch (shdr[i].sh_type) {
case SHT_PROGBITS:
case SHT_NOBITS:
+#ifdef __amd64__
+ case SHT_AMD64_UNWIND:
+#endif
alignmask = shdr[i].sh_addralign - 1;
mapbase += alignmask;
mapbase &= ~alignmask;
@@ -760,6 +779,10 @@ link_elf_load_file(linker_class_t cls, c
}
} else if (shdr[i].sh_type == SHT_PROGBITS)
ef->progtab[pb].name = "<<PROGBITS>>";
+#ifdef __amd64__
+ else if (shdr[i].sh_type == SHT_AMD64_UNWIND)
+ ef->progtab[pb].name = "<<UNWIND>>";
+#endif
else
ef->progtab[pb].name = "<<NOBITS>>";
if (ef->progtab[pb].name != NULL &&
@@ -781,7 +804,11 @@ link_elf_load_file(linker_class_t cls, c
}
ef->progtab[pb].size = shdr[i].sh_size;
ef->progtab[pb].sec = i;
- if (shdr[i].sh_type == SHT_PROGBITS) {
+ if (shdr[i].sh_type == SHT_PROGBITS
+#ifdef __amd64__
+ || shdr[i].sh_type == SHT_AMD64_UNWIND
+#endif
+ ) {
error = vn_rdwr(UIO_READ, nd.ni_vp,
ef->progtab[pb].addr,
shdr[i].sh_size, shdr[i].sh_offset,
More information about the svn-src-all
mailing list