~ubuntu-branches/ubuntu/wily/clamav/wily-proposed

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/lib/CodeGen/ObjectCodeEmitter.cpp

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Sebastian Andrzej Siewior, Andreas Cadhalpun, Scott Kitterman, Javier Fernández-Sanguino
  • Date: 2015-01-28 00:25:13 UTC
  • mfrom: (0.48.14 sid)
  • Revision ID: package-import@ubuntu.com-20150128002513-lil2oi74cooy4lzr
Tags: 0.98.6+dfsg-1
[ Sebastian Andrzej Siewior ]
* update "fix-ssize_t-size_t-off_t-printf-modifier", include of misc.h was
  missing but was pulled in via the systemd patch.
* Don't leak return codes from libmspack to clamav API. (Closes: #774686).

[ Andreas Cadhalpun ]
* Add patch to avoid emitting incremental progress messages when not
  outputting to a terminal. (Closes: #767350)
* Update lintian-overrides for unused-file-paragraph-in-dep5-copyright.
* clamav-base.postinst: always chown /var/log/clamav and /var/lib/clamav
  to clamav:clamav, not only on fresh installations. (Closes: #775400)
* Adapt the clamav-daemon and clamav-freshclam logrotate scripts,
  so that they correctly work under systemd.
* Move the PidFile variable from the clamd/freshclam configuration files
  to the init scripts. This makes the init scripts more robust against
  misconfiguration and avoids error messages with systemd. (Closes: #767353)
* debian/copyright: drop files from Files-Excluded only present in github
  tarballs
* Drop Workaround-a-bug-in-libc-on-Hurd.patch, because hurd got fixed.
  (see #752237)
* debian/rules: Remove useless --with-system-tommath --without-included-ltdl
  configure options.

[ Scott Kitterman ]
* Stop stripping llvm when repacking the tarball as the system llvm on some
  releases is too old to use
* New upstream bugfix release
  - Library shared object revisions.
  - Includes a patch from Sebastian Andrzej Siewior making ClamAV pid files
    compatible with systemd.
  - Fix a heap out of bounds condition with crafted Yoda's crypter files.
    This issue was discovered by Felix Groebert of the Google Security Team.
  - Fix a heap out of bounds condition with crafted mew packer files. This
    issue was discovered by Felix Groebert of the Google Security Team.
  - Fix a heap out of bounds condition with crafted upx packer files. This
    issue was discovered by Kevin Szkudlapski of Quarkslab.
  - Fix a heap out of bounds condition with crafted upack packer files. This
    issue was discovered by Sebastian Andrzej Siewior. CVE-2014-9328.
  - Compensate a crash due to incorrect compiler optimization when handling
    crafted petite packer files. This issue was discovered by Sebastian
    Andrzej Siewior.
* Update lintian override for embedded zlib to match new so version

[ Javier Fernández-Sanguino ]
* Updated Spanish Debconf template translation (Closes: #773563)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===-- llvm/CodeGen/ObjectCodeEmitter.cpp -------------------- -*- C++ -*-===//
 
2
//
 
3
//                     The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is distributed under the University of Illinois Open Source
 
6
// License. See LICENSE.TXT for details.
 
7
//
 
8
//===----------------------------------------------------------------------===//
 
9
 
 
10
#include "llvm/CodeGen/BinaryObject.h"
 
11
#include "llvm/CodeGen/MachineBasicBlock.h"
 
12
#include "llvm/CodeGen/MachineRelocation.h"
 
13
#include "llvm/CodeGen/ObjectCodeEmitter.h"
 
14
 
 
15
//===----------------------------------------------------------------------===//
 
16
//                       ObjectCodeEmitter Implementation
 
17
//===----------------------------------------------------------------------===//
 
18
 
 
19
namespace llvm {
 
20
 
 
21
ObjectCodeEmitter::ObjectCodeEmitter() : BO(0) {}
 
22
ObjectCodeEmitter::ObjectCodeEmitter(BinaryObject *bo) : BO(bo) {}
 
23
ObjectCodeEmitter::~ObjectCodeEmitter() {}
 
24
 
 
25
/// setBinaryObject - set the BinaryObject we are writting to
 
26
void ObjectCodeEmitter::setBinaryObject(BinaryObject *bo) { BO = bo; }
 
27
 
 
28
/// emitByte - This callback is invoked when a byte needs to be
 
29
/// written to the data stream, without buffer overflow testing.
 
30
void ObjectCodeEmitter::emitByte(uint8_t B) {
 
31
  BO->emitByte(B);
 
32
}
 
33
 
 
34
/// emitWordLE - This callback is invoked when a 32-bit word needs to be
 
35
/// written to the data stream in little-endian format.
 
36
void ObjectCodeEmitter::emitWordLE(uint32_t W) {
 
37
  BO->emitWordLE(W);
 
38
}
 
39
 
 
40
/// emitWordBE - This callback is invoked when a 32-bit word needs to be
 
41
/// written to the data stream in big-endian format.
 
42
void ObjectCodeEmitter::emitWordBE(uint32_t W) {
 
43
  BO->emitWordBE(W);
 
44
}
 
45
 
 
46
/// emitDWordLE - This callback is invoked when a 64-bit word needs to be
 
47
/// written to the data stream in little-endian format.
 
48
void ObjectCodeEmitter::emitDWordLE(uint64_t W) {
 
49
  BO->emitDWordLE(W);
 
50
}
 
51
 
 
52
/// emitDWordBE - This callback is invoked when a 64-bit word needs to be
 
53
/// written to the data stream in big-endian format.
 
54
void ObjectCodeEmitter::emitDWordBE(uint64_t W) {
 
55
  BO->emitDWordBE(W);
 
56
}
 
57
 
 
58
/// emitAlignment - Align 'BO' to the necessary alignment boundary.
 
59
void ObjectCodeEmitter::emitAlignment(unsigned Alignment /* 0 */,
 
60
                                      uint8_t fill /* 0 */) {
 
61
  BO->emitAlignment(Alignment, fill);
 
62
}
 
63
 
 
64
/// emitULEB128Bytes - This callback is invoked when a ULEB128 needs to be
 
65
/// written to the data stream.
 
66
void ObjectCodeEmitter::emitULEB128Bytes(uint64_t Value) {
 
67
  BO->emitULEB128Bytes(Value);
 
68
}
 
69
 
 
70
/// emitSLEB128Bytes - This callback is invoked when a SLEB128 needs to be
 
71
/// written to the data stream.
 
72
void ObjectCodeEmitter::emitSLEB128Bytes(uint64_t Value) {
 
73
  BO->emitSLEB128Bytes(Value);
 
74
}
 
75
 
 
76
/// emitString - This callback is invoked when a String needs to be
 
77
/// written to the data stream.
 
78
void ObjectCodeEmitter::emitString(const std::string &String) {
 
79
  BO->emitString(String);
 
80
}
 
81
 
 
82
/// getCurrentPCValue - This returns the address that the next emitted byte
 
83
/// will be output to.
 
84
uintptr_t ObjectCodeEmitter::getCurrentPCValue() const {
 
85
  return BO->getCurrentPCOffset();
 
86
}
 
87
 
 
88
/// getCurrentPCOffset - Return the offset from the start of the emitted
 
89
/// buffer that we are currently writing to.
 
90
uintptr_t ObjectCodeEmitter::getCurrentPCOffset() const {
 
91
  return BO->getCurrentPCOffset();
 
92
}
 
93
 
 
94
/// addRelocation - Whenever a relocatable address is needed, it should be
 
95
/// noted with this interface.
 
96
void ObjectCodeEmitter::addRelocation(const MachineRelocation& relocation) {
 
97
  BO->addRelocation(relocation);
 
98
}
 
99
 
 
100
/// StartMachineBasicBlock - This should be called by the target when a new
 
101
/// basic block is about to be emitted.  This way the MCE knows where the
 
102
/// start of the block is, and can implement getMachineBasicBlockAddress.
 
103
void ObjectCodeEmitter::StartMachineBasicBlock(MachineBasicBlock *MBB) {
 
104
  if (MBBLocations.size() <= (unsigned)MBB->getNumber())
 
105
    MBBLocations.resize((MBB->getNumber()+1)*2);
 
106
  MBBLocations[MBB->getNumber()] = getCurrentPCOffset();
 
107
}
 
108
 
 
109
/// getMachineBasicBlockAddress - Return the address of the specified
 
110
/// MachineBasicBlock, only usable after the label for the MBB has been
 
111
/// emitted.
 
112
uintptr_t
 
113
ObjectCodeEmitter::getMachineBasicBlockAddress(MachineBasicBlock *MBB) const {
 
114
  assert(MBBLocations.size() > (unsigned)MBB->getNumber() &&
 
115
         MBBLocations[MBB->getNumber()] && "MBB not emitted!");
 
116
  return MBBLocations[MBB->getNumber()];
 
117
}
 
118
 
 
119
/// getJumpTableEntryAddress - Return the address of the jump table with index
 
120
/// 'Index' in the function that last called initJumpTableInfo.
 
121
uintptr_t ObjectCodeEmitter::getJumpTableEntryAddress(unsigned Index) const {
 
122
  assert(JTLocations.size() > Index && "JT not emitted!");
 
123
  return JTLocations[Index];
 
124
}
 
125
 
 
126
/// getConstantPoolEntryAddress - Return the address of the 'Index' entry in
 
127
/// the constant pool that was last emitted with the emitConstantPool method.
 
128
uintptr_t ObjectCodeEmitter::getConstantPoolEntryAddress(unsigned Index) const {
 
129
  assert(CPLocations.size() > Index && "CP not emitted!");
 
130
  return CPLocations[Index];
 
131
}
 
132
 
 
133
/// getConstantPoolEntrySection - Return the section of the 'Index' entry in
 
134
/// the constant pool that was last emitted with the emitConstantPool method.
 
135
uintptr_t ObjectCodeEmitter::getConstantPoolEntrySection(unsigned Index) const {
 
136
  assert(CPSections.size() > Index && "CP not emitted!");
 
137
  return CPSections[Index];
 
138
}
 
139
 
 
140
} // end namespace llvm
 
141