[PATCH] D33046: [ELF] - Set DF_TEXTREL flag properly.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 08:58:05 PDT 2017


grimar updated this revision to Diff 98473.
grimar added a comment.

- Uploaded correct patch.


https://reviews.llvm.org/D33046

Files:
  ELF/SyntheticSections.cpp
  test/ELF/ztext-text-notext.s


Index: test/ELF/ztext-text-notext.s
===================================================================
--- test/ELF/ztext-text-notext.s
+++ test/ELF/ztext-text-notext.s
@@ -19,16 +19,16 @@
 # CHECK-NEXT:    }
 # CHECK-NEXT:  ]
 # CHECK: DynamicSection [
-# CHECK: 0x0000000000000016 TEXTREL 0x0
+# CHECK: 0x000000000000001E FLAGS TEXTREL
 
 # STATIC:      Relocations [
 # STATIC-NEXT:    Section {{.*}} .rela.dyn {
 # STATIC-NEXT:      0x201008 R_X86_64_64 bar 0x0
 # STATIC-NEXT:      0x201010 R_X86_64_PC64 zed 0x0
 # STATIC-NEXT:    }
 # STATIC-NEXT:  ]
 # STATIC: DynamicSection [
-# STATIC: 0x0000000000000016 TEXTREL 0x0
+# STATIC: 0x000000000000001E FLAGS TEXTREL
 
 foo:
 .quad foo
Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ ELF/SyntheticSections.cpp
@@ -1066,6 +1066,8 @@
   }
   if (Config->HasStaticTlsModel)
     DtFlags |= DF_STATIC_TLS;
+  if (!Config->ZText)
+    DtFlags |= DF_TEXTREL;
 
   if (DtFlags)
     add({DT_FLAGS, DtFlags});
@@ -1101,8 +1103,6 @@
   add({DT_SYMENT, sizeof(Elf_Sym)});
   add({DT_STRTAB, In<ELFT>::DynStrTab});
   add({DT_STRSZ, In<ELFT>::DynStrTab->getSize()});
-  if (!Config->ZText)
-    add({DT_TEXTREL, (uint64_t)0});
   if (In<ELFT>::GnuHashTab)
     add({DT_GNU_HASH, In<ELFT>::GnuHashTab});
   if (In<ELFT>::HashTab)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33046.98473.patch
Type: text/x-patch
Size: 1395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170510/6ebb8e18/attachment.bin>


More information about the llvm-commits mailing list