Skip to content

Commit

Permalink
cleaning some code and adding travis
Browse files Browse the repository at this point in the history
  • Loading branch information
snf committed Mar 16, 2016
1 parent fcab1ae commit eead999
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
before_script:
- sudo add-apt-repository "deb https://llvm.org/apt/trusty/ llvm-toolchain-trusty main" -y
- sudo apt-get update -q
- sudo apt-get install -y g++ libz-dev libedit-dev

language: rust
rust:
- stable
- beta
- nightly
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn main() {
if let Ok(v) = env::var("LLVM_CONFIG") {
v
} else {
"/home/asdf/local/3.8/bin/llvm-config".to_string()
"llvm-config-3.8".to_string()
}
};

Expand Down
26 changes: 2 additions & 24 deletions src/c/assemble.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

using namespace llvm;

// Utils to evaluate MCExpr with Symbol

typedef struct {
StringRef name;
uint64_t addr;
Expand Down Expand Up @@ -183,20 +181,11 @@ class MCBinaryStreamer: public MCStreamer {
return false;
}

// FIXME: We need target hooks for the evaluation. It may be limited in
// width, and gas defines the result of comparisons differently from
// Apple as.
switch (ABE->getOpcode()) {
case MCBinaryExpr::AShr: *res = LHS >> RHS; break;
case MCBinaryExpr::Add: *res = LHS + RHS; break;
case MCBinaryExpr::And: *res = LHS & RHS; break;
case MCBinaryExpr::Div:
// Handle division by zero. gas just emits a warning and keeps going,
// we try to be stricter.
// FIXME: Currently the caller of this function has no way to understand
// we're bailing out because of 'division by zero'. Therefore, it will
// emit a 'expected relocatable expression' error. It would be nice to
// change this code to emit a better diagnostic.
if (RHS == 0)
return false;
*res = LHS / RHS;
Expand Down Expand Up @@ -227,13 +216,6 @@ class MCBinaryStreamer: public MCStreamer {
}

void FinishImpl() {
// for (Label label: VLabels) {
// OS << "fixing label: " << label.name;
// OS << " offset: " << label.offset;
// OS << "\n";
// }
// OS << "finishing!";
//AsmBackend->getFixupKindInfo(F.getKind())
for (VFixup vfixup: VFixups) {
OS << "fixing: " << *vfixup.fixup.getValue()
<< " offset: " << vfixup.fixup.getOffset()
Expand Down Expand Up @@ -279,12 +261,6 @@ class MCBinaryStreamer: public MCStreamer {
for (unsigned i = 0, e = Code.size() * 8; i != e; ++i)
FixupMap[i] = 0;

// if (Fixups.size() != 0 || Code.size() == 0) {
// std::cerr << std::endl << "fixups!" << std::endl;
// *Failed = true;
// return;
// }

for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
// Check
MCFixup &F = Fixups[i];
Expand Down Expand Up @@ -356,6 +332,7 @@ class MCBinaryStreamer: public MCStreamer {
}
OS << "]\n";

// Print the Fixups information
for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
MCFixup &F = Fixups[i];
const MCFixupKindInfo &Info = AsmBackend->getFixupKindInfo(F.getKind());
Expand Down Expand Up @@ -538,6 +515,7 @@ static int assemble_llvm(StringRef &arch, StringRef &input_str, uint64_t address
out_bytes, &failed));

int Res = 1;

// XXX_ remember the last arg is only for X86
Res = AssembleInput(TheTarget, SrcMgr, Ctx, *Str, *MAI, *STI,
*MCII, MCOptions, 1);
Expand Down

0 comments on commit eead999

Please sign in to comment.