public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: ELF Sections in GCC
       [not found] <BAY7-F1008S0g9S83w40000c987@hotmail.com>
@ 2003-09-15 18:45 ` John Love-Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: John Love-Jensen @ 2003-09-15 18:45 UTC (permalink / raw)
  To: Rudy Koot; +Cc: gcc-help

Hi Rudy,

I'm not seeing a intra-routine padding problem, using GCC 3.2.

I'm only seeing inter-routine padding, for alignment.

Could you send a short example that illustrates the problem?

Worse come to worse, you could change the ".p2align 4,,15" to ".p2align
4,144,15" (144 == 0x90) through some post-processing sed or perl magic
before the assembler gets a crack at it.

--Eljay

>gcc -O3 -save-temps -c doo.cpp

- - - - doo.cpp - - - -
extern int foo (char a, char b) __attribute__ ((section ("bar")));
extern int bar (int a, int b) __attribute__ ((section ("bar")));

int foo (char a, char b)// __attribute__ ((section ("bar")))
{
   return a + b;
}

int bar (int a, int b)// __attribute__ ((section ("bar")))
{
   return a + b;
}

- - - - doo.s - - - -
        .file   "doo.cpp"
        .section        bar,"ax",@progbits
        .align 2
        .p2align 4,,15
.globl _Z3foocc
        .type   _Z3foocc,@function
_Z3foocc:
.LFB1:
        pushl   %ebp
.LCFI0:
        movl    %esp, %ebp
.LCFI1:
        movsbl  8(%ebp),%eax
        movsbl  12(%ebp),%ecx
        popl    %ebp
        addl    %ecx, %eax
        ret
.LFE1:
.Lfe1:
        .size   _Z3foocc,.Lfe1-_Z3foocc
        .align 2
        .p2align 4,,15
.globl _Z3barii
        .type   _Z3barii,@function
_Z3barii:
.LFB2:
        pushl   %ebp
.LCFI2:
        movl    %esp, %ebp
.LCFI3:
        movl    12(%ebp), %eax
        movl    8(%ebp), %ecx
        popl    %ebp
        addl    %ecx, %eax
        ret
.LFE2:
.Lfe2:
        .size   _Z3barii,.Lfe2-_Z3barii
        .ident  "GCC: (GNU) 3.2"


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ELF Sections in GCC
       [not found] <BAY7-F58QtofuWvPwcu000241d6@hotmail.com>
@ 2003-09-15 21:02 ` Eljay Love-Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: Eljay Love-Jensen @ 2003-09-15 21:02 UTC (permalink / raw)
  To: Rudy Koot; +Cc: gcc-help

Hi Rudy,

It's interesting to note that the same assembly is generated in either default ".text" or in my "bar" section include the .p2align commands -- only the .text or .section are different.

That tells me that it's the assembler that takes the assembly and outputs the object file which is putting in the NOPs, or the troublesome 0x00 for padding.

I don't know if that's of any help for your issue.

The GCC documentation indicates that another possibility is to use the linker to map the entire contents of a module (.o) to a particular section, but doesn't give an example, <http://gcc.gnu.org/onlinedocs/gcc-3.3.1/gcc/Function-Attributes.html#Function%20Attributes>.

HTH,
--Eljay


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-09-15 21:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <BAY7-F1008S0g9S83w40000c987@hotmail.com>
2003-09-15 18:45 ` ELF Sections in GCC John Love-Jensen
     [not found] <BAY7-F58QtofuWvPwcu000241d6@hotmail.com>
2003-09-15 21:02 ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).