[llvm] r217264 - Revert "Disable the fix for pr20793 because of a gnu ld bug."

Reid Kleckner rnk at google.com
Fri Sep 5 11:23:51 PDT 2014


Nice! This change was super easy. We still need to handle
@llvm.global_ctors in LTO, though.


On Fri, Sep 5, 2014 at 11:03 AM, Rafael Espindola <
rafael.espindola at gmail.com> wrote:

> Author: rafael
> Date: Fri Sep  5 13:03:38 2014
> New Revision: 217264
>
> URL: http://llvm.org/viewvc/llvm-project?rev=217264&view=rev
> Log:
> Revert "Disable the fix for pr20793 because of a gnu ld bug."
>
> This reverts commit r217211.
>
> Both the bfd ld and gold outputs were valid. They were using a Rela
> relocation,
> so the value present in the relocated location was not used, which caused
> me
> to misread the output.
>
> Modified:
>     llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
>     llvm/trunk/test/CodeGen/X86/constructor.ll
>
> Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=217264&r1=217263&r2=217264&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
> +++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Fri Sep  5
> 13:03:38 2014
> @@ -31,7 +31,6 @@
>  #include "llvm/MC/MCSectionMachO.h"
>  #include "llvm/MC/MCStreamer.h"
>  #include "llvm/MC/MCSymbol.h"
> -#include "llvm/Support/CommandLine.h"
>  #include "llvm/Support/Dwarf.h"
>  #include "llvm/Support/ELF.h"
>  #include "llvm/Support/ErrorHandling.h"
> @@ -42,13 +41,6 @@
>  using namespace llvm;
>  using namespace dwarf;
>
> -// Disabled by default because it hits bug 17350 in GNU ld (gold is fine)
> -static cl::opt<bool>
> -    EnableStructorCOMDAT("enable-structor-comdat", cl::Hidden,
> -                         cl::desc("Use comdats to keep only one copy of a
> "
> -                                  "constructor/destructor invocation"),
> -                         cl::init(false));
> -
>
>  //===----------------------------------------------------------------------===//
>  //                                  ELF
>
>  //===----------------------------------------------------------------------===//
> @@ -371,9 +363,6 @@ static const MCSectionELF *getStaticStru
>                                                      bool IsCtor,
>                                                      unsigned Priority,
>                                                      const MCSymbol
> *KeySym) {
> -  if (!EnableStructorCOMDAT)
> -    KeySym = nullptr;
> -
>    std::string Name;
>    unsigned Type;
>    unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE;
>
> Modified: llvm/trunk/test/CodeGen/X86/constructor.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/constructor.ll?rev=217264&r1=217263&r2=217264&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/CodeGen/X86/constructor.ll (original)
> +++ llvm/trunk/test/CodeGen/X86/constructor.ll Fri Sep  5 13:03:38 2014
> @@ -1,8 +1,5 @@
> -; RUN: llc -mtriple x86_64-pc-linux -use-ctors -enable-structor-comdat <
> %s | FileCheck --check-prefix=CTOR-COMDAT %s
> -; RUN: llc -mtriple x86_64-pc-linux  -enable-structor-comdat < %s |
> FileCheck --check-prefix=INIT-ARRAY-COMDAT %s
>  ; RUN: llc -mtriple x86_64-pc-linux -use-ctors < %s | FileCheck
> --check-prefix=CTOR %s
>  ; RUN: llc -mtriple x86_64-pc-linux < %s | FileCheck
> --check-prefix=INIT-ARRAY %s
> -
>  @llvm.global_ctors = appending global [2 x { i32, void ()*, i8* }] [{
> i32, void ()*, i8* } { i32 65535, void ()* @f, i8* null}, { i32, void ()*,
> i8* } { i32 15, void ()* @g, i8* @v }]
>
>  @v = weak_odr global i8 0
> @@ -17,30 +14,16 @@ entry:
>    ret void
>  }
>
> -; CTOR:                .section        .ctors.65520,"aw", at progbits
> +; CTOR:                .section
> .ctors.65520,"aGw", at progbits,v,comdat
>  ; CTOR-NEXT:   .align  8
>  ; CTOR-NEXT:   .quad   g
>  ; CTOR-NEXT:   .section        .ctors,"aw", at progbits
>  ; CTOR-NEXT:   .align  8
>  ; CTOR-NEXT:   .quad   f
>
> -; INIT-ARRAY:          .section        .init_array.15,"aw", at init_array
> +; INIT-ARRAY:          .section
> .init_array.15,"aGw", at init_array,v,comdat
>  ; INIT-ARRAY-NEXT:     .align  8
>  ; INIT-ARRAY-NEXT:     .quad   g
>  ; INIT-ARRAY-NEXT:     .section        .init_array,"aw", at init_array
>  ; INIT-ARRAY-NEXT:     .align  8
>  ; INIT-ARRAY-NEXT:     .quad   f
> -
> -; CTOR-COMDAT:         .section
> .ctors.65520,"aGw", at progbits,v,comdat
> -; CTOR-COMDAT-NEXT:    .align  8
> -; CTOR-COMDAT-NEXT:    .quad   g
> -; CTOR-COMDAT-NEXT:    .section        .ctors,"aw", at progbits
> -; CTOR-COMDAT-NEXT:    .align  8
> -; CTOR-COMDAT-NEXT:    .quad   f
> -
> -; INIT-ARRAY-COMDAT:           .section
> .init_array.15,"aGw", at init_array,v,comdat
> -; INIT-ARRAY-COMDAT-NEXT:      .align  8
> -; INIT-ARRAY-COMDAT-NEXT:      .quad   g
> -; INIT-ARRAY-COMDAT-NEXT:      .section
> .init_array,"aw", at init_array
> -; INIT-ARRAY-COMDAT-NEXT:      .align  8
> -; INIT-ARRAY-COMDAT-NEXT:      .quad   f
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140905/6d479c36/attachment.html>


More information about the llvm-commits mailing list