aboutsummaryrefslogtreecommitdiff
path: root/libminijailpreload.c
diff options
context:
space:
mode:
authorWill Drewry <wad@chromium.org>2011-10-21 16:38:58 -0500
committerGerrit <chrome-bot@google.com>2011-10-27 15:30:12 -0700
commit6ac9112378c716d6c1de2952bb971728b0655616 (patch)
tree333c93a54015401667e984383bb0ae6c34b50aea /libminijailpreload.c
parentbee7ba7f2cd6168f60f51dd0ce3ac8961b4cc25a (diff)
downloadminijail-6ac9112378c716d6c1de2952bb971728b0655616.tar.gz
Makefile, libminijail: Invert symbol visibility to allow sane unittesting
libminijail.c contains many helpers that are marked static. For instance, consumestr and consumebytes are both static yet eminently unittestable. The options for testing are as follows: 1. Replace "static" with a "private" or "protected" macro which we undefined during testing. 2. #include "libminijail.c" into the unittests to avoid visibility challenges. 3. Change default visibility to internal for all functions and data then invert it during unittesting. I chose #3. It also has the benefit of creating an optimally stripped binary and shared object. Using 'internal' visibility also let's the linker perform more optimizations. Feedback on this approach is very welcome. In the past, I've chosen approach #2, but that seems wrong for at least a couple of reasons. TEST=build, run readelf -s in all the output. .so should show LOCAL for all internal functions and on executables, private functions should show INTERNAL. Running strip --unneeded should remove all of the private linkage which can be checked with readelf -s again BUG=none Change-Id: Ifb1f02b4505f2f25d824c067748054520c39d3bf Reviewed-on: https://gerrit.chromium.org/gerrit/10540 Commit-Ready: Will Drewry <wad@chromium.org> Tested-by: Will Drewry <wad@chromium.org> Reviewed-by: Will Drewry <wad@chromium.org>
Diffstat (limited to 'libminijailpreload.c')
-rw-r--r--libminijailpreload.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libminijailpreload.c b/libminijailpreload.c
index 9b7d338..90f8733 100644
--- a/libminijailpreload.c
+++ b/libminijailpreload.c
@@ -96,7 +96,7 @@ static int fake_main(int argc, char **argv, char **envp)
* so we can't rely on things like malloc() being available yet.
*/
-int __libc_start_main(int (*main) (int, char **, char **),
+int API __libc_start_main(int (*main) (int, char **, char **),
int argc, char **ubp_av, void (*init) (void),
void (*fini) (void), void (*rtld_fini) (void),
void (*stack_end))