diff options
| author | Ingo Molnar <mingo@elte.hu> | 2011-05-18 13:46:10 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2011-05-18 13:46:10 -0400 |
| commit | af2d03d4aaa847ef41a229dfee098a47908437c6 (patch) | |
| tree | 5f97d5dfe21ba056f8d638622a415e3c4a287fa0 /scripts | |
| parent | 94692349c4fc1bc74c19a28f9379509361a06a3b (diff) | |
| parent | f29638868280534ed7e2fdd93b31557232597940 (diff) | |
Merge branch 'tip/perf/core-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into perf/core
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Makefile.build | 5 | ||||
| -rw-r--r-- | scripts/recordmcount.c | 168 | ||||
| -rw-r--r-- | scripts/recordmcount.h | 174 | ||||
| -rwxr-xr-x | scripts/recordmcount.pl | 5 |
4 files changed, 261 insertions, 91 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index d5f925abe4d2..fdca952f6a40 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
| @@ -244,13 +244,16 @@ endif | |||
| 244 | 244 | ||
| 245 | ifdef CONFIG_FTRACE_MCOUNT_RECORD | 245 | ifdef CONFIG_FTRACE_MCOUNT_RECORD |
| 246 | ifdef BUILD_C_RECORDMCOUNT | 246 | ifdef BUILD_C_RECORDMCOUNT |
| 247 | ifeq ("$(origin RECORDMCOUNT_WARN)", "command line") | ||
| 248 | RECORDMCOUNT_FLAGS = -w | ||
| 249 | endif | ||
| 247 | # Due to recursion, we must skip empty.o. | 250 | # Due to recursion, we must skip empty.o. |
| 248 | # The empty.o file is created in the make process in order to determine | 251 | # The empty.o file is created in the make process in order to determine |
| 249 | # the target endianness and word size. It is made before all other C | 252 | # the target endianness and word size. It is made before all other C |
| 250 | # files, including recordmcount. | 253 | # files, including recordmcount. |
| 251 | sub_cmd_record_mcount = \ | 254 | sub_cmd_record_mcount = \ |
| 252 | if [ $(@) != "scripts/mod/empty.o" ]; then \ | 255 | if [ $(@) != "scripts/mod/empty.o" ]; then \ |
| 253 | $(objtree)/scripts/recordmcount "$(@)"; \ | 256 | $(objtree)/scripts/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)"; \ |
| 254 | fi; | 257 | fi; |
| 255 | else | 258 | else |
| 256 | sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ | 259 | sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \ |
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c index f9f6f52db772..ee52cb8e17ad 100644 --- a/scripts/recordmcount.c +++ b/scripts/recordmcount.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <sys/types.h> | 24 | #include <sys/types.h> |
| 25 | #include <sys/mman.h> | 25 | #include <sys/mman.h> |
| 26 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
| 27 | #include <getopt.h> | ||
| 27 | #include <elf.h> | 28 | #include <elf.h> |
| 28 | #include <fcntl.h> | 29 | #include <fcntl.h> |
| 29 | #include <setjmp.h> | 30 | #include <setjmp.h> |
| @@ -39,6 +40,7 @@ static char gpfx; /* prefix for global symbol name (sometimes '_') */ | |||
| 39 | static struct stat sb; /* Remember .st_size, etc. */ | 40 | static struct stat sb; /* Remember .st_size, etc. */ |
| 40 | static jmp_buf jmpenv; /* setjmp/longjmp per-file error escape */ | 41 | static jmp_buf jmpenv; /* setjmp/longjmp per-file error escape */ |
| 41 | static const char *altmcount; /* alternate mcount symbol name */ | 42 | static const char *altmcount; /* alternate mcount symbol name */ |
| 43 | static int warn_on_notrace_sect; /* warn when section has mcount not being recorded */ | ||
| 42 | 44 | ||
| 43 | /* setjmp() return values */ | 45 | /* setjmp() return values */ |
| 44 | enum { | 46 | enum { |
| @@ -78,7 +80,7 @@ static off_t | |||
| 78 | ulseek(int const fd, off_t const offset, int const whence) | 80 | ulseek(int const fd, off_t const offset, int const whence) |
| 79 | { | 81 | { |
| 80 | off_t const w = lseek(fd, offset, whence); | 82 | off_t const w = lseek(fd, offset, whence); |
| 81 | if ((off_t)-1 == w) { | 83 | if (w == (off_t)-1) { |
| 82 | perror("lseek"); | 84 | perror("lseek"); |
| 83 | fail_file(); | 85 | fail_file(); |
| 84 | } | 86 | } |
| @@ -111,13 +113,41 @@ static void * | |||
| 111 | umalloc(size_t size) | 113 | umalloc(size_t size) |
| 112 | { | 114 | { |
| 113 | void *const addr = malloc(size); | 115 | void *const addr = malloc(size); |
| 114 | if (0 == addr) { | 116 | if (addr == 0) { |
| 115 | fprintf(stderr, "malloc failed: %zu bytes\n", size); | 117 | fprintf(stderr, "malloc failed: %zu bytes\n", size); |
| 116 | fail_file(); | 118 | fail_file(); |
| 117 | } | 119 | } |
| 118 | return addr; | 120 | return addr; |
| 119 | } | 121 | } |
| 120 | 122 | ||
| 123 | static unsigned char ideal_nop5_x86_64[5] = { 0x0f, 0x1f, 0x44, 0x00, 0x00 }; | ||
| 124 | static unsigned char ideal_nop5_x86_32[5] = { 0x3e, 0x8d, 0x74, 0x26, 0x00 }; | ||
| 125 | static unsigned char *ideal_nop; | ||
| 126 | |||
| 127 | static char rel_type_nop; | ||
| 128 | |||
| 129 | static int (*make_nop)(void *map, size_t const offset); | ||
| 130 | |||
| 131 | static int make_nop_x86(void *map, size_t const offset) | ||
| 132 | { | ||
| 133 | uint32_t *ptr; | ||
| 134 | unsigned char *op; | ||
| 135 | |||
| 136 | /* Confirm we have 0xe8 0x0 0x0 0x0 0x0 */ | ||
| 137 | ptr = map + offset; | ||
| 138 | if (*ptr != 0) | ||
| 139 | return -1; | ||
| 140 | |||
| 141 | op = map + offset - 1; | ||
| 142 | if (*op != 0xe8) | ||
| 143 | return -1; | ||
| 144 | |||
| 145 | /* convert to nop */ | ||
| 146 | ulseek(fd_map, offset - 1, SEEK_SET); | ||
| 147 | uwrite(fd_map, ideal_nop, 5); | ||
| 148 | return 0; | ||
| 149 | } | ||
| 150 | |||
| 121 | /* | 151 | /* |
| 122 | * Get the whole file as a programming convenience in order to avoid | 152 | * Get the whole file as a programming convenience in order to avoid |
| 123 | * malloc+lseek+read+free of many pieces. If successful, then mmap | 153 | * malloc+lseek+read+free of many pieces. If successful, then mmap |
| @@ -136,7 +166,7 @@ static void *mmap_file(char const *fname) | |||
| 136 | void *addr; | 166 | void *addr; |
| 137 | 167 | ||
| 138 | fd_map = open(fname, O_RDWR); | 168 | fd_map = open(fname, O_RDWR); |
| 139 | if (0 > fd_map || 0 > fstat(fd_map, &sb)) { | 169 | if (fd_map < 0 || fstat(fd_map, &sb) < 0) { |
| 140 | perror(fname); | 170 | perror(fname); |
| 141 | fail_file(); | 171 | fail_file(); |
| 142 | } | 172 | } |
| @@ -147,7 +177,7 @@ static void *mmap_file(char const *fname) | |||
| 147 | addr = mmap(0, sb.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, | 177 | addr = mmap(0, sb.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, |
| 148 | fd_map, 0); | 178 | fd_map, 0); |
| 149 | mmap_failed = 0; | 179 | mmap_failed = 0; |
| 150 | if (MAP_FAILED == addr) { | 180 | if (addr == MAP_FAILED) { |
| 151 | mmap_failed = 1; | 181 | mmap_failed = 1; |
| 152 | addr = umalloc(sb.st_size); | 182 | addr = umalloc(sb.st_size); |
| 153 | uread(fd_map, addr, sb.st_size); | 183 | uread(fd_map, addr, sb.st_size); |
| @@ -206,12 +236,13 @@ static uint32_t (*w2)(uint16_t); | |||
| 206 | static int | 236 | static int |
| 207 | is_mcounted_section_name(char const *const txtname) | 237 | is_mcounted_section_name(char const *const txtname) |
| 208 | { | 238 | { |
| 209 | return 0 == strcmp(".text", txtname) || | 239 | return strcmp(".text", txtname) == 0 || |
| 210 | 0 == strcmp(".ref.text", txtname) || | 240 | strcmp(".ref.text", txtname) == 0 || |
| 211 | 0 == strcmp(".sched.text", txtname) || | 241 | strcmp(".sched.text", txtname) == 0 || |
| 212 | 0 == strcmp(".spinlock.text", txtname) || | 242 | strcmp(".spinlock.text", txtname) == 0 || |
| 213 | 0 == strcmp(".irqentry.text", txtname) || | 243 | strcmp(".irqentry.text", txtname) == 0 || |
| 214 | 0 == strcmp(".text.unlikely", txtname); | 244 | strcmp(".kprobes.text", txtname) == 0 || |
| 245 | strcmp(".text.unlikely", txtname) == 0; | ||
| 215 | } | 246 | } |
| 216 | 247 | ||
| 217 | /* 32 bit and 64 bit are very similar */ | 248 | /* 32 bit and 64 bit are very similar */ |
| @@ -264,43 +295,48 @@ do_file(char const *const fname) | |||
| 264 | w8 = w8nat; | 295 | w8 = w8nat; |
| 265 | switch (ehdr->e_ident[EI_DATA]) { | 296 | switch (ehdr->e_ident[EI_DATA]) { |
| 266 | static unsigned int const endian = 1; | 297 | static unsigned int const endian = 1; |
| 267 | default: { | 298 | default: |
| 268 | fprintf(stderr, "unrecognized ELF data encoding %d: %s\n", | 299 | fprintf(stderr, "unrecognized ELF data encoding %d: %s\n", |
| 269 | ehdr->e_ident[EI_DATA], fname); | 300 | ehdr->e_ident[EI_DATA], fname); |
| 270 | fail_file(); | 301 | fail_file(); |
| 271 | } break; | 302 | break; |
| 272 | case ELFDATA2LSB: { | 303 | case ELFDATA2LSB: |
| 273 | if (1 != *(unsigned char const *)&endian) { | 304 | if (*(unsigned char const *)&endian != 1) { |
| 274 | /* main() is big endian, file.o is little endian. */ | 305 | /* main() is big endian, file.o is little endian. */ |
| 275 | w = w4rev; | 306 | w = w4rev; |
| 276 | w2 = w2rev; | 307 | w2 = w2rev; |
| 277 | w8 = w8rev; | 308 | w8 = w8rev; |
| 278 | } | 309 | } |
| 279 | } break; | 310 | break; |
| 280 | case ELFDATA2MSB: { | 311 | case ELFDATA2MSB: |
| 281 | if (0 != *(unsigned char const *)&endian) { | 312 | if (*(unsigned char const *)&endian != 0) { |
| 282 | /* main() is little endian, file.o is big endian. */ | 313 | /* main() is little endian, file.o is big endian. */ |
| 283 | w = w4rev; | 314 | w = w4rev; |
| 284 | w2 = w2rev; | 315 | w2 = w2rev; |
| 285 | w8 = w8rev; | 316 | w8 = w8rev; |
| 286 | } | 317 | } |
| 287 | } break; | 318 | break; |
| 288 | } /* end switch */ | 319 | } /* end switch */ |
| 289 | if (0 != memcmp(ELFMAG, ehdr->e_ident, SELFMAG) | 320 | if (memcmp(ELFMAG, ehdr->e_ident, SELFMAG) != 0 |
| 290 | || ET_REL != w2(ehdr->e_type) | 321 | || w2(ehdr->e_type) != ET_REL |
| 291 | || EV_CURRENT != ehdr->e_ident[EI_VERSION]) { | 322 | || ehdr->e_ident[EI_VERSION] != EV_CURRENT) { |
| 292 | fprintf(stderr, "unrecognized ET_REL file %s\n", fname); | 323 | fprintf(stderr, "unrecognized ET_REL file %s\n", fname); |
| 293 | fail_file(); | 324 | fail_file(); |
| 294 | } | 325 | } |
| 295 | 326 | ||
| 296 | gpfx = 0; | 327 | gpfx = 0; |
| 297 | switch (w2(ehdr->e_machine)) { | 328 | switch (w2(ehdr->e_machine)) { |
| 298 | default: { | 329 | default: |
| 299 | fprintf(stderr, "unrecognized e_machine %d %s\n", | 330 | fprintf(stderr, "unrecognized e_machine %d %s\n", |
| 300 | w2(ehdr->e_machine), fname); | 331 | w2(ehdr->e_machine), fname); |
| 301 | fail_file(); | 332 | fail_file(); |
| 302 | } break; | 333 | break; |
| 303 | case EM_386: reltype = R_386_32; break; | 334 | case EM_386: |
| 335 | reltype = R_386_32; | ||
| 336 | make_nop = make_nop_x86; | ||
| 337 | ideal_nop = ideal_nop5_x86_32; | ||
| 338 | mcount_adjust_32 = -1; | ||
| 339 | break; | ||
| 304 | case EM_ARM: reltype = R_ARM_ABS32; | 340 | case EM_ARM: reltype = R_ARM_ABS32; |
| 305 | altmcount = "__gnu_mcount_nc"; | 341 | altmcount = "__gnu_mcount_nc"; |
| 306 | break; | 342 | break; |
| @@ -311,67 +347,91 @@ do_file(char const *const fname) | |||
| 311 | case EM_S390: /* reltype: e_class */ gpfx = '_'; break; | 347 | case EM_S390: /* reltype: e_class */ gpfx = '_'; break; |
| 312 | case EM_SH: reltype = R_SH_DIR32; break; | 348 | case EM_SH: reltype = R_SH_DIR32; break; |
| 313 | case EM_SPARCV9: reltype = R_SPARC_64; gpfx = '_'; break; | 349 | case EM_SPARCV9: reltype = R_SPARC_64; gpfx = '_'; break; |
| 314 | case EM_X86_64: reltype = R_X86_64_64; break; | 350 | case EM_X86_64: |
| 351 | make_nop = make_nop_x86; | ||
| 352 | ideal_nop = ideal_nop5_x86_64; | ||
| 353 | reltype = R_X86_64_64; | ||
| 354 | mcount_adjust_64 = -1; | ||
| 355 | break; | ||
| 315 | } /* end switch */ | 356 | } /* end switch */ |
| 316 | 357 | ||
| 317 | switch (ehdr->e_ident[EI_CLASS]) { | 358 | switch (ehdr->e_ident[EI_CLASS]) { |
| 318 | default: { | 359 | default: |
| 319 | fprintf(stderr, "unrecognized ELF class %d %s\n", | 360 | fprintf(stderr, "unrecognized ELF class %d %s\n", |
| 320 | ehdr->e_ident[EI_CLASS], fname); | 361 | ehdr->e_ident[EI_CLASS], fname); |
| 321 | fail_file(); | 362 | fail_file(); |
| 322 | } break; | 363 | break; |
| 323 | case ELFCLASS32: { | 364 | case ELFCLASS32: |
| 324 | if (sizeof(Elf32_Ehdr) != w2(ehdr->e_ehsize) | 365 | if (w2(ehdr->e_ehsize) != sizeof(Elf32_Ehdr) |
| 325 | || sizeof(Elf32_Shdr) != w2(ehdr->e_shentsize)) { | 366 | || w2(ehdr->e_shentsize) != sizeof(Elf32_Shdr)) { |
| 326 | fprintf(stderr, | 367 | fprintf(stderr, |
| 327 | "unrecognized ET_REL file: %s\n", fname); | 368 | "unrecognized ET_REL file: %s\n", fname); |
| 328 | fail_file(); | 369 | fail_file(); |
| 329 | } | 370 | } |
| 330 | if (EM_S390 == w2(ehdr->e_machine)) | 371 | if (w2(ehdr->e_machine) == EM_S390) { |
| 331 | reltype = R_390_32; | 372 | reltype = R_390_32; |
| 332 | if (EM_MIPS == w2(ehdr->e_machine)) { | 373 | mcount_adjust_32 = -4; |
| 374 | } | ||
| 375 | if (w2(ehdr->e_machine) == EM_MIPS) { | ||
| 333 | reltype = R_MIPS_32; | 376 | reltype = R_MIPS_32; |
| 334 | is_fake_mcount32 = MIPS32_is_fake_mcount; | 377 | is_fake_mcount32 = MIPS32_is_fake_mcount; |
| 335 | } | 378 | } |
| 336 | do32(ehdr, fname, reltype); | 379 | do32(ehdr, fname, reltype); |
| 337 | } break; | 380 | break; |
| 338 | case ELFCLASS64: { | 381 | case ELFCLASS64: { |
| 339 | Elf64_Ehdr *const ghdr = (Elf64_Ehdr *)ehdr; | 382 | Elf64_Ehdr *const ghdr = (Elf64_Ehdr *)ehdr; |
| 340 | if (sizeof(Elf64_Ehdr) != w2(ghdr->e_ehsize) | 383 | if (w2(ghdr->e_ehsize) != sizeof(Elf64_Ehdr) |
| 341 | || sizeof(Elf64_Shdr) != w2(ghdr->e_shentsize)) { | 384 | || w2(ghdr->e_shentsize) != sizeof(Elf64_Shdr)) { |
| 342 | fprintf(stderr, | 385 | fprintf(stderr, |
| 343 | "unrecognized ET_REL file: %s\n", fname); | 386 | "unrecognized ET_REL file: %s\n", fname); |
| 344 | fail_file(); | 387 | fail_file(); |
| 345 | } | 388 | } |
| 346 | if (EM_S390 == w2(ghdr->e_machine)) | 389 | if (w2(ghdr->e_machine) == EM_S390) { |
| 347 | reltype = R_390_64; | 390 | reltype = R_390_64; |
| 348 | if (EM_MIPS == w2(ghdr->e_machine)) { | 391 | mcount_adjust_64 = -8; |
| 392 | } | ||
| 393 | if (w2(ghdr->e_machine) == EM_MIPS) { | ||
| 349 | reltype = R_MIPS_64; | 394 | reltype = R_MIPS_64; |
| 350 | Elf64_r_sym = MIPS64_r_sym; | 395 | Elf64_r_sym = MIPS64_r_sym; |
| 351 | Elf64_r_info = MIPS64_r_info; | 396 | Elf64_r_info = MIPS64_r_info; |
| 352 | is_fake_mcount64 = MIPS64_is_fake_mcount; | 397 | is_fake_mcount64 = MIPS64_is_fake_mcount; |
| 353 | } | 398 | } |
| 354 | do64(ghdr, fname, reltype); | 399 | do64(ghdr, fname, reltype); |
| 355 | } break; | 400 | break; |
| 401 | } | ||
| 356 | } /* end switch */ | 402 | } /* end switch */ |
| 357 | 403 | ||
| 358 | cleanup(); | 404 | cleanup(); |
| 359 | } | 405 | } |
| 360 | 406 | ||
| 361 | int | 407 | int |
| 362 | main(int argc, char const *argv[]) | 408 | main(int argc, char *argv[]) |
| 363 | { | 409 | { |
| 364 | const char ftrace[] = "/ftrace.o"; | 410 | const char ftrace[] = "/ftrace.o"; |
| 365 | int ftrace_size = sizeof(ftrace) - 1; | 411 | int ftrace_size = sizeof(ftrace) - 1; |
| 366 | int n_error = 0; /* gcc-4.3.0 false positive complaint */ | 412 | int n_error = 0; /* gcc-4.3.0 false positive complaint */ |
| 413 | int c; | ||
| 414 | int i; | ||
| 415 | |||
| 416 | while ((c = getopt(argc, argv, "w")) >= 0) { | ||
| 417 | switch (c) { | ||
| 418 | case 'w': | ||
| 419 | warn_on_notrace_sect = 1; | ||
| 420 | break; | ||
| 421 | default: | ||
| 422 | fprintf(stderr, "usage: recordmcount [-w] file.o...\n"); | ||
| 423 | return 0; | ||
| 424 | } | ||
| 425 | } | ||
| 367 | 426 | ||
| 368 | if (argc <= 1) { | 427 | if ((argc - optind) < 1) { |
| 369 | fprintf(stderr, "usage: recordmcount file.o...\n"); | 428 | fprintf(stderr, "usage: recordmcount [-w] file.o...\n"); |
| 370 | return 0; | 429 | return 0; |
| 371 | } | 430 | } |
| 372 | 431 | ||
| 373 | /* Process each file in turn, allowing deep failure. */ | 432 | /* Process each file in turn, allowing deep failure. */ |
| 374 | for (--argc, ++argv; 0 < argc; --argc, ++argv) { | 433 | for (i = optind; i < argc; i++) { |
| 434 | char *file = argv[i]; | ||
| 375 | int const sjval = setjmp(jmpenv); | 435 | int const sjval = setjmp(jmpenv); |
| 376 | int len; | 436 | int len; |
| 377 | 437 | ||
| @@ -380,29 +440,29 @@ main(int argc, char const *argv[]) | |||
| 380 | * function but does not call it. Since ftrace.o should | 440 | * function but does not call it. Since ftrace.o should |
| 381 | * not be traced anyway, we just skip it. | 441 | * not be traced anyway, we just skip it. |
| 382 | */ | 442 | */ |
| 383 | len = strlen(argv[0]); | 443 | len = strlen(file); |
| 384 | if (len >= ftrace_size && | 444 | if (len >= ftrace_size && |
| 385 | strcmp(argv[0] + (len - ftrace_size), ftrace) == 0) | 445 | strcmp(file + (len - ftrace_size), ftrace) == 0) |
| 386 | continue; | 446 | continue; |
| 387 | 447 | ||
| 388 | switch (sjval) { | 448 | switch (sjval) { |
| 389 | default: { | 449 | default: |
| 390 | fprintf(stderr, "internal error: %s\n", argv[0]); | 450 | fprintf(stderr, "internal error: %s\n", file); |
| 391 | exit(1); | 451 | exit(1); |
| 392 | } break; | 452 | break; |
| 393 | case SJ_SETJMP: { /* normal sequence */ | 453 | case SJ_SETJMP: /* normal sequence */ |
| 394 | /* Avoid problems if early cleanup() */ | 454 | /* Avoid problems if early cleanup() */ |
| 395 | fd_map = -1; | 455 | fd_map = -1; |
| 396 | ehdr_curr = NULL; | 456 | ehdr_curr = NULL; |
| 397 | mmap_failed = 1; | 457 | mmap_failed = 1; |
| 398 | do_file(argv[0]); | 458 | do_file(file); |
| 399 | } break; | 459 | break; |
| 400 | case SJ_FAIL: { /* error in do_file or below */ | 460 | case SJ_FAIL: /* error in do_file or below */ |
| 401 | ++n_error; | 461 | ++n_error; |
| 402 | } break; | 462 | break; |
| 403 | case SJ_SUCCEED: { /* premature success */ | 463 | case SJ_SUCCEED: /* premature success */ |
| 404 | /* do nothing */ | 464 | /* do nothing */ |
| 405 | } break; | 465 | break; |
| 406 | } /* end switch */ | 466 | } /* end switch */ |
| 407 | } | 467 | } |
| 408 | return !!n_error; | 468 | return !!n_error; |
diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h index baf187bee983..4be60364a405 100644 --- a/scripts/recordmcount.h +++ b/scripts/recordmcount.h | |||
| @@ -22,11 +22,15 @@ | |||
| 22 | #undef is_fake_mcount | 22 | #undef is_fake_mcount |
| 23 | #undef fn_is_fake_mcount | 23 | #undef fn_is_fake_mcount |
| 24 | #undef MIPS_is_fake_mcount | 24 | #undef MIPS_is_fake_mcount |
| 25 | #undef mcount_adjust | ||
| 25 | #undef sift_rel_mcount | 26 | #undef sift_rel_mcount |
| 27 | #undef nop_mcount | ||
| 26 | #undef find_secsym_ndx | 28 | #undef find_secsym_ndx |
| 27 | #undef __has_rel_mcount | 29 | #undef __has_rel_mcount |
| 28 | #undef has_rel_mcount | 30 | #undef has_rel_mcount |
| 29 | #undef tot_relsize | 31 | #undef tot_relsize |
| 32 | #undef get_mcountsym | ||
| 33 | #undef get_sym_str_and_relp | ||
| 30 | #undef do_func | 34 | #undef do_func |
| 31 | #undef Elf_Addr | 35 | #undef Elf_Addr |
| 32 | #undef Elf_Ehdr | 36 | #undef Elf_Ehdr |
| @@ -49,14 +53,18 @@ | |||
| 49 | #ifdef RECORD_MCOUNT_64 | 53 | #ifdef RECORD_MCOUNT_64 |
| 50 | # define append_func append64 | 54 | # define append_func append64 |
| 51 | # define sift_rel_mcount sift64_rel_mcount | 55 | # define sift_rel_mcount sift64_rel_mcount |
| 56 | # define nop_mcount nop_mcount_64 | ||
| 52 | # define find_secsym_ndx find64_secsym_ndx | 57 | # define find_secsym_ndx find64_secsym_ndx |
| 53 | # define __has_rel_mcount __has64_rel_mcount | 58 | # define __has_rel_mcount __has64_rel_mcount |
| 54 | # define has_rel_mcount has64_rel_mcount | 59 | # define has_rel_mcount has64_rel_mcount |
| 55 | # define tot_relsize tot64_relsize | 60 | # define tot_relsize tot64_relsize |
| 61 | # define get_sym_str_and_relp get_sym_str_and_relp_64 | ||
| 56 | # define do_func do64 | 62 | # define do_func do64 |
| 63 | # define get_mcountsym get_mcountsym_64 | ||
| 57 | # define is_fake_mcount is_fake_mcount64 | 64 | # define is_fake_mcount is_fake_mcount64 |
| 58 | # define fn_is_fake_mcount fn_is_fake_mcount64 | 65 | # define fn_is_fake_mcount fn_is_fake_mcount64 |
| 59 | # define MIPS_is_fake_mcount MIPS64_is_fake_mcount | 66 | # define MIPS_is_fake_mcount MIPS64_is_fake_mcount |
| 67 | # define mcount_adjust mcount_adjust_64 | ||
| 60 | # define Elf_Addr Elf64_Addr | 68 | # define Elf_Addr Elf64_Addr |
| 61 | # define Elf_Ehdr Elf64_Ehdr | 69 | # define Elf_Ehdr Elf64_Ehdr |
| 62 | # define Elf_Shdr Elf64_Shdr | 70 | # define Elf_Shdr Elf64_Shdr |
| @@ -77,14 +85,18 @@ | |||
| 77 | #else | 85 | #else |
| 78 | # define append_func append32 | 86 | # define append_func append32 |
| 79 | # define sift_rel_mcount sift32_rel_mcount | 87 | # define sift_rel_mcount sift32_rel_mcount |
| 88 | # define nop_mcount nop_mcount_32 | ||
| 80 | # define find_secsym_ndx find32_secsym_ndx | 89 | # define find_secsym_ndx find32_secsym_ndx |
| 81 | # define __has_rel_mcount __has32_rel_mcount | 90 | # define __has_rel_mcount __has32_rel_mcount |
| 82 | # define has_rel_mcount has32_rel_mcount | 91 | # define has_rel_mcount has32_rel_mcount |
| 83 | # define tot_relsize tot32_relsize | 92 | # define tot_relsize tot32_relsize |
| 93 | # define get_sym_str_and_relp get_sym_str_and_relp_32 | ||
| 84 | # define do_func do32 | 94 | # define do_func do32 |
| 95 | # define get_mcountsym get_mcountsym_32 | ||
| 85 | # define is_fake_mcount is_fake_mcount32 | 96 | # define is_fake_mcount is_fake_mcount32 |
| 86 | # define fn_is_fake_mcount fn_is_fake_mcount32 | 97 | # define fn_is_fake_mcount fn_is_fake_mcount32 |
| 87 | # define MIPS_is_fake_mcount MIPS32_is_fake_mcount | 98 | # define MIPS_is_fake_mcount MIPS32_is_fake_mcount |
| 99 | # define mcount_adjust mcount_adjust_32 | ||
| 88 | # define Elf_Addr Elf32_Addr | 100 | # define Elf_Addr Elf32_Addr |
| 89 | # define Elf_Ehdr Elf32_Ehdr | 101 | # define Elf_Ehdr Elf32_Ehdr |
| 90 | # define Elf_Shdr Elf32_Shdr | 102 | # define Elf_Shdr Elf32_Shdr |
| @@ -123,6 +135,8 @@ static void fn_ELF_R_INFO(Elf_Rel *const rp, unsigned sym, unsigned type) | |||
| 123 | } | 135 | } |
| 124 | static void (*Elf_r_info)(Elf_Rel *const rp, unsigned sym, unsigned type) = fn_ELF_R_INFO; | 136 | static void (*Elf_r_info)(Elf_Rel *const rp, unsigned sym, unsigned type) = fn_ELF_R_INFO; |
| 125 | 137 | ||
| 138 | static int mcount_adjust = 0; | ||
| 139 | |||
| 126 | /* | 140 | /* |
| 127 | * MIPS mcount long call has 2 _mcount symbols, only the position of the 1st | 141 | * MIPS mcount long call has 2 _mcount symbols, only the position of the 1st |
| 128 | * _mcount symbol is needed for dynamic function tracer, with it, to disable | 142 | * _mcount symbol is needed for dynamic function tracer, with it, to disable |
| @@ -234,6 +248,49 @@ static void append_func(Elf_Ehdr *const ehdr, | |||
| 234 | uwrite(fd_map, ehdr, sizeof(*ehdr)); | 248 | uwrite(fd_map, ehdr, sizeof(*ehdr)); |
| 235 | } | 249 | } |
| 236 | 250 | ||
| 251 | static unsigned get_mcountsym(Elf_Sym const *const sym0, | ||
| 252 | Elf_Rel const *relp, | ||
| 253 | char const *const str0) | ||
| 254 | { | ||
| 255 | unsigned mcountsym = 0; | ||
| 256 | |||
| 257 | Elf_Sym const *const symp = | ||
| 258 | &sym0[Elf_r_sym(relp)]; | ||
| 259 | char const *symname = &str0[w(symp->st_name)]; | ||
| 260 | char const *mcount = gpfx == '_' ? "_mcount" : "mcount"; | ||
| 261 | |||
| 262 | if (symname[0] == '.') | ||
| 263 | ++symname; /* ppc64 hack */ | ||
| 264 | if (strcmp(mcount, symname) == 0 || | ||
| 265 | (altmcount && strcmp(altmcount, symname) == 0)) | ||
| 266 | mcountsym = Elf_r_sym(relp); | ||
| 267 | |||
| 268 | return mcountsym; | ||
| 269 | } | ||
| 270 | |||
| 271 | static void get_sym_str_and_relp(Elf_Shdr const *const relhdr, | ||
| 272 | Elf_Ehdr const *const ehdr, | ||
| 273 | Elf_Sym const **sym0, | ||
| 274 | char const **str0, | ||
| 275 | Elf_Rel const **relp) | ||
| 276 | { | ||
| 277 | Elf_Shdr *const shdr0 = (Elf_Shdr *)(_w(ehdr->e_shoff) | ||
| 278 | + (void *)ehdr); | ||
| 279 | unsigned const symsec_sh_link = w(relhdr->sh_link); | ||
| 280 | Elf_Shdr const *const symsec = &shdr0[symsec_sh_link]; | ||
| 281 | Elf_Shdr const *const strsec = &shdr0[w(symsec->sh_link)]; | ||
| 282 | Elf_Rel const *const rel0 = (Elf_Rel const *)(_w(relhdr->sh_offset) | ||
| 283 | + (void *)ehdr); | ||
| 284 | |||
| 285 | *sym0 = (Elf_Sym const *)(_w(symsec->sh_offset) | ||
| 286 | + (void *)ehdr); | ||
| 287 | |||
| 288 | *str0 = (char const *)(_w(strsec->sh_offset) | ||
| 289 | + (void *)ehdr); | ||
| 290 | |||
| 291 | *relp = rel0; | ||
| 292 | } | ||
| 293 | |||
| 237 | /* | 294 | /* |
| 238 | * Look at the relocations in order to find the calls to mcount. | 295 | * Look at the relocations in order to find the calls to mcount. |
| 239 | * Accumulate the section offsets that are found, and their relocation info, | 296 | * Accumulate the section offsets that are found, and their relocation info, |
| @@ -250,47 +307,27 @@ static uint_t *sift_rel_mcount(uint_t *mlocp, | |||
| 250 | { | 307 | { |
| 251 | uint_t *const mloc0 = mlocp; | 308 | uint_t *const mloc0 = mlocp; |
| 252 | Elf_Rel *mrelp = *mrelpp; | 309 | Elf_Rel *mrelp = *mrelpp; |
| 253 | Elf_Shdr *const shdr0 = (Elf_Shdr *)(_w(ehdr->e_shoff) | 310 | Elf_Sym const *sym0; |
| 254 | + (void *)ehdr); | 311 | char const *str0; |
| 255 | unsigned const symsec_sh_link = w(relhdr->sh_link); | 312 | Elf_Rel const *relp; |
| 256 | Elf_Shdr const *const symsec = &shdr0[symsec_sh_link]; | ||
| 257 | Elf_Sym const *const sym0 = (Elf_Sym const *)(_w(symsec->sh_offset) | ||
| 258 | + (void *)ehdr); | ||
| 259 | |||
| 260 | Elf_Shdr const *const strsec = &shdr0[w(symsec->sh_link)]; | ||
| 261 | char const *const str0 = (char const *)(_w(strsec->sh_offset) | ||
| 262 | + (void *)ehdr); | ||
| 263 | |||
| 264 | Elf_Rel const *const rel0 = (Elf_Rel const *)(_w(relhdr->sh_offset) | ||
| 265 | + (void *)ehdr); | ||
| 266 | unsigned rel_entsize = _w(relhdr->sh_entsize); | 313 | unsigned rel_entsize = _w(relhdr->sh_entsize); |
| 267 | unsigned const nrel = _w(relhdr->sh_size) / rel_entsize; | 314 | unsigned const nrel = _w(relhdr->sh_size) / rel_entsize; |
| 268 | Elf_Rel const *relp = rel0; | ||
| 269 | |||
| 270 | unsigned mcountsym = 0; | 315 | unsigned mcountsym = 0; |
| 271 | unsigned t; | 316 | unsigned t; |
| 272 | 317 | ||
| 318 | get_sym_str_and_relp(relhdr, ehdr, &sym0, &str0, &relp); | ||
| 319 | |||
| 273 | for (t = nrel; t; --t) { | 320 | for (t = nrel; t; --t) { |
| 274 | if (!mcountsym) { | 321 | if (!mcountsym) |
| 275 | Elf_Sym const *const symp = | 322 | mcountsym = get_mcountsym(sym0, relp, str0); |
| 276 | &sym0[Elf_r_sym(relp)]; | ||
| 277 | char const *symname = &str0[w(symp->st_name)]; | ||
| 278 | char const *mcount = '_' == gpfx ? "_mcount" : "mcount"; | ||
| 279 | |||
| 280 | if ('.' == symname[0]) | ||
| 281 | ++symname; /* ppc64 hack */ | ||
| 282 | if (0 == strcmp(mcount, symname) || | ||
| 283 | (altmcount && 0 == strcmp(altmcount, symname))) | ||
| 284 | mcountsym = Elf_r_sym(relp); | ||
| 285 | } | ||
| 286 | 323 | ||
| 287 | if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) { | 324 | if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) { |
| 288 | uint_t const addend = _w(_w(relp->r_offset) - recval); | 325 | uint_t const addend = |
| 289 | 326 | _w(_w(relp->r_offset) - recval + mcount_adjust); | |
| 290 | mrelp->r_offset = _w(offbase | 327 | mrelp->r_offset = _w(offbase |
| 291 | + ((void *)mlocp - (void *)mloc0)); | 328 | + ((void *)mlocp - (void *)mloc0)); |
| 292 | Elf_r_info(mrelp, recsym, reltype); | 329 | Elf_r_info(mrelp, recsym, reltype); |
| 293 | if (sizeof(Elf_Rela) == rel_entsize) { | 330 | if (rel_entsize == sizeof(Elf_Rela)) { |
| 294 | ((Elf_Rela *)mrelp)->r_addend = addend; | 331 | ((Elf_Rela *)mrelp)->r_addend = addend; |
| 295 | *mlocp++ = 0; | 332 | *mlocp++ = 0; |
| 296 | } else | 333 | } else |
| @@ -304,6 +341,63 @@ static uint_t *sift_rel_mcount(uint_t *mlocp, | |||
| 304 | return mlocp; | 341 | return mlocp; |
| 305 | } | 342 | } |
| 306 | 343 | ||
| 344 | /* | ||
| 345 | * Read the relocation table again, but this time its called on sections | ||
| 346 | * that are not going to be traced. The mcount calls here will be converted | ||
| 347 | * into nops. | ||
| 348 | */ | ||
| 349 | static void nop_mcount(Elf_Shdr const *const relhdr, | ||
| 350 | Elf_Ehdr const *const ehdr, | ||
| 351 | const char *const txtname) | ||
| 352 | { | ||
| 353 | Elf_Shdr *const shdr0 = (Elf_Shdr *)(_w(ehdr->e_shoff) | ||
| 354 | + (void *)ehdr); | ||
| 355 | Elf_Sym const *sym0; | ||
| 356 | char const *str0; | ||
| 357 | Elf_Rel const *relp; | ||
| 358 | Elf_Shdr const *const shdr = &shdr0[w(relhdr->sh_info)]; | ||
| 359 | unsigned rel_entsize = _w(relhdr->sh_entsize); | ||
| 360 | unsigned const nrel = _w(relhdr->sh_size) / rel_entsize; | ||
| 361 | unsigned mcountsym = 0; | ||
| 362 | unsigned t; | ||
| 363 | int once = 0; | ||
| 364 | |||
| 365 | get_sym_str_and_relp(relhdr, ehdr, &sym0, &str0, &relp); | ||
| 366 | |||
| 367 | for (t = nrel; t; --t) { | ||
| 368 | int ret = -1; | ||
| 369 | |||
| 370 | if (!mcountsym) | ||
| 371 | mcountsym = get_mcountsym(sym0, relp, str0); | ||
| 372 | |||
| 373 | if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) { | ||
| 374 | if (make_nop) | ||
| 375 | ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset); | ||
| 376 | if (warn_on_notrace_sect && !once) { | ||
| 377 | printf("Section %s has mcount callers being ignored\n", | ||
| 378 | txtname); | ||
| 379 | once = 1; | ||
| 380 | /* just warn? */ | ||
| 381 | if (!make_nop) | ||
| 382 | return; | ||
| 383 | } | ||
| 384 | } | ||
| 385 | |||
| 386 | /* | ||
| 387 | * If we successfully removed the mcount, mark the relocation | ||
| 388 | * as a nop (don't do anything with it). | ||
| 389 | */ | ||
| 390 | if (!ret) { | ||
| 391 | Elf_Rel rel; | ||
| 392 | rel = *(Elf_Rel *)relp; | ||
| 393 | Elf_r_info(&rel, Elf_r_sym(relp), rel_type_nop); | ||
| 394 | ulseek(fd_map, (void *)relp - (void *)ehdr, SEEK_SET); | ||
| 395 | uwrite(fd_map, &rel, sizeof(rel)); | ||
| 396 | } | ||
| 397 | relp = (Elf_Rel const *)(rel_entsize + (void *)relp); | ||
| 398 | } | ||
| 399 | } | ||
| 400 | |||
| 307 | 401 | ||
| 308 | /* | 402 | /* |
| 309 | * Find a symbol in the given section, to be used as the base for relocating | 403 | * Find a symbol in the given section, to be used as the base for relocating |
| @@ -354,13 +448,13 @@ __has_rel_mcount(Elf_Shdr const *const relhdr, /* is SHT_REL or SHT_RELA */ | |||
| 354 | Elf_Shdr const *const txthdr = &shdr0[w(relhdr->sh_info)]; | 448 | Elf_Shdr const *const txthdr = &shdr0[w(relhdr->sh_info)]; |
| 355 | char const *const txtname = &shstrtab[w(txthdr->sh_name)]; | 449 | char const *const txtname = &shstrtab[w(txthdr->sh_name)]; |
| 356 | 450 | ||
| 357 | if (0 == strcmp("__mcount_loc", txtname)) { | 451 | if (strcmp("__mcount_loc", txtname) == 0) { |
| 358 | fprintf(stderr, "warning: __mcount_loc already exists: %s\n", | 452 | fprintf(stderr, "warning: __mcount_loc already exists: %s\n", |
| 359 | fname); | 453 | fname); |
| 360 | succeed_file(); | 454 | succeed_file(); |
| 361 | } | 455 | } |
| 362 | if (SHT_PROGBITS != w(txthdr->sh_type) || | 456 | if (w(txthdr->sh_type) != SHT_PROGBITS || |
| 363 | !is_mcounted_section_name(txtname)) | 457 | !(w(txthdr->sh_flags) & SHF_EXECINSTR)) |
| 364 | return NULL; | 458 | return NULL; |
| 365 | return txtname; | 459 | return txtname; |
| 366 | } | 460 | } |
| @@ -370,7 +464,7 @@ static char const *has_rel_mcount(Elf_Shdr const *const relhdr, | |||
| 370 | char const *const shstrtab, | 464 | char const *const shstrtab, |
| 371 | char const *const fname) | 465 | char const *const fname) |
| 372 | { | 466 | { |
| 373 | if (SHT_REL != w(relhdr->sh_type) && SHT_RELA != w(relhdr->sh_type)) | 467 | if (w(relhdr->sh_type) != SHT_REL && w(relhdr->sh_type) != SHT_RELA) |
| 374 | return NULL; | 468 | return NULL; |
| 375 | return __has_rel_mcount(relhdr, shdr0, shstrtab, fname); | 469 | return __has_rel_mcount(relhdr, shdr0, shstrtab, fname); |
| 376 | } | 470 | } |
| @@ -383,9 +477,11 @@ static unsigned tot_relsize(Elf_Shdr const *const shdr0, | |||
| 383 | { | 477 | { |
| 384 | unsigned totrelsz = 0; | 478 | unsigned totrelsz = 0; |
| 385 | Elf_Shdr const *shdrp = shdr0; | 479 | Elf_Shdr const *shdrp = shdr0; |
| 480 | char const *txtname; | ||
| 386 | 481 | ||
| 387 | for (; nhdr; --nhdr, ++shdrp) { | 482 | for (; nhdr; --nhdr, ++shdrp) { |
| 388 | if (has_rel_mcount(shdrp, shdr0, shstrtab, fname)) | 483 | txtname = has_rel_mcount(shdrp, shdr0, shstrtab, fname); |
| 484 | if (txtname && is_mcounted_section_name(txtname)) | ||
| 389 | totrelsz += _w(shdrp->sh_size); | 485 | totrelsz += _w(shdrp->sh_size); |
| 390 | } | 486 | } |
| 391 | return totrelsz; | 487 | return totrelsz; |
| @@ -421,7 +517,7 @@ do_func(Elf_Ehdr *const ehdr, char const *const fname, unsigned const reltype) | |||
| 421 | for (relhdr = shdr0, k = nhdr; k; --k, ++relhdr) { | 517 | for (relhdr = shdr0, k = nhdr; k; --k, ++relhdr) { |
| 422 | char const *const txtname = has_rel_mcount(relhdr, shdr0, | 518 | char const *const txtname = has_rel_mcount(relhdr, shdr0, |
| 423 | shstrtab, fname); | 519 | shstrtab, fname); |
| 424 | if (txtname) { | 520 | if (txtname && is_mcounted_section_name(txtname)) { |
| 425 | uint_t recval = 0; | 521 | uint_t recval = 0; |
| 426 | unsigned const recsym = find_secsym_ndx( | 522 | unsigned const recsym = find_secsym_ndx( |
| 427 | w(relhdr->sh_info), txtname, &recval, | 523 | w(relhdr->sh_info), txtname, &recval, |
| @@ -432,6 +528,12 @@ do_func(Elf_Ehdr *const ehdr, char const *const fname, unsigned const reltype) | |||
| 432 | mlocp = sift_rel_mcount(mlocp, | 528 | mlocp = sift_rel_mcount(mlocp, |
| 433 | (void *)mlocp - (void *)mloc0, &mrelp, | 529 | (void *)mlocp - (void *)mloc0, &mrelp, |
| 434 | relhdr, ehdr, recsym, recval, reltype); | 530 | relhdr, ehdr, recsym, recval, reltype); |
| 531 | } else if (txtname && (warn_on_notrace_sect || make_nop)) { | ||
| 532 | /* | ||
| 533 | * This section is ignored by ftrace, but still | ||
| 534 | * has mcount calls. Convert them to nops now. | ||
| 535 | */ | ||
| 536 | nop_mcount(relhdr, ehdr, txtname); | ||
| 435 | } | 537 | } |
| 436 | } | 538 | } |
| 437 | if (mloc0 != mlocp) { | 539 | if (mloc0 != mlocp) { |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 4be0deea71ca..858966ab019c 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
| @@ -134,6 +134,7 @@ my %text_sections = ( | |||
| 134 | ".sched.text" => 1, | 134 | ".sched.text" => 1, |
| 135 | ".spinlock.text" => 1, | 135 | ".spinlock.text" => 1, |
| 136 | ".irqentry.text" => 1, | 136 | ".irqentry.text" => 1, |
| 137 | ".kprobes.text" => 1, | ||
| 137 | ".text.unlikely" => 1, | 138 | ".text.unlikely" => 1, |
| 138 | ); | 139 | ); |
| 139 | 140 | ||
| @@ -222,6 +223,7 @@ if ($arch eq "x86_64") { | |||
| 222 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; | 223 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; |
| 223 | $type = ".quad"; | 224 | $type = ".quad"; |
| 224 | $alignment = 8; | 225 | $alignment = 8; |
| 226 | $mcount_adjust = -1; | ||
| 225 | 227 | ||
| 226 | # force flags for this arch | 228 | # force flags for this arch |
| 227 | $ld .= " -m elf_x86_64"; | 229 | $ld .= " -m elf_x86_64"; |
| @@ -231,6 +233,7 @@ if ($arch eq "x86_64") { | |||
| 231 | 233 | ||
| 232 | } elsif ($arch eq "i386") { | 234 | } elsif ($arch eq "i386") { |
| 233 | $alignment = 4; | 235 | $alignment = 4; |
| 236 | $mcount_adjust = -1; | ||
| 234 | 237 | ||
| 235 | # force flags for this arch | 238 | # force flags for this arch |
| 236 | $ld .= " -m elf_i386"; | 239 | $ld .= " -m elf_i386"; |
| @@ -240,12 +243,14 @@ if ($arch eq "x86_64") { | |||
| 240 | 243 | ||
| 241 | } elsif ($arch eq "s390" && $bits == 32) { | 244 | } elsif ($arch eq "s390" && $bits == 32) { |
| 242 | $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_32\\s+_mcount\$"; | 245 | $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_32\\s+_mcount\$"; |
| 246 | $mcount_adjust = -4; | ||
| 243 | $alignment = 4; | 247 | $alignment = 4; |
| 244 | $ld .= " -m elf_s390"; | 248 | $ld .= " -m elf_s390"; |
| 245 | $cc .= " -m31"; | 249 | $cc .= " -m31"; |
| 246 | 250 | ||
| 247 | } elsif ($arch eq "s390" && $bits == 64) { | 251 | } elsif ($arch eq "s390" && $bits == 64) { |
| 248 | $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_(PC|PLT)32DBL\\s+_mcount\\+0x2\$"; | 252 | $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_(PC|PLT)32DBL\\s+_mcount\\+0x2\$"; |
| 253 | $mcount_adjust = -8; | ||
| 249 | $alignment = 8; | 254 | $alignment = 8; |
| 250 | $type = ".quad"; | 255 | $type = ".quad"; |
| 251 | $ld .= " -m elf64_s390"; | 256 | $ld .= " -m elf64_s390"; |
