Linking

This stuff is somehow even more confusing. Still using: http://cs-fundamentals.com/c-programming/how-to-compile-c-program-using-gcc.php

In a perfect world we would then use ld to build an executable file with our .o file, but unfortunately, the example in the link above will not work.

Why will it not work? Likely because the names of the required libraries will be different or in different places, depending on your OS. So how would we figure this out?

Work through this compilation tutorial and dynamically link your helloworld ELF using LD.

https://github.com/adamaviv/si485h-f18/blob/master/units/unit_01.md

Stop at "Library Functions vs. System Calls" and don't go any further.

By the end of this, you should have two helloworld programs, with different source codes but similar outputs. Keep both of them, labeled as helloworld and helloaviv.

Task:

  • Submit text discussing anything that you struggled with and didn't understand, and what you did to overcome that problem. Include all the commands you ran. If you still don't understand, tell us what specifically you did not understand.