public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: 桂永林 <guiyonglin@huaqin.com>
To: "Xi Ruoyao" <xry111@mengyan1223.wang>,
	"LIU Hao" <lh_mouse@126.com>,
	 "Tom Kacvinsky" <tkacvins@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>, 柳茂昕 <liumaoxin@huaqin.com>,
	李闯闯 <lichuangchuang@huaqin.com>, 汤汝 <tangru@huaqin.com>
Subject: Re:  Re: GCC link problem help!
Date: Thu, 21 Oct 2021 11:36:35 +0800 (GMT+08:00)	[thread overview]
Message-ID: <3515425a.16174.17ca0ec071d.Coremail.guiyonglin@huaqin.com> (raw)
In-Reply-To: <ff6294e94f738a9456bd246182146870dee4f14f.camel@mengyan1223.wang>

Hello Xi Ruoyao,
   Thanks for your reply! I can confirm that our hardware can work well, since if I link another C lib to replace the C++ lib with same function, the program can work well. So, I guess this problem maybe related with my c++ lib, and the only difference is that the c++ lib is build by G++ and g++linker. 
   If there is some special parameter we need check, when we link the c++ lib to C program with C linker? 
Thanks!
Best regards, 
Operagui




发件人:Xi Ruoyao <xry111@mengyan1223.wang>
发送时间:2021-10-21 00:17
主题:Re: GCC link problem help!
收件人:"桂永林/图灵研究院软件三部/图灵研究院"<guiyonglin@huaqin.com>,"LIU Hao"<lh_mouse@126.com>,"Tom Kacvinsky"<tkacvins@gmail.com>
抄送:"gcc-help"<gcc-help@gcc.gnu.org>,"柳茂昕/图灵研究院软件三部/图灵研究院"<liumaoxin@huaqin.com>,"李闯闯/图灵研究院软件三部/图灵研究院"<lichuangchuang@huaqin.com>,"汤汝/图灵研究院软件三部/图灵研究院"<tangru@huaqin.com>
 
On Wed, 2021-10-20 at 22:53 +0800, 桂永林 wrote: 
> Hellow Tom and Liu Hao, 
>    We encounter another GCC link problem. Our hardware is cotex-M33 
> platform,  our software project development on windows environment and 
> use GCC compiler and the gcc-linker as bellow: 
>  
>  
>    gcc version 7.3.1 20180622 (release) [ARM/embedded-7-branch 
> revision 261907] (GNU Tools for Arm Embedded Processors 7-2018-q2- 
> update) 
>  
>    GCC: GNU ISO C11  7 2018-q2-update  
>  
>    GCC parameter:  -std=gnu11 
>  
>    gcc-linker parameter: --specs=nano.specs --specs=nosys.specs 
>     
>    Our project need link a C++ static lib into our project. The C++ 
> lib build enviroment as bellow: 
>    G++:GNU ISO 2011 C++ 
>    G++ parameter:-std=gnu++11 -fabi-version=0 -fno-exceptions -fno- 
> rtti -fno-use-cxa-atexit -fno-non-call-exceptions 
>  
>  
>  
>    But we found that if we linked the C++ static lib to our program, 
> then the program have runtime logic problem sometimes. If we do not 
> link the C++ lib, it can run well. We can not understand why the 
> reason. We guess, if maybe some gcc linker parameter need used when we 
> need link the C++ lib?  
 
>    Can you give us some suggest about how to fix this problem!    
 
I think it will be very difficult to tell. Maybe there is some 
undefined behavior (for example, out-of-bound access) in your program 
and linking in libstdc++ just changes the memory layout or something and 
exploits the issue. The undefined behavior may be even triggered by 
some hardware problem for a embedded system... (I once debugged my 
program for one day and then found out one capacitor was simply too 
small!) 
--  
Xi Ruoyao <xry111@mengyan1223.wang> 
School of Aerospace Science and Technology, Xidian University 

  reply	other threads:[~2021-10-21  3:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11  3:23 GCC link error help! 桂永林
2021-10-11  5:10 ` Tom Kacvinsky
2021-10-11  6:43   ` LIU Hao
2021-10-11  7:57     ` 桂永林
2021-10-20 14:53     ` GCC link problem help! 桂永林
2021-10-20 16:17       ` Xi Ruoyao
2021-10-21  3:36         ` 桂永林 [this message]
2021-10-21 12:04           ` Xi Ruoyao
2021-10-21 12:34             ` Jonathan Wakely
2021-10-22  3:37               ` 桂永林
     [not found]               ` <617231DF.3080808@huaqin.com>
2021-10-22  3:39                 ` 桂永林
2021-10-22  7:06                   ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3515425a.16174.17ca0ec071d.Coremail.guiyonglin@huaqin.com \
    --to=guiyonglin@huaqin.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=lh_mouse@126.com \
    --cc=lichuangchuang@huaqin.com \
    --cc=liumaoxin@huaqin.com \
    --cc=tangru@huaqin.com \
    --cc=tkacvins@gmail.com \
    --cc=xry111@mengyan1223.wang \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).