Status: New
Owner: ----

New issue 1869 by [email protected]: more netbsd support including gyp
http://code.google.com/p/v8/issues/detail?id=1869

Index: src/d8.gyp
===================================================================
--- src/d8.gyp  (revision 10272)
+++ src/d8.gyp  (working copy)
@@ -65,7 +65,7 @@
               'sources': [ 'd8-readline.cc' ],
             }],
             [ '(OS=="linux" or OS=="mac" or OS=="freebsd" \
-              or OS=="openbsd" or OS=="solaris" or OS=="android")', {
+ or OS=="openbsd" or OS=="solaris" or OS=="android" or OS=="netbsd")', {
               'sources': [ 'd8-posix.cc', ]
             }],
             [ 'OS=="win"', {
Index: build/common.gypi
===================================================================
--- build/common.gypi   (revision 10272)
+++ build/common.gypi   (working copy)
@@ -215,7 +215,7 @@
           },
         },
       }],
-      ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" or OS=="netbsd"', {
         'conditions': [
           [ 'target_arch=="ia32"', {
             'cflags': [ '-m32' ],
@@ -259,7 +259,10 @@
           ['OS=="freebsd" or OS=="openbsd"', {
             'cflags': [ '-I/usr/local/include' ],
           }],
-          ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
+          ['OS=="netbsd"', {
+            'cflags': [ '-I/usr/pkg/include' ],
+          }],
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', { 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
                         '-Wnon-virtual-dtor' ],
           }],

@@ -267,7 +270,7 @@
       },
       'Release': {
         'conditions': [
-          ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
             'cflags!': [
               '-O2',
               '-Os',
@@ -290,6 +293,9 @@
           ['OS=="freebsd" or OS=="openbsd"', {
             'cflags': [ '-I/usr/local/include' ],
           }],
+          ['OS=="netbsd"', {
+            'cflags': [ '-I/usr/pkg/include' ],
+          }],
           ['OS=="mac"', {
             'xcode_settings': {
               'GCC_OPTIMIZATION_LEVEL': '3',  # -O3

Index: build/standalone.gypi
===================================================================
--- build/standalone.gypi       (revision 10272)
+++ build/standalone.gypi       (working copy)
@@ -37,13 +37,13 @@
       'variables': {
         'variables': {
           'conditions': [
-            [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
+ [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', { # This handles the Linux platforms we generally deal with. Anything # else gets passed through, which probably won't work very well; such
               # hosts should pass an explicit target_arch to gyp.
               'host_arch%':
'<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/mips.*/mips/")',
-            }, {  # OS!="linux" and OS!="freebsd" and OS!="openbsd"
+ }, { # OS!="linux" and OS!="freebsd" and OS!="openbsd" and OS!="netbsd"
               'host_arch%': 'ia32',
             }],
           ],
@@ -78,7 +78,7 @@
     },
   },
   'conditions': [
-    [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
+ [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" or OS=="netbsd"', {
       'target_defaults': {
         'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
                     '-Wnon-virtual-dtor', '-pthread', '-fno-rtti',
@@ -96,7 +96,7 @@
           }],
         ],
       },
-    }],  # 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"'
+ }], # 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" or OS=="netbsd"'
     ['OS=="win"', {
       'target_defaults': {
         'defines': [

Index: tools/gyp/v8.gyp
===================================================================
--- tools/gyp/v8.gyp    (revision 10272)
+++ tools/gyp/v8.gyp    (working copy)
@@ -681,6 +681,17 @@
                 ],
               }
             ],
+            ['OS=="netbsd"', {
+                'link_settings': {
+                  'libraries': [
+                    '-L/usr/pkg/lib -lexecinfo',
+                ]},
+                'sources': [
+                  '../../src/platform-netbsd.cc',
+                  '../../src/platform-posix.cc'
+                ],
+              }
+            ],
             ['OS=="solaris"', {
                 'sources': [
                   '../../src/platform-solaris.cc',


--- platform-openbsd.cc 2011-12-18 13:25:55.000000000 -0500
+++ platform-netbsd.cc  2011-12-18 13:49:27.000000000 -0500
@@ -25,7 +25,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-// Platform specific code for OpenBSD goes here. For the POSIX comaptible parts +// Platform specific code for NetBSD goes here. For the POSIX comaptible parts
 // the implementation is in platform-posix.cc.

 #include <pthread.h>
@@ -42,8 +42,8 @@
 #include <sys/stat.h>   // open
 #include <fcntl.h>      // open
 #include <unistd.h>     // sysconf
-#include <execinfo.h>   // backtrace, backtrace_symbols
 #include <strings.h>    // index
+#include <execinfo.h>    // index
 #include <errno.h>
 #include <stdarg.h>

@@ -743,15 +743,16 @@

   // Extracting the sample from the context is extremely machine dependent.
   ucontext_t* ucontext = reinterpret_cast<ucontext_t*>(context);
+  mcontext_t& mcontext = ucontext->uc_mcontext;
   sample->state = isolate->current_vm_state();
 #if V8_HOST_ARCH_IA32
-  sample->pc = reinterpret_cast<Address>(ucontext->sc_eip);
-  sample->sp = reinterpret_cast<Address>(ucontext->sc_esp);
-  sample->fp = reinterpret_cast<Address>(ucontext->sc_ebp);
+  sample->pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_EIP]);
+  sample->sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_ESP]);
+  sample->fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_EBP]);
 #elif V8_HOST_ARCH_X64
-  sample->pc = reinterpret_cast<Address>(ucontext->sc_rip);
-  sample->sp = reinterpret_cast<Address>(ucontext->sc_rsp);
-  sample->fp = reinterpret_cast<Address>(ucontext->sc_rbp);
+  sample->pc = reinterpret_cast<Address>(mcontext.__gregs[_REG_RIP]);
+  sample->sp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RSP]);
+  sample->fp = reinterpret_cast<Address>(mcontext.__gregs[_REG_RBP]);
 #endif
   sampler->SampleStack(sample);
   sampler->Tick(sample);


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to