This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Emit only one error if -z max-page-size without value
ClosedPublic

Authored by jhenderson on Jun 15 2017, 3:52 AM.

Details

Summary

In rL305364, @ruiu changed the mechanism that parses -z option values slightly. This caused a bug, as demonstrated by this test, which now fails:

# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
# RUN: ld.lld %t.o -o %t -z max-page-size

.global _start
_start:
  nop

Before, the link succeeded and set the max-page-size to the target default.

After we get the following two error messages:
"invalid max-page-size: "
"max-page-size: value isn't a power of 2" (because an uninitialised variable ends up being passed back to getMaxPageSize).

I think we should have the first error, but not the second, as demonstrated by the new test in this change.

Diff Detail

Event Timeline

jhenderson created this revision.Jun 15 2017, 3:52 AM
ruiu accepted this revision.Jun 15 2017, 11:18 AM

LGTM

This revision is now accepted and ready to land.Jun 15 2017, 11:18 AM
This revision was automatically updated to reflect the committed changes.