History

Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus

* 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus: (71 commits) MIPS: Lasat: Fix botched changes to sysctl code. RTC: rtc-cmos.c: Fix warning on MIPS MIPS: Cleanup random differences beween lmo and Linus' kernel. MIPS: No longer hardwire CONFIG_EMBEDDED to y MIPS: Fix and enhance built-in kernel command line MIPS: eXcite: Remove platform. MIPS: Loongson: Cleanups of serial port support MIPS: Lemote 2F: Suspend CS5536 MFGPT Timer MIPS: Excite: move iodev_remove to .devexit.text MIPS: Lasat: Convert to proc_fops / seq_file MIPS: Cleanup signal code initialization MIPS: Modularize COP2 handling MIPS: Move EARLY_PRINTK to Kconfig.debug MIPS: Yeeloong 2F: Cleanup reset logic using the new ec_write function MIPS: Yeeloong 2F: Add LID open event as the wakeup event MIPS: Yeeloong 2F: Add basic EC operations MIPS: Move several variables from .bss to .init.data MIPS: Tracing: Make function graph tracer work with -mmcount-ra-address MIPS: Tracing: Reserve $12(t0) for mcount-ra-address of gcc 4.5 MIPS: Tracing: Make ftrace for MIPS work without -fno-omit-frame-pointer ...

Linus Torvalds committed 16 years ago

Commit dbfc9852 parents 7c508e5 606d62f255 files · +18310 −4878Browse files

Showing the changes to scripts (2 of 255 files). Show all

Unified · Split

2 files
  1. scripts/Makefile.build +1 −0
  2. scripts/recordmcount.pl +55 −3
scripts/Makefile.build+1−0
@@ -207,6 +207,7 @@ endif · 206 unmodified lines
207207
208208 ifdef CONFIG_FTRACE_MCOUNT_RECORD
209209 cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
210+ "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
210211 "$(if $(CONFIG_64BIT),64,32)" \
211212 "$(OBJDUMP)" "$(OBJCOPY)" "$(CC)" "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
212213 "$(if $(part-of-module),1,0)" "$(@)";
scripts/recordmcount.pl+55−3
@@ -113,13 +113,13 @@ $P =~ s@.*/@@g; · 112 unmodified lines
113113
114114 my $V = '0.1';
115115
116−if ($#ARGV != 10) {
117− print "usage: $P arch bits objdump objcopy cc ld nm rm mv is_module inputfile\n";
116+if ($#ARGV != 11) {
117+ print "usage: $P arch endian bits objdump objcopy cc ld nm rm mv is_module inputfile\n";
118118 print "version: $V\n";
119119 exit(1);
120120 }
121121
122−my ($arch, $bits, $objdump, $objcopy, $cc,
122+my ($arch, $endian, $bits, $objdump, $objcopy, $cc,
123123 $ld, $nm, $rm, $mv, $is_module, $inputfile) = @ARGV;
124124
125125 # This file refers to mcount and shouldn't be ftraced, so lets' ignore it
@@ -295,6 +295,58 @@ if ($arch eq "x86_64") { · 169 unmodified lines
295295 $ld .= " -m elf64_sparc";
296296 $cc .= " -m64";
297297 $objcopy .= " -O elf64-sparc";
298+} elsif ($arch eq "mips") {
299+ # To enable module support, we need to enable the -mlong-calls option
300+ # of gcc for module, after using this option, we can not get the real
301+ # offset of the calling to _mcount, but the offset of the lui
302+ # instruction or the addiu one. herein, we record the address of the
303+ # first one, and then we can replace this instruction by a branch
304+ # instruction to jump over the profiling function to filter the
305+ # indicated functions, or swith back to the lui instruction to trace
306+ # them, which means dynamic tracing.
307+ #
308+ # c: 3c030000 lui v1,0x0
309+ # c: R_MIPS_HI16 _mcount
310+ # c: R_MIPS_NONE *ABS*
311+ # c: R_MIPS_NONE *ABS*
312+ # 10: 64630000 daddiu v1,v1,0
313+ # 10: R_MIPS_LO16 _mcount
314+ # 10: R_MIPS_NONE *ABS*
315+ # 10: R_MIPS_NONE *ABS*
316+ # 14: 03e0082d move at,ra
317+ # 18: 0060f809 jalr v1
318+ #
319+ # for the kernel:
320+ #
321+ # 10: 03e0082d move at,ra
322+ # 14: 0c000000 jal 0 <loongson_halt>
323+ # 14: R_MIPS_26 _mcount
324+ # 14: R_MIPS_NONE *ABS*
325+ # 14: R_MIPS_NONE *ABS*
326+ # 18: 00020021 nop
327+ if ($is_module eq "0") {
328+ $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$";
329+ } else {
330+ $mcount_regex = "^\\s*([0-9a-fA-F]+): R_MIPS_HI16\\s+_mcount\$";
331+ }
332+ $objdump .= " -Melf-trad".$endian."mips ";
333+
334+ if ($endian eq "big") {
335+ $endian = " -EB ";
336+ $ld .= " -melf".$bits."btsmip";
337+ } else {
338+ $endian = " -EL ";
339+ $ld .= " -melf".$bits."ltsmip";
340+ }
341+
342+ $cc .= " -mno-abicalls -fno-pic -mabi=" . $bits . $endian;
343+ $ld .= $endian;
344+
345+ if ($bits == 64) {
346+ $function_regex =
347+ "^([0-9a-fA-F]+)\\s+<(.|[^\$]L.*?|\$[^L].*?|[^\$][^L].*?)>:";
348+ $type = ".dword";
349+ }
298350 } elsif ($arch eq "microblaze") {
299351 # Microblaze calls '_mcount' instead of plain 'mcount'.
300352 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$";