summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwin Jansen <jansene@google.com>2020-05-01 11:31:28 +0200
committerErwin Jansen <jansene@google.com>2020-05-01 11:38:43 +0200
commit6c302fcee964f2adff3447046f5fb4856b07d2a6 (patch)
treef0db9e822c3997346875dcdd0155714a68d487af
parent4a1f910150bed6d8afd9c7f89a437ca7060cdaee (diff)
downloadnasm-6c302fcee964f2adff3447046f5fb4856b07d2a6.tar.gz
Fix linker issue on MacOS
The linker on macos ignores "common" symbols, resulting in linker failures. We now explicitly initialize the zero buffer to make sure this doesn't happen. See https://stackoverflow.com/questions/28464770 for details on why this happens on MacOs. Bug: b/155459126 Change-Id: Ibf1a8818a9ad2675861883fbbe2c5b7103585004
-rw-r--r--nasmlib/zerobuf.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/nasmlib/zerobuf.c b/nasmlib/zerobuf.c
index 651c0fd4..cb35af52 100644
--- a/nasmlib/zerobuf.c
+++ b/nasmlib/zerobuf.c
@@ -1,5 +1,5 @@
/* ----------------------------------------------------------------------- *
- *
+ *
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
@@ -14,7 +14,7 @@
* 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 COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
@@ -38,5 +38,7 @@
#include "compiler.h"
#include "nasmlib.h"
-/* Uninitialized -> all zero by C spec */
-const uint8_t zero_buffer[ZERO_BUF_SIZE];
+/* Explicitly initialize buffer, as some linkers will drop common symbols
+ (See https://stackoverflow.com/questions/28464770)
+*/
+const uint8_t zero_buffer[ZERO_BUF_SIZE] = {0}; \ No newline at end of file