[PATCH] D18682: Add some dllexport tests

Warren Ristow via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 1 18:31:08 PDT 2016


wristow added a comment.

I'll explain, but maybe Reid or someone else will jump in.

The three items being added, and explanations, are:

- Variables in bss are exported appropriately

  Added a definition of an exported new variable `WeakVar3`, which is identical to the existing (exported) variable `WeakVar1`, except for the value it is initialized to.  `WeakVar3` is initialized to 0, making it a candidate for the bss section (`WeakVar1` was non-zero, specifically 1, so it could not be in bss).  Previously, there weren't any bss variables that were exported, and with this new test, there is one.  So we're making sure the dllexport attribute for a variable in bss is handled, by checking that `WeakVar3` is in `.bss`, and that `WeakVar3` appears in the export table.

- Non-dllexport symbols aliased to dllexport symbols are not exported

  The function `f1()` is exported, and an alias for `f1` has been defined, where the aliasing symbol is _not_ exported, specifically `aliasNotExported`.  The test makes sure that `aliasNotExported` doesn't appear in the export table.  I.e., it makes sure that the dllexport attribute from `f1` doesn't incorrectly "propagate through" to `aliasNotExported`.  (Note that the dual of this test already existed, in that there is an unexported function, `notExported()`, and an alias for `notExported` was defined (specifically `alias3`), and `alias3` _is_ exported.  The test checks that `alias3` appears in the export table.  With the proposed change, we will also check the other way around.)

- Symbols declared as dllexport but are not defined are not exported

  The variable `exportedButNotDefinedVariable` has been added, and declared as dllexport (and it is used), but no defition of the variable appears.  Similarly, the function `exportedButNotDefinedFunction()` has been declared as dllexport (and used), but there isn't a definition.  Even though they are declared as dllexport, since there is no definition, they cannot be exported.  So they should not appear in the export table.  The test checks that they don't appear in the table.


http://reviews.llvm.org/D18682





More information about the llvm-commits mailing list