| Issue |
208033
|
| Summary |
[libc] Provide `getenv` and other environment related symbols for bare metal targets
|
| Labels |
libc
|
| Assignees |
|
| Reporter |
omegametabroccolo
|
I'm currently trying to port [mimalloc](https://github.com/microsoft/mimalloc) to bare metal targets, linking against different libcs. `getenv`, which is provided by picolibc, newlib and newlib-nano, is missing from llvmlibc. I [tried my hand](https://github.com/omegametabroccolo/llvm-project/commit/64e2e5ae520fd4fc41e801f714c0013dc51d2f80) at patching it, but my attempt crashes during the first call to `EnvironmentManager::get_instance` (I probably just forgot something dumb).
Before going further, there are a few things I'd like to discuss:
- In my current attempt, I set `app.env_ptr` to `nullptr` with the intent that `EnvironmentManager` immediately starts to manage the environment's memory. Maybe we could use a symbol like `__llvm_libc_environ` so that vendors can define their own initial environment?
- @kaladron I see that you implemented `setenv` and `unsetenv` under `src/stdlib/linux`, unlike `getenv` which is under `src/stdlib`, why is that? My understanding is that `{un,}setenv` only rely on `EnvironmentManager`, which can support any target with an `AppProperties app` struct that has a `uintptr_t *env_ptr` field, but maybe I'm missing something.
- I think we could also provide *env for `uefi` in the same way.
Thanks!
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs