elf

What is the difference between .got and .got.plt section?

吃可爱长大的小学妹 提交于 2019-12-02 23:30:08
What is the difference between .got and .got.plt section in ELF format? My previous comment turns to be right, the example below makes things a bit clear. These are the relocations for my 32 bits i686-linux /lib/libm.so Relocation section '.rel.dyn' at offset 0x32b8 contains 8 entries: Offset Info Type Sym.Value Sym. Name 00025030 00000008 R_386_RELATIVE 00024fd8 00005706 R_386_GLOB_DAT 00025034 _LIB_VERSION 00024fdc 00000406 R_386_GLOB_DAT 00000000 __gmon_start__ 00024fe0 00000506 R_386_GLOB_DAT 00000000 _Jv_RegisterClasses 00024fe4 00000806 R_386_GLOB_DAT 00000000 _rtld_global_ro 00024fe8

Clarification on Binary file (PE/COFF & ELF) formats & terminology

拜拜、爱过 提交于 2019-12-02 23:22:17
I'm confusing little in terminology. A file that is given as input to the linker is called Object File . The linker produces an Image file , which in turn is used as input by the loader. I got this from "MS PE & COFF Specification" Q1. Image file is also referred to as Binary Image , Binary File or just Binary . Right? Q2. So, according to the above stated terminology, the PE/ELF/COFF are the formats of Image File & not the Object File. right? But http://www.sco.com/developers/gabi/latest/ch4.intro.html says This chapter describes the object file format, called ELF (Executable and Linking

C++ exceptions and the .eh_frame ELF section

戏子无情 提交于 2019-12-02 22:27:51
问题 Is it that the absence or damage of the .eh_frame ELF section is the cause of exceptions in my C++ code stopped working? Any exception that previously was caught successfully is now calling std::terminate(). My situation: My zzz.so shared library has try-catch blocks: try { throw Exc(); } catch (const Exc &e) { LOG("ok " << e.what()); } catch (...) { LOG("all"); } An executable which loads the zzz.so (using ldopen). It call a function in the zzz.so All the exceptions thrown in the zzz.so are

How to run ELF binary file on cygwin

筅森魡賤 提交于 2019-12-02 22:26:03
问题 I'm new to cygwin but I am having a bit of a trouble. I have Linux ELF compiled binary file, and is there a way to lunch it under cygwin a simple way, like windows binary for example .\a.exe 回答1: from https://www.cygwin.com/ Cygwin is not: a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows. If you want to run a ELF binary you need a VM with Linux inside 来源: https://stackoverflow.com/questions/40785187/how-to-run-elf-binary

What is the difference between executable and relocatable in elf format?

谁说我不能喝 提交于 2019-12-02 22:00:56
What is the difference between executable file in elf format and relocatable file in elf format? As it can be seen in the image below, relocatable ELF goes as the input to the linker, whereas the executable ELF is the product of the linker. zixcool as you know every compiled executable file is a binary file with address relative and absolute, so relocatable format is a format in which function and other symbols still have there names definition in other word functions and variables are not bound to any specific address. Instead, the addresses are still symbols look : unix > gcc -c main.c unix

Incorrect function size inside ARM ELF object

守給你的承諾、 提交于 2019-12-02 21:48:03
问题 readelf output of the object file: Symbol table '.symtab' contains 15 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 FILE LOCAL DEFAULT ABS fp16.c 2: 00000000 0 SECTION LOCAL DEFAULT 1 3: 00000000 0 SECTION LOCAL DEFAULT 3 4: 00000000 0 SECTION LOCAL DEFAULT 4 5: 00000000 0 NOTYPE LOCAL DEFAULT 1 $t 6: 00000001 194 FUNC LOCAL DEFAULT 1 __gnu_f2h_internal 7: 00000010 0 NOTYPE LOCAL DEFAULT 5 $d 8: 00000000 0 SECTION LOCAL DEFAULT 5 9:

Linux user-space ELF loader

时光怂恿深爱的人放手 提交于 2019-12-02 20:58:14
I need to do a rather unusual thing: manually execute an elf executable. I.e. load all sections into right places, query main() and call it (and cleanup then). Executable will be statically linked, so there will be no need to link libraries. I also control base address, so no worries about possible conflicts. So, is there are any libraries for that? I found OSKit and its liboskit_exec, but project seems to be dead since 2002. I'm OK with taking parts of projects (respecting licenses, of course) and tailoring them to my need, but as I'm quite a noob in the linux world, I dont even know where to

Lab_1:练习一——理解通过make生成执行文件的过程

吃可爱长大的小学妹 提交于 2019-12-02 19:46:17
参考网站: https://www.cnblogs.com/chaunceyctx/p/7188779.html https://cloud.tencent.com/developer/article/1415004 https://www.runoob.com/linux/linux-comm-dd.html 练习1:理解通过make生成执行文件的过程。(要求在报告中写出对下述问题的回答) 列出本实验各练习中对应的OS原理的知识点,并说明本实验中的实现部分如何对应和体现了原理中的基本概念和关键知识点。 在此练习中,大家需要通过静态分析代码来了解: 操作系统镜像文件ucore.img是如何一步一步生成的?(需要比较详细地解释Makefile中每一条相关命令和命令参数的含义,以及说明命令导致的结果) 一个被系统认为是符合规范的硬盘主引导扇区的特征是什么 一、操作步骤 1、进入/moocos/ucore_lab/labcodes_answer/lab1_result目录 cd ./moocos/ucore_lab/labcodes_answer/lab1_result 2、 执行 make qemu Ctrl+C 退出 3、 make clean 清除上次的 make 命令所产生的 object 文件(后缀为“ .o ”的文件)及可执行文件 4、查看Makefile cat

Forcing certain compiler-generated variables into specific ELF sections (with gcc)

痴心易碎 提交于 2019-12-02 19:34:29
I'll start with the ultimate question: In C with gcc, is it possible to get the value(s) of __func__ (or equivalently, __FUNCTION__ ) stored in a section other than .rodata (or wherever -mrodata= points) or subsection thereof? The full explanation: Say I have a logging macro: #define LOG(fmt, ...) log_internal(__FILE__, __LINE__, __func__, fmt, ##__VA_ARGS__) (The string concatenation operator ## used in that unary context consumes the preceding comma if and only if the __VA_ARGS__ list is empty, thereby allowing use of a format string with or without arguments.) I can then use the macro

dumping C structure sizes from ELF object file

删除回忆录丶 提交于 2019-12-02 19:32:57
How can you extract the sizes of all C structures from an ELF object file with debugging symbols? Individual struct sizes can be obtained from GDB using "print sizeof(some_struct)", but what I need is to get a listing of all structures. I've looked at "nm" and "objdump", but I don't see options to do what I'm looking for. Is there a way to do this with standard Unix tools, or do I need to extract the debug symbol section from the ELF file and process it myself? I'm hoping it's not the latter. Thanks in advance for any advice. Ray pahole shows this and other details about structs. Its git repo