Re: How to avoding compiling unreferenced code into .o target file

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

 



On 2017.08.31 at 17:31 +0800, kipade wrote:
> Hi all,
> If there is a way to avoiding assemblly unreferenced entry into .o target
> file?
> The issue is from such condition:
> Dynamic library B is dependent on Dynamic library A: the source find b.c in
> library B includes a header file from A, which named a.h, here, there was a
> inlined function within a.h, however, b.c just include a.h and without any
> code decleared within a.h.  So, the target .o file of b.c would not generate
> any code for the inline function, just leave an entry for that function.
> 
> The problem is, when the b.c was packed as a shared dynamic library and
> was used by the third executable client, gcc would complain it can't find
> the reference of the inline function entry decleared in a.h, although which
> would not be used by the library B.
> 
> Finnaly, I have to remove the include instruction in b.c to avoiding such
> linking error. But, I don't know how to resolve that issue if there is a c.c
> which have to include a.h because it use parts of entries decleared in
> a.h. (I can't modify any code of library A, because it's a foreign library)

There is nothing gcc specific in you question so it is off-topic for this
list. Just read Drepper's whitepaper:
https://www.akkadia.org/drepper/dsohowto.pdf

-- 
Markus



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux