Help regarding architecture and related info needed for ELF header

2023-07-12 Thread Rishi Raj via Gcc
Hi,
As mentioned earlier in previous thread, I am working on a project to
bypass the assembler. I have already finished addition of .symtab section.
While I am currently working to emit the debugging symbols directly from
compiler, one thing which I missed was directly outputting the various info
like architecture, machine type and OS ABI in ELF header rather than
reading it from crtbegin.o. I tried my hand at it but couldn't find
anything substantial. Any suggestion regarding the same will be helpful!

Also a question to Jan and Martin, right now should I focus on debugging
part or get this done before moving to it?

--
Rishi


Re: GCC support addition for Safety compliances

2023-07-12 Thread David Brown via Gcc

On 12/07/2023 14:43, Jonathan Wakely via Gcc wrote:

On Wed, 12 Jul 2023 at 10:25, Vishal B Patil via Gcc  wrote:


Hi Team,

Any updates ?


You're not going to get any useful answers.

You asked "Please share the costs and time as well." Costs for what? From whom?

GCC is an open-source project with a diverse community of hundreds of
contributors. Who are you asking to give you costs? What work are you
expecting them to do?

It is unlikely that you obtained GCC from https://gcc.gnu.org so you
should probably talk to whoever provided you with your GCC binaries.


Most people get their GCC binaries for free, and no such source is going 
to be able to help for safety compliance or any other kind of 
certification.  Certification always costs time, effort and money.  But 
there are suppliers who provide toolchain binaries with commercial 
support contract, and which could help with certification.  I know Code 
Sourcery certainly used to be able to provide language compliance 
certification - I have no idea if they still can (it seems they are part 
of Siemens these days).  Maybe Red Hat (part of IBM) can do so too, and 
possibly others.  But perhaps that will give the OP a starting point.


David



For safety compliance you will probably need to talk to a third-party
who specializes in that. I don't think you will achieve anything by
asking the GCC project to do that for you.

That's not how open source projects work.





Regards,
Vishal B Patil

vishal.b.pa...@cummins.com

Dahanukar Colony, Kothrud
Pune
Maharashtra
411038
India

-Original Message-
From: Vishal B Patil
Sent: Wednesday, July 5, 2023 4:18 PM
To: Basile Starynkevitch 
Subject: RE: GCC support addition for Safety compliances

Hi Team,

Thanks for the response.

Actually required for UL60730, UL6200. Please share the costs and time as well.

Regards,
Vishal B Patil

vishal.b.pa...@cummins.com

Dahanukar Colony, Kothrud
Pune
Maharashtra
411038
India

-Original Message-
From: Basile Starynkevitch 
Sent: Wednesday, July 5, 2023 4:07 PM
To: Vishal B Patil 
Subject: GCC support addition for Safety compliances

EXTERNAL SENDER: This email originated outside of Cummins. Do not click links 
or open attachments unless you verify the sender and know the content is safe.


Hello


Need support from the GCC GNU for the some safety compliances. Can you please 
guide or check which GCC support the safety compliances.

For safety compliance GCC is probably not enough.


Consider (if allowed by your authorities) using static analysis tools like 
https://frama-c.com/ or https://www.absint.com/products.htm


Be sure to understand what technically safety compliance means to you.
DOI178C? ISO26262?

Be also aware that safety compliance costs a lot of money and a lot of time. 
(you'll probably need a budget above 100k€ ou 100kUS$ and about a person*year 
of developer efforts)


--
Basile Starynkevitch  
(only mine opinions / les opinions sont miennes uniquement)
92340 Bourg-la-Reine, France
web page: starynkevitch.net/Basile/







Re: Network Services Alert#489707

2023-07-12 Thread Dave Blanchard
You know, if you useless cocksuckers would spend half as much energy and 
cleverness figuring out some kind of morally upright way to generate income 
instead of scamming retards on the internet, you'd be billionaires by now.

This is what "civilization" has devolved to; a world of grifters scamming other 
grifters. The only difference between this guy and the rest is that his scam is 
obvious to intelligent people; the most dangerous frauds are the most 
legitimate appearing, and are heavily promoted and legally enforced by 
"authorities." Rob a bank and you go to jail; own the bank and you can rob it 
all day long. We need to bring back the guillotine.

Dave

>On Wed, 12 Jul 2023 19:44:01 +0530
Michael Smith via Gcc  wrote:

> Dear user,  g...@gnu.org
> 
> Thank you again for subscribing to us!
> 
> [...]
>
> As you opted for auto-debit, the recurring fee will be debited again next 
> year on July 10, 2024, unless you choose to cancel the subscription or stop 
> auto-debit payments.
> 
> If you wish to opt out or drop all charges and want the full amount refunded 
> back to the original payment source, please contact us at +1 {888}-713-5735
> 
>  
> 
> Regards,,
> 
> Michael Smith
> Customer Support Dept.
> Toll-free Number: +1 {888}-713-5735
> 


Re: Suspicious code

2023-07-12 Thread Andreas Schwab via Gcc
This looks like being part of gas, so you need to ask on
.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Suspicious code

2023-07-12 Thread jacob navia
Consider this code:

1202 static fragS * get_frag_for_reloc (fragS *last_frag,
1203 const segment_info_type *seginfo,
1204 const struct reloc_list *r)
1205 {   
1206   fragS *f;
1207   
1208   for (f = last_frag; f != NULL; f = f->fr_next)
1209 if (f->fr_address <= r->u.b.r.address
1210 && r->u.b.r.address < f->fr_address + f->fr_fix)
1211   return f;
1212 
1213   for (f = seginfo->frchainP->frch_root; f != NULL; f = f->fr_next)
1214 if (f->fr_address <= r->u.b.r.address
1215 && r->u.b.r.address < f->fr_address + f->fr_fix)
1216   return f;
1217   
1218   for (f = seginfo->frchainP->frch_root; f != NULL; f = f->fr_next)
1219 if (f->fr_address <= r->u.b.r.address
1220 && r->u.b.r.address <= f->fr_address + f->fr_fix)
1221   return f;
1222 
1223   as_bad_where (r->file, r->line,
1224 _("reloc not within (fixed part of) section"));
1225   return NULL;
1226 }

This function consists of 3 loops: 1208-1211, 1213 to 1216 and 1218 to 1221. 

Lines 1213 - 1216 are ALMOST identical to lines 1218 to 1221. The ONLY 
difference that I can see is that the less in line 1215 is replaced by a less 
equal in line 1220.

But… why?

This code is searching the fragment that contains a given address in between 
the start and end addresses of the frags in question, either in the fragment 
list given by last_frag or in the list given by seginfo.

To know if a fragment is OK you should start with the given address and stop 
one memory address BEFORE the limit given by fr_address + f->fr_fix. That is 
what the first two loops are doing. The third loop repeats the second one and 
changes the less to less equal, so if fr_address+fr_fix is one MORE than the 
address it will still pass.

Why it is doing that? 

If that code is correct, it is obvious that we could merge the second and third 
loops and put a <= in t he second one and erase the third one… UNLESS priority 
should be given to matches that are less and not less equal, what seems 
incomprehensible … to me.

This change was introduced on Aug 18th 2011 by Mr Alan Modra with the rather 
terse comment: "(get_frag_for_reloc): New function. ». There are no further 
comments in the code at all.

This code is run after all relocations are fixed just before the software 
writes them out. The code is in file « write.c » in the gas directory. Note 
that this code runs through ALL relocations lists each time for EACH 
relocation, so it is quite expensive. In general the list data structure is not 
really optimal here but that is another story.

Thanks in advance for your help.

Jacob

analyzer: New state machine should be C++ only

2023-07-12 Thread Benjamin Priour via Gcc
Hi David,


Lately I've been working on adding a new state machine to keep track of
ownership transfers

and misuses, e.g. to warn about use-after-move, partial or shallow
copy/move.

I'm trying to stay abstracted from heap allocated regions, and to rather
work with "resources",

so that the state machine could be easily further extended.

However, the whole concern of ownership is really C++-like, and most of the
checks would require

things unheard of in vanilla C, such as copy/move operators, ctors & dtors
...


Using those constructs, it is really doable to guess ownership of
resources, whereas without them it becomes

much more hazardous.

So, should we make this new sm -adroitly called sm-ownership- C++-only ?


Doing so would allow the sm to reuse code from under cp/*, thus it'd reduce
duplicating code and would

likely lead to less false positives in C++ -more precise function checks-,
though it would make any future C-support more tedious.

It's also going against the current flow of porting what's already done for
C to C++.


Best,

Benjamin.


Re: GCC support addition for Safety compliances

2023-07-12 Thread Jonathan Wakely via Gcc
On Wed, 12 Jul 2023 at 10:25, Vishal B Patil via Gcc  wrote:
>
> Hi Team,
>
> Any updates ?

You're not going to get any useful answers.

You asked "Please share the costs and time as well." Costs for what? From whom?

GCC is an open-source project with a diverse community of hundreds of
contributors. Who are you asking to give you costs? What work are you
expecting them to do?

It is unlikely that you obtained GCC from https://gcc.gnu.org so you
should probably talk to whoever provided you with your GCC binaries.
For safety compliance you will probably need to talk to a third-party
who specializes in that. I don't think you will achieve anything by
asking the GCC project to do that for you.

That's not how open source projects work.



>
> Regards,
> Vishal B Patil
>
> vishal.b.pa...@cummins.com
>
> Dahanukar Colony, Kothrud
> Pune
> Maharashtra
> 411038
> India
>
> -Original Message-
> From: Vishal B Patil
> Sent: Wednesday, July 5, 2023 4:18 PM
> To: Basile Starynkevitch 
> Subject: RE: GCC support addition for Safety compliances
>
> Hi Team,
>
> Thanks for the response.
>
> Actually required for UL60730, UL6200. Please share the costs and time as 
> well.
>
> Regards,
> Vishal B Patil
>
> vishal.b.pa...@cummins.com
>
> Dahanukar Colony, Kothrud
> Pune
> Maharashtra
> 411038
> India
>
> -Original Message-
> From: Basile Starynkevitch 
> Sent: Wednesday, July 5, 2023 4:07 PM
> To: Vishal B Patil 
> Subject: GCC support addition for Safety compliances
>
> EXTERNAL SENDER: This email originated outside of Cummins. Do not click links 
> or open attachments unless you verify the sender and know the content is safe.
>
>
> Hello
>
> > Need support from the GCC GNU for the some safety compliances. Can you 
> > please guide or check which GCC support the safety compliances.
> For safety compliance GCC is probably not enough.
>
>
> Consider (if allowed by your authorities) using static analysis tools like 
> https://frama-c.com/ or https://www.absint.com/products.htm
>
>
> Be sure to understand what technically safety compliance means to you.
> DOI178C? ISO26262?
>
> Be also aware that safety compliance costs a lot of money and a lot of time. 
> (you'll probably need a budget above 100k€ ou 100kUS$ and about a person*year 
> of developer efforts)
>
>
> --
> Basile Starynkevitch  
> (only mine opinions / les opinions sont miennes uniquement)
> 92340 Bourg-la-Reine, France
> web page: starynkevitch.net/Basile/
>


RE: GCC support addition for Safety compliances

2023-07-12 Thread Vishal B Patil via Gcc
Hi Team,

Any updates ?

Regards,
Vishal B Patil

vishal.b.pa...@cummins.com

Dahanukar Colony, Kothrud
Pune
Maharashtra
411038
India

-Original Message-
From: Vishal B Patil 
Sent: Wednesday, July 5, 2023 4:18 PM
To: Basile Starynkevitch 
Subject: RE: GCC support addition for Safety compliances

Hi Team,

Thanks for the response.

Actually required for UL60730, UL6200. Please share the costs and time as well.

Regards,
Vishal B Patil

vishal.b.pa...@cummins.com

Dahanukar Colony, Kothrud
Pune
Maharashtra
411038
India

-Original Message-
From: Basile Starynkevitch  
Sent: Wednesday, July 5, 2023 4:07 PM
To: Vishal B Patil 
Subject: GCC support addition for Safety compliances

EXTERNAL SENDER: This email originated outside of Cummins. Do not click links 
or open attachments unless you verify the sender and know the content is safe.


Hello

> Need support from the GCC GNU for the some safety compliances. Can you please 
> guide or check which GCC support the safety compliances.
For safety compliance GCC is probably not enough.


Consider (if allowed by your authorities) using static analysis tools like 
https://frama-c.com/ or https://www.absint.com/products.htm


Be sure to understand what technically safety compliance means to you.
DOI178C? ISO26262?

Be also aware that safety compliance costs a lot of money and a lot of time. 
(you'll probably need a budget above 100k€ ou 100kUS$ and about a person*year 
of developer efforts)


--
Basile Starynkevitch  
(only mine opinions / les opinions sont miennes uniquement)
92340 Bourg-la-Reine, France
web page: starynkevitch.net/Basile/