RFR: 8308031: Linkers should reject unpromoted variadic parameters [v6]
Jorn Vernee
jvernee at openjdk.org
Fri Jun 2 15:16:28 UTC 2023
> In C, arguments smaller than `int` are promoted to (`unsigned`) `int`, and `float` is promoted to `double`, when being passed as variadic argument (see e.g. https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions). This patch restricts the layouts that can be used as variadic layouts to what is allowed by the C specification.
>
> The fallback linker is also updated to use to correct function to link variadic calls (not doing this turned out not to be a problem so far, but it is problematic for instance on Mac/AArch64 when using the fallback linker). Adding the restriction on layouts for all linkers is also partly motivated by the fallback linker rejecting such unsupported variadic layouts already.
>
> I've added a small paragraph to the Linker javadoc as well that explains the restriction. Comments on that are welcome, but please explain.
>
> The tests are updated to no longer try to link variadic functions with the illegal layouts, and I've added some more negative tests to TestIllegalLink.
>
> Testing:
> - local testing on Windows/x64
> - tier1-3 + jdk-tier5 (ongoing)
> - manual test run on mac/aarch64 with the fallback linker to verify the correctness of the fallback linker changes.
Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:
- Merge branch 'master' into VAFixes
- undo spurious whitespace changes
- automatically apply variadic promotions
- move prototype-less name
- Rework javadoc
- review comments
- fix word order
- adjust whitespace
- simplify test changes
- reject invalid variadic layouts
- ... and 1 more: https://git.openjdk.org/jdk/compare/ad4d487a...9daadbfc
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/14225/files
- new: https://git.openjdk.org/jdk/pull/14225/files/38d759d6..9daadbfc
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=05
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=14225&range=04-05
Stats: 16078 lines in 335 files changed: 13372 ins; 1441 del; 1265 mod
Patch: https://git.openjdk.org/jdk/pull/14225.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/14225/head:pull/14225
PR: https://git.openjdk.org/jdk/pull/14225
More information about the core-libs-dev
mailing list