[PATCH] D17975: [lto] Avoid duplicate symbol error for appending linkage.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 8 17:22:34 PST 2016


I think the check you want is

Symflags & object::BasicSymbolRef::SF_FormatSpecific

Cheers,
Rafael


On 8 March 2016 at 20:09, Sean Silva <chisophugis at gmail.com> wrote:
> silvas created this revision.
> silvas added a reviewer: rafael.
> silvas added subscribers: llvm-commits, Bigcheese.
> Herald added a subscriber: joker.eph.
>
> I'm not sure if this is the right solution, since it seems like we need
> to do something more with @llvm.global_ctors in
> SymbolTable.cpp:addBitcodeFile.
>
> Any ideas?
>
> http://reviews.llvm.org/D17975
>
> Files:
>   ELF/InputFiles.cpp
>   test/ELF/lto/linkage.ll
>
> Index: test/ELF/lto/linkage.ll
> ===================================================================
> --- test/ELF/lto/linkage.ll
> +++ test/ELF/lto/linkage.ll
> @@ -7,3 +7,9 @@
>
>  ; Should not encounter a duplicate symbol error for @.str
>  @.str = private unnamed_addr constant [4 x i8] c"Hey\00", align 1
> +
> +; Should not encounter a duplicate symbol error for @llvm.global_ctors
> + at llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @ctor, i8* null }]
> +define internal void @ctor() {
> +  ret void
> +}
> Index: ELF/InputFiles.cpp
> ===================================================================
> --- ELF/InputFiles.cpp
> +++ ELF/InputFiles.cpp
> @@ -446,6 +446,8 @@
>          continue;
>      if (!(Flags & object::BasicSymbolRef::SF_Global))
>          continue;
> +    if (GV->getLinkage() == GlobalValue::AppendingLinkage)
> +      continue;
>      uint8_t Visibility = getGvVisibility(GV);
>
>      SmallString<64> Name;
>
>


More information about the llvm-commits mailing list