linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasily Gorbik <gor@linux.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@suse.de>,
	Miroslav Benes <mbenes@suse.cz>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] objtool: Fix elf_create_undef_symbol() endianness
Date: Wed, 12 May 2021 19:42:10 +0200	[thread overview]
Message-ID: <patch-1.thread-6c9df9.git-d39264656387.your-ad-here.call-01620841104-ext-2554@work.hours> (raw)
In-Reply-To: <cover.thread-6c9df9.your-ad-here.call-01620841104-ext-2554@work.hours>

Currently x86 cross-compilation fails on big endian system with:

x86_64-cross-ld: init/main.o: invalid string offset 488112128 >= 6229
for section `.strtab'

Mark new ELF data in elf_create_undef_symbol() as symbol, so that libelf
does endianness handling correctly.

Fixes: 2f2f7e47f052 ("objtool: Add elf_create_undef_symbol()")
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
---
 tools/objtool/elf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index a8a0ee21f71a..4d0d4d7a9aba 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -791,6 +791,7 @@ struct symbol *elf_create_undef_symbol(struct elf *elf, const char *name)
 	data->d_buf = &sym->sym;
 	data->d_size = sizeof(sym->sym);
 	data->d_align = 1;
+	data->d_type = ELF_T_SYM;
 
 	sym->idx = symtab->len / sizeof(sym->sym);
 
-- 
2.25.4


  reply	other threads:[~2021-05-12 19:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 17:42 [PATCH 0/2] objtool: fixes for couple of endianness issues which appeared in v5.13-rc1 Vasily Gorbik
2021-05-12 17:42 ` Vasily Gorbik [this message]
2021-05-12 17:42 ` [PATCH 2/2] objtool/x86: Fix elf_add_alternative() endianness Vasily Gorbik

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=patch-1.thread-6c9df9.git-d39264656387.your-ad-here.call-01620841104-ext-2554@work.hours \
    --to=gor@linux.ibm.com \
    --cc=bp@suse.de \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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 NNTP newsgroup(s).