I am trying to compile a RISC-V C code into hex or binary file. I found out that the GCC-GNU compiler might help me.
On the wiki page of gcc, underArchitectures, there is a list of available targets and there, we can find:
Additional processors have been supported by GCC versions maintained separately from the FSF version:
...,...,...RISC-V
Does this mean that is it not supported? That i have to install something else? If yes, what and how can i do that?
Thanks for any help.
Related
I cloned and built the RISC-V GNU toolchain. I built the Newlib version for RV32I architecture(--with-arch=rv32i). However, I also need to have the RV32IM architecture build. Problem is, if I build the compiler for RV32IM, and compile my RISC-V code for RV32I, the compiler emulates multiply/divide operations for the RV32I architecture but still uses mul instrucions. I think this happens because there are mul instructions in the libgcc.a file, because that's the architecture it was built for. This is why I desire to have two seperate builds, i.e. RV32I and RV32IM.
Is this possible? If so, how can I achieve this?
I guess a multilib version could be built. riscv-none-embed-gcc-xpack is such a multilib version without libgloss, but I haven't delved into the details of implementation. Hope it'll help.
I am working on a project that uses a GCC library (SFML), which is not available for clang, as far as I know. I am using COC with vim for code completions, but for C++ it needs clangd. Is there a way to use GCC as my compiler, but still use the clangd language server?
I have also heard that there may be a way to make clang recognize GCC libraries/headers, but I've never been able to make it work right. If somebody could point me in the right direction there that would be helpfull too. But I'm used to GCC (I've been using it since I started programming C++), so being able to use clangd and GCC would be preferable.
Yes it is. I do it with ccls (which is clang based as well).
Given my installation of clang is not the standard one (I compile it, tune it to use libc++ by default, and I install it somewhere in my personal space) I have to inject paths to header files known by clang but unknown by other clang based tools.
I obtain them with
clang++ -E -xc++ - -Wp,-v < /dev/null
Regarding the other options related to the current project, I make sure to have a compile_commands.json compilation database (generated by CMake, or bear if I have no other choice), and ccls can work from there. I expect clangd to be quite similar in these aspects.
Ops, answered the wrong question.
But for those who use ccls:
create a .ccls file in your project directory and append --gcc-toolchain=/usr to it.
use this tool to generate a compile_commands.json file
see https://github.com/MaskRay/ccls/wiki/FAQ#compiling-with-gcc
How I can to know what is a minimal version of glibc for gcc or binutils?
Regards.
binutils doesn't generally have a minimal glibc requirement because it doesn't have too much glibc-specific details in it. it's merely a collection of low level tools like an assembler and linker and objdumper all of which are built on code included in binutils.
gcc is a different beast -- it needs to know intimate details about C library capabilities. in the specific version of gcc you have, consult the INSTALL/index.html file (and particularly, the Prerequisites page) for the requirements.
I am trying to make changes to the openMP runtime library (GOMP). As far as I know, the library comes with GCC compiler but my goal is to work on GOMP alone. So I wonder how I can build and develop GOMP separately from GCC. Any help would be highly appreciated. Thank you!
Building libgomp separately of GCC is not supported upstream. It can be done (you'd need to figure out some "lengthy" configure command lines, and so on), so you're mostly on your own if attempting that. But: why wouldn't you just build libgomp in its standard GCC build environment?
I want to write an own c/c++ IDE with syntax-check etc. And of course I need a compiler-functionality. For this I want to use gcc, I think it is a good option, isn't it? The IDE should not call a gcc-binary to compile, it should include the gcc source code, because after compiling the IDE I want a stay alone executable.
So my question: Is there sth like a tutorial or a good hint how to realize this?
btw it's for Mac, I'll write the IDE with XCode
Thank you!
Use LLVM's Clang and its libClang API, it's built for this purpose. GCC is not made to be used as a library.
You might develop a plugin for GCC, or a GCC MELT extension. But it could be that on MacOSX GCC plugins are not supported yet. You might also look into GCCSense which might fill some of your goals (but I never used it).