diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -212,6 +212,8 @@ # -fPIC does not enable the large code model for GCC on AIX but does for XL. if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") append("-mcmodel=large" CMAKE_CXX_FLAGS CMAKE_C_FLAGS) + append("-Wl, -bglink=large" + CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS) elseif(CMAKE_CXX_COMPILER_ID MATCHES "XL") # XL generates a small number of relocations not of the large model, -bbigtoc is needed. append("-Wl,-bbigtoc"