Skip to contentSkip to conversation

Wanted: A decent assembler

DISCUSSION Chuck Ebbert 2 participants 2 messages Apr 23, 2003

lore
Share & tools
lore
#0 lore raw

"Richard B. Johnson" wrote"

Quoted 5 lines
Quoted 5 lines

Output from 'make bzImage' after making some changes:

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

Quoted 8 lines
Quoted 2 lines

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

Quoted 2 lines

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

#1 lore raw
Quoted 6 lines · Chuck Ebbert

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

Quoted 6 lines

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 <[email protected]>.

Maciej

Signature · 3 lines
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: [email protected], PGP key available        +