nm

Building libcurl with static linking to openssl

依然范特西╮ 提交于 2021-01-01 07:32:21
问题 I am trying to build libcurl with static linking to openssl. So to achieve that, I have used following configuration: OpenSSL: LDFLAGS="-static” LIBS="-ldl” cURL: LDFLAGS="-static” CPPFLAGS="-I$(CURDIR)/$(3RDPARTY_DIR)$(OPENSSL)/include LDFLAGS="-L$(CURDIR)/$(3RDPARTY_DIR)$(OPENSSL)" ./configure --disable-shared --without-zlib --without-libidn --without-librtmp --disable-ldap —-with-ssl=<path where my openssl is installed> With this, I am to generate libcurl.a and link it to my code where I

How to redirect llvm::outs() to file?

╄→尐↘猪︶ㄣ 提交于 2020-12-30 05:58:25
问题 I'm using some LLVM tools (like llvm-nm ) as static libraries. I.e. i copied source llvm-nm.cpp, renamed main(..) to llvm_nm(..) and compiled it as static library. I'd like to forward standard output to my file. I've tried to use the next approach: int out_fd, err_fd; fpos_t out_pos, err_pos; // redirect out fflush(stdout); fgetpos(stdout, &out_pos); out_fd = dup(fileno(stdout)); freopen(outFilename, "w", stdout); // execute int ret = llvm_nm(argc_, argv_); // restore output fflush(stdout);

Force definition of symbol for a C++ template instance in a library

ぐ巨炮叔叔 提交于 2020-05-23 14:50:06
问题 I'd like to provide a library that provides template code. But I would also like to keep the most possible the ownership of this code (generated code) when I can guess the usage of different usual types of my template. Here is an example of what I am trying to do: lib1.h #include <iostream> template<int N> void print_me() { std::cout << "I am function number " << N << std::endl; } lib1.cpp #include "lib1.h" /* Force symbols to be defined here. */ template void print_me<0>(); template void

What does '_GLOBAL__sub_I_' mean in nm output?

雨燕双飞 提交于 2020-05-12 11:16:29
问题 While I was trying to resolve a problem in static linking, I encounter a couple of _GLOBAL__sub_I_ prefixes in front of symbol names. It appears in that form although I used nm --demangle(-C) . I stumbled upon this answer (How to find global static initializations). Looking at my source code, it indeed looks like initialization of a global static variable. What I'm wondering is, where can I more information on __sub_ and other mangled names, like __cxxabiv1 ? 回答1: To prevent link rot i will

Symbol lookup error at runtime even though nm reports symbol present

守給你的承諾、 提交于 2020-01-07 06:34:53
问题 I build my program like this: g++ -std=c++11 myprog.cpp -o myprog -lqpid-proton-cpp Then I run ./myprog and get this error: symbol lookup error: ./myprog: undefined symbol: _ZN6proton10event_loop6injectESt8functionIFvvEE Yet, nm reports the symbol is present in the library . . . nm -D /usr/lib/libqpid-proton-cpp.so | grep _ZN6proton10event_loop6injectESt8functionIFvvEE . . . yields: 000000000002f460 T _ZN6proton10event_loop6injectESt8functionIFvvEE What am I missing here? 回答1: Did you verify,

nm symbol both “U” and “T”, what does that mean?

孤人 提交于 2019-12-24 17:03:55
问题 I am having an undefined symbol error at runtime, and when I look for the symbol in the relevant library, I get the result: nm -C -D /home/farmer/anaconda3/envs/general/lib/python3.6/site-packages/pyscannerbit/libScannerBitCAPI.so | grep empty_ U YAML::detail::node_data::empty_scalar[abi:cxx11] 00000000002b5860 T YAML::detail::node_data::empty_scalar[abi:cxx11]() But how is that possible? The symbol is both undefined, and also in the library? What? Or are these actually different symbols?

what does the $ld$add$os10.4$ prefix mean when I use nm to look at a symbol list on a Mac?

╄→尐↘猪︶ㄣ 提交于 2019-12-22 20:09:08
问题 I'm having some problems with my iPhone app not linking for the iPhone Simulator. It tells me there are undefined symbols: Undefined symbols for architecture i386: ".objc_class_name_NSRunLoop", referenced from: pointer-to-literal-objc-class-name in SampleBrowser.cpp.o ".objc_class_name_NSDate", referenced from: pointer-to-literal-objc-class-name in SampleBrowser.cpp.o ".objc_class_name_NSAutoreleasePool", referenced from: pointer-to-literal-objc-class-name in SampleBrowser.cpp.o pointer-to

Can't find .dtors and .ctors in binary

喜夏-厌秋 提交于 2019-12-21 17:53:40
问题 I am reading the book Hacking, the art of exploitation. In the book there is a section that explain the use of .dtors and .ctors . I'm trying to reproduce one of the exercises of the book but in my executable I do not have this sections. At first I thought the problem was that I was compiling for 64-bit, but now I'm compiling for 32-bit and .dtors and .ctors are still not appearing in the section table. Here is the code: #include <stdio.h> #include <stdlib.h> static void miConstructor(void) _

How can I get the symbol name in struct “Elf64_Rela”

北城以北 提交于 2019-12-13 12:34:11
问题 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/mman.h> #include <errno.h> #include <fcntl.h> #include <elf.h> Elf64_Rela *retab; Elf64_Rela *retab_end; Elf64_Ehdr *ehdr; Elf64_Shdr *shdr; char *strtab; void elf_open(char *filename) { int fd = open(filename, O_RDONLY); struct stat sbuf; fstat(fd, &sbuf); void *maddr = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, fd, 0); close(fd); ehdr = maddr; shdr =

Offset in nm symbol value?

风流意气都作罢 提交于 2019-12-12 08:43:05
问题 Just to give you some context, here's what I'm trying to achieve: I am embedding a const char* in a shared object file in order to have a version string in the .so file itself. I am doing data analysis and this string enables me to let the data know which version of the software produced it. This all works fine. The issue I am having is when I try to read the string out of the .so library directly. I tried to use nm libSMPselection.so | grep _version_info and get 000000000003d968 D _