[llvm] 34b8daf - Revert "[llvm-objcopy] Fix --section-add when section contain empty bytes"
Douglas Yung via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 2 22:41:36 PST 2022
Author: Douglas Yung
Date: 2022-12-02T22:40:32-08:00
New Revision: 34b8daf4a817e69d996ca163c3a22bab46f58fa8
URL: https://github.com/llvm/llvm-project/commit/34b8daf4a817e69d996ca163c3a22bab46f58fa8
DIFF: https://github.com/llvm/llvm-project/commit/34b8daf4a817e69d996ca163c3a22bab46f58fa8.diff
LOG: Revert "[llvm-objcopy] Fix --section-add when section contain empty bytes"
This reverts commit 0041382198f20fe51d8574363bc91c317c7f3c71.
The test added is failing on Windows:
- https://lab.llvm.org/buildbot/#/builders/216/builds/13762
- https://lab.llvm.org/buildbot/#/builders/123/builds/14447
Added:
Modified:
llvm/lib/ObjCopy/wasm/WasmObjcopy.cpp
llvm/test/tools/llvm-objcopy/wasm/add-section.test
Removed:
################################################################################
diff --git a/llvm/lib/ObjCopy/wasm/WasmObjcopy.cpp b/llvm/lib/ObjCopy/wasm/WasmObjcopy.cpp
index 19f10bf4c8180..6877cd68bee47 100644
--- a/llvm/lib/ObjCopy/wasm/WasmObjcopy.cpp
+++ b/llvm/lib/ObjCopy/wasm/WasmObjcopy.cpp
@@ -126,11 +126,9 @@ static Error handleArgs(const CommonConfig &Config, Object &Obj) {
Sec.SectionType = llvm::wasm::WASM_SEC_CUSTOM;
Sec.Name = NewSection.SectionName;
- llvm::StringRef InputData =
- llvm::StringRef(NewSection.SectionData->getBufferStart(),
- NewSection.SectionData->getBufferSize());
std::unique_ptr<MemoryBuffer> BufferCopy = MemoryBuffer::getMemBufferCopy(
- InputData, NewSection.SectionData->getBufferIdentifier());
+ NewSection.SectionData->getBufferStart(),
+ NewSection.SectionData->getBufferIdentifier());
Sec.Contents = makeArrayRef<uint8_t>(
reinterpret_cast<const uint8_t *>(BufferCopy->getBufferStart()),
BufferCopy->getBufferSize());
diff --git a/llvm/test/tools/llvm-objcopy/wasm/add-section.test b/llvm/test/tools/llvm-objcopy/wasm/add-section.test
index 46bf4e95cb122..2f32eaca0ac46 100644
--- a/llvm/test/tools/llvm-objcopy/wasm/add-section.test
+++ b/llvm/test/tools/llvm-objcopy/wasm/add-section.test
@@ -20,17 +20,6 @@
# REPLACE: Name: foo
# REPLACE: Payload: 3132330A
-# Check that raw data bytes can be imported and exported unchanged especially the ones containing empty bytes.
-# RUN: echo -en '\x02\x01\x00\x01\x02' > %t6
-# RUN: llvm-objcopy --add-section=bar=%t6 %t %t7
-# RUN: llvm-objcopy --dump-section=bar=%t8 %t7
-# RUN:
diff %t8 %t6
-# RUN: obj2yaml %t7 | FileCheck %s --check-prefix=RAW-DATA
-
-# Check that raw data is well formated in the file as well.
-# RAW-DATA: Name: bar
-# RAW-DATA-NEXT: Payload: '0201000102'
-
--- !WASM
FileHeader:
Version: 0x00000001
More information about the llvm-commits
mailing list