static_tls_alignment.
* elfxx-target.h (elf_backend_static_tls_alignment): Provide
default.
(elfNN_bed): Initialize static_tls_alignment.
* elflink.c (bfd_elf_final_link): Don't round end of TLS section
if static TLS has special alignment requirements.
* elf32-i386.c (elf_i386_tpoff): Define bed, static_tls_size.
Consider static_tls_alignment.
(elf_backend_static_tls_alignment): Redefine for Solaris 2.
Undef again for VxWorks.
* elf64-x86-64.c (elf64_x86_64_tpoff): Define bed,
static_tls_size.
Consider static_tls_alignment.
(elf_backend_static_tls_alignment): Redefine for Solaris 2.
Undef again for Intel L1OM.
+2010-10-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * elf-bfd.h (struct elf_backend_data): New member
+ static_tls_alignment.
+ * elfxx-target.h (elf_backend_static_tls_alignment): Provide
+ default.
+ (elfNN_bed): Initialize static_tls_alignment.
+ * elflink.c (bfd_elf_final_link): Don't round end of TLS section
+ if static TLS has special alignment requirements.
+ * elf32-i386.c (elf_i386_tpoff): Define bed, static_tls_size.
+ Consider static_tls_alignment.
+ (elf_backend_static_tls_alignment): Redefine for Solaris 2.
+ Undef again for VxWorks.
+ * elf64-x86-64.c (elf64_x86_64_tpoff): Define bed,
+ static_tls_size.
+ Consider static_tls_alignment.
+ (elf_backend_static_tls_alignment): Redefine for Solaris 2.
+ Undef again for Intel L1OM.
+
2010-10-14 Dave Korn <dave.korn.cygwin@gmail.com>
Apply LD plugin patch series (part 6/6).
actual tag number to place in the input position. */
int (*obj_attrs_order) (int);
+ /* This is non-zero if static TLS segments require a special alignment. */
+ unsigned static_tls_alignment;
+
/* This is TRUE if the linker should act like collect and gather
global constructors and destructors by name. This is TRUE for
MIPS ELF because the Irix 5 tools can not handle the .init
elf_i386_tpoff (struct bfd_link_info *info, bfd_vma address)
{
struct elf_link_hash_table *htab = elf_hash_table (info);
+ const struct elf_backend_data *bed = get_elf_backend_data (info->output_bfd);
+ bfd_vma static_tls_size;
/* If tls_sec is NULL, we should have signalled an error already. */
if (htab->tls_sec == NULL)
return 0;
- return htab->tls_size + htab->tls_sec->vma - address;
+
+ /* Consider special static TLS alignment requirements. */
+ static_tls_size = BFD_ALIGN (htab->tls_size, bed->static_tls_alignment);
+ return static_tls_size + htab->tls_sec->vma - address;
}
/* Relocate an i386 ELF section. */
#undef elf32_bed
#define elf32_bed elf32_i386_sol2_bed
+/* The 32-bit static TLS arena size is rounded to the nearest 8-byte
+ boundary. */
+#undef elf_backend_static_tls_alignment
+#define elf_backend_static_tls_alignment 8
+
/* The Solaris 2 ABI requires a plt symbol on all platforms.
Cf. Linker and Libraries Guide, Ch. 2, Link-Editor, Generating the Output
#undef elf_backend_final_write_processing
#define elf_backend_final_write_processing \
elf_vxworks_final_write_processing
+#undef elf_backend_static_tls_alignment
/* On VxWorks, we emit relocations against _PROCEDURE_LINKAGE_TABLE_, so
define it. */
elf64_x86_64_tpoff (struct bfd_link_info *info, bfd_vma address)
{
struct elf_link_hash_table *htab = elf_hash_table (info);
+ const struct elf_backend_data *bed = get_elf_backend_data (info->output_bfd);
+ bfd_vma static_tls_size;
/* If tls_segment is NULL, we should have signalled an error already. */
if (htab->tls_sec == NULL)
return 0;
- return address - htab->tls_size - htab->tls_sec->vma;
+
+ /* Consider special static TLS alignment requirements. */
+ static_tls_size = BFD_ALIGN (htab->tls_size, bed->static_tls_alignment);
+ return address - static_tls_size - htab->tls_sec->vma;
}
/* Is the instruction before OFFSET in CONTENTS a 32bit relative
#undef elf64_bed
#define elf64_bed elf64_x86_64_sol2_bed
+/* The 64-bit static TLS arena size is rounded to the nearest 16-byte
+ boundary. */
+#undef elf_backend_static_tls_alignment
+#define elf_backend_static_tls_alignment 16
+
/* The Solaris 2 ABI requires a plt symbol on all platforms.
Cf. Linker and Libraries Guide, Ch. 2, Link-Editor, Generating the Output
#define elf_backend_object_p elf64_l1om_elf_object_p
#undef elf_backend_post_process_headers
+#undef elf_backend_static_tls_alignment
#include "elf64-target.h"
end = sec->vma + size;
}
base = elf_hash_table (info)->tls_sec->vma;
- end = align_power (end, elf_hash_table (info)->tls_sec->alignment_power);
+ /* Only align end of TLS section if static TLS doesn't have special
+ alignment requirements. */
+ if (bed->static_tls_alignment == 1)
+ end = align_power (end,
+ elf_hash_table (info)->tls_sec->alignment_power);
elf_hash_table (info)->tls_size = end - base;
}
/* Target definitions for NN-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
#ifndef elf_backend_obj_attrs_order
#define elf_backend_obj_attrs_order NULL
#endif
+#ifndef elf_backend_static_tls_alignment
+#define elf_backend_static_tls_alignment 1
+#endif
#ifndef elf_backend_post_process_headers
#define elf_backend_post_process_headers NULL
#endif
elf_backend_obj_attrs_arg_type,
elf_backend_obj_attrs_section_type,
elf_backend_obj_attrs_order,
+ elf_backend_static_tls_alignment,
elf_backend_collect,
elf_backend_type_change_ok,
elf_backend_may_use_rel_p,