<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><br>
</p>
<p>I checked with lto, unfortunately, it didn't get rid of multiple .objc_protocol inclusions.<br>
</p>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>От:</b> llvm-dev <llvm-dev-bounces@lists.llvm.org> от имени Perevalov Alexey via llvm-dev <llvm-dev@lists.llvm.org><br>
<b>Отправлено:</b> 26 сентября 2016 г. 16:33<br>
<b>Кому:</b> cfe-users@lists.llvm.org; llvm-dev@lists.llvm.org<br>
<b>Тема:</b> [llvm-dev] objc object file generated for gnustep runtime for ELF target is too big</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">Dear community,<br>
<br>
<br>
I'm using gnustep runtime -fobjc-runtime=gnustep with gnustep-libobjc2 (<a href="https://github.com/gnustep/libobjc2" id="LPlnk418536" previewremoved="true">https://github.com/gnustep/libobjc2</a>) and
<div id="LPBorder_GT_14749036336170.21060941218069595" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_14749036336130.058257173362501136" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td id="TextCell_14749036336140.9876425540158027" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" colspan="2">
<div id="LPRemovePreviewContainer_14749036336140.3855922093158055"></div>
<div id="LPTitle_14749036336150.4266230802766937" style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: "wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_14749036336150.1881738165572291" style="text-decoration: none;" href="https://github.com/gnustep/libobjc2" target="_blank">GitHub - gnustep/libobjc2</a></div>
<div id="LPMetadata_14749036336160.8658466384504706" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 14px;">
github.com</div>
<div id="LPDescription_14749036336160.04729718245598946" style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
README.md GNUstep Objective-C Runtime. The GNUstep Objective-C runtime is designed as a drop-in replacement for the GCC runtime. It supports both a legacy and a ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
Cocotron/Chameleon.<br>
<br>
For following source file<br>
<br>
#import <Foundation/Foundation.h><br>
#import <UIKit/UIKit.h><br>
<br>
int main(void)<br>
{<br>
NSString *str = [NSString stringWithCString:"TEST"];<br>
NSLog(@"test object %@", str);<br>
return 0;<br>
}<br>
<br>
Compilation in xcode's clang<br>
xcrun -sdk iphoneos clang -arch armv7s -mios-version-min=6.1 -c test_foundation.m -o test_foundation_apple.o<br>
gives following result:<br>
1. object file has only 3156 bytes size<br>
2. and in disassembler only main function<br>
3. the final executable will be 49992 bytes size in this case<br>
<br>
<br>
But compilation in llvm's clang downloaded from <a href="http://llvm.org/releases/3.8.0/clang+llvm-3.8.0-x86_64-apple-darwin.tar.xz" id="LPlnk896526" previewremoved="true">
http://llvm.org/releases/3.8.0/clang+llvm-3.8.0-x86_64-apple-darwin.tar.xz</a><br>
<br>
(<br>
clang version 3.8.0 (tags/RELEASE_380/final)<br>
Target: x86_64-apple-darwin15.0.0<br>
Thread model: posix<br>
)<br>
gives another results:<br>
1. object file has 159044 bytes size<br>
2. in disassembler a lot of unnecessary .objc_property_list, .objc_method_list, .objc_protocol_list and .objc_protocol in .bss and .data section<br>
3. the final binary size is 101837 bytes size<br>
<br>
<br>
<br>
If comment in above sample #import <UIKit/UIKit.h, the size of object file and binary file in xcode compilation will be the same,<br>
but size binary and object file in case of clang+llvm-3.8.0-x86_64-apple-darwin compilation will be reduced sufficiently:<br>
binary 28569 and object 36952 accordingly.<br>
<br>
<br>
<br>
Looks like all protocols from UIKit.h is placed into binary/object even it's not used there.<br>
I got 3.9.0 from public git (branch release_39 of clang git repository) and found that all protocols interpret as definition (isThisDeclarationADefinition),<br>
and in CGObjCGNU.cpp it's placed into object file whenever it's used or not. With the same open source compiler and -fobjc-runtime=ios protocols are not putting into<br>
object file even in compilation for ELF (I used -target arm-linux-gnueabi).<br>
I used default binutil linker, not llvm's ld.ldd, due to I have problem with relocation on ARM.<br>
I didn't use LTO, due to my linker doesn't have plugin support (I didnt' yet recompile it).<br>
<br>
Could somebody point me where to solve that problem, is it AST generation stage, or linkage stage or maybe it's not a problem and just LTO could be solution here?<br>
<br>
<br>
<br>
<br>
p.s. It's not only one issue found by me in gnustep runtime generation, and I'll report these issues in next emails.<br>
<br>
<br>
<br>
<br>
<br>
Best regards,<br>
Alexey Perevalov<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
llvm-dev@lists.llvm.org<br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" id="LPlnk428953" previewremoved="true">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
<div id="LPBorder_GT_14749036918660.6278961046141593" style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;">
<table id="LPContainer_14749036918630.11655853703751984" style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td id="TextCell_14749036918640.447618687257342" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" colspan="2">
<div id="LPRemovePreviewContainer_14749036918640.45869437611547015"></div>
<div id="LPTitle_14749036918640.20186186062104827" style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: "wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height: 21px;">
<a id="LPUrlAnchor_14749036918640.7940226549369314" style="text-decoration: none;" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">llvm-dev Info Page</a></div>
<div id="LPMetadata_14749036918650.6229748992883752" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 14px;">
lists.llvm.org</div>
<div id="LPDescription_14749036918650.5381825358153547" style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;">
To see the collection of prior postings to the list, visit the llvm-dev Archives. Using llvm-dev: To post a message to all the list members, send ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
</div>
</span></font></div>
</div>
</body>
</html>