[ELF][MIPS] Do not use 'sed' to modify binary files

On Windows different versions of 'sed' work in different text/binary
mode by default. If default mode is text, sed produces corrupted binary
files. Unfortunately there is no standard command line option to select
the mode. Some 'sed' support '-b' to switch to binary mode, while other
ones support '--text' option and does not have '-b' option at all.

llvm-svn: 257471
This commit is contained in:
Simon Atanasyan 2016-01-12 12:38:43 +00:00
parent 6abd69a60b
commit 49f98c742c
3 changed files with 3 additions and 14 deletions

View File

@ -1,8 +0,0 @@
# We cannot create a shared library with defined _gp_disp symbol
# so we use a workaround - create a library with XXXXXXXX symbols
# and use 'sed' to replace it by _gp_disp right in the binary file.
.data
.globl XXXXXXXX
.space 16
XXXXXXXX:
.space 4

Binary file not shown.

View File

@ -1,14 +1,11 @@
# Check that even if _gp_disp symbol is defined in the shared library
# we use our own value.
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux \
# RUN: %S/Inputs/mips-gp-disp-def.s -o %t-ext.o
# RUN: ld.lld -shared -o %t-ext-int.so %t-ext.o
# RUN: sed -e 's/XXXXXXXX/_gp_disp/g' %t-ext-int.so > %t-ext.so
# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t.o
# RUN: ld.lld -shared -o %t.so %t.o %t-ext.so
# RUN: ld.lld -shared -o %t.so %t.o %S/Inputs/mips-gp-disp.so
# RUN: llvm-readobj -symbols %t.so | FileCheck -check-prefix=INT-SO %s
# RUN: llvm-readobj -symbols %t-ext.so | FileCheck -check-prefix=EXT-SO %s
# RUN: llvm-readobj -symbols %S/Inputs/mips-gp-disp.so \
# RUN: | FileCheck -check-prefix=EXT-SO %s
# RUN: llvm-objdump -d -t %t.so | FileCheck -check-prefix=DIS %s
# REQUIRES: mips