This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Incremental linking - how to do that?


1) Suppose you have P1.cc,P2.cc,...,Pn.cc (C++ programs) and you want to
incrementally link them,
    how do you do that?
    I mean, as I understand from the poorly written docs about that
subject, first you will write probably
    ld -Ur -o P.exe P1.o P2.o .. Pn.o
    (the -Ur option is for incremental linking on C++)

    Now suppose that only P1.o changed and you want to update that in
the exe file,
    without linking again all the object files, what should you write:

    ld -Ur -o P.exe P1.o
        or
    ld -Ur -o P.exe P1.o P2.o .. Pn.o (Does the linker check the
timestamps of the files and knows to "update" only P1.o in P.exe?)

2) The documentation for -Ur says :
    "For anything other than C++ programs, this option is equivalent to
`-r': it generates relocatable output--i.e., an output file that can in
turn serve as input to ld. When linking C++ programs, `-Ur' does resolve
references to constructors, unlike `-r'. It does not work to use `-Ur'
on files that were themselves linked with `-Ur'; once the constructor
table has been built, it cannot be added to. Use `-Ur' only for the last
partial link, and `-r' for the others. "
    Does that mean that what I suggested in question 1 cannot be done at
all?
    i.e. does it mean that P.exe, after being created with the -Ur
option,
    cannot be used again with the -Ur option to update itself.
    If the answer is yes, Then how can incremental links be done in C++.

3) What is the exact reason for the separation between C and C++ (the
options -r and -Ur), what is it with constructors that makes them
different?



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]