summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libexec/ld.so/aarch64/rtld_machine.c5
-rw-r--r--libexec/ld.so/alpha/rtld_machine.c5
-rw-r--r--libexec/ld.so/amd64/rtld_machine.c5
-rw-r--r--libexec/ld.so/arm/rtld_machine.c5
-rw-r--r--libexec/ld.so/hppa/rtld_machine.c5
-rw-r--r--libexec/ld.so/i386/rtld_machine.c5
-rw-r--r--libexec/ld.so/loader.c16
-rw-r--r--libexec/ld.so/m88k/rtld_machine.c5
-rw-r--r--libexec/ld.so/mips64/rtld_machine.c5
-rw-r--r--libexec/ld.so/powerpc/rtld_machine.c5
-rw-r--r--libexec/ld.so/sh/rtld_machine.c5
-rw-r--r--libexec/ld.so/sparc64/rtld_machine.c5
12 files changed, 24 insertions, 47 deletions
diff --git a/libexec/ld.so/aarch64/rtld_machine.c b/libexec/ld.so/aarch64/rtld_machine.c
index 5516364570a..5ac50d715cf 100644
--- a/libexec/ld.so/aarch64/rtld_machine.c
+++ b/libexec/ld.so/aarch64/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.17 2019/11/28 16:54:29 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.18 2019/12/07 22:57:47 guenther Exp $ */
/*
* Copyright (c) 2004 Dale Rahn
@@ -242,9 +242,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
if (object->Dyn.info[DT_PLTREL] != DT_RELA)
return 0;
- if (object->traced)
- lazy = 1;
-
if (!lazy) {
fails = _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ);
} else {
diff --git a/libexec/ld.so/alpha/rtld_machine.c b/libexec/ld.so/alpha/rtld_machine.c
index 0e4c93f6bc7..24029fcad4e 100644
--- a/libexec/ld.so/alpha/rtld_machine.c
+++ b/libexec/ld.so/alpha/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.69 2019/10/23 19:55:08 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.70 2019/12/07 22:57:47 guenther Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -238,9 +238,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
pltgot = (Elf_Addr *)object->Dyn.info[DT_PLTGOT];
- if (object->traced)
- lazy = 1;
-
if (!lazy || pltgot == NULL) {
fails = _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ);
} else {
diff --git a/libexec/ld.so/amd64/rtld_machine.c b/libexec/ld.so/amd64/rtld_machine.c
index 16d13e349f1..e36b29d2f6b 100644
--- a/libexec/ld.so/amd64/rtld_machine.c
+++ b/libexec/ld.so/amd64/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.38 2019/11/28 16:54:29 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.39 2019/12/07 22:57:47 guenther Exp $ */
/*
* Copyright (c) 2002,2004 Dale Rahn
@@ -368,9 +368,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
if (object->Dyn.info[DT_PLTREL] != DT_RELA)
return 0;
- if (object->traced)
- lazy = 1;
-
if (__predict_false(!lazy)) {
fails = _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ);
} else {
diff --git a/libexec/ld.so/arm/rtld_machine.c b/libexec/ld.so/arm/rtld_machine.c
index e4933e53065..a7c9778a9cf 100644
--- a/libexec/ld.so/arm/rtld_machine.c
+++ b/libexec/ld.so/arm/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.38 2019/11/28 16:54:30 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.39 2019/12/07 22:57:47 guenther Exp $ */
/*
* Copyright (c) 2004 Dale Rahn
@@ -305,9 +305,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
if (object->Dyn.info[DT_PLTREL] != DT_REL)
return 0;
- if (object->traced)
- lazy = 1;
-
if (!lazy) {
fails = _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ);
} else {
diff --git a/libexec/ld.so/hppa/rtld_machine.c b/libexec/ld.so/hppa/rtld_machine.c
index 7e4645f10a8..89dd9628370 100644
--- a/libexec/ld.so/hppa/rtld_machine.c
+++ b/libexec/ld.so/hppa/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.41 2019/10/23 19:55:09 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.42 2019/12/07 22:57:47 guenther Exp $ */
/*
* Copyright (c) 2004 Michael Shalayeff
@@ -312,9 +312,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
if (object->dyn.pltrel != DT_RELA)
return 0;
- if (object->traced)
- lazy = 1;
-
if (!lazy) {
fails = _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ);
} else {
diff --git a/libexec/ld.so/i386/rtld_machine.c b/libexec/ld.so/i386/rtld_machine.c
index 6ab0616e112..a23a188f3f4 100644
--- a/libexec/ld.so/i386/rtld_machine.c
+++ b/libexec/ld.so/i386/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.47 2019/11/28 16:54:30 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.48 2019/12/07 22:57:48 guenther Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
@@ -369,9 +369,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
if (object->Dyn.info[DT_PLTREL] != DT_REL)
return 0;
- if (object->traced)
- lazy = 1;
-
if (!lazy) {
fails = _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ);
} else {
diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c
index 3ffe9307c3f..7ed24131350 100644
--- a/libexec/ld.so/loader.c
+++ b/libexec/ld.so/loader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: loader.c,v 1.187 2019/10/04 17:42:16 guenther Exp $ */
+/* $OpenBSD: loader.c,v 1.188 2019/12/07 22:57:47 guenther Exp $ */
/*
* Copyright (c) 1998 Per Fogelstrom, Opsycon AB
@@ -718,8 +718,18 @@ _dl_rtld(elf_object_t *object)
fails =_dl_md_reloc(object, DT_REL, DT_RELSZ);
fails += _dl_md_reloc(object, DT_RELA, DT_RELASZ);
reprotect_if_textrel(object);
- fails += _dl_md_reloc_got(object, !(_dl_bindnow ||
- object->obj_flags & DF_1_NOW));
+
+ /*
+ * We do lazy resolution by default, doing eager resolution if
+ * - the object requests it with -znow, OR
+ * - LD_BIND_NOW is set and this object isn't being ltraced
+ *
+ * Note that -znow disables ltrace for the object: on at least
+ * amd64 'ld' doesn't generate the trampoline for lazy relocation
+ * when -znow is used.
+ */
+ fails += _dl_md_reloc_got(object, !(object->obj_flags & DF_1_NOW) &&
+ !(_dl_bindnow && !object->traced));
/*
* Look for W&X segments and make them read-only.
diff --git a/libexec/ld.so/m88k/rtld_machine.c b/libexec/ld.so/m88k/rtld_machine.c
index 9635e5b5b67..59a13f367f5 100644
--- a/libexec/ld.so/m88k/rtld_machine.c
+++ b/libexec/ld.so/m88k/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.28 2019/10/23 19:55:09 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.29 2019/12/07 22:57:48 guenther Exp $ */
/*
* Copyright (c) 2013 Miodrag Vallat.
@@ -251,9 +251,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
if (object->Dyn.info[DT_PLTREL] != DT_RELA)
return 0;
- if (object->traced)
- lazy = 1;
-
if (!lazy) {
fails = _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ);
} else {
diff --git a/libexec/ld.so/mips64/rtld_machine.c b/libexec/ld.so/mips64/rtld_machine.c
index a93db355625..17d29d8a13d 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.32 2019/10/23 19:55:09 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.33 2019/12/07 22:57:48 guenther Exp $ */
/*
* Copyright (c) 1998-2004 Opsycon AB, Sweden.
@@ -187,9 +187,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
n = object->Dyn.info[DT_MIPS_SYMTABNO - DT_LOPROC + DT_NUM] -
object->Dyn.info[DT_MIPS_GOTSYM - DT_LOPROC + DT_NUM];
- if (object->traced)
- lazy = 1;
-
/*
* Then do all global references according to the ABI.
* Quickstart is not yet implemented.
diff --git a/libexec/ld.so/powerpc/rtld_machine.c b/libexec/ld.so/powerpc/rtld_machine.c
index b1f3dc9ab38..3bc6cd2ed2b 100644
--- a/libexec/ld.so/powerpc/rtld_machine.c
+++ b/libexec/ld.so/powerpc/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.69 2019/10/23 19:55:09 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.70 2019/12/07 22:57:48 guenther Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -275,9 +275,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
if (object->Dyn.info[DT_PLTREL] != DT_RELA)
return 0;
- if (object->traced)
- lazy = 1;
-
if (!lazy) {
fails = _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ);
} else {
diff --git a/libexec/ld.so/sh/rtld_machine.c b/libexec/ld.so/sh/rtld_machine.c
index f2c252ac1d3..7f5c679740f 100644
--- a/libexec/ld.so/sh/rtld_machine.c
+++ b/libexec/ld.so/sh/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.32 2019/10/24 22:11:10 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.33 2019/12/07 22:57:48 guenther Exp $ */
/*
* Copyright (c) 2004 Dale Rahn
@@ -743,9 +743,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
if (object->Dyn.info[DT_PLTREL] != DT_RELA)
return 0;
- if (object->traced)
- lazy = 1;
-
if (!lazy) {
fails = _dl_md_reloc(object, DT_JMPREL, DT_PLTRELSZ);
} else {
diff --git a/libexec/ld.so/sparc64/rtld_machine.c b/libexec/ld.so/sparc64/rtld_machine.c
index 14ba5591406..a83a99593a8 100644
--- a/libexec/ld.so/sparc64/rtld_machine.c
+++ b/libexec/ld.so/sparc64/rtld_machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtld_machine.c,v 1.67 2019/10/23 19:55:09 guenther Exp $ */
+/* $OpenBSD: rtld_machine.c,v 1.68 2019/12/07 22:57:48 guenther Exp $ */
/*
* Copyright (c) 1999 Dale Rahn
@@ -811,9 +811,6 @@ _dl_md_reloc_got(elf_object_t *object, int lazy)
if (object->Dyn.info[DT_PLTREL] != DT_RELA)
return 0;
- if (object->traced)
- lazy = 1;
-
if (!lazy) {
fails = _dl_md_reloc_all_plt(object);
} else {