Linker
Re:Linker
That's a nice idea. You might want to pick up a copy of Aho, Sethi and Ullman's Compilers - Principles, Techniques and Tools and the book Linkers and Loaders (which you can download and print for free, use google).khc0d wrote: hey!
i want to write linker which makes .exe files.What do you think about it?
If you use those two to the letter you should get quite far. Remember that writing a linker is quite hard, complex and can get you debugging for days.
Do you have any experience with the file format you want to use as input or output? Try to understand the format first. Then try to understand all of its details and quirks, think up a nice way to structure the linker and make a hello world input file (whichever type you like). Then, make that part work using the design. If you get this working and the design is good, you can pretty much use it to finish up.
Good luck. Writing a proper linker is a few years of work for somebody who knows how it all should be.
Hint: Try searching for PE and/or COFF exe files, that should give more useful results.
Re:Linker
Nice. What should it be able to do? Did you design it yet?khc0d wrote: yeah,i know format of PE-files. and i am making programm(Exeditor),.it's PE-editor.
Then... what are your questions?And i have "Linkers and loaders". But i have few questions about it.
Re:Linker
For what are object files needed?
Erm...
You know how the translation process works in C, usually? You translate each .c (source) file into an .o (object) file. These are either put together into a linker library, or linked to form an executable / runtime library.
The advantages are that, 1) if you have changed one source file, you only have to re-translate a fraction of the source as compared to when all source files were compiled directly into an executable. And 2), a linker library put together by multiple object files means that the linker has to link in only those object files that are actually needed, instead of all of them.
If that really was your question, though, I doubt that writing a linker is the right project for you...
Erm...
You know how the translation process works in C, usually? You translate each .c (source) file into an .o (object) file. These are either put together into a linker library, or linked to form an executable / runtime library.
The advantages are that, 1) if you have changed one source file, you only have to re-translate a fraction of the source as compared to when all source files were compiled directly into an executable. And 2), a linker library put together by multiple object files means that the linker has to link in only those object files that are actually needed, instead of all of them.
If that really was your question, though, I doubt that writing a linker is the right project for you...
Every good solution is obvious once you've found it.
Re:Linker
Oi, oi, oi...
1) Source is documentation for compilers, not for people.
2) You just reinforced my impression that writing a linker is at least two leagues over your head. (It's at least one league over my head.)
If you insist, try GNU 'binutils'. It includes 'ld', which is one of the most powerful linkers available.
1) Source is documentation for compilers, not for people.
2) You just reinforced my impression that writing a linker is at least two leagues over your head. (It's at least one league over my head.)
If you insist, try GNU 'binutils'. It includes 'ld', which is one of the most powerful linkers available.
Every good solution is obvious once you've found it.
Re:Linker
I can confirm this.Solar wrote: 2) You just reinforced my impression that writing a linker is at least two leagues over your head. (It's at least one league over my head.)
For the record, a league is 4828.03 meters.