You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The input ELF file has been compiled for multiple targets(spir64_x86_64 and spir64_fpga) therefore, it includes __CLANG_OFFLOAD_BUNDLE__sycl-spir64_x86_64 section and __CLANG_OFFLOAD_BUNDLE__sycl-spir64_fpga section.
To remove one of the sections, llvm-objcopy --remove-section _CLANG... has been typed. As a result of readelf -SWl I can check the section has been removed.
I expected the reduced size of the ELF file would be decreasing as the size of the section(about 91.5KB) but, only a few hundred Bytes has been reduced.
I'm new to handle ELF files and binutils. Any suggestions for using binutils properly or any hints to fix this problem are welcome. Thank you.
To Reproduce
$clang++ -fsycl -fsycl-targets=spir64_x86_64,spir64_fpga simple.cpp -o simple
#simple.cpp from https://intel.github.io/llvm-docs/GetStartedGuide.html#run-simple-dpc-application
$ls -l
... 276960 ... simple # size of simple
$readelf -SWl simple
Section Headers:
[17] __CLANG_OFFLOAD_BUNDLE__sycl-spir64_fpga ... 0165c0 ... # size of the section
$llvm-objcopy --remove-section __CLANG_OFFLOAD_BUNDLE__sycl-spir64_fpga simple
$readelf -SWl simple
...
... # __CLANG_OFFLOAD_BUNDLE__sycl-spir64_fpga section has been removed from "Section Headers" and "Section to Segment mapping"
$ls -l
... 276808 ... simple # size of simple(the section removed)
I expected the size of simple would be reduced as 0x0165c0(size of the section) but only 152B.
Environment (please complete the following information):
OS: Ubuntu 18.04 (5.4.0.-86-generic)
Target device and vendor: Intel CPU and Intel FPGA emulation
Dependencies version:
for Intel CPU: oclcpuexp_2021.12.6.0.19
for Intel FPGA emulation: oclfpgaemu_2021.12.6.0.19
Additional context
I tested on previous DPC++ version matches above CPU and FPGA emulation runtimes too.
I tried using other binutils such as objcopy(v2.30), strip(v.2.30, tried to remove the section after change flag to unload) and objcopy --update-section with a zero-sized file.
I'm guessing the command removes only the section header. After trying to remove the section, there are no changes to the offset of the next section header(in this example .eh_frame_hdr).
This discussion was converted from issue #4767 on October 15, 2021 12:55.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Describe the bug
The input ELF file has been compiled for multiple targets(spir64_x86_64 and spir64_fpga) therefore, it includes __CLANG_OFFLOAD_BUNDLE__sycl-spir64_x86_64 section and __CLANG_OFFLOAD_BUNDLE__sycl-spir64_fpga section.
To remove one of the sections, llvm-objcopy --remove-section _CLANG... has been typed. As a result of readelf -SWl I can check the section has been removed.
I expected the reduced size of the ELF file would be decreasing as the size of the section(about 91.5KB) but, only a few hundred Bytes has been reduced.
I'm new to handle ELF files and binutils. Any suggestions for using binutils properly or any hints to fix this problem are welcome. Thank you.
To Reproduce
$clang++ -fsycl -fsycl-targets=spir64_x86_64,spir64_fpga simple.cpp -o simple
#simple.cpp from https://intel.github.io/llvm-docs/GetStartedGuide.html#run-simple-dpc-application
$ls -l
... 276960 ... simple # size of simple
$readelf -SWl simple
Section Headers:
[17] __CLANG_OFFLOAD_BUNDLE__sycl-spir64_fpga ... 0165c0 ... # size of the section
$llvm-objcopy --remove-section __CLANG_OFFLOAD_BUNDLE__sycl-spir64_fpga simple
$readelf -SWl simple
...
... # __CLANG_OFFLOAD_BUNDLE__sycl-spir64_fpga section has been removed from "Section Headers" and "Section to Segment mapping"
$ls -l
... 276808 ... simple # size of simple(the section removed)
I expected the size of simple would be reduced as 0x0165c0(size of the section) but only 152B.
Environment (please complete the following information):
for Intel CPU: oclcpuexp_2021.12.6.0.19
for Intel FPGA emulation: oclfpgaemu_2021.12.6.0.19
Additional context
I tested on previous DPC++ version matches above CPU and FPGA emulation runtimes too.
I tried using other binutils such as objcopy(v2.30), strip(v.2.30, tried to remove the section after change flag to unload) and objcopy --update-section with a zero-sized file.
I'm guessing the command removes only the section header. After trying to remove the section, there are no changes to the offset of the next section header(in this example .eh_frame_hdr).
Beta Was this translation helpful? Give feedback.
All reactions