How to configure my project to do dead-code stripping (properly!)
How to configure my project to do dead-code stripping (properly!)
- Subject: How to configure my project to do dead-code stripping (properly!)
- From: "Theodore H. Smith" <email@hidden>
- Date: Fri, 26 Jul 2013 21:30:11 +0100
Hi everyone,
So I'm compiling a dylib library written in C, in Xcode.
Now... heres an interesting problem. Much of this library that I'm writing uses inherited code. High quality code, but sometimes it contains functions that I'm simply not using anymore.
Somehow... these functions find their way into the final product. Heres one example...
bool JB_Str_IsDouble( String* self, int BeginPos, int Finish ) {
// EndPos is byte AFTER, like range.
int Length = 1 + Finish - BeginPos;
SectFix_(BeginPos, Length, self->Length);
u8* ReadPlace = self->Addr + BeginPos;
u8* ReadEnd = ReadPlace + Length;
const int kAllowMinus = 1;
const int kAllowNum = 2;
const int kAllowE = 4;
const int kAllowDot = 8;
// <more code...>
} else {
return false;
}
State = State &~ Restrict;
}
return FoundNum;
}
OK... So the full function takes only 48 lines of code. Somehow... when I compile it, this adds 4KB to the final library. 4K for 48 lines of code seems a lot, to me. By this rate, I could shrink my library size by 1/3 if I can make the compiler not include functions that aren't called.
Basically... my library has a "main" function... and I'd like all functions not reachable from main... to be dead code stripped. Is that possible?
I know a library is supposed to be "Callable" and therefor... the functions in the library shouldn't be stripped... because they could be called from the outside... but I want to simply expose a select few functions and have the rest stripped unless refered to from those exposed functions.
Heres my setup:
OS 10.8.4
Xcode 4.6.3
LLVM compiler
32 bit code generation
--
http://jeebox.org/
"An extensible language for describing code, concepts and stories"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden