gnu

GCC从头到尾自制编译脚本

喜夏-厌秋 提交于 2020-01-01 00:50:04
目录 简介 预处理 编译 汇编 链接 分析链接过程 头文件路径 动态库路径 使用到的标准目标文件 使用到的动态库 获得gcc默认的链接脚本 MakeFile 参考资料 简介 本文的目的是深入理解gcc编译的过程,以及从编译到链接,做一个自己定制化的编译脚本。常用的 预处理 编译 汇编 链接 源文件只有一个 test.c 预处理 生成 test.i 文件 root@zhou 22:01:40 ~/r/p/Chapter1 # gcc -v -E test.c -o test.i Using built-in specs. COLLECT_GCC = gcc OFFLOAD_TARGET_NAMES = nvptx-none OFFLOAD_TARGET_DEFAULT = 1 Target: x86_64-linux-gnu Configured with: .. /src/configure -v --with-pkgversion = 'Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl = file:///usr/share/doc/gcc-7/README.Bugs --enable-languages = c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix = /usr --with-gcc

What exactly is the GNU tar ././@LongLink “trick”?

谁都会走 提交于 2019-12-31 12:50:02
问题 I read that a tar entry type of 'L' (76) is used by gnu tar and gnu-compliant tar utilities to indicate that the next entry in the archive has a "long" name. In this case the header block with the entry type of 'L' usually encodes the name ././@LongLink . My question is: where is the format of the next block described? The format of a tar archive is very simple: it is just a series of 512-byte blocks. In the normal case, each file in a tar archive is represented as a series of blocks. The

Writing a shell - how to execute commands

廉价感情. 提交于 2019-12-31 05:17:06
问题 I'm trying to write a shell that will eventually take advantage of concurrency. Right now I've got a working shell parser but I'm having trouble figuring out how to execute commands. I've looked a bit at exec ( execvp etc.) and it looks promising but I have some questions. Can exec handle file input/output redirection? Can I set up pipes using exec? I'm also wondering about subshells. What should subshells return; the exit status of its last statement? Can subshells be a part of a pipe? These

GNU readline and key bindings

折月煮酒 提交于 2019-12-31 01:43:27
问题 I've read from the GNU getline documentation that it's capable for binding some callback functions to some keys. I know already how to bind an action to the TAB key using rl_bind_key function. But how can I use it to bind some action to the following keys?: CTRL + TAB , ESC , PAUSE / BREAK 回答1: #include <stdio.h> #include <readline/readline.h> int my_cool_readline_func (int count, int key) { printf ("key pressed: %d\n", key); rl_on_new_line (); return 0; } int main(void) { rl_command_func_t

eclipse配置c开发环境

倖福魔咒の 提交于 2019-12-30 21:25:37
/*--> */ /*--> */ eclipse配置c开发环境 1. eclipse配置c开发环境 1.1. 缘起 1.2. cygwin 1.3. eclipse 1.4. 配置 1 eclipse配置c开发环境 1.1 缘起 公司同事需要开发c语言,想要配置一个开发环境,考虑使用eclipse+cygwin gcc开发,因 此帮着配置了开发环境。机器配置:win10,4G。 首先,Windows下用eclipse玩c用到一下三个东西: cygwin(Windows平台的unix模拟程序,包含了gcc和g++) eclipse 1.2 cygwin cygwin搜索官方网站下载安装程序,选择64位的,打开安装程序setup-x86_64.exe,然后选 install from internet,接着选择存放位置,打开翻_墙(不翻_墙下载会很慢),进入下载列 表,这个列表就是要求你下载什么程序的列表,请务必安装以下程序,务必安装: gcc-core,gcc-g++,make,gdb,binutils;可以参考: http://www.linuxidc.com/Linux/2011-06/37588.htm 。 将cygwin安装目录\bin加入到环境变量PATH中。好了,开个cmd命令行窗口,分别试一下gcc -v, make -v,gdb -v命令。 $ gcc -v

Under Linux, How C++ source code becomes executable files or static/dynamic libraries. And how a program get loaded into memory when it runs

南楼画角 提交于 2019-12-30 12:38:42
问题 I know that source code can be compiled and linked to shared/static library or ELF executable files. And when program runs, it loads into memory and creates a process image according to ELF format. But I am not sure how programs loading shared libraries. How a linker looking for symbols in extern libraries and how the .a archive works. What else should I know if program runs on 64 bit OS? I am trying to draw a whole picture of it. Can someone give a general talk about the whole thing and

What are good heuristics for inlining functions?

丶灬走出姿态 提交于 2019-12-30 09:15:49
问题 Considering that you're trying solely to optimize for speed, what are good heuristics for deciding whether to inline a function or not? Obviously code size should be important, but are there any other factors typically used when (say) gcc or icc is determining whether to inline a function call? Has there been any significant academic work in the area? 回答1: Wikipedia has a few paragraphs about this, with some links at the bottom: In addition to memory size and cache issues, another

Bumping version numbers for new releases in associated files (documentation)

情到浓时终转凉″ 提交于 2019-12-30 03:15:27
问题 I would be interested to in knowing how you out there handle the bumping the version number for new releases issue. How do you handle the version number in associated files like man pages, etc. The software is build with the gnu tool chain so autoconf, automake, etc are available and used for the version number of the application. So that information can be reused. git is used as a vcs. One possibility would be introduce an extra, new target in Makefile.am that does a sed/awk to replace

Stm32 学习笔记(2)Eclipse 开发环境搭建

早过忘川 提交于 2019-12-30 01:22:26
开发 Stm32 的标准环境应该是 MDK Keil,但是这玩意儿也有短板,一是商业软件、二是代码编辑功能不强(比记事本强点),所以,GCC撸起来。方案有两个,一是 VsCode + PlatformIo IDE,二是Eclipse + plugins。从发展来看大概、可能、应该是 VsCode 胜出,但试了一下,目前可用性还比较差,也可能是因为我对 Eclipse 更加熟悉, 配置一下,多数情况都能跑起来。so, 最终选择 Eclipse,并且 Eclipse 的代码编辑功能是挺强大的。 开源环境最大的问题为不是开箱即用,需要分别准备如下材料: 相关软件 Eclipse CDT 下载地址: https://www.eclipse.org/cdt/downloads.php The GNU MCU Eclipse plug-ins 原 GNU ARM Eclipse Plugins 下载地址: https://github.com/gnu-mcu-eclipse/eclipse-plugins/releases GNU Arm Embedded Toolchain 主页: https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain 来源: CSDN

How to install GNU gettext on windows 7?

时间秒杀一切 提交于 2019-12-30 01:08:11
问题 I need to install version 0.15 or higher of GNU's gettext so that I can use some i18n feateres with django. I've downloaded : http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.3.1.tar.gz from https://www.gnu.org/software/gettext/ However I have no idea how to install it and there's no installation guide on their website. How can I install it ? 回答1: I'm maintaining a GitHub repository with Windows binaries of gettext and iconv (I just updated it to the latest gettext version: 0.19.3) You can