@@ -94,6 +94,7 @@ void elf::errorOrWarn(const Twine &msg) {
94
94
void Ctx::reset () {
95
95
driver = LinkerDriver ();
96
96
script = nullptr ;
97
+ target = nullptr ;
97
98
98
99
bufferStart = nullptr ;
99
100
mainPart = nullptr ;
@@ -2065,13 +2066,13 @@ void LinkerDriver::inferMachineType() {
2065
2066
// each target.
2066
2067
static uint64_t getMaxPageSize (opt::InputArgList &args) {
2067
2068
uint64_t val = args::getZOptionValue (args, OPT_z, " max-page-size" ,
2068
- target->defaultMaxPageSize );
2069
+ ctx. target ->defaultMaxPageSize );
2069
2070
if (!isPowerOf2_64 (val)) {
2070
2071
error (" max-page-size: value isn't a power of 2" );
2071
- return target->defaultMaxPageSize ;
2072
+ return ctx. target ->defaultMaxPageSize ;
2072
2073
}
2073
2074
if (config->nmagic || config->omagic ) {
2074
- if (val != target->defaultMaxPageSize )
2075
+ if (val != ctx. target ->defaultMaxPageSize )
2075
2076
warn (" -z max-page-size set, but paging disabled by omagic or nmagic" );
2076
2077
return 1 ;
2077
2078
}
@@ -2082,13 +2083,13 @@ static uint64_t getMaxPageSize(opt::InputArgList &args) {
2082
2083
// each target.
2083
2084
static uint64_t getCommonPageSize (opt::InputArgList &args) {
2084
2085
uint64_t val = args::getZOptionValue (args, OPT_z, " common-page-size" ,
2085
- target->defaultCommonPageSize );
2086
+ ctx. target ->defaultCommonPageSize );
2086
2087
if (!isPowerOf2_64 (val)) {
2087
2088
error (" common-page-size: value isn't a power of 2" );
2088
- return target->defaultCommonPageSize ;
2089
+ return ctx. target ->defaultCommonPageSize ;
2089
2090
}
2090
2091
if (config->nmagic || config->omagic ) {
2091
- if (val != target->defaultCommonPageSize )
2092
+ if (val != ctx. target ->defaultCommonPageSize )
2092
2093
warn (" -z common-page-size set, but paging disabled by omagic or nmagic" );
2093
2094
return 1 ;
2094
2095
}
@@ -3106,9 +3107,9 @@ template <class ELFT> void LinkerDriver::link(opt::InputArgList &args) {
3106
3107
// The Target instance handles target-specific stuff, such as applying
3107
3108
// relocations or writing a PLT section. It also contains target-dependent
3108
3109
// values such as a default image base address.
3109
- target = getTarget ();
3110
+ ctx. target = getTarget ();
3110
3111
3111
- config->eflags = target->calcEFlags ();
3112
+ config->eflags = ctx. target ->calcEFlags ();
3112
3113
// maxPageSize (sometimes called abi page size) is the maximum page size that
3113
3114
// the output can be run on. For example if the OS can use 4k or 64k page
3114
3115
// sizes then maxPageSize must be 64k for the output to be useable on both.
0 commit comments