Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160493274
D40623.id123756.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D40623.id123756.diff
View Options
diff --git a/lib/csu/Makefile.inc b/lib/csu/Makefile.inc
--- a/lib/csu/Makefile.inc
+++ b/lib/csu/Makefile.inc
@@ -20,7 +20,6 @@
ACFLAGS+= -DLOCORE
CFLAGS+= -DSTRIP_FBSDID
-CFLAGS+= -fno-asynchronous-unwind-tables
CFLAGS+= -fno-omit-frame-pointer
CFLAGS+= -I${.CURDIR:H}/common \
-I${SRCTOP}/lib/libc/include
diff --git a/lib/csu/aarch64/crt1_c.c b/lib/csu/aarch64/crt1_c.c
--- a/lib/csu/aarch64/crt1_c.c
+++ b/lib/csu/aarch64/crt1_c.c
@@ -35,7 +35,8 @@
#include "libc_private.h"
#include "csu_common.h"
-void __start(int, char **, char **, void (*)(void)) __dead2;
+void _start(int, char **, char **, void (*)(void)) __hidden __dead2;
+void __start(int, char **, char **, void (*)(void)) __hidden __dead2;
/* The entry function. */
void
diff --git a/lib/csu/aarch64/crt1_s.S b/lib/csu/aarch64/crt1_s.S
--- a/lib/csu/aarch64/crt1_s.S
+++ b/lib/csu/aarch64/crt1_s.S
@@ -33,12 +33,15 @@
__FBSDID("$FreeBSD$");
ENTRY(_start)
+ .cfi_undefined x30
+ mov x29,#0
+ mov x30,#0
mov x3, x2 /* cleanup */
add x1, x0, #8 /* load argv */
ldr x0, [x0] /* load argc */
add x2, x1, x0, lsl #3 /* env is after argv */
add x2, x2, #8 /* argv is null terminated */
- b __start
+ bl __start
END(_start)
.section .note.GNU-stack,"",@progbits
diff --git a/lib/csu/amd64/Makefile b/lib/csu/amd64/Makefile
--- a/lib/csu/amd64/Makefile
+++ b/lib/csu/amd64/Makefile
@@ -5,4 +5,6 @@
CFLAGS+= -I${.CURDIR}
CFLAGS+= -fno-omit-frame-pointer
+CRT1OBJS+= crt1_s.o
+
.include <bsd.lib.mk>
diff --git a/lib/csu/amd64/crt1_c.c b/lib/csu/amd64/crt1_c.c
--- a/lib/csu/amd64/crt1_c.c
+++ b/lib/csu/amd64/crt1_c.c
@@ -32,11 +32,12 @@
#include "libc_private.h"
#include "csu_common.h"
-void _start(char **, void (*)(void)) __dead2;
+void _start(char **, void (*)(void)) __hidden __dead2;
+void _start1(char **, void (*)(void)) __hidden __dead2;
/* The entry function. */
void
-_start(char **ap, void (*cleanup)(void))
+_start1(char **ap, void (*cleanup)(void))
{
int argc;
char **argv;
diff --git a/lib/csu/amd64/crt1_s.S b/lib/csu/amd64/crt1_s.S
new file mode 100644
--- /dev/null
+++ b/lib/csu/amd64/crt1_s.S
@@ -0,0 +1,43 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2023 Dmitry Chagin <dchagin@FreeBSD.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+ .text
+
+ENTRY(_start)
+ .cfi_undefined %rip /* Terminate call stack. */
+ .cfi_def_cfa %rsp, 0
+ xorq %rbp,%rbp
+ pushq %rbp /* Align stack. */
+ .cfi_def_cfa_offset 8
+ movq %rsp,%rbp
+ .cfi_offset %rbp, -8
+ callq _start1
+END(_start)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/csu/i386/crt1_s.S b/lib/csu/i386/crt1_s.S
--- a/lib/csu/i386/crt1_s.S
+++ b/lib/csu/i386/crt1_s.S
@@ -31,6 +31,7 @@
.type _start, @function
_start:
.cfi_startproc
+ .cfi_undefined %eip
xorl %ebp,%ebp
pushl %ebp
.cfi_def_cfa_offset 4
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jun 26, 2:17 AM (1 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34336861
Default Alt Text
D40623.id123756.diff (4 KB)
Attached To
Mode
D40623: csu: Add a stop indicator to _start to satisfy unwinders on aarch64
Attached
Detach File
Event Timeline
Log In to Comment