r334839 - bpf: recognize target specific option -mattr=dwarfris in clang

Yonghong Song via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 15 08:53:31 PDT 2018


Author: yhs
Date: Fri Jun 15 08:53:31 2018
New Revision: 334839

URL: http://llvm.org/viewvc/llvm-project?rev=334839&view=rev
Log:
bpf: recognize target specific option -mattr=dwarfris in clang

The following is the usage example with clang:
  bash-4.2$ clang -target bpf -O2 -g -c -Xclang -target-feature -Xclang +dwarfris t.c
  bash-4.2$ llvm-objdump -S -d t.o

  t.o:    file format ELF64-BPF

  Disassembly of section .text:
  test:
  ; int test(void) {
       0:       b7 00 00 00 00 00 00 00         r0 = 0
  ; return 0;
         1:       95 00 00 00 00 00 00 00         exit
  bash-4.2$ cat t.c
  int test(void) {
    return 0;
  }
  bash-4.2$

Signed-off-by: Yonghong Song <yhs at fb.com>

Modified:
    cfe/trunk/lib/Basic/Targets/BPF.h

Modified: cfe/trunk/lib/Basic/Targets/BPF.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/BPF.h?rev=334839&r1=334838&r2=334839&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets/BPF.h (original)
+++ cfe/trunk/lib/Basic/Targets/BPF.h Fri Jun 15 08:53:31 2018
@@ -47,7 +47,7 @@ public:
                         MacroBuilder &Builder) const override;
 
   bool hasFeature(StringRef Feature) const override {
-    return Feature == "bpf" || Feature == "alu32";
+    return Feature == "bpf" || Feature == "alu32" || Feature == "dwarfris";
   }
 
   void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,




More information about the cfe-commits mailing list