GithubHelp home page GithubHelp logo

openorbis / musl Goto Github PK

View Code? Open in Web Editor NEW
34.0 34.0 11.0 6.31 MB

A PS4 port of musl for the OpenOrbis PS4 Toolchain.

License: Other

Makefile 0.25% C 95.04% Assembly 4.18% Awk 0.41% Shell 0.11% sed 0.01%

musl's People

Contributors

alexdowad avatar amonakov avatar arkamar avatar armcc avatar awilfox avatar cpasjuste avatar cryptogenic avatar doughdemon avatar dtzwill avatar fabled avatar gustedt avatar hauke avatar jlama avatar john-tornblom avatar jow- avatar kaniini avatar kiwidoggie avatar kraj avatar maskray avatar michaelforney avatar ncopa avatar niklata avatar nkrapivin avatar nto avatar pattop avatar pikhq avatar rofl0r avatar shizmob avatar sleirsgoevy avatar smaeul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

musl's Issues

Few questions

In Linux, musl is received as a light libc variant, and alternative to glibc. Over the years/decades, glibc has gathered bulk due to backwards compatibility support, which musl shaves off, and generally developers of musl libc make choices to keep the code size small (it's almost 1/3rd of the size of glibc).

Given the above, I have few questions:

  1. Does FreeBSD's libc also suffer with same "bulkiness" issue as glibc, such that it makes observable difference when it was replaced by musl?
  2. Do you see a potential in upstreamming patches to musl?
  3. Do you see a potential in proposing a change to FreeBSD to make building the OS with musl (instead of FreeBSD's in-tree libc) optional?

pthread "fallback" implementation misses some functions

Got this while trying to compile JamVM:

ld.lld: error: undefined symbol: _pthread_cleanup_push
>>> referenced by res_msend.c
>>>               res_msend.lo:(__res_msend_rc) in archive /home/sergey/openorbis//lib/libc.a

ld.lld: error: undefined symbol: _pthread_cleanup_pop
>>> referenced by res_msend.c
>>>               res_msend.lo:(__res_msend_rc) in archive /home/sergey/openorbis//lib/libc.a

Musl is internally using some pthread functions (pthread_cleanup_push and pthread_cleanup_pop in this case) that are not implemented in the "fallback" implementation.

Sleep is broken

Originally reported by LM in the discord:

Apparently sleep() does not function properly, calling it is effectively a no-op.

BSD/Linux differences in socket.h

The socket options for Linux and BSD use different values for, e.g., SO_REUSEADDR, which in turn cause setsockopt to behave incorrectly.

musl: #define SO_REUSEADDR 2
freebsd: #define SO_REUSEADDR 0x0004

Better handling of unavailable syscalls

For syscalls that the PS4 doesn't have available, we currently punt by always returning -1. There seems to be two broad categories for how we can usually do this better, though:

  1. Syscalls that really have no equivalent at all, like fanotify_init, should set errno to ENOSYS, so that the caller will have a clue about why it actually failed, instead of getting a random unrelated error.
  2. Syscalls that can be emulated in userspace with only slight degradation, like pipe2, should do that instead of failing entirely. In fact, in that case it looks like the code to do that is already there; we just #ifdef'ed out a bit too much.

[possible enhancement] Use libkernel wrappers instead of issuing syscalls directly

This is not a bugreport, just a possible enhancement.

Arguments:

  1. Issuing syscalls directly requires a patched kernel. If some other way of running homebrew (e.g. a code execution vulnerability in a JIT-enabled system app) approaches, OpenOrbis toolchain would be of no use.
  2. It seems that libkernel explicitly omits some syscall wrappers. Sony can expect that replacing one of those with another custom syscall won't break existing code.
  3. Little can be done without loading system libraries, and those depend on libkernel anyway.
  4. libkernel wrappers are supposed to be C functions, so using them could allow to avoid low-level ABI incompatibilities.

Musl's open/open64 wrapper fails to build correctly

In file included from src/fcntl/open.c:2:
src/fcntl/open.c: In function 'open':
src/fcntl/open.c:16:21: warning: 'mode_t' {aka 'short unsigned int'} is promoted to 'int' when passed through '...'
   16 |   mode = va_arg(ap, mode_t);
./include/stdarg.h:14:44: note: in definition of macro 'va_arg'
   14 | #define va_arg(v,l)     __builtin_va_arg(v,l)
      |                                            ^
src/fcntl/open.c:16:21: note: (so you should pass 'int' not 'mode_t' {aka 'short unsigned int'} to 'va_arg')
   16 |   mode = va_arg(ap, mode_t);
./include/stdarg.h:14:44: note: in definition of macro 'va_arg'
   14 | #define va_arg(v,l)     __builtin_va_arg(v,l)
      |                                            ^
src/fcntl/open.c:16:21: note: if this code is reached, the program will abort
   16 |   mode = va_arg(ap, mode_t);
./include/stdarg.h:14:44: note: in definition of macro 'va_arg'
   14 | #define va_arg(v,l)     __builtin_va_arg(v,l)
      |                                            ^

XXX: is this actually an upstream issue?

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.