The generated (problematic) ccode, declares a static prototype for an extern symbol, which I believe is the cause of the problem. After replacing the declaration with extern keyword, the library is no longer a SE trouble maker.
The library was built with a DISABLE_STATIC libtool with -Wl,--as-needed. I believe -fPIC are always automatically added when real shared-libraries are built on applicable platforms. I am totally confused with what was happening inside the linker world. I had same issues when I forgot declaring the prototypes of extern symbols in the source files for building shared libraries though. Yu On Mon, 2009-04-06 at 19:38 +0200, pancake wrote: > The same bug should appear with Solaris and the Sun Studio (aka Forte > compiler) > > you should build everything with -fPIC, can you provide more information > about your > build ? console output? > > SElinux doesnt allows symbol relocation because it can be dangerous (can > be used > for in-memory patching using the linux loader) which is permitted, on > normal linux, > but forbidden in selinux for obvious reasons. > > This also happens when you link a blob compiled without -fPIC against a > static library > that isnot compiled with relocatable code (no -fPIC) the reason is taht > the non-relocatable > code is compiled to live at a certain offset, and pic code generates > some stubs to know > where is and how to reach all the data from their position (like > oldschool viruses did), > you cannot mix pic-nonpic code in an application. well.. default linux > allows you to do this, > but its a bit ugly workaround ;) > > Yu Feng wrote: > > Dear list, > > > > I encountered a very hidden problem with private extern class methods, > > which I would like to share with you. > > > > The scenario is like this. It compiles, links. everything seems fine > > until the library is installed: the produced .so file will have a wrong > > reloc symbol which doesn't work with SELinux!): > > > > A member function of a class is externally written in C. > > > > # Class.vala > > public class Class { > > private extern static void func(); > > } > > # Class-ccode.c > > void class_func() { > > // Do stuff > > } > > > > The generated ccode: > > # Class.c > > ... > > ... > > static void func(); > > ... > > ... > > > > This seems to be a bug in valac. > > The private extern method actually should be declared without the static > > keyword but with an extern instead. > > > > Regards, > > > > Yu > > > > _______________________________________________ > > Vala-list mailing list > > Vala-list@gnome.org > > http://mail.gnome.org/mailman/listinfo/vala-list > > > > > _______________________________________________ > Vala-list mailing list > Vala-list@gnome.org > http://mail.gnome.org/mailman/listinfo/vala-list _______________________________________________ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list