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
+
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.
147
+
```shell
148
+
$ out/shecc --dynlink -o fib tests/fib.c
149
+
$ chmod +x fib
150
+
$ qemu-arm -L /usr/arm-linux-gnueabihf fib
151
+
```
152
+
122
153
### IR Regression Tests
123
154
124
155
To ensure the consistency of frontend (lexer, parser) behavior when working on it, the snapshot test is introduced.
@@ -142,6 +173,7 @@ use `update-snapshot` / `check-snapshot` instead.
142
173
143
174
`shecc` comes with a comprehensive test suite (200+ test cases). To run the tests:
144
175
```shell
176
+
# Add 'LINK_MODE=dynamic' if using the dynamic linking mode.
145
177
$ make check # Run all tests (stage 0 and stage 2)
0 commit comments