-
Marcus Comstedt authored
Apple's linker performs by-content merges of string constants in the magical "cstring" section. We do not want this to happen to _master_location since we modify it later, which would also modify any merged strings. The "cstring" section is only supposed to contain values following C string syntax, i.e. any number of non-NUL bytes followed by a single NUL byte. So actually _master_location should already be disqualified from placement in this section since it has MAXPATHLEN NUL bytes at the end instead of just one. However, in the case of const char[] variables initialized from a string literal there is a bug/misfeature in gcc that it only considers the literal, not the initialized variable as a whole. Thus, we need to add at least one of the extra NUL bytes to the string literal for gcc to do the right thing. This does not change the actual variable value in any way.
Marcus Comstedt authoredApple's linker performs by-content merges of string constants in the magical "cstring" section. We do not want this to happen to _master_location since we modify it later, which would also modify any merged strings. The "cstring" section is only supposed to contain values following C string syntax, i.e. any number of non-NUL bytes followed by a single NUL byte. So actually _master_location should already be disqualified from placement in this section since it has MAXPATHLEN NUL bytes at the end instead of just one. However, in the case of const char[] variables initialized from a string literal there is a bug/misfeature in gcc that it only considers the literal, not the initialized variable as a whole. Thus, we need to add at least one of the extra NUL bytes to the string literal for gcc to do the right thing. This does not change the actual variable value in any way.