linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Wanted: A decent assembler
@ 2003-04-23 13:02 Chuck Ebbert
  2003-04-23 13:57 ` Maciej W. Rozycki
  0 siblings, 1 reply; 6+ messages in thread
From: Chuck Ebbert @ 2003-04-23 13:02 UTC (permalink / raw)
  To: root; +Cc: linux-kernel

"Richard B. Johnson" wrote"


>>   Output from 'make bzImage' after making some changes:
>>
>>         Error: non-constant expression in ".if" statement.
>>
>>
>>   Why is the kernel using a 1-pass assembler?
>>
>
> Well it isn't. The AT&T clone assembler will resolve forward
> references and it does it by using as many passes as necessary.
> It even has a 'reasonable' MACRO capability. I use it quite a
> bit to minimize the code-size or to maximize performance in
> embedded systems.


  This is from the info for GNU as:


   "The result of an expression must be an absolute number, or else an
offset into a particular section.  If an expression is not absolute,
and there is not enough information when `as' sees the expression to
know its section, a second pass over the source program might be
necessary to interpret the expression--but the second pass is currently
not implemented.  `as' aborts with an error message in this situation."


> Your error shown above is a real error. If you expose the code
> that it barfed on, maybe somebody could help you fix the code.

if NR_IRQS gt 16			# only build this for IO-APIC
	.align 8,0x90			# make ENTRY have exact address
irq_align=8				# start with 8-byte alignment
ENTRY(high_irq_entries_start)
rept NR_IRQS-16			# the rest of the stubs
	.align irq_align,0x90
1:	pushl $vector-256		# 5-byte instruction
	jmp common_interrupt		# 2 or 5 bytes (8 or 32-bit offset)
2:
if 2b-1b > 8			# <============================= ERROR
	irq_align=16			# switch to 16-byte alignment
endif
data
	.long 1b
text
vector=vector+1
endr
endif


-------
 Chuck

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

* Re: Wanted: A decent assembler
  2003-04-23 13:02 Wanted: A decent assembler Chuck Ebbert
@ 2003-04-23 13:57 ` Maciej W. Rozycki
  0 siblings, 0 replies; 6+ messages in thread
From: Maciej W. Rozycki @ 2003-04-23 13:57 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: linux-kernel

On Wed, 23 Apr 2003, Chuck Ebbert wrote:

>    "The result of an expression must be an absolute number, or else an
> offset into a particular section.  If an expression is not absolute,
> and there is not enough information when `as' sees the expression to
> know its section, a second pass over the source program might be
> necessary to interpret the expression--but the second pass is currently
> not implemented.  `as' aborts with an error message in this situation."

 But:

    `-'
          "Subtraction".  If the right argument is absolute, the result
          has the section of the left argument.  If both arguments are
          in the same section, the result is absolute.  You may not
          subtract arguments from different sections.

> 1:	pushl $vector-256		# 5-byte instruction
> 	jmp common_interrupt		# 2 or 5 bytes (8 or 32-bit offset)
> 2:
> if 2b-1b > 8			# <============================= ERROR
> 	irq_align=16			# switch to 16-byte alignment
> endif

 This is a bug in gas.  Please check if it is reproducible with the latest
release (2.13.2.1) and if so, then file a bug report to
<bug-binutils@gnu.org>.

  Maciej

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +


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

* Re: Wanted: A decent assembler
  2003-04-23 13:49 Chuck Ebbert
@ 2003-04-23 14:24 ` Richard B. Johnson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard B. Johnson @ 2003-04-23 14:24 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: linux-kernel

On Wed, 23 Apr 2003, Chuck Ebbert wrote:

>
> Chuck Ebbert wrote:
>
> > <mangled asm source>
>
>  Should be:
>
>
> .if NR_IRQS gt 16			# only build this for IO-APIC
> 	.align 8,0x90			# make ENTRY have exact address
> irq_align=8				# start with 8-byte alignment
> ENTRY(high_irq_entries_start)
> .rept NR_IRQS-16			# the rest of the stubs
> 	.align irq_align,0x90
> 1:	pushl $vector-256		# 5-byte instruction
> 	jmp common_interrupt		# 2 or 5 bytes (8 or 32-bit offset)
> 2:
> .if 2b-1b > 8				# offset changed to 32-bit
> 	irq_align=16			# switch to 16-byte alignment
> .endif
> .data
> 	.long 1b
> .text
> vector=vector+1
> .endr
> .endif
>
>
\

Well the source has several errors. I fixed a couple and made
the jump (temporarily) a fixed-length jump. The remaining error
is the improper construction of the label "vector", which needs
to be fixed and I need to take a work-break. I think all you
need to do is pre-define it, i.e., like the following:

NR_IRQS = 32

.if NR_IRQS > 16			# only build this for IO-APIC
	.align 8,0x90			# make ENTRY have exact address
irq_align=8				# start with 8-byte alignment
#ENTRY(high_irq_entries_start)
vector = 0;                             # Define as a variable, not label
.rept NR_IRQS-16			# the rest of the stubs
	.align irq_align,0x90
1:	pushl $vector		# 5-byte instruction
	ljmp common_interrupt		# 2 or 5 bytes (8 or 32-bit offset)
2:
.if 2b-1b > 8				# offset changed to 32-bit
	irq_align=16			# switch to 16-byte alignment
.endif
.data
	.long 1b
.text
vector=vector+1
.endr
.endif


Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.


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

* Re: Wanted: A decent assembler
@ 2003-04-23 13:49 Chuck Ebbert
  2003-04-23 14:24 ` Richard B. Johnson
  0 siblings, 1 reply; 6+ messages in thread
From: Chuck Ebbert @ 2003-04-23 13:49 UTC (permalink / raw)
  To: linux-kernel


Chuck Ebbert wrote:

> <mangled asm source>

 Should be:


.if NR_IRQS gt 16			# only build this for IO-APIC
	.align 8,0x90			# make ENTRY have exact address
irq_align=8				# start with 8-byte alignment
ENTRY(high_irq_entries_start)
.rept NR_IRQS-16			# the rest of the stubs
	.align irq_align,0x90
1:	pushl $vector-256		# 5-byte instruction
	jmp common_interrupt		# 2 or 5 bytes (8 or 32-bit offset)
2:
.if 2b-1b > 8				# offset changed to 32-bit
	irq_align=16			# switch to 16-byte alignment
.endif
.data
	.long 1b
.text
vector=vector+1
.endr
.endif


-------
 Chuck

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

* Re: Wanted: A decent assembler
  2003-04-23 10:59 Chuck Ebbert
@ 2003-04-23 11:11 ` Richard B. Johnson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard B. Johnson @ 2003-04-23 11:11 UTC (permalink / raw)
  To: Chuck Ebbert; +Cc: linux-kernel

On Wed, 23 Apr 2003, Chuck Ebbert wrote:

>
>   Output from 'make bzImage' after making some changes:
>
>         Error: non-constant expression in ".if" statement.
>
>
>   Why is the kernel using a 1-pass assembler?
>

Well it isn't. The AT&T clone assembler will resolve forward
references and it does it by using as many passes as necessary.
It even has a 'reasonable' MACRO capability. I use it quite a
bit to minimize the code-size or to maximize performance in
embedded systems.

Your error shown above is a real error. If you expose the code
that it barfed on, maybe somebody could help you fix the code.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
Why is the government concerned about the lunatic fringe? Think about it.


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

* Wanted: A decent assembler
@ 2003-04-23 10:59 Chuck Ebbert
  2003-04-23 11:11 ` Richard B. Johnson
  0 siblings, 1 reply; 6+ messages in thread
From: Chuck Ebbert @ 2003-04-23 10:59 UTC (permalink / raw)
  To: linux-kernel


  Output from 'make bzImage' after making some changes:

        Error: non-constant expression in ".if" statement.


  Why is the kernel using a 1-pass assembler?





------
 Chuck

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

end of thread, other threads:[~2003-04-23 14:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-23 13:02 Wanted: A decent assembler Chuck Ebbert
2003-04-23 13:57 ` Maciej W. Rozycki
  -- strict thread matches above, loose matches on Subject: below --
2003-04-23 13:49 Chuck Ebbert
2003-04-23 14:24 ` Richard B. Johnson
2003-04-23 10:59 Chuck Ebbert
2003-04-23 11:11 ` Richard B. Johnson

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).