elf

Using clang++, -fvisibility=hidden, and typeinfo, and type-erasure

妖精的绣舞 提交于 2019-12-18 11:25:58
问题 This is a scaled down version of a problem I am facing with clang++ on Mac OS X. This was seriously edited to better reflect the genuine problem (the first attempt to describe the issue was not exhibiting the problem). The failure I have this big piece of software in C++ with a large set of symbols in the object files, so I'm using -fvisibility=hidden to keep my symbol tables small. It is well known that in such a case one must pay extra attention to the vtables, and I suppose I face this

Is there a downside to using -Bsymbolic-functions?

狂风中的少年 提交于 2019-12-18 10:52:52
问题 I recently discovered the linker option "-Bsymbolic-functions" in GNU ld: -Bsymbolic When creating a shared library, bind references to global symbols to the definition within the shared library, if any. Normally, it is possible for a program linked against a shared library to override the definition within the shared library. This option is only meaningful on ELF platforms which support shared libraries. -Bsymbolic-functions When creating a shared library, bind references to global function

arm gcc toolchain as arm-elf or arm-none-eabi, what is the difference?

99封情书 提交于 2019-12-18 10:01:41
问题 When you build a gcc toolchain there is the possibility to build it as arm-elf or as arm-none-eabi, but what is the difference? I use the eabi today, but that is just since everyone else seem to do that... but since that is a really bad argument, it would be really nice to understand the difference. Note: This toolchain will crosscompile code for Cortex-M3 based mcu:s like the stm32. Thanks Some links : EABI: http://en.wikipedia.org/wiki/Application_binary_interface http://infocenter.arm.com

How to create a statically linked position independent executable ELF in Linux?

坚强是说给别人听的谎言 提交于 2019-12-18 08:58:40
问题 I have a working position independent Linux freestanding x86_64 hello world: main.S .text .global _start _start: asm_main_after_prologue: /* Write */ mov $1, %rax /* syscall number */ mov $1, %rdi /* stdout */ lea msg(%rip), %rsi /* buffer */ mov $len, %rdx /* len */ syscall /* Exit */ mov $60, %rax /* syscall number */ mov $0, %rdi /* exit status */ syscall msg: .ascii "hello\n" len = . - msg which I can assemble and run with: as -o main.o main.S ld -o main.out main.o ./main.out Since it is

Why is the entry point address in my executable 0x8048330? (0x330 being the offset of .text section)

久未见 提交于 2019-12-18 03:06:12
问题 I wrote a small program to add two integers and on using readelf -a executable_name it showed the entry point address in elf header as: Entry point address: 0x8048330 How does my executable know this address beforehand even before loader loads it in memory? elf_format.pdf says this member gives the virtual address to which the system first transfers control, thus starting the process. Can anyone please explain what is the meaning of this statement and what is the meaning of virtual address

Why does objdump not show .bss, .shstratab, .symtab and .strtab sections?

自闭症网瘾萝莉.ら 提交于 2019-12-18 02:39:07
问题 I'm currently doing my own objdump implementation in C. For my -s option, I have to show the full contents of the section of an ELF file. I'm doing it well, but i'm showing more sections than the "real" objdump. In fact, it does not output the .bss, .shstrtab, .symtab and .strtab sections. I'm looking around the sh_flags value on the Shdr struct but I can't find any logic... Why objdump -s does not shows these sections ? 回答1: Why objdump -s does not shows these sections ? Objdump is based on

How can I find which ELF dependency is not fulfilled?

為{幸葍}努か 提交于 2019-12-17 20:17:20
问题 I've built a test ELF program using the LSB SDK ( note that my question is not specific to LSB ): $ /opt/lsb/bin/lsbcc tst.c $ ls -l a.out -rwxr-xr-x 1 math math 10791 2009-10-13 20:13 a.out $ file a.out a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped But I am unable to launch it ( yes, I assure you the file is in the directory... ): $ ./a.out bash: ./a.out: No such file or directory $ uname -a Linux math 2

.bss vs COMMON: what goes where?

情到浓时终转凉″ 提交于 2019-12-17 16:32:30
问题 From my book: .bss: Uninitialized global C variables COMMON: Uninitalized data objects that are not yet allocated I have to say, I don't quite see a clear distinction. I don't even quite understand what an uninitizalied, non-allocated data object is...seems like nothing. I've used GNU's readelf tool to try to take a look at some simple C code, but can't find a single COMMON symbol. I've read things like FORTRAN's COMMON type is an example of a COMMON symbol - but I don't know FORTRAN Can

bcrypt invalid elf header when running node app

a 夏天 提交于 2019-12-17 15:43:11
问题 I'm working on a nodejs project for school. I wasn't able to install bcrypt with npm so i installed bcrypt-nodejs and the project worked fine yesterday. But today, when I do a "node app" i have this error : /.../node_modules/bcrypt/node_modules/bindings/bindings.js:79 throw e ^ Error: /.../node_modules/bcrypt/build/Release/bcrypt_lib.node: invalid ELF header at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js

Pack shared libraries into the elf

╄→гoц情女王★ 提交于 2019-12-17 08:53:52
问题 Is there a utility that can take ALL the SO's that an Elf needs turn them into static then converts the Elf to be SO's free? 回答1: Here are some projects you might find useful: Statifier (basically does what you want) ERESI (might do what you want, also allows for analysis of ELF targets) NOTE: I've not used either application myself. 回答2: Statifier is an option. Another option is Ermine. While Ermine is commercial it behaves better than statifier on systems with memory randomization. 回答3: I