Skip to content

build: add --v8-target-arch and cross compiling options - #7787

Closed
xbolshe wants to merge 1 commit into
nodejs:masterfrom
xbolshe:master
Closed

xbolshe wants to merge 1 commit into
nodejs:masterfrom
xbolshe:master

Conversation

@xbolshe

@xbolshe xbolshe commented Jul 18, 2016

Copy link
Copy Markdown
Checklist
  • commit message follows commit guidelines
Affected core subsystem(s)

build

Description of change
  • Add --v8-target-arch option to apply a correct v8_target_arch like x87 in config.gypi while --dest-cpu=ia32.
  • Add --host-cc, --host-cxx, --host-ar options to set environment variables required for a cross compiling process.

Signed-off-by: Eugene Bolshakov pub@relvarsoft.com

Signed-off-by: Eugene Bolshakov <pub@relvarsoft.com>
@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to Node.js builds or CI infrastructure. label Jul 18, 2016
@mscdex mscdex added the v8 engine Issues and PRs related to the V8 dependency. label Jul 18, 2016
@bnoordhuis

Copy link
Copy Markdown
Member

I don't think --v8-target-arch would work. Your x87 example results in a binary where V8 emits x87 code but everything else still uses SSE. Is there a plausible scenario for target_arch != v8_target_arch?

@xbolshe

xbolshe commented Jul 20, 2016 •

Copy link
Copy Markdown
Author

Let me provide some experience about --v8-target-arch:

  1. My experience to build my own Linux images with NodeJS for Intel Galileo Gen1&Gen2 boards:

There is no SSE support, my NodeJS works on Quark CPU:
x87_3

  1. I found this presentation too late (after digging into V8 code and finding a solution):

http://ark.intel.com/products/79084/Intel-Quark-SoC-X1000-16K-Cache-400-MHz

http://events.linuxfoundation.org/sites/events/files/slides/V8%20engine%20of%20Node.js%20on%20IA%20JavaScript-JITTED%20x86%20machine%20code%20mapping%20profiling%20support%20and%20X87%20Quark%20processor%20enabling.pdf

x87 support in V8 belongs to Intel.
On a slide below you may find that target_arch != v8_target_arch.

x87_1

x87_2

  1. Users' experience when x87 is not selected and "Illegal instruction" is present:

https://communities.intel.com/thread/52059

https://forums.gentoo.org/viewtopic-p-7804792.html?sid=dee8f41663e159818a8f913e37b757bf#7804792

https://communities.intel.com/thread/80904

  1. About "everything else still uses SSE":
    I can't agree with you because GCC and all code is done without SSE support using -march=i586 option:

https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html

‘i586’
‘pentium’
Intel Pentium CPU with no MMX support.

x87_4

/сс @cdai2

BR,
xbolshe

@bnoordhuis

bnoordhuis commented Jul 20, 2016 •

Copy link
Copy Markdown
Member
  1. About "everything else still uses SSE": I can't agree with you because GCC and all code is done without SSE support using -march=i586 option:

I know that V8 is compiled with -march=i586 when v8_target_arch=x87, but node is not - that is what I mean with "everything else".

If you get a working binary, that probably means your toolchain is configured for i586, i.e., it defaults to -march=i586. But someone with, say, an i686 toolchain would end up with a malfunctioning binary.

@xbolshe

xbolshe commented Jul 20, 2016

Copy link
Copy Markdown
Author

Sure. And a malfunctioning binary may be done with another wrong compiler options (like big endian instead of little endian).

x87_5

@jasnell

jasnell commented Mar 1, 2017

Copy link
Copy Markdown
Member

Is this still needed?

@jasnell jasnell added the stalled Issues and PRs manually marked as stalled and scheduled for automatic closure. label Mar 1, 2017
@bnoordhuis

Copy link
Copy Markdown
Member

I had another look and I still think this isn't the right approach. For one, this PR lets you build a node binary that reports process.arch is ia32 while it's really x87 (assuming the binary actually works, see my #7787 (comment) here.)

The --host-* switches might be acceptable, although I wouldn't want to vouch they are sufficient in all cases.

@xbolshe

xbolshe commented Mar 19, 2017

Copy link
Copy Markdown
Author

@jasnell Yep, it is needed.
@bnoordhuis It is not just an arch like i586. x87 option enables a part of V8 code like https://github.com/v8/v8/tree/master/src/x87

@fhinkel

fhinkel commented May 26, 2017

Copy link
Copy Markdown
Contributor

There hasn't been any activity here. I'm closing this. Feel free to reopen (or ping a collaborator) if I closed this in error.

@fhinkel fhinkel closed this May 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to Node.js builds or CI infrastructure. stalled Issues and PRs manually marked as stalled and scheduled for automatic closure. v8 engine Issues and PRs related to the V8 dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants