[SERVER-40260] on windows, linking with tcmalloc_minimal.lib emits warning LNK4078 Created: 21/Mar/19  Updated: 29/Oct/23  Resolved: 22/Mar/19

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 4.1.10

Type: Bug Priority: Major - P3
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Dev Tools 2019-03-25
Participants:

 Description   

This is emitted on basically on every link step in a Windows build.

[2019/03/21 11:55:11.613] tcmalloc_minimal.lib(port.obj) : warning LNK4078: multiple '.CRT' sections found with different attributes (C0400040)

...

It's a nuisance and may be revealing a deeper misconfiguration on our part, or on gperftools' part.

 



 Comments   
Comment by Githook User [ 23/Mar/19 ]

Author:

{'name': 'Billy Donahue', 'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com'}

Message: SERVER-40260 Backport gperftools upstream 62c4eca6e7e to gperftools-2.5.

Under x64, the PE loader looks for callbacks in constant sections
Branch: master
https://github.com/mongodb/mongo/commit/10f196bb962c6d4f983b9d7b1209aff26f97573a

Comment by Billy Donahue [ 23/Mar/19 ]

We could backport this linker fix to our vendored gperftools-2.5.
It might be worth it, since gperftools-2.7 won't be default for a while longer.

Comment by Githook User [ 22/Mar/19 ]

Author:

{'name': 'Billy Donahue', 'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com'}

Message: SERVER-40260 reimport gperftools for the fix cherry-pick.
Branch: master
https://github.com/mongodb/mongo/commit/bc70cf81a6790e727c61d25c0066a7b331081e28

Comment by Billy Donahue [ 22/Mar/19 ]

reimport from the mongodb-labs repo containing our cherry-pick.
https://mongodbcr.appspot.com/438250003

Comment by Billy Donahue [ 21/Mar/19 ]

Github PR: https://github.com/mongodb-labs/gperftools/pull/10

Comment by Billy Donahue [ 21/Mar/19 ]

identified change to cherry-pick for this.

Comment by Billy Donahue [ 21/Mar/19 ]

Aha! Fixed upstream:

https://github.com/gperftools/gperftools/commit/62c4eca6e7ec9dc78333dc6b499f90eef9849378

We need to cherry-pick this.

Comment by Billy Donahue [ 21/Mar/19 ]

gperftools mentions .CRT only here in port.cc.
This matches the "port.obj" from the warning text.

windows/port.cc-148-// extern "C" suppresses C++ name mangling so we know the symbol names
windows/port.cc-149-// for the linker /INCLUDE:symbol pragmas above.
windows/port.cc-150-extern "C" {
windows/port.cc-151-// This tells the linker to run these functions.
windows/port.cc-152-#pragma data_seg(push, old_seg)
windows/port.cc:153:#pragma data_seg(".CRT$XLB")
windows/port.cc-154-void (NTAPI *p_thread_callback_tcmalloc)(
windows/port.cc-155-    HINSTANCE h, DWORD dwReason, PVOID pv) = on_tls_callback;
windows/port.cc:156:#pragma data_seg(".CRT$XTU")
windows/port.cc-157-int (*p_process_term_tcmalloc)(void) = on_process_term;
windows/port.cc-158-#pragma data_seg(pop, old_seg)
windows/port.cc-159-}  // extern "C"

Generated at Thu Feb 08 04:54:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.