elf

Symbol visibility, exceptions, runtime error

风格不统一 提交于 2019-12-03 04:59:01
问题 I try to understand symbol visibility better. The GCC Wiki (http://gcc.gnu.org/wiki/Visibility) has a section about "Problems with C++ exceptions". According to GCC Wiki it is possible the have runtime error because of not exported exceptions. Runtime errors without compile time error/warning is quite dangerous so I tried to understand the problem better. I made some experiments but I still can't reproduce it. Any ideas how to reproduce the problem? The Wiki mentions three library using each

How can I get the architecture of a '.a' file?

安稳与你 提交于 2019-12-03 04:52:16
问题 I have a .a file from which I want to get architecture information. Running file myFile.a results in file.a: current ar archive . How can I get more information on what architecture the file contains? 回答1: You can also skip the ar command and use readelf, via something like: readelf -h <archive>.a | grep 'Class\|File\|Machine' [00:32:15] /usr/lib $ readelf -h libxslt.a | grep 'Class\|File\|Machine' File: libxslt.a(attrvt.o) Class: ELF32 Machine: Intel 80386 File: libxslt.a(xslt.o) Class:

readelf vs. objdump: why are both needed

两盒软妹~` 提交于 2019-12-03 04:14:01
问题 I need to learn about the ELF file layout for a project I am working on and I noticed the existence of these tools. Why do all Linux distributions include both readelf and objdump? Do these tools complement one another? When would i prefer to use one over another? 回答1: from binutils/readelf.c: /* The difference between readelf and objdump: Both programs are capabale of displaying the contents of ELF format files, so why does the binutils project have two file dumpers ? The reason is that

In an ELF file, how does the address for _start get detemined?

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I've been reading the ELF specification and cannot figure out where the program entry point and _start address come from. It seems like they should have to be in a pretty consistent place, but I made a few trivial programs, and _start is always in a different place. Can anyone clarify? 回答1: The _start symbol may be defined in any object file. Normally it is generated automatically (it corresponds to main in C). You can generate it yourself, for instance in an assembler source file: . globl _start _start : // assembly here When the

wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have this strange exception saying wrong ELF class but the wrapper is set correctly. To read Belgiun ID card using this SDK from belgiun ID card issuers official site: http://eid.belgium.be/en/binaries/beid-sdk-3.5.3-ubuntu-9.10-i686-6193_tcm147-94066_tcm406-114986.tgz $ uname -a # Using NetBeans IDE 7.3 in Ubuntu 12.10 64-bit Linux sun-M14xR2 3.5.0-25-generic #39-Ubuntu SMP Mon Feb 25 18:26:58 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux $ java -version java version "1.7.0_15" OpenJDK Runtime Environment (IcedTea7 2.3.7) (7u15-2.3.7-0ubuntu1

a.out replaced by ELF file format?

最后都变了- 提交于 2019-12-03 02:29:16
I have a few questions: Why was a.out replaced by ELF ? What were the major flaws in the a.out format that led to the raise of ELF file format? Earlier core dumps were based on a.out, but now they are based on ELF. What are the various advantages provided by ELF? The a.out format forced shared libraries to occupy a fixed place in memory. If you wanted to distribute an a.out shared library, you had to register its address space. This was good for performance but it didn't scale at all. See for yourself how tricky it was (linuxjournal). By contrast, in ELF, shared libraries can be loaded

How to compile glibc 32bit on an x86_64 machine

匿名 (未验证) 提交于 2019-12-03 02:00:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to compile glibc (as a secondary, not a system replacement) 2.6 on an x86_64, and trying to get it to produce 32-bit objects. When I give it a standard configure, it compiles fine, producing the usual 64-bit library objects. Some info: $ uname -a Linux localhost.localdomain 2.6.18-164.11.1.el5 #1 SMP Wed Jan 20 07:32:21 \ EST 2010 x86_64 x86_64 x86_64 GNU/Linux $ cat /etc/redhat-release CentOS release 5.4 (Final) Among other things, I've tried the following: Attempt 1: $ # [in build/glibc-2.6] $ ../../src/glibc-2.6/configure -

which part of ELF file must be loaded into the memory?

匿名 (未验证) 提交于 2019-12-03 01:58:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: An ELF file for executables has a program (segment) header and a section header, which can be seen through readelf -a , here is an example: The two pictures above are section header and program (segment) header, respectively. It can be seen that a segment header is composed of several section headers, which is used for loading program into the memory. Is it only necessary for .text, .rodata, .data, .bss sections to be loaded into the memory? Are all of the other sections in the segment (e.g. .ctors, .dtors .jcr in the 3rd segment)

linking arbitrary data using GCC ARM toolchain

匿名 (未验证) 提交于 2019-12-03 01:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to link in raw binary data. I'd like to either put it at a particular address, or have it link to a symbol (char* mydata, for instance) I have defined in code. Since it's not an obj file, I can't simply link it in. A similar post ( Include binary file with GNU ld linker script ) suggests using objcopy with the -B bfdarch option. objcopy responds with "archictecture bfdarch unknown". Yet another answer suggests transforming the object into a custom LD script and then include that from the main LD script. At this point, I may as well

Possibility of loading/executing ELF files on OSX

匿名 (未验证) 提交于 2019-12-03 01:49:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm just curious as to the possibility of loading and executing elf files on OSX. I know the standard executable format is MACHO, but NASM is unable to generate debug information for MACHO objects (and I am required to use NASM). I imagine its a long shot, but I don't suppose I can use ELF files. I can build them with NASM, but I can't seem to even link them with LD. 回答1: The author of the best OS X internals book has some code showing how you'd write a kernel extension to handle another executable file format here . He gives two