This is the mail archive of the binutils@sourceware.org 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]

GAS: changing name of default sections .text/.data/.rodata


 Hello,

 Is it possible to add a way to tell GAS to change those
default section names for current file? Here is my problem:

 I am compiling with GCC an i386 application for real mode,
so GCC will use default keyword/section names .text/.data/.rodata
freely. For instance, this simple code:

unsigned global_data = 3;
unsigned fct (unsigned data)
{
    char string[80] = "abc";
    return data / 2;
}

Puts global_data in .data, .LC0 string "abc" in .rodata and 
fct in .text . The syntax is different for .rodata because
it is used by GCC as ".section .rodata" (the .section 
keyword is added), but "sed" could sort that out.

  In my Gujin bootloader:
http://gujin.org
  but mostly in this patch proposed to the Linux kernel:
http://marc.theaimsgroup.com/?l=linux-kernel&m=113650255604862&q=p3
  I want to use special section names which shall not be mixed
 with the complete protected mode sections.

 So I have to add lines like:
#define CONST	__attribute__ ((section (".rodata16"))) const
#define VARIABLE __attribute__ ((section (".data16")))
#define BSS	__attribute__ ((section (".bss16")))
#define CODE	__attribute__ ((section (".text16")))
 and use them for each symbol I define; and I cannot use
inline strings in C expressions, nor a switch which would
generate a jump table, because there is no way to define a
section for them.

 But if I could do something like:
asm ("
 .data = .data16 
 .text = .code16
 .rodata = .rodata16 
 ");
 to say the name of the default section to use when the keyword
".text" or ".data" are used without ".section", then I would
not need to put the same "__attribute__ ((section()))" to every
object declared in C.
 Note that any other syntax to define the default name of
keywords ".text" and ".data" (and ".rodata" keyword if possible)
for current file would be fine, it is a lot better if it can be something inside the file
instead of a GAS option (changing the command line option for one file in a project is
difficult in Makefile - worse is treating differently the object file by using objcopy to
rename the sections in Makefile).

  Thanks for reading,
  Etienne.


	

	
		
___________________________________________________________________________ 
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com


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