* gas' nop(s)
@ 2002-08-04 20:28 m_hrebien
[not found] ` <20020805091651.245c7d4b.jani@iv.ro>
2002-08-05 10:20 ` h-peter recktenwald
0 siblings, 2 replies; 10+ messages in thread
From: m_hrebien @ 2002-08-04 20:28 UTC (permalink / raw)
To: linux-assembly
Hi there,
did You noticed that GNU as adds some padding nop(s) like:
lea (%esi),%esi
mov %esi,%esi
nop
at the end of .text section? Is this really necessary? The .text section
mustn't be padded to 4 like it seems to be or am i wrong? How can i
avoid this? Is there any gas option to switch this off?
Sorry if this topic is doubled by me but i couldn't find something
similar in the archive :(
--
Maciej Hrebien
^ permalink raw reply [flat|nested] 10+ messages in thread[parent not found: <20020805091651.245c7d4b.jani@iv.ro>]
* Re: gas' nop(s) [not found] ` <20020805091651.245c7d4b.jani@iv.ro> @ 2002-08-05 9:23 ` m_hrebien 0 siblings, 0 replies; 10+ messages in thread From: m_hrebien @ 2002-08-05 9:23 UTC (permalink / raw) To: linux-assembly Jani Monoses wrote: > > Hi > look at the .align directive in info gas .align, oh, of course!! :) Thank You!! > there is no requirement for text to be packed at 4 I thought so. Thanks for Your confirmation! > but it is the default (or maybe even 16) 16? Possibly it depends on system/compilation, don't You think so? On my gas it seems to be 4 as i wrote. -- Maciej Hrebien ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gas' nop(s) 2002-08-04 20:28 gas' nop(s) m_hrebien [not found] ` <20020805091651.245c7d4b.jani@iv.ro> @ 2002-08-05 10:20 ` h-peter recktenwald 2002-08-05 17:53 ` m_hrebien 1 sibling, 1 reply; 10+ messages in thread From: h-peter recktenwald @ 2002-08-05 10:20 UTC (permalink / raw) To: m_hrebien; +Cc: linux-assembly On Sun, 04 Aug 2002 22:28:47 +0200 m_hrebien@wp.pl wrote: > Hi there, > > did You noticed that GNU as adds some padding nop(s) like: > > lea (%esi),%esi > mov %esi,%esi > nop > > at the end of .text section? Is this really necessary? The .text section > mustn't be padded to 4 like it seems to be or am i wrong? How can i > avoid this? Is there any gas option to switch this off? some time back, i tried AS as an intermediate program, w. piped i/o, and encountered the same problem, which i didn't manage to solve, too. there is no option + no other idea. those gods of gnu binutils devel might know but, i myself never received an answer to any AS related question... anyway, AS wsn't meant to do plain, stand alone assembly but is designed to produceing a set of data which can be combined to something, probably executeable, with the "ld" linker. so the implicite alignment might even be very helpful for faster processing. i'd (highly) recommend the "fasm" assembler for the more 'direct' work:) http://fasm.metro-nt.pl/ > Sorry if this topic is doubled by me but i couldn't find something > similar in the archive :( > > -- > Maciej Hrebien > > - > To unsubscribe from this list: send the line "unsubscribe linux-assembly" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de NO abusive software patents http://petition.eurolinux.org/pr/pr17.html - To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gas' nop(s) 2002-08-05 10:20 ` h-peter recktenwald @ 2002-08-05 17:53 ` m_hrebien 2002-08-05 22:21 ` h-peter recktenwald 0 siblings, 1 reply; 10+ messages in thread From: m_hrebien @ 2002-08-05 17:53 UTC (permalink / raw) To: linux-assembly h-peter recktenwald wrote: > > > Hi there, > > > > did You noticed that GNU as adds some padding nop(s) like: > > > > lea (%esi),%esi > > mov %esi,%esi > > nop > > > > at the end of .text section? Is this really necessary? The .text section > > mustn't be padded to 4 like it seems to be or am i wrong? How can i > > avoid this? Is there any gas option to switch this off? > > some time back, i tried AS as an intermediate program, w. piped i/o, and > encountered the same problem, which i didn't manage to solve, too. there > is no option + no other idea. those gods of gnu binutils devel might know > but, i myself never received an answer to any AS related question... > > anyway, AS wsn't meant to do plain, stand alone assembly but is designed > to produceing a set of data which can be combined to something, probably > executeable, with the "ld" linker. Yes, it's gcc's back-end rather then stand alone assembler. > so the implicite alignment might even > be very helpful for faster processing. > > i'd (highly) recommend the "fasm" assembler for the more 'direct' work:) > http://fasm.metro-nt.pl/ :) Thanks, i'll check it... > > Sorry if this topic is doubled by me but i couldn't find something > > similar in the archive :( Guess what? I've tried this .align directive as Jani Monoses suggested like this: .text .align 1 .globl _start _start: mov $1,%eax xor %ebx,%ebx int $0x80 and it's not working as i wish - gas adds lea (%esi),%esi after int $0x80 to the output :( I've tried with 2, 4, 8 & 16 and it seems that .align x works good if x is greater equal than 4 :( But why?? -- Maciej Hrebien ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gas' nop(s) 2002-08-05 17:53 ` m_hrebien @ 2002-08-05 22:21 ` h-peter recktenwald 2002-08-06 9:30 ` m_hrebien 0 siblings, 1 reply; 10+ messages in thread From: h-peter recktenwald @ 2002-08-05 22:21 UTC (permalink / raw) To: m_hrebien; +Cc: linux-assembly On Mon, 05 Aug 2002 19:53:41 +0200 m_hrebien@wp.pl wrote: > Guess what? I've tried this .align directive as Jani Monoses suggested > like this: > > .text > > .align 1 > > .globl _start > _start: > mov $1,%eax > xor %ebx,%ebx > int $0x80 > > and it's not working as i wish - gas adds lea (%esi),%esi after int > $0x80 to the output :( I've tried with 2, 4, 8 & 16 and it seems that > .align x works good if x is greater equal than 4 :( But why?? .text section for ELF format defined to be page aligned, so it's always a multiple of 4, and the end-alignment added for what "bu" gnu-ers seem to think is #the# appropriate thing or, just more convenient to further asm output processing - just guessing, has anyone else a more thorough idea? a work-around for piped output may be defining a label at code end and taking the actually assmbled code length from the listing file. tested: echo ".att_syntax noprefix;.global XLAB;jnc XLAB;movl eax,ebx;\ movl ebx,edx;XLAB:;.end"|as -achnlsd m=l --gstabs |tee t the listing: ---------------------------------------------------- 1 0000 0F83FCFF .att_syntax noprefix 1 FFFF89C3 1 89DA89F6 DEFINED SYMBOLS {standard input}:1 .text:0000000a XLAB NO UNDEFINED SYMBOLS -------------------------------------------------- asm 4 bytes shorter w/o the ".global" statement, <jnc> then w. byte disp. regards, hp -- Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de NO abusive software patents http://petition.eurolinux.org/pr/pr17.html - To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gas' nop(s) 2002-08-05 22:21 ` h-peter recktenwald @ 2002-08-06 9:30 ` m_hrebien 2002-08-07 7:41 ` h-peter recktenwald 0 siblings, 1 reply; 10+ messages in thread From: m_hrebien @ 2002-08-06 9:30 UTC (permalink / raw) To: linux-assembly h-peter recktenwald wrote: > > > .text > > > > .align 1 > > > > .globl _start > > _start: > > mov $1,%eax > > xor %ebx,%ebx > > int $0x80 > > > > echo ".att_syntax noprefix;.global XLAB;jnc XLAB;movl eax,ebx;\ > movl ebx,edx;XLAB:;.end"|as -achnlsd m=l --gstabs |tee t > > the listing: > ---------------------------------------------------- > 1 0000 0F83FCFF .att_syntax noprefix > 1 FFFF89C3 > 1 89DA89F6 > DEFINED SYMBOLS > {standard input}:1 .text:0000000a XLAB > > NO UNDEFINED SYMBOLS > -------------------------------------------------- > asm 4 bytes shorter w/o the ".global" statement, <jnc> then w. byte disp. Yes, right! But it still adds "89F6" padding which stands for "mov %esi,%esi" & my question was how to avoid this. -- Maciej Hrebien ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gas' nop(s) 2002-08-06 9:30 ` m_hrebien @ 2002-08-07 7:41 ` h-peter recktenwald 2002-08-08 15:50 ` h-peter recktenwald 0 siblings, 1 reply; 10+ messages in thread From: h-peter recktenwald @ 2002-08-07 7:41 UTC (permalink / raw) To: m_hrebien; +Cc: linux-assembly On Tue, 06 Aug 2002 11:30:56 +0200 m_hrebien@wp.pl wrote: > > asm 4 bytes shorter w/o the ".global" statement, <jnc> then w. byte disp. > > Yes, right! But it still adds "89F6" padding which stands for "mov > %esi,%esi" & my question was how to avoid this. ok. you can not. hp ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gas' nop(s) 2002-08-07 7:41 ` h-peter recktenwald @ 2002-08-08 15:50 ` h-peter recktenwald 2002-08-09 16:07 ` h-peter recktenwald 0 siblings, 1 reply; 10+ messages in thread From: h-peter recktenwald @ 2002-08-08 15:50 UTC (permalink / raw) To: linux-assembly; +Cc: m_hrebien On Wed, 7 Aug 2002 07:41:36 +0000 h-peter recktenwald <lx@lxhp.in-berlin.de> wrote: > On Tue, 06 Aug 2002 11:30:56 +0200 > m_hrebien@wp.pl wrote: > > > > asm 4 bytes shorter w/o the ".global" statement, <jnc> then w. byte disp. > > > > Yes, right! But it still adds "89F6" padding which stands for "mov > > %esi,%esi" & my question was how to avoid this. > > ok. you can not. just tried: apparently, the ".end" directive inhibits those alignemt bytes, (if not a label at end of code). hp -- Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de NO abusive software patents http://petition.eurolinux.org/pr/pr17.html - To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gas' nop(s) 2002-08-08 15:50 ` h-peter recktenwald @ 2002-08-09 16:07 ` h-peter recktenwald 2002-08-09 19:47 ` Maciej Hrebien 0 siblings, 1 reply; 10+ messages in thread From: h-peter recktenwald @ 2002-08-09 16:07 UTC (permalink / raw) To: linux-assembly; +Cc: m_hrebien On Thu, 8 Aug 2002 15:50:47 +0000 h-peter recktenwald <*@lxhp.in-berlin.de> wrote: > > > > > > Yes, right! But it still adds "89F6" padding which stands for "mov > > > %esi,%esi" & my question was how to avoid this. > > just tried: apparently, the ".end" directive inhibits those alignemt bytes, > (if not a label at end of code). that was an error. though i wonder how some program of mine ends up with an odd address. probably due to its .data end. so i tried asm into a .data section, which works and, does #not# align. so, since you seem not to asm to any fixed 'format', that might be the alternative. hp -- Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de NO abusive software patents http://petition.eurolinux.org/pr/pr17.html - To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: gas' nop(s) 2002-08-09 16:07 ` h-peter recktenwald @ 2002-08-09 19:47 ` Maciej Hrebien 0 siblings, 0 replies; 10+ messages in thread From: Maciej Hrebien @ 2002-08-09 19:47 UTC (permalink / raw) To: linux-assembly h-peter recktenwald wrote: > > > > > Yes, right! But it still adds "89F6" padding which stands for "mov > > > > %esi,%esi" & my question was how to avoid this. > > > > just tried: apparently, the ".end" directive inhibits those alignemt bytes, > > (if not a label at end of code). > > that was an error. though i wonder how some program of mine ends up > with an odd address. probably due to its .data end. so i tried asm > into a .data section, which works and, does #not# align. so, since you > seem not to asm to any fixed 'format', that might be the alternative. Good idea!! I've tried to move our example (this with simple exit call) to the .data section but it still adds padding - it's: add %al,(%eax) (coded as "00 00") on my gas even with .align directive set to 1. But! I've followed Your way of thinking and guess what?! :) "why not to move this code to the .rodata section?" and... it works just fine!! No paddings!! :) Thank You very much for Your suggestion Peter (is that Your name?)!!! -- Maciej Hrebien ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2002-08-09 19:47 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-04 20:28 gas' nop(s) m_hrebien
[not found] ` <20020805091651.245c7d4b.jani@iv.ro>
2002-08-05 9:23 ` m_hrebien
2002-08-05 10:20 ` h-peter recktenwald
2002-08-05 17:53 ` m_hrebien
2002-08-05 22:21 ` h-peter recktenwald
2002-08-06 9:30 ` m_hrebien
2002-08-07 7:41 ` h-peter recktenwald
2002-08-08 15:50 ` h-peter recktenwald
2002-08-09 16:07 ` h-peter recktenwald
2002-08-09 19:47 ` Maciej Hrebien
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 NNTP newsgroup(s).