public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [Bug default/28025] New: exceptions are not checked for ABI compatibility.
@ 2021-06-29 15:28 woodard at redhat dot com
  2021-06-30 23:09 ` [Bug default/28025] " woodard at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: woodard at redhat dot com @ 2021-06-29 15:28 UTC (permalink / raw)
  To: libabigail

https://sourceware.org/bugzilla/show_bug.cgi?id=28025

            Bug ID: 28025
           Summary: exceptions are not checked for ABI compatibility.
           Product: libabigail
           Version: unspecified
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: default
          Assignee: dodji at redhat dot com
          Reporter: woodard at redhat dot com
                CC: libabigail at sourceware dot org
  Target Milestone: ---

Libabigail doesn't inspect types which are thrown for compatibility this can
lead to ABI errors. The reason for this appears to be that it believes that the
types are private and therefore not part of the exported ABI. 

Here is an example that shows that they are.

$ for i in rtti-exception.[hC] use-rtti-excep.C;do echo --- $i;cat $i;done
--- rtti-exception.C
#include <iostream>
#include "rtti-exception.h"

extern int do_something( int num){
  std::cout << "did something\n";
  throw ex(num);
}
--- rtti-exception.h
#ifdef VER_1
class ex {
public:
  int num;
  ex( int n):num(n){}
};
#endif

#ifdef VER_2
class ex {
  float num;
public:
  ex( int n):num(n){}
};
#endif

int do_something( int num);
--- use-rtti-excep.C
#define VER_1

#include <iostream>

#include "rtti-exception.h"

int main( int argc, char **argv){
  try{
    do_something( 3);
  }
  catch( ex &excep){
    std::cout << "caught " << excep.num << std::endl;
  }
  return 0;
}

$ abidiff librttiexcep_v1.so librttiexcep_v2.so ;echo $?
0
$ abidiff rtti-v1.o rtti-v2.o ;echo $?
0
$ export SWAP_LIB_FILENAME=libswapfile
$ LD_LIBRARY_PATH=. ./use-rtti-excep
did something
caught 3
$ LD_AUDIT=./swap-libs-audit.so LD_LIBRARY_PATH=. ./use-rtti-excep 
did something
caught 1077936128

It is believed that types that there is enough information in the LSDA of the
object doing the throwing to be able to identify the type being thrown. It can
then be added to the list of types which must be compared when comparing
libraries.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-07 18:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29 15:28 [Bug default/28025] New: exceptions are not checked for ABI compatibility woodard at redhat dot com
2021-06-30 23:09 ` [Bug default/28025] " woodard at redhat dot com
2021-07-01 16:35 ` woodard at redhat dot com
2021-07-02  0:35 ` woodard at redhat dot com
2021-09-07 18:20 ` woodard at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).