-n/--nmagic disables page alignment of sections. Should it affect the target specific constants MAXPAGESIZE and COMMONPAGESIZE by changing them to 1? % cat a.lds maxpagesize = CONSTANT(MAXPAGESIZE); commonpagesize = CONSTANT(COMMONPAGESIZE); % as /dev/null -o a.o % ld.bfd -n a.o -T a.lds -o a % readelf -Ws a | grep pagesize 2: 0000000000001000 0 NOTYPE GLOBAL DEFAULT ABS commonpagesize 3: 0000000000200000 0 NOTYPE GLOBAL DEFAULT ABS maxpagesize Feel free to close the issue if CONSTANT(MAXPAGESIZE) / CONSTANT(COMMONPAGESIZE) are not supposed to change. I just have a feeling that making commonpagesize=maxpagesize=1 may simplify the implementation.
Hi Fanguri, It might be implied, but it certainly is not implemented or documented. I think that it would be best to leave things as they are. Changing the behaviour now would probably break somebody's program somewhere. Cheers Nick
Thanks for the reply. I've tried hard to find who are using both CONSTANT(COMMONPAGESIZE) and -n/-N in the wild. It looks only Tianocore edk2 (ab)uses -n -z common-page-size=0x20 to use CONSTANT(COMMONPAGESIZE) as if it were a preprocessor macro set with -D in the compiler. But not changing the behavior is also fine.