linker-flags

How to add linker option to CMake bootstrap?

落爺英雄遲暮 提交于 2019-12-13 05:50:04
问题 I'm building CMake 3.12.4 from the release tarball on AIX. CMake is failing to link on the machine: ld: 0711-781 ERROR: TOC overflow. TOC size: 65632 Maximum size: 65536 The error is detailed in the IBM technotes at ld: 0711-781 ERROR: TOC overflow. I want to add -bbigtoc linker option for the cmake recipe. CMake's bootstrap does not appear to accept linker options for LDFLAGS as shown below. How do I add a linker flag to the bootstrap process? Here are the options CMake bootstrap accepts: $

How to wrap functions with the `--wrap` option correctly?

倾然丶 夕夏残阳落幕 提交于 2019-12-10 19:20:46
问题 The man page of gcc 6.3 says: --wrap=symbol Use a wrapper function for symbol. Any undefined reference to symbol will be resolved to "__wrap_symbol". Any undefined reference to "__real_symbol" will be resolved to symbol. ... If you link other code with this file using --wrap malloc, then all calls to "malloc" will call the function "__wrap_malloc" instead. The call to "__real_malloc" in "__wrap_malloc" will call the real "malloc" function. So I created a simple example: #include <stdio.h> int

Appending to CMAKE_C_FLAGS

白昼怎懂夜的黑 提交于 2019-12-06 19:39:09
问题 I'm using CMake for a project that comes in two versions, one of which requires -lglapi and the other does not. So far the lines we used look like that: SET(CMAKE_C_FLAGS "-O3 -xSSE3 -restrict -lpthread -lX11 -ldrm") SET(CMAKE_CXX_FLAGS "-O3 -xSSE3 -restrict -lpthread -lX11 -ldrm") I added an if statement in my CMakeList.txt exactly after those lines: if(SINGLE_MODE) SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} " -lglapi") SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} " -lglapi") endif(SINGLE_MODE) The SINGLE

Appending to CMAKE_C_FLAGS

为君一笑 提交于 2019-12-05 01:03:46
I'm using CMake for a project that comes in two versions, one of which requires -lglapi and the other does not. So far the lines we used look like that: SET(CMAKE_C_FLAGS "-O3 -xSSE3 -restrict -lpthread -lX11 -ldrm") SET(CMAKE_CXX_FLAGS "-O3 -xSSE3 -restrict -lpthread -lX11 -ldrm") I added an if statement in my CMakeList.txt exactly after those lines: if(SINGLE_MODE) SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} " -lglapi") SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} " -lglapi") endif(SINGLE_MODE) The SINGLE_MODE variable is defined a little up. When I use the message command to display the content of the

How to allow -z multidefs with g++47

牧云@^-^@ 提交于 2019-12-04 20:05:49
How can I tell the linker of g++ to allow multiple definitions of symbols (choose the first appearance)? -z multidefs Allows multiple symbol definitions. By default, multiple symbol definitions occurring between relocatable objects (.o files) will result in a fatal error condition. This option suppresses the error condition and allows the first symbol definition to be taken. This option is valid only when the -b svr4 option is specified. The -zmuldefs option is not recognized by g++ , nor -z OPTION . What's the correct parameter? Is it possible? There is no such thing as the "linker of g++",

What are gcc linker map files used for?

ぐ巨炮叔叔 提交于 2019-12-04 08:33:01
问题 What are the ".map" files generated by gcc/g++ linker option "-Map" used for ? And how to read them ? 回答1: I recommend generating a map file and keeping a copy for any software you put into production. It can be useful for deciphering crash reports. Depending on the system, you likely can get a stack dump from the crash. The stack dump will include memory addresses and one of the registers will include the Instruction Pointer. That tells you the memory address code was executing at. On some

What are gcc linker map files used for?

让人想犯罪 __ 提交于 2019-12-03 01:07:53
What are the ".map" files generated by gcc/g++ linker option "-Map" used for ? And how to read them ? I recommend generating a map file and keeping a copy for any software you put into production. It can be useful for deciphering crash reports. Depending on the system, you likely can get a stack dump from the crash. The stack dump will include memory addresses and one of the registers will include the Instruction Pointer. That tells you the memory address code was executing at. On some systems, code addresses can be moved around (when loading dynamic libraries, hence, dynamic), but the lower

CMake AMRCC + custom linker

∥☆過路亽.° 提交于 2019-12-01 11:54:29
问题 I'm trying to use cmake in a project which is compiled using armcc , but use a custom proprietary linker (not armlink ). I've changed the variables in the toolchain.cmake file as following: unset (CMAKE_LINKER CACHE) set (CMAKE_LINKER "my_linker" CACHE STRING "" FORCE) unset (CMAKE_ARMCC_LINKER CACHE) set (CMAKE_ARMCC_LINKER "my_linker" CACHE STRING "" FORCE) unset (CMAKE_EXE_LINKER_FLAGS CACHE ) set (CMAKE_EXE_LINKER_FLAGS "-flag1 -flag2" CACHE STRING "" FORCE) unset (CMAKE_C_LINK_EXECUTABLE

what is the json-spirit linker flag for g++?

半世苍凉 提交于 2019-12-01 11:08:32
I can't find this anywhere. I've installed json-spirit on my ubuntu server with apt-get install json-spirit-dev . What linker flag has to be used with g++ to use json-spirit? The only library listed in that package is called libjson_spirit.a . You can link with it by adding -ljson_spirit to your linker step. 来源: https://stackoverflow.com/questions/17437893/what-is-the-json-spirit-linker-flag-for-g

Can you compile a shared object to prefer local symbols even if it's being loaded by a program compiled with -rdynamic?

落花浮王杯 提交于 2019-12-01 05:49:33
I am building a shared library in C that is dynamically loaded by a program that I do not have source access to. The target platform is a 64-bit Linux platform and we're using gcc to build. I was able to build a reproduction of the issue in ~100 lines, but it's still a bit to read. Hopefully it's illustrative. The core issue is I have two non-static functions ( bar and baz ) defined in my shared library. Both need to be non-static as we expect the caller to be able to dlsym them. Additionally, baz calls bar . The program that is using my library also has a function named bar , which wouldn't