Skip to content

Commit

Permalink
Remove a hack around an LLVM bug
Browse files Browse the repository at this point in the history
This has since been fixed in rust-lang/rust#52506
  • Loading branch information
alexcrichton committed Aug 25, 2018
1 parent 8ce7465 commit 4f4da74
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions crates/cli-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ fn extract_programs(module: &mut Module) -> Result<Vec<shared::Program>, Error>
to_remove.push(i);

let mut payload = custom.payload();
let mut added_programs = Vec::new();
while payload.len() > 0 {
let len = ((payload[0] as usize) << 0)
| ((payload[1] as usize) << 8)
Expand All @@ -330,19 +329,6 @@ fn extract_programs(module: &mut Module) -> Result<Vec<shared::Program>, Error>
let (a, b) = payload[4..].split_at(len as usize);
payload = b;

// Due to a nasty LLVM bug it's currently possible for LLVM to
// duplicate custom section directives in intermediate object files.
// This means that we could see multiple program directives when in
// fact we were originally only meant to see one!
//
// Work around the issue here until the upstream bug,
// https://bugs.llvm.org/show_bug.cgi?id=38184, is hopefully fixed
// via some other means.
if added_programs.iter().any(|p| a == *p) {
continue
}
added_programs.push(a);

let p: shared::ProgramOnlySchema = match serde_json::from_slice(&a) {
Ok(f) => f,
Err(e) => bail!("failed to decode what looked like wasm-bindgen data: {}", e),
Expand Down

0 comments on commit 4f4da74

Please sign in to comment.