[DynInst_API:] [PATCH] dyninstAPI: Set image::findMain's findings as LOCAL/INTERNAL


Date: Wed, 15 Jan 2014 11:33:18 -0800
From: Josh Stone <jistone@xxxxxxxxxx>
Subject: [DynInst_API:] [PATCH] dyninstAPI: Set image::findMain's findings as LOCAL/INTERNAL
When we look for new symbols in image::findMain, it's not really the
intent to make these global/exported symbols.  It doesn't matter so much
for live processes, but these shouldn't be exported in rewritten
binaries.  This patch sets them as LOCAL and INTERNAL instead.

Note, this is only for Linux and FreeBSD, but Windows may want it too.
---
 dyninstAPI/src/image.C | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/dyninstAPI/src/image.C b/dyninstAPI/src/image.C
index 7c83642124d9..11e4cfd0b1dd 100644
--- a/dyninstAPI/src/image.C
+++ b/dyninstAPI/src/image.C
@@ -482,8 +482,8 @@ void image::findMain()
             }
            	Symbol *newSym= new Symbol( "main", 
                                             Symbol::ST_FUNCTION,
-                                            Symbol::SL_GLOBAL, 
-                                            Symbol::SV_DEFAULT, 
+                                            Symbol::SL_LOCAL,
+                                            Symbol::SV_INTERNAL,
                                             mainAddress,
                                             linkedFile->getDefaultModule(),
                                             eReg, 
@@ -649,8 +649,8 @@ void image::findMain()
             	//logLine( "No static symbol for function main\n" );
                 Symbol *newSym = new Symbol("DYNINST_pltMain", 
                                             Symbol::ST_FUNCTION, 
-                                            Symbol::SL_GLOBAL,
-                                            Symbol::SV_DEFAULT,
+                                            Symbol::SL_LOCAL,
+                                            Symbol::SV_INTERNAL,
                                             mainAddress,
                                             linkedFile->getDefaultModule(),
                                             eReg, 
@@ -661,8 +661,8 @@ void image::findMain()
            {
            	Symbol *newSym= new Symbol( "main", 
                                             Symbol::ST_FUNCTION,
-                                            Symbol::SL_GLOBAL, 
-                                            Symbol::SV_DEFAULT, 
+                                            Symbol::SL_LOCAL,
+                                            Symbol::SV_INTERNAL,
                                             mainAddress,
                                             linkedFile->getDefaultModule(),
                                             eReg, 
@@ -674,8 +674,8 @@ void image::findMain()
     	{
             Symbol *startSym = new Symbol( "_start",
                                            Symbol::ST_FUNCTION,
-                                           Symbol::SL_GLOBAL,
-                                           Symbol::SV_DEFAULT, 
+                                           Symbol::SL_LOCAL,
+                                           Symbol::SV_INTERNAL,
                                            eReg->getMemOffset(),
                                            linkedFile->getDefaultModule(),
                                            eReg,
@@ -690,8 +690,8 @@ void image::findMain()
 	  if (linkedFile->findRegion(finisec,".fini")) {
 	    Symbol *finiSym = new Symbol( "_fini",
 					  Symbol::ST_FUNCTION,
-					  Symbol::SL_GLOBAL, 
-					  Symbol::SV_DEFAULT, 
+					  Symbol::SL_LOCAL,
+					  Symbol::SV_INTERNAL,
 					  finisec->getMemOffset(),
 					  linkedFile->getDefaultModule(),
 					  finisec, 
@@ -712,8 +712,8 @@ void image::findMain()
         {
 	    Symbol *newSym = new Symbol( "_DYNAMIC", 
 					Symbol::ST_OBJECT, 
-                                         Symbol::SL_GLOBAL, 
-                                         Symbol::SV_DEFAULT,
+                                         Symbol::SL_LOCAL,
+                                         Symbol::SV_INTERNAL,
                                          dynamicsec->getMemOffset(), 
                                          linkedFile->getDefaultModule(),
                                          dynamicsec, 
-- 
1.8.4.2

[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [PATCH] dyninstAPI: Set image::findMain's findings as LOCAL/INTERNAL, Josh Stone <=