[cfe-dev] [3.7 Release] RC1 has been tagged, Testing Phase I begins

Dimitry Andric dimitry at andric.com
Mon Jul 20 15:09:31 PDT 2015


On 20 Jul 2015, at 23:40, Hans Wennborg <hans at chromium.org> wrote:
> 
> On Sun, Jul 19, 2015 at 12:49 PM, Dimitry Andric <dimitry at andric.com> wrote:
>> Another new problem with the test-release.sh script is that it can cause the whole machine (!) to run out of memory, when comparing phase 2 with phase 3, due to the following fragment:
>> 
>>   470          echo "# Comparing Phase 2 and Phase 3 files"
>>   471          for p2 in `find $llvmCore_phase2_objdir -name '*.o'` ; do
>>   472              p3=`echo $p2 | sed -e 's,Phase2,Phase3,'`
>>   473              # Substitute 'Phase2' for 'Phase3' in the Phase 2 object file in
>>   474              # case there are build paths in the debug info. On some systems,
>>   475              # sed adds a newline to the output, so pass $p3 through sed too.
>>   476              if ! cmp --ignore-initial=16 <(sed -e 's,Phase2,Phase3,g' $p2) \
>>   477                      <(sed -e '' $p3) > /dev/null 2>&1 ; then
>>   478                  echo "file `basename $p2` differs between phase 2 and phase 3"
>>   479              fi
>>   480          done
>> 
>> Because cmp(1) on FreeBSD does not support the --ignore-initial option, which is a GNU extension, the command immediately fails.  Then, the <(...) constructs on lines 476 and 477 spawn two new bash instances per iteration, and these never get cleaned up, at least not on FreeBSD.  This may very well be a bash bug.
>> 
>> Alternatively, the 'skip' values can be specified as the third and fourth argument on the cmp(1) command line, and this works on both Linux, FreeBSD and OSX; e.g. this:
>> 
>>            if ! cmp -s <(sed -e 's,Phase2,Phase3,g' $p2) <(sed -e '' $p3) \
>>                    16 16 ; then
> 
> That seems like a good solution, feel free to commit that.

Committed just that change in r242721.


> I wonder why the first 16 bytes need to be skipped though. Does anyone know?

Probably to skip the ELF e_ident field [1], but I'm unsure why this
would be different for stages 2 and 3.  This was added by Bill Wendling
in r142173; CC'ing him so he may enlighten us, if he is available.

-Dimitry

[1] http://www.sco.com/developers/gabi/1998-04-29/ch4.eheader.html#elfid

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150721/1cedb212/attachment.sig>


More information about the cfe-dev mailing list