how to update objdump? got: unknown command line argument -M - macos

Working through Jon Erickson's book on Hacking. He uses an intel format assembly code. He provides the following snippet:
reader#hacking:~/booksrc 08048374 <main>:
$ objdump -M intel -D
a.out | grep -A20 main.
I'm getting this error:
Mac-of-Thor:test thorkamphefner$ objdump -M
objdump: Unknown command line argument '-M'. Try: '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump -help'
objdump: Did you mean '-C'?
What do I need to do to update objdump?

objdump on a Mac is llvm-objdump, not GNU Binutils objdump that takes command-line options like -Mintel
I think I've read that the standard ways of installing GNU binutils on Mac will give you gobjdump.
See Disassemble into x86_64 on OSX10.6 (But with _Intel_ Syntax)
objdump -disassemble -x86-asm-syntax=intel should work on a Mac (for llvm-objdump).

Related

Add DTB to u-boot uImage during Yocto build

I have a manual process for compiling a Linux kernel for an embedded ARM device. I use the CONFIG_APPENDED_DTB=y option, append my DTB file to the zImage file, then convert to uImage:
cat arch/arm/boot/zImage ./arch/arm/boot/dts/lpc3250-phy3250.dtb > arch/arm/boot/zImage-dtb
mkimage -A arm -O linux -C none -T kernel -a 0x80008000 -e 0x80008000 -n 'Linux' \
-d arch/arm/boot/zImage-dtb arch/arm/boot/uImage
I'm attempting to migrate to Yocto. How can I implement the same process? I can set KERNEL_IMAGETYPE = "zImage" but I'm not sure how to postprocess the zImage file.
Note that my version of u-boot is fixed and quite old, so I am not currently considering migrating to other formats such as FIT.
I am a newcomer to Yocto, so expository answers are especially welcome.

OpenCOBOL Static Linking Multiple .cob Files

I am trying to statically link two COBOL files together using GnuCobol (Windows 10) following the example listed here: https://open-cobol.sourceforge.io/historical/open-cobol/Static-Linking.html but cannot seem to get it to work.
I am running the following:
cobc -free -c InterpFunc.cob
cobc -free -c -fmain Integrator.cob
cobc -x -o .\\dist\\integrator Integrator.o InterpFunc.o
The '.o' files compile correctly, but the binary never builds with the following errors:
H:\Programs\COBAL\cobc\bin\cobc.exe: unrecognized option '-fmain'
h:/programs/cobal/cobc/bin/../lib/gcc/mingw32/6.3.0/../../../libmingw32.a(main.o):(.text.startup+0xa0): undefined reference to `WinMain#16'
collect2.exe: error: ld returned 1 exit status
The terminal process terminated with exit code: 1
I have tried a few different things such as leaving out the '-fmain' or leaving out the '-x', but all seem to produce different errors.
Is this perhaps an issue with my compiler/system setup or am I misunderstanding how to statically link files?
I'm quite sure you do not use a compiler matching that old documentation (having "historical" in its URL). I'm quite sure it'll work the way the current manual says:
The easiest way of combining multiple files is to compile them into a single executable.
One way is to compile all the files in one command:
$ cobc -x -o prog main.cob subr1.cob subr2.cob
Another way is to compile each file with the option -c, and link them at the end. > The top-level program must be compiled with the option -x.
$ cobc -c subr1.cob
$ cobc -c subr2.cob
$ cobc -c -x main.cob
$ cobc -x -o prog main.o subr1.o subr2.o

/usr/bin/ld: cannot find -lglscblas

See the thing is, there is no such thing as a file to link to named glscblas because that's a typo.
Here's an example of the problem when Rstudio calls gcc:
install.packages('devtools')
gcc -std=gnu99 -shared -L/usr/lib/R/lib -L/usr/lib/x86_64-linux-gnu -lgsl -lglscblas -o openssl.so aes.o base64.o bignum.o cert.o compatibility.o diffie.o envelope.o error.o hash.o info.o keygen.o keys.o onload.o openssh.o password.o pem.o pkcs12.o pkcs7.o rand.o rsa.o signing.o ssl.o stream.o write.o -L/usr/lib/x86_64-linux-gnu -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lglscblas
Where could the filename typo be hiding, that is, what file holds the filename that feeds -l parameters to gcc when calling install.packages in Rstudio? Rstudio invokes gcc with some wrong linker parameter that's obviously a typo for gnu scientific library "gslcblas" -- notice the gls / gsl character ordering mixup. It's harming the build anytime I run the command install.packages when it depends on the gnu scientific library, which is a lot of packages. It's crippling my Rstudio system. Installing today's latest Rstudio did not fix it. I can't seem to find the file that has the typo. Can anyone help me find the file containing the typo? thank you so much for helping. The RStudio forums were unresponsive, so I'm here now.
Rstudio server, Ubuntu 16.04, gcc. Additionally:
ga#ga-HP-Z820:~/Downloads$ ld --verbose | grep SEARCH_DIR | tr -s ' ;' \\012
SEARCH_DIR("=/usr/local/lib/x86_64-linux-gnu")
SEARCH_DIR("=/lib/x86_64-linux-gnu")
SEARCH_DIR("=/usr/lib/x86_64-linux-gnu")
SEARCH_DIR("=/usr/local/lib64")
SEARCH_DIR("=/lib64")
SEARCH_DIR("=/usr/lib64")
SEARCH_DIR("=/usr/local/lib")
SEARCH_DIR("=/lib")
SEARCH_DIR("=/usr/lib")
SEARCH_DIR("=/usr/x86_64-linux-gnu/lib64")
SEARCH_DIR("=/usr/x86_64-linux-gnu/lib")
ga#ga-HP-Z820:~/Downloads$ gcc -print-search-dirs | sed '/^lib/b 1;d;:1;s,/[^/.][^/]*/\.\./,/,;t 1;s,:[^=]*=,:;,;s,;,; ,g' | tr \; \\012
libraries:
/usr/lib/nvidia-current/x86_64-linux-gnu/5/:/usr/lib/nvidia-current/x86_64-linux-gnu/:/usr/lib/lib/:./x86_64-linux-gnu/5/:./x86_64-linux-gnu/lib/:/usr/lib/nvidia-current/x86_64-linux-gnu/5/:/usr/lib/nvidia-current/x86_64-linux-gnu/:/usr/lib/lib/:./x86_64-linux-gnu/5/:./x86_64-linux-gnu/lib/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/x86_64-linux-gnu/lib/x86_64-linux-gnu/5/:/usr/x86_64-linux-gnu/lib/x86_64-linux-gnu/:/usr/x86_64-linux-gnu/lib/:/usr/lib/x86_64-linux-gnu/5/:/usr/lib/x86_64-linux-gnu/:/usr/lib/:/lib/x86_64-linux-gnu/5/:/lib/x86_64-linux-gnu/:/lib/:/usr/lib/x86_64-linux-gnu/5/:/usr/lib/x86_64-linux-gnu/:/usr/lib/:/usr/lib/nvidia-current/:./:/usr/lib/nvidia-current/:./:/usr/x86_64-linux-gnu/lib/:/usr/lib/:/lib/:/usr/lib/

linker option while building vmlinux

I am understanding how vmlinux will create with the help of link-vmlinux.sh script, I could see it is passing -p option to the linker while building vmlinux, but I couldn't see any option named -p when executed linker with --help.
#arm-linux-gnueabihf-ld -EL -p --no-undefined -X --build-id -o vmlinux
Can you please tel me what is the use of '-p' option in the above command.
I reckon it prints the program headers object file format uses also known as
segments.The program headers describe how the program should be loaded into memory. You can print them out by using the objdump program with the -p option.
Did you try arm-linux-gnueabihf-ld --help ?

Installing eclim on osx 10.8.5 fails - no acceptable grep found

Im trying to install eclim on OSX 10.8.5 and the installer fails because it does not like the grep I have installed.
[ANT][exec]configure: error: no acceptable grep could be found
[ANT][exec] checking for grep that handles long lines and -e...
My grep has -e
SYNOPSIS
grep [OPTIONS] PATTERN [FILE...]
grep [OPTIONS] [-e PATTERN | -f FILE] [FILE...]
What is going on here?
I ended up fixing this by using macports to install gcc grep. Apparently OSX now uses bsd grep by default and there are differences between the two that gcc was choking on. The part of this that a little ridiculous is that I installed gcc through XCode.

Resources