@@ -282,7 +282,8 @@ class Writer {
282
282
uint32_t getSizeOfInitializedData ();
283
283
284
284
void prepareLoadConfig ();
285
- template <typename T> void prepareLoadConfig (T *loadConfig);
285
+ template <typename T>
286
+ void prepareLoadConfig (SymbolTable &symtab, T *loadConfig);
286
287
287
288
std::unique_ptr<FileOutputBuffer> &buffer;
288
289
std::map<PartialSectionKey, PartialSection *> partialSections;
@@ -2637,22 +2638,25 @@ void Writer::fixTlsAlignment() {
2637
2638
}
2638
2639
2639
2640
void Writer::prepareLoadConfig () {
2640
- if (!ctx.symtab .loadConfigSym )
2641
- return ;
2641
+ ctx.forEachSymtab ([&](SymbolTable &symtab) {
2642
+ if (!symtab.loadConfigSym )
2643
+ return ;
2642
2644
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 ());
2648
2648
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
+ });
2653
2656
}
2654
2657
2655
- template <typename T> void Writer::prepareLoadConfig (T *loadConfig) {
2658
+ template <typename T>
2659
+ void Writer::prepareLoadConfig (SymbolTable &symtab, T *loadConfig) {
2656
2660
size_t loadConfigSize = loadConfig->Size ;
2657
2661
2658
2662
#define RETURN_IF_NOT_CONTAINS (field ) \
@@ -2665,12 +2669,12 @@ template <typename T> void Writer::prepareLoadConfig(T *loadConfig) {
2665
2669
if (loadConfigSize >= offsetof (T, field) + sizeof (T::field))
2666
2670
2667
2671
#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))) \
2669
2673
if (loadConfig->field != ctx.config .imageBase + s->getRVA ()) \
2670
2674
Warn (ctx) << #field " not set correctly in '_load_config_used'" ;
2671
2675
2672
2676
#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))) \
2674
2678
if (loadConfig->field != s->getVA ()) \
2675
2679
Warn (ctx) << #field " not set correctly in '_load_config_used'" ;
2676
2680
0 commit comments