aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile9
-rw-r--r--tests/asm-c-connect-1.c9
-rw-r--r--tests/asm-c-connect-2.c9
3 files changed, 26 insertions, 1 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 61b585e..f06f39c 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -235,9 +235,16 @@ vla_test-run: vla_test$(EXESUF)
asm-c-connect$(EXESUF): asm-c-connect-1.c asm-c-connect-2.c
$(TCC) -o $@ $^
-asm-c-connect-test: asm-c-connect$(EXESUF)
+asm-c-connect-%.o: asm-c-connect-%.c
+ $(TCC) -c -o $@ $<
+
+asm-c-connect-sep$(EXESUF): asm-c-connect-1.o asm-c-connect-2.o
+ $(TCC) -o $@ $^
+
+asm-c-connect-test: asm-c-connect$(EXESUF) asm-c-connect-sep$(EXESUF)
@echo ------------ $@ ------------
./asm-c-connect$(EXESUF)
+ ./asm-c-connect-sep$(EXESUF)
cross-test :
@echo ------------ $@ ------------
diff --git a/tests/asm-c-connect-1.c b/tests/asm-c-connect-1.c
index c3dcf2b..1849b56 100644
--- a/tests/asm-c-connect-1.c
+++ b/tests/asm-c-connect-1.c
@@ -15,12 +15,15 @@ static int x1_c(void)
asm(".text;"_"x1: call "_"x1_c; ret");
void callx4(void);
+void callx5_again(void);
int main(int argc, char *argv[])
{
asm("call "_"x1");
asm("call "_"x2");
asm("call "_"x3");
callx4();
+ asm("call "_"x5");
+ callx5_again();
return 0;
}
@@ -37,3 +40,9 @@ void x4(void)
{
printf("x4\n");
}
+
+void x5(void);
+void x5(void)
+{
+ printf("x5\n");
+}
diff --git a/tests/asm-c-connect-2.c b/tests/asm-c-connect-2.c
index 7ab9dc3..5dad26c 100644
--- a/tests/asm-c-connect-2.c
+++ b/tests/asm-c-connect-2.c
@@ -6,5 +6,14 @@ int x3(void)
return 3;
}
+/* That callx4 is defined globally (as if ".globl callx4")
+ is a TCC extension. GCC doesn't behave like this. */
void callx4(void);
__asm__("callx4: call x4; ret");
+
+extern void x5(void);
+void callx5_again(void);
+void callx5_again(void)
+{
+ x5();
+}