[llvm-dev] DragonEgg for gcc-5 and llvm-3.6

Duncan Sands via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 28 10:18:22 PDT 2015

Hi Arun,

On 28/10/15 13:42, Arun Prabhu via llvm-dev wrote:
> Hi,
> My brother (Tarun) and I have been attempting to get dragonegg working with
> gcc-5 and llvm-3.6. So far we have had some success and most of the compilator
> and validator tests of dragonegg pass. However the following validator tests
> fail and we don't understand why.
>      The Validator :: c++/2007-01-06-ELF-Thunk-Sections.cpp
>      The Validator :: c/ExternFunctionWeakref.c
>      The Validator :: c/ExternVariableWeakref.c
>      The Validator :: c/InternFunctionWeakref.c
>      The Validator :: c/InternVariableWeakref.c
> Since the last four are extremely similar, I give the example of
> ExternVariableWeakref.c below:
> The test file looks like:
> // RUN: %dragonegg -S %s -o - | FileCheck %s
> static int variable_weakref __attribute__ ((weakref("bar")));
> int *use_variable = &variable_weakref;
> // CHECK: @use_variable = unnamed_addr global i32* @bar
> // CHECK: @bar = extern_weak global i32
> And the output we get (which ideally should match the CHECK sections above) is:
> @use_variable = unnamed_addr global i32* @variable_weakref
> @variable_weakref = internal global i32 0
> Note that for some reason, it is not creating a weak symbol.
> We'd appreciate any suggestions on how these might be fixed or where to look to
> figure out what's going on.

it's great to hear that you are trying to bring dragonegg back to life.  The 
logic for weak symbols has broken several times in the past when changing GCC 
versions.  That's because the way weak symbols were represented inside GCC used 
to be a mess, and GCC has been evolving towards a more sane system.  Much more 
like LLVM's in fact.  Unfortunately for dragonegg, each step in that evolution 
tends to break the logic.  My guess is that they made a new step.  Take a look 
in emit_alias in Backend.cpp for the dragonegg logic.  You may want to try 
asking on the GCC IRC channel for help understanding what has changed in the GCC 
handling of weak symbols.

Ciao, Duncan.

> Thanks and Regards,
> Arun Prabhu
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

More information about the llvm-dev mailing list