dragonegg plugin invoking issue

Hi,

I am using latest sources on GCC (gcc4.5_branch), LLVM and dragonegg. I am able to build all three bits though unsuccessfull in building. Already done obvious things

  • checked out the sources as per defined in “Getting the development version” on dragonegg.llvm.org
  • Modified the llvm-backend.cpp in dragonegg to make available the global plugin_is_GPL_compatible publically
  • exports.map do include the global symbol “plugin_is_GPL_compatible” and “plugin_init”

My host system is CentOS-3.8 and I am building it for same operating system and intel machine.

Can somebody please help me why GCC is not reconizing dragonegg.so as a legal plugin - as the requirement is symbol plugin_is_GPL_compatible should be able publically? Maybe I am missing something obvious. Please find below the different version & configuration and error which I am getting. Please let me know if I need to provide any further information. Thanks.

Regards,
Rehman

GCC configuration & version

Hi Rehman, does it work if you remove -fvisibility=hidden from these two lines
in the Makefile:
  CFLAGS+=-Wall $(shell $(LLVM_CONFIG) --cflags) -fvisibility=hidden
  CXXFLAGS+=-Wall $(shell $(LLVM_CONFIG) --cxxflags) -fvisibility=hidden
?

- Modified the llvm-backend.cpp in dragonegg to make available the global
plugin_is_GPL_compatible publically

What exactly did you change here?

Ciao,

Duncan.

Hi Rehman, does it work if you remove -fvisibility=hidden from these two lines

in the Makefile:

CFLAGS+=-Wall $(shell $(LLVM_CONFIG) --cflags) -fvisibility=hidden

CXXFLAGS+=-Wall $(shell $(LLVM_CONFIG) --cxxflags) -fvisibility=hidden

?

I tried it with clean build and yes it did work when I remove the -fvisibility=hidden option

  • Modified the llvm-backend.cpp in dragonegg to make available the global

plugin_is_GPL_compatible publically

What exactly did you change here?

GCC docs says that plugin_is_GPL_compatible need to be defined even if uninitialized so was trying to define this symbol by changing in llvm-backend.cpp:

int plugin_is_GPL_compatible LLVM_GLOBAL_VISIBILITY;

Hi Rehman, if I understand right the plugin works fine if you compile it with
-fvisibility=hidden, and replace LLVM_GLOBAL_VISIBILITY in llvm-backend.cpp
with __attribute__ ((visibility("default"))). Since LLVM_GLOBAL_VISIBILITY
is a macro that expands to __attribute__ ((visibility("default"))) if you
are not on mingw32 or cygwin, and your gcc version is at least 4, that
suggests that you are compiling the plugin with gcc 3.x. Is that right?

Best wishes,

Duncan.

Hi Duncan,

Thank you very much for looking into it.

I used the command to build dragonegg

GCC=4.5.x make

and silently it was using system compiler which is yes 3.x.x

I turned the command to explicitly use latest compiler

GCC=4.5.x CC=4.5.x CXX=4.5.x make

and the problem gone away.

Regards,
Rehman