shithub: scc

Download patch

ref: cbc25129f24988965a55c87501f7e36cbd6fc245
parent: d87648e6d3b8b6d2f6f430a7ef1c4f378feeae09
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Jan 26 09:24:36 EST 2016

[cc2-i386] Emit .extern for external variables

This is not needed with gas, because it is totally stupid and
it sets as external by default all the symbols, but it is a good
idea to use it if we want to move to other assembler in the future.

--- a/cc2/arch/i386-sysv/code.c
+++ b/cc2/arch/i386-sysv/code.c
@@ -164,8 +164,9 @@
 	segment(seg);
 
 	switch (sym->kind) {
-	case LOCAL:
 	case EXTRN:
+		printf("\t.extern\t%s\n", name);
+	case LOCAL:
 		return;
 	case GLOB:
 		printf("\t.globl\t%s\n", name);