UPSTREAM: scripts/recordmcount.{c,pl}: support -ffunction-sections .text.* section names

When building with -ffunction-sections, the compiler will place each
function into its own ELF section, prefixed with ".text".  For example,
a simple test module with functions test_module_do_work() and
test_module_wq_func():

  % objdump --section-headers test_module.o | awk '/\.text/{print $2}'
  .text
  .text.test_module_do_work
  .text.test_module_wq_func
  .init.text
  .exit.text

Adjust the recordmcount scripts to look for ".text" as a section name
prefix.  This will ensure that those functions will be included in the
__mcount_loc relocations:

  % objdump --reloc --section __mcount_loc test_module.o
  OFFSET           TYPE              VALUE
  0000000000000000 R_X86_64_64       .text.test_module_do_work
  0000000000000008 R_X86_64_64       .text.test_module_wq_func
  0000000000000010 R_X86_64_64       .init.text

Link: http://lkml.kernel.org/r/1542745158-25392-2-git-send-email-joe.lawrence@redhat.com

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
(cherry picked from commit 9c8e2f6d3d361439cc6744a094f1c15681b55269)

BUG=chromium:1184483
TEST=veyron images boot

Signed-off-by: Manoj Gupta <manojgupta@google.com>
Change-Id: I0fbd159831f9fc7f96844e24467c8013a5915bde
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2746909
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Igor Sarkisov <isarkisov@google.com>
Reviewed-by: Caroline Tice <cmtice@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Auto-Submit: Manoj Gupta <manojgupta@chromium.org>
Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
2 files changed