diff options
author | Anas Nashif <anashif@tizendev.org> | 2012-05-23 08:22:02 +0900 |
---|---|---|
committer | Gerrit Code Review <gerrit2@localhost> | 2012-05-23 08:22:02 +0900 |
commit | b9fae45f49f97914a89b763028f5dbf8b70a9cbc (patch) | |
tree | a76f72f9a6d751f31456309e3cfdf3022b6c5546 /test/objlink.c | |
parent | ecc629773ccf1eaae669dce3d2b017ed476ce911 (diff) | |
parent | b9fad1ab2ad3bd87bff05c4688c978d582ada438 (diff) | |
download | nasm-b9fae45f49f97914a89b763028f5dbf8b70a9cbc.tar.gz nasm-b9fae45f49f97914a89b763028f5dbf8b70a9cbc.tar.bz2 nasm-b9fae45f49f97914a89b763028f5dbf8b70a9cbc.zip |
Merge " Upstream version 2.08rc7"
Diffstat (limited to 'test/objlink.c')
-rw-r--r-- | test/objlink.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/objlink.c b/test/objlink.c new file mode 100644 index 0000000..b767b01 --- /dev/null +++ b/test/objlink.c @@ -0,0 +1,33 @@ +/* + * test source file for assembling to Microsoft 16-bit .OBJ + * build with (16-bit Microsoft C): + * nasm -f obj objtest.asm + * cl /AL objtest.obj objlink.c + * other compilers should work too, provided they handle large + * model in the same way as MS C + */ + +#include <stdio.h> +#include <inttypes.h> + +int8_t text[] = "hello, world\n"; + +extern void function(int8_t *); +extern int bsssym, commvar; +extern void *selfptr; +extern void *selfptr2; + +int main(void) +{ + printf("these should be identical: %p, %p\n", + (int32_t)selfptr, (int32_t)&selfptr); + printf("these should be equivalent but different: %p, %p\n", + (int32_t)selfptr2, (int32_t)&selfptr2); + printf("you should see \"hello, world\" twice:\n"); + bsssym = 0xF00D; + commvar = 0xD00F; + function(text); + printf("this should be 0xF00E: 0x%X\n", bsssym); + printf("this should be 0xD00E: 0x%X\n", commvar); + return 0; +} |