Fixed
Status Update
Comments
ch...@google.com <ch...@google.com>
cl...@google.com <cl...@google.com> #2
download_sdk.py requires a python module called colorama which I don't have on my mac. Is there a recommended way to get it for naclports?
ch...@google.com <ch...@google.com> #3
gclient should install it during runhooks.
ch...@google.com <ch...@google.com>
ap...@google.com <ap...@google.com> #4
Oh.. and run it with build_tools/python_wrapper to get those modules.
ap...@google.com <ap...@google.com> #6
This bug seems to be a problem with the inliner. In this trace seems to be inlining ~basic_string into ~basic_stringstream; in my repro it's a the same verifier failure but with different functions. It looks like the inliner is failing to update (or create) the inlinedAt field in the MDLocation metadata. The verifier starts with the original MDSubprogram (first output line), finds the function it describes (second output, the function prototye) checks each instruction in that function (3rd output, the load instruction) and follows the chain from its !dbg attachment (4th-6th outputs) lead back to an MDSubprogram describing the same function. Here they don't match.
ap...@google.com <ap...@google.com> #7
Here's a bugpoint-reduced version of the testcase. bugpoint made the code pretty small but apparently it doesn't know how to remove debug info.
ap...@google.com <ap...@google.com> #8
So, this seems to happen when function A that has debug info (in the attached repro from #6 it's _ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSERKS5_) gets inlined into a function B (_ZNSt3__115basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEE3strERKNS_12basic_stringIcS2_S4_EE in the repro) which has no debug info, which is then in turn inlined into a function C (_ZN7testing7MessageC2Ev in the repro) which has debug info.
When the verifier visits the MDSubprogram entry for function B it finds the instruction originally from A, walks its debug info attachments and finds that it points to function A, and fails verification.
I'm not sure if it matters whether B is ultimately inlined into C or not. It does appear that a workaround is to generate debug info for B.
For glibc-compat this happens because the main program for the unit tests is built without debug info (it's built in one command without a separate link step). So as a workaround you could enable debug info for that. Usually everything has debug info or nothing does (this case can only happen with LTO) but clearly it should work, and it definitely seems to be an upstream bug.
When the verifier visits the MDSubprogram entry for function B it finds the instruction originally from A, walks its debug info attachments and finds that it points to function A, and fails verification.
I'm not sure if it matters whether B is ultimately inlined into C or not. It does appear that a workaround is to generate debug info for B.
For glibc-compat this happens because the main program for the unit tests is built without debug info (it's built in one command without a separate link step). So as a workaround you could enable debug info for that. Usually everything has debug info or nothing does (this case can only happen with LTO) but clearly it should work, and it definitely seems to be an upstream bug.
ap...@google.com <ap...@google.com> #9
I'm happy to put the workaround in naclports, as long we don't loose track of this. Might be worth a test case?
ap...@google.com <ap...@google.com> #10
I'm definitely going to try to fix this, probably upstream first, and it will surely have a test case. It's a bit more complicated than I posted in #7 though, a simple test that has only that doesn't reproduce the problem, so I'm still trying build up from that rather than cut down from the test I posted. But adding -g to the rest of the files in the naclports build seems like a reasonable thing to do in any case.
ap...@google.com <ap...@google.com> #12
The following revision refers to this bug:
https://chromium.googlesource.com/native_client/src/native_client.git/+/3e51032a7156a948d03edcc4e4a919ace972becf
commit 3e51032a7156a948d03edcc4e4a919ace972becf
Author: Derek Schuff <dschuff@chromium.org>
Date: Wed Jun 24 16:33:19 2015
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
This pulls in the following LLVM changes:
44f58b6: (petar.jovanovic@rt-rk.com) [MIPS] Set pnacl-llc arguments for MIPS
74a458c: (petar.jovanovic@rt-rk.com) [MIPS] Force UseReadOnlyJumpTables to true for NaCl subtarget
d62b2e9: (kschimpf@google.com) Fix handling of TYPE_CODE_NUMENTRY record when size large.
9b9fd38: (kschimpf@google.com) Extend the munging bitcode records to generate text records.
3389b3d: (kschimpf@google.com) Modify pnacl-{llc,thaw} to read textual bitcode records.
93d4c96: (kschimpf@google.com) Make function readNaClRecordTextAndBuildBitcode public.
8457aca: (kschimpf@google.com) Fix error category handling in textual bitcode reader.
0606321: (jpp@chromium.org) Subzero. Adds x86-64 to the list of supported Subzero targets.
bf00952: (jpp@chromium.org) Removes x86_64 from ALL_TARGETS.
9ad211b: (dschuff@chromium.org) Stub out DISubprograms that point to functions without dbg attachments
BUG= arguments are wrong for MIPS
BUG=https://code.google.com/p/nativeclient/issues/detail?id=4195
BUG=https://code.google.com/p/nativeclient/issues/detail?id=4169
BUG=https://code.google.com/p/nativeclient/issues/detail?id=4211
BUG=https://code.google.com/p/nativeclient/issues/detail?id=4077
BUG=
BUG=https://code.google.com/p/nativeclient/issues/detail?id=4200
TEST= PNaCl toolchain trybots
R=jpp@chromium.org
Review URL:https://codereview.chromium.org/1203123002 .
[modify]http://crrev.com/3e51032a7156a948d03edcc4e4a919ace972becf/pnacl/COMPONENT_REVISIONS
commit 3e51032a7156a948d03edcc4e4a919ace972becf
Author: Derek Schuff <dschuff@chromium.org>
Date: Wed Jun 24 16:33:19 2015
PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
This pulls in the following LLVM changes:
44f58b6: (petar.jovanovic@rt-rk.com) [MIPS] Set pnacl-llc arguments for MIPS
74a458c: (petar.jovanovic@rt-rk.com) [MIPS] Force UseReadOnlyJumpTables to true for NaCl subtarget
d62b2e9: (kschimpf@google.com) Fix handling of TYPE_CODE_NUMENTRY record when size large.
9b9fd38: (kschimpf@google.com) Extend the munging bitcode records to generate text records.
3389b3d: (kschimpf@google.com) Modify pnacl-{llc,thaw} to read textual bitcode records.
93d4c96: (kschimpf@google.com) Make function readNaClRecordTextAndBuildBitcode public.
8457aca: (kschimpf@google.com) Fix error category handling in textual bitcode reader.
0606321: (jpp@chromium.org) Subzero. Adds x86-64 to the list of supported Subzero targets.
bf00952: (jpp@chromium.org) Removes x86_64 from ALL_TARGETS.
9ad211b: (dschuff@chromium.org) Stub out DISubprograms that point to functions without dbg attachments
BUG= arguments are wrong for MIPS
BUG=
BUG=
BUG=
BUG=
BUG=
BUG=
TEST= PNaCl toolchain trybots
R=jpp@chromium.org
Review URL:
[modify]
ap...@google.com <ap...@google.com> #13
The following revision refers to this bug:
https://chromium.googlesource.com/native_client/src/native_client.git/+/66c300e071cf3e1c1fb98f9a3e15bb02b4388d72
commit 66c300e071cf3e1c1fb98f9a3e15bb02b4388d72
Author: Derek Schuff <dschuff@chromium.org>
Date: Wed Jun 24 20:40:00 2015
Update revision for PNaCl
Update 287c0fffd7d3b7f38b887324f261ddb724d38f26 -> 3e51032a7156a948d03edcc4e4a919ace972becf
Pull the following PNaCl changes into NaCl:
3e51032: (dschuff@chromium.org) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
| 44f58b6: (petar.jovanovic@rt-rk.com) [MIPS] Set pnacl-llc arguments for MIPS
| 74a458c: (petar.jovanovic@rt-rk.com) [MIPS] Force UseReadOnlyJumpTables to true for NaCl subtarget
| d62b2e9: (kschimpf@google.com) Fix handling of TYPE_CODE_NUMENTRY record when size large.
| 9b9fd38: (kschimpf@google.com) Extend the munging bitcode records to generate text records.
| 3389b3d: (kschimpf@google.com) Modify pnacl-{llc,thaw} to read textual bitcode records.
| 93d4c96: (kschimpf@google.com) Make function readNaClRecordTextAndBuildBitcode public.
| 8457aca: (kschimpf@google.com) Fix error category handling in textual bitcode reader.
| 0606321: (jpp@chromium.org) Subzero. Adds x86-64 to the list of supported Subzero targets.
| bf00952: (jpp@chromium.org) Removes x86_64 from ALL_TARGETS.
| 9ad211b: (dschuff@chromium.org) Stub out DISubprograms that point to functions without dbg attachments
TBR=jfb@chromium.org
TEST=git cl try
(Please LGTM this change and tick the "commit" box)
BUG=https://code.google.com/p/nativeclient/issues/detail?id=4195
BUG=https://code.google.com/p/nativeclient/issues/detail?id=4169
BUG=https://code.google.com/p/nativeclient/issues/detail?id=4211
BUG=https://code.google.com/p/nativeclient/issues/detail?id=4077
BUG=https://code.google.com/p/nativeclient/issues/detail?id=4200
Review URL:https://codereview.chromium.org/1207713003 .
[modify]http://crrev.com/66c300e071cf3e1c1fb98f9a3e15bb02b4388d72/toolchain_revisions/pnacl_newlib.json
[modify]http://crrev.com/66c300e071cf3e1c1fb98f9a3e15bb02b4388d72/toolchain_revisions/pnacl_newlib_raw.json
[modify]http://crrev.com/66c300e071cf3e1c1fb98f9a3e15bb02b4388d72/toolchain_revisions/pnacl_translator.json
commit 66c300e071cf3e1c1fb98f9a3e15bb02b4388d72
Author: Derek Schuff <dschuff@chromium.org>
Date: Wed Jun 24 20:40:00 2015
Update revision for PNaCl
Update 287c0fffd7d3b7f38b887324f261ddb724d38f26 -> 3e51032a7156a948d03edcc4e4a919ace972becf
Pull the following PNaCl changes into NaCl:
3e51032: (dschuff@chromium.org) PNaCl: Update LLVM revision in pnacl/COMPONENT_REVISIONS
| 44f58b6: (petar.jovanovic@rt-rk.com) [MIPS] Set pnacl-llc arguments for MIPS
| 74a458c: (petar.jovanovic@rt-rk.com) [MIPS] Force UseReadOnlyJumpTables to true for NaCl subtarget
| d62b2e9: (kschimpf@google.com) Fix handling of TYPE_CODE_NUMENTRY record when size large.
| 9b9fd38: (kschimpf@google.com) Extend the munging bitcode records to generate text records.
| 3389b3d: (kschimpf@google.com) Modify pnacl-{llc,thaw} to read textual bitcode records.
| 93d4c96: (kschimpf@google.com) Make function readNaClRecordTextAndBuildBitcode public.
| 8457aca: (kschimpf@google.com) Fix error category handling in textual bitcode reader.
| 0606321: (jpp@chromium.org) Subzero. Adds x86-64 to the list of supported Subzero targets.
| bf00952: (jpp@chromium.org) Removes x86_64 from ALL_TARGETS.
| 9ad211b: (dschuff@chromium.org) Stub out DISubprograms that point to functions without dbg attachments
TBR=jfb@chromium.org
TEST=git cl try
(Please LGTM this change and tick the "commit" box)
BUG=
BUG=
BUG=
BUG=
BUG=
Review URL:
[modify]
[modify]
[modify]
ap...@google.com <ap...@google.com> #14
[Empty comment from Monorail migration]
ap...@google.com <ap...@google.com> #15
[Empty comment from Monorail migration]
ap...@google.com <ap...@google.com> #16
I'm using this bug as a tracking bug for the current set of naclports breakages. Once we fix all the blocking bugs here we can unpin the naclports builders.
ch...@google.com <ch...@google.com> #17
For the record, the original issue on this bug (with glibc-compat) is fixed. So that just leaves the ones that are blocked on this.
ap...@google.com <ap...@google.com> #18
To be fair the glibc-compat issues has a work around to always pass -g, so it wasn't really "fixed". (removing that would be good and might give you quicker repro case?)
ap...@google.com <ap...@google.com> #19
No, it should be actually fixed with LLVM rev 9ad211b4c050b9299081607978bda264046bd287. Let me double check that removing the -g in my local naclports works.
ap...@google.com <ap...@google.com> #20
[Empty comment from Monorail migration]
ap...@google.com <ap...@google.com> #21
I believe this is now fixed.
an...@google.com <an...@google.com> #22
This issue was migrated from crbug.com/nativeclient/4200?no_tracker_redirect=1
[Auto-CCs applied]
[Monorail components: PNaCl]
[Monorail blocked-on:crbug.com/nativeclient/4201 , crbug.com/nativeclient/4202 , crbug.com/nativeclient/4203 , crbug.com/nativeclient/4219 ]
[Monorail blocking:crbug.com/nativeclient/4149 ]
[Auto-CCs applied]
[Monorail components: PNaCl]
[Monorail blocked-on:
[Monorail blocking:
an...@google.com <an...@google.com> #23
The fixes for this issue are now also available in:
- Android Studio Meerkat | 2024.3.1 Patch 1
- Android Gradle Plugin 8.9.1
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Description
Summary
There is a problem with the R8 shrinker in versions 8.6., 8.7., and 8.8.0, where it improperly strips code related to Java Service Provider Interface (SPI) usage. This issue occurs when a class is provided via the Java SPI API using
ServiceLoader.load(SomeInterface.class)
without direct references from other code. While the service provider class is retained, some of its code is stripped, leading to runtime errors.Affected Versions
Description
The issue arises when using Java SPI to load service providers. Specifically, when a class is loaded using
ServiceLoader.load(SomeInterface.class)
and there are no direct references to it from other parts of the code, R8 retains the service provider class but strips some of its code. This results in aNullPointerException
(NPE) during runtime.Reproduction Steps
Set up a project with the following module structure:
Implement the following code:
MainActivity.kt in the
:app
module:Api.kt in the
:api
module:MyApi.kt in the
:provider
module:add the service provider file (named com.example.api.Spi) in src/main/resources/META-INF/service/ in the provider:
Configure the
build.gradle.kts
in the:app
module as follows:Build the project in release mode with R8 enabled.
Run the application and observe the
NullPointerException
whentestApi()
is called.Expected Behavior
The service provider class and its methods should be fully retained by R8, allowing the application to run without errors.
Actual Behavior
The service provider class is retained, but some of its code is stripped, leading to a
NullPointerException
during runtime.Additional Information
The full source code for reproducing this issue can be found at:https://github.com/zhcnxf/testagp87