public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Oleh Matiusha <oleh.matiusha@globallogic.com>
To: gcc-help@gcc.gnu.org
Subject: ELF section not represented in symbol table
Date: Mon, 11 Oct 2021 22:09:21 +0300	[thread overview]
Message-ID: <CAG5ScR+JfWHDh3EUp9Fweb1FNyasxEkWUqcygnAUsh8-d+3huA@mail.gmail.com> (raw)

Hello GCC,
I am stuck debugging the compilation of my kernel module.

The files and copy-pasted description of this problem can be viewed here:
github.com/omatiusha/cdevmod .

My dir structure is following:


..
  |-linux       (here resides the source code for linux kernel
5.14.0-09718-g4b93c544e90e,
  |              built with GCC Ubuntu 9.3.0-17ubuntu1~20.04 + binutils 2.34)
  |-linux-cross (here resides the source code for linux kernel
5.14.0-09718-g4b93c544e90e,
  |              built with x86_64-linux-gcc 8.5.0 + binutils 2.36.1
  |              from https://mirrors.edge.kernel.org/pub/tools/crosstool/).
  |              Tried also versions 9.4 and 11.1 from there.
  |-extmodules - repo mentioned above.

I am trying to get my module working with kpatch (github.com/dynup/kpatch)
and get stuck debugging the compiler. To spot the place when everything
gets wrong, I compile this module independently four times, with host or
cross compiler, and patched or unpatched.

make KCFLAGS="-ffunction-sections -fdata-sections"

for host-compiler, and

CROSS_COMPILE=x86_64-linux- suffix=-cross make KCFLAGS="-ffunction-sections
-fdata-sections"

for cross-compiler. Then I dump symbols with objdump -t cdevmod.o and full
text with objdump -s cdevmod.o | grep PATCHED -C5. And notice that for a
host compiler, both sections .rodata.cdev_read.str1.1 and
.rodata.cdev_read.str1.8 are present in symbol table of patched version,
while for a cross compiler section .rodata.cdev_read.str1.1 is present as a
section, but absent in the symbol table. This causes kpatch utilities not
to work properly and crash.

I want the cross compiler to behave like host one. Please someone suggest
why it behaves differently.

Best regards,

Oleh Matiusha

                 reply	other threads:[~2021-10-11 19:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAG5ScR+JfWHDh3EUp9Fweb1FNyasxEkWUqcygnAUsh8-d+3huA@mail.gmail.com \
    --to=oleh.matiusha@globallogic.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).