MantisBT - NetSurf
View Issue Details
0002679NetSurf[All Projects] Generalpublic2019-06-27 19:552019-07-19 09:23
ReporterMichael Forney 
Assigned ToJohn-Mark Bell 
PlatformOSOS Version
Product Version3.9 
Target Version3.9Fixed in Version3.9 
Fixed in CI build #
Reported in CI build #
URL of problem page
Summary0002679: _ALIGNED used in public header in libdom
DescriptionWhen building netsurf with `LDFLAGS=-Wl,--warn-common`, I noticed many warnings of duplicate definitions for a global variable named _ALIGNED, for example:

    /usr/bin/ld: build/Linux-gtk/utils_libdom.o and build/Linux-gtk/build_Linux-gtk_duktape_application_cache.o: warning: multiple common of `_ALIGNED'

It looks like _ALIGNED is defined in the netsurf buildsystem as __attribute__((aligned)). However, since it is used in the public header dom/core/string.h, this means that _ALIGNED needs to be defined when building every source file that includes it.

Since _ALIGNED isn't defined when building netsurf itself, every source file that includes dom/core/string.h ends up treating it as a definition of a global variable called _ALIGNED.

I'm not sure how best to resolve this, but I do have some questions and suggestions.

Why is _ALIGNED needed for dom_string? It was added in 98e480e4[0] without much explanation. Looking through the commit history, I see that originally when dom_string was split up (in 79e6a0be[1]), dom_string was *not* used as the first member of dom_string_internal, and instead aliased with dom_string_internal. 98e480e4[0] fixes this by making dom_string the first member of dom_string_internal, but also adds _ALIGNED. I'm having trouble coming up with a reason why the increased alignment of dom_string is required.

If _ALIGNED is indeed necessary, maybe it should be added to the pkg-config file for libdom, so that it gets defined properly for software that uses it. Or, if dom_string is only ever allocated through dom_string_internal, maybe it could be moved to the `base` member of dom_string_internal?

TagsNo tags attached.
Attached Files

Vincent Sanders   
2019-06-30 12:52   
removed usage of unnecessary _ALIGNED macro in libdom public headers
Vincent Sanders   
2019-07-19 09:23   
we believe this issue has been resolved in NetSurf 3.9

Issue History
2019-06-27 19:55Michael ForneyNew Issue
2019-06-30 12:52Vincent SandersAssigned To => John-Mark Bell
2019-06-30 12:52Vincent SandersReproducibilityN/A => always
2019-06-30 12:52Vincent SandersStatusnew => resolved
2019-06-30 12:52Vincent SandersResolutionopen => fixed
2019-06-30 12:52Vincent SandersProduct Version => 3.9
2019-06-30 12:52Vincent SandersFixed in Version => 3.9
2019-06-30 12:52Vincent SandersTarget Version => 3.9
2019-06-30 12:52Vincent SandersNote Added: 0001975
2019-07-19 09:23Vincent SandersStatusresolved => closed
2019-07-19 09:23Vincent SandersNote Added: 0001995