Commit 3177b564 authored by David Mosberger's avatar David Mosberger

ia64: If GAS can handle .align inside code, enable it via TEXT_ALIGN().

parent 65e199f9
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# License. See the file "COPYING" in the main directory of this archive # License. See the file "COPYING" in the main directory of this archive
# for more details. # for more details.
# #
# Copyright (C) 1998-2003 by David Mosberger-Tang <davidm@hpl.hp.com> # Copyright (C) 1998-2004 by David Mosberger-Tang <davidm@hpl.hp.com>
# #
NM := $(CROSS_COMPILE)nm -B NM := $(CROSS_COMPILE)nm -B
...@@ -26,9 +26,8 @@ CFLAGS_KERNEL := -mconstant-gp ...@@ -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_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'.') 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)) GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas $(CC) $(OBJDUMP))
CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags $(CC) $(OBJDUMP) $(READELF))
CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags $(CC) $(OBJDUMP))
ifeq ($(GAS_STATUS),buggy) ifeq ($(GAS_STATUS),buggy)
$(error Sorry, you need a newer version of the assember, one that is built from \ $(error Sorry, you need a newer version of the assember, one that is built from \
......
...@@ -155,7 +155,7 @@ GLOBAL_ENTRY(__copy_user) ...@@ -155,7 +155,7 @@ GLOBAL_ENTRY(__copy_user)
mov ar.ec=2 mov ar.ec=2
(p10) br.dpnt.few .aligned_src_tail (p10) br.dpnt.few .aligned_src_tail
;; ;;
// .align 32 TEXT_ALIGN(32)
1: 1:
EX(.ex_handler, (p16) ld8 r34=[src0],16) EX(.ex_handler, (p16) ld8 r34=[src0],16)
EK(.ex_handler, (p16) ld8 r38=[src1],16) EK(.ex_handler, (p16) ld8 r38=[src1],16)
...@@ -312,7 +312,7 @@ EK(.ex_handler, (p[D]) st8 [dst1] = t15, 4*8) ...@@ -312,7 +312,7 @@ EK(.ex_handler, (p[D]) st8 [dst1] = t15, 4*8)
(p7) mov ar.lc = r21 (p7) mov ar.lc = r21
(p8) mov ar.lc = r0 (p8) mov ar.lc = r0
;; ;;
// .align 32 TEXT_ALIGN(32)
1: lfetch.fault [src_pre_mem], 128 1: lfetch.fault [src_pre_mem], 128
lfetch.fault.excl [dst_pre_mem], 128 lfetch.fault.excl [dst_pre_mem], 128
br.cloop.dptk.few 1b br.cloop.dptk.few 1b
...@@ -518,7 +518,7 @@ EK(.ex_handler, (p17) st8 [dst1]=r39,8); \ ...@@ -518,7 +518,7 @@ EK(.ex_handler, (p17) st8 [dst1]=r39,8); \
shrp r21=r22,r38,shift; /* speculative work */ \ shrp r21=r22,r38,shift; /* speculative work */ \
br.sptk.few .unaligned_src_tail /* branch out of jump table */ \ br.sptk.few .unaligned_src_tail /* branch out of jump table */ \
;; ;;
// .align 32 TEXT_ALIGN(32)
.jump_table: .jump_table:
COPYU(8) // unaligned cases COPYU(8) // unaligned cases
.jmp1: .jmp1:
......
...@@ -125,7 +125,7 @@ GLOBAL_ENTRY(memset) ...@@ -125,7 +125,7 @@ GLOBAL_ENTRY(memset)
(p_zr) br.cond.dptk.many .l1b // Jump to use stf.spill (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 { .mmi
and tmp = -(LINE_SIZE), cnt // compute end of range and tmp = -(LINE_SIZE), cnt // compute end of range
mov ptr9 = ptr1 // used for prefetching mov ptr9 = ptr1 // used for prefetching
...@@ -194,7 +194,7 @@ GLOBAL_ENTRY(memset) ...@@ -194,7 +194,7 @@ GLOBAL_ENTRY(memset)
br.cond.dpnt.many .move_bytes_from_alignment // Branch no. 3 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 .l1b: // ------------------------------------ // L1B: store ahead into cache lines; fill later
{ .mmi { .mmi
and tmp = -(LINE_SIZE), cnt // compute end of range and tmp = -(LINE_SIZE), cnt // compute end of range
...@@ -261,7 +261,7 @@ GLOBAL_ENTRY(memset) ...@@ -261,7 +261,7 @@ GLOBAL_ENTRY(memset)
and cnt = 0x1f, cnt // compute the remaining cnt and cnt = 0x1f, cnt // compute the remaining cnt
mov.i ar.lc = loopcnt mov.i ar.lc = loopcnt
;; } ;; }
// .align 32 TEXT_ALIGN(32)
.l2: // ------------------------------------ // L2A: store 32B in 2 cycles .l2: // ------------------------------------ // L2A: store 32B in 2 cycles
{ .mmb { .mmb
stf8 [ptr1] = fvalue, 8 stf8 [ptr1] = fvalue, 8
......
.proc foo
.prologue
foo: .save rp, r2
nop 0
.align 64
.endp foo
#!/bin/sh
# Usage: unwcheck.sh <executable_file_name>
# 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 "======================================"
}
'
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define _ASM_IA64_ASMMACRO_H #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 <davidm@hpl.hp.com> * David Mosberger-Tang <davidm@hpl.hp.com>
*/ */
...@@ -89,4 +89,15 @@ ...@@ -89,4 +89,15 @@
# define FSYS_RETURN br.ret.sptk.many b6 # define FSYS_RETURN br.ret.sptk.many b6
#endif #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 */ #endif /* _ASM_IA64_ASMMACRO_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment