Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate symbols in Microsoft C library

I'm writing a linker for Windows PE format object files, and I've got to the stage where it can link together object files produced by the Microsoft compiler, but when I try to link with libcmt.lib I get a lot of duplicate symbols.

For example, cosl is defined by three different objects in the library. All three refer to definitions in different places, and all three look genuine, e.g. they point to text segments named .text$mn and have storage class IMAGE_SYM_CLASS_EXTERNAL.

Is it the case that these are alternate versions and the linker is supposed to pick one based on some criterion, or am I misunderstanding something about the semantics of the PE library format?

like image 397
rwallace Avatar asked Mar 10 '14 13:03

rwallace


1 Answers

As referenced in the comments, the OP is not processing the COMDAT section properly. http://download.microsoft.com/download/e/b/a/eba1050f-a31d-436b-9281-92cdfeae4b45/pecoff.doc

like image 146
CDahn Avatar answered Nov 16 '22 13:11

CDahn