1#!/bin/sh 2# Translate the assembler syntax of s390/s390x assembler programs 3# Usage: asm-s390.sh < s390linux-asm-file > portable-asm-file 4# The portable-asm-file has to be 5# 1. preprocessed, 6# 2. grep -v '^ *#line' | grep -v '^#' 7# 3. sed -e 's,% ,%,g' -e 's,//.*$,,' 8 9# Copyright (C) 2017 Bruno Haible <bruno@clisp.org> 10# 11# This program is free software: you can redistribute it and/or modify 12# it under the terms of the GNU General Public License as published by 13# the Free Software Foundation; either version 2 of the License, or 14# (at your option) any later version. 15# 16# This program is distributed in the hope that it will be useful, 17# but WITHOUT ANY WARRANTY; without even the implied warranty of 18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19# GNU General Public License for more details. 20# 21# You should have received a copy of the GNU General Public License 22# along with this program. If not, see <https://www.gnu.org/licenses/>. 23 24tmpscript1=sed$$tmp1 25tmpscript2=sed$$tmp2 26tmpremove='rm -f $tmpscript1 $tmpscript2' 27trap "$tmpremove" 1 2 15 28 29cat > $tmpscript1 << \EOF 30# ----------- Remove gcc self-identification 31/gcc2_compiled/d 32/gnu_compiled_c/d 33/\.ident/d 34EOF 35 36cat > $tmpscript2 << \EOF 37# ----------- Introduce macro syntax for assembler pseudo-ops 38/\.section\([ ]\+\).*GNU-stack/d 39EOF 40 41sed -f $tmpscript1 | \ 42sed -f $tmpscript2 43 44eval "$tmpremove" 45