Skip to content

Commit 2a45e61

Browse files
committed
Only the top-level section should be considered for renaming
The Linux kernel first places `jiffies64` in .data, and later refines that to .data..cacheline_aligned. The latter still is within the .data section, though, so just use the .data part for renaming.
1 parent 9c66a66 commit 2a45e61

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/ansi-c/c_typecheck_base.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,18 @@ void c_typecheck_baset::typecheck_declaration(
721721
apply_asm_label(full_spec.asm_label, symbol);
722722
else
723723
{
724-
std::string asm_name;
725-
asm_name=id2string(full_spec.section)+"$$";
724+
// section name is not empty, do a bit of parsing
725+
std::string asm_name = id2string(full_spec.section);
726+
if(asm_name[0] != '.')
727+
{
728+
warning().source_location = symbol.location;
729+
warning() << "section name `" << asm_name
730+
<< "' expected to start with `.'" << eom;
731+
}
732+
std::string::size_type primary_section = asm_name.find('.', 1);
733+
if(primary_section != std::string::npos)
734+
asm_name.resize(primary_section);
735+
asm_name += "$$";
726736
if(!full_spec.asm_label.empty())
727737
asm_name+=id2string(full_spec.asm_label);
728738
else

0 commit comments

Comments
 (0)