linker

Discussion in 'C Programming' started by George2, Feb 19, 2008.

  1. George2

    George2

    Joined:
    Feb 12, 2008
    Messages:
    108
    Hello everyone,


    Here are two conflicting documents from MSDN. About whether linker will modify code generated by compiler. I quote both of them here.

    Document (1) mentioned linker can not modify any code generated by compiler, but document (2) mentioned linker will replace address code generated by compiler during fixup process.

    Which one is correct?

    1.

    http://blogs.msdn.com/oldnewthing/archive/2006/07/21/673830.aspx

    --------------------
    But the linker can't rewrite the code generated by the compiler.
    --------------------

    2.

    http://www.microsoft.com/msj/0797/hood0797.aspx

    --------------------
    Consider a call to a function named Foo in C++:


    //...
    Foo();
    //...



    The exact bytes emitted from a 32-bit C++ compiler will be this:


    E8 00 00 00 00



    The 0xE8 is the CALL instruction opcode. The next DWORD should contain the offset to the Foo function (relative to the CALL instruction). It's pretty clear that Foo probably isn't zero bytes away from the CALL instruction. Simply put, this code wouldn't work as expected if you were to execute it. The code is broken, and needs to be fixed up. In the above example, the linker needs to replace the DWORD following the CALL opcode with the correct address of Foo.
    --------------------


    thanks in advance,
    George
    George2, Feb 19, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Namratha Shah \(Nasha\)
    Replies:
    0
    Views:
    5,312
    Namratha Shah \(Nasha\)
    Nov 3, 2004
  2. George Durzi

    Assembly Linker Question

    George Durzi, Feb 5, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    3,138
    Alvin Bruney [MVP]
    Mar 2, 2004
  3. Davenport   | ATC uk RAF |   1 1 8 9  Squadron

    Java 88x31 linker buttons

    Davenport | ATC uk RAF | 1 1 8 9 Squadron, Mar 3, 2004, in forum: Java
    Replies:
    1
    Views:
    318
    Andrew Thompson
    Mar 3, 2004
  4. Wolfgang Rueckert

    Linker error - unsolved external symbol

    Wolfgang Rueckert, Jun 30, 2003, in forum: C++
    Replies:
    0
    Views:
    713
    Wolfgang Rueckert
    Jun 30, 2003
  5. MiniDisc_2k2

    Linker Errors

    MiniDisc_2k2, Jul 5, 2003, in forum: C++
    Replies:
    2
    Views:
    393
    MiniDisc_2k2
    Jul 5, 2003
Loading...

Share This Page