This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Help with adding header w/ non-template functions to libstdc++


Hello!

I'm very green to working on GCC, but nonetheless I've been working on the
contracts proposal (p0542). I feel like I've come a long way but I've been
struggling with adding symbols to libstdc++.

Basically, I added a new header in include/std/ with the boilerplate
modeled after the exception header. I added the source code in src/c++11
and cheated by changing the Makefile to compile these files with gnu++1z
(obviously I should just make a new folder but I wanted to minimize reasons
things were going wrong). I modified the Makefiles to add the necessary
contract.cc file and contract header as well. I can attach these files if
anyone thinks they will be helpful but from my experiments I don't honestly
think the contents of _these_ files are the problem.

I read the documentation at
/path/to/my/build/doc/html/manual/appendix_porting.html#appendix.porting.build_hacking
and _mostly_ followed the steps:
* I didn't run autoreconf,
* I didn't run check-abi (though I did add the new version to the actual
test file based of a previous patch),
* I didn't update the documentation, and
* I didn't generate baseline_symbol.txt.

The above is a small white lie, because I _did_ run autoreconf, after
changing override.m4 to use my local version. This is the only way I've
been able to get the build to generate my version of the library. However,
I still have to link the correct version for the executable that is built.
I also tried running exactly auroreconf2.64 from a docker image of Ubuntu
but it only changed one line! And the line it did change seemed more or
less meaningless:

if test "${with_gcc_major_version_only+set}" = set; then :
>   withval=$with_gcc_major_version_only; if test
> x$with_gcc_major_version_only = xyes ; then
> +        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*/\1/'"
> -        get_gcc_base_ver="sed -e 's/^\([0-9]*\).*\$\$/\1/'"
>       fi
> fi
>

Not only that, but the build still didn't generate the correct standard
library version! It instead builds the older version.

Here are my gnu.ver changes:

GLIBCXX_3.4.26 {
>
>     # std::contract_violation::contract_violation (int, std::string_view,
> std::string_view, std::string_view, std::string_view)
>
> _ZNSt18contract_violationC1EiSt17basic_string_viewIcSt11char_traitsIcEES3_S3_S3_;
>     _ZNKSt18contract_violation11line_numberEv;
>     _ZNKSt18contract_violation13function_nameEv;
>     _ZNKSt18contract_violation15assertion_levelEv;
>     _ZNKSt18contract_violation7commentEv;
>     _ZNKSt18contract_violation9file_nameEv;
>     # void std::__on_contract_violation (bool, int, const char *, const
> char *, const char *, const char *)
>     _ZSt23__on_contract_violationbiPKcS0_S0_S0_;
>     # void std::handle_contract_violation (const std::contract_violation &)
>     _ZSt25handle_contract_violationRKSt18contract_violation;
>
> } GLIBCXX_3.4.25;
>

I'm not sure if I should be adding a new version or not but either way I'm
curious as to why I can't get the new version to build!

I've been using these three patches as a guide to how this is usually done:
* https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=194958
* https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=217452
*
https://gcc.gnu.org/viewcvs/gcc?limit_changes=0&view=revision&revision=197380

However, I can't understand exactly where my trouble is coming from based
off of them.

Any hints?

Thanks for your time!
Andrew Marmaduke


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]