This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gold linker: Access section start & end address w/o using a linker script


After having read several things about gold in the net, my impression is that gold mainly supports linker scripts to be backward compatible to the bfd linker. But the "gold style of linking" is to avoid using linker scripts. Am I roughly right with this conclusion?

Assuming yes:
The problem that arises when no linker script should be used is that our RTOS (and probably embedded system in general) requires to know the start address and end address of certain sections, such as data, sbss, etc. We need to know these addresses in order to create copies of these section during startup to support 'soft reset OS' features. Moreover, according to my understanding, gcc itself requires certain such symbols when compiled for powerpc-*-eabi from gcc 4.7.2 sources: libgcc/config/rs6000/eabi.S:
/* Do any initializations needed for the eabi environment */

	.section ".text"
	#include "ppc-asm.h"

#ifndef __powerpc64__

	 .section ".got2","aw"
	.align	2
.LCTOC1 = . /* +32768 */

/* Table of addresses */
.Ltable = .-.LCTOC1
	.long	.LCTOC1				/* address we are really at */

.Lsda = .-.LCTOC1
	.long	_SDA_BASE_			/* address of the first small data area */

.Lsdas = .-.LCTOC1
	.long	__SDATA_START__			/* start of .sdata/.sbss section */

Finally, the question: What is the concept of gold to support the symbols as required by gcc and to create "project-specific" symbols at the start and end of sections? Should we continue using linker scripts or is there something else we can/should do?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]