[PATCH] D38360: [ELF] Set Dot initially to --image-base value when using linker scripts
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 4 09:50:55 PDT 2017
ruiu added inline comments.
================
Comment at: ELF/Config.h:176-177
uint64_t ErrorLimit = 20;
uint64_t ImageBase;
+ uint64_t InitialDot;
uint64_t MaxPageSize;
----------------
So, now you have two variables for the image base. Their valid combinations are:
- ImageBase has value N, and InitialDot also has N. This happens only when you explicitly passed an -image-base.
- ImageBase has value N, and InitialDot has 0. This happens only when you didn't pass an -image-base.
Other combinations are all invalid. That means you are effectively using InitiaDot as a boolean variable. It doesn't have to be an integer, and to convey the intention how it is used, it should be a boolean.
I'd make these changes:
- Change the type of ImageBase from uint64_t to Optional<uint64_t>, and set a value only when an -image-base is given.
- Define a function, getImageBase, which returns either Config->ImageBase or Target->DefaultImageBase.
https://reviews.llvm.org/D38360
More information about the llvm-commits
mailing list