Re: [dev] [scc] typeof is a gcc keyword

From: Marc Collin <marc.collin7_AT_gmail.com>
Date: Tue, 5 Jul 2016 16:04:20 -0300

Actually, "make CC=../1c/8cc" works but 8cc doesn't support no-strict-aliasing.
[ERROR] main.c:87: (null): unknown -W option: no-strict-aliasing



On Tue, Jul 5, 2016 at 4:00 PM, Marc Collin <marc.collin7_AT_gmail.com> wrote:
>> I don't think this does what you expect it to do. At least looking at
>> the 8cc makefile, the compiler is hardcoded as `cc', not the expansion
>> of the variable `cc'.
>
> You are right.
> But the CC flag is accepted.
> Try "make CC=clang" and it will work.
> But "make CC=../1c/8cc" fails. Any idea how to use relative paths like that?
>
>> On my system, the resulting binaries include references to the path they were compiled at.
>
> That could be the reason then.
> Let's try to test on the same absolute paths.
>
>
> On Tue, Jul 5, 2016 at 3:55 PM, S. Gilles <sgilles_AT_math.umd.edu> wrote:
>> On 2016-07-05T15:31:57-0300, Marc Collin wrote:
>>> I did some tests with 8cc (because it's easier to build than scc for me).
>>> My results are that the binaries aren't identical.
>>> Here's a script so you can try to reproduce it.
>>>
>>> #!/bin/sh
>>> mkdir test_comp
>>> cd test_comp
>>> git clone https://github.com/rui314/8cc
>>> mv 8cc 1c
>>> cp -r 1c 2c
>>> cp -r 1c Ac
>>> cp -r 1c Bc
>>>
>>> # compile 8cc with gcc
>>> cd 1c
>>> make cc=gcc
>>>
>>> # compile 8cc with clang
>>> cd ../2c
>>> make cc=clang
>>
>> I don't think this does what you expect it to do. At least looking at
>> the 8cc makefile, the compiler is hardcoded as `cc', not the expansion
>> of the variable `cc'. Try
>>
>> make cc=/bin/false
>>
>> or such.
>>
>>> # compile 8cc with 8cc
>>> # using the binary that
>>> # was compiled with gcc
>>> cd ../Ac
>>> make cc=../1c/8cc
>>>
>>> # compile 8cc with 8cc
>>> # using the binary that
>>> # was compiled with clang
>>> cd ../Bc
>>> make cc=../2c/8cc
>>>
>>> cd ..
>>>
>>> # compare binaries
>>> md5sum Ac/8cc Bc/8cc
>>>
>>
>> On my system, the resulting binaries include references to the path they
>> were compiled at.
>>
>> $ ls */8cc
>> 8cc/8cc other_8cc/8cc
>> $ strings 8cc/8cc | grep home
>> /home/sgilles/temp/a/8cc/include
>> #include </home/sgilles/temp/a/8cc/include/8cc.h>
>> /home/sgilles/temp/a/8cc
>> $ strings other_8cc/8cc | grep home
>> /home/sgilles/temp/a/other_8cc/include
>> #include </home/sgilles/temp/a/other_8cc/include/8cc.h>
>> /home/sgilles/temp/a/other_8cc
>>
>> I suspect this is what actually causes the differences in md5sums.
>>
>> --
>> S. Gilles
>>
Received on Tue Jul 05 2016 - 21:04:20 CEST

This archive was generated by hypermail 2.3.0 : Tue Jul 05 2016 - 21:12:18 CEST