[LLVMdev] Shared library support of llvm

Morten Ofstad morten at hue.no
Wed May 8 12:55:19 PDT 2013


Actually, adding a LLVM_EXPORT macro would be positive for other 
environments, because you can then build LLVM
as a shared library with -fvisibility=hidden and use LLVM_EXPORT to only 
make public symbols visible. There are several
advantages to this, as noted here:

http://gcc.gnu.org/wiki/Visibility

From: Reid Kleckner
Sent: Wednesday, May 08, 2013 6:21 PM
To: Peng Cheng
Cc: LLVMdev at cs.uiuc.edu
Subject: Re: [LLVMdev] Shared library support of llvm
I've never tried building LLVM dlls on Windows, so this is all from
faulty mailing list memory.

You should be able to make a ginormous LLVM.dll that includes
everything you need just once.  This should avoid your duplicate data
in depending DLLs problem.  Someone else may know how to do this, or
you can search the list.

Splitting LLVM's internal libraries up into little dlls would speed up
incremental builds, but it's not easy.  There's no way to blanket
export every symbol from a dll.  Even if you did, I've heard there are
issues with exporting more than 2^16 symbols.

Adding targeted dllexport annotations won't work because non-Windows
developers (the majority) shouldn't be burdened with keeping them up
to date.

On Wed, May 8, 2013 at 11:30 AM, Peng Cheng <gm4cheng at gmail.com> wrote:
> According to http://llvm.org/docs/CMake.html, "Shared libraries are not
> supported on Windows and not recommended in the other OSes".
>
> The problem is that static libraries have some limitations, especially 
> when
> linked into multiple shared libraries, the global data of llvm could have
> multiple copies leading to undefined behaviors.  This has caused much 
> pains
> during my usage of llvm.
>
> My questions are:
>
> 1. What are the reasons to not support shared libraries on Windows and not
> recommended in other OSes?
>
> 2. Are there any plans to support shared libraries?
>
> Thanks very much for any information!
>
> Best,
> -Peng
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev 




More information about the llvm-dev mailing list