On 8/12/26 18:48, John David Anglin wrote:

If you add -save-temps to the compile options for your program, the .i, .s and 
.o files
will be generated.  I suspect you will only see memset.constprop.0 in the .s 
and .o
intermediate files.  However, there are likely some undefined symbols in the .o 
that
need to be resolved by linking against libgcc.  There are millicode routines in 
it for
multiplication, etc, and routines for unwind EH support (e.g., 
uw_frame_state_for) that
use memset.

The binary is actually linked against libgcc too, that's not the  problem.

-save-temps helps ofc, but the output is quite a bit too large.  I was trying to
simplify the thing.  But it looks like the prob has been identified already...

It feels like the prob is .constprop.0 suffix, added with -fwhole-program?  
Because
...
Without -fwhole-program it seems to work.  But I dunno if the resulting binary
works.

At the moment, I would say hppa is not compatible with -fwhole-program.  The
simplest fix might be to add "_attribute__((used, externally_visible))" to the 
memcpy
declaration in your code.

And this one helps to finish the build, and it finishes successfully.

This what google said about this:
[...]
I see. It's a fun stuff.

So, for the time being, I'm including this workaround.  For the future, I
guess something has to be done with the build system to avoid -fwhole-program
(Cc'ing Helge Deller).

BTW, this is the complete compiler command line:

hppa64-linux-gnu-gcc -I. -Io64/ -Isrc -Ivgasrc -Os -MD -g \
 -Wall -Wno-strict-aliasing -Wold-style-definition 
-Wno-address-of-packed-member \
 -Wno-stringop-overflow -Wno-array-bounds -Wtype-limits \
 -fomit-frame-pointer -freg-struct-return -ffreestanding 
-fno-delete-null-pointer-checks \
 -fdata-sections -fno-common -fno-merge-constants -mdisable-fpregs 
-fno-builtin-printf \
 -fno-ipa-sra -fno-pie -fno-stack-protector -fstack-check=no 
-Wno-pointer-to-int-cast \
 -Wno-int-to-pointer-cast -DMODE16=0 -DMODESEGMENT=0 -fwhole-program 
-DWHOLE_PROGRAM \
 -c o64/ccode32flat.o.tmp.c -o o64/ccode32flat.o

Without -fwhole-program there are numerous error messages in there, such as
"impossible constraint in 'asm'" - many of them.  Different optimization levels 
-
such as omitting -Os - gives the same errors too.

Thank you very much for the help!

/mjt

Reply via email to