[PATCH] Implementation of #pragma (data|code|const|bss)_seg

Warren Hunt whunt at google.com
Wed Apr 2 18:21:39 PDT 2014


  A major overhaul.  The patch now considers __attribute__((section())), __declspec(allocate()) and #pragma section.  I've also added gcc style diagnostics for section conflicts (a behavior clang lacked for __attribute__((section()))).  I've added test cases for both Sema and CodeGen.  The CodeGen test case reuses an old file-name and moves its contents to a more appropriately named test.

  Note: There is one known outstanding issue with the patch:  In C mode, due to tentative declarations, we don't actually process uninitialized variables until the end of the TU, which means they get stuck in whatever section the last #pragma bss_seg() dictates, rather than the one that was active when they were defined.

Hi rsmith, majnemer, rnk, aaron.ballman,

http://llvm-reviews.chandlerc.com/D3065

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D3065?vs=8116&id=8320#toc

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/DiagnosticParseKinds.td
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Basic/TokenKinds.def
  include/clang/Parse/Parser.h
  include/clang/Sema/Sema.h
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParsePragma.cpp
  lib/Parse/ParseStmt.cpp
  lib/Parse/Parser.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaAttr.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaObjCProperty.cpp
  test/CodeGen/function-sections.c
  test/CodeGen/sections.c
  test/Sema/pragma-section.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3065.3.patch
Type: text/x-patch
Size: 30962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140402/2c2de75e/attachment.bin>


More information about the cfe-commits mailing list