I'm following along in some books on assembler and find that they happily use fprintf with stdout. They simply reference stdout as a known symbol. I tried to do that in my code, and the linker complains that stdout is not found. I tried variation on spelling including a leading underscore. I also disassembled printf. It sets up a call to vfprintf using the following line:
leaq 0x41879948(%rip), %rax ; __stdoutp
So it seems like I should be able to do something like:
leaq __stdoutp(%rip), %rdi
Didn't work. Linker complains of undefined symbol. Tried with variations. Left off the p suffix, one or both of the underscores. Nothing worked.
Any ideas, or insider knowledge I can follow to access to this symbol?