[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: gas/ia64 "data in a code section" problem

From: Jim Wilson
Subject: RE: gas/ia64 "data in a code section" problem
Date: 30 Jun 2004 16:17:47 -0700

On Tue, 2004-06-29 at 22:40, Belochapka, Konstantin wrote:
> Of course I agree that if anyone puts a data into code segment does this at 
> his own risk. But my point is that an assembler also should not any 
> restriction based on assumption of any potential problem. 
> The situation when IA64 assembler starts next bundle from an address that is 
> not aligned on 16 bytes
> in my opinion is a bug that need to be corrected or it might be mentioned in 
> a README file that after a data .align 16 directive is a requirement. But 
> emitting error message would be not good solution, warning might be more 
> appropriate.

That is a reasonable position. Unfortunately, I don't see any easy way
to implement this feature in gas.

I tried 5 toolchains: alpha, IA-64, mips, powerpc, sparc.  I inserted a
single byte between two instructions.  Only the Alpha port handled this

Looking at the Alpha port, I see it works by adding hooks to every
directive that changes section, emits data, or emits alignment.  In
these hooks, it maintains a variable alpha_current_align.  This is quite
a bit of work for an obscure feature.

Furthermore, this approach is error prone.  This requires that you can
accurately identify all such directives, and that similar hooks also be
added for any future directives.  By inspection, I was able to write a
testcase that also failed for alpha by using pushsection/popsection. 
The alpha port does not properly maintain alpha_current_align across
these directives.  There are likely other similar problems.

If we are going to do this right, I think it needs to be handled in the
assembler proper, rather than in the target ports.  In which case this
isn't an IA-64 bug, and no longer my problem.

An alternative way to do this is to emit an alignment before every
instruction (bundle).  I don't believe this is appropriate.  This will
make the assembler slower and bigger for everyone, even though very few
people will ever need or want this feature.  This could also cause other
problems for IA-64, such as poor bundling, emitting unnecessary stop
bits, etc.

So from my point of view, there is really no good solution in the gas
IA-64 target port.  The only good solution I see is to change your
assembler code to include an explicit alignment directive after emitting
data into the text section.  This should work for all assemblers, so it
should not be a problem to do this.

Another way to go here would be to file a bug report into our bugzilla
bug database:
I will then suspend the bug report saying that it is too much work for
too little gain.  That doesn't help you much, but at least the problem
would be recorded so we don't forget it.
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]