I am working on a project and i want to compile valgrind using uClibc.
Can anyone suggest me something about how to proceed?
I am using fedora and i386 platform. the target platform is also i386 at the moment later on would work on MIPS.
thanks
Valgrind does not support the MIPS instruction set, so unless you put some significant effort to port Valgrind on MIPS, it is not possible to use Valgrind on this architecture.
we can use toolchain provided by buildroot. Just install it and cross compile the valgind .
Related
I would like to assemble Aarch64 armv8 Assembly on my mac and eventually run it with qemu and maybe on a real device like a raspberry pi 2 or 4 later on. I don't know how to assemble the code I'm going to write, gcc, llvm-gcc and clang don't seem to support the -arch=armv8 flag or anything similar. So I can't build for the targeted architecture, how could I achieve this?
I'm running mac os 10.14.5. I wouldn't mind finding a solution that works on a recent ubuntu version either since I have a VM for linux development.
The clang version that ships with Xcode supports -arch arm64. (Or armv7 for 32bit.)
Note that if you want to use any libraries though, they'll have to be arm64 as well. If you want, you can invoke the iOS toolchain with xcrun -sdk iphoneos clang -arch arm64 [...], but then you'll also have to pull the libraries you want off of some IPSW and stuff them into qemu.
Also note that the above will give you a Mach-O binary. For your Raspberry Pi, you'll probably want an ELF, and you'll probably want gcc rather than clang. You should be able to build both gcc and GNU binutils from source with --target as either aarch64-linux-gnu or aarch64-none-elf, depending on your goals. Yet another note: since macOS silently aliases gcc to clang and many tools depend on that, you'll probably also want to build this toolchain with something like --program-prefix=aarch64-.
I need to debug a multi-threaded program which keeps throwing horrible segmentation faults, and I chose Valgrind to do so. The problem, though, is that the code is cross-compiled and run in an ARMv5 machine. I tried to build Valgrind for that architecture, but configure failed because that version is not supported:
$ CC=arm-linux-gnueabi-gcc ./configure --prefix=/opt/valgrind \
--host=armv5-none-linux-gnueabi --target=arm-none-linux-gnueabi \
--build=i386-ubuntu-linux
(...)
checking for a supported CPU... no (armv5)
configure: error: Unsupported host architecture. Sorry
Is there a way to solve this issue? Could it be somehow possible to compile for ARMv7 (which I read is fully supported), and use it in my platform? I found this question, but it was asked two years ago and the answer points to a patch for older versions of Valgrind.
If you get to compile valgrind for an ARMv5 instruction set CPU you cannot run it since valgrind only runs on ARMv7 CPUs.
Valgrind cross compilation for ARMv5tel
ARM support seems to be added since "Release 3.6.0 (21 October 2010)":
http://valgrind.org/docs/manual/dist.news.html
But it has to run on an ARMv7 CPU even if it supports older instruction sets.
I compiled valgrind for an ARMv5 and it does not run, it throws "Illegal instruction".
https://community.nxp.com/message/863066?commentID=863066#comment-863066
In configure file change "armv7*" to "arm", then your compilation will success.
I am following this tutorial on operating system development for the raspberry pi.
http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html
I am using a Mac, so it suggests using the Yagarto packages for assembling the code. However, they do not seem to work. I installed it multiple times to check.
I want to know if there is an alternative assembler for Mac and how to use it to create the .img file to use as the kernel for the pi.
You can use Xcode for that - if you install xcode, the "iPhone SDK" compiler is really a cross compiler for i386, x86_64 and - ARM.
${whereever_you_put_xcode}/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/as -arch armv6
will do the trick: specifically, it will execute
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/../libexec/as/arm/as
I know that to compile to assembly, I should use the -Soption with gcc or g++, but how do I get MIPS assembly?
I tried
g++ -march=mips2 dll.c
but that gives the error
dll.c:1:0: error: bad value (mips2) for -march= switch
I saw a suggestion of the compile command mips_gcc, but I can't find how to install that compiler.
I'm using Ubuntu 64-bit, if that helps.
You need a version of gcc that is built as a MIPS cross compiler. You can download the free Mentor/Codesourcery MIPS gnu/gcc cross compilation tool chain from here. This toolchain is available for both Windows and Linux.
After downloading, installing and adding the tool chain to your path you would say:
mips-linux-gnu-g++ -march=mips32r2 -S dll.c
to compile your code to MIPS32R2 assembly.
UPDATE 8/2017:
It looks like Sourcery CodeBench free cross compiler for MIPS is no longer available at Mentor's site.
Try the free toolchain at Imagination's site.
Is it possible to use the stock (non-apple) version of g++ on Mac OSX 10.7? I want to be able to use the stock g++ without running a virtual linux box on my mac. The reason I want to do this is because apple's version of g++ doesn't warn you when there are unused variables and etc. I'm doing some assessed C++ problems in my numerical methods course and I want to make sure I'm not making any mistakes.
It was suggested I make a symbolic link to a linux version of g++ for compiling the code for the assessments. How do I go about doing that?
Thanks
A linux version of the compiler will not work on what is (essentially) a bsd port.
Are you sure that the current version of g++ cannot warn on the conditions you expect?
Finally, if #2 is true, there is nothing stopping you from getting another version of g++ (compiled for MacOSX) that doesn't have this issue.
A binary for g++ for Linux won't run on MacOSX.
You could compile GCC from its source code; use the latest release i.e. 4.6.2. But that requires some work. Be sure to follow the installation instructions, in particular care about dependencies (like PPL & Cloog) and configure (appropriately) and compile in a build tree outside of the source tree.