Skip to content
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

Broken linkerscript, julia fails to link with modern lld versions #54533

Open
LebedevRI opened this issue May 21, 2024 · 2 comments · May be fixed by #55363
Open

Broken linkerscript, julia fails to link with modern lld versions #54533

LebedevRI opened this issue May 21, 2024 · 2 comments · May be fixed by #55363
Labels
building Build system, or building Julia or its dependencies

Comments

@LebedevRI
Copy link
Contributor

Building v1.10.3 with

$ ld -v
Debian LLD 18.1.6 (compatible with GNU linkers)

fails:

ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol '__stack_chk_guard' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol 'asprintf' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol 'rec_backtrace' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol 'localtime_r' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol 'restore_signals' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol 'add_library_mapping' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol 'jlbacktrace' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol 'jlbacktracet' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol '_Z24jl_coverage_data_pointerN4llvm9StringRefEi' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol '_Z22jl_coverage_alloc_lineN4llvm9StringRefEi' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol '_Z22jl_malloc_data_pointerN4llvm9StringRefEi' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol 'llvmGetPassPluginInfo' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol 'environ' failed: symbol not defined
ld: error: version script assignment of 'JL_LIBJULIA_1.10' to symbol '__progname' failed: symbol not defined
@gbaraldi
Copy link
Member

https://reviews.llvm.org/D135402 This was a very contentious change to lld, but I think there might be a workaround we could do like llvm/llvm-project@fef73b8, which just defines empty versions of those symbols.

@LebedevRI
Copy link
Contributor Author

Locally, this workarounds the problem for me:

> cat Make.user
CFLAGS=-Wl,--undefined-version
CXXFLAGS=$(CFLAGS)

@nsajko nsajko added the building Build system, or building Julia or its dependencies label May 22, 2024
giordano pushed a commit that referenced this issue Sep 9, 2024
This fixes various issues with the PGO+LTO makefile
- `USECCACHE` doesn't work throwing an error at
https://github.com/JuliaLang/julia/blob/eb5587dac02d1f6edf486a71b95149139cc5d9f7/Make.inc#L734
This is because setting `CC` and `CCX` by passing them as arguments to
`make` prevents `Make.inc` from prepending these variables with `ccache`
as `Make.inc` doesn't use override. To workaround this I instead set
`USECLANG` and add the toolchain to the `PATH`.
- To deal with similar issues for the other make flags, I pass them as
environment variables which can be edited in `Make.inc`.
- I add a way to build in one go by creating the `all` target, now you
can just run `make` and a PGO+LTO build that profiles Julia's build will
be generated.
- I workaround `PROFRAW_FILES` not being reevaluated after `stage1`
builds, this caused the generation of `PROFILE_FILE` to run an outdated
command if `stage1` was built and affected the profraw files. This is
important when building in one go.
- I add a way to run rules like `binary-dist` which are not defined in
this makefile with the correct toolchain which for example prevents
`make binary-dist` from unnecessarily rebuilding `sys.ji`.
- Include `-Wl,--undefined-version` till
#54533 gets fixed.

These changes need to be copied to the PGO+LTO+BOLT makefile and some to
the BOLT makefile in a later pr.

---------

Co-authored-by: Zentrik <Zentrik@users.noreply.github.com>
kshyatt pushed a commit that referenced this issue Sep 12, 2024
This fixes various issues with the PGO+LTO makefile
- `USECCACHE` doesn't work throwing an error at
https://github.com/JuliaLang/julia/blob/eb5587dac02d1f6edf486a71b95149139cc5d9f7/Make.inc#L734
This is because setting `CC` and `CCX` by passing them as arguments to
`make` prevents `Make.inc` from prepending these variables with `ccache`
as `Make.inc` doesn't use override. To workaround this I instead set
`USECLANG` and add the toolchain to the `PATH`.
- To deal with similar issues for the other make flags, I pass them as
environment variables which can be edited in `Make.inc`.
- I add a way to build in one go by creating the `all` target, now you
can just run `make` and a PGO+LTO build that profiles Julia's build will
be generated.
- I workaround `PROFRAW_FILES` not being reevaluated after `stage1`
builds, this caused the generation of `PROFILE_FILE` to run an outdated
command if `stage1` was built and affected the profraw files. This is
important when building in one go.
- I add a way to run rules like `binary-dist` which are not defined in
this makefile with the correct toolchain which for example prevents
`make binary-dist` from unnecessarily rebuilding `sys.ji`.
- Include `-Wl,--undefined-version` till
#54533 gets fixed.

These changes need to be copied to the PGO+LTO+BOLT makefile and some to
the BOLT makefile in a later pr.

---------

Co-authored-by: Zentrik <Zentrik@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies
Projects
None yet
3 participants