[aur-general] Need help with some patching for my package (gcc44-multilib)

carstene1ns arch at carsten-teibes.de
Sun Jun 21 19:30:45 UTC 2015


Am 20.06.2015 um 12:11 schrieb Giovanni Santini:
> [...]
> I had some problems in compiling (toplevel.c), that I fixed an hand-made
> patch, but then I have problems in linking (double defines for the
> function I fixed with my patch)...
> [...]

tl;dr:
Here[1] is a working patch.

Reason it did not work before: GCC 5 is just strict and does not like
multiple definitions of a function by default. There is a warning above
the functions, it tells you the way the include/inline magic is done may
be problematic.

Reason it did not work after your patch: The way inline functions are
treated changed with GCC5[2]. The two functions have been included and
exported in all .c source files referencing the toplev.h header and
therefore a name clash happened when linking them together.

The solution: Define the functions statically. This way they still will
be included in every .c file referencing the toplev.h header, but they
will only be available from inside them, not exported.
GCC will optimize them away anyways, if not used.

After fiddling a bit with the source, I thought this problem should be
known by the GCC devs (as they even made a comment about that broken
magic) and therefore I looked a bit through the toplev.(c/h) from more
recent versions. The code has since been refactored, but I found the
relevant change in the gcc repository[3] (used github for better web
view). The removed checks for the C*Z_HWI macros is because they will
only be defined when using the faster inlined functions, but are useless
in the fallback code.

Hope this helps.

best regards,
carstene1ns

[1]: https://paste.xinu.at/f32k/
[2]: https://gcc.gnu.org/gcc-5/porting_to.html ("Different semantics for
inline functions")
[3]:
https://github.com/gcc-mirror/gcc/commit/4345dfaa7260253cb0d3b10b4b466f586e9d28dc


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/aur-general/attachments/20150621/e877afe0/attachment.asc>


More information about the aur-general mailing list