This is the mail archive of the binutils@sources.redhat.com 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]

linker scripts and linker sections


Hi,

may i ask if anybody on this list has attempted to or knows how to simule
the microsoft VC++ #pragmas data_seg and bss_seg.

these pragmas move vairables into sections e.g

#pragma bss_seg(.mybss)
int one;
bool two;
float three;
#pragma bss_seg()

this is instead of using the gcc __attribute__ to do the same,.. as it would
have to be added to every variable declaration (and i have many, many).

i have had most sucess using a linker script to move the sections like
this,... (note i am using x86 ELF linux)

SECTIONS {
	. = 0x08048000 + SIZEOF_HEADERS;

	.outvar :{
		__outvar_start = . ;

		./osfiles/debug/*(.bss)

		__outvar_stop = . ;
		}

	//
	// other section stuff snipped
	//
}

in C code i then,..

memset((void*)&__outvar_start,0,(&__outvar_stop - &__outvar_start));

(gdb) p &__outvar_start
$2 = 0x808a8a0 ""
(gdb) p &__outvar_stop
$3 = 0x808c0f4 <Address 0x808c0f4 out of bounds>

what does this mean ?

regards,

---
Matthew J Fletcher
Serck Controls Ltd
Embedded/Firmware/Development

mfletcher@serck-controls.co.uk
Phone (UK Direct) 02476 515089
---

**********************************************************************
Serck Controls Ltd, Rowley Drive, Coventry, CV3 4FH, UK
Tel: 44 (0) 24 7630 5050   Fax: 44 (0) 24 7630 2437
Web: www.serck-controls.co.uk  Admin: post@serck-controls.co.uk
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the above.  Any views or opinions presented are solely those of the
author and do not necessarily represent those of Serck Controls Ltd.
Please note that Serck Controls Ltd is able to, and reserves the right
to, monitor e-mail communications passing through its network.
This email has been checked for viruses.  Serck Controls Ltd shall not
be responsible for damage caused by any undetected virus.
**********************************************************************
Serck Controls Ltd is a subsidiary of Hunter Watertech Pty.
Registered in England No. 4353634.
**********************************************************************


******************************************************************
This message has been checked for all known viruses by MessageLabs
******************************************************************


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