<div dir="ltr">Hi Rafael,<div><br></div><div>Could you advise what might be done next about this, please?</div><div>Would it be reasonable to discuss the issue in the binutils mailing list?</div><div><br></div><div>Thank you.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 19, 2015 at 10:02 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Honestly this looks like a bug in the linker.<br>
<br>
<br>
Do they still show up with --discard-locals and/or --discard-all?<br>
<br>
On 18 September 2015 at 12:10, Oleg Ranevskyy via llvm-dev<br>
<div><div class="h5"><<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
> CC llvm-dev<br>
><br>
> ---------- Forwarded message ----------<br>
><br>
> Hello Duncan<br>
><br>
> The size of ARM binaries created by clang has increased after r236642.<br>
> Would you be able to find some time to look at my findings and share your<br>
> thoughts about the problem, please?<br>
><br>
> r236642 prevents emitting of temp label names into object files to save<br>
> memory. This is fine, the label names do not appear in the resulting<br>
> binaries. However, this creates some problems for the binutils linker, which<br>
> analyzes symbol names from the input object files and can decide to skip<br>
> some local compiler generated labels. Now it no longer sees the label names<br>
> and therefore puts them all into the final binary. I will demonstrate this<br>
> on an example.<br>
><br>
> If we compile the attached main.cpp file for ARM<br>
> clang++ -c -o main.o -O0 -g --target=armv7l-linux-gnueabihf main.cpp<br>
> and then look at the symbols<br>
> readelf -s main.o<br>
> there will be a number of similar entries (showing one entry only here for<br>
> conciseness):<br>
> Num: Value Size Type Bind Vis Ndx Name<br>
> 7: 00000062 0 NOTYPE LOCAL DEFAULT 9<br>
> These are the .Linfo_string<index> symbols whose names are skipped due to<br>
> r236642.<br>
><br>
> If we now link it<br>
> clang++ -o main.out --target=armv7l-linux-gnueabihf main.o<br>
> all the symbols get through to the final binary:<br>
> readelf -s main.out<br>
><br>
> Num: Value Size Type Bind Vis Ndx Name<br>
> 73: 0000006e 0 NOTYPE LOCAL DEFAULT 32<br>
><br>
> The linker can't decide if the labels are the local ones to be left out not<br>
> seeing their names. Its bfd_is_local_label_name function returns false and<br>
> the labels are not skipped.<br>
><br>
> Before r236642 the names were inserted into object files:<br>
> readelf -s main.o<br>
><br>
> Num: Value Size Type Bind Vis Ndx Name<br>
> 23: 0000007a 0 NOTYPE LOCAL DEFAULT 9 .Linfo_string7<br>
><br>
> bfd_is_local_label_name returns true if the name starts with ".L" and the<br>
> symbol is skipped.<br>
><br>
> This is not critical for small projects but can create noticeable overhead<br>
> for the big ones.<br>
><br>
> Any help will be much appreciated.<br>
> Thank you.<br>
> Oleg<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
</blockquote></div><br></div></div>