Comments (9)
This patch should fix the issue (at least temporarly):
diff --git a/tool/alignment/pyalign/Linker.py b/tool/alignment/pyalign/Linker.py
index 710d6d3..64494b9 100644
--- a/tool/alignment/pyalign/Linker.py
+++ b/tool/alignment/pyalign/Linker.py
@@ -90,6 +90,14 @@ class Linker:
for symbolName in Globals.SYMBOLS_BLACKLIST[section]:
output_buffer.append("\t*(" + symbolName + ");\n")
+ # *This solve the problem of compiler inserted function: float function such as __extenddftf2
+ # (these function lands in the default *text section at the end of other function specific fuunctions)
+ # This leads to section with different size on Xeon and ARM(bigger) binaries which in turn leads to
+ # a segfault, since the DSM check the address at origin and when not found, trigger the fault!
+ # *The solution is to make sure that both section (on ARM and Xeon) have the same size.
+ # This alignement sould do just that (at least for many cases!)
+ output_buffer.append("\t. = ALIGN(0x100000);\n")
+
# Section "closing" part
output_buffer.append("}\n")
from popcorn-compiler.
@mohamed-karaoui That did the trick. Maybe submit that as a patch via pull request? Thanks!!
from popcorn-compiler.
I know this patch fixes this particular problem for EP, but it's not very robust (plus having gigantic alignment directives all over the place balloons the size of the binary). @olivierpierre is there a way we can accumulate the architecture-specific & blacklisted symbol sizes in order to safely align the next section to the correct page across all architectures?
from popcorn-compiler.
I'll have to look at this, can we attach the sources for a test case here? In the meantime, I recommend using Mohamed solution, some ideas to make it lighter:
- Potentially the amount of padding can be reduced imo, I doubt arm is adding 1MB of code at the end of the
.text
section - It seems this padding can be added only at the end of selected section (
.text.
, any other?)
from popcorn-compiler.
@olivierpierre Any program will do, but here's a simple hello world program for fun :)
More accurately, anything compiled with Popcorn's musl
library will do, since that's where the soft float routines originate.
from popcorn-compiler.
I believe I've found a better (?) fix that eliminates the soft float libraries altogether. Based on a comment on a StackOverflow question I asked and a post on the llvm-dev listserv, I tracked down the following code in <LLVM_SRC>/tools/clang/lib/Basic/Targets.cpp
(lines 4950-4991):
class AArch64TargetInfo : public TargetInfo {
virtual void setDescriptionString() = 0;
static const TargetInfo::GCCRegAlias GCCRegAliases[];
static const char *const GCCRegNames[];
enum FPUModeEnum {
FPUMode,
NeonMode
};
unsigned FPU;
unsigned CRC;
unsigned Crypto;
static const Builtin::Info BuiltinInfo[];
std::string ABI;
public:
AArch64TargetInfo(const llvm::Triple &Triple)
: TargetInfo(Triple), ABI("aapcs") {
if (getTriple().getOS() == llvm::Triple::NetBSD) {
WCharType = SignedInt;
// NetBSD apparently prefers consistency across ARM targets to consistency
// across 64-bit targets.
Int64Type = SignedLongLong;
IntMaxType = SignedLongLong;
} else {
WCharType = UnsignedInt;
Int64Type = SignedLong;
IntMaxType = SignedLong;
}
LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
MaxVectorAlign = 128;
MaxAtomicInlineWidth = 128;
MaxAtomicPromoteWidth = 128;
LongDoubleWidth = LongDoubleAlign = SuitableAlign = 128;
LongDoubleFormat = &llvm::APFloat::IEEEquad;
By changing the last two lines here, I was able to force the long double
type to 64 bits (the same size as a double
) on ARM64:
LongDoubleWidth = LongDoubleAlign = SuitableAlign = 64;
LongDoubleFormat = &llvm::APFloat::IEEEdouble;
This removed all reference to __extenddftf2
and (it appears) all other soft float library routines.
So far, I've tested this by:
- Successfully rebuilding the compiler
- Successfully rebuilding the Popcorn libraries (
musl
,stack transformation
, andmigration
) - Successfully building an NPB binary (CG, class A,
make-popcorn-explicit
branch) - Successfully running & migrating the binary
I believe further testing is probably needed (I'll be working with this modified version of the compiler for a while to see if any bugs pop up), but as of right now it's looking promising.
from popcorn-compiler.
This is awesome, thanks! Once you verify that it works, you can submit a pull request or let me know if you want me to implement. Just a couple of mental notes here that I don't want to forget:
-
We should make this command-line selectable if possible, so that we can enable automatically with "-popcorn-*" but not force users to use it if they don't want. We also need to document that this is enabled with the Popcorn flags
-
This fix needs to be applied to all architectures, including PowerPC & X86 (& maybe RISCV if we go that direction)
from popcorn-compiler.
@rlyerly I'm going to test it for another day or two, but I'll try to put together a pull request for at least the ARM changes.
from popcorn-compiler.
Additional note: requires modifying arch/aarch64/bits/float.h
in musl
(replace every field except DECIMAL_DIG
with values from arch/arm/bits/float.h
.
from popcorn-compiler.
Related Issues (20)
- Segmentation fault during homogeneous execution on aarch64 HOT 2
- pyalign script bugs HOT 2
- Failed assertion in CodeGen/UnwindInfo.cpp HOT 2
- Unable to build bodytrack with clang HOT 1
- Unhandled level 2 translation fault HOT 1
- Segfault when compiling bzlib.c (bzip2 SPEC-2006) HOT 1
- Compilation fails with backend ran out of registers HOT 1
- number of records for stackmap ... doesn't match HOT 1
- Argv argument table corruption HOT 2
- Cannot Build libopenpop HOT 2
- libelf: different code paths on aarch64 compared to x86-64 HOT 1
- GCC constructor/destructor attributes do not execute on AArch64
- SIGRTMIN does not induce migration
- struct stat wrong value HOT 4
- Wrong value when passing "struct stat" as a parameter to a function
- Stack transform timing utility architecture mismatch HOT 2
- Changing musl Makefile to use -O0 explicitly causes arm64 STLXR -> LDAXR pair to fail on real machines
- ./install_compiler.py error on Ubuntu 20.04 HOT 2
- libevent configure failed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from popcorn-compiler.