This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why does gas put a stop bit in a bundle?


H. J. Lu wrote:
GAS adds a stop bit at the last bundle in the current section
automatically.
Why does gas do that? I'd like to turn it off.

Because we can't do dependency violation checking across section switches. Thus, in order to be safe, we must emit a stop bit when exiting the text section. Doing otherwise will result in code that silently fails at run time. Consider what happens if someone has C code with an extended asm that switches to an alternate code section and then back to text.


Section switching also causes problems for generation of unwind info. It also used to cause trouble for dwarf2 compaction, but I think Richard Henderson fixed that problem.

I believe the best long term solution for this is to modify IA-64 gas to insist on structured assembly language. Gas should emit an error if it sees code that isn't inside a function. Also, gas should emit an error if there is a section switch inside a function. If we do this, then all of the dependency violation, unwind info, and dwarf2 problems go away. It isn't hard to follow these rules, it just takes a little thought. The IA-64 linux kernel is written this way for instance, because they have had problems in the past with secction switching in the middle of functions breaking DV checking and/or unwind info.

Jim



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]