Commit 7d5222a6afa4e429f55df8c086adb747837cbdf5
Committed by
Ingo Molnar
1 parent
c76f06945b
Exists in
master
and in
4 other branches
ftrace: align __mcount_loc sections
Impact: add alignment option for recordmcount.pl script Align the __mcount_loc sections so that architectures with strict alignment requirements need not worry about performing unaligned accesses. This fixes an issue where I was seeing unaligned accesses, which are not supported on our architecture (the results of an unaligned access are undefined). Signed-off-by: Matt Fleming <matthew.fleming@imgtec.com> Signed-off-by: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff
scripts/recordmcount.pl
... | ... | @@ -134,6 +134,7 @@ |
134 | 134 | my $function_regex; # Find the name of a function |
135 | 135 | # (return offset and func name) |
136 | 136 | my $mcount_regex; # Find the call site to mcount (return offset) |
137 | +my $alignment; # The .align value to use for $mcount_section | |
137 | 138 | |
138 | 139 | if ($arch eq "x86") { |
139 | 140 | if ($bits == 64) { |
... | ... | @@ -148,6 +149,7 @@ |
148 | 149 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
149 | 150 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; |
150 | 151 | $type = ".quad"; |
152 | + $alignment = 8; | |
151 | 153 | |
152 | 154 | # force flags for this arch |
153 | 155 | $ld .= " -m elf_x86_64"; |
... | ... | @@ -160,6 +162,7 @@ |
160 | 162 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
161 | 163 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; |
162 | 164 | $type = ".long"; |
165 | + $alignment = 4; | |
163 | 166 | |
164 | 167 | # force flags for this arch |
165 | 168 | $ld .= " -m elf_i386"; |
... | ... | @@ -288,6 +291,7 @@ |
288 | 291 | open(FILE, ">$mcount_s") || die "can't create $mcount_s\n"; |
289 | 292 | $opened = 1; |
290 | 293 | print FILE "\t.section $mcount_section,\"a\",\@progbits\n"; |
294 | + print FILE "\t.align $alignment\n"; | |
291 | 295 | } |
292 | 296 | printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset; |
293 | 297 | } |