aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2018-11-23 22:37:35 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2018-11-23 22:37:35 +0000
commite8927aa6c68bd1d647270bb7c6817dd5118cf8cf (patch)
tree0bfbd977eb7d21d17f762d2d87faa6d538196024
parent6c81fe160cb922d35cc740e2fa8be1a9467d139f (diff)
downloadsrc-e8927aa6c68bd1d647270bb7c6817dd5118cf8cf.tar.gz
src-e8927aa6c68bd1d647270bb7c6817dd5118cf8cf.zip
rtld: parse FreeBSD Feature Control note on the object load.
Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=340858
-rw-r--r--libexec/rtld-elf/rtld.c8
-rw-r--r--libexec/rtld-elf/rtld.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index b78dc84fe310..fce99383f74e 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -1477,6 +1477,7 @@ digest_notes(Obj_Entry *obj, Elf_Addr note_start, Elf_Addr note_end)
note->n_descsz != sizeof(int32_t))
continue;
if (note->n_type != NT_FREEBSD_ABI_TAG &&
+ note->n_type != NT_FREEBSD_FEATURE_CTL &&
note->n_type != NT_FREEBSD_NOINIT_TAG)
continue;
note_name = (const char *)(note + 1);
@@ -1491,6 +1492,13 @@ digest_notes(Obj_Entry *obj, Elf_Addr note_start, Elf_Addr note_end)
obj->osrel = *(const int32_t *)(p);
dbg("note osrel %d", obj->osrel);
break;
+ case NT_FREEBSD_FEATURE_CTL:
+ /* FreeBSD ABI feature control note */
+ p = (uintptr_t)(note + 1);
+ p += roundup2(note->n_namesz, sizeof(Elf32_Addr));
+ obj->fctl0 = *(const uint32_t *)(p);
+ dbg("note fctl0 %#x", obj->fctl0);
+ break;
case NT_FREEBSD_NOINIT_TAG:
/* FreeBSD 'crt does not call init' note */
obj->crt_no_init = true;
diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h
index 650c6dbb8229..335971eb13e5 100644
--- a/libexec/rtld-elf/rtld.h
+++ b/libexec/rtld-elf/rtld.h
@@ -235,6 +235,7 @@ typedef struct Struct_Obj_Entry {
int fini_array_num; /* Number of entries in fini_array */
int32_t osrel; /* OSREL note value */
+ uint32_t fctl0; /* FEATURE_CONTROL note desc[0] value */
bool mainprog : 1; /* True if this is the main program */
bool rtld : 1; /* True if this is the dynamic linker */