- Generate __data_start symbol that marks the start of .data when __data_start is referenced from code being linked. - add .gnu.warning.SYMBOL support to ld.lld(1) Index: tools/lld/ELF/Symbols.h --- tools/lld/ELF/Symbols.h.orig +++ tools/lld/ELF/Symbols.h @@ -142,6 +142,9 @@ class Symbol { (public) // True if this symbol is specified by --trace-symbol option. uint8_t traced : 1; + // True if the .gnu.warning.SYMBOL is set for the symbol + uint8_t gwarn : 1; + inline void replace(const Symbol &newSym); bool includeInDynsym() const; @@ -247,7 +250,7 @@ class Symbol { (public) type(type), stOther(stOther), symbolKind(k), visibility(stOther & 3), isUsedInRegularObj(!file || file->kind() == InputFile::ObjKind), exportDynamic(isExportDynamic(k, visibility)), inDynamicList(false), - canInline(false), referenced(false), traced(false), needsPltAddr(false), + canInline(false), referenced(false), traced(false), gwarn(false), needsPltAddr(false), isInIplt(false), gotInIgot(false), isPreemptible(false), used(!config->gcSections), needsTocRestore(false), scriptDefined(false) {} @@ -436,6 +439,9 @@ struct ElfSym { // __bss_start static Defined *bss; + // __data_start + static Defined *data; + // etext and _etext static Defined *etext1; static Defined *etext2; @@ -557,6 +563,7 @@ void Symbol::replace(const Symbol &newSym) { canInline = old.canInline; referenced = old.referenced; traced = old.traced; + gwarn = old.gwarn; isPreemptible = old.isPreemptible; scriptDefined = old.scriptDefined; partition = old.partition; @@ -575,6 +582,8 @@ void Symbol::replace(const Symbol &newSym) { void maybeWarnUnorderableSymbol(const Symbol *sym); bool computeIsPreemptible(const Symbol &sym); void reportBackrefs(); + +extern llvm::DenseMap gnuWarnings; // A mapping from a symbol to an InputFile referencing it backward. Used by // --warn-backrefs.