gnu-toolchain

Declaring abstract class (pure virtual method) increase binary size substantially

陌路散爱 提交于 2019-11-29 20:41:43
问题 Here is the story: I am developing C++ software for ARM Cortex-M0 processor in Linux with AC6 Toolpack. Before I was using Keil (in windows) (who has their own toolchain) and I have migrated to GNU-toolchain ((GNU Tools for ARM Embedded Processors) 5.2.1) . First thing i have realized is; binary file size increased substantially. I have tested every compiler optimizations (except link time optimization, it gives an error in inline assembly, not part of question but may be related to answer).

Why does gcc not implicitly supply the -fPIC flag when compiling static libraries on x86_64

核能气质少年 提交于 2019-11-29 19:05:00
I've had numerous problems compiling shared objects that link statically against static libraries. This problem only shows up on x84_64 platforms. When doing the same compilation work on x86_32 I do not have any problems. Perhaps this is a OS specific GCC configuration thing, but my research indicates that its how GCC works on x86_64 platforms. Anyhow, I am using gcc 4.4.3 on Ubuntu 10.04 x86_64. How is the problem fixed ?... Making sure all the static library dependencies are compiled with -fPIC. Question 1: What is the difference between -fpic and -fPIC (apparently -fPIC generates more

How do I link a library file in GCC that does not start with lib?

白昼怎懂夜的黑 提交于 2019-11-29 12:58:34
问题 When I link a library such as libm in with ld, I need to drop the lib prefix. What if the file does not follow this naming convention? Is there a way to link it other than renaming the file? 回答1: You can link against any library, e.g. foo.a , by specifying full path to it on the link line: gcc main.o /path/to/foo.a What you lose with non-standard library name is the ability for the linker to search for it, e.g. this will not work: gcc main.o -L/path/to foo.a You can avoid that lack of search

How to cross compile from Mac OS X to Linux x86?

那年仲夏 提交于 2019-11-27 19:51:58
I'm running Mac OS X 10.5.8 and want to compile for target CentOS 5.3 with GCC 4.1.2. How could I: Compile GCC 4.1.2 toolchain and related tools? Use that tool to cross compile for target CentOS 5.3? Any help is greatly appreciated! Your simplest solution is to just run CentOS 5.3 in a VM (e.g. Sun VirtualBox ). This requires minimal setup, has quite reasonable overhead (assuming an Intel Mac), and you'll be able to actually test and debug what you are building. If you really insist on cross-compiling, you must build a cross-compiler. Instructions are here and here , but beware: it will likely

How to cross compile from Mac OS X to Linux x86?

旧城冷巷雨未停 提交于 2019-11-26 19:53:31
问题 I'm running Mac OS X 10.5.8 and want to compile for target CentOS 5.3 with GCC 4.1.2. How could I: Compile GCC 4.1.2 toolchain and related tools? Use that tool to cross compile for target CentOS 5.3? Any help is greatly appreciated! 回答1: Your simplest solution is to just run CentOS 5.3 in a VM (e.g. Sun VirtualBox). This requires minimal setup, has quite reasonable overhead (assuming an Intel Mac), and you'll be able to actually test and debug what you are building. If you really insist on