[llvm-commits] [lld] r165170 - in /lld/trunk: lib/ReaderWriter/ELF/ReaderELF.cpp test/elf/sections.objtxt
Sid Manning
sidneym at codeaurora.org
Wed Oct 3 14:46:48 PDT 2012
Author: sidneym
Date: Wed Oct 3 16:46:48 2012
New Revision: 165170
URL: http://llvm.org/viewvc/llvm-project?rev=165170&view=rev
Log:
* Return correct size and alignment for common symbols.
Modified:
lld/trunk/lib/ReaderWriter/ELF/ReaderELF.cpp
lld/trunk/test/elf/sections.objtxt
Modified: lld/trunk/lib/ReaderWriter/ELF/ReaderELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ReaderELF.cpp?rev=165170&r1=165169&r2=165170&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ReaderELF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ReaderELF.cpp Wed Oct 3 16:46:48 2012
@@ -237,11 +237,11 @@
virtual uint64_t size() const {
- // Common symbols are not allocated in object files so
- // their size is zero.
+ // Common symbols are not allocated in object files,
+ // so use st_size to tell how many bytes are required.
if ((_symbol->getType() == llvm::ELF::STT_COMMON)
|| _symbol->st_shndx == llvm::ELF::SHN_COMMON)
- return (uint64_t)0;
+ return (uint64_t)_symbol->st_size;
return _contentData.size();
@@ -317,7 +317,7 @@
// constraints in st_value.
if ((_symbol->getType() == llvm::ELF::STT_COMMON)
|| _symbol->st_shndx == llvm::ELF::SHN_COMMON) {
- return (Alignment(_symbol->st_value));
+ return Alignment(llvm::Log2_64(_symbol->st_value));
}
return Alignment(llvm::Log2_64(_section->sh_addralign));
Modified: lld/trunk/test/elf/sections.objtxt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/elf/sections.objtxt?rev=165170&r1=165169&r2=165170&view=diff
==============================================================================
--- lld/trunk/test/elf/sections.objtxt (original)
+++ lld/trunk/test/elf/sections.objtxt Wed Oct 3 16:46:48 2012
@@ -24,7 +24,7 @@
ED: 'e_indent[EI_DATA]', 0x01
ED: 'e_machine', 0x0003
ED: Section 1
-ED: 'sh_addralign', 0x00000002
+ED: 'sh_addralign', 0x00000001
ED: Section 2
ED: 'sh_addralign', 0x00000008
ED: Section 7
More information about the llvm-commits
mailing list