placing .align after the function start is crazy. other things are ensuring
authorderaadt <deraadt@openbsd.org>
Tue, 25 Apr 2023 04:06:06 +0000 (04:06 +0000)
committerderaadt <deraadt@openbsd.org>
Tue, 25 Apr 2023 04:06:06 +0000 (04:06 +0000)
this function is at the start of the section, there is no poing in potentially
stuffing nops into the sequence if things go wrong, it is better to fail hard.
ok guenther

lib/csu/amd64/md_init.h
lib/csu/i386/md_init.h

index 83365c3..329c2d3 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: md_init.h,v 1.8 2020/10/15 16:30:23 deraadt Exp $ */
+/* $OpenBSD: md_init.h,v 1.9 2023/04/25 04:06:06 deraadt Exp $ */
 
 /*-
  * Copyright (c) 2001 Ross Harvey
        "       call " #func "\n"               \
        "       .previous")
 
-/*
- * Align is after because we want the function to start at the first
- * address of the section, but overall we want the section to be
- * aligned by the align amount.
- */
 #define MD_SECTION_PROLOGUE(sect, entry_pt)    \
        __asm (                                 \
        ".section "#sect",\"ax\",@progbits      \n" \
        "       .globl " #entry_pt "            \n" \
        "       .type " #entry_pt ",@function   \n" \
-       #entry_pt":                             \n" \
        "       .align 16                       \n" \
+       #entry_pt":                             \n" \
        "       subq    $8,%rsp                 \n" \
        "       .previous")
 
index 64d7aeb..efd601d 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: md_init.h,v 1.11 2020/10/15 16:30:23 deraadt Exp $ */
+/* $OpenBSD: md_init.h,v 1.12 2023/04/25 04:06:06 deraadt Exp $ */
 
 /*-
  * Copyright (c) 2001 Ross Harvey
        "       call " #func "\n"               \
        "       .previous")
 
-/*
- * Align is after because we want the function to start at the first
- * address of the section, but overall we want the section to be
- * aligned by the align amount.
- */
 #define MD_SECTION_PROLOGUE(sect, entry_pt)    \
        __asm (                                 \
        ".section "#sect",\"ax\",@progbits      \n" \
        "       .globl " #entry_pt "            \n" \
        "       .type " #entry_pt ",@function   \n" \
-       #entry_pt":                             \n" \
        "       .align 16                       \n" \
+       #entry_pt":                             \n" \
        "       pushl   %ebp                    \n" \
        "       movl    %esp,%ebp               \n" \
        "       andl    $~15,%esp               \n" \