Skip to content

Commit

Permalink
fix(julia): custom build without Frame Pointer Omission
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunet committed Feb 12, 2023
1 parent 68c3f7d commit 72d589a
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ repos:
rev: v4.4.0
hooks:
- id: end-of-file-fixer
exclude: \.patch$
- id: trailing-whitespace
- repo: https://github.com/hadolint/hadolint
rev: v2.12.0
Expand Down
4 changes: 4 additions & 0 deletions julia/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.PHONY: build
build:
docker build -t parca-demo:julia .

build-patched:
docker run --interactive --rm --volume="${PWD}:/build" --workdir=/build \
docker.io/nixos/nix:2.11.1 sh -c '$$(nix-build --no-out-link)' | docker load
28 changes: 28 additions & 0 deletions julia/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{ pkgs ? import
(builtins.fetchTarball
"https://github.com/NixOS/nixpkgs/archive/nixos-22.11.tar.gz"
)
{ }
}:

let
julia = pkgs.julia.overrideAttrs (current: {
patches = current.patches ++ [
./patches/0001-disable-frame-pointer-omission.patch
];
doInstallCheck = false;
});
in
pkgs.dockerTools.streamLayeredImage {
name = "parca-demo";
tag = "julia";
contents = [
julia
(pkgs.writeTextDir "app/main.jl" (builtins.readFile ./main.jl))
];
config = {
Cmd = [ "julia" "main.jl" ];
Env = [ "ENABLE_JITPROFILING=1" ];
WorkingDir = "/app";
};
}
20 changes: 20 additions & 0 deletions julia/patches/0001-disable-frame-pointer-omission.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
commit 1d5a4168933d19df4784aa6c73a5a7653610cf04
Author: Maxime Brunet <[email protected]>
Date: Sat Feb 11 11:37:06 2023 -0800

Disable Frame Pointer Omission on Linux

diff --git a/src/codegen.cpp b/src/codegen.cpp
index 104f77f8d6..5a1284be6d 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -10,7 +10,7 @@
#if defined(_CPU_X86_)
#define JL_NEED_FLOATTEMP_VAR 1
#endif
-#if defined(_OS_WINDOWS_) || defined(_OS_FREEBSD_)
+#if defined(_OS_WINDOWS_) || defined(_OS_LINUX_) || defined(_OS_FREEBSD_)
#define JL_DISABLE_FPO
#endif


0 comments on commit 72d589a

Please sign in to comment.