summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/OrderPass.h
blob: 74bddc8acb4ce80af0b02d6e311cbb472c1f9533 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//===- lib/ReaderWriter/ELF/OrderPass.h -----------------------------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLD_READER_WRITER_ELF_ORDER_PASS_H
#define LLD_READER_WRITER_ELF_ORDER_PASS_H

#include "lld/Core/Parallel.h"
#include <limits>

namespace lld {
namespace elf {

/// \brief This pass sorts atoms by file and atom ordinals.
class OrderPass : public Pass {
public:
  void perform(std::unique_ptr<SimpleFile> &file) override {
    parallel_sort(file->definedAtoms().begin(), file->definedAtoms().end(),
                  DefinedAtom::compareByPosition);
  }
};
}
}

#endif
OpenPOWER on IntegriCloud