From 3177b564b376d08046be4edb494fdad27a0de659 Mon Sep 17 00:00:00 2001 From: David Mosberger Date: Thu, 15 Jan 2004 01:51:32 -0800 Subject: [PATCH] ia64: If GAS can handle .align inside code, enable it via TEXT_ALIGN(). --- arch/ia64/Makefile | 7 +- arch/ia64/lib/memcpy_mck.S | 6 +- arch/ia64/lib/memset.S | 6 +- arch/ia64/scripts/check-text-align.S | 6 ++ arch/ia64/scripts/unwcheck.sh | 109 --------------------------- include/asm-ia64/asmmacro.h | 13 +++- 6 files changed, 27 insertions(+), 120 deletions(-) create mode 100644 arch/ia64/scripts/check-text-align.S delete mode 100755 arch/ia64/scripts/unwcheck.sh diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile index eed40027bb3db..a174cc5c62723 100644 --- a/arch/ia64/Makefile +++ b/arch/ia64/Makefile @@ -5,7 +5,7 @@ # License. See the file "COPYING" in the main directory of this archive # for more details. # -# Copyright (C) 1998-2003 by David Mosberger-Tang +# Copyright (C) 1998-2004 by David Mosberger-Tang # NM := $(CROSS_COMPILE)nm -B @@ -26,9 +26,8 @@ CFLAGS_KERNEL := -mconstant-gp GCC_VERSION=$(shell $(CC) -v 2>&1 | fgrep 'gcc version' | cut -f3 -d' ' | cut -f1 -d'.') GCC_MINOR_VERSION=$(shell $(CC) -v 2>&1 | fgrep 'gcc version' | cut -f3 -d' ' | cut -f2 -d'.') -GAS_STATUS=$(shell $(srctree)/arch/ia64/scripts/check-gas $(CC) $(OBJDUMP)) - -CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags $(CC) $(OBJDUMP)) +GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas $(CC) $(OBJDUMP)) +CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags $(CC) $(OBJDUMP) $(READELF)) ifeq ($(GAS_STATUS),buggy) $(error Sorry, you need a newer version of the assember, one that is built from \ diff --git a/arch/ia64/lib/memcpy_mck.S b/arch/ia64/lib/memcpy_mck.S index 76eb542fd7591..b1f806a7dbe7a 100644 --- a/arch/ia64/lib/memcpy_mck.S +++ b/arch/ia64/lib/memcpy_mck.S @@ -155,7 +155,7 @@ GLOBAL_ENTRY(__copy_user) mov ar.ec=2 (p10) br.dpnt.few .aligned_src_tail ;; -// .align 32 + TEXT_ALIGN(32) 1: EX(.ex_handler, (p16) ld8 r34=[src0],16) EK(.ex_handler, (p16) ld8 r38=[src1],16) @@ -312,7 +312,7 @@ EK(.ex_handler, (p[D]) st8 [dst1] = t15, 4*8) (p7) mov ar.lc = r21 (p8) mov ar.lc = r0 ;; -// .align 32 + TEXT_ALIGN(32) 1: lfetch.fault [src_pre_mem], 128 lfetch.fault.excl [dst_pre_mem], 128 br.cloop.dptk.few 1b @@ -518,7 +518,7 @@ EK(.ex_handler, (p17) st8 [dst1]=r39,8); \ shrp r21=r22,r38,shift; /* speculative work */ \ br.sptk.few .unaligned_src_tail /* branch out of jump table */ \ ;; -// .align 32 + TEXT_ALIGN(32) .jump_table: COPYU(8) // unaligned cases .jmp1: diff --git a/arch/ia64/lib/memset.S b/arch/ia64/lib/memset.S index 350663bcb9cab..bd8cf907fe227 100644 --- a/arch/ia64/lib/memset.S +++ b/arch/ia64/lib/memset.S @@ -125,7 +125,7 @@ GLOBAL_ENTRY(memset) (p_zr) br.cond.dptk.many .l1b // Jump to use stf.spill ;; } -// .align 32 // -------------------------- // L1A: store ahead into cache lines; fill later + TEXT_ALIGN(32) // --------------------- // L1A: store ahead into cache lines; fill later { .mmi and tmp = -(LINE_SIZE), cnt // compute end of range mov ptr9 = ptr1 // used for prefetching @@ -194,7 +194,7 @@ GLOBAL_ENTRY(memset) br.cond.dpnt.many .move_bytes_from_alignment // Branch no. 3 ;; } -// .align 32 + TEXT_ALIGN(32) .l1b: // ------------------------------------ // L1B: store ahead into cache lines; fill later { .mmi and tmp = -(LINE_SIZE), cnt // compute end of range @@ -261,7 +261,7 @@ GLOBAL_ENTRY(memset) and cnt = 0x1f, cnt // compute the remaining cnt mov.i ar.lc = loopcnt ;; } -// .align 32 + TEXT_ALIGN(32) .l2: // ------------------------------------ // L2A: store 32B in 2 cycles { .mmb stf8 [ptr1] = fvalue, 8 diff --git a/arch/ia64/scripts/check-text-align.S b/arch/ia64/scripts/check-text-align.S new file mode 100644 index 0000000000000..03f586abb7345 --- /dev/null +++ b/arch/ia64/scripts/check-text-align.S @@ -0,0 +1,6 @@ + .proc foo + .prologue +foo: .save rp, r2 + nop 0 + .align 64 + .endp foo diff --git a/arch/ia64/scripts/unwcheck.sh b/arch/ia64/scripts/unwcheck.sh deleted file mode 100755 index cf61dd42cba2f..0000000000000 --- a/arch/ia64/scripts/unwcheck.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/sh -# Usage: unwcheck.sh -# Pre-requisite: readelf [from Gnu binutils package] -# Purpose: Check the following invariant -# For each code range in the input binary: -# Sum[ lengths of unwind regions] = Number of slots in code range. -# Author : Harish Patil -# First version: January 2002 -# Modified : 2/13/2002 -# Modified : 3/15/2002: duplicate detection -readelf -u $1 | gawk '\ - function todec(hexstr){ - dec = 0; - l = length(hexstr); - for (i = 1; i <= l; i++) - { - c = substr(hexstr, i, 1); - if (c == "A") - dec = dec*16 + 10; - else if (c == "B") - dec = dec*16 + 11; - else if (c == "C") - dec = dec*16 + 12; - else if (c == "D") - dec = dec*16 + 13; - else if (c == "E") - dec = dec*16 + 14; - else if (c == "F") - dec = dec*16 + 15; - else - dec = dec*16 + c; - } - return dec; - } - BEGIN { first = 1; sum_rlen = 0; no_slots = 0; errors=0; no_code_ranges=0; } - { - if (NF==5 && $3=="info") - { - no_code_ranges += 1; - if (first == 0) - { - if (sum_rlen != no_slots) - { - print full_code_range; - print " ", "lo = ", lo, " hi =", hi; - print " ", "sum_rlen = ", sum_rlen, "no_slots = " no_slots; - print " "," ", "*******ERROR ***********"; - print " "," ", "sum_rlen:", sum_rlen, " != no_slots:" no_slots; - errors += 1; - } - sum_rlen = 0; - } - full_code_range = $0; - code_range = $2; - gsub("..$", "", code_range); - gsub("^.", "", code_range); - split(code_range, addr, "-"); - lo = toupper(addr[1]); - - code_range_lo[no_code_ranges] = addr[1]; - occurs[addr[1]] += 1; - full_range[addr[1]] = $0; - - gsub("0X.[0]*", "", lo); - hi = toupper(addr[2]); - gsub("0X.[0]*", "", hi); - no_slots = (todec(hi) - todec(lo))/ 16*3 - first = 0; - } - if (index($0,"rlen") > 0 ) - { - rlen_str = substr($0, index($0,"rlen")); - rlen = rlen_str; - gsub("rlen=", "", rlen); - gsub(")", "", rlen); - sum_rlen = sum_rlen + rlen; - } - } - END { - if (first == 0) - { - if (sum_rlen != no_slots) - { - print "code_range=", code_range; - print " ", "lo = ", lo, " hi =", hi; - print " ", "sum_rlen = ", sum_rlen, "no_slots = " no_slots; - print " "," ", "*******ERROR ***********"; - print " "," ", "sum_rlen:", sum_rlen, " != no_slots:" no_slots; - errors += 1; - } - } - no_duplicates = 0; - for (i=1; i<=no_code_ranges; i++) - { - cr = code_range_lo[i]; - if (reported_cr[cr]==1) continue; - if ( occurs[cr] > 1) - { - reported_cr[cr] = 1; - print "Code range low ", code_range_lo[i], ":", full_range[cr], " occurs: ", occurs[cr], " times."; - print " "; - no_duplicates++; - } - } - print "======================================" - print "Total errors:", errors, "/", no_code_ranges, " duplicates:", no_duplicates; - print "======================================" - } - ' diff --git a/include/asm-ia64/asmmacro.h b/include/asm-ia64/asmmacro.h index 9618467c930a4..25eb686b02c31 100644 --- a/include/asm-ia64/asmmacro.h +++ b/include/asm-ia64/asmmacro.h @@ -2,7 +2,7 @@ #define _ASM_IA64_ASMMACRO_H /* - * Copyright (C) 2000-2001, 2003 Hewlett-Packard Co + * Copyright (C) 2000-2001, 2003-2004 Hewlett-Packard Co * David Mosberger-Tang */ @@ -89,4 +89,15 @@ name: # define FSYS_RETURN br.ret.sptk.many b6 #endif +/* + * Up until early 2004, use of .align within a function caused bad unwind info. + * TEXT_ALIGN(n) expands into ".align n" if a fixed GAS is available or into nothing + * otherwise. + */ +#ifdef HAVE_WORKING_TEXT_ALIGN +# define TEXT_ALIGN(n) .align n +#else +# define TEXT_ALIGN(n) +#endif + #endif /* _ASM_IA64_ASMMACRO_H */ -- 2.53.0