1; This test ensures that when linkonce_odr + unnamed_addr symbols promoted to 2; weak symbols, it preserves the auto hide property when possible. 3 4; RUN: opt -module-summary %s -o %t.o 5; RUN: opt -module-summary %p/Inputs/linkonce_odr_unnamed_addr.ll -o %t2.o 6; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \ 7; RUN: -m elf_x86_64 \ 8; RUN: --plugin-opt=save-temps \ 9; RUN: %t.o %t2.o -o %t3.o 10; RUN: llvm-dis %t.o.1.promote.bc -o - | FileCheck %s 11 12; Now test when one module is a native object. In that case we must be 13; conservative and not auto hide. 14; RUN: llc %p/Inputs/linkonce_odr_unnamed_addr.ll -o %t2native.o -filetype=obj 15; RUN: %gold -plugin %llvmshlibdir/LLVMgold%shlibext \ 16; RUN: -m elf_x86_64 \ 17; RUN: --plugin-opt=save-temps \ 18; RUN: %t.o %t2native.o -o %t3.o 19; RUN: llvm-dis %t.o.1.promote.bc -o - | FileCheck %s --check-prefix=NOSUMMARY 20 21target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 22target triple = "x86_64-grtev4-linux-gnu" 23 24; In this case all copies are linkonce_odr, so it may be hidden. 25; CHECK: @linkonceodrunnamed = weak_odr hidden unnamed_addr constant i32 0 26; NOSUMMARY: @linkonceodrunnamed = weak_odr dso_local unnamed_addr constant i32 0 27@linkonceodrunnamed = linkonce_odr unnamed_addr constant i32 0 28 29; In this case, the other copy was weak_odr, so it may not be hidden. 30; CHECK: @odrunnamed = weak_odr dso_local unnamed_addr constant i32 0 31; NOSUMMARY: @odrunnamed = weak_odr dso_local unnamed_addr constant i32 0 32@odrunnamed = linkonce_odr unnamed_addr constant i32 0 33