Commit Graph

21 Commits

Author SHA1 Message Date
Azat Khuzhin
a23bb79479 Fix parsing symbols from resources (for shared builds)
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)
2021-12-29 09:56:59 +03:00
Alexey Milovidov
bbd8e055a1 Fix clang-tidy 2021-12-24 18:25:59 +03:00
Alexey Milovidov
c8b8cc74fc Fix clang-tidy 2021-12-24 18:15:04 +03:00
Alexey Milovidov
a96b4d50d6 Fix error 2021-12-24 12:25:27 +03:00
Alexey Milovidov
003ee51c6d Fix buildId 2021-12-24 12:25:27 +03:00
Alexey Milovidov
ae61cf66b5 Fix resources 2021-12-24 12:25:27 +03:00
Alexey Milovidov
29d28c531f Move code around to avoid dlsym on Musl 2021-12-24 12:25:27 +03:00
Amos Bird
163a416366
Refactor 2021-09-02 19:29:14 +08:00
Amos Bird
e6a1124ebe
Reload stacktrace cache. 2021-08-25 21:05:48 +08:00
Azat Khuzhin
810023a65c Do not undefine __has_feature (may break c++ headers)
If the order of <common/defines.h> and c++ header will be wrong the
compilation will be broken.

v2: rename __ch_has_feature to ch_has_feature to fix -Wreserved-id-macro
v3: do not fallback to 0
2021-02-23 19:46:47 +03:00
Amos Bird
366c75ed29
Ensure buildid length 2021-01-24 10:28:43 +08:00
Amos Bird
554663a533
Support new .debug location 2021-01-24 03:03:54 +08:00
Amos Bird
310918b06a
reload symbols and fix build-id 2020-11-30 22:30:55 +08:00
Alexey Milovidov
ef5363b87f Fix terribly wrong code 2020-09-19 02:05:13 +03:00
Alexey Milovidov
edd89a8610 Fix half of typos 2020-08-08 03:47:03 +03:00
Alexey Milovidov
7f05d2bac0 Merge branch 'master' into print-build-id 2020-06-21 13:44:32 +03:00
Alexey Milovidov
961568e978 Fix false MSan report in SymbolIndex 2020-06-20 22:05:03 +03:00
Alexey Milovidov
ead4a2cfd9 Print build id in crash messages 2020-06-20 12:07:05 +03:00
Alexey Milovidov
4a052f60c7 Don't use debug info from ELF file if it doesn't correspond to the running binary. 2020-06-14 06:10:35 +03:00
Alexey Milovidov
be22a4b94e Checkpoint 2020-04-22 08:39:31 +03:00
Ivan Lezhankin
06446b4f08 dbms/ → src/ 2020-04-03 18:14:31 +03:00