From 71eb351d01a32f188f27c254f37f549db2851307 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 24 May 2010 12:27:30 +0000 Subject: [PATCH] 2010-05-24 Richard Guenther * lto-elf.c (lto_obj_build_section_table): Work around FreeBSD libelf issue. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159777 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/lto/ChangeLog | 5 +++++ gcc/lto/lto-elf.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 83cfe3e3e90d..766c71b85fea 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,8 @@ +2010-05-24 Richard Guenther + + * lto-elf.c (lto_obj_build_section_table): Work around + FreeBSD libelf issue. + 2010-05-22 Richard Guenther * lto.c (read_cgraph_and_symbols): Do not collect. diff --git a/gcc/lto/lto-elf.c b/gcc/lto/lto-elf.c index 1796888f4c31..bb4df809d9e1 100644 --- a/gcc/lto/lto-elf.c +++ b/gcc/lto/lto-elf.c @@ -189,6 +189,13 @@ lto_obj_build_section_table (lto_file *lto_file) section_hash_table = htab_create (37, hash_name, eq_name, free); base_offset = elf_getbase (elf_file->elf); + /* We are reasonably sure that elf_getbase does not fail at this + point. So assume that we run into the incompatibility with + the FreeBSD libelf implementation that has a non-working + elf_getbase for non-archive members in which case the offset + should be zero. */ + if (base_offset == (size_t)-1) + base_offset = 0; for (section = elf_getscn (elf_file->elf, 0); section; section = elf_nextscn (elf_file->elf, section)) -- 2.47.2