Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure folly's memcpy/memset not replaced by glibc's implementation
Summary: `__folly_memcpy` and `__folly_memset` are supposed to be used in prod. However, they may be replaced by libc's implementation when `link_group_map` is used. The issue comes from two places: (1) The `link_group_map` may cause "folly/__memcpy-use__/__objects__/memcpy.S.o" to be put after "libc.so" in the xxx.thinlto.index.argsfile. (2) Even if "folly/__memcpy-use__/__objects__/memcpy.S.o" comes before "libc.so", `__folly_memcpy` may still be replaced by libc's implementation in some cases. For example: if there's no reference to `memcpy` before "folly/__memcpy-use__/__objects__/memcpy.S.o", the symbol `memcpy` inside memcpy.S.o is considered to be a lazy symbol, which will be replaced by the definition inside "libc.so". To make sure `__folly_memcpy` and `__folly_memset` are linked, this diff sets link_whole for cpp_library memcpy-use and memset-use. Because memcpy-use and memset-use only contain the necessary symbols, link_whole doesn't cause size bloat. Reviewed By: WenleiHe Differential Revision: D58921357 fbshipit-source-id: f5c7161dda24edd1ac808042715931d9b8dfaf10
- Loading branch information