Skip to content

can we use upstream pthread instead of this library? #26

@ian-h-chamberlain

Description

@ian-h-chamberlain

The new newlib update from devkitPro seems to include an actual libpthread!!!

$ arm-none-eabi-nm   /opt/devkitpro/devkitARM/arm-none-eabi/lib/libsysbase.a | grep pthread | wc -l 
86

I can't quite tell if it works correctly or at all, but there is definitely some new code in the libsysbase library and we might need to readjust how this library works to play nicely with it (link errors etc.)

The implementation looks to be similar to what we have done in this library, but perhaps the syscalls are still stubs (and we could implement them here, but let newlib handle the business logic):

https://github.com/devkitPro/buildscripts/blob/cd5e224d6a14f7d32712ab10cfc08e0c6a2daea3/dkarm-eabi/patches/newlib-4.3.0.20230120.patch#L7741

There might also be some other stuff that relates to shim-3ds, it seems like a lot of new library surface area. Probably will take a while to crawl through all of it and figure out what we can use or need to change.

Looking at libnx (where I am guessing some of these changes came from) it seems they just implement __syscall_* in terms of the device-specific libraries: https://github.com/switchbrew/libnx/blob/master/nx/source/runtime/newlib.c#L172

Perhaps we could do the same in this lib instead.

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