[PATCH] D60965: [llvm-mc] - Properly set the the address align field of the compressed sections.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 23 02:15:12 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL358960: [llvm-mc] - Properly set the the address align field of the compressed sections. (authored by grimar, committed by ).
Herald added a project: LLVM.
Changed prior to commit:
https://reviews.llvm.org/D60965?vs=196061&id=196199#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60965/new/
https://reviews.llvm.org/D60965
Files:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/test/MC/ELF/compression.s
Index: llvm/trunk/test/MC/ELF/compression.s
===================================================================
--- llvm/trunk/test/MC/ELF/compression.s
+++ llvm/trunk/test/MC/ELF/compression.s
@@ -10,9 +10,11 @@
// RUN: llvm-mc -filetype=obj -compress-debug-sections=zlib -triple x86_64-pc-linux-gnu < %s -o %t
// RUN: llvm-objdump -s %t | FileCheck --check-prefix=CHECK-ZLIB-STYLE %s
// RUN: llvm-dwarfdump -debug-str %t | FileCheck --check-prefix=STR %s
-// RUN: llvm-mc -filetype=obj -compress-debug-sections=zlib -triple i386-pc-linux-gnu < %s \
-// RUN: | llvm-readobj -symbols - | FileCheck --check-prefix=386-SYMBOLS-ZLIB %s
-// RUN: llvm-readobj -sections %t | FileCheck --check-prefix=ZLIB-STYLE-FLAGS %s
+// RUN: llvm-readobj -sections %t | FileCheck --check-prefixes=ZLIB-STYLE-FLAGS,ZLIB-STYLE-FLAGS64 %s
+
+// RUN: llvm-mc -filetype=obj -compress-debug-sections=zlib -triple i386-pc-linux-gnu < %s -o %t
+// RUN: llvm-readobj -symbols -sections %t \
+// RUN: | FileCheck --check-prefixes=386-SYMBOLS-ZLIB,ZLIB-STYLE-FLAGS,ZLIB-STYLE-FLAGS32 %s
// Don't compress small sections, such as this simple debug_abbrev example
// CHECK-GNU-STYLE: Contents of section .debug_abbrev:
@@ -60,6 +62,16 @@
// ZLIB-STYLE-FLAGS-NEXT: Type: SHT_PROGBITS
// ZLIB-STYLE-FLAGS-NEXT: Flags [
// ZLIB-STYLE-FLAGS-NEXT: SHF_COMPRESSED
+// ZLIB-STYLE-FLAGS-NEXT: SHF_MERGE
+// ZLIB-STYLE-FLAGS-NEXT: SHF_STRINGS
+// ZLIB-STYLE-FLAGS-NEXT: ]
+// ZLIB-STYLE-FLAGS-NEXT: Address:
+// ZLIB-STYLE-FLAGS-NEXT: Offset:
+// ZLIB-STYLE-FLAGS-NEXT: Size:
+// ZLIB-STYLE-FLAGS-NEXT: Link:
+// ZLIB-STYLE-FLAGS-NEXT: Info:
+// ZLIB-STYLE-FLAGS32-NEXT: AddressAlignment: 4
+// ZLIB-STYLE-FLAGS64-NEXT: AddressAlignment: 8
// 386-SYMBOLS-ZLIB: Name: .Linfo_string0
// 386-SYMBOLS-ZLIB-NOT: }
Index: llvm/trunk/lib/MC/ELFObjectWriter.cpp
===================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp
@@ -886,12 +886,16 @@
return;
}
- if (ZlibStyle)
+ if (ZlibStyle) {
// Set the compressed flag. That is zlib style.
Section.setFlags(Section.getFlags() | ELF::SHF_COMPRESSED);
- else
+ // Alignment field should reflect the requirements of
+ // the compressed section header.
+ Section.setAlignment(is64Bit() ? 8 : 4);
+ } else {
// Add "z" prefix to section name. This is zlib-gnu style.
MC.renameELFSection(&Section, (".z" + SectionName.drop_front(1)).str());
+ }
W.OS << CompressedContents;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60965.196199.patch
Type: text/x-patch
Size: 2559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190423/6335c363/attachment.bin>
More information about the llvm-commits
mailing list