@@ -241,7 +241,6 @@ class Writer {
241
241
void addSyntheticIdata ();
242
242
void fixPartialSectionChars (StringRef name, uint32_t chars);
243
243
bool fixGnuImportChunks ();
244
- void fixTlsAlignment ();
245
244
PartialSection *createPartialSection (StringRef name, uint32_t outChars);
246
245
PartialSection *findPartialSection (StringRef name, uint32_t outChars);
247
246
@@ -268,7 +267,6 @@ class Writer {
268
267
DelayLoadContents delayIdata;
269
268
EdataContents edata;
270
269
bool setNoSEHCharacteristic = false ;
271
- uint32_t tlsAlignment = 0 ;
272
270
273
271
DebugDirectoryChunk *debugDirectory = nullptr ;
274
272
std::vector<std::pair<COFF::DebugType, Chunk *>> debugRecords;
@@ -635,11 +633,6 @@ void Writer::run() {
635
633
writeSections ();
636
634
sortExceptionTable ();
637
635
638
- // Fix up the alignment in the TLS Directory's characteristic field,
639
- // if a specific alignment value is needed
640
- if (tlsAlignment)
641
- fixTlsAlignment ();
642
-
643
636
t1.stop ();
644
637
645
638
if (!config->pdbPath .empty () && config->debug ) {
@@ -873,10 +866,6 @@ void Writer::createSections() {
873
866
StringRef name = c->getSectionName ();
874
867
if (shouldStripSectionSuffix (sc, name))
875
868
name = name.split (' $' ).first ;
876
-
877
- if (name.startswith (" .tls" ))
878
- tlsAlignment = std::max (tlsAlignment, c->getAlignment ());
879
-
880
869
PartialSection *pSec = createPartialSection (name,
881
870
c->getOutputCharacteristics ());
882
871
pSec->chunks .push_back (c);
@@ -2049,33 +2038,3 @@ PartialSection *Writer::findPartialSection(StringRef name, uint32_t outChars) {
2049
2038
return it->second ;
2050
2039
return nullptr ;
2051
2040
}
2052
-
2053
- void Writer::fixTlsAlignment () {
2054
- Defined *tlsSym =
2055
- dyn_cast_or_null<Defined>(symtab->findUnderscore (" _tls_used" ));
2056
- if (!tlsSym)
2057
- return ;
2058
-
2059
- OutputSection *sec = tlsSym->getChunk ()->getOutputSection ();
2060
- assert (sec && tlsSym->getRVA () >= sec->getRVA () &&
2061
- " no output section for _tls_used" );
2062
-
2063
- uint8_t *secBuf = buffer->getBufferStart () + sec->getFileOff ();
2064
- uint64_t tlsOffset = tlsSym->getRVA () - sec->getRVA ();
2065
- uint64_t directorySize = config->is64 ()
2066
- ? sizeof (object::coff_tls_directory64)
2067
- : sizeof (object::coff_tls_directory32);
2068
-
2069
- if (tlsOffset + directorySize > sec->getRawSize ())
2070
- fatal (" _tls_used sym is malformed" );
2071
-
2072
- if (config->is64 ()) {
2073
- object::coff_tls_directory64 *tlsDir =
2074
- reinterpret_cast <object::coff_tls_directory64 *>(&secBuf[tlsOffset]);
2075
- tlsDir->setAlignment (tlsAlignment);
2076
- } else {
2077
- object::coff_tls_directory32 *tlsDir =
2078
- reinterpret_cast <object::coff_tls_directory32 *>(&secBuf[tlsOffset]);
2079
- tlsDir->setAlignment (tlsAlignment);
2080
- }
2081
- }
0 commit comments