Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2008

Tip: Looking for answers? Try searching our database.

linker

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George3 - 19 Feb 2008 03:50 GMT
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.

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

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

2.

[url]http://www.microsoft.com/msj/0797/hood0797.aspx[/url]

--------------------
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
Frank Hickman - 19 Feb 2008 09:29 GMT
> Hello everyone,
>
[quoted text clipped - 47 lines]
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------

Both statements are correct.  The compiler creates tokens for address space
that the linker will use where appropriate.  The linker is not changing
"code", simply performing it's function of address fixup.

Signature

============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.