This is an archive of the discontinued LLVM Phabricator instance.

[lld][WebAssembly] Fix func reloc for internal GOT with extended-const
ClosedPublic

Authored by yamt on Jul 17 2023, 9:23 PM.

Diff Detail

Event Timeline

yamt created this revision.Jul 17 2023, 9:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 9:23 PM
yamt requested review of this revision.Jul 17 2023, 9:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 9:23 PM
yamt added a reviewer: sbc100.Jul 17 2023, 9:24 PM
sbc100 added inline comments.Jul 24 2023, 9:30 AM
lld/wasm/SyntheticSections.cpp
525

Can we combine these two blocks into a single if (config->extendedConst && config->isPic) block that handles these? (since they share most of the code).

Also, shouldn't there be a corresponding change to __wasm_apply_global_relocs to avoid applying a relocation?

Also, can you add a test for this (I would imagine by modifying lld/test/wasm/pie.ll perhaps?

yamt added inline comments.Jul 24 2023, 8:39 PM
lld/wasm/SyntheticSections.cpp
525

Can we combine these two blocks into a single if (config->extendedConst && config->isPic) block that handles these? (since they share most of the code).

ok

Also, shouldn't there be a corresponding change to __wasm_apply_global_relocs to avoid applying a relocation?

that part is already done. that's why it's broken and i noticed it.

Also, can you add a test for this (I would imagine by modifying lld/test/wasm/pie.ll perhaps?

ok. i will try.

yamt updated this revision to Diff 543927.Jul 25 2023, 4:57 AM

reduce code dup, add test

yamt marked an inline comment as done.Jul 25 2023, 4:58 AM
yamt updated this revision to Diff 543929.Jul 25 2023, 5:02 AM

fix test

sbc100 added inline comments.Jul 25 2023, 5:10 AM
lld/test/wasm/Inputs/internal_func.ll
11 ↗(On Diff #543929)

For new test files could you add them as .s files? I've been trying to convert all the .ll files for .s over time but have yet to finish that work.

It should be that same or fewer lines I think.

lld/test/wasm/pie.ll
39

Why define two different internal funcs?

lld/wasm/SyntheticSections.cpp
488

llvm coding style uses camel case for locals so this would be useExtendedConst and globalIdx

yamt added inline comments.Jul 25 2023, 5:39 AM
lld/test/wasm/Inputs/internal_func.ll
11 ↗(On Diff #543929)

ok

lld/test/wasm/pie.ll
39

because one of them happened to have offset 0.

lld/wasm/SyntheticSections.cpp
488

ok

yamt updated this revision to Diff 543940.Jul 25 2023, 5:52 AM

rename variables, convert to .s

yamt marked 2 inline comments as done.Jul 25 2023, 5:52 AM
sbc100 accepted this revision.Jul 25 2023, 5:57 AM
This revision is now accepted and ready to land.Jul 25 2023, 5:57 AM
yamt updated this revision to Diff 544266.Jul 26 2023, 2:15 AM

apply clang-format

Do you have llvm commit permissions or should I land this for you?

yamt added a comment.Jul 26 2023, 9:36 PM

Do you have llvm commit permissions or should I land this for you?

i don't have any permissions on this repo.