[PATCH] D137044: [ClangFE] Add support for option -mno-pic-data-is-text-relative

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 6 12:01:05 PST 2022


jonpa updated this revision to Diff 473507.
jonpa added a comment.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

Sorry for the confusion... My first idea to make an internal value external was based on the assumption that since no other module would ever actually be aware of it, it should be safe to play around with it and pretend that its linkage is external. Live patching in itself is weird enough to perhaps allow this kind of trick. But I guess then that it wasn't really a good idea at all... (as a newbie here I'm curious on what would break..?)

I tried another approach along your suggestions instead:

- Be compatible with GCC and accept -mpic-data-is-text-relative and -mno-pic-data-is-text-relative CL options.
- If Clang Driver gets -mno-pic-data-is-text-relative, it emits -no-pic-data-is-text-relative (just like -pic-level and -pic-is-pie) to the CmdArgs to CC1.
- If CC1 gets -no-pic-data-is-text-relative, a Module flag is emitted to indicate this (just like "PIC Level" and "PIE Level").
- If this module attribute is present, the SystemZ backend will access an internal global value via GOT.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137044/new/

https://reviews.llvm.org/D137044

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/piclevels.c
  clang/test/Driver/pic.c
  llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
  llvm/test/CodeGen/SystemZ/no-pic-data-is-text-rel.ll
  llvm/test/CodeGen/SystemZ/pic-data-is-text-rel.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137044.473507.patch
Type: text/x-patch
Size: 10392 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221106/9aca99c4/attachment.bin>


More information about the llvm-commits mailing list