summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libexec/ld.so/mips64/rtld_machine.c7
-rw-r--r--sys/sys/exec_elf.h12
2 files changed, 15 insertions, 4 deletions
diff --git a/libexec/ld.so/mips64/rtld_machine.c b/libexec/ld.so/mips64/rtld_machine.c
index 528b1f31876..fbc6d93a173 100644
--- a/libexec/ld.so/mips64/rtld_machine.c
+++ b/libexec/ld.so/mips64/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.27 2017/01/30 05:00:31 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.28 2018/01/18 08:17:39 guenther Exp $ */
/*
* Copyright (c) 1998-2004 Opsycon AB, Sweden.
@@ -235,8 +235,9 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
symp, object, NULL);
if (this)
*gotp = this->st_value + ooff;
- } else if (ELF64_ST_TYPE(symp->st_info) == STT_FUNC &&
- symp->st_value != *gotp) {
+ } else if ((ELF64_ST_TYPE(symp->st_info) == STT_FUNC &&
+ symp->st_value != *gotp) ||
+ ELF_ST_VISIBILITY(symp->st_other) == STV_PROTECTED) {
*gotp += loff;
} else { /* Resolve all others immediately */
this = NULL;
diff --git a/sys/sys/exec_elf.h b/sys/sys/exec_elf.h
index 817bfc69e5a..141f9d489cb 100644
--- a/sys/sys/exec_elf.h
+++ b/sys/sys/exec_elf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_elf.h,v 1.78 2017/12/09 06:35:08 deraadt Exp $ */
+/* $OpenBSD: exec_elf.h,v 1.79 2018/01/18 08:17:39 guenther Exp $ */
/*
* Copyright (c) 1995, 1996 Erik Theisen. All rights reserved.
*
@@ -356,6 +356,16 @@ typedef struct {
#define STT_LOPROC 13 /* reserved range for processor */
#define STT_HIPROC 15 /* specific symbol types */
+/* Extract symbol visibility - st_other */
+#define ELF_ST_VISIBILITY(v) ((v) & 0x3)
+#define ELF32_ST_VISIBILITY ELF_ST_VISIBILITY
+#define ELF64_ST_VISIBILITY ELF_ST_VISIBILITY
+
+#define STV_DEFAULT 0 /* Visibility set by binding type */
+#define STV_INTERNAL 1 /* OS specific version of STV_HIDDEN */
+#define STV_HIDDEN 2 /* can only be seen inside own .so */
+#define STV_PROTECTED 3 /* HIDDEN inside, DEFAULT outside */
+
/* Relocation entry with implicit addend */
typedef struct {
Elf32_Addr r_offset; /* offset of relocation */