summary refs log tree commit diff stats
path: root/results/classifier/gemma3:12b/debug/729
blob: 3447c93a79e918231ab982d54976fccff582a317 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Environment variables are not passed with user-space semihosting
Description of problem:
Environment variables are not passed to the emulated process, either inherited (as I might expect it to work in user-space?) or by specifying the values through the QEMU command-line. Note that setting the environment variable from within the app before calling `getenv` does work, so it isn't just a case of some system no-ops for the platform.
Steps to reproduce:
1. Compile the following program with [ARM embedded toolchain](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads):
```cpp
#include <iostream>
#include <cstdlib>

int main(int argc, char* argv[]) {
	char* env = std::getenv("TEST");
	if (env)
		std::cout << "Env TEST: " << env << "\n";
	else
		std::cout << "Env TEST not set.\n";
	return 0;
}
```

```
$ $CXX --version
arm-none-eabi-g++ (GNU Arm Embedded Toolchain 10-2020-q4-major) 10.2.1 20201103 (release)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ $CXX main.cpp --specs=rdimon.specs -mcpu=cortex-m7
```

2. Run in user-space (semihosted):
```
$ qemu-arm -cpu cortex-m7 -E TEST=val123 ./a.out 
Env TEST not set.
```