binutils

How to extract only the raw contents of an ELF section?

你离开我真会死。 提交于 2019-11-27 07:27:13
I've tried the following, but the resulting file is still an ELF and not purely the section content. $ objcopy --only-section=<name> <infile> <outfile> I just want the contents of the section. Is there any utility that can do this? Any ideas? Rather inelegant hack around objdump and dd : IN_F=/bin/echo OUT_F=./tmp1.bin SECTION=.text objdump -h $IN_F | grep $SECTION | awk '{print "dd if='$IN_F' of='$OUT_F' bs=1 count=$[0x" $3 "] skip=$[0x" $6 "]"}' | bash The objdump -h produces predictable output which contains section offset in the elf file. I made the awk to generate a dd command for the

Script/Tool predicate for ARM ELF compiled for Thumb OR Arm

一个人想着一个人 提交于 2019-11-27 07:22:53
问题 I have rootfs and klibc file systems. I am creating make rules and some developers have an older compiler without inter-networking. note1 I am trying to verify that all the files get built with arm only when a certain version of the compiler is detected. I have re-built the tree's several times. I was using readelf -A and looking for Tag_THUMB_ISA_use: Thumb-1 , but this seem to be in arm only code (but was built with the interworking compiler) as well as thumb code. I can manually run

Weird MIPS assembler behavior with jump (and link) instruction

家住魔仙堡 提交于 2019-11-27 06:53:34
问题 So, we're studying MIPS architecture at school and we're implementing a MIPS32 architecture. I thought I'd use GNU cross-binutils as assembler but I'm getting weird output when dealing with instructions jal, j and jr. The assembler seems to insert the instructions at the wrong places. I have no idea why this happens, and I doubt the MIPS assembler would be that broken, so I assume this is supposed to happen. Here is my dummy assembly file: .section .text .globl __start __start: addi $a0, $0,

Requirements to use flto

蹲街弑〆低调 提交于 2019-11-27 06:49:52
问题 If I want to compile my project with -flto is it enough to have built gcc with --enable-gold or do I also need to build gold and replace ld with it? And do I need any other flags? Ie I'm doing this gcc -flto one.c two.c 回答1: According to https://gcc.gnu.org/wiki/LinkTimeOptimization#Requirements, Despite the " link time " name, LTO does not need to use any special linker features. The basic mechanism needed is the detection of GIMPLE sections inside object files. This is currently implemented

How to use/install GNU binutils (objdump)

孤者浪人 提交于 2019-11-27 03:51:16
问题 I need to use the objdump and readelf commands in my application that runs on windows. I know I can install cygwin in order to use them. The reason why I don't want to use cygwin is because I want to make it essay to deploy. Plus I don't know how to make a silent install of cygwin. As a result I believe that what I need is GNU Utilities For Win32 as the link states those libraries are serverless. "executables do only depend on the Microsoft C-runtime (msvcrt.dll) and not an emulation layer

Does the order of -l and -L options in the GNU linker matter?

偶尔善良 提交于 2019-11-26 23:13:29
问题 The -l option tells the linker to search the libraries in the standard dirs. And with -L , we can specify our own library directories for searching. Question: Does the sequence of order matters for the -L option too, like it does for the -l w.r.t the linker? This link: http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html doesn't say much about the sequence of -L . EDIT Also, Directories specified on the command line are searched before the default directories is from the man page (as pointed

How to install gnu ld on mac os x 10.6?

喜欢而已 提交于 2019-11-26 17:48:17
问题 I'm having a lot of trouble compiling the otherwise excellent Contiki OS on my macbook pro (with mac os x 10.6). Contiki actually uses a lot of GNU-specific features and options of GCC, AR, LD, and so on. So I installed those utilities via macports, but it looks like "port install binutils" does not install GNU ld, does it ? So, the question is, how do I get GNU ld on my mac ? Is there a simple alternative to the hard-way (i.e. the wget, configure, make, make install way) ? 回答1: As far as I

How to extract only the raw contents of an ELF section?

廉价感情. 提交于 2019-11-26 13:09:59
问题 I've tried the following, but the resulting file is still an ELF and not purely the section content. $ objcopy --only-section=<name> <infile> <outfile> I just want the contents of the section. Is there any utility that can do this? Any ideas? 回答1: Rather inelegant hack around objdump and dd : IN_F=/bin/echo OUT_F=./tmp1.bin SECTION=.text objdump -h $IN_F | grep $SECTION | awk '{print "dd if='$IN_F' of='$OUT_F' bs=1 count=$[0x" $3 "] skip=$[0x" $6 "]"}' | bash The objdump -h produces