-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Section order should be tweaked #1748
Comments
Here are the constraints. Darwin does dead code stripping on a per-atom basis. Atoms are chunks of The problem we have is that we can't have the function and the jump tables end up in different sections The solution is that the jump tables have to be emitted into the text section, right after the function
... function body .. because we don't have a "section rodata". Also, in the EH case, eh_func_end is in the right section, There are really two bugs here. First, the .size directive should be emitted before the JT entries for Also, eh_func_end doesn't sound like a legal label. It should start with an L/., no? -Chris |
I attached some GCC generated code. GCC emits the jump tables inside the functions. We don't want to |
Extended Description
Consider we have function with jump tables. Currently we're doing something like
this:
... function body ..
ret
.section .rodata
... jump table entries ...
.size funcname, .-funcname
Note, that .size directive is actually located in rodata section and "." refers
to .rodata section too, so size is definitely incorrect. Ok. This doesn't make
things too much bad.
Consider we have eh enabled. We have:
eh_func_begin:
... function body ...
ret
.section .rodata
... jump table entries ...
.size funcname, .-funcname
eh_func_end:
.section eh_frame
....
Note, eh_func_end is in rodata section. eh_frame should contain misc. offsets,
involving eh_func_begin and eh_func_end. Surely this information will be
invalid. Even more, as blames, because it cannot compute cross-section offsets.
The solution seems to be easy: just emit JT info in the late end, but I'm little
bit worried, because I saw the following comment in X86ATTAsmPrinter.cpp:
// Print out jump tables referenced by the function.
// Mac OS X requires that the jump table follow the function, so that the jump
// table is part of the same atom that the function is in.
EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
if (TAI->hasDotTypeDotSizeDirective())
O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
if (Subtarget->isTargetDarwin() ||
Subtarget->isTargetELF() ||
Subtarget->isTargetCygMing()) {
// Emit post-function debug information.
DW.EndFunction();
}
It seems for me, that EmitJumpTableInfo() should be moved to the late end, but
what does that comment mean" What is "atom" for MacOS X?
We really need someone with darwin knowledge to resolve this.
The text was updated successfully, but these errors were encountered: