[llvm-dev] objc object file generated for gnustep runtime for ELF target is too big
Perevalov Alexey via llvm-dev
llvm-dev at lists.llvm.org
Tue Sep 27 11:00:39 PDT 2016
От: Dr D. Chisnall <dc552 at hermes.cam.ac.uk> от имени David Chisnall <David.Chisnall at cl.cam.ac.uk>
Отправлено: 27 сентября 2016 г. 10:42
Кому: Perevalov Alexey
Копия: cfe-users at lists.llvm.org; llvm-dev at lists.llvm.org
Тема: Re: [llvm-dev] objc object file generated for gnustep runtime for ELF target is too big
On 26 Sep 2016, at 14:33, Perevalov Alexey via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> 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?
>First, please don’t expect the sizes for different runtimes to be the same (or, necessarily, to be even very close). The Mac runtimes have a bit more support from the linker for >various things. To ensure that property introspection is consistent without this support, the GNUstep runtime IR generation emits property definitions in all compilation units and >then uniques them later.
>We’re currently working on a new ABI for the GNUstep runtime that should address the size issues, but until then this looks pretty much what I’d expect.
>David
Thank you David,
I didn't expect the same size for executable file, but I got binary (real application) for gnustep runtime 5 times bigger than for ios runtime, and then I decided to figure out it.
(neither -flto nor -fdata-sections -ffunction-sections -Wl,--gc-sections helped).
5x bigber it's not due to only this issue ;) I think.
For small sample (listed above in thread) I found that all protocol's declaration is interprets as definitions, and I see a lot of
.objc_protocol:
.long 3
.long .L.objc_protocol_name
.long .objc_protocol_list
.long .objc_method_list
.long .objc_method_list.1
.long .objc_method_list.2
.long .objc_method_list.3
.long .objc_property_list
.long .objc_property_list.4
.size .objc_protocol, 36
.type .L__unnamed_37,%object @ @34
.section .rodata.str1.1,"aMS",%progbits,1
.L__unnamed_37:
.asciz "copyWithZone:"
.size .L__unnamed_37, 14
.type .L__unnamed_38,%object @ @35
...
in disassembler output and in final binary, but these protocol aren't used in sample. Neither front end nor linker got rid of it.
You wrote definitions will be unique, but it didn't strip out unnecessary .objc_protocol and depended fields.
(frankly saying after strip -s I didn't see .objc_protocol, but still find all selector and protocol names in strings output ;)
And it's look like a bug.
More information about the llvm-dev
mailing list