binutils

Is there an advantage to upgrade Binutils from 2.16.1 to 2.19? Why?

In the PSPSDK (Homebrew) we are using the Binutils 2.16.1 to assemble and link the code for the PlayStation Portable, however that release is getting quite outdated (3 versions have superseded it). The community and me have been updating the GCC and newlib to the latest stable versions and everything seems to work with the old binutils. ...

Is it possible to use MIPS register names with GAS (GNU assembler)?

If I use register names I get: Error: illegal operands `add $t0,$zero,$zero' If I use register number ($8 instead of $t0 and $0 instead of $zero) it works. (I'm using binutils 2.17). ...

Trying to no-op an instruction

Is it possible using GNU tools (gcc, binutils, etc) to modify all occurrences of an assembly instruction into a no-op? Specifically, gcc with the -pg option generates the following assembly (ARM): 0x0: e1a0c00d mov ip, sp 0x4: e92dd800 stmdb sp!, {fp, ip, lr, pc} 0x8: e24cb004 sub fp, ip, #4 ; 0x4 0xc: ebfffffe bl 0 <mco...

Help with linker failer: .gnu.linkonce.t...

I'm having trouble linking a shared library using gcc 3.2.3 with binutils 2.18. When I try to link the library I get the following error: .gnu.linkonce.t_... referenced in section .rodata: defined in discarded section .gnu.linkonce.t... I've done a fair amount of googling on this and most places seem to indicate it is a regression intr...

How to install gnu ld on mac os x 10.6 ?

Hi, 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, th...

Recipe for compiling binutils & gcc together?

Greetings, According the the gcc build instructions you can build binutils concurrently with building gcc (as well as gmp,mpc,etc). Here's what that page says : If you also intend to build binutils (either to upgrade an existing installation or for use in place of the corresponding tools of your OS), unpack the binutils di...

solaris elfedit: Is there something similar for linux ? (a shared library editor)?

Linux: It there a way to edit a compiled shared library ? specifically I am searching on how to add the DT_SYMBOLIC flag on an already compiled binary shared library? Here is why I am asking this: our application is composed of our own libraries (static libXXX.a) some 3rd party libs (binary-only shared libraries libYYY.so) Every...

ELF shared library: relocation offset out of bounds

There is a software package elfutils which includes a program called eu-elflint for checking ELF binaries (just as lint for C - hence the name). Just for curiosity I have checked our own shared libraries with this tool and it found a lot of issues, e.g.: eu-elflint libUtils.so section [ 2] '.dynsym': _DYNAMIC symbol size 0 does not ma...

How do you get the initialized value of a global variable out of an object file?

If you have an object file, how do you get the initialized value of a global variable in that object file's data segment? For example, say I've done the following: # I'm interested in the variable foo inside bar.o in libbar.a: $ ar -x libbar.a bar.o $ nm --print-size bar.o | grep foo 00000048 00000004 D foo This tells me that foo is ...

How to reverse the objdump's strip with only-keep-debug?

Hello In modern linux almost all objects are stripped and splitted in two parts. One - is executable itself and second is debug symbols, stripped out from original ELF. Such files are created with objcopy --only-keep-debug original.elf binary.dbg mv original.elf binary objcopy --strip-debug binary How can I merge binary and binary.d...

How to get information from objdump

I encounter a problem when reading information dumped out from an executable file in linux. The information is as follows: 804a0ea: 04 08 add $0x8, %al ... 804a0f4: a6 cmpsb %es:(%edi),%ds:(%esi) I have two questions: what does the address 804a0ea and 804a0f4 mean? the virtual address in the process's...

Given an ELF binary built from C++ with gcc, how can I determine the sizeof some type in it?

Is there some way using binutils tools to get this? For example: // x.cc typedef long long MyInt; int main(int argc, char* argv[]) { // blah blah blah } Then: g++ -g x.cc -o a.out How can I analyze a.out to get sizeof(MyInt)? GDB can do it, but I don't want to use GDB because it's really slow for large binaries. ...

How to deal with recursive dependencies between static libraries using the binutils linker?

I'm porting an existing system from Windows to Linux. The build is structured with multiple static libraries. I ran into a linking error where a symbol (defined in libA) could not be found in an object from libB. The linker line looked like g++ test_obj.o -lA -lB -o test The problem of course being that by the time the linker finds it ...

C compiler cannot create executables when trying to build Binutils

I am trying to build Linux From Scratch, and now I am at chapter 5.4, which tells me how to build Binutils. I have binutils 2.20's source code, but when I try to build it: time { ./binutils-2.20/configure --target=$LFS_TGT --prefix=/tools --disable-nls --disable-werror ; } it gives me an error: checking build system type... i686-pc-l...

Adding MEMORY specifications to a GNU linker script causes segfault

I obtained a generic linker script using "ld --verbose test.o" and simply added a memory section. From what I understand this should work fine, but no matter how I setup the memory section the resulting program never functions properly. (ld generated linker script can be found here). tl;dr; How do you use MEMORY{...} correctly in GNU ...

How can adding a function call cause other symbols to become undefined when linking?

Hey Guys, I'm hoping someone will be able to help troubleshoot what I think is a linker script issue. I'm encountering a strange problem after adding a call to a new function. Without the function call, my object files link correctly, however, with the new function call added, I get an undefined reference to a symbol from another object...

readelf-like tool for Mac OS X?

Is there a tool for reading Mac OS X binaries that would print information about relocation tables and symbol offsets similar to this readelf output? readelf -r app Relocation section '.rel.dyn' at offset 0x5ec contains 2 entries: Offset Info Type Sym.Value Sym. Name 08049d58 00001706 R_386_GLOB_DAT 00000000 _...

Getting a full path from addr2line

Hi, I'm trying to automate some debugging tasks. In certain cases, I print the value of $ra [this is a MIPS machine] and parts of the stack as hex addresses. During debugging, I use addr2line to convert them into file:line pairs. I'd like to automate this procedure. The problem is that addr2line returns a filename that equivelent to t...

objdump ELF and Windows

Hello, I am fairly new to this subject, that is ELF and any Linux related stuff. I am trying to write an ELF file and would prefer to do it on WinXP. My question is, can this be done with MS Visual Studio including the compilation? As far as my understanding goes, ELF files can not be compiled on Windows OSs. Well, at least that's wha...

An objcopy equivalent for Mac / iPhone?

Hello, I would like to rename symbols inside object files (.o) with something that would be the Mac equivalent of binutils' objcopy --redefine-syms tool. I found no arm-apple-darwin10-objcopy. I tried the MacPorts' arm-elf-binutils port and also tried to play a bit with otool and segedit without much success. Any idea please? ...