diff options
-rw-r--r-- | gcc/lto/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/lto/lto-elf.c | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 83cfe3e..766c71b 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,8 @@ +2010-05-24 Richard Guenther <rguenther@suse.de> + + * lto-elf.c (lto_obj_build_section_table): Work around + FreeBSD libelf issue. + 2010-05-22 Richard Guenther <rguenther@suse.de> * lto.c (read_cgraph_and_symbols): Do not collect. diff --git a/gcc/lto/lto-elf.c b/gcc/lto/lto-elf.c index 1796888..bb4df80 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)) |