binutils

Building a two-part firmware image using GCC toolchain

梦想与她 提交于 2019-12-05 07:21:39
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 program memory. App : contains application-specific code. It will be located in the second half of the

Generating link-time error for deprecated functions

£可爱£侵袭症+ 提交于 2019-12-05 06:05:49
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 script and prototyping them itself. My goal is to generate a link-time error for the bad configure

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

天大地大妈咪最大 提交于 2019-12-04 18:23:48
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] Install : libTest.so => libs/x86/libTest.so [mips] Install : libTest.so => libs/mips/libTest.so (There

Injecting sections into GNU ld script; script compatibility between versions of binutils.

烈酒焚心 提交于 2019-12-04 18:07:31
问题 I'm building something like in the question How to collect data from different .a files into one array? How to keep sections in .a files with ld script?, i.e. arrays composed during link-time out of elements from different object files. In my case, there are several arrays, each one going into its own section, .ld_comp_array_*, where * matches the name of the array. Then I take the default linker script using ld --verbose and modify it by putting all these sections (sorted, so that elements

How to filter a lot of data with IPC::Open2?

你说的曾经没有我的故事 提交于 2019-12-04 18:06:41
My task is to filter some data from perl script with external utility (the addr2line). The data size is quite large. I need to print a lot of data to stdin of program and read a lot of data back (from stdout of program into my script). Now I do this with IPC::Open2 , but I don't mix reading and writing. Is this legal? Will Open2 buffer any size of data in pipe? My code: my $cmd="addr2line -e $prog_name "; use IPC::Open2; local (*Reader, *Writer); my $pid = open2(\*Reader, \*Writer, $cmd); for(@requests) { # this array is HUGE, 100s of thousands of entries print Writer "$_\n"; } close Writer;

Unresolvable `R_X86_64_NONE` relocation

泪湿孤枕 提交于 2019-12-04 11:03:51
问题 I'm using Devtoolset-7 on CentOS 7 and have built Boost 1.65.1 w/ it. But when I link my application, I've got the following: /opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: /opt/rh/devtoolset-7/root/usr/lib64/libboost_unit_test_framework.a(compiler_log_formatter.o)(.text._ZN5boost9unit_test5utils11string_castINS0_13basic_cstringIKcEEEESsRKT_[_ZN5boost9unit_test5utils11string_castINS0_13basic_cstringIKcEEEESsRKT_]+0x3c): unresolvable R_X86_64_NONE relocation against symbol

How to build GCC 4.8.x on Mac OS X host for MIPS target

无人久伴 提交于 2019-12-04 03:48:47
I am trying to build GCC / binutils for a MIPS target platform on a Mac OS X host running (10.9) x86_64. I have downloaded the latest version of binutils and GCC to my knowledge, and I have also installed GCC 4.8.2 via homebrew. However, so far I have been unsuccessful in building GCC / binutils for MIPS arch on a OS X host. I tried setting the CC environment variable to point to the gcc version installed via homebrew, but that doesn't seem to fix the problem. Has anyone created a step by step guide for this procedure? ipatch So I was able to get GCC built on OS X for a target architecture of

objdump and ARM vs Thumb

允我心安 提交于 2019-12-04 03:17:50
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 only means of debugging is to look at the disassembly). I've tried various approaches, including trying

Dynamic loading of shared objects using dlopen()

扶醉桌前 提交于 2019-12-03 21:04:06
问题 I'm working on a plain X11 app. By default, my app only requires libX11.so and the standard gcc C and math libs. The App can extend features with Xfixes, Xrender and ALSA sound system. However, these (Xfixes, Xrender and ALSA) feature are optional. To achieve this behavior, I am using run time loading i.e., libXfixes, libXrender and libasound shall be dlopen()ed. Hence the App can function in absence of such libraries. Now my question: What library names should I use when calling dlopen()? I

How to compile an assembly file to a raw binary (like DOS .com) format with GNU assembler (as)? [duplicate]

你。 提交于 2019-12-03 15:30:49
This question already has an answer here: How to generate plain binaries like nasm -f bin with the GNU GAS assembler? 2 answers I want to compile this source code in Windows (It just an example): start: NOP NOP When I compile it with NASM or FASM, output file length is 2 bytes. But when I compile it with GNU assembler (as) the output file length is 292 bytes! How to compile an assembly file to a raw binary (like DOS .com) format with GNU assembler (as)? Why I do this? I want to write my own simple OS, I write my codes with C (without using any C standard libraries even stdio.h or math.h) and