[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/12641] New: Section symbols get discarded when assigned to the "
From: |
binutils at marino dot st |
Subject: |
[Bug ld/12641] New: Section symbols get discarded when assigned to the "dot" |
Date: |
Tue, 5 Apr 2011 23:21:06 +0000 |
http://sourceware.org/bugzilla/show_bug.cgi?id=12641
Summary: Section symbols get discarded when assigned to the
"dot"
Product: binutils
Version: 2.22 (HEAD)
Status: NEW
Severity: normal
Priority: P2
Component: ld
AssignedTo: address@hidden
ReportedBy: address@hidden
Created attachment 5647
--> http://sourceware.org/bugzilla/attachment.cgi?id=5647
Dragonfly kernel module used for test case
DragonFly BSD has moved to Binutils 2.21 from 2.17 for its upcoming release.
During the transition an anomaly was seen, and the cause was traced back to
missing __start_set and __stop_set symbols within a generated file.
It appeared that lang_insert_orphan function was silently discarding the
section label symbols due to being assigned the "dot" (the origin). It appears
that exp_provide() function used there discards the symbols assigned "." and
exp_assign() function does not.
It has been confirmed that the same problem exists in the head. Using the
attached file on an i386 platform (confirmed on DragonFly i386 and Ubuntu
i386), and a "stock" binutils built from head:
> /usr/bin222/bin/ld -Bshareable -o test222_stock.ko null.kld
> readelf -s test222_stock.ko | grep __start
> readelf -s test222_stock.ko | grep __stop
I repeated this test using a patched version of binutils (patch follows):
> /usr/bin222/bin/ld -Bshareable -o test222_mod.ko null.kld
> readelf -s test222_mod.ko | grep __start
7: 000011c0 0 NOTYPE GLOBAL DEFAULT ABS __start_set_modmetadata_s
17: 000011c4 0 NOTYPE GLOBAL DEFAULT ABS __start_set_sysuninit_set
32: 000011b8 0 NOTYPE GLOBAL DEFAULT ABS __start_set_sysinit_set
63: 000011c0 0 NOTYPE GLOBAL DEFAULT ABS __start_set_modmetadata_s
73: 000011c4 0 NOTYPE GLOBAL DEFAULT ABS __start_set_sysuninit_set
88: 000011b8 0 NOTYPE GLOBAL DEFAULT ABS __start_set_sysinit_set
> readelf -s test222_mod.ko | grep __stop
15: 000011c8 0 NOTYPE GLOBAL DEFAULT ABS __stop_set_sysuninit_set
25: 000011c0 0 NOTYPE GLOBAL DEFAULT ABS __stop_set_sysinit_set
54: 000011c4 0 NOTYPE GLOBAL DEFAULT ABS __stop_set_modmetadata_se
71: 000011c8 0 NOTYPE GLOBAL DEFAULT ABS __stop_set_sysuninit_set
81: 000011c0 0 NOTYPE GLOBAL DEFAULT ABS __stop_set_sysinit_set
110: 000011c4 0 NOTYPE GLOBAL DEFAULT ABS __stop_set_modmetadata_se
The following patch was used to restore the __start_set and __stop_set sections
that were present in version 2.17 but disappeared by 2.20. Please confirm that
this is a bug and that the provided patch is the proper fix for the bug.
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 76b02f4..6a6b09e 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -1821,10 +1821,9 @@ lang_insert_orphan (asection *s,
e_align = exp_unop (ALIGN_K,
exp_intop ((bfd_vma) 1 << s->alignment_power));
lang_add_assignment (exp_assign (".", e_align));
- lang_add_assignment (exp_provide (symname,
+ lang_add_assignment (exp_assign (symname,
exp_unop (ABSOLUTE,
- exp_nameop (NAME, ".")),
- FALSE));
+ exp_nameop (NAME, "."))));
}
}
@@ -1854,9 +1853,8 @@ lang_insert_orphan (asection *s,
symname = (char *) xmalloc (ps - secname + sizeof "__stop_" + 1);
symname[0] = bfd_get_symbol_leading_char (link_info.output_bfd);
sprintf (symname + (symname[0] != 0), "__stop_%s", secname);
- lang_add_assignment (exp_provide (symname,
- exp_nameop (NAME, "."),
- FALSE));
+ lang_add_assignment (exp_assign (symname,
+ exp_nameop (NAME, ".")));
}
/* Restore the global list pointer. */
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
- [Bug ld/12641] New: Section symbols get discarded when assigned to the "dot",
binutils at marino dot st <=