Bug 56088 - cti_vm_throw gets kicked out by gcc 4.6 -flto
Summary: cti_vm_throw gets kicked out by gcc 4.6 -flto
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Allan Sandfeld Jensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-10 03:31 PST by Bernhard Rosenkraenzer
Modified: 2023-10-24 23:07 PDT (History)
7 users (show)

See Also:


Attachments
Patch (19.16 KB, patch)
2012-03-07 09:10 PST, Allan Sandfeld Jensen
no flags Details | Formatted Diff | Diff
Patch (5.80 KB, patch)
2012-05-23 05:39 PDT, Allan Sandfeld Jensen
no flags Details | Formatted Diff | Diff
Patch (5.75 KB, patch)
2012-05-23 10:00 PDT, Allan Sandfeld Jensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Rosenkraenzer 2011-03-10 03:31:14 PST
Building WebKit with gcc 4.6 with -flto enabled results in a linking error:
/tmp/ccaOGKiM.ltrans0.ltrans.o: In function `ctiVMThrowTrampoline':
ccaOGKiM.ltrans0.o:(.text+0x4c): undefined reference to `cti_vm_throw'

The gcc guys say this is not a bug in gcc, since cti_vm_throw is called only by asm code, it needs to be marked with __attribute__((used))
Comment 1 stormbyte 2011-07-28 06:39:37 PDT
I can confirm this one failing with LTO with gcc 4.6.1
Comment 2 Allan Sandfeld Jensen 2012-03-07 09:10:27 PST
Created attachment 130635 [details]
Patch

Add __attribute__((used)) to cti_vm_throw and several other functions that needs it to make linking with -flto work.
Comment 3 Allan Sandfeld Jensen 2012-05-21 08:27:23 PDT
Comment on attachment 130635 [details]
Patch

I am not 100% sure this is the right solution, but without review, I will never be told if I wrong.
Comment 4 Filip Pizlo 2012-05-21 13:47:00 PDT
Comment on attachment 130635 [details]
Patch

This looks fine in principle, but can you rebase your patch?
Comment 5 Allan Sandfeld Jensen 2012-05-23 05:39:33 PDT
Created attachment 143544 [details]
Patch
Comment 6 Allan Sandfeld Jensen 2012-05-23 05:42:02 PDT
Rebased patch. I should not that I have not succeeded in building WebCore with flto yet, but this patch fixes WTF and JavaScriptCore if build separately.
Comment 7 WebKit Review Bot 2012-05-23 05:43:27 PDT
Attachment 143544 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1
Source/JavaScriptCore/jit/JITStubs.h:466:  cti_vm_throw is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 1 in 7 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Darin Adler 2012-05-23 08:27:02 PDT
Comment on attachment 143544 [details]
Patch

I’m not sure about the name FUNCTION_USED.
Comment 9 Darin Adler 2012-05-23 08:27:43 PDT
Comment on attachment 143544 [details]
Patch

Wait, shouldn’t FUNCTION_USED go into Compiler.h instead of Platform.h?
Comment 10 Allan Sandfeld Jensen 2012-05-23 08:44:55 PDT
(In reply to comment #8)
> (From update of attachment 143544 [details])
> I’m not sure about the name FUNCTION_USED.

I am not either, but I don't have a better one. MARK_AS_USED?

(In reply to comment #9)
> Wait, shouldn’t FUNCTION_USED go into Compiler.h instead of Platform.h?

I originally placed it Platform.h because it was were JSC_HOST_CALL was defined which is another flag for JIT-assembler functions, but they may both be misplaced.
Comment 11 Allan Sandfeld Jensen 2012-05-23 10:00:19 PDT
Created attachment 143584 [details]
Patch

Renamed FUNCTION_USED to REFERENCED_FROM_ASM and moved its definition to Compiler.h
Comment 12 WebKit Review Bot 2012-05-24 03:49:55 PDT
Comment on attachment 143584 [details]
Patch

Clearing flags on attachment: 143584

Committed r118344: <http://trac.webkit.org/changeset/118344>
Comment 13 WebKit Review Bot 2012-05-24 03:50:00 PDT
All reviewed patches have been landed.  Closing bug.