binutils

How to set 2 byte wchar_t output?

血红的双手。 提交于 2019-12-07 09:20:58
问题 The GCC uses a 4-byte wchar_t by default. I can set the option -fshort-wchar to get 2 bytes per wchar_t in the L"string constants" . But when I set the compiler option to my source file I get the famous warning message foo.o uses 2-byte wchar_t yet the output is to use 4-byte wchar_t ; use of wchar_t values across objects may fail Since I really want 2-byte wchar_t I also want the output to use this variant. Is there any linker option to tell it what I want? Edit This warning doesn't inhibit

gnu ld/gdb: separate debug files. How to produce the debug file when there's too much debug info to link?

一世执手 提交于 2019-12-07 08:22:15
问题 There's now gdb and binutils support for separating debug info from the binaries to be debugged. Docs describing this can be found in: gdb: separate debug files objcopy --add-gnu-debuglink, --only-keep-debug ld --build-id After a bit of experimenting, I'm able to get gdb (7.6) to find the debug info using either the build-id and debug-link methods. Here's two gdb fragments that show the debugger finding the debug info in the non-standard locations, using the build-id and debug-link methods

Generating link-time error for deprecated functions

孤者浪人 提交于 2019-12-07 03:32:30
问题 Is there a way with gcc and GNU binutils to mark some functions such that they will generate an error at link-time if used? My situation is that I have some library functions which I am not removing for the sake of compatibility with existing binaries, but I want to ensure that no newly-compiled binary tries to make use of the functions. I can't just use compile-time gcc attributes because the offending code is ignoring my headers and detecting the presence of the functions with a configure

Building a two-part firmware image using GCC toolchain

依然范特西╮ 提交于 2019-12-07 03:08:00
问题 I have some firmware built with GCC that runs on an ARM Cortex M0 based microcontroller. The build currently generates a single binary image that can be written into the program memory of the microcontroller. For reasons to do with field update, I need to split this image into two parts that can be updated separately. I'll call these Core and App . Core : contains the interrupt vector table, main() routine, and various drivers and library routines. It will be located in the first half of the

Is there a way to unhide hidden-visibility symbols with GNU binutils?

江枫思渺然 提交于 2019-12-06 16:54:58
I'm working on a script to make uClibc usable on an existing glibc-targetted gcc/binutils toolchain, and the one problem I'm left with is that pthread_cancel needs to dlopen libgcc_s.so.1 . The version supplied with the host gcc is linked to depend on glibc, so I'm instead using ld 's -u option to pull in the needed symbols (and their dependencies) from libgcc_eh.a to make a replacement libgcc_s.so.1 : gcc -specs uclibc.specs -Wl,-u,_Unwind_Resume -Wl,-u,__gcc_personality_v0 \ -Wl,-u,_Unwind_ForcedUnwind -Wl,-u,_Unwind_GetCFA -shared -o libgcc_s.so.1 In principle I would be done, but all the

android NDK: objcopy --rename-sym does not work (need to rename a function in a .so file)

自古美人都是妖i 提交于 2019-12-06 12:41:28
问题 I cannot get objcopy --rename-sym working. In a new Android project, I have created the directory jni and the file stub.c: #include <jni.h> #include "dlog.h" jint JNI_OnLoad(JavaVM* vm, void* reserved) { DLOG("~~~~~~~~~~~~~~~~~~~~~~~ JNI_OnLoad ~~~~~~~~~~~~~~~~~~~~~~~~~"); return JNI_VERSION_1_6; } int myfunc() { return 0; } the command ~/an/ndk-build -j 4 says: [armeabi-v7a] Install : libTest.so => libs/armeabi-v7a/libTest.so [armeabi] Install : libTest.so => libs/armeabi/libTest.so [x86]

How to decide the base address for the location counter “.” when VMA and LMA are different?

三世轮回 提交于 2019-12-06 06:21:32
According to the ld manual on the special symbol . , i.e.the Location Counter . Note: . actually refers to the byte offset from the start of the current containing object. Normally this is the SECTIONS statement, whose start address is 0, hence . can be used as an absolute address. If . is used inside a section description however, it refers to the byte offset from the start of that section, not an absolute address. Thus in a script like this: SECTIONS { . = 0x100 .text: { *(.text) . = 0x200 } . = 0x500 .data: { *(.data) . += 0x600 } } The '.text' section will be assigned a starting address of

objdump and ARM vs Thumb

三世轮回 提交于 2019-12-05 22:30:21
问题 I'm trying to disassemble an object built for ARM with gcc. Unfortunately, objdump is trying to guess whether the code is ARM and Thumb, and is getting it wrong: it thinks my code is Thumb when it's actually ARM. I see that objdump has an option to force it to interpret all instructions as Thumb ( -Mforce-thumb ), but it doesn't have one to force ARM mode! This seems like a really weird omission to me, and it's seriously hampering my ability to get work done (I'm on an embedded device and my

gnu ld/gdb: separate debug files. How to produce the debug file when there's too much debug info to link?

*爱你&永不变心* 提交于 2019-12-05 18:12:59
There's now gdb and binutils support for separating debug info from the binaries to be debugged. Docs describing this can be found in: gdb: separate debug files objcopy --add-gnu-debuglink, --only-keep-debug ld --build-id After a bit of experimenting, I'm able to get gdb (7.6) to find the debug info using either the build-id and debug-link methods. Here's two gdb fragments that show the debugger finding the debug info in the non-standard locations, using the build-id and debug-link methods respectively: (gdb) set debug-file-directory . (gdb) file uWithBuildId Reading symbols from /home/peeterj

How to set 2 byte wchar_t output?

。_饼干妹妹 提交于 2019-12-05 15:55:24
The GCC uses a 4-byte wchar_t by default. I can set the option -fshort-wchar to get 2 bytes per wchar_t in the L"string constants" . But when I set the compiler option to my source file I get the famous warning message foo.o uses 2-byte wchar_t yet the output is to use 4-byte wchar_t ; use of wchar_t values across objects may fail Since I really want 2-byte wchar_t I also want the output to use this variant. Is there any linker option to tell it what I want? Edit This warning doesn't inhibit the linker to produce a valid output. But the dozens of false warnings cover other messages. In