Space for the personality routine pointer in the unwind info was allocated unconditionally so far. Since a large part of assembly sources are likely to not make use of personality routines, this patch tries to avoid wasting the space. Built and tested on ia64-unknown-linux-gnu. Jan gas/ 2005-01-24 Jan Beulich * config/tc-ia64.c (ia64_estimate_size_before_relax): Allocate space for personality routine pointer only if there is one. (ia64_convert_frag): Likewise. (generate_unwind_image): Likewise. ld/testsuite/ 2005-01-24 Jan Beulich * ld/ia64/tlsbin.[rt]d: Widen expected offset/size ranges. * ld/ia64/tlspic.[rt]d: Likewise. --- /home/jbeulich/src/binutils/mainline/2005-01-24.08.40/gas/config/tc-ia64.c 2005-01-18 10:43:33.000000000 +0100 +++ 2005-01-24.08.40/gas/config/tc-ia64.c 2005-01-24 12:36:50.207668370 +0100 @@ -2863,8 +2863,11 @@ ia64_estimate_size_before_relax (fragS * pad = len % md.pointer_size; if (pad != 0) len += md.pointer_size - pad; - /* Add 8 for the header + a pointer for the personality offset. */ - size = len + 8 + md.pointer_size; + /* Add 8 for the header. */ + size = len + 8; + /* Add a pointer for the personality offset. */ + if (frag->fr_offset) + size += md.pointer_size; /* fr_var carries the max_chars that we created the fragment with. We must, of course, have allocated enough memory earlier. */ @@ -2891,8 +2894,11 @@ ia64_convert_frag (fragS *frag) pad = len % md.pointer_size; if (pad != 0) len += md.pointer_size - pad; - /* Add 8 for the header + a pointer for the personality offset. */ - size = len + 8 + md.pointer_size; + /* Add 8 for the header. */ + size = len + 8; + /* Add a pointer for the personality offset. */ + if (frag->fr_offset) + size += md.pointer_size; /* fr_var carries the max_chars that we created the fragment with. We must, of course, have allocated enough memory earlier. */ @@ -3454,9 +3460,11 @@ generate_unwind_image (const segT text_s pad = size % md.pointer_size; if (pad != 0) size += md.pointer_size - pad; - /* Add 8 for the header + a pointer for the personality - offset. */ - size += 8 + md.pointer_size; + /* Add 8 for the header. */ + size += 8; + /* Add a pointer for the personality offset. */ + if (unwind.personality_routine) + size += md.pointer_size; } /* If there are unwind records, switch sections, and output the info. */ --- /home/jbeulich/src/binutils/mainline/2005-01-24.08.40/ld/testsuite/ld-ia64/tlsbin.rd 2004-11-02 17:16:18.000000000 +0100 +++ 2005-01-24.08.40/ld/testsuite/ld-ia64/tlsbin.rd 2005-01-24 13:17:55.398067859 +0100 @@ -20,9 +20,9 @@ Section Headers: \[ 8\] .text +PROGBITS +40+1000 0+1000 0+140 00 +AX +0 +0 4096 \[ 9\] .IA_64.unwind_inf +.* \[10\] .IA_64.unwind +.* - \[11\] .tdata +PROGBITS +60+1170 0+1170 0+60 00 WAT +0 +0 +4 - \[12\] .tbss +NOBITS +60+11d0 0+11d0 0+40 00 WAT +0 +0 +1 - \[13\] .dynamic +DYNAMIC +60+11d0 0+11d0 0+150 10 +WA +4 +0 +8 + \[11\] .tdata +PROGBITS +60+1[0-9a-f]+ 0+1[0-9a-f]+ 0+60 00 WAT +0 +0 +4 + \[12\] .tbss +NOBITS +60+1[0-9a-f]+ 0+1[0-9a-f]+ 0+40 00 WAT +0 +0 +1 + \[13\] .dynamic +DYNAMIC +60+1[0-9a-f]+ 0+1[0-9a-f]+ 0+150 10 +WA +4 +0 +8 \[14\] .data +.* \[15\] .got +PROGBITS +60+2000 0+2000 0+48 00 WAp +0 +0 +8 \[16\] .IA_64.pltoff +.* @@ -42,10 +42,10 @@ Program Headers: PHDR +0x0+40 0x40+40 0x40+40 0x0+188 0x0+188 R E 0x8 INTERP +0x0+1c8 0x40+1c8 0x40+1c8 0x[0-9a-f]+ 0x[0-9a-f]+ R +0x1 .*Requesting program interpreter.* - LOAD +0x0+ 0x40+ 0x40+ 0x0+1170 0x0+1170 R E 0x10000 - LOAD +0x0+1170 0x60+1170 0x60+1170 0x0+ef0 0x0+ef0 RW +0x10000 - DYNAMIC +0x0+11d0 0x60+11d0 0x60+11d0 0x0+150 0x0+150 RW +0x8 - TLS +0x0+1170 0x60+1170 0x60+1170 0x0+60 0x0+a0 R +0x4 + LOAD +0x0+ 0x40+ 0x40+ 0x0+1[0-9a-f]+ 0x0+1[0-9a-f]+ R E 0x10000 + LOAD +0x0+1[0-9a-f]+ 0x60+1[0-9a-f]+ 0x60+1[0-9a-f]+ 0x0+0[0-9a-f]+ 0x0+0[0-9a-f]+ RW +0x10000 + DYNAMIC +0x0+1[0-9a-f]+ 0x60+1[0-9a-f]+ 0x60+1[0-9a-f]+ 0x0+150 0x0+150 RW +0x8 + TLS +0x0+1[0-9a-f]+ 0x60+1[0-9a-f]+ 0x60+1[0-9a-f]+ 0x0+60 0x0+a0 R +0x4 IA_64_UNWIND .* R +0x8 #... @@ -62,7 +62,7 @@ Relocation section '.rela.IA_64.pltoff' Symbol table '.dynsym' contains 8 entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name +0: 0+ +0 NOTYPE +LOCAL +DEFAULT +UND * - +1: 60+11d0 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC + +1: 60+1[0-9a-f]+ +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC +2: 0+ +0 TLS +GLOBAL DEFAULT +UND sG2 +3: 0+ +16 FUNC +GLOBAL DEFAULT +UND __tls_get_addr +4: [0-9a-f]+ +0 NOTYPE +GLOBAL DEFAULT +ABS __bss_start @@ -114,7 +114,7 @@ Symbol table '.symtab' contains 72 entri +39: 0+7c +0 TLS +GLOBAL DEFAULT +12 bg8 +40: 0+74 +0 TLS +GLOBAL DEFAULT +12 bg6 +41: 0+68 +0 TLS +GLOBAL DEFAULT +12 bg3 - +42: 60+11d0 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC + +42: 60+1[0-9a-f]+ +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC +43: 0+8 +0 TLS +GLOBAL DEFAULT +11 sg3 +44: 0+48 +0 TLS +GLOBAL HIDDEN +11 sh3 +45: 0+ +0 TLS +GLOBAL DEFAULT +UND sG2 --- /home/jbeulich/src/binutils/mainline/2005-01-24.08.40/ld/testsuite/ld-ia64/tlsbin.td 2004-05-11 19:08:36.000000000 +0200 +++ 2005-01-24.08.40/ld/testsuite/ld-ia64/tlsbin.td 2005-01-24 13:18:27.175411220 +0100 @@ -8,9 +8,9 @@ .*: +file format elf..-ia64-.* Contents of section .tdata: - (60+)?1170 11000000 12000000 13000000 14000000 .* - (60+)?1180 15000000 16000000 17000000 18000000 .* - (60+)?1190 41000000 42000000 43000000 44000000 .* - (60+)?11a0 45000000 46000000 47000000 48000000 .* - (60+)?11b0 01010000 02010000 03010000 04010000 .* - (60+)?11c0 05010000 06010000 07010000 08010000 .* + (60+)?1[0-9a-f]+ 11000000 12000000 13000000 14000000 .* + (60+)?1[0-9a-f]+ 15000000 16000000 17000000 18000000 .* + (60+)?1[0-9a-f]+ 41000000 42000000 43000000 44000000 .* + (60+)?1[0-9a-f]+ 45000000 46000000 47000000 48000000 .* + (60+)?1[0-9a-f]+ 01010000 02010000 03010000 04010000 .* + (60+)?1[0-9a-f]+ 05010000 06010000 07010000 08010000 .* --- /home/jbeulich/src/binutils/mainline/2005-01-24.08.40/ld/testsuite/ld-ia64/tlspic.rd 2004-11-02 17:16:18.000000000 +0100 +++ 2005-01-24.08.40/ld/testsuite/ld-ia64/tlspic.rd 2005-01-24 13:13:58.548461385 +0100 @@ -19,9 +19,9 @@ Section Headers: \[ 7\] .text +PROGBITS +0+1000 0+1000 0+110 00 +AX +0 +0 4096 \[ 8\] .IA_64.unwind_inf +.* \[ 9\] .IA_64.unwind +.* - \[10\] .tdata +PROGBITS +0+11140 0+1140 0+60 00 WAT +0 +0 +4 - \[11\] .tbss +NOBITS +0+111a0 0+11a0 0+20 00 WAT +0 +0 +1 - \[12\] .dynamic +DYNAMIC +0+111a0 0+11a0 0+140 10 +WA +3 +0 +8 + \[10\] .tdata +PROGBITS +0+11[0-9a-f]+ 0+1[0-9a-f]+ 0+60 00 WAT +0 +0 +4 + \[11\] .tbss +NOBITS +0+11[0-9a-f]+ 0+1[0-9a-f]+ 0+20 00 WAT +0 +0 +1 + \[12\] .dynamic +DYNAMIC +0+11[0-9a-f]+ 0+1[0-9a-f]+ 0+140 10 +WA +3 +0 +8 \[13\] .data +.* \[14\] .got +PROGBITS +0+12000 0+2000 0+50 00 WAp +0 +0 +8 \[15\] .IA_64.pltoff +.* @@ -39,11 +39,11 @@ There are 5 program headers, starting at Program Headers: Type +Offset +VirtAddr +PhysAddr +FileSiz +MemSiz +Flg Align - LOAD +0x0+ 0x0+ 0x0+ 0x0+1140 0x0+1140 R E 0x10000 - LOAD +0x0+1140 0x0+11140 0x0+11140 0x0+f20 0x0+f20 RW +0x10000 - DYNAMIC +0x0+11a0 0x0+111a0 0x0+111a0 0x0+140 0x0+140 RW +0x8 - TLS +0x0+1140 0x0+11140 0x0+11140 0x0+60 0x0+80 R +0x4 - IA_64_UNWIND +0x0+1128 0x0+1128 0x0+1128 0x0+18 0x0+18 R +0x8 + LOAD +0x0+ 0x0+ 0x0+ 0x0+1[0-9a-f]+ 0x0+1[0-9a-f]+ R E 0x10000 + LOAD +0x0+1[0-9a-f]+ 0x0+11[0-9a-f]+ 0x0+11[0-9a-f]+ 0x0+0[0-9a-f]+ 0x0+0[0-9a-f]+ RW +0x10000 + DYNAMIC +0x0+1[0-9a-f]+ 0x0+11[0-9a-f]+ 0x0+11[0-9a-f]+ 0x0+140 0x0+140 RW +0x8 + TLS +0x0+1[0-9a-f]+ 0x0+11[0-9a-f]+ 0x0+11[0-9a-f]+ 0x0+60 0x0+80 R +0x4 + IA_64_UNWIND +0x0+1[0-9a-f]+ 0x0+1[0-9a-f]+ 0x0+1[0-9a-f]+ 0x0+18 0x0+18 R +0x8 #... Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 6 entries: @@ -71,7 +71,7 @@ Symbol table '.dynsym' contains 23 entri +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +15 * +[0-9]+: [0-9a-f]+ +0 SECTION LOCAL +DEFAULT +17 * +[0-9]+: 0+1c +0 TLS +GLOBAL DEFAULT +10 sg8 - +[0-9]+: 0+111a0 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC + +[0-9]+: 0+11[0-9a-f]+ +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC +[0-9]+: 0+8 +0 TLS +GLOBAL DEFAULT +10 sg3 +[0-9]+: 0+c +0 TLS +GLOBAL DEFAULT +10 sg4 +[0-9]+: 0+10 +0 TLS +GLOBAL DEFAULT +10 sg5 @@ -134,7 +134,7 @@ Symbol table '.symtab' contains 60 entri +[0-9]+: 0+44 +0 TLS +LOCAL +HIDDEN +10 sh2 +[0-9]+: 0+54 +0 TLS +LOCAL +HIDDEN +10 sh6 +[0-9]+: 0+1c +0 TLS +GLOBAL DEFAULT +10 sg8 - +[0-9]+: 0+111a0 +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC + +[0-9]+: 0+11[0-9a-f]+ +0 OBJECT +GLOBAL DEFAULT +ABS _DYNAMIC +[0-9]+: 0+8 +0 TLS +GLOBAL DEFAULT +10 sg3 +[0-9]+: 0+c +0 TLS +GLOBAL DEFAULT +10 sg4 +[0-9]+: 0+10 +0 TLS +GLOBAL DEFAULT +10 sg5 --- /home/jbeulich/src/binutils/mainline/2005-01-24.08.40/ld/testsuite/ld-ia64/tlspic.td 2004-05-11 19:08:36.000000000 +0200 +++ 2005-01-24.08.40/ld/testsuite/ld-ia64/tlspic.td 2005-01-24 13:15:01.177366868 +0100 @@ -8,9 +8,9 @@ .*: +file format elf..-ia64-.* Contents of section .tdata: - 11140 11000000 12000000 13000000 14000000 .* - 11150 15000000 16000000 17000000 18000000 .* - 11160 41000000 42000000 43000000 44000000 .* - 11170 45000000 46000000 47000000 48000000 .* - 11180 01010000 02010000 03010000 04010000 .* - 11190 05010000 06010000 07010000 08010000 .* + 11[0-9a-f]+ 11000000 12000000 13000000 14000000 .* + 11[0-9a-f]+ 15000000 16000000 17000000 18000000 .* + 11[0-9a-f]+ 41000000 42000000 43000000 44000000 .* + 11[0-9a-f]+ 45000000 46000000 47000000 48000000 .* + 11[0-9a-f]+ 01010000 02010000 03010000 04010000 .* + 11[0-9a-f]+ 05010000 06010000 07010000 08010000 .*