1737973
1737973

Reputation: 118

Dynamic linking vs Static linking vs PIC vs non PIC

Let us have a quick review of the cases for:

But both options are actually correct, aren't them?

I would like to glance a four square map showing relevant cases, but have not found any at all.

Upvotes: 4

Views: 1499

Answers (1)

Matthias
Matthias

Reputation: 8180

While PIC/non-PIC and dynamic/static linking are independent concepts, there is an "affinity" between PIC and dynamic linking. However, beside a small performance penalty, there is no reason against using PIC in static libraries as well.

Furthermore, also dynamic libraries can be made relocatable. This approach is often done in MIPS systems. For static linking, relocatable code is frequently used anyway.

In addition, in the times of MMUs, the relation of PIC/nonPIC and static/dynamic linking is decoupled, or more precise: PIC becomes less significant.

To summarize: any combination is possible.

Upvotes: 3

Related Questions