@@ -282,7 +282,8 @@ class Writer {
282282 uint32_t getSizeOfInitializedData ();
283283
284284 void prepareLoadConfig ();
285- template <typename T> void prepareLoadConfig (T *loadConfig);
285+ template <typename T>
286+ void prepareLoadConfig (SymbolTable &symtab, T *loadConfig);
286287
287288 std::unique_ptr<FileOutputBuffer> &buffer;
288289 std::map<PartialSectionKey, PartialSection *> partialSections;
@@ -2637,22 +2638,25 @@ void Writer::fixTlsAlignment() {
26372638}
26382639
26392640void Writer::prepareLoadConfig () {
2640- if (!ctx.symtab .loadConfigSym )
2641- return ;
2641+ ctx.forEachSymtab ([&](SymbolTable &symtab) {
2642+ if (!symtab.loadConfigSym )
2643+ return ;
26422644
2643- OutputSection *sec =
2644- ctx.getOutputSection (ctx.symtab .loadConfigSym ->getChunk ());
2645- uint8_t *secBuf = buffer->getBufferStart () + sec->getFileOff ();
2646- uint8_t *symBuf =
2647- secBuf + (ctx.symtab .loadConfigSym ->getRVA () - sec->getRVA ());
2645+ OutputSection *sec = ctx.getOutputSection (symtab.loadConfigSym ->getChunk ());
2646+ uint8_t *secBuf = buffer->getBufferStart () + sec->getFileOff ();
2647+ uint8_t *symBuf = secBuf + (symtab.loadConfigSym ->getRVA () - sec->getRVA ());
26482648
2649- if (ctx.config .is64 ())
2650- prepareLoadConfig (reinterpret_cast <coff_load_configuration64 *>(symBuf));
2651- else
2652- prepareLoadConfig (reinterpret_cast <coff_load_configuration32 *>(symBuf));
2649+ if (ctx.config .is64 ())
2650+ prepareLoadConfig (symtab,
2651+ reinterpret_cast <coff_load_configuration64 *>(symBuf));
2652+ else
2653+ prepareLoadConfig (symtab,
2654+ reinterpret_cast <coff_load_configuration32 *>(symBuf));
2655+ });
26532656}
26542657
2655- template <typename T> void Writer::prepareLoadConfig (T *loadConfig) {
2658+ template <typename T>
2659+ void Writer::prepareLoadConfig (SymbolTable &symtab, T *loadConfig) {
26562660 size_t loadConfigSize = loadConfig->Size ;
26572661
26582662#define RETURN_IF_NOT_CONTAINS (field ) \
@@ -2665,12 +2669,12 @@ template <typename T> void Writer::prepareLoadConfig(T *loadConfig) {
26652669 if (loadConfigSize >= offsetof (T, field) + sizeof (T::field))
26662670
26672671#define CHECK_VA (field, sym ) \
2668- if (auto *s = dyn_cast<DefinedSynthetic>(ctx. symtab .findUnderscore (sym))) \
2672+ if (auto *s = dyn_cast<DefinedSynthetic>(symtab.findUnderscore (sym))) \
26692673 if (loadConfig->field != ctx.config .imageBase + s->getRVA ()) \
26702674 Warn (ctx) << #field " not set correctly in '_load_config_used'" ;
26712675
26722676#define CHECK_ABSOLUTE (field, sym ) \
2673- if (auto *s = dyn_cast<DefinedAbsolute>(ctx. symtab .findUnderscore (sym))) \
2677+ if (auto *s = dyn_cast<DefinedAbsolute>(symtab.findUnderscore (sym))) \
26742678 if (loadConfig->field != s->getVA ()) \
26752679 Warn (ctx) << #field " not set correctly in '_load_config_used'" ;
26762680
0 commit comments