linker

Linker error in AIX - Need explanation about the error “The csect is part of the .text section, and relocation entries”

允我心安 提交于 2021-01-29 02:13:50
问题 I get the following error from the linker 'ld' during linking. ld: 0711-302 ERROR: Object SomeLibrary.a[SomeObject.o], csect <.text> The csect is part of the .text section, and relocation entries from the csect have been written to the .loader section. ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. What does this error mean? (BTW I am using GCC for AIX) 来源: https://stackoverflow.com/questions/55058344/linker-error-in-aix-need-explanation-about-the-error-the

Linker error in AIX - Need explanation about the error “The csect is part of the .text section, and relocation entries”

匆匆过客 提交于 2021-01-29 02:11:25
问题 I get the following error from the linker 'ld' during linking. ld: 0711-302 ERROR: Object SomeLibrary.a[SomeObject.o], csect <.text> The csect is part of the .text section, and relocation entries from the csect have been written to the .loader section. ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. What does this error mean? (BTW I am using GCC for AIX) 来源: https://stackoverflow.com/questions/55058344/linker-error-in-aix-need-explanation-about-the-error-the

Understanding linker script NOLOAD sections in embedded software

耗尽温柔 提交于 2021-01-28 20:01:01
问题 According to the GNU documentation for ld , a NOLOAD section works as following: The `(NOLOAD)' directive will mark a section to not be loaded at run time. The linker will process the section normally, but will mark it so that a program loader will not load it into memory. Now, regarding to the program loader , accordign to wikipedia: Embedded systems typically do not have loaders, and instead, the code executes directly from ROM. In order to load the operating system itself, as part of

Convert qmake into CMake

会有一股神秘感。 提交于 2021-01-28 11:37:07
问题 I am new to CMake, but I used to use qmake. In my qmake, I have the following for adding a static library that is inside a folder called bin, inside the project folder: QT -= gui QT += core CONFIG += c++11 console CONFIG -= app_bundle DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \ main.cpp macx: LIBS += -L$$PWD/bin/lib/ -lnanomsg INCLUDEPATH += $$PWD/bin/include DEPENDPATH += $$PWD/bin/include macx: PRE_TARGETDEPS += $$PWD/bin/lib/libnanomsg.a What is the corresponding CMake syntax? I tried

Override GCC linker symbols in c code using weak declaration

瘦欲@ 提交于 2021-01-28 09:02:26
问题 I am building an elf target. I have a linker script where I input some of the symbol locations like(these symbols are defined in a different locations like ROM whose address is provided below), A = 0x12345678; B = 0x1234567c; D = 0x1234568c; In the C code I can use these variables A and B without declaring them which is expected. I want to know if I can override the symbol D i.e., My current executable can have its own declaration of D. In that case the linker should ignore D. Is there a way

Define new code section in assembly code to compile ELF binary

 ̄綄美尐妖づ 提交于 2021-01-28 08:06:41
问题 I defined a new code section in my assembly program, which is going to be compiled into 32-bit ELF binary, on x86. I use the linker scripts to assign a specified address for this new code section, it works. However, I noticed that this new section does not be loaded to the memory, after some debugging! I use readelf and figure out that there is no "execution" privilege of this new section: [15] .trampoline PROGBITS 080483d0 004020 000117 00 0 0 16 Then I did this: objcopy --set-section-flags

Can't find JNI_OnLoad_libname in example program

可紊 提交于 2021-01-28 06:23:31
问题 How exactly do I call native static libraries from Java? I'm using Java 8. It looks to me like I should be able to define a JNI_OnLoad_library in a C++ program with an embedded JVM but my VM keeps dying when I call System.loadLibrary. The following only prints "Hello from main". main.cpp: #include <jni.h> #include <iostream> extern "C" { JNIEXPORT jint JNI_OnLoad_hello(JavaVM *vm, void *reserved) { std::cout << "Hello World" << std::endl; return JNI_VERSION_1_8; } } int main(int argc, char**

How to circumvent dlopen() caching?

…衆ロ難τιáo~ 提交于 2021-01-28 06:08:27
问题 According to its man page, dlopen() will not load the same library twice: If the same shared object is loaded again with dlopen(), the same object handle is returned. The dynamic linker maintains reference counts for object handles, so a dynamically loaded shared object is not deallocated until dlclose() has been called on it as many times as dlopen() has succeeded on it. Any initialization returns (see below) are called just once. However, a subsequent dlopen() call that loads the same

qmake to Cmake transition: syntax for external librairies

亡梦爱人 提交于 2021-01-28 06:08:21
问题 For a specific project I am moving out of qmake and now have to use cmake. My path are the following: Source : ~/Projects/Project External static library (OSVR in this instance) paths : ~/osvr/lib/ , ~/osvr/include/osvr /osvr/include/jsoncpp Using qmake, the linking part to that library used to be: INCLUDEPATH += /usr/include LIBS += -L$$PWD/../../osvr/lib/ -losvrClientKit -losvrClient -losvrCommon -losvrUtil -ljsoncpp INCLUDEPATH += $$PWD/../../osvr/include/ INCLUDEPATH += $$PWD/../..

undefined reference when including a header file

帅比萌擦擦* 提交于 2021-01-28 05:17:07
问题 I get an error when I include a header file, but not if I include the source file instead. The function is defined in the source file like this: /* in User.c */ struct User { const char* name; }; struct User* addedUser(const char* name) { struct User* user = malloc(sizeof(struct User)); user->name = name; return user; } And used like this: /* in main.c */ int test_addedUser() { char* newName = "Fooface"; struct User* newUser = addedUser(newName); assert(!strcmp(newName, newUser->name));