[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:56:52 PDT 2017


grimar created this revision.

Documentation says that DT_TEXTREL has been superseded by the DF_TEXTREL flag.

I think that happened 18 years ago in this commit:
https://sourceware.org/git/?p=glibc.git;a=commit;h=06535ae9487708dad9048552c9c92828d998a897

https://sourceware.org/git/?p=glibc.git;a=blobdiff;f=elf/dynamic-link.h;h=59a6001069f56b075c2bebaa9bff609b8ce92d9d;hp=d322c1231faa19900cf1f5e078d93d4203b8ce7a;hb=06535ae9487708dad9048552c9c92828d998a897;hpb=fc9cfb28c05def1bfc0edc099d8001f83654fd10

In that case it looks adding DT_TEXTREL is a bit outdated and we can use DF_TEXTREL always instead.


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,6 +19,7 @@
 # CHECK-NEXT:    }
 # CHECK-NEXT:  ]
 # CHECK: DynamicSection [
+# CHECK: 0x000000000000001E FLAGS TEXTREL
 # CHECK: 0x0000000000000016 TEXTREL 0x0
 
 # STATIC:      Relocations [
@@ -28,6 +29,7 @@
 # STATIC-NEXT:    }
 # STATIC-NEXT:  ]
 # STATIC: DynamicSection [
+# STATIC: 0x000000000000001E FLAGS TEXTREL
 # STATIC: 0x0000000000000016 TEXTREL 0x0
 
 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});


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


More information about the llvm-commits mailing list