Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1203)

Issue 1694663002: PNaCl dynamic linking: Fix handling of local relocations with addends (Closed)

Created:
4 years, 10 months ago by Mark Seaborn
Modified:
4 years, 10 months ago
Reviewers:
Petr Hosek
CC:
native-client-reviews_googlegroups.com, Sean Klein
Base URL:
https://chromium.googlesource.com/native_client/pnacl-llvm@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

PNaCl dynamic linking: Fix handling of local relocations with addends While testing ConvertToPSO on newlib's libc.a, I found that the pass didn't work on relocations with addends that refer to module-local variables. The reason is that we're running FlattenGlobals twice (once in "-convert-to-pso" and once in "-pnacl-abi-simplify-postopt"), but FlattenGlobals isn't idempotent for this case. FlattenGlobals can handle a getelementptr as input, but it converts it to ptrtoint+add, which it doesn't handle. Fix this by changing FlattenGlobals to handle "add" ConstantExprs. Testing: * convert-to-pso.ll: Test this end-to-end. * flatten-globals.ll: Check this specific case, and check idempotence in general. The latter requires that we use getSExtValue() (sign-extending) rather than getZExtValue() (zero-extending), otherwise the negative-addend test fails with "FlattenGlobals: Offset does not fit into 32 bits". BUG=https://bugs.chromium.org/p/nativeclient/issues/detail?id=4351 TEST=test/Transforms/NaCl/*.ll R=phosek@chromium.org Committed: https://chromium.googlesource.com/native_client/pnacl-llvm/+/aa09f2c4ce3ced974ef25e004106345daaaebd04

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -1 line) Patch
M lib/Transforms/NaCl/FlattenGlobals.cpp View 1 chunk +4 lines, -1 line 0 comments Download
M test/Transforms/NaCl/convert-to-pso.ll View 1 chunk +2 lines, -0 lines 0 comments Download
M test/Transforms/NaCl/flatten-globals.ll View 2 chunks +6 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (3 generated)
Mark Seaborn
4 years, 10 months ago (2016-02-12 19:19:16 UTC) #3
Petr Hosek
lgtm
4 years, 10 months ago (2016-02-12 19:55:48 UTC) #4
Mark Seaborn
4 years, 10 months ago (2016-02-12 22:17:39 UTC) #6
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
aa09f2c4ce3ced974ef25e004106345daaaebd04 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698