summaryrefslogtreecommitdiff
path: root/sys-freebsd/freebsd-libexec/files/freebsd-libexec-8.2-rtld.patch
diff options
context:
space:
mode:
Diffstat (limited to 'sys-freebsd/freebsd-libexec/files/freebsd-libexec-8.2-rtld.patch')
-rw-r--r--sys-freebsd/freebsd-libexec/files/freebsd-libexec-8.2-rtld.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/sys-freebsd/freebsd-libexec/files/freebsd-libexec-8.2-rtld.patch b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-8.2-rtld.patch
new file mode 100644
index 000000000000..c60b2fec102c
--- /dev/null
+++ b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-8.2-rtld.patch
@@ -0,0 +1,40 @@
+--- head/libexec/rtld-elf/rtld.c 2011/09/15 11:50:09 225582
++++ head/libexec/rtld-elf/rtld.c 2011/10/08 12:39:47 226155
+@@ -495,8 +495,12 @@
+ exit (0);
+ }
+
+- /* setup TLS for main thread */
+- dbg("initializing initial thread local storage");
++ /*
++ * Processing tls relocations requires having the tls offsets
++ * initialized. Prepare offsets before starting initial
++ * relocation processing.
++ */
++ dbg("initializing initial thread local storage offsets");
+ STAILQ_FOREACH(entry, &list_main, link) {
+ /*
+ * Allocate all the initial objects out of the static TLS
+@@ -504,7 +508,6 @@
+ */
+ allocate_tls_offset(entry->obj);
+ }
+- allocate_initial_tls(obj_list);
+
+ if (relocate_objects(obj_main,
+ ld_bind_now != NULL && *ld_bind_now != '\0', &obj_rtld, NULL) == -1)
+@@ -519,6 +522,14 @@
+ exit (0);
+ }
+
++ /*
++ * Setup TLS for main thread. This must be done after the
++ * relocations are processed, since tls initialization section
++ * might be the subject for relocations.
++ */
++ dbg("initializing initial thread local storage");
++ allocate_initial_tls(obj_list);
++
+ dbg("initializing key program variables");
+ set_program_var("__progname", argv[0] != NULL ? basename(argv[0]) : "");
+ set_program_var("environ", env);