Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
lld/ELF/InputSection.h
//===- InputSection.h -------------------------------------------*- C++ -*-===// | //===- InputSection.h -------------------------------------------*- C++ -*-===// | ||||
// | // | ||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||||
// See https://llvm.org/LICENSE.txt for license information. | // See https://llvm.org/LICENSE.txt for license information. | ||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||||
// | // | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
#ifndef LLD_ELF_INPUT_SECTION_H | #ifndef LLD_ELF_INPUT_SECTION_H | ||||
#define LLD_ELF_INPUT_SECTION_H | #define LLD_ELF_INPUT_SECTION_H | ||||
#include "Config.h" | |||||
#include "Relocations.h" | #include "Relocations.h" | ||||
#include "lld/Common/CommonLinkerContext.h" | #include "lld/Common/CommonLinkerContext.h" | ||||
#include "lld/Common/LLVM.h" | #include "lld/Common/LLVM.h" | ||||
#include "lld/Common/Memory.h" | #include "lld/Common/Memory.h" | ||||
#include "llvm/ADT/CachedHashString.h" | #include "llvm/ADT/CachedHashString.h" | ||||
#include "llvm/ADT/DenseSet.h" | #include "llvm/ADT/DenseSet.h" | ||||
#include "llvm/ADT/TinyPtrVector.h" | #include "llvm/ADT/TinyPtrVector.h" | ||||
#include "llvm/Object/ELF.h" | #include "llvm/Object/ELF.h" | ||||
▲ Show 20 Lines • Show All 290 Lines • ▼ Show 20 Lines | |||||
private: | private: | ||||
void splitStrings(StringRef s, size_t size); | void splitStrings(StringRef s, size_t size); | ||||
void splitNonStrings(ArrayRef<uint8_t> a, size_t size); | void splitNonStrings(ArrayRef<uint8_t> a, size_t size); | ||||
}; | }; | ||||
struct EhSectionPiece { | struct EhSectionPiece { | ||||
EhSectionPiece(size_t off, InputSectionBase *sec, uint32_t size, | EhSectionPiece(size_t off, InputSectionBase *sec, uint32_t size, | ||||
unsigned firstRelocation) | unsigned firstRelocation) | ||||
: inputOff(off), sec(sec), size(size), firstRelocation(firstRelocation) {} | : inputOff(off), sec(sec), size(size), live(!config->gcSections), | ||||
firstRelocation(firstRelocation) {} | |||||
ArrayRef<uint8_t> data() const { | ArrayRef<uint8_t> data() const { | ||||
return {sec->content().data() + this->inputOff, size}; | return {sec->content().data() + this->inputOff, size}; | ||||
} | } | ||||
size_t inputOff; | size_t inputOff; | ||||
ssize_t outputOff = -1; | ssize_t outputOff = -1; | ||||
InputSectionBase *sec; | InputSectionBase *sec; | ||||
uint32_t size; | uint32_t size : 31; | ||||
uint32_t live : 1; | |||||
unsigned firstRelocation; | unsigned firstRelocation; | ||||
}; | }; | ||||
// This corresponds to a .eh_frame section of an input file. | // This corresponds to a .eh_frame section of an input file. | ||||
class EhInputSection : public InputSectionBase { | class EhInputSection : public InputSectionBase { | ||||
public: | public: | ||||
template <class ELFT> | template <class ELFT> | ||||
EhInputSection(ObjFile<ELFT> &f, const typename ELFT::Shdr &header, | EhInputSection(ObjFile<ELFT> &f, const typename ELFT::Shdr &header, | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |