This is the mail archive of the binutils@sourceware.org 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]

Dead-stripping unused code?


So, I'm trying to bring in code from a large project (called "AFS") a little at a time. I started with a complete, working, non-trivial "hello world" project, and added the AFS sources into it. I then made a call to a single routine in the AFS code. This, of course, generated a linker error because I was not actually building and linking the AFS code yet.

So, I found the file, added it to the Makefile, and built again. It compiled, and as expected, issued more link errors. I expected to proceed in this fashion until I had brought in enough of the AFS code to allow that one call to work.

The problem is, it seems to complain about *all* the missing symbols, not just ones actually called (indirectly) from my code.

Is it possible to get gcc/ld to not try to link code referenced by uncalled functions? I tried using -Xlinker -dead-strip, but that appears to be an Apple extension not in binutils 2.18 (at least, I couldn't find it in the docs).

Basically, I want the linker not to complain about missing code that's never called, but I do want it to complain about missing code that *is* called. Is this possible?

TIA,

--
Rick




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