[PATCH] ftrace: Align __mcount_loc sections
From: Matt Fleming
Date: Fri Nov 07 2008 - 08:26:25 EST
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@xxxxxxxxxx>
---
scripts/recordmcount.pl | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 6b9fe3e..2d0bfa1 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -134,6 +134,7 @@ my $section_regex; # Find the start of a section
my $function_regex; # Find the name of a function
# (return offset and func name)
my $mcount_regex; # Find the call site to mcount (return offset)
+my $alignment; # The .align value to use for $mcount_section
if ($arch eq "x86") {
if ($bits == 64) {
@@ -148,6 +149,7 @@ if ($arch eq "x86_64") {
$function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";
$mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$";
$type = ".quad";
+ $alignment = 8;
# force flags for this arch
$ld .= " -m elf_x86_64";
@@ -160,6 +162,7 @@ if ($arch eq "x86_64") {
$function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";
$mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$";
$type = ".long";
+ $alignment = 4;
# force flags for this arch
$ld .= " -m elf_i386";
@@ -288,6 +291,7 @@ sub update_funcs
open(FILE, ">$mcount_s") || die "can't create $mcount_s\n";
$opened = 1;
print FILE "\t.section $mcount_section,\"a\",\@progbits\n";
+ print FILE "\t.align $alignment\n";
}
printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset;
}
--
1.5.6.4
------=_Part_28270_2851883.1226066379088
Content-Type: text/x-diff;
name=0001-ftrace-Align-__mcount_loc-sections.patch
Content-Transfer-Encoding: base64
X-Attachment-Id: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fcmVnZXggPSAiXlxccyooWzAtOWEtZkEtRl0rKTouKlxcc21jb3VudFwkIjsKICAgICAk
dHlwZSA9ICIubG9uZyI7CisgICAgJGFsaWdubWVudCA9IDQ7CiAKICAgICAjIGZvcmNlIGZsYWdz
IGZvciB0aGlzIGFyY2gKICAgICAkbGQgLj0gIiAtbSBlbGZfaTM4NiI7CkBAIC0yODgsNiArMjkx
LDcgQEAgc3ViIHVwZGF0ZV9mdW5jcwogCSAgICBvcGVuKEZJTEUsICI+JG1jb3VudF9zIikgfHwg
ZGllICJjYW4ndCBjcmVhdGUgJG1jb3VudF9zXG4iOwogCSAgICAkb3BlbmVkID0gMTsKIAkgICAg
cHJpbnQgRklMRSAiXHQuc2VjdGlvbiAkbWNvdW50X3NlY3Rpb24sXCJhXCIsXEBwcm9nYml0c1xu
IjsKKwkgICAgcHJpbnQgRklMRSAiXHQuYWxpZ24gJGFsaWdubWVudFxuIjsKIAl9CiAJcHJpbnRm
IEZJTEUgIlx0JXMgJXMgKyAlZFxuIiwgJHR5cGUsICRyZWZfZnVuYywgJG9mZnNldHNbJGldIC0g
JG9mZnNldDsKICAgICB9Ci0tIAoxLjUuNi40Cgo=
------=_Part_28270_2851883.1226066379088--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/