----------------------------------------------------------------------*/
LIBGOBLIN_BINFO_EXTERN
int
+ LibGoblin_BinInfo_SetRPath(
+ LibGoblin_BinaryInfo *p_binfo,
+ const char *pstr_rpath )
+{
+ int i_len;
+ char str_src[MAXPATHLEN];
+ char str_dest[MAXPATHLEN];
+ char *pstr_result;
+
+ if( LIBGOBLIN_BINFO_PHASE_SETPROG > p_binfo->b_phase ) {
+ return -0x01;
+ }
+
+ memset( str_src, 0x00, MAXPATHLEN );
+
+ i_len = strnlen( p_binfo->str_path, DRD64_MAX_PATH );
+ strncpy( str_src, p_binfo->str_path, i_len + 1 );
+ str_src[ i_len ] = '/';
+ strncat( str_src, pstr_rpath, (MAXPATHLEN - i_len - 1) );
+
+ pstr_result = realpath( str_src, str_dest );
+ if( NULL == pstr_result ) {
+ return -0x02;
+ }
+
+ i_len = strnlen( str_dest, MAXPATHLEN );
+ if( DRD64_MAX_PATH <= i_len ) {
+ return -0x03;
+ }
+ strncpy( p_binfo->str_rpath, str_dest, DRD64_MAX_PATH );
+
+ return 0x00;
+}
+
+
+/*----------------------------------------------------------------------
+----------------------------------------------------------------------*/
+LIBGOBLIN_BINFO_EXTERN
+int
LibGoblin_BinInfo_SetProgramName(
LibGoblin_BinaryInfo *p_binfo,
const char *pstr_progname )
LIBGOBLIN_BINFO_EXTERN
LibGoblin_BinaryInfo *LibGoblin_BinInfo_GetBinInfo( int i_bid );
LIBGOBLIN_BINFO_EXTERN
+ int LibGoblin_BinInfo_SetRPath(
+ LibGoblin_BinaryInfo *p_binfo, const char *pstr_rpath );
+LIBGOBLIN_BINFO_EXTERN
int LibGoblin_BinInfo_SetProgramName(
LibGoblin_BinaryInfo *p_binfo, const char *pstr_progname );
LIBGOBLIN_BINFO_EXTERN
if( DT_NEEDED == qw_tag ) {
p_bintmp = LibGoblin_ProgInfo_AddBinaryInfo( p_pginfo );
LibGoblin_BinInfo_SetProgramName( p_bintmp, ((char *)(pb_dynstr + qw_value)) );
- //printf("%s\n", pb_dynstr + qw_value );
}
else if( DT_RPATH == qw_tag ) {
- strncpy( p_binfo->str_rpath, (char *)(pb_dynstr + qw_value), DRD64_MAX_PATH );
+ LibGoblin_BinInfo_SetRPath( p_binfo, (const char *)(pb_dynstr + qw_value) );
}
/*
else if( DT_SONAME == qw_tag ) { }
#
## TESTPG_HEADER =
+FLAGS_LINKER = -L. -lm -Xlinker -rpath -Xlinker .
+
TESTPG02_TARGET_FULL = dwarftest
TESTPG02_TARGET_NODBG = dwarfnodbg
TESTPG02_DBGFILE = dwarfnodbg.dbg
$(CC) -o datatype.o $(FLAGS_DEBUG) -c datatype.c
$(CC) -o ctrltest.o $(FLAGS_DEBUG) -c ctrltest.c
$(CC) -o calcfloat.o $(FLAGS_DEBUG) -c calcfloat.c
- $(CC) -o $(TESTPG02_TARGET_FULL) $(FLAGS_DEBUG) $(TESTPG02_OBJ) -I. -L. -lsotest -lm
+ $(CC) -o $(TESTPG02_TARGET_FULL) $(FLAGS_DEBUG) $(TESTPG02_OBJ) -I. $(FLAGS_LINKER) -lsotest
cp $(TESTPG02_TARGET_FULL) ../..
$(TESTPG02_TARGET_NODBG): $(TESTPG02_OBJ) $(TESTPG02_SOLIB_NODBG)
- $(CC) -o $(TESTPG02_TARGET_NODBG) $(FLAGS_DEBUG) $(TESTPG02_OBJ) -I. -L. -lsonodbg -lm
+ $(CC) -o $(TESTPG02_TARGET_NODBG) $(FLAGS_DEBUG) $(TESTPG02_OBJ) -I. $(FLAGS_LINKER) -lsonodbg
objcopy --only-keep-debug $(TESTPG02_TARGET_NODBG) $(TESTPG02_DBGFILE)
objcopy --strip-debug $(TESTPG02_TARGET_NODBG)
objcopy --add-gnu-debuglink=$(TESTPG02_DBGFILE) $(TESTPG02_TARGET_NODBG)