You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the dynamic linking was introduced in the previous commit, this
commit updates the README to describe how to use dynamic linking mode
and provides basic usage examples for illustration.
-`--dynlink` : Use dynamic linking (default: disabled)
114
137
115
-
Example:
138
+
Example 1: static linking mode
116
139
```shell
117
140
$ out/shecc -o fib tests/fib.c
118
141
$ chmod +x fib
119
142
$ qemu-arm fib
120
143
```
121
144
145
+
Example 2: dynamic linking mode
146
+
147
+
Notice that `/usr/arm-linux-gnueabihf` is the ELF interpreter prefix. Since the path may be different if you manually install the ARM GNU toolchain instead of using `apt-get`, you should set the prefix to the actual path.
148
+
```shell
149
+
$ out/shecc --dynlink -o fib tests/fib.c
150
+
$ chmod +x fib
151
+
$ qemu-arm -L /usr/arm-linux-gnueabihf fib
152
+
```
153
+
122
154
### IR Regression Tests
123
155
124
156
To ensure the consistency of frontend (lexer, parser) behavior when working on it, the snapshot test is introduced.
@@ -142,6 +174,7 @@ use `update-snapshot` / `check-snapshot` instead.
142
174
143
175
`shecc` comes with a comprehensive test suite (200+ test cases). To run the tests:
144
176
```shell
177
+
# Add 'LINK_MODE=dynamic' if using the dynamic linking mode.
145
178
$ make check # Run all tests (stage 0 and stage 2)
0 commit comments