1// Check that COFF section names are properly encoded. 2// 3// Encodings for different lengths: 4// [0, 8]: raw name 5// (8, 999999]: base 10 string table index (/9999999) 6// (999999, 0xFFFFFFFF]: base 64 string table index (//AAAAAA) 7// 8// RUN: llvm-mc -triple x86_64-pc-win32 -filetype=obj %s | llvm-readobj -s | FileCheck %s 9 10// Raw encoding 11 12// CHECK: Section { 13// CHECK: Number: 4 14// CHECK: Name: s (73 00 00 00 00 00 00 00) 15// CHECK: } 16// CHECK: Section { 17// CHECK: Number: 5 18// CHECK: Name: s1234567 (73 31 32 33 34 35 36 37) 19// CHECK: } 20.section s; .long 1 21.section s1234567; .long 1 22 23 24// Base 10 encoding 25 26// /4 27// CHECK: Section { 28// CHECK: Number: 6 29// CHECK: Name: s12345678 (2F 34 00 00 00 00 00 00) 30// CHECK: } 31.section s12345678; .long 1 32 33 34// Generate padding sections to increase the string table size to at least 35// 1,000,000 bytes. 36.macro pad_sections2 pad 37 // 10x \pad 38 .section p0\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad; .long 1 39 .section p1\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad; .long 1 40 .section p2\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad; .long 1 41 .section p3\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad; .long 1 42 .section p4\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad; .long 1 43.endm 44 45.macro pad_sections pad 46 // 20x \pad 47 pad_sections2 \pad\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad\pad 48.endm 49 50// 1000x 'a' 51pad_sections aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 52 53 54// /1000029 == 4 + 10 + (5 * (2 + (20 * 10 * 1000) + 1)) 55// v | | v ~~~~~~~~~~~~~~ v 56// table size v v "p0" pad NUL separator 57// "s12345678\0" # of pad sections 58// 59// CHECK: Section { 60// CHECK: Number: 12 61// CHECK: Name: seven_digit (2F 31 30 30 30 30 32 39) 62// CHECK: } 63.section seven_digit; .long 1 64 65 66// Generate padding sections to increase the string table size to at least 67// 10,000,000 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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 75 76 77// //AAmJa4 == 1000029 + 12 + (5 * (2 + (9 * 20 * 10 * 1000) + 1)) == 38*64^3 + 9*64^2 + 26*64 + 56 78// v | | v ~~~~~~~~~~~~~~~~~~ v 79// seven_digit offset v v "p0" pad NUL separator 80// "seven_digit\0" # of pad sections 81// 82// "2F 2F 41 41 6D 4A 61 34" is "//AAmJa4", which decodes to "0 0 38 9 26 56". 83// 84// CHECK: Section { 85// CHECK: Number: 18 86// CHECK: Name: double_slash (2F 2F 41 41 6D 4A 61 34) 87// CHECK: } 88.section double_slash; .long 1 89