pranavappu007 wrote:
But do I need the runtime library? I m using it like a standalone code, no environment.
If your compiler emits a call to a runtime library, then you either need the library, or you need an implementation of the called function(s) suitable to your needs. Standalone does not mean your compiler gains magical abilities, and it is still beneficial to outsource complicated things into a library.
pranavappu007 wrote:
Also, how can using modulo operator needs runtime libraries?
Because your CPU does not have the instructions needed for the job. lmod sounds to me like it is trying to divide a long number, possibly by a short one. C has the semantics that dividing a 64-bit number by a 32-bit number should return a 64-bit number, and also dividing two 64-bit numbers should return a 64-bit number. But in 32-bit mode, x86 only has instructions for dividing a 64-bit number by a 32-bit number, with the result to be contained in a 32-bit number, and if the result doesn't fit, a #DE is issued. You don't usually want that. So the compiler writers created a function called lmod that implements the division in different terms, probably as shifts and subtractions, and so the #DE is avoided and you actually get the correct result.
I am only guessing based on the name, though. From what little I've looked up, the above might still hold up, but you have to divide all numbers by two.