1 |
On 12/14/2010 05:23 PM, Perry Smith wrote: |
2 |
>>>> Drawback 1: |
3 |
>>>> It is impossible to specify undefined symbols in an import file for the |
4 |
>>>> shared object to allow for subsequent link steps keeping those symbols in the |
5 |
>>>> created shared object or executables, to be resolved by runtime linking when |
6 |
>>>> the executable is run. |
7 |
> |
8 |
> |
9 |
> Can you describe the original, base, issue? I'm wondering if there is some confusing between |
10 |
> import files and export files. I think a specific example would help me to understand. |
11 |
> This may not be worth the time since it sounds like from your comment that, over time, |
12 |
> this issue should go away but I'm still curious. |
13 |
|
14 |
Trying to create a sample from memory: |
15 |
|
16 |
Sources: |
17 |
|
18 |
$ cat a.c |
19 |
int afunc(void) { return 0; } |
20 |
|
21 |
$ cat b.c |
22 |
extern int afunc(void); |
23 |
int bfunc(void) { return afunc() + 1; } |
24 |
|
25 |
(optional): |
26 |
$ cat c.c |
27 |
int cfunc(void) { return 2; } |
28 |
|
29 |
$ cat main.c |
30 |
extern int bfunc(void); |
31 |
int main(void) { return bfunc(); } |
32 |
|
33 |
Actions: |
34 |
|
35 |
*) Create a shared object 'a': |
36 |
from a.c, |
37 |
with runtime linking enabled, |
38 |
loaded at runtime as (something like) 'a0'. |
39 |
|
40 |
*) Create a shared object 'b': |
41 |
from b.c, |
42 |
with runtime linking enabled, |
43 |
/without/ linking against 'a' (results in 'afunc' being undefined), |
44 |
loaded at runtime as (something like) 'b0'. |
45 |
|
46 |
*) Create an executable 'exe': |
47 |
from main.c, |
48 |
linking against 'a' (without any version number), |
49 |
linking against 'b' (without any version number), |
50 |
at runtime loading 'a0' (with some version number), |
51 |
at runtime loading 'b0' (with some version number). |
52 |
|
53 |
The exakt names for linktime and runtime are less important - they just have to be different. |
54 |
However, for linktime it should be something like 'liba.so'. |
55 |
|
56 |
The important problem when creating 'exe' is: |
57 |
|
58 |
How to automagically have 'b' tell the linker that it has an undefined symbol 'afunc', |
59 |
so that the reference to 'a0' is added to 'exe'. |
60 |
|
61 |
As far as I have seen, this problem is irrelevant to the LIBPATH problem. |
62 |
|
63 |
/haubi/ |
64 |
-- |
65 |
Michael Haubenwallner |
66 |
Gentoo on a different level |