aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-05-24 12:27:30 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-05-24 12:27:30 +0000
commit468194f4432a52e5767421f88104a9f1f4d4ff36 (patch)
tree82ad25914515e78cb52c54540c7848eb10e631ce /gcc/lto
parentb748fbd6b981877caad2c6da42974610cdb53e01 (diff)
downloadgcc-468194f4432a52e5767421f88104a9f1f4d4ff36.zip
gcc-468194f4432a52e5767421f88104a9f1f4d4ff36.tar.gz
gcc-468194f4432a52e5767421f88104a9f1f4d4ff36.tar.bz2
lto-elf.c (lto_obj_build_section_table): Work around FreeBSD libelf issue.
2010-05-24 Richard Guenther <rguenther@suse.de> * lto-elf.c (lto_obj_build_section_table): Work around FreeBSD libelf issue. From-SVN: r159777
Diffstat (limited to 'gcc/lto')
-rw-r--r--gcc/lto/ChangeLog5
-rw-r--r--gcc/lto/lto-elf.c7
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))