Merge pull request #652 from agx/symbols-file

Add symbols file
This commit is contained in:
emersion 2018-02-23 09:54:49 +01:00 committed by GitHub
commit bd9583a7e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 78 additions and 6 deletions

View file

@ -121,12 +121,32 @@ static const struct wl_registry_listener registry_listener = {
.global_remove = handle_global_remove, .global_remove = handle_global_remove,
}; };
static int backingfile(off_t size) {
static char template[] = "/tmp/wlroots-shared-XXXXXX";
int fd, ret;
fd = mkstemp(template);
if (fd < 0) {
return -1;
}
while ((ret = ftruncate(fd, size)) == EINTR) {}
if (ret < 0) {
close(fd);
return -1;
}
unlink(template);
return fd;
}
static struct wl_buffer *create_shm_buffer(int width, int height, static struct wl_buffer *create_shm_buffer(int width, int height,
void **data_out) { void **data_out) {
int stride = width * 4; int stride = width * 4;
int size = stride * height; int size = stride * height;
int fd = os_create_anonymous_file(size); int fd = backingfile(size);
if (fd < 0) { if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n", size); fprintf(stderr, "creating a buffer file for %d B failed: %m\n", size);
return NULL; return NULL;

View file

@ -62,7 +62,7 @@ extern const GLchar fragment_src_external[];
bool _gles2_flush_errors(const char *file, int line); bool _gles2_flush_errors(const char *file, int line);
#define gles2_flush_errors(...) \ #define gles2_flush_errors(...) \
_gles2_flush_errors(_strip_path(__FILE__), __LINE__) _gles2_flush_errors(wlr_strip_path(__FILE__), __LINE__)
#define GL_CALL(func) func; gles2_flush_errors() #define GL_CALL(func) func; gles2_flush_errors()

View file

@ -28,13 +28,13 @@ void wlr_log_init(log_importance_t verbosity, log_callback_t callback);
void _wlr_log(log_importance_t verbosity, const char *format, ...) ATTRIB_PRINTF(2, 3); void _wlr_log(log_importance_t verbosity, const char *format, ...) ATTRIB_PRINTF(2, 3);
void _wlr_vlog(log_importance_t verbosity, const char *format, va_list args) ATTRIB_PRINTF(2, 0); void _wlr_vlog(log_importance_t verbosity, const char *format, va_list args) ATTRIB_PRINTF(2, 0);
const char *_strip_path(const char *filepath); const char *wlr_strip_path(const char *filepath);
#define wlr_log(verb, fmt, ...) \ #define wlr_log(verb, fmt, ...) \
_wlr_log(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, ##__VA_ARGS__) _wlr_log(verb, "[%s:%d] " fmt, wlr_strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
#define wlr_vlog(verb, fmt, args) \ #define wlr_vlog(verb, fmt, args) \
_wlr_vlog(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, args) _wlr_vlog(verb, "[%s:%d] " fmt, wlr_strip_path(__FILE__), __LINE__, args)
#define wlr_log_errno(verb, fmt, ...) \ #define wlr_log_errno(verb, fmt, ...) \
wlr_log(verb, fmt ": %s", ##__VA_ARGS__, strerror(errno)) wlr_log(verb, fmt ": %s", ##__VA_ARGS__, strerror(errno))

View file

@ -140,6 +140,8 @@ wlr_deps += [
math, math,
] ]
symbols_file = 'wlroots.syms'
symbols_flag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbols_file)
lib_wlr = library( lib_wlr = library(
meson.project_name(), meson.project_name(),
version: '.'.join(so_version), version: '.'.join(so_version),
@ -147,6 +149,7 @@ lib_wlr = library(
dependencies: wlr_deps, dependencies: wlr_deps,
include_directories: wlr_inc, include_directories: wlr_inc,
install: true, install: true,
link_args : symbols_flag,
) )
wlroots = declare_dependency( wlroots = declare_dependency(

View file

@ -73,7 +73,7 @@ void _wlr_log(log_importance_t verbosity, const char *fmt, ...) {
// e.g. '/src/build/wlroots/backend/wayland/backend.c' and // e.g. '/src/build/wlroots/backend/wayland/backend.c' and
// '../backend/wayland/backend.c' will both be stripped to // '../backend/wayland/backend.c' will both be stripped to
// 'backend/wayland/backend.c' // 'backend/wayland/backend.c'
const char *_strip_path(const char *filepath) { const char *wlr_strip_path(const char *filepath) {
static int srclen = sizeof(WLR_SRC_DIR); static int srclen = sizeof(WLR_SRC_DIR);
if (strstr(filepath, WLR_SRC_DIR) == filepath) { if (strstr(filepath, WLR_SRC_DIR) == filepath) {
filepath += srclen; filepath += srclen;

49
wlroots.syms Normal file
View file

@ -0,0 +1,49 @@
WLROOTS_0_0_0 {
global:
wlr_*;
_wlr_log;
local:
wlr_data_device_keyboard_drag_interface;
wlr_data_device_pointer_drag_interface;
wlr_data_device_touch_drag_interface;
wlr_drm_backend_get_session;
wlr_drm_check_features;
wlr_drm_connector_cleanup;
wlr_drm_connector_start_renderer;
wlr_drm_event;
wlr_drm_get_connector_props;
wlr_drm_get_crtc_props;
wlr_drm_get_plane_props;
wlr_drm_get_prop;
wlr_drm_get_prop_blob;
wlr_drm_plane_surfaces_init;
wlr_drm_renderer_finish;
wlr_drm_renderer_init;
wlr_drm_resources_free;
wlr_drm_resources_init;
wlr_drm_restore_outputs;
wlr_drm_scan_connectors;
wlr_drm_surface_finish;
wlr_drm_surface_get_front;
wlr_drm_surface_init;
wlr_drm_surface_make_current;
wlr_drm_surface_mgpu_copy;
wlr_drm_surface_post;
wlr_drm_surface_swap_buffers;
wlr_egl_get_buffer_age;
wlr_libinput_event;
wlr_libinput_keyboard_create;
wlr_libinput_pointer_create;
wlr_libinput_tablet_pad_create;
wlr_libinput_tablet_tool_create;
wlr_libinput_touch_create;
wlr_log_stderr;
wlr_signal_emit_safe;
wlr_subsurface_destroy;
wlr_wl_output_for_surface;
wlr_wl_output_layout_get_box;
wlr_wl_output_move_cursor;
wlr_wl_output_update_cursor;
wlr_wl_registry_poll;
*;
};