Wilfred / bfc

An industrial-grade brainfuck compiler
https://bfc.wilfred.me.uk
GNU General Public License v2.0
508 stars 30 forks source link

Linker fails #25

Closed WonderJ13 closed 5 years ago

WonderJ13 commented 6 years ago

I'm running the integration tests, and the linker fails for each file. Here's the message I'm getting.

/usr/bin/ld: /tmp/.tmpjUJ2R4: relocation R_X86_64_32 against symbol 'known_outputs' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: final link failed: nonrepresentable section on output clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)

I hope this is enough information. I don't know if I can fix this myself.

zesterer commented 6 years ago

I have a similar problem. Is there any solution available yet? I assume that I need to involve lld rather than ld, although bfc doesn't seem to provide a way to do that.

bitwave commented 5 years ago
--- a/src/llvm.rs
+++ b/src/llvm.rs
@@ -845,7 +845,7 @@ impl TargetMachine {
                                         cpu.as_ptr() as *const _,
                                         features.as_ptr() as *const _,
                                         LLVMCodeGenOptLevel::LLVMCodeGenLevelAggressive,
-                                        LLVMRelocMode::LLVMRelocDefault,
+                                        LLVMRelocMode::LLVMRelocPIC,
                                         LLVMCodeModel::LLVMCodeModelDefault);
         }

should fix this

Wilfred commented 5 years ago

Sorry for the delay on this, and thanks @bitwave for the pointer as to what needed fixing! This should be correct now :)