Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753769Ab0GJWZl (ORCPT ); Sat, 10 Jul 2010 18:25:41 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:49225 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753180Ab0GJWZk (ORCPT ); Sat, 10 Jul 2010 18:25:40 -0400 MIME-Version: 1.0 In-Reply-To: <20100710063459.GA14596@merkur.ravnborg.org> References: <1278705402.1537.157.camel@gandalf.stny.rr.com> <20100709203301.GA13839@merkur.ravnborg.org> <1278721339.1537.166.camel@gandalf.stny.rr.com> <20100710063459.GA14596@merkur.ravnborg.org> Date: Sat, 10 Jul 2010 15:25:02 -0700 Message-ID: Subject: Re: [PATCH] tracing: properly align linker defined symbols From: Linus Torvalds To: Sam Ravnborg Cc: Steven Rostedt , Zeev Tarantov , LKML , Ingo Molnar , Frederic Weisbecker , Andrew Morton , "Rafael J. Wysocki" Content-Type: multipart/mixed; boundary=000e0cd598cc9cd122048b0ffd91 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 8475 Lines: 164 --000e0cd598cc9cd122048b0ffd91 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Jul 9, 2010 at 11:35 PM, Sam Ravnborg wrote: > > We define a number of symbols in the linker scipt like this: > > =A0 =A0__start_syscalls_metadata =3D .; > =A0 =A0*(__syscalls_metadata) > > But we do not know the alignment of "." when we assign > the __start_syscalls_metadata symbol. > gcc started to uses bigger alignment for structs (32 bytes), > so we saw situations where the linker due to alignment > constraints increased the value of "." after the symbol assignment. Ok, why not clean this up a bit more, and use a helper macro for this pattern. There's a fair number of users of that kind of pattern, so that actually removes a few lines. Here's an example patch. Untested. Whatever. But just this part 1 files changed, 21 insertions(+), 31 deletions(-) says to me that it's a good idea, and there are other cases that could use the new SYMBOL_SECTION() helper. What do people think? Linus > > This resulted in boot fails. > > Fix this by forcing a 32 byte alignment of "." before the > assignment. > > This patch introduces the forced alignment for > ftrace_events and syscalls_metadata. > It may be required in more places. > > Reported-by: Zeev Tarantov > Signed-off-by: Sam Ravnborg > Cc: Steven Rostedt > Cc: Frederic Weisbecker > --- > =A0include/asm-generic/vmlinux.lds.h | =A0 10 ++++++++++ > =A01 files changed, 10 insertions(+), 0 deletions(-) > > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmli= nux.lds.h > index 48c5299..4b5902a 100644 > --- a/include/asm-generic/vmlinux.lds.h > +++ b/include/asm-generic/vmlinux.lds.h > @@ -63,6 +63,12 @@ > =A0/* Align . to a 8 byte boundary equals to maximum function alignment. = */ > =A0#define ALIGN_FUNCTION() =A0. =3D ALIGN(8) > > +/* > + * Align to a 32 byte boundary equal to the > + * alignment gcc 4.5 uses for a struct > + */ > +#define STRUCT_ALIGN() . =3D ALIGN(32) > + > =A0/* The actual configuration determine if the init/exit sections > =A0* are handled as text/data or they can be discarded (which > =A0* often happens at runtime) > @@ -166,7 +172,11 @@ > =A0 =A0 =A0 =A0LIKELY_PROFILE() =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\ > =A0 =A0 =A0 =A0BRANCH_PROFILE() =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0\ > =A0 =A0 =A0 =A0TRACE_PRINTKS() =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > + =A0 =A0 =A0 STRUCT_ALIGN(); =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > =A0 =A0 =A0 =A0FTRACE_EVENTS() =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > + =A0 =A0 =A0 STRUCT_ALIGN(); =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \ > =A0 =A0 =A0 =A0TRACE_SYSCALLS() > > =A0/* > -- > 1.6.0.6 > > --000e0cd598cc9cd122048b0ffd91 Content-Type: application/octet-stream; name=diff Content-Disposition: attachment; filename=diff Content-Transfer-Encoding: base64 X-Attachment-Id: f_gbh0wewl0 IGluY2x1ZGUvYXNtLWdlbmVyaWMvdm1saW51eC5sZHMuaCB8ICAgNTIgKysrKysrKysrKysrKysr LS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogMSBmaWxlcyBjaGFuZ2VkLCAyMSBpbnNlcnRpb25zKCsp LCAzMSBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9pbmNsdWRlL2FzbS1nZW5lcmljL3ZtbGlu dXgubGRzLmggYi9pbmNsdWRlL2FzbS1nZW5lcmljL3ZtbGludXgubGRzLmgKaW5kZXggNDhjNTI5 OS4uYjkxYTU1NS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uOwkJCQlcCi0JKihfX21hcmtlcnMpCQkJCQkJ CVwKLQlWTUxJTlVYX1NZTUJPTChfX3N0b3BfX19tYXJrZXJzKSA9IC47CQkJCVwKLQkuID0gQUxJ R04oMzIpOwkJCQkJCQlcCi0JVk1MSU5VWF9TWU1CT0woX19zdGFydF9fX3RyYWNlcG9pbnRzKSA9 IC47CQkJXAotCSooX190cmFjZXBvaW50cykJCQkJCQlcCi0JVk1MSU5VWF9TWU1CT0woX19zdG9w X19fdHJhY2Vwb2ludHMpID0gLjsJCQlcCisJU1lNQk9MX1NFQ1RJT04oX19tYXJrZXJzLCBfX21h cmtlcnMpCQkJCVwKKwlTWU1CT0xfU0VDVElPTihfX3RyYWNlcG9pbnRzLCBfX3RyYWNlcG9pbnRz KTsJCQlcCiAJLyogaW1wbGVtZW50IGR5bmFtaWMgcHJpbnRrIGRlYnVnICovCQkJCVwKLQkuID0g QUxJR04oOCk7CQkJCQkJCVwKLQlWTUxJTlVYX1NZTUJPTChfX3N0YXJ0X19fdmVyYm9zZSkgPSAu OyAgICAgICAgICAgICAgICAgICAgICAgICAgXAotCSooX192ZXJib3NlKSAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCi0JVk1MSU5VWF9TWU1CT0wo X19zdG9wX19fdmVyYm9zZSkgPSAuOwkJCQlcCisJU1lNQk9MX1NFQ1RJT04oX192ZXJib3NlLCBf X3ZlcmJvc2UpCQkJCVwKIAlMSUtFTFlfUFJPRklMRSgpCQkgICAgICAgCQkJCVwKIAlCUkFOQ0hf UFJPRklMRSgpCQkJCQkJXAogCVRSQUNFX1BSSU5US1MoKQkJCQkJCQlcCg== --000e0cd598cc9cd122048b0ffd91-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/