CTSRD-CHERI / cheribsd-ports

FreeBSD ports tree adapted for CheriBSD.
https://CheriBSD.org
Other
5 stars 11 forks source link

A64 npm tries to build pure-cap libraries #23

Open davidchisnall opened 2 years ago

davidchisnall commented 2 years ago

There is not yet a CHERI port of v8 and so node and npm must be installed as A64 programs. If you then use npm to install something with native components then gyp then it will build using cc, which defaults to building pure-capability binaries. I have worked around this locally by hacking /usr/local64/lib/node_modules/npm/node_modules/node-gyp/addon.gypi to change this bit at the end of the file:

      [ 'OS in "freebsd openbsd netbsd solaris android" or \
         (OS=="linux" and target_arch!="ia32")', {
        'cflags': [ '-fPIC' ],
      }],

to this:

      [ 'OS in "freebsd openbsd netbsd solaris android" or \
         (OS=="linux" and target_arch!="ia32")', {
        'cflags': [ '-fPIC', '-mabi=aapcs' ],
        'ldflags': [ '-mabi=aapcs' ],
      }],