cmake/target.cmake defines macros for the supported platforms, this
commit changes predefined system macros to our own macros.
__linux__ --> OS_LINUX
__APPLE__ --> OS_DARWIN
__FreeBSD__ --> OS_FREEBSD
In case of shared builds the symbol can be represented in multiple
shared objects, and so if one SO contains _end symbol firstly, then it
it's address can subtracted from the symbol from another SO, and this
give overflow.
Here is an example of such symbol:
$ llvm-readelf -a programs/server/libclickhouse-server-libd.so | fgrep schemata_sql
552: 000000000010b869 0 NOTYPE GLOBAL DEFAULT 22 _binary_schemata_sql_size
1271: 000000000010b869 0 NOTYPE GLOBAL DEFAULT 22 _binary_schemata_sql_end
3627: 000000000010b480 0 NOTYPE GLOBAL DEFAULT 22 _binary_schemata_sql_start
5822: 000000000010b869 0 NOTYPE GLOBAL DEFAULT 22 _binary_schemata_sql_end
5828: 000000000010b869 0 NOTYPE GLOBAL DEFAULT 22 _binary_schemata_sql_size
5831: 000000000010b480 0 NOTYPE GLOBAL DEFAULT 22 _binary_schemata_sql_start
$ llvm-readelf -W -a src/TableFunctions/libclickhouse_table_functionsd.* | fgrep schemata_sql
1709: 00000000001fc5a1 0 NOTYPE GLOBAL DEFAULT 22 _binary_schemata_sql_end
5107: 00000000001fc5a1 0 NOTYPE GLOBAL DEFAULT 22 _binary_schemata_sql_size
6090: 00000000001fc1b8 0 NOTYPE GLOBAL DEFAULT 22 _binary_schemata_sql_start
10975: 00000000001fc1b8 0 NOTYPE GLOBAL DEFAULT 22 _binary_schemata_sql_start
10976: 00000000001fc5a1 0 NOTYPE GLOBAL DEFAULT 22 _binary_schemata_sql_end
10977: 00000000001fc5a1 0 NOTYPE GLOBAL DEFAULT 22 _binary_schemata_sql_size
To address this, add base address of the Elf into the resources to
compare with.
Follow-up for: #33134 (cc @alexey-milovidov)