Index: lib/CodeGen/TargetLoweringObjectFileImpl.cpp =================================================================== --- lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -588,15 +588,18 @@ bool EmitUniqueSection = false; - // If we have -ffunction-sections or -fdata-sections then we should emit the - // global value to a uniqued section of the same name. - if (!(Flags & ELF::SHF_MERGE) && !Kind.isCommon()) { - if (Kind.isText()) - EmitUniqueSection = TM.getFunctionSections(); - else - EmitUniqueSection = TM.getDataSections(); + if (TM.getMCAsmInfo()->useIntegratedAssembler()) { + // If we are using the integrated assembler and we have -ffunction-sections + // or -fdata-sections, then we emit the global value into a uniqued section + // of the same name. + if (!(Flags & ELF::SHF_MERGE) && !Kind.isCommon()) { + if (Kind.isText()) + EmitUniqueSection = TM.getFunctionSections(); + else + EmitUniqueSection = TM.getDataSections(); + } + EmitUniqueSection |= GO->hasComdat(); } - EmitUniqueSection |= GO->hasComdat(); // A section can have at most one associated section. Put each global with // MD_associated in a unique section.