shithub: scc

Download patch

ref: 950206e6394fe75a3b9bfebd4560128a686046db
parent: 74b3f8fbc062af088bc005f0a15a1415a287352f
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Apr 19 11:58:44 EDT 2020

libc: Use common symbols for _environ

.bss + long/quad doesn't guarantee a correct definition of global not
initialize symbols.  The correct definition must be a common block.

--- a/src/libc/arch/amd64/crt-posix.s
+++ b/src/libc/arch/amd64/crt-posix.s
@@ -1,7 +1,5 @@
-	.bss
 	.globl	_environ
-_environ:
-	.quad	0
+	.comm	_environ,8,8
 
 	.text
 	.globl	_start
--- a/src/libc/arch/arm32/crt-posix.s
+++ b/src/libc/arch/arm32/crt-posix.s
@@ -1,7 +1,5 @@
-	.bss
 	.globl	_environ
-_environ:
-	.word	0
+	.comm	_environ,4,4
 
 	.text
 	.globl	_start
--- a/src/libc/arch/arm64/crt-posix.s
+++ b/src/libc/arch/arm64/crt-posix.s
@@ -1,7 +1,5 @@
-	.bss
 	.globl	_environ
-_environ:
-	.quad	0
+	.comm	_environ,8,8
 
 	.text
 	.globl	_start
--- a/src/libc/arch/i386/crt-posix.s
+++ b/src/libc/arch/i386/crt-posix.s
@@ -1,10 +1,8 @@
-	.bss
 	.globl	_environ
-_environ:
-	.long	0
+	.comm	_environ,4,4
 
-	.text
 	.globl	_start
+	.text
 _start:
 	movl	%esp,%ebp