Vibhor, coming back to your question, there are two different paths.
if all you need is to route the printf from the risc-v elf to your simulator console, you can use the current libgloss and implement the ECALL in the simulator to process the write system call in order to identify the stdout and forward the stream to wherever you want.
if you need to also run your elf on a physical target (even synthesised on an FPGA), connected to a debugger (like OpenOCD) via a JTAG connection, the current libgloss won't do it, since the ECALL will fail on a bare-metal device.
the solution is to use a semihosting protocol, which, instead of ECALL uses BRK, to break to the debugger.
of course you can invent your own protocol, but once you do it, you need to implement it in all the debuggers you plan to use.
the industry de-facto protocol is ARM semihosting, which is already implemented by most debuggers (for sure in OpenOCD, since I contributed the implementation), and it is perfectly possible to use the same protocol with risc-v devices.
to be noted that the semihosting solution is more general, you can run the same binary image both on a physical target via a debugger and on a simulator, since the semihosting protocol can be easily implemented on a simulator, while the ECALL solution normally cannot be used with a debugger, (since ECALL does not break to the debugger, only BRK can do it).
regards,
Liviu