This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Exporting new libgomp functions
On Jan 12, 2011, at 1:57 PM, Ian Lance Taylor wrote:
> Amittai Aviram <amittai.aviram@yale.edu> writes:
>
>> I would like to define some new functions in libgomp and make these
>> available to applications compiled with GCC with the -fopenmp flag.
>> Suppose I want to export function void foo(void). I had thought that
>> I could just define it in, say, foo.c, include foo.c into my build of
>> libgomp, and provide a header file in my application with foo's
>> signature. However, when I do this, I get a linker error that the
>> application uses an "undefined function." I have verified that foo.o
>> and foo.lo are in my gcc_obj build directory tree, and that the
>> definition of "foo" does indeed occur in foo.o (i.e., I can see its
>> disassembly using objdump -d). Now, libgomp already exports a bunch
>> of functions, such as omp_get_thread_num, etc. How can I do the same
>> with my new functions? Thanks!
>
> You need to edit libgomp/libgomp.map to assign an appropriate version to
> your new symbol. All libgomp symbols not mentioned in that file are
> hidden in libgomp.so.
>
> Ian
Thank you! Unfortunately, this didn't work. I added my function names to the end of the list for OMP_1.0 "global," i.e.,
OMP_1.0 {
global:
omp_set_num_threads;
[...]
foo;
local:
*;
};
I rebuilt GCC and again tried to build my application, which makes a call to foo from inside an OpenMP parallel block:
#pragma omp parallel
{
foo();
}
And I get the same linker error, an "undefined reference to 'foo'."
I also tried putting my function names into the GOMP_1.0 global list, with the same results. :-(
Is there something else I need to do? Thanks!
Amittai Aviram
PhD Student in Computer Science
Yale University
646 483 2639
amittai.aviram@yale.edu
http://www.amittai.com