Bug 150381 - [MIPS] LLInt: fix calculation of Global Offset Table
Summary: [MIPS] LLInt: fix calculation of Global Offset Table
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 108664
  Show dependency treegraph
 
Reported: 2015-10-20 17:53 PDT by Guillaume Emont
Modified: 2016-01-18 18:38 PST (History)
7 users (show)

See Also:


Attachments
Patch (1.79 KB, patch)
2015-10-20 17:56 PDT, Guillaume Emont
mcatanzaro: review+
Details | Formatted Diff | Diff
Patch (3.11 KB, patch)
2016-01-17 12:24 PST, Konstantin Tokarev
no flags Details | Formatted Diff | Diff
Patch (3.05 KB, patch)
2016-01-18 01:35 PST, Konstantin Tokarev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Emont 2015-10-20 17:53:02 PDT
Offlineasm adds a .cpload when we create a label in MIPS (useful for functions so that the GOT can be used to calculate the address of position-independent code). But the code created by the assembler when encountering a .cpload assumes  that we jumped to that address. So we need to add a jump to pcBase in initPCRelative(), or otherwise the GOT-related calculations are wrong.
Comment 1 Guillaume Emont 2015-10-20 17:56:50 PDT
Created attachment 263644 [details]
Patch
Comment 2 Michael Catanzaro 2015-12-30 15:06:11 PST
Comment on attachment 263644 [details]
Patch

Can't hurt anything for non-MIPS, so sure....
Comment 3 Konstantin Tokarev 2016-01-16 04:39:09 PST
Could anyone land this patch? It is needed to get MIPS finally working.
Comment 4 Konstantin Tokarev 2016-01-16 11:34:47 PST
Looks like jmp is not needed here, we just need to update $t9. I will upload different patch.
Comment 5 Konstantin Tokarev 2016-01-17 12:24:12 PST
Created attachment 269193 [details]
Patch
Comment 6 Konstantin Tokarev 2016-01-17 12:26:09 PST
New patch fixes the bug without adding unneeded jr instruction after move $t9, $v1
Comment 7 Julien Brianceau 2016-01-18 01:31:46 PST
Comment on attachment 269193 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=269193&action=review

LGTM, please just fix ChangeLog file

> Source/JavaScriptCore/ChangeLog:3
> +        llint: fix calculation of Global Offset Table

This line seems redundant with line 5, please remove it

> Source/JavaScriptCore/ChangeLog:14
> +        instruction setcallreg which does exactlly that.

exactlly -> exactly
Comment 8 Konstantin Tokarev 2016-01-18 01:35:51 PST
Created attachment 269212 [details]
Patch
Comment 9 Konstantin Tokarev 2016-01-18 01:41:17 PST
Comment on attachment 269193 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=269193&action=review

>> Source/JavaScriptCore/ChangeLog:3
>> +        llint: fix calculation of Global Offset Table
> 
> This line seems redundant with line 5, please remove it

Done

>> Source/JavaScriptCore/ChangeLog:14
>> +        instruction setcallreg which does exactlly that.
> 
> exactlly -> exactly

Done
Comment 10 Julien Brianceau 2016-01-18 02:13:16 PST
Thanks, LGTM
Comment 11 Michael Saboff 2016-01-18 12:17:58 PST
Comment on attachment 269212 [details]
Patch

r=me
Comment 12 WebKit Commit Bot 2016-01-18 13:07:20 PST
Comment on attachment 269212 [details]
Patch

Clearing flags on attachment: 269212

Committed r195236: <http://trac.webkit.org/changeset/195236>
Comment 13 Guillaume Emont 2016-01-18 18:38:41 PST
(In reply to comment #6)
> New patch fixes the bug without adding unneeded jr instruction after move
> $t9, $v1

Indeed, I was a bit lazy with my patch. Thanks!