Skip to content

Add support for riscv64gc #2323

@nc7s

Description

@nc7s

Hi,

The Rust crate jemalloc-sys currently fails to build from source on Debian (see buildd logs). The cause is that configure didn't recognize riscv64gc. tikv/jemallocator#36

jemalloc has been successfully built on an amd64 Debian chroot with qemu-user-riscv64 binaries,

  • with default settings - bare ./autogen.sh, which recognizes the chroot as riscv64-unknown-linux-gnu, and
  • with --host=riscv64gc-unknown-linux-gnu after adding riscv64gc to build-aux/config.{sub,guess}
    • The full command generated by jemalloc-sys build.rs is "sh" "/root/jemallocator/target/debug/build/tikv-jemalloc-sys-7a22a3b3fd1c07ca/out/build/autogen.sh" "--disable-cxx" "--enable-doc=no" "--enable-shared=no" "--with-jemalloc-prefix=_rjem_" "--with-private-namespace=_rjem_" "--host=riscv64gc-unknown-linux-gnu" "--build=riscv64gc-unknown-linux-gnu"

so adding riscv64gc seems trivial.

The are two "pointer reuse after realloc" errors:

Details
gcc  -std=gnu11 -Wall -Wextra -Wsign-compare -Wundef -Wno-format-zero-length -Wpointer-arith -Wno-missing-braces -Wno-missing-field-initializers -Wno-missing-attributes -pipe -g3 -fvisibility=hidden -Wimplicit-fallthrough -O3 -funroll-loops -Werror -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -I../../include -DJEMALLOC_INTEGRATION_TEST -I../../test/include -Itest/include -o test/integration/overflow.o ../../test/integration/overflow.c
In file included from test/include/test/jemalloc_test.h:128,
                 from ../../test/integration/overflow.c:1:
../../test/integration/overflow.c: In function 'test_overflow':
include/jemalloc/jemalloc.h:86:22: error: pointer 'p' used after 'realloc' [-Werror=use-after-free]
   86 | #  define je_realloc realloc
../../test/include/test/test.h:4:23: note: in definition of macro 'verify_cmp'
    4 |         const t a_ = (a);                                               \
      |                       ^
../../test/include/test/test.h:31:41: note: in expansion of macro 'expect_cmp'
   31 | #define expect_ptr_null(a, ...)         expect_cmp(void *, a, NULL, ==, \
      |                                         ^~~~~~~~~~
../../test/integration/overflow.c:46:9: note: in expansion of macro 'expect_ptr_null'
   46 |         expect_ptr_null(realloc(p, SIZE_T_MAX),
      |         ^~~~~~~~~~~~~~~
include/jemalloc/jemalloc.h:423:19: note: in expansion of macro 'je_realloc'
  423 | #  define realloc je_realloc
      |                   ^~~~~~~~~~
../../test/integration/overflow.c:46:25: note: in expansion of macro 'realloc'
   46 |         expect_ptr_null(realloc(p, SIZE_T_MAX),
      |                         ^~~~~~~
include/jemalloc/jemalloc.h:86:22: note: call to 'realloc' here
   86 | #  define je_realloc realloc
../../test/include/test/test.h:4:23: note: in definition of macro 'verify_cmp'
    4 |         const t a_ = (a);                                               \
      |                       ^
../../test/include/test/test.h:31:41: note: in expansion of macro 'expect_cmp'
   31 | #define expect_ptr_null(a, ...)         expect_cmp(void *, a, NULL, ==, \
      |                                         ^~~~~~~~~~
../../test/integration/overflow.c:44:9: note: in expansion of macro 'expect_ptr_null'
   44 |         expect_ptr_null(realloc(p, max_size_class + 1),
      |         ^~~~~~~~~~~~~~~
include/jemalloc/jemalloc.h:423:19: note: in expansion of macro 'je_realloc'
  423 | #  define realloc je_realloc
      |                   ^~~~~~~~~~
../../test/integration/overflow.c:44:25: note: in expansion of macro 'realloc'
   44 |         expect_ptr_null(realloc(p, max_size_class + 1),
      |                         ^~~~~~~
In file included from test/include/test/jemalloc_test.h:58:
include/jemalloc/jemalloc.h:71:19: error: pointer 'p' used after 'realloc' [-Werror=use-after-free]
   71 | #  define je_free free
include/jemalloc/jemalloc.h:408:16: note: in expansion of macro 'je_free'
  408 | #  define free je_free
      |                ^~~~~~~
../../test/integration/overflow.c:48:9: note: in expansion of macro 'free'
   48 |         free(p);
      |         ^~~~
include/jemalloc/jemalloc.h:86:22: note: call to 'realloc' here
   86 | #  define je_realloc realloc
../../test/include/test/test.h:4:23: note: in definition of macro 'verify_cmp'
    4 |         const t a_ = (a);                                               \
      |                       ^
../../test/include/test/test.h:31:41: note: in expansion of macro 'expect_cmp'
   31 | #define expect_ptr_null(a, ...)         expect_cmp(void *, a, NULL, ==, \
      |                                         ^~~~~~~~~~
../../test/integration/overflow.c:44:9: note: in expansion of macro 'expect_ptr_null'
   44 |         expect_ptr_null(realloc(p, max_size_class + 1),
      |         ^~~~~~~~~~~~~~~
include/jemalloc/jemalloc.h:423:19: note: in expansion of macro 'je_realloc'
  423 | #  define realloc je_realloc
      |                   ^~~~~~~~~~
../../test/integration/overflow.c:44:25: note: in expansion of macro 'realloc'
   44 |         expect_ptr_null(realloc(p, max_size_class + 1),
      |                         ^~~~~~~
cc1: all warnings being treated as errors
gmake: *** [Makefile:479: test/integration/overflow.o] Error 1
==> Error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions