龙芯3A4000的linux系统下node14.17.5运行出现Floating point exception(浮点数异常)问题解决
因项目需要在龙芯下使用node14.17.5执行构建任务,在使用源码编译安装后,执行时出现Floating point exception(浮点数异常)问题。
经调试发现,其是在使用openssl加载ECC相关证书时使用mips64汇编代码时导致的。
在分析相关代码后,将deps下的openssl中的bn_div.c文件的16行进行修改,重新编译即可运行。
修改前代码片段如下:
/*
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <assert.h>
#include <openssl/bn.h>
#include "internal/cryptlib.h"
#include "bn_local.h"
/* The old slow way */
#if 0
int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
BN_CTX *ctx)
{
修改后代码片段如下:
/*
* Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <assert.h>
#include <openssl/bn.h>
#include "internal/cryptlib.h"
#include "bn_local.h"
/* The old slow way */
#if 1
int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
BN_CTX *ctx)
{