From: Nadav Har'El <n...@scylladb.com>
Committer: Nadav Har'El <n...@scylladb.com>
Branch: master
elf: support PT_GNU_PROPERTY segment type
Recently, binutils added yet another segment type, called "PT_GNU_PROPERTY":
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0a59decbb81676ac30deede1bb6b6e241cd75502
Since OSv's linker currently aborts when it sees an unknown segment type,
we saw crashes when loading some specific shared objects, like a recent
Java build from Fedora.
This patch adds the missing segment type (and ignores it), and also improves
the error message in case in the future we encounter more newly invented
segment types.
Fixes #1030.
Signed-off-by: Nadav Har'El <n...@scylladb.com>
---
diff --git a/core/elf.cc b/core/elf.cc
--- a/core/elf.cc
+++ b/core/elf.cc
@@ -423,15 +423,15 @@ void object::load_segments()
case PT_GNU_RELRO:
case PT_GNU_EH_FRAME:
case PT_PAX_FLAGS:
+ case PT_GNU_PROPERTY:
break;
case PT_TLS:
_tls_segment = _base + phdr.p_vaddr;
_tls_init_size = phdr.p_filesz;
_tls_uninit_size = phdr.p_memsz - phdr.p_filesz;
break;
default:
- abort();
- throw osv::invalid_elf_error("bad p_type");
+ abort("Unknown p_type in executable %s: %d\n", pathname(),
phdr.p_type);
}
}
// As explained in issue #352, we currently don't correctly support TLS
diff --git a/include/osv/elf.hh b/include/osv/elf.hh
--- a/include/osv/elf.hh
+++ b/include/osv/elf.hh
@@ -111,6 +111,7 @@ enum {
PT_GNU_EH_FRAME = 0x6474e550, // Exception handling records
PT_GNU_STACK = 0x6474e551, // Stack permissions record
PT_GNU_RELRO = 0x6474e552, // Read-only after relocations
+ PT_GNU_PROPERTY = 0x6474e553,
PT_PAX_FLAGS = 0x65041580,
};
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.