Magnus pushed to branch wip/mangoiv/aarch64-longjump at Glasgow Haskell Compiler / GHC
Commits:
-
8a0cf1dd
by mangoiv at 2026-06-30T14:46:52+02:00
4 changed files:
- + changelog.d/inter-module-far-jumps-aarch64-default
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Platform/Ways.hs
- docs/users_guide/using-optimisation.rst
Changes:
| 1 | +section: driver
|
|
| 2 | +synopsis: enable -finter-module-far-jumps by default on profiled aarch64-linux
|
|
| 3 | +issues: #26994
|
|
| 4 | +mrs: !16016
|
|
| 5 | +description: Some binutils and gcc versions lead to jump offset erros on aarch64-linux profiled ways. To mitigate this bug, we enable inter-module-far-jumps by default on this platform/way. |
| ... | ... | @@ -1241,7 +1241,6 @@ defaultFlags settings |
| 1241 | 1241 | Opt_SpecialiseIncoherents,
|
| 1242 | 1242 | Opt_WriteSelfRecompInfo
|
| 1243 | 1243 | ]
|
| 1244 | - |
|
| 1245 | 1244 | ++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]
|
| 1246 | 1245 | -- The default -O0 options
|
| 1247 | 1246 |
| ... | ... | @@ -154,6 +154,14 @@ wayGeneralFlags _ WayDyn = [Opt_PIC, Opt_ExternalDynamicRefs] |
| 154 | 154 | -- .so before loading the .so using the system linker. Since only
|
| 155 | 155 | -- PIC objects can be linked into a .so, we have to compile even
|
| 156 | 156 | -- modules of the main program with -fPIC when using -dynamic.
|
| 157 | +wayGeneralFlags platform WayProf
|
|
| 158 | + | ArchAArch64 <- platformArch platform
|
|
| 159 | + , OSLinux <- platformOS platform = [Opt_InterModuleFarJumps]
|
|
| 160 | + {- note(mangoiv):
|
|
| 161 | + - on aarch64 profiled-dynamic, we are seeing jump offset overflow
|
|
| 162 | + - errors on certain binutils versions. This can probably be deactivated
|
|
| 163 | + - if we stop supporting binutils 2.44 / GCC 14.2
|
|
| 164 | + - https://gitlab.haskell.org/ghc/ghc/-/issues/26994 -}
|
|
| 157 | 165 | wayGeneralFlags _ WayProf = []
|
| 158 | 166 | |
| 159 | 167 | -- | Turn these flags off when enabling this way
|
| ... | ... | @@ -732,7 +732,7 @@ as such you shouldn't need to set any of them explicitly. A flag |
| 732 | 732 | :reverse: -fno-inter-module-far-jumps
|
| 733 | 733 | :category:
|
| 734 | 734 | |
| 735 | - :default: Off
|
|
| 735 | + :default: on if the target is AArch64-Linux and this is a profiling way, off on all others
|
|
| 736 | 736 | |
| 737 | 737 | This flag forces GHC to use far jumps instead of near jumps for all jumps
|
| 738 | 738 | which cross module boundries. This removes the need for jump islands/linker
|