Perverse mixing of C and assembly
I've been finding lately that it is really convenient to write a whole bunch of assembly and then glue it together with a little bit of C. However, there is one issue I've been wondering about: is there some way to use an undefined symbol in a file of C code?
Say, as my primary example, I create assembly file data.S that contains a .data section, which contains object "specialdat" consisting of 64 bytes of various data. I can use that symbol in various other assembly files, because the assembler (gas) allows me to have undefined symbols in individual files which are resolved later. But what if I want to use specialdat in the C file (say, to pass it to a function that takes a void pointer to refer to a block of memory). Is there a way I can do that? GCC will allow me to use the functions from the assembly files in the C file without declaring them, so one would think there would be a way to do it with a symbol that simply points to data.
Of course, I could create the data block in the C file and then reference it from the assembly files, but lets say that I preferred to create the data in an assembly file instead.
|