1 //===- SyntheticSections.cpp ---------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "SyntheticSections.h"
10 #include "Symbols.h"
11 
12 using namespace llvm::MachO;
13 
14 namespace lld {
15 namespace macho {
16 
17 GotSection::GotSection() {
18   segname = "__DATA_CONST";
19   name = "__got";
20   align = 8;
21   flags = S_NON_LAZY_SYMBOL_POINTERS;
22 
23   // TODO: section_64::reserved1 should be an index into the indirect symbol
24   // table, which we do not currently emit
25 }
26 
27 void GotSection::addEntry(DylibSymbol &sym) {
28   if (entries.insert(&sym)) {
29     sym.gotIndex = entries.size() - 1;
30   }
31 }
32 
33 InStruct in;
34 
35 } // namespace macho
36 } // namespace lld
37