Re: What exactly is __ALIGN_STR in pnpbios/bioscalls.c for?

From: Sam Ravnborg
Date: Sun Nov 21 2004 - 17:16:59 EST


On Sun, Nov 21, 2004 at 09:29:32PM +0100, Andreas Schwab wrote:
> Adrian Bunk <bunk@xxxxxxxxx> writes:

> It's for aligning function entries to a 16 byte boundary instead of only 4
> bytes, used together with -malign-functions. See also the ENTRY macro.
> Note that the default value of __ALIGN is actually useless for anything
> but x86 and x86-64.

Recently someone complained that __sched_text_start changed address during
pass one and two of kallsyms. The actual culprint was that an
address changed due to different section layout.
The fix I posted was to align .sched.text to an 8 byte boundary.

Can we say anything about alignment of functions across architectures?

Patch in question below.
Grepping tells me to use FUNCTION_ALIGN if I push this for inclusion.

Sam

===== include/asm-generic/vmlinux.lds.h 1.16 vs edited =====
--- 1.16/include/asm-generic/vmlinux.lds.h 2004-10-06 18:45:06 +02:00
+++ edited/include/asm-generic/vmlinux.lds.h 2004-11-06 21:56:11 +01:00
@@ -6,6 +6,11 @@
#define VMLINUX_SYMBOL(_sym_) _sym_
#endif

+/* Aling functions to a 8 byte boundary.
+ * This prevents lables defined to mark start/end of section to differ
+ * during pass 1 and pass 2 when generating System.map */
+#define ALIGN_FUNCTION() . = ALIGN(8)
+
#define RODATA \
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
*(.rodata) *(.rodata.*) \
@@ -77,11 +82,13 @@
}

#define SCHED_TEXT \
+ ALIGN_FUNCTION(); \
VMLINUX_SYMBOL(__sched_text_start) = .; \
*(.sched.text) \
VMLINUX_SYMBOL(__sched_text_end) = .;

#define LOCK_TEXT \
+ ALIGN_FUNCTION(); \
VMLINUX_SYMBOL(__lock_text_start) = .; \
*(.spinlock.text) \
VMLINUX_SYMBOL(__lock_text_end) = .;
-
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/