[LEDE-DEV] [PATCH] gcc: 7.2: remove mips patch causing broken code
Kevin Darbyshire-Bryant
kevin at darbyshire-bryant.me.uk
Mon Dec 18 02:07:17 PST 2017
> On 18 Dec 2017, at 08:40, Felix Fietkau <nbd at nbd.name> wrote:
>
> On 2017-12-17 22:21, Hauke Mehrtens wrote:
>> This patch made GCC produce broken code, remove it.
>> In mp_cmp_d() function in th libtommath shipped with dropbear the
>> following code was compiled wrong:
>>
>> /* compare based on magnitude */
>> if (a->used > 1) {
>> return 1;
>> }
>>
>> In the broken ASM this part returned -1 like the previous return
>> statement did instead of 1 like it should.
>>
>> This did not happen when the -funroll-loops option was given to GCC.
>>
>> Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
> This patch only passes the cost associated with branches and memory
> transfers to other parts of GCC, which causes it to generate different
> code (matching what it already does on -O2).
> I'm pretty sure that by removing the patch you're simply hiding the real
> issue which can easily creep in again in other places when compiling
> with -O2. I don't think we can trust GCC 7 on MIPS before we find and
> fix the real bug.
>
Hi Felix,
Thanks for explaining that. I suspect you’re right that there’s an underlying bug in gcc mips. So ideally we need some code that exposes the bug when using -O2 (or even just -funroll_loops) Looking at FS 814 there’s a hint in there that uhttpd was similarly affected…and not solved by the patch drop. So what to do if there’s a bug just lurking to bite us?
Updating code (as in dropbear when it eventually releases) is still not the ultimate solution. On the basis at present gcc7 mips produces a broken dropbear, thus soft bricking, perhaps gcc7 should be disabled for mips architecture.
Cheers,
Kevin D-B
GPG fingerprint: 012C ACB2 28C6 C53E 9775 9123 B3A2 389B 9DE2 334A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.infradead.org/pipermail/lede-dev/attachments/20171218/681cea21/attachment.sig>
More information about the Lede-dev
mailing list