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
Copy file name to clipboardexpand all lines: Readme.md
+46-1
Original file line number
Diff line number
Diff line change
@@ -91,6 +91,9 @@ $ CHANNEL="release" $CG_GCCJIT_DIR/cargo.sh run
91
91
92
92
If you compiled cg_gccjit in debug mode (aka you didn't pass `--release` to `./test.sh`) you should use `CHANNEL="debug"` instead or omit `CHANNEL="release"` completely.
93
93
94
+
To use LTO, you need to set the variable `FAT_LTO=1` and `EMBED_LTO_BITCODE=1` in addition to setting `lto = "fat"` in the `Cargo.toml`.
95
+
Don't set `FAT_LTO` when compiling the sysroot, though: only set `EMBED_LTO_BITCODE=1`.
96
+
94
97
### Rustc
95
98
96
99
> You should prefer using the Cargo method.
@@ -191,6 +194,48 @@ set substitute-path /usr/src/debug/gcc /path/to/gcc-repo/gcc
191
194
192
195
TODO(antoyo): but that's not what I remember I was doing.
193
196
197
+
### `failed to build archive` error
198
+
199
+
When you get this error:
200
+
201
+
```
202
+
error: failed to build archive: failed to open object file: No such file or directory (os error 2)
203
+
```
204
+
205
+
That can be caused by the fact that you try to compile with `lto = "fat"`, but you didn't compile the sysroot with LTO.
206
+
(Not sure if that's the reason since I cannot reproduce anymore. Maybe it happened when forgetting setting `FAT_LTO`.)
207
+
208
+
### How to debug GCC LTO
209
+
210
+
Run do the command with `-v -save-temps` and then extract the `lto1` line from the output and run that under the debugger.
# Take the command from the output and add --emit=llvm-ir
229
+
```
230
+
231
+
### To prevent the linker from unmangling symbols
232
+
233
+
Run with:
234
+
235
+
```
236
+
COLLECT_NO_DEMANGLE=1
237
+
```
238
+
194
239
### How to use a custom-build rustc
195
240
196
241
* Build the stage2 compiler (`rustup toolchain link debug-current build/x86_64-unknown-linux-gnu/stage2`).
@@ -253,4 +298,4 @@ generate it in [gimple.md](./doc/gimple.md).
253
298
* Set `linker='-Clinker=m68k-linux-gcc'`.
254
299
* Set the path to the cross-compiling libgccjit in `gcc_path`.
255
300
* Comment the line: `context.add_command_line_option("-masm=intel");` in src/base.rs.
256
-
* (might not be necessary) Disable the compilation of libstd.so (and possibly libcore.so?).
301
+
* (might not be necessary) Disable the compilation of libstd.so (and possibly libcore.so?): Remove dylib from build_sysroot/sysroot_src/library/std/Cargo.toml.
0 commit comments