aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-08-25 09:42:20 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-06-22 06:04:17 -0700
commitdc14c8980672194a1b329b5c35a7f781bc04a3f5 (patch)
treee3d6a419510c587892d5ca8abf5a7a199cd640fc /gas
parent6b1edb94fedc7103b4929354d27304d0bd756f49 (diff)
downloadgdb-users/hjl/sharable.zip
gdb-users/hjl/sharable.tar.gz
gdb-users/hjl/sharable.tar.bz2
Add PT_GNU_SHR/SHF_GNU_SHARABLE/SHN_GNU_SHARABLE_COMMON support to gas/ldusers/hjl/sharable
PT_GNU_SHR/SHF_GNU_SHARABLE/SHN_GNU_SHARABLE_COMMON are used to group data into a PT_GNU_SHR to improve performance on NUMA system.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/obj-elf.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 8af563f..da3b483 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -76,6 +76,7 @@ static void obj_elf_subsection (int);
static void obj_elf_popsection (int);
static void obj_elf_gnu_attribute (int);
static void obj_elf_tls_common (int);
+static void obj_elf_sharable_common (int);
static void obj_elf_lcomm (int);
static void obj_elf_struct (int);
@@ -136,6 +137,8 @@ static const pseudo_typeS elf_pseudo_table[] =
{"tls_common", obj_elf_tls_common, 0},
+ {"sharable_common", obj_elf_sharable_common, 0},
+
/* End sentinel. */
{NULL, NULL, 0},
};
@@ -394,6 +397,39 @@ obj_elf_tls_common (int ignore ATTRIBUTE_UNUSED)
}
static void
+obj_elf_sharable_common (int ignore ATTRIBUTE_UNUSED)
+{
+ static segT sharable_bss_section;
+ asection *saved_com_section_ptr = elf_com_section_ptr;
+ asection *saved_bss_section = bss_section;
+
+ if (sharable_bss_section == NULL)
+ {
+ flagword applicable;
+ segT seg = now_seg;
+ subsegT subseg = now_subseg;
+
+ /* The .sharable_bss section is for local .sharable_common
+ symbols. */
+ sharable_bss_section = subseg_new (".sharable_bss", 0);
+ applicable = bfd_applicable_section_flags (stdoutput);
+ bfd_set_section_flags (stdoutput, sharable_bss_section,
+ applicable & SEC_ALLOC);
+ seg_info (sharable_bss_section)->bss = 1;
+
+ subseg_set (seg, subseg);
+ }
+
+ elf_com_section_ptr = &_bfd_elf_sharable_com_section;
+ bss_section = sharable_bss_section;
+
+ s_comm_internal (0, elf_common_parse);
+
+ elf_com_section_ptr = saved_com_section_ptr;
+ bss_section = saved_bss_section;
+}
+
+static void
obj_elf_lcomm (int ignore ATTRIBUTE_UNUSED)
{
symbolS *symbolP = s_comm_internal (0, s_lcomm_internal);
@@ -611,11 +647,17 @@ obj_elf_change_section (const char *name,
.section .lbss,"aw",@progbits
+ "@progbits" is incorrect. Also for sharable bss
+ sections, gcc, as of 2005-07-06, will emit
+
+ .section .sharable_bss,"aw",@progbits
+
"@progbits" is incorrect. */
#ifdef TC_I386
&& (bed->s->arch_size != 64
|| !(ssect->attr & SHF_X86_64_LARGE))
#endif
+ && !(ssect->attr & SHF_GNU_SHARABLE)
&& ssect->type != SHT_INIT_ARRAY
&& ssect->type != SHT_FINI_ARRAY
&& ssect->type != SHT_PREINIT_ARRAY)