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

[cling] Inject symbols from libc_nonshared.a #13286

Merged
merged 1 commit into from
Jul 21, 2023

Conversation

hahnjo
Copy link
Member

@hahnjo hahnjo commented Jul 19, 2023

These symbols may not be found automatically. See also upstream issue llvm/llvm-project#61289. This fixes the test DynamicLibraryManager/cached_realpath.C, approach by Lang Hames.

@hahnjo hahnjo self-assigned this Jul 19, 2023
@hahnjo hahnjo requested a review from Axel-Naumann as a code owner July 19, 2023 16:54
@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac11/noimt, mac12arm/cxx20, windows10/cxx14
How to customize builds

@root-project root-project deleted a comment from sonatype-lift bot Jul 19, 2023
Comment on lines 588 to 593
SymbolMap LibcNonsharedSymbols;
LibcNonsharedSymbols[Jit->mangleAndIntern("lstat")] = JITEvaluatedSymbol(
static_cast<JITTargetAddress>(reinterpret_cast<uintptr_t>(&lstat)),
JITSymbolFlags::Exported);
cantFail(
Jit->getMainJITDylib().define(absoluteSymbols(LibcNonsharedSymbols)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether we could reuse IncrementalJIT::addOrReplaceDefinition() for this, but other than that LGTM!

Copy link
Member

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming we will update the llvm issue capturing the discussion and our finding, I'd propose to move forward here.

@github-actions
Copy link

github-actions bot commented Jul 19, 2023

Test Results

         8 files           8 suites   1d 15h 39m 10s ⏱️
  2 474 tests   2 472 ✔️ 0 💤 2
18 743 runs  18 734 ✔️ 0 💤 9

For more details on these failures, see this check.

Results for commit d29adcd.

♻️ This comment has been updated with latest results.

@phsft-bot
Copy link
Collaborator

Build failed on mac12arm/cxx20.
Running on macphsft26.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

These symbols may not be found automatically. See also upstream issue
llvm/llvm-project#61289. This fixes the
test DynamicLibraryManager/cached_realpath.C, approach by Lang Hames.
@phsft-bot
Copy link
Collaborator

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac11/noimt, mac12arm/cxx20, windows10/cxx14
How to customize builds

@hahnjo hahnjo changed the title [cling] Inject absolute address of lstat [cling] Inject symbols from libc_nonshared.a Jul 20, 2023
@hahnjo hahnjo requested a review from vgvassilev July 20, 2023 10:15
@jalopezg-git
Copy link
Contributor

Even better now 👍! Many thanks, @hahnjo!

Copy link
Member

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Axel-Naumann
Copy link
Member

Does this also fix cling with devtoolset? Or could a similar approach be used? (I forgot the exact library name that provides the extra symbols.)

@hahnjo
Copy link
Member Author

hahnjo commented Jul 21, 2023

Does this also fix cling with devtoolset?

No.

Or could a similar approach be used? (I forgot the exact library name that provides the extra symbols.)

Not quite, for that we actually have to load the full static library and stuff it into a StaticLibraryDefinitionGenerator.

@phsft-bot
Copy link
Collaborator

Build failed on ROOT-debian10-i386/soversion.
Running on pcepsft11.dyndns.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@hahnjo hahnjo merged commit 4b6075b into root-project:master Jul 21, 2023
@hahnjo hahnjo deleted the cling-lstat branch July 21, 2023 11:03
LebedevRI added a commit to LebedevRI/Halide that referenced this pull request Aug 11, 2024
The original workaround is very partial,
and was not really working in my experience,
even after making it non-GCC specific.

Instead:
1. Ensure that the library that actually provides that symbol
   (as per the compiler used!) is actually linked into.
   This was not enough still.
2. Replace `HalideJITMemoryManager` hack with a more direct approach
   of actually telling the JIT the address of the symbol.
3. While there, move the symbol's forward definition to outside
   of namespaces. It's a global symbol, it makes sense to place it there.

This makes python binding tests pass on i386,
and i'm really happy about that.

Refs. llvm/llvm-project#61289
Inspired by root-project/root#13286
LebedevRI added a commit to LebedevRI/Halide that referenced this pull request Aug 11, 2024
The original workaround is very partial,
and was not really working in my experience,
even after making it non-GCC specific.

Instead:
1. Ensure that the library that actually provides that symbol
   (as per the compiler used!) is actually linked into.
   This was not enough still.
2. Replace `HalideJITMemoryManager` hack with a more direct approach
   of actually telling the JIT the address of the symbol.
3. While there, move the symbol's forward definition to outside
   of namespaces. It's a global symbol, it makes sense to place it there.

This makes python binding tests pass on i386,
and i'm really happy about that.

Refs. llvm/llvm-project#61289
Inspired by root-project/root#13286
LebedevRI added a commit to LebedevRI/Halide that referenced this pull request Aug 11, 2024
The original workaround is very partial,
and was not really working in my experience,
even after making it non-GCC specific.

Instead:
1. Ensure that the library that actually provides that symbol
   (as per the compiler used!) is actually linked into.
   This was not enough still.
2. Replace `HalideJITMemoryManager` hack with a more direct approach
   of actually telling the JIT the address of the symbol.
3. While there, move the symbol's forward definition to outside
   of namespaces. It's a global symbol, it makes sense to place it there.

This makes python binding tests pass on i386,
and i'm really happy about that.

Refs. llvm/llvm-project#61289
Inspired by root-project/root#13286
LebedevRI added a commit to LebedevRI/Halide that referenced this pull request Aug 11, 2024
The original workaround is very partial,
and was not really working in my experience,
even after making it non-GCC specific.

Instead:
1. Ensure that the library that actually provides that symbol
   (as per the compiler used!) is actually linked into.
   This was not enough still.
2. Replace `HalideJITMemoryManager` hack with a more direct approach
   of actually telling the JIT the address of the symbol.
3. While there, move the symbol's forward definition to outside
   of namespaces. It's a global symbol, it makes sense to place it there.

This makes python binding tests pass on i386,
and i'm really happy about that.

Refs. llvm/llvm-project#61289
Inspired by root-project/root#13286
LebedevRI added a commit to LebedevRI/Halide that referenced this pull request Aug 11, 2024
The original workaround is very partial,
and was not really working in my experience,
even after making it non-GCC specific.

Instead:
1. Ensure that the library that actually provides that symbol
   (as per the compiler used!) is actually linked into.
   This was not enough still.
2. Replace `HalideJITMemoryManager` hack with a more direct approach
   of actually telling the JIT the address of the symbol.
3. While there, move the symbol's forward definition to outside
   of namespaces. It's a global symbol, it makes sense to place it there.

This makes python binding tests pass on i386,
and i'm really happy about that.

Refs. llvm/llvm-project#61289
Inspired by root-project/root#13286

Forwarded: halide#8389

Gbp-Pq: Name 0010-JITModule-rework-fix-__udivdi3-handling.patch
LebedevRI added a commit to LebedevRI/Halide that referenced this pull request Aug 13, 2024
The original workaround is very partial,
and was not really working in my experience,
even after making it non-GCC specific.

Instead:
1. Ensure that the library that actually provides that symbol
   (as per the compiler used!) is actually linked into.
   This was not enough still.
2. Replace `HalideJITMemoryManager` hack with a more direct approach
   of actually telling the JIT the address of the symbol.
3. While there, move the symbol's forward definition to outside
   of namespaces. It's a global symbol, it makes sense to place it there.

This makes python binding tests pass on i386,
and i'm really happy about that.

Refs. llvm/llvm-project#61289
Inspired by root-project/root#13286

Forwarded: halide#8389

Gbp-Pq: Name 0010-JITModule-rework-fix-__udivdi3-handling.patch
LebedevRI added a commit to LebedevRI/Halide that referenced this pull request Aug 13, 2024
The original workaround is very partial,
and was not really working in my experience,
even after making it non-GCC specific.

Instead:
1. Ensure that the library that actually provides that symbol
   (as per the compiler used!) is actually linked into.
   This was not enough still.
2. Replace `HalideJITMemoryManager` hack with a more direct approach
   of actually telling the JIT the address of the symbol.
3. While there, move the symbol's forward definition to outside
   of namespaces. It's a global symbol, it makes sense to place it there.

This makes python binding tests pass on i386,
and i'm really happy about that.

Refs. llvm/llvm-project#61289
Inspired by root-project/root#13286

Forwarded: halide#8389

Gbp-Pq: Name 0010-JITModule-rework-fix-__udivdi3-handling.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants