From efcc50dfdc94c82ee0292bf71992ecb7c0123061 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <stapelberg@debian.org>
Date: Tue, 14 May 2013 18:39:35 +0200
Subject: Imported Upstream version 1.1

---
 src/cmd/cc/dpchk.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

(limited to 'src/cmd/cc/dpchk.c')

diff --git a/src/cmd/cc/dpchk.c b/src/cmd/cc/dpchk.c
index 2f038f520..34163ff92 100644
--- a/src/cmd/cc/dpchk.c
+++ b/src/cmd/cc/dpchk.c
@@ -692,22 +692,24 @@ pragcgo(char *verb)
 		goto out;
 	}	
 	
-	if(strcmp(verb, "cgo_export") == 0 || strcmp(verb, "dynexport") == 0) {
+	if(strcmp(verb, "dynexport") == 0)
+		verb = "cgo_export_dynamic";
+	if(strcmp(verb, "cgo_export_static") == 0 || strcmp(verb, "cgo_export_dynamic") == 0) {
 		local = getimpsym();
 		if(local == nil)
 			goto err2;
 		if(!more()) {
-			fmtprint(&pragcgobuf, "cgo_export %q\n", local->name);
+			fmtprint(&pragcgobuf, "%s %q\n", verb, local->name);
 			goto out;
 		}
 		remote = getimpsym();
 		if(remote == nil)
 			goto err2;
-		fmtprint(&pragcgobuf, "cgo_export %q %q\n", local->name, remote->name);
+		fmtprint(&pragcgobuf, "%s %q %q\n", verb, local->name, remote->name);
 		goto out;
 	
 	err2:
-		yyerror("usage: #pragma cgo_export local [remote]");
+		yyerror("usage: #pragma %s local [remote]", verb);
 		goto out;
 	}
 	
@@ -749,6 +751,18 @@ pragcgo(char *verb)
 		goto out;
 	}
 	
+	if(strcmp(verb, "cgo_ldflag") == 0) {
+		p = getquoted();
+		if(p == nil)
+			goto err5;
+		fmtprint(&pragcgobuf, "cgo_ldflag %q\n", p);
+		goto out;
+
+	err5:
+		yyerror("usage: #pragma cgo_ldflag \"arg\"");
+		goto out;
+	}
+	
 out:
 	while(getnsc() != '\n')
 		;
-- 
cgit v1.2.3