Re: [Vala] private extern class methods.



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




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]