ld

manually link standard library in MinGW

≯℡__Kan透↙ 提交于 2021-01-27 20:34:49
问题 I had some trouble getting MinGW to recognise libraries for CSFML. I've had to manually link each library using the linker. Now I dont have the standard library that gets linked automatically from a simple gcc call. bbroo@DESKTOP-1F1J3SM ~/Shaders $ ld shaders.o libcsfml-system.a libcsfml-window.a libcsfml-graphics.a csfml-system-2.dll csfml-window-2.dll csfml-graphics-2.dll shaders.o:shaders.c:(.text+0x10): undefined reference to `__main' shaders.o:shaders.c:(.text+0x4bc): undefined

“ld: unknown option: -Bsymbolic” when trying to build iniparser on OSX

狂风中的少年 提交于 2021-01-27 17:36:08
问题 I'm trying to build http://github.com/ndevilla/iniparser on OSX, but getting: ~/ make compiling src/iniparser.c ... compiling src/dictionary.c ... a - src/iniparser.o a - src/dictionary.o ld: unknown option: -Bsymbolic collect2: ld returned 1 exit status make: *** [libiniparser.so] Error 1 This seems to not be a known issue with the code itself. What do I need to adjust on my system? 回答1: The -Bsymbolic flag specified in the Makefile of that project is specific to the GNU linker and platforms

MinGW: Linking with -nostdlib produces invalid executable

≡放荡痞女 提交于 2021-01-27 16:42:29
问题 I've spent the last couple of hours trying to link a simple x86 assembly program without any of the CRT initialization code using MinGW. I want the executable to only contain the _main method listed below and a single import of the ExitProcess kernel function. Opening the various generated files in a disassembler reveals that _main is indeed the entry point and the import table contains an import of ExitProcess (without the name decorations) from KERNEL32.dll , however Windows won't load the

MinGW: Linking with -nostdlib produces invalid executable

白昼怎懂夜的黑 提交于 2021-01-27 16:35:52
问题 I've spent the last couple of hours trying to link a simple x86 assembly program without any of the CRT initialization code using MinGW. I want the executable to only contain the _main method listed below and a single import of the ExitProcess kernel function. Opening the various generated files in a disassembler reveals that _main is indeed the entry point and the import table contains an import of ExitProcess (without the name decorations) from KERNEL32.dll , however Windows won't load the

GCC LD NOLOAD linker section generates loadable segment

懵懂的女人 提交于 2021-01-24 18:44:03
问题 I'm working on an Arm bare-metal application and I've marked some sections with NOLOAD . According to the explanation in Understanding linker script NOLOAD sections in embedded software , I expected the resulting ELF file to not have a loadable segment (program header) for these sections, but it does. Is this correct? Why are those sections marked as loadable in the ELF file? This is a part of my linker script: .bss (NOLOAD) : { . = ALIGN(4); __bss_start__ = .; *(.bss_begin .bss_begin.*) *(

GCC LD NOLOAD linker section generates loadable segment

核能气质少年 提交于 2021-01-24 18:39:49
问题 I'm working on an Arm bare-metal application and I've marked some sections with NOLOAD . According to the explanation in Understanding linker script NOLOAD sections in embedded software , I expected the resulting ELF file to not have a loadable segment (program header) for these sections, but it does. Is this correct? Why are those sections marked as loadable in the ELF file? This is a part of my linker script: .bss (NOLOAD) : { . = ALIGN(4); __bss_start__ = .; *(.bss_begin .bss_begin.*) *(

GCC LD NOLOAD linker section generates loadable segment

限于喜欢 提交于 2021-01-24 18:39:44
问题 I'm working on an Arm bare-metal application and I've marked some sections with NOLOAD . According to the explanation in Understanding linker script NOLOAD sections in embedded software , I expected the resulting ELF file to not have a loadable segment (program header) for these sections, but it does. Is this correct? Why are those sections marked as loadable in the ELF file? This is a part of my linker script: .bss (NOLOAD) : { . = ALIGN(4); __bss_start__ = .; *(.bss_begin .bss_begin.*) *(

How to get a pointer to a binary section in Mac OS X?

点点圈 提交于 2021-01-20 20:11:25
问题 I'm writing some code which stores some data structures in a special named binary section. These are all instances of the same struct which are scattered across many C files and are not within scope of each other. By placing them all in the named section I can iterate over all of them. This works perfectly with GCC and GNU ld. Fails on Mac OS X due to missing __start___mysection and __stop___mysection symbols. I guess llvm ld is not smart enough to provide them automatically. In GCC and GNU

Why `-fvisibility-inlines-hidden` is not the default?

↘锁芯ラ 提交于 2021-01-18 06:30:30
问题 I am asking to see whether my understandings are correct. inline is a suggestion to C++ compiler for substituting a function whenever it sees better, therefore calling a procedure flagged as inlined from outside of a library shouldn't be reliable and they logically should be hidden by default, preventing others to call them as an update to a compiler or codebase can be change the decision (thus removal of the inline d function and ABI breakage?). However it seems that is not the default

Why `-fvisibility-inlines-hidden` is not the default?

送分小仙女□ 提交于 2021-01-18 06:28:06
问题 I am asking to see whether my understandings are correct. inline is a suggestion to C++ compiler for substituting a function whenever it sees better, therefore calling a procedure flagged as inlined from outside of a library shouldn't be reliable and they logically should be hidden by default, preventing others to call them as an update to a compiler or codebase can be change the decision (thus removal of the inline d function and ABI breakage?). However it seems that is not the default