mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-13 09:40:32 +08:00
Revert "generate object file from Ruby code directly"
This reverts commit ebc11886ef.
This commit is contained in:
@@ -123,8 +123,8 @@ module Motion; module Project;
|
||||
kernel = File.join(datadir, platform, "kernel-#{arch}.bc")
|
||||
raise "Can't locate kernel file" unless File.exist?(kernel)
|
||||
|
||||
# Object
|
||||
arch_obj = File.join(files_build_dir, "#{path}.#{arch}.o")
|
||||
# Assembly.
|
||||
asm = File.join(files_build_dir, "#{path}.#{arch}.s")
|
||||
arm64 = false
|
||||
compiler_exec_arch = case arch
|
||||
when /^arm/
|
||||
@@ -132,8 +132,10 @@ module Motion; module Project;
|
||||
else
|
||||
arch
|
||||
end
|
||||
sh "/usr/bin/env VM_PLATFORM=\"#{platform}\" VM_KERNEL_PATH=\"#{kernel}\" VM_OPT_LEVEL=\"#{config.opt_level}\" /usr/bin/arch -arch #{compiler_exec_arch} #{ruby} #{rubyc_bs_flags} --emit-llvm \"#{arch_obj}\" #{init_func} \"#{path}\""
|
||||
sh "/usr/bin/env VM_PLATFORM=\"#{platform}\" VM_KERNEL_PATH=\"#{kernel}\" VM_OPT_LEVEL=\"#{config.opt_level}\" /usr/bin/arch -arch #{compiler_exec_arch} #{ruby} #{rubyc_bs_flags} --emit-llvm \"#{asm}\" #{init_func} \"#{path}\""
|
||||
|
||||
# Object
|
||||
arch_obj = File.join(files_build_dir, "#{path}.#{arch}.o")
|
||||
if arm64
|
||||
# At the time of this writing Apple hasn't yet contributed the source code of the LLVM backend for the "arm64" architecture, so the RubyMotion compiler can't emit proper assembly yet. We work around this limitation by generating bitcode instead and giving it to the linker. Ugly but should be temporary (right?).
|
||||
@dummy_object_file ||= begin
|
||||
@@ -144,9 +146,12 @@ module Motion; module Project;
|
||||
obj_path
|
||||
end
|
||||
ld_path = File.join(App.config.xcode_dir, 'Toolchains/XcodeDefault.xctoolchain/usr/bin/ld')
|
||||
sh "#{ld_path} \"#{arch_obj}\" \"#{@dummy_object_file}\" -arch arm64 -r -o \"#{arch_obj}\""
|
||||
sh "#{ld_path} \"#{asm}\" \"#{@dummy_object_file}\" -arch arm64 -r -o \"#{arch_obj}\""
|
||||
else
|
||||
sh "#{cc} -fexceptions -c -arch #{arch} \"#{asm}\" -o \"#{arch_obj}\""
|
||||
end
|
||||
|
||||
[asm].each { |x| File.unlink(x) } unless ENV['keep_temps']
|
||||
arch_objs << arch_obj
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user