Giter Club home page Giter Club logo

Comments (4)

jleidel avatar jleidel commented on September 17, 2024

this is a known issue. we're working it. RISC-V doesn't fully support portions of the ELF spec

from rev.

ukasz avatar ukasz commented on September 17, 2024

I am changing that to P0 because it is super annoying to deal with as we work more and more with c++ code. This issue has huge negative impact for c++ applications: a) static members of a function cannot be initialized properly b) constructors of globally defined classed are never called.

Global class declaration:

class X {
        public:
        X() {
                magic = 42;
        }
        int magic;
};

X x;

int main() {
        assert(x.magic == 42);

        return 0;
}

Static class member initialization:

class X {
        public:
        static int magic;
};

int X::magic = 42;

int main() {
        assert(X::magic == 42);

        return 0;
}

from rev.

jleidel avatar jleidel commented on September 17, 2024

feel free to start execution at _start

from rev.

ukasz avatar ukasz commented on September 17, 2024

I wasn't aware of the lack of .init/.fini sections on RV, but the same mechanism seems to be implemented on risc using .text and .plt sections.

I tried starting directly from _start, our libc runs calls set_tid_address syscall, I know that you are working on TLS support, would it be a problem to add support for this syscall, or should we try to do something on our end with it?

I briefly added a dummy set_tid_address syscall implementation and with that in place all three examples posted here work fine for us.

diff --git a/src/RevProc.cc b/src/RevProc.cc
index 6175d23..b76acc0 100644
--- a/src/RevProc.cc
+++ b/src/RevProc.cc
@@ -2412,6 +2412,7 @@ void RevProc::InitEcallTable(){
     {93,  &RevProc::ECALL_exit},
     {94,  &RevProc::ECALL_exit_group},      // Not implemented
     {95,  &RevProc::ECALL_waitid},          // Not implemented
+    {96,  &RevProc::ECALL_set_tid_address}, // Not implemented
     {99,  &RevProc::ECALL_set_robust_list}, // Not implemented
     {100, &RevProc::ECALL_get_robust_list}, // Not implementedt
     {101, &RevProc::ECALL_nanosleep},       // Not implemented
@@ -2789,6 +2790,11 @@ void RevProc::ECALL_munmap(){
   return;
 }

+void RevProc::ECALL_set_tid_address(){
+  output->verbose(CALL_INFO, 2, 0, "ECALL: set_tid_address called\n");
+  return;
+}
+

from rev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.