Skip to content

Commit df8a3fa

Browse files
authored
Merge pull request google#159 from keir/master
Add segment index to segment labels
2 parents 8bea013 + 5b31a85 commit df8a3fa

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/elf.cc

+14-1
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,20 @@ static void DoReadELFSegments(RangeSink* sink, ReportSegmentsBy report_by) {
11171117
continue;
11181118
}
11191119

1120-
std::string name = "LOAD [";
1120+
// Include the segment index in the label, to support embedded.
1121+
//
1122+
// Including the index in the segment label differentiates
1123+
// segments with the same access control (e.g. RWX vs RW). In
1124+
// ELF files built for embedded microcontroller projects, a
1125+
// segment is used for each distinct type of memory. In simple
1126+
// cases, there is a segment for the flash (which will store
1127+
// code and read-only data) and a segment for RAM (which
1128+
// usually stores globals, stacks, and maybe a heap). In more
1129+
// involved projects, there may be special segments for faster
1130+
// RAM (e.g. core coupled RAM or CCRAM), or there may even be
1131+
// memory overlays to support manual paging of code from flash
1132+
// (which may be slow) into RAM.
1133+
std::string name(absl::StrCat("LOAD #", i, " ["));
11211134

11221135
if (header.p_flags & PF_R) {
11231136
name += 'R';

0 commit comments

Comments
 (0)